1import{b as T,c as he}from"./chunk-VPXP2N2Q.js";import{a as ce}from"./chunk-HB6SYD54.js";import{a as P}from"./chunk-2ZOJC5WM.js";import{a as ue}from"./chunk-O2MJTLNI.js";import{a as A}from"./chunk-JS6R4UJZ.js";import{a as D}from"./chunk-CAO24PDZ.js";import{B as le,C as me,D as pe,b as J,c as Q,e as x,h as ee,i as te,l as G,n as ie,p as ne,s as oe,t as re,x as se,y as ae,z as de}from"./chunk-V4RBVOVY.js";import{g as w}from"./chunk-ERNBO6RL.js";import{g,q as y,z as xe}from"./chunk-HVHJBPYH.js";import{e as Z}from"./chunk-HGDZ6AMD.js";import"./chunk-LSBESHNF.js";import"./chunk-BVHX55FD.js";import"./chunk-XKES3XAV.js";import{Oa as W,U as K,ua as $}from"./chunk-MI6MLOSR.js";import{Bc as N,Cc as B,Nb as m,Ob as p,Oc as z,Qb as H,Rb as q,Sb as X,Tb as C,Ub as n,Vb as o,Wb as h,_ as M,_a as d,bc as F,da as v,ea as S,fa as R,hb as I,ic as b,kc as c,ob as L,pa as E,tb as U,xc as j,yc as Y,zc as e}from"./chunk-EOSBAT63.js";import"./chunk-UGY2Q5IC.js";import{a as V,b as O}from"./chunk-ZGVHDELW.js";var s=(function(i){return i.PAN="pan",i.PINCODE="pincode",i.GSTIN="gstin",i.EMAIL="email",i.SAME_SHIPPING_ADDRESS="sameShippingAddress",i.SAME_BILLING_ADDRESS="sameBillingAddress",i.PHONE="phone",i.OTP="otp",i.NAME="name",i.ADDRESS="address",i.ADDRESS2="address2",i.BUSINESS_NAME="businessName",i.LAND_MARK="landmark",i.DEFAULT="default",i.ALTERNATE_PHONE="alternatePhone",i.LOCATION_TYPE_TAG="locationTypeTag",i.CITY="city",i.STATE="state",i})(s||{});var fe=i=>({"md:mt-12":i});function ge(i,l){if(i&1){let t=F();e(0,` 2 `),n(1,"span"),e(2," "),o(),e(3,` 3 `),n(4,"span",23),b("click",function(){v(t);let r=c();return S(r.performAction(r.slot.widget.data.value.backButton==null?null:r.slot.widget.data.value.backButton.action))}),e(5,` 4 `),n(6,"span"),e(7,` 5 `),R(),n(8,"svg",24),e(9,` 6 `),h(10,"path",25),e(11,` 7 `),h(12,"path",26),e(13,` 8 `),o(),e(14,` 9 `),o(),e(15),o(),e(16,` 10 `)}if(i&2){let t=c();d(15),N(` 11 `,t.slot.widget.data.value.backButton==null||t.slot.widget.data.value.backButton.value==null?null:t.slot.widget.data.value.backButton.value.text,` 12 `)}}function _e(i,l){i&1&&e(0,` 13 GST Number 14 `)}function ve(i,l){i&1&&e(0,` 15 Add GSTIN and click verify to claim input tax credit on this 16 purchase. 17 `)}function Se(i,l){if(i&1){let t=F();e(0,` 18 `),n(1,"button",28),b("click",function(){v(t);let r=c(2);return S(r.verifyGST())}),e(2,` 19 Verify 20 `),o(),e(3,` 21 `)}}function Ee(i,l){if(i&1&&(e(0,` 22 `),h(1,"img",29),e(2,` 23 `)),i&2){let t=c(2);d(),C("ngSrc",t.data==null?null:t.data.verifiedGstinImg)("height",20)("width",20)}}function be(i,l){if(i&1&&(e(0,` 24 `),n(1,"div",30),e(2),o(),e(3,` 25 `)),i&2){let t,a=c(2);d(2),N(` 26 `,((t=a.addressForm.get("gstin"))==null||t.errors==null?null:t.errors.invalidGstinError)||"Enter a valid GSTIN number.",` 27 `)}}function Ce(i,l){if(i&1){let t=F();e(0,` 28 `),n(1,"div"),e(2,` 29 `),n(3,"div",5),e(4,` 30 `),m(5,_e,1,0)(6,ve,1,0),o(),e(7,` 31 `),n(8,"div",7),e(9,` 32 `),n(10,"input",27),b("keyup",function(){v(t);let r=c();return S(r.verifiedGstinNumber())}),o(),e(11,` 33 `),m(12,Se,4,0),m(13,Ee,3,3),o(),e(14,` 34 `),m(15,be,4,1),o(),e(16,` 35 `)}if(i&2){let t=c();d(5),p(t.isSignUp()?5:6),d(5),C("disabled",t.readOnly().gstin)("readonly",t.readOnly().gstin),d(2),p(t.gstinVerified()?-1:12),d(),p(t.addressForm.get("gstin").value&&t.gstinVerified()?13:-1),d(2),p(t.shouldShowGstinError()?15:-1)}}function Fe(i,l){if(i&1){let t=F();e(0,` 36 `),n(1,"li",35),b("click",function(){let r=v(t).$implicit,_=c(2);return S(_.selectOption(r))}),e(2),o(),e(3,` 37 `)}if(i&2){let t=l.$implicit;d(2),B(` 38 `,t.state," - ",t.gstin,` 39 `)}}function Ne(i,l){if(i&1&&e(0),i&2){let t=c(2);N(` 40 No GSTIN Registered for this pan: `,t.addressForm.value.pan,` 41 `)}}function Te(i,l){if(i&1){let t=F();e(0,` 42 `),n(1,"div",31),e(2,` 43 `),n(3,"div",32),e(4,` 44 `),n(5,"h2"),e(6),o(),e(7,` 45 `),n(8,"span"),e(9," Select one gst to continue "),o(),e(10,` 46 `),o(),e(11,` 47 `),n(12,"ul",33),e(13,` 48 `),q(14,Fe,4,2,null,null,H,!1,Ne,1,1),o(),e(17,` 49 `),n(18,"button",34),b("click",function(){v(t);let r=c();return S(r.closeGSTOptions())}),e(19,` 50 Close 51 `),o(),e(20,` 52 `),o(),e(21,` 53 `)}if(i&2){let t=c();d(6),B(` 54 Found `,t.gstOptions.length,` gstin for PAN: 55 `,t.addressForm.value.pan,` 56 `),d(8),X(t.gstOptions)}}function ye(i,l){i&1&&(e(0,` 57 `),n(1,"div"),e(2,` 58 `),n(3,"div",5),e(4,` 59 GST Number 60 `),o(),e(5,` 61 `),n(6,"div",7),e(7,` 62 `),h(8,"input",37),e(9,` 63 `),o(),e(10,` 64 `),o(),e(11,` 65 `))}function we(i,l){if(i&1&&(e(0,` 66 `),m(1,ye,12,0),n(2,"div",4),e(3,` 67 `),n(4,"div",5),e(5,`
68 Business Name`),n(6,"span",6),e(7,"*"),o(),e(8,` 69 `),o(),e(9,` 70 `),n(10,"div",7),e(11,` 71 `),h(12,"input",36),e(13,` 72 `),o(),e(14,` 73 `),o(),e(15,` 74 `)),i&2){let t=c();d(),p(t.addressForm.get("businessVerificationOption").value!="GST"?1:-1)}}function Ae(i,l){i&1&&(e(0,` 75 `),n(1,"div",30),e(2,` 76 Please enter a name with at least 3 characters. 77 `),o(),e(3,` 78 `))}function Pe(i,l){i&1&&(e(0,` 79 `),n(1,"div",30),e(2,` 80 Name contains only letters, spaces, and hyphens. Special characters 81 are not allowed. 82 `),o(),e(3,` 83 `))}function Ve(i,l){i&1&&(e(0,` 84 `),n(1,"div",30),e(2,` 85 Please enter a valid name 86 `),o(),e(3,` 87 `))}function Oe(i,l){i&1&&(e(0,` 88 `),n(1,"div",30),e(2,` 89 Enter a valid email. 90 `),o(),e(3,` 91 `))}function Ie(i,l){if(i&1){let t=F();e(0,` 92 `),n(1,"button",38),b("click",function(){v(t);let r=c();return S(r.sendOTP())}),e(2,` 93 Send OTP 94 `),o(),e(3,` 95 `)}if(i&2){let t=c();d(),C("disabled",!t.isPhoneNumberValid())}}function Be(i,l){i&1&&(e(0,` 96 `),n(1,"div",30),e(2,` 97 Enter a valid 10 digit phone number. 98 `),o(),e(3,` 99 `))}function De(i,l){if(i&1&&(e(0,` 100 `),n(1,"div",30),e(2),o(),e(3,` 101 `)),i&2){let t=c(3);d(2),N(` 102 `,t.addressForm.get("otp").errors.error,` 103 `)}}function Ge(i,l){if(i&1){let t=F();e(0,` 104 `),n(1,"button",40),b("click",function(){v(t);let r=c(2);return S(r.verifyOTP())}),e(2,` 105 Verify 106 `),o(),e(3,` 107 `),m(4,De,4,1)}if(i&2){let t,a=c(2);d(4),p((t=a.addressForm.get("otp").errors)!=null&&t.error?4:-1)}}function ke(i,l){if(i&1&&(e(0,` 108 `),h(1,"div",4),e(2,` 109 110 `),n(3,"div",4),e(4,` 111 `),n(5,"div",5),e(6,` 112 Otp`),n(7,"span",6),e(8,"*"),o(),e(9,` 113 `),o(),e(10,` 114 `),n(11,"div",7),e(12,` 115 `),h(13,"input",39),e(14,` 116 `),m(15,Ge,5,1),o(),e(16,` 117 `),o(),e(17,` 118 `)),i&2){let t=c();d(15),p(t.addressForm.get("otp").value?15:-1)}}function Me(i,l){i&1&&(e(0,` 119 `),n(1,"div",30),e(2,` 120 Enter a valid 10 digit phone number. 121 `),o(),e(3,` 122 `))}function Re(i,l){i&1&&e(0,` 123 Address field cannot exceed 100 characters. 124 `)}function Le(i,l){i&1&&e(0,` 125 Address is required and cannot contain only spaces. 126 `)}function Ue(i,l){if(i&1&&(e(0,` 127 `),n(1,"div",30),e(2,` 128 `),m(3,Re,1,0)(4,Le,1,0),o(),e(5,` 129 `)),i&2){let t,a=c();d(3),p((t=a.addressForm.get("address").errors)!=null&&t.maxlength?3:4)}}function He(i,l){i&1&&e(0,` 130 Address field cannot exceed 100 characters. 131 `)}function qe(i,l){i&1&&e(0,` 132 Please enter a valid address detail. 133 `)}function Xe(i,l){if(i&1&&(e(0,` 134 `),n(1,"div",30),e(2,` 135 `),m(3,He,1,0)(4,qe,1,0),o(),e(5,` 136 `)),i&2){let t,a=c();d(3),p((t=a.addressForm.get("address2").errors)!=null&&t.maxlength?3:4)}}function je(i,l){if(i&1&&(e(0,` 137 `),n(1,"div",30),e(2),o(),e(3,` 138 `)),i&2){let t,a=c();d(2),N(` 139 `,((t=a.addressForm.get("pincode").errors)==null?null:t.invalidPincodeError)||"Enter a valid 6 digit pincode.",` 140 `)}}function Ye(i,l){if(i&1&&(e(0,` 141 `),n(1,"div",30),e(2),o(),e(3,` 142 `)),i&2){let t=c();d(2),N(` 143 `,t.data==null?null:t.data.isPincodeValid,` 144 `)}}function ze(i,l){i&1&&(e(0,` 145 `),n(1,"div",42),e(2,` 146 `),h(3,"input",45),e(4,` 147 `),n(5,"label",46),e(6,` 148 Make this Shipping address 149 `),o(),e(7,` 150 `),o(),e(8,` 151 `))}function Ke(i,l){i&1&&(e(0,` 152 `),n(1,"div",42),e(2,` 153 `),h(3,"input",47),e(4,` 154 `),n(5,"label",48),e(6,` 155 Make this Billing address 156 `),o(),e(7,` 157 `),o(),e(8,` 158 `))}function $e(i,l){if(i&1&&(e(0,` 159 `),n(1,"div",41),e(2,` 160 `),n(3,"div",42),e(4,` 161 `),h(5,"input",43),e(6,` 162 `),n(7,"label",44),e(8,` 163 Make as Primary Address 164 `),o(),e(9,` 165 `),o(),e(10,` 166 `),m(11,ze,9,0),m(12,Ke,9,0),o(),e(13,` 167 `)),i&2){let t=c();d(11),p(t.addressType==="billing"&&!t.addressId?11:-1),d(),p(t.addressType==="shipping"&&!t.addressId?12:-1)}}function We(i,l){i&1&&(e(0,` 168 `),n(1,"div",49),e(2,` 169 `),n(3,"div",50),e(4,` 170 `),n(5,"div",51),e(6,` 171 `),n(7,"label"),e(8,` 172 `),h(9,"input",52),e(10,` 173 `),n(11,"div",53),e(12,` 174 Home 175 `),o(),e(13,` 176 `),o(),e(14,` 177 `),n(15,"label"),e(16,` 178 `),h(17,"input",54),e(18,` 179 `),n(19,"div",53),e(20,` 180 Office 181 `),o(),e(21,` 182 `),o(),e(22,` 183 `),n(23,"label"),e(24,` 184 `),h(25,"input",55),e(26,` 185 `),n(27,"div",53),e(28,` 186 Other 187 `),o(),e(29,` 188 `),o(),e(30,` 189 `),o(),e(31,` 190 `),o(),e(32,` 191 `),o(),e(33,` 192 `))}var St=(()=>{class i extends xe{constructor(t,a){super(),this.formBuilder=t,this.router=a,this.LoginType=D,this.isNewAddress=!0,this.formChangesMade=!1,this.verifiedGstin=E("",{}),this.verifiedPan="",this.gstOptions=[],this.showGSTOptions=E(!1,{}),this.pincodeData=E(null,{}),this.showOTPVerification=E(!1,{}),this.gstinVerified=E(!1,{}),this.readOnly=E({},{}),this.isSignUp=E(!1,{}),this.showSendOTPButton=E(!1,{}),this.disableSaveAndContinue=E(!1,{}),this.gstVerification=E(!1,{}),this.hideError=E(!1,{}
192),this.StringUtils=g,this._inputValidators=M(ue,{optional:!0})}blockPageReloadAndExitOnFormEdits(){this.addressForm.valueChanges.subscribe(()=>{this.formChangesMade=!0})}ngOnInit(){if(this.data=this.slot.widget.data.value,this.data?.formData?.gstin_verified&&this.gstVerification.set(!0),this.addressForm=this.formBuilder.group({name:["",[x.required,x.pattern(y.NAME_REGEX)]],phone:["",[x.required,x.pattern(A.PHONE_REGEX)]],email:["",[x.pattern(A.EMAIL_REGEXP)]],alternatePhone:["",[x.pattern(A.PHONE_REGEX)]],gstin:["",x.pattern(y.GSTIN_REGEX)],otp:[""],businessName:[""],pan:[""],pincode:["",[x.required,x.pattern(A.PINCODE_REGEX)]],address:["",[x.required,x.maxLength(100),x.pattern(/\S/)]],address2:[""],city:new G({value:"",disabled:!0},[x.required]),state:new G({value:"",disabled:!0},[x.required]),landmark:[""],default:[!0],sameShippingAddress:[!0],sameBillingAddress:[!0],businessVerificationOption:[P.GST],locationTypeTag:[he.OFFICE]}),this.data){this.isNewAddress=!1,this.data?.signUp&&(this.isNewAddress=!0,this.data=this.data?.payload?.addressBook,this.readOnly.set({email:!!this.data?.email,phone:!!this.data?.phone,pincode:!!this.data?.pincode,gstin:!0}),this.isSignUp.set(!0)),this.data?.type?this.addressType=this.data?.type:this.router.url.split("/new/")[1]?.split("?")[0]===T.BILLING?this.addressType=T.BILLING:this.addressType=T.SHIPPING,this.addressId=Number(this.data?.id),this.verifiedGstin.set(this.data?.gstin_number),!g.isEmpty(this.data?.formData?.gstin_number)&&this.data?.formData?.gstin_verified&&this.verifiedGstin.set(this.data?.formData?.gstin_number),this.verifiedPan=this.data?.pan,this.data?.formData?(this.patchAddress(this.data?.formData),this.data?.otpData&&(this.data?.otpData?.otpVerified?this.addressForm.get(s.OTP)?.setValue(null):(this.showOTPVerification.set(!0),this.addressForm.patchValue({otp:this.data?.otpData?.otp}),setTimeout(()=>{this.addressForm.get(s.OTP)?.setErrors({error:this.data?.otpData?.otpStatusMsg})})))):this.data?.id||this.isSignUp()?this.patchAddress(this.data):!g.isEmpty(this.data?.profileEmail)&&g.isValidEmail(this.data?.profileEmail)&&this.addressForm.get(s.EMAIL)?.setValue(this.data?.profileEmail),this.addressForm.valueChanges.subscribe(()=>{this.updateButtonStates()}),this.updateButtonStates(),this.data?.verificationStatus&&this.showSendOTPButton.set(!1),this.blockPageReloadAndExitOnFormEdits();return}else this.addressForm.valueChanges.subscribe(()=>{this.updateButtonStates()}),this.updateButtonStates(),this.data?.verificationStatus&&this.showSendOTPButton.set(!1),this.blockPageReloadAndExitOnFormEdits();let a=this.router.url.split("/new/")[1]?.split("?")[0]||T.BILLING;switch(a){case T.BILLING:case T.SHIPPING:this.addressType=a;break;default:window&&(window.location.href="/user/addressbook")}}isInvalid(t){let{invalid:a,touched:r}=this.addressForm.get(t)||{};return a&&r}patchAddress(t){typeof t=="object"&&t&&Object.keys(t).length&&(this.addressForm.patchValue({address:t?.address,address2:t?.address2,businessName:t?.company_name,city:t?.city?.name,gstin:t?.gstin_number,default:t?.default,sameShippingAddress:t?.sameShippingAddress,sameBillingAddress:t?.sameBillingAddress,landmark:t?.landmark,name:t?.name,phone:t?.phone,email:g.isValidEmail(t?.email)?t?.email:"",alternatePhone:t?.alternate_phone,pincode:t?.pincode,state:t?.state?.name,pan:t?.pan,locationTypeTag:t?.address_type}),!g.isEmpty(t.gstin_number)&&t.gstin_number===this.addressForm.get(s.GSTIN)?.value&&this.gstinVerified.set(!0),this.toggleBusinessNameEnablement(t?.company_name),this.togglePincodeEnablement(t?.pincode),this.addressForm.markAllAsTouched(),this.onPincodeChange())}closeGSTOptions(){this.showGSTOptions.set(!1)}getGSTfoFromPan(){let t={type:P.PAN,panNumber:this.addressForm.get(s.PAN)?.value};if(this.verifiedPan==this.addressForm.get(s.PAN)?.value&&this.gstOptions.length){this.showGSTOptions.set(!0);return}this.apiService.callVerificationApi(t).subscribe({next:a=>{let r=a.RESPONSE.data;r.status?(this.gstOptions=r.gstList,this.showGSTOptions.set(!0),this.verifiedPan=r.pan):(this.addressForm.get(s.PAN)?.setErrors({invalid:!0}),this.gstOptions=[],this.showGSTOptions.set(!0))},error:()=>{}})}onPincodeChange(){this.hideError.set(!0),!this.addressForm.get(s.PINCODE)?.invalid&&this.checkPincodeDetails()}async checkPincodeDetails(){return new Promise((t,a)=>{if(g.isEmpty(this.addressForm.get(s.PINCODE)?.value)||this.addressForm.get(s.PINCODE)?.invalid){this.addressForm.get(s.PINCODE)?.setErrors({invalid:!0});return}let r={type:P.PINCODE,pincode:this.addressForm.get(s.PINCODE)?.value};this.apiService.callVerificationApi(r).subscribe({next:_=>{let f=_.RESPONSE.data;if(!f.status){this.addressForm.get(s.PINCODE)?.setErrors({invalid:!0}),this.addressForm.get(s.PINCODE)?.setErrors({invalidPincodeError:"The provided pincode is not serviceable."}),a(f.message);return}this.addressForm.patchValue({city:f?.city?.name,state:f?.state?.name}),this.pincodeData.set(f),t(f)},error:()=>{}})})}async selectOption(t){this.addressForm.patchValue({gstin:t.gstin}),this.verifyGST().then(a=>{this.showGSTOptions.set(!1)}).catch(a=>{})}verifyGST(){return new Promise((t,a)=>{let r=this.addressForm.get(s.GSTIN)?.value;if(!y.GSTIN_REGEX.test(r)){this.addressForm.get(s.GSTIN)?.setErrors({invalidGstinError:"Enter a valid GSTIN number."});return}let _={type:P.GST,gstNumber:r,payload:{formType:ce.ADDRESS_FORM,formData:this.addressForm.value,pageUrl:this.router.url}};this.apiService.callVerificationApi(_).subscribe({next:f=>{let u=f.RESPONSE.data;if(!u.status&&u.apiError){this.addressForm.get(s.GSTIN)?.setErrors({invalidGstinError:u.message||"Enter a valid GSTIN number."}),this.verifiedGstin.set(""),this.gstinVerified.set(!1),this.gstVerification.set(!1),a(u.message);return}else if(!u.status){this.addressForm.get(s.GSTIN)?.setErrors({invalidGstinError:u.message}),this.verifiedGstin.set(""),this.gstinVerified.set(!1),this.gstVerification.set(!1),a(u.message);return}let k=u.gst||r;this.addressForm.patchValue({businessName:u.businessName,pincode:u.pincode,city:u?.city?.name,state:u?.state?.name,gstin:k,address:u.splitAddress?.[0]??u?.address,address2:u.splitAddress?.[1]??""}),u.status?(this.checkPincodeDetails(),this.gstVerification.set(!0)):(this.addressForm.get(s.GSTIN)?.setErrors({invalidGstinError:u.message}),this.gstVerification.set(!1)),this.gstinVerified.set(!0),this.verifiedGstin.set(k),this.togglePincodeEnablement(u.pincode),this.toggleBusinessNameEnablement(u?.businessName),t(u)},error:()=>{}})})}async saveAddress(){if(this.addressForm.markAllAsTouched(),this.data.loginType==D.EMAIL&&g.isValidEmail(this.data?.profileEmail)&&g.isEmpty(this.addressForm.get(s.EMAIL)?.value)&&this.addressForm.get(s.EMAIL)?.setValue(this.data?.profileEmail),this.addressForm.invali
192d)return;let t=this.makeAddressData(),a={actionData:{type:w.ADDRESS_SAVE,params:O(V({},this.slot?.widget?.data?.value?.payload),{addressBook:t,addressId:null,sameShippingAddress:this.addressForm.get(s.SAME_SHIPPING_ADDRESS)?.value,sameBillingAddress:this.addressForm.get(s.SAME_BILLING_ADDRESS)?.value})}};this.addressId&&(a.actionData.type=w.ADDRESS_UPDATE,a.actionData.params.addressId=Number(this.addressId)),this.actionEvent(a)}async sendOTP(){this.showOTPVerification.set(!0),this.actionEvent({actionData:{type:w.SEND_OTP,params:{phone:this.addressForm.get(s.PHONE)?.value}}})}async verifyOTP(){let t=this.makeAddressData();this.actionEvent({actionData:{type:w.VERIFY_OTP,params:O(V({},t),{phone:this.addressForm.get(s.PHONE)?.value,otp:this.addressForm.get(s.OTP)?.value,sameShippingAddress:this.addressForm.get(s.SAME_SHIPPING_ADDRESS)?.value,sameBillingAddress:this.addressForm.get(s.SAME_BILLING_ADDRESS)?.value})}}),this.showOTPVerification.set(!1)}makeAddressData(){let t=this.addressForm.get(s.NAME)?.value?.split(" ")||[],a=t[0],r=t.length>1?t[t.length-1]:"";return{address:this.addressForm.get(s.ADDRESS)?.value,address2:this.addressForm.get(s.ADDRESS2)?.value,city_id:this.pincodeData()?.city?.id,state_id:this.pincodeData()?.state?.id,city:this.pincodeData()?.city?.name,state:this.pincodeData()?.state?.name,company_name:this.addressForm.get(s.BUSINESS_NAME)?.value,name:this.addressForm.get(s.NAME)?.value,first_name:a,last_name:r,gstin_number:this.addressForm.get(s.GSTIN)?.value,landmark:this.addressForm.get(s.LAND_MARK)?.value,default:this.addressForm.get(s.DEFAULT)?.value,phone:Number(this.addressForm.get(s.PHONE)?.value),email:this.addressForm.get(s.EMAIL)?.value,alternate_phone:Number(this.addressForm.get(s.ALTERNATE_PHONE)?.value)||null,pincode:this.addressForm.get(s.PINCODE)?.value,type:this.addressType,address_type:this.addressForm.get(s.LOCATION_TYPE_TAG)?.value,gstin_verified:!g.isEmpty(this.addressForm.get(s.GSTIN)?.value)&&this.gstVerification()}}verifiedGstinNumber(){let t=this.addressForm.get(s.GSTIN),a=t?.value?.trim()??"",r=this.gstVerification();if(g.isEmpty(a)){this.verifiedGstin.set(""),this.gstinVerified.set(!1),this.gstVerification.set(!1),t?.setErrors(null),t?.updateValueAndValidity({emitEvent:!1}),this.addressForm.get(s.BUSINESS_NAME)?.setValue(null),this.addressForm.get(s.PINCODE)?.setValue(""),this.addressForm.get(s.CITY)?.setValue(""),this.addressForm.get(s.STATE)?.setValue(""),this.toggleBusinessNameEnablement(null),this.togglePincodeEnablement(this.addressForm.get(s.PINCODE)?.value),this.updateButtonStates();return}this.verifiedGstin()!==a&&this.gstinVerified()&&(this.gstinVerified.set(!1),this.gstVerification.set(!1),this.addressForm.get(s.BUSINESS_NAME)?.setValue(null),this.toggleBusinessNameEnablement(null),r&&(this.addressForm.get(s.PINCODE)?.setValue(""),this.addressForm.get(s.CITY)?.setValue(""),this.addressForm.get(s.STATE)?.setValue(""))),this.togglePincodeEnablement(this.addressForm.get(s.PINCODE)?.value),this.updateButtonStates()}isPhoneNumberValid(){let t=this.addressForm.get(s.PHONE)?.value;return t&&y.PHONE_REGEX.test(t)}onPhoneInputChange(t){t.target.value=t?.target?.value.replace(/\D/g,"");let r=this.addressForm.get(s.PHONE)?.value!=this.data?.addressPhone;this.showOTPVerification.set(!1),this.addressForm.get(s.OTP)?.setValue(""),this.showSendOTPButton.set(!this.data?.profilePhone&&r),this.disableSaveAndContinue.set(!this.data?.profilePhone&&r||this.addressForm?.invalid||this.showOTPVerification())}onInputChange(t){t.target.value=t?.target?.value.replace(/\D/g,"")}updateButtonStates(){let a=this.addressForm.get(s.PHONE)?.value!=this.data.addressPhone;this.data?.profilePhone?(this.showSendOTPButton.set(!1),this.disableSaveAndContinue.set(this.addressForm?.invalid||this.showOTPVerification())):this.data?.profileEmail&&!this.data?.profilePhone&&this.data?.addressPhone!=this.addressForm.get(s.PHONE)?.value?(this.data.verificationStatus||this.showSendOTPButton.set(!0),this.disableSaveAndContinue.set(this.addressForm?.invalid||this.showOTPVerification())):!this.data?.profilePhone&&a?(this.showSendOTPButton.set(!0),this.disableSaveAndContinue.set(!0)):(this.showSendOTPButton.set(!1),this.disableSaveAndContinue.set(this.addressForm?.invali
192d||this.showOTPVerification()))}performAction(t){this.actionEvent({actionData:V({},t)})}isButtonDisabled(){return this.isSignUp()?!1:this.disableSaveAndContinue()||this.addressForm.get(s.GSTIN)?.value&&!this.gstinVerified()||this.addressForm.get(s.GSTIN)?.value&&this.gstinVerified()&&g.isEmpty(this.addressForm.get(s.BUSINESS_NAME)?.value)||!this.data?.verificationStatus&&this.addressForm.get(s.PHONE)?.value&&!this.isPhoneVerified()}isPhoneVerified(){return this.data?.profilePhone||this.data?.addressPhone||this.data?.otpData?.otpVerified}togglePincodeEnablement(t){this._inputValidators?.checkPincode(t)&&this.gstinVerified()?this.addressForm.get(s.PINCODE)?.disable():this.addressForm.get(s.PINCODE)?.enable()}toggleBusinessNameEnablement(t){g.isEmpty(t)&&this.gstinVerified()?(this.addressForm.get(s.BUSINESS_NAME)?.enable(),this.addressForm.get(s.BUSINESS_NAME)?.setValidators([x.required]),this.addressForm.get(s.BUSINESS_NAME)?.updateValueAndValidity()):(this.addressForm.get(s.BUSINESS_NAME)?.disable(),this.addressForm.get(s.BUSINESS_NAME)?.clearValidators(),this.addressForm.get(s.BUSINESS_NAME)?.updateValueAndValidity())}shouldShowGstinError(){let t=this.addressForm.get("gstin");return t?.touched&&t.errors!=null||!!t?.errors?.invalidGstinError}shouldShowPincodeError(){let t=this.addressForm.get("pincode");return t?.touched&&t.errors!=null||!!t?.errors?.invalidPincodeError}static{this.\u0275fac=function(a){return new(a||i)(I(le),I(Z))}}static{this.\u0275cmp=L({type:i,selectors:[["address-form"]],hostVars:4,hostBindings:function(a,r){a&2&&(j(r.ngStyle),Y(r.ngClass))},inputs:{ngClass:"ngClass",ngStyle:"ngStyle",actionEvent:"actionEvent",slot:"slot"},features:[U],decls:177,vars:30,consts:[["phone",""],[3,"ngSubmit","formGroup"],[1,"bg-white","p-[15px]"],[1,"grid","md:grid-cols-2","grid-cols-1","gap-[10px]","mb-[10px]","text-left","rounded-[5px]"],[1,""],[1,"md:text-[14px]","text-[13px]","text-[#5B5B5B]","mb-[5px]"],[1,"md:text-[14px]","text-[#eb3406]","text-[12px]"],[1,"relative"],["formControlName","name","required","","type","text","maxlength","40","minlength","3",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important"],["formControlName","email","required","","type","text","maxlength","40",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important",3,"disabled","readonly","value"],["formControlName","phone","type","text","maxlength","10",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important",3,"input","disabled","readonly"],["formControlName","alternatePhone","type","text","maxlength","10",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important",3,"input"],["formControlName","address","required","","type","text","maxlength","100",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important"],["formControlName","address2","type","text","maxlength","100",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important"],["for","pincode",1,"md:text-[14px]","text-[13px]","text-[#5B5B5B]","mb-[5px]"],["required","","type","text","id","pincode","maxlength","6","formControlName","pincode","onkeypress",` 193 return ( 194 (event.charCode != 8 && event.charCode == 0) || 195 (event.charCode >= 48 && event.charCode <= 57) 196 ); 197 `,1,"px-[10px]","rounded-none","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important",3,"input","disabled","readonly"],["formControlName","landmark","type","text","maxlength","60",1,"px-[10px]","rounded-none","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important"],[1,"mt-[2px]","text-[12px]","text-[#BCBCBC]"],[1,"grid","grid-cols-2","gap-[10px]"],["formControlName","city","type","text",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important"],["formControlName","state","type","text",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important"],[1,"flex","justify-end","md:mx-[0px]",3,"ngClass"],["type","submit",1,"p-[10px]","cursor-pointer","rounded-[5px]","text-[13px]","font-bold","border","bg-[#162F4D]","disabled:bg-[#DFDFDF]","text-[#FFFFFF]","disabled:text-[#5B5B5B]","disabled:cursor-auto","md:w-auto","w-full","mb-[10px]","h-[40px]",2,"border-color","#162f4d !important","padding","8px 35px",3,"disabled"],[1,"flex","items-center","gap-[4px]","bg-[#ffffff]","md:text-[14px]","text-[12px]","text-center","max-w-[240px]","md:ml-auto","font-medium","md:pl-[13px]","md:pr-[13px]","cursor-pointer","md:pt-[13px]","md:pb-[13px]","text-[#5b5b5b]",3,"click"],["xmlns","http://www.w3.org/2000/svg","width","1.5em","height","1.5em","viewBox","0 0 512 512"],["fill","none","stroke","black","stroke-miterlimit","10","stroke-width","32","d","M256 64C150 64 64 150 64 256s86 192 192 192s192-86 192-192S362 64 256 64Z"],["fill","none","stroke","black","stroke-linecap","round","stroke-linejoin","round","stroke-width","32","d","m296 352l-96-96l96-96"],["formControlName","gstin","maxlength","15","oninput","this.value = this.value.toUpperCase()","type","text",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]","mb-[10px]",2,"border-color","#dfdfdf !important",3,"keyup","disabled","readonly"],["type","button",1,"h-[40p
197x]","absolute","inset-y-0","right-0","bg-[#D0F0C0]","hover:bg-[#3BB000]","text-[#000000]","hover:text-[#FFFFFF]","px-[10px]","md:text-[14px]","text-[13px]",3,"click"],["title","gst verified","alt","green check",1,"absolute","top-[10px]","right-[5px]",3,"ngSrc","height","width"],[1,"text-[12px]","text-[#FF0000]","my-[2px]"],[1,"absolute","bg-white","border","border-gray-300","p-4","z-50","shadow-2xl"],[1,"mb-2"],[1,"mt-3","list-none","h-80","overflow-scroll","shadow-inner"],["type","button",1,"p-3","m-2","cursor-pointer","bg-orange-300",3,"click"],[1,"cursor-pointer","p-4","border-solid","border-white","border-2","hover:border-black",3,"click"],["formControlName","businessName","type","text",1,"px-[10px]","rounded-sm","border","border-solid","bg-transparent","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important"],["formControlName","gstin","type","text","oninput","this.value = this.value?.toUpperCase()",1,"px-[10px]","rounded-sm","border","border-solid","bg-transparent","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important"],["type","button",1,"h-[40px]","absolute","inset-y-0","right-0","bg-[#D0F0C0]","hover:bg-[#3BB000]","text-[#000000]","hover:text-[#FFFFFF]","px-[10px]","text-[13px]","disabled:bg-[#DFDFDF]","disabled:text-[#5B5B5B]","disabled:cursor-auto",3,"click","disabled"],["formControlName","otp","onkeypress",` 198 return ( 199 (event.charCode != 8 && event.charCode == 0) || 200 (event.charCode >= 48 && event.charCode <= 57) 201 ); 202 `,"type","text","maxlength","6",1,"px-[10px]","rounded-sm","border","border-solid","bg-white","w-full","focus:ring-0","focus:outline-none","focus:shadow-outline","h-[40px]",2,"border-color","#dfdfdf !important"],["type","button",1,"h-[40px]","absolute","inset-y-0","right-0","bg-[#D0F0C0]","hover:bg-[#3BB000]","text-[#000000]","hover:text-[#FFFFFF]","px-[10px]","text-[13px]",3,"click"],[1,"flex","items-center","flex-wrap","gap-[10px]"],[1,"flex","items-center","gap-[10px]"],["type","checkbox","formControlName","default","id","default-checkbox-1","value","",1,"w-[15px]","h-[15px]","bg-transparent","border","border-solid","rounded","accent-[#F94D00]",2,"border-color","#5b5b5b !important"],["for","default-checkbox-1",1,"md:text-[14px]","text-[13px]","font-semibold","text-[#000000]"],["type","checkbox","formControlName","sameShippingAddress","id","default-checkbox-2",1,"w-[15px]","h-[15px]","bg-transparent","border","border-solid","rounded","accent-[#F94D00]",2,"border-color","#5b5b5b !important"],["for","default-checkbox-2",1,"md:text-[14px]","text-[13px]","font-semibold","text-[#000000]"],["type","checkbox","formControlName","sameBillingAddress","id","default-checkbox-3",1,"w-[15px]","h-[15px]","bg-transparent","border","border-solid","rounded","accent-[#F94D00]",2,"border-color","#5b5b5b !important"],["for","default-checkbox-3",1,"md:text-[14px]","text-[13px]","font-semibold","text-[#000000]"],[1,"mt-3"],[1,"flex","items-baseline"],[1,"space-x-2","flex","md:text-[14px]","text-[13px]"],["formControlName","locationTypeTag","type","radio","value","home",1,"sr-only","peer"],[1,"cursor-pointer","w-[80px]","h-[40px]","flex","items-center","justify-center","text-[#000000]","peer-checked:font-semibold","peer-checked:text-[#F94D00]","peer-checked:border-[#F94D00]","border","border-solid",2,"border-color","#dfdfdf !important"],["formControlName","locationTypeTag","type","radio","value","office",1,"sr-only","peer"],["formControlName","locationTypeTag","type","radio","value","other",1,"sr-only","peer"]],template:function(a,r){if(a&1){let _=F();n(0,"form",1),b("ngSubmit",function(){return v(_),S(r.saveAddress())}),e(1,` 203 `),n(2,"div",2),e(3,` 204 `),n(4,"div",3),e(5,` 205 `),m(6,ge,17,1),n(7,"div"),e(8,` 206 `),m(9,Ce,17,6),o(),e(10,` 207 208 `),m(11,Te,22,3),m(12,we,16,1),n(13,"div",4),e(14,` 209 `),n(15,"div",5),e(16,` 210 Name`),n(17,"span",6),e(18,"*"),o(),e(19,` 211 `),o(),e(20,` 212 213 `),n(21,"div",7),e(22,` 214 `),h(23,"input",8),e(24,` 215 `),o(),e(25,` 216 `),m(26,Ae,4,0),m(27,Pe,4,0),m(28,Ve,4,0),o(),e(29,` 217 `),n(30,"div",4),e(31,` 218 `),n(32,"div",5),e(33,` 219 Email`),n(34,"span",6),e(35,"*"),o(),e(36,` 220 `),o(),e(37,` 221 `),n(38,"div",7),e(39,` 222 `),h(40,"input",9),e(41,` 223 `),o(),e(42,` 224 `),m(43,Oe,4,0),o(),e(44,` 225 `),n(45,"div",4),e(46,` 226 `),n(47,"div",5),e(48,` 227 Mobile`),n(49,"span",6),e(50,"*"),o(),e(51,` 228 `),o(),e(52,` 229 `),n(53,"div",7),e(54,` 230 `),n(55,"input",10,0),b("input",function(u){return v(_),S(r.onPhoneInputChange(u))}),o(),e(57,` 231 `),m(58,Ie,4,1),o(),e(59,` 232 233 `),m(60,Be,4,0),o(),e(61,` 234 235 `),m(62,ke,18,1),n(63,"div",4),e(64,` 236 `),n(65,"div",5),e(66,` 237 Alternate Mobile 238 `),o(),e(67,` 239 `),n(68,"div",7),e(69,` 240 `),n(70,"input",11),b("input",function(u){return v(_),S(r.onInputChange(u))}),o(),e(71,` 241 `),o(),e(72,` 242 `),m(73,Me,4,0),o(),e(74,` 243 244 `),n(75,"div",4),e(76,` 245 `),n(77,"div",5),e(78,` 246 Flat, House no., Building, Company, Apartment`),n(79,"span",6),e(80,"*"),o(),e(81,` 247 `),o(),e(82,` 248 `),n(83,"div",7),e(84,` 249 `),h(85,"input",12),e(86,` 250 `),o(),e(87,` 251 `),m(88,Ue,6,1),o(),e(89,` 252 253 `),n(90,"div",4),e(91,` 254 `),n(92,"div",5),e(93,` 255 Area, Street, Sector, Village 256 `),o(),e(94,` 257 `),n(95,"div",7),e(96,` 258 `),h(97,"input",13),e(98,` 259 `),o(),e(99,` 260 `),m(100,Xe,6,1),o(),e(101,` 261 262 `),n(102,"div",4),e(103,` 263 `),n(104,"label",14),e(105,"Pincode"),n(106,"span",6),e(107,"*"),o()(),e(108,` 264 `),n(109,"div",7),e(110,` 265 `),n(111,"input",15),b("input",function(){return v(_),S(r.onPincodeChange())}),o(),e(112,` 266 `),o(),e(113,` 267 268 `),m(114,je,4,1),m(115,Ye,4,1),o(),e(116,` 269 270 `),n(117,"div",4),e(118,` 271 `),n(119,"div",5),e(120,` 272 Landmark 273 `),o(),e(121,` 274 `),n(122,"div",7),e(123,` 275 `),h(124,"input",16),e(125,` 276 `),o(),e(126,` 277 `),n(127,"div",17),e(128,` 278 Landmark will ensure faster delivery 279 `),o(),e(129,` 280 `),o(),e(130,` 281 282 `),n(131,"div",18),e(132,` 283 `),n(133,"div",4),e(134,` 284 `),n(135,"div",5),e(136,` 285 City`),n(137,"span",6),e(138,"*"),o(),e(139,` 286 `),o(),e(140,` 287 `),n(141,"div",7),e(142,` 288 `),h(143,"input",19),e(144,` 289 `),o(),e(145,` 290 `),o(),e(146,` 291 292 `),n(147,"div",4),e(148,` 293 `),n(149,"div",5),e(150,` 294 State`),n(151,"span",6),e(152,"*"),o(),e(153,` 295 `),o(),e(154,` 296 `),n(155,"div",7),e(156,` 297 `),h(157,"input",20),e(158,` 298 `),o(),e(159,` 299 `),o(),e(160,` 300 `),o(),e(161,` 301 302 `),e(162,` 303 `),e(163,` 304 `),e(164,` 305 `),e(165,` 306 307 `),m(166,$e,14,2),m(167,We,34,0),o(),e(168,` 308 309 `),n(169,"div",21),e(170,` 310 `),n(171,"button",22),e(172,` 311 Save and Continue 312 `),o(),e(173,` 313 `),o(),e(174,` 314 `),o(),e(175,` 315`),o(),e(176,` 316`)}if(a&2){let _,f;C("formGroup",r.addressForm),d(6),p(!(r.slot==null||r.slot.widget==null||r.slot.widget.data==null||r.slot.widget.data.value==null||r.slot.widget.data.value.backButton==null||r.slot.widget.data.value.backButton.value==null)&&r.slot.widget.data.value.backButton.value.status?6:-1),d(3),p(r.addressForm.get("businessVerificationOption").value==="GST"?9:-1),d(2),p(r.showGSTOptions()?11:-1),d(),p(r.verifiedGstin()&&r.addressForm.get("gstin").value?12:-1),d(14),p(r.addressForm.get("name").value&&((_=r.addressForm.get("name").errors)!=null&&_.minlength)?26:-1),d(),p(r.addressForm.get("name").value&&((f=r.addressForm.get("name").errors)!=null&&f.pattern)?27:-1),d(),p(r.addressForm.get("name").touched&&!r.addressForm.get("name").value&&r.addressForm.get("name").errors?28:-1),d(12),C("disabled",r.readOnly().email)("readonly",r.readOnly().email)("value",r.StringUtils.isValidEmail(r.data==null?null:r.data.profileEmail)?r.data==null?null:r.data.profileEmail:""),d(3),p(r.addressForm.get("email").touched&&r.addressForm.get("email").errors?43:-1),d(12),C("disabled",r.readOnly().phone)("readonly",r.readOnly().phone),d(3),p(!r.isSignUp()&&r.showSendOTPButton()?58:-1),d(2),p(r.addressForm.get("phone").touched&&r.addressForm.get("phone").errors?60:-1),d(2),p(r.showOTPVerification()?62:-1),d(11),p(r.addressForm.get("alternatePhone").touched&&r.addressForm.get("alternatePhone").errors?73:-1),d(15),p(r.addressForm.get("address").touched&&r.addressForm.get("address").errors?88:-1),d(12),p(r.addressForm.get("address2").touched&&r.addressForm.get("address2").errors?100:-1),d(11),C("disabled",r.readOnly().pincode)("readonly",r.readOnly().pincode),d(3),p(r.shouldShowPincodeError()?114:-1),d(),p(r.data!=null&&r.data.isPincodeValid&&!r.hideError()?115:-1),d(51),p(r.data!=null&&r.data.showMakeAddressBox?166:-1),d(),p(r.data!=null&&r.data.showAddressType?167:-1),d(2),C("ngClass",z(28,fe,!r.isSignUp())),d(2),C("disabled",r.isButtonDisabled())}},dependencies:[$,K,me,ie,Q,J,ne,ee,te,se,ae,de,pe,re,oe,W],encapsulation:2})}}return i})();export{St as AddressFormComponent}; 317//# sourceMappingURL=chunk-2MEHMQIZ.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.