PageSourceSearch

https://static.onsitego.com/_next/static/chunks/8608-b83d165019ec515c.js

js onsitego.com collected 2026-10-02 05:06:32 UTC 10,799 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8608],{98608:function(e,a,t){t.d(a,{P:function(){return AddressPopup}});var n=t(24043),i=t(85893),d=t(20873),s=t.n(d),l=t(47718),o=t(67294),r=t(88850),c=t(71623),u=t(46529),m=t(72749),v=t(99099),h=t(96416),p=t(67162),g=t(58762),f=t(39173),x=t(2664),_=t(40842),AddressPopup=function(e){var a=(0,n._)((0,o.useState)(!1),2),t=a[0],d=a[1],y=(0,n._)((0,o.useState)(""),2),j=y[0],k=y[1],N=(0,n._)((0,o.useState)(""),2),b=N[0],S=N[1],A=(0,n._)((0,o.useState)(""),2),O=A[0],C=A[1],E=(0,n._)((0,o.useState)(""),2),w=E[0],L=E[1],F=(0,n._)((0,o.useState)(""),2),P=F[0],T=F[1],D=(0,n._)((0,o.useState)(""),2),M=D[0],Z=D[1],q=(0,n._)((0,o.useState)(!1),2),R=q[0],V=q[1],B=(0,n._)((0,o.useState)({lat:19.10547002800624,lng:72.8811771561344}),2),G=B[0],H=B[1],I=(0,n._)((0,o.useState)({lat:19.10547002800624,lng:72.8811771561344}),2),K=I[0],J=I[1],z=(0,n._)((0,o.useState)({lat:19.10547002800624,lng:72.8811771561344}),2),Q=z[0],U=z[1],W=(0,n._)((0,o.useState)(""),2),X=W[0],Y=W[1],$=(0,n._)((0,o.useState)(""),2),ee=$[0],ea=$[1],et=(0,n._)((0,o.useState)("Other"),2),en=et[0],ei=et[1],ed=(0,n._)((0,o.useState)(!1),2),es=ed[0],el=ed[1],eo=(0,n._)((0,o.useState)({pincode:void 0,address:void 0,landmark:void 0,label:void 0}),2),er=eo[0],ec=eo[1],eu=(0,n._)((0,o.useState)(!1),2),em=eu[0],ev=eu[1],eh=(0,n._)((0,o.useState)(!0),2),ep=eh[0],eg=eh[1],ef=(0,x.I0)(),ex=["Home","Office","Other"],e_=ex.filter(function(a){return!e.existing_label.includes(a)});"Other"===X||""===X||e_.includes(X)||e_.push(X),""===ee||"Other"===ee||e_.includes(ee)||e_.push(ee),e_.includes("Other")||e_.push("Other"),e_.sort(),(0,o.useEffect)(function(){Y(e_[0]),"edit"!==e.mode&&"verify"!==e.mode||(k(e.data.pincode),S(e.data.city),C(e.data.state),T(e.data.address),L(e.data.landmark),(0,g.kT)({text:e.data.address+e.data.pincode,type:"geocode"}).then(function(e){if(e){var a,t;J({lat:null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.results[0].geometry.location.lat,lng:null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.results[0].geometry.location.lng})}}).catch(function(e){return console.log(e)}),e.data.lat&&e.data.lng?(H({lat:Number(e.data.lat),lng:Number(e.data.lng)}),U({lat:Number(e.data.lat),lng:Number(e.data.lng)})):(0,g.kT)({text:e.data.address+e.data.pincode,type:"geocode",source:"Address Management"}).then(function(e){if(e){var a,t,n=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.results[0].geometry.location.lat,i=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.results[0].geometry.location.lng;H({lat:n,lng:i}),U({lat:n,lng:i})}}).catch(function(e){return console.log(e)}),ex.includes(e.data.label)&&"Other"!==e.data.label?Y(e.data.label):(ei(e.data.label||"Other"),Y("Other")),e.data.address||ec({address:"Required field"}))},[e.mode]);var ey=(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"popup-info",children:[(0,i.jsx)("div",{className:es||em?"error_desc map_desc":"map_desc",children:es||em?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:"heading",children:es?"Selected location is different from the entered address":"Address is outside of entered pincode"}),(0,i.jsx)("p",{className:"go_back",onClick:function(){updateTempLatLong(G.lat,G.lng),em&&(ev(!1),T(""),ec({address:""}))},children:"< Go Back"})]}):R&&P||"edit"===e.mode?(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("p",{className:"heading",children:"Place the pin accurately on the map"})}):(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("p",{className:"heading",children:"Hi, we have spotted your location"})})}),(0,i.jsx)("div",{className:"map_marker",children:(0,i.jsx)(l.Z,{src:(0,v.lg)("/static/images/home/kyc_marker.png"),width:"16",height:"36"})}),(0,i.jsxs)("div",{className:"map_loader",children:[(0,i.jsx)("div",{className:"circle"}),(0,i.jsx)("div",{className:"circle"})]})]})}),checkServiceable=function(a){if(e.isSelfserve){var t={token_id:e.selfserveReducer.token_id,osid:e.selfserveReducer.planDetails.osid,pincode:a};(0,f.GC)({application:"website",data:JSON.stringify(t)}).then(function(e){e&&e.data&&(S(e.data.city),C(e.data.state))})}
1else e.isMyAccount||e.isActivation?(0,g.kT)({text:a,type:"geocode",source:"myaccount"}).then(function(e){e&&e.data&&(S(e.data.city),C(e.data.state))}):(0,p.Cd)(e.cart.token_id,{application:"website",pincode:a}).then(function(a){a&&a.data&&(e.cart.items.filter(function(e){return!e.serviceable}).length,S(a.data.city),C(a.data.state))})},handlePincode=function(e){if(!isNaN(e.target.value)&&(k(e.target.value.trim()),6==e.target.value.length)){checkServiceable(e.target.value);var a=e.target.value;(0,g.kT)({text:a,type:"geocode",source:"Address Management"}).then(function(e){if(e){var a,t,n=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.results[0].geometry.location.lat,i=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.results[0].geometry.location.lng;H({lat:n,lng:i}),U({lat:n,lng:i}),J({lat:n,lng:i}),document.querySelector("input#address").focus()}})}},locationEnterAction=function(e){if(e.length>2){var a=e+", "+j;(0,g.kT)({text:a,type:"geocode",source:"Address Management"}).then(function(e){if(e){var a,t,n,i,d,s=null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.results[0].geometry.location.lat,l=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.results[0].geometry.location.lng,o=null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.results[0].address_components,r=(o||[]).filter(function(e){return e.types.includes("postal_code")}),c=(o||[]).filter(function(e){return e.types.includes("locality")}),u=(0,v.xm)(s,l,K.lat,K.lng);(null==r?void 0:null===(i=r[0])||void 0===i?void 0:i.long_name.slice(0,3))===j.slice(0,3)||c&&(null==c?void 0:null===(d=c[0])||void 0===d?void 0:d.long_name.trim().toLowerCase())===b.trim().toLocaleLowerCase()||u<5e4?(H({lat:s,lng:l}),U({lat:s,lng:l}),V(!0),ec({address:""}),ev(!1),Z(P),eg(!1),document.querySelector("input#landmark").focus()):(ev(!0),U({lat:s,lng:l}),V(!0),eg(!1),ec({address:"Address is outside of entered pincode"}))}}).catch(function(e){return ec({address:"Enter valid address. Please contact support."})})}},submitDetails=function(){var a,t=e.existing_label.filter(function(e){return null!==e}).map(function(e){return e.toLowerCase()});if(P&&j&&O&&b&&X){if("Other"===X&&""===en)ec({label:"Please add a nickname"});else if("Other"===X&&en&&""!==en&&t.includes(en.trim().toLowerCase())&&en!==(null==e?void 0:null===(a=e.data)||void 0===a?void 0:a.label))ec({label:"This nickname already exists"});else if(!1===R)ec({address:"Please click on enter"});else{var n={};n.address=P,n.landmark=w,n.label="Other"===X?en.trim():X,n.lat=Number(Q.lat.toString().slice(0,10)),n.lng=Number(Q.lng.toString().slice(0,10)),n.customer_token=e.token,"edit"===e.mode||"verify"===e.mode?((0,p.EN)(n,e.id),ef((0,_.y3)(n,e.id)),e.updateEditMode(!1,e.mode,e.data,"Saved")):(n.pincode=j,n.city=b,n.state=O,(0,p.Fp)(n).then(function(e){e&&ef((0,_.kH)(e.data))}),e.updateEditMode(!1,e.mode,n,"Saved")),e.updateVerify(!1)}}},updateTempLatLong=function(e,a){U({lat:e,lng:a})},handleInput=function(e){ei(e.target.value)};return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(r.default,{className:s().address_popup,isPlainBG:!0,isFullScreen:t,isOpen:!0,medium:!0,xlarge:!1,onClick:function(){e.isKyc||e.isActivation?e.onDiscard():(e.updateEditMode(!1,e.mode,e.data,"Not Saved"),("edit"===e.mode||"verify"===e.mode)&&e.updateVerify(!1))},children:["edit"===e.mode&&!e.verify&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h6",{children:"Edit Address"}),(0,i.jsx)("p",{children:"Our Engineer will arrive at this location to provide the service"})]}),"verify"===e.mode&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h6",{children:"Verify Service Address"}),(0,i.jsx)("p",{children:"Our engineer will arrive at this location to provide the service"})]}),"new"===e.mode&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("h6",{children:"Add Service Address"}),(0,i.jsx)("p",{children:"Our Engineer will arrive at this location to provide the service"})]}),(0,i.jsxs)("div",{className:s().pincode_field,children:[(0,i.jsx)(c.Z,{className:s().pincode,placeholder:"Enter your 6 digit pincode",label:"Pincode",onChange:function(e){handlePincode(e)},isRequired:!0,value:j,isDisabled:"edit"===e.mode||"verify"===e.mode,maxLength:6,isAutoFocus:"new"===e.mode}),(0,i.jsx)(c.Z,{className:s().state,placeholder:"-",label:"City/State",onCh
1ange:function(){},value:"".concat(b?"".concat(b,", ").concat(O):""),isDisabled:!0})]}),(0,i.jsx)("div",{className:"".concat(s().address_field_div," ").concat(s().address_div),children:(0,i.jsx)(c.Z,{className:s().address_field,isAutoFocus:"new"!==e.mode,placeholder:"Enter house/flat, area, locality",value:P,label:"Address",onChange:function(e){T(e.target.value.trimStart()),ec({address:""}),P.length>2&&eg(!0)},isRequired:!0,enterClick:locationEnterAction,propsError:er.address,isEnter:!0,maxLength:200,addressEnter:R,isDisabled:"new"===e.mode&&6!=j.length,enterEnabled:ep,id:"address"})}),(0,i.jsx)("div",{className:s().address_field_div,children:(0,i.jsx)(c.Z,{className:"".concat(s().address_field," ").concat(s().landmark_noleftpad),placeholder:"Enter street/landmark",value:w,label:"Landmark",onChange:function(e){L(e.target.value)},id:"landmark",onFocus:function(){ep&&locationEnterAction(P)}})}),(0,i.jsxs)("div",{className:s().address_nickname,children:[(0,i.jsx)("p",{children:"Nickname:"}),e_.map(function(e){return(0,i.jsx)("span",{className:e===X?s().nickname:"",onClick:function(){ea(X),Y(e)},children:e})}),"Other"===X&&(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:s().address_nickname_input,children:[(0,i.jsxs)("div",{style:{position:"relative",display:"flex"},children:[(0,i.jsx)("input",{className:s().nickname_input,placeholder:"Nickname Address",required:!0,value:en,onChange:function(e){ec({label:""}),handleInput((0,v.b0)(e))},id:"nickname"}),en&&(0,i.jsx)("div",{className:s().cross_button,onClick:function(){ei("")}})," "]}),er.label&&(0,i.jsxs)("p",{className:s().textfield__error,children:[er.label," "]})]})})]}),(0,i.jsx)("div",{className:"".concat(s().map," map"),children:(0,i.jsx)(m.Z,{toggleFullScreen:function(e){d(e),e?(0,h.yR)():(0,h.hT)()},draggable:j&&("new"!==e.mode||R),coord:Q,prevCoord:G,infobox:ey,outOfPincode:em,setOutOfBound:function(e){el(e)},updateLatLong:updateTempLatLong})}),(0,i.jsxs)("div",{className:s().actions,children:[(0,i.jsx)(u.Z,{className:s().discard,text:"Discard",onClick:function(){e.isKyc||e.isActivation?e.onDiscard():(e.updateEditMode(!1,e.mode,e.data,"Not Saved"),e.updateVerify(!1))}}),(0,i.jsx)(u.Z,{className:s().save,text:"Save",disabled:!j||!b||!O||!P||!X||!R||es||em||M!==P||"Other"===X&&!en,onClick:function(){e.isKyc||e.isActivation?e.onSave(P,X,en,w,Q,O,j,b):submitDetails()}})]})]})})}}}]);
2//# sourceMappingURL=8608-b83d165019ec515c.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.