1import{a as _e,b as ge}from"./chunk-BZ3VJ5CR.js";import{Fa as me,La as se,Ma as ce,eb as h,ha as z,ia as j,ja as le,ka as ae}from"./chunk-MNEXBAOF.js";import{a as R,b as D,c as L,d as Z,e as G,f as U,g as $}from"./chunk-CVJJSF3O.js";import"./chunk-ZVZKEND6.js";import{d as pe,e as ue}from"./chunk-GYDUJTDI.js";import"./chunk-6KTR47WW.js";import{B as oe,b as O,d as s,f as Y,g as W,n as H,o as J,q as K,r as Q,s as X,t as ee,u as ie,w as te,x as ne,z as re}from"./chunk-4WWBVFJU.js";import{c as de}from"./chunk-GHIHZVWI.js";import{f as I,h as B,i as k,o as P}from"./chunk-SWAYLFYF.js";import"./chunk-52HQWOF2.js";import"./chunk-37I2XFPY.js";import"./chunk-QOIFOME4.js";import"./chunk-CHMZFOR2.js";import{j as N,s as w}from"./chunk-RP54ASDE.js";import{$b as t,Dc as n,Fc as f,Rc as V,Tc as q,Ub as d,Vb as m,Vc as y,Xb as g,Yb as C,Zb as v,_b as c,a as F,ac as e,bc as p,ia as A,ib as r,mc as x,oc as E,rb as u,yb as T,yd as M}from"./chunk-UYEXYFUI.js";var b=i=>({"invalid-field":i});function he(i,a){if(i&1&&(t(0,"button",1)(1,"mat-icon"),n(2,"list"),e(),n(3," View all credit cards "),e()),i&2){let o=E();c("routerLink",V("/user/cards/view/",o.aid))}}function be(i,a){i&1&&(t(0,"button",2)(1,"mat-icon"),n(2,"list"),e(),n(3," View all credit cards "),e())}function Se(i,a){i&1&&p(0,"mat-spinner",4),i&2&&c("diameter",24)("strokeWidth",2)}function xe(i,a){i&1&&(t(0,"div",16),n(1," Credit card number must be 16 characters and only numbers. "),e())}function Ee(i,a){i&1&&(t(0,"div",16),n(1," Expiration month must have two digits numeric only "),e())}function Fe(i,a){i&1&&(t(0,"div",16),n(1," Expiration year must have two digits numeric only "),e())}function Ae(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Mailing address is required."),e()())}function Te(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Zip / Postal code is required."),e()())}function Ve(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"City is required."),e()())}function qe(i,a){if(i&1&&(t(0,"option",26),n(1),e()),i&2){let o=a.$implicit;c("value",o.value),r(),f(" ",o.display," ")}}function Me(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Country is required."),e()())}function Ne(i,a){if(i&1&&(t(0,"option",26),n(1),e()),i&2){let o=a.$implicit;c("value",o.value),r(),f(" ",o.display," ")}}function we(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"State / Province / Region is required."),e()())}function Ie(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Billing address (line 1) is required."),e()())}function Be(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Billing zip code is required."),e()())}function ke(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Billing city is required."),e()())}function Pe(i,a){if(i&1&&(t(0,"option",26),n(1),e()),i&2){let o=a.$implicit;c("value",o.value),r(),f(" ",o.display," ")}}function ze(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Billing state is required."),e()())}function je(i,a){if(i&1&&(t(0,"option",26),n(1),e()),i&2){let o=a.$implicit;c("value",o.value),r(),f(" ",o.display," ")}}function Re(i,a){i&1&&(t(0,"div",19)(1,"span"),n(2,"Billing country is required."),e()())}function De(i,a){if(i&1&&(t(0,"div")(1,"mat-card-subtitle"),n(2,"Billing address"),e(),t(3,"div",20)(4,"label"),n(5,"Address line 1"),e(),p(6,"input",33),d(7,Ie,3,0,"div",19),e(),t(8,"div",20)(9,"label"),n(10,"Address line 2"),e(),p(11,"input",34),e(),t(12,"div",20)(13,"label"),n(14,"Zip"),e(),p(15,"input",35),d(16,Be,3,0,"div",19),e(),t(17,"div",20)(18,"label"),n(19,"City"),e(),p(20,"input",36),d(21,ke,3,0,"div",19),e(),t(22,"div",20)(23,"label"),n(24,"State"),e(),t(25,"select",37),C(26,Pe,2,2,"option",26,g),e(),d(28,ze,3,0,"div",19),e(),t(29,"div",38)(30,"label"),n(31,"Country"),e(),t(32,"select",39),C(33,je,2,2,"option",26,g),e(),d(35,Re,3,0,"div",19),e()()),i&2){let o=E();r(7),m(o.registerForm.controls.billing_address_line_1.invalid===!0?7:-1),r(9),m(o.registerForm.controls.billing_zip.invalid===!0?16:-1),r(5),m(o.registerForm.controls.billing_city.invalid===!0?21:-1),r(5),v(o.states),r(2),m(o.registerForm.controls.billing_state.invalid===!0?28:-1),r(5),v(o.countries),r(2),m(o.registerForm.controls.billing_country.invalid===!0?35:-1)}}function Le(i,a){i&1&&(t(0,"div",30)(1,"span"),n(2," Some above fields are missing or invalid. "),e()())}var ui=(()=>{class i{constructor(o,_,l,S,Ce,ve,fe,ye){this.router=o,this.locationService=_,this.formBuilder=l,this.activatedRoute=S,this.pathService=Ce,this.settingsService=ve,this.notificationService=fe,this.errorService=ye,this.loading=!1,this.registerForm=this.formBuilder.group({billing_address_different:[],billing_address_line_1:[],billing_address_line_2:[],billing_city:[],billing_country:[],billing_state:[],billing_zip:[],card_number:["",s.required],cvc:["",s.required],expiry_month:["",s.required],expiry_year:["",s.required],mailing_address_line_1:["",s.required],mailing_address_line_2:[],mailing_city:["",s.required],mailing_country:["USA",s.required],mailing_state:["",s.required],mailing_zip:["",s.required]}),this.countries=this.locationService.countries,this.states=this.locationService.states,this.aid=this.activatedRoute.snapshot.params.aid,this.cdr=A(M)}ngAfterViewInit(){this.scrollAddPaymentPageToTop()}scrollAddPaymentPageToTop(){globalThis.window?.setTimeout(()=>{globalThis.window?.scrollTo({top:0,left:0,behavior:"auto"}),globalThis.document?.querySelector("body")?.scrollTo(0,0),globalThis.document?.querySelector("html")?.scrollTo(0,0)},0)}async submit(){try{this.loading=!0;let o=this.pathService.createCustomer,_=F({aid:this.aid},this.registerForm.value),l=await this.settingsService.post(o,_);if(l.success!==!0)throw Error(l.error);if(this.notificationService.openDialog("Saved","Your information has been updated."),this.aid)return this.router.navigateByUrl("/user/cards/view/"+this.aid);await this.router.navigateByUrl("/user/cards/view")}catch(o){this.errorService.showError(o)}finally{this.loading=!1,this.cdr.markForCheck();return}}billingDifferent(){this.registerForm.controls.billing_address_different.value===!0?(this.registerForm.controls.billing_address_line_1.setValidators([s.required]),this.registerForm.controls.billing_address_line_1.updateV
1alueAndValidity(),this.registerForm.controls.billing_city.setValidators([s.required]),this.registerForm.controls.billing_city.updateValueAndValidity(),this.registerForm.controls.billing_state.setValidators([s.required]),this.registerForm.controls.billing_state.updateValueAndValidity(),this.registerForm.controls.billing_country.setValidators([s.required]),this.registerForm.controls.billing_country.updateValueAndValidity(),this.registerForm.controls.billing_zip.setValidators([s.required]),this.registerForm.controls.billing_zip.updateValueAndValidity()):(this.registerForm.controls.billing_address_line_1.setValidators([]),this.registerForm.controls.billing_address_line_1.updateValueAndValidity(),this.registerForm.controls.billing_city.setValidators([]),this.registerForm.controls.billing_city.updateValueAndValidity(),this.registerForm.controls.billing_state.setValidators([]),this.registerForm.controls.billing_state.updateValueAndValidity(),this.registerForm.controls.billing_country.setValidators([]),this.registerForm.controls.billing_country.updateValueAndValidity(),this.registerForm.controls.billing_zip.setValidators([]),this.registerForm.controls.billing_zip.updateValueAndValidity())}static{this.\u0275fac=function(_){return new(_||i)(u(B),u(h),u(re),u(I),u(de),u(me),u(se),u(ce))}}static{this.\u0275cmp=T({type:i,selectors:[["app-add-credit-card"]],features:[q([h])],decls:65,vars:27,consts:[[1,"text-center","my-2"],["mat-button","",3,"routerLink"],["mat-button","","routerLink","/user/cards/view"],[1,"d-flex"],[1,"mx-auto","my-2",3,"diameter","strokeWidth"],[1,"medium-card"],[3,"ngSubmit","formGroup"],[1,"forms-inner"],[1,"section"],[1,"form-row"],[1,"form-group","col"],["type","tel","autocomplete","cc-number","formControlName","card_number","name","card_number","maxlength","16","placeholder","Credit card number",1,"form-control"],[1,"form-group","col",2,"display","flex"],["autocomplete","cc-exp-month","formControlName","expiry_month","type","tel","maxlength","2","name","expiry_month","placeholder","MM",1,"form-control","small-number"],["autocomplete","cc-exp-year","formControlName","expiry_year","type","tel","maxlength","2","name","['expiry_year']","placeholder","YY",1,"form-control","small-number"],["autocomplete","cc-csc","formControlName","cvc","type","tel","name","cvv","placeholder","CVV",1,"form-control","small-number"],[1,"hint"],[1,"form-group",3,"ngClass"],["autocomplete","shipping street-address","formControlName","mailing_address_line_1","required","","placeholder","Address (line 1)",1,"form-control"],[1,"alert","alert-warning","mt-2"],[1,"form-group"],["autocomplete","shipping address-line2","formControlName","mailing_address_line_2","placeholder","Address (line 2)",1,"form-control"],["autocomplete","shipping postal-code","formControlName","mailing_zip","placeholder","Zip code","required","",1,"form-control"],["autocomplete","shipping locality","formControlName","mailing_city","placeholder","City","required","",1,"form-control"],[1,"form-group","select-field",3,"ngClass"],["required","","autocomplete","shipping country","placeholder","Country","formControlName","mailing_country",1,"form-control"],[3,"value"],["autocomplete","billing region","formControlName","mailing_state",1,"form-control"],[1,"text-center","mx-2"],["type","checkbox","formControlName","billing_address_different",3,"change"],[1,"alert","alert-danger"],[1,"buttons"],["type","submit","mat-button","","color","primary",3,"disabled"],["autocomplete","billing address-line1","formControlName","billing_address_line_1","placeholder","Address (line 1)",1,"form-control"],["formControlName","billing_address_line_2","autocomplete","billing address-line2","placeholder","Address (line 2)",1,"form-control"],["autocomplete","billing postal-code","formControlName","billing_zip","placeholder","Zip code","type","number",1,"form-control"],["autocomplete","billing locality","formControlName","billing_city","placeholder","City",1,"form-control"],["autocomplete","billing region","formControlName","billing_state",1,"form-control"],[1,"form-group","select-field"],["autocomplete","billing country","placeholder","Country","formControlName","billing_country",1,"form-control"]],template:function(_,l){_&1&&(t(0,"div",0),d(1,he,4,2,"button",1),d(2,be,4,0,"button",2),e(),t(3,"div",3),d(4,Se,1,2,"mat-spinner",4),e(),t(5,"mat-card",5)(6,"form",6),x("ngSubmit",function(){return l.submit()}),t(7,"mat-card-header")(8,"mat-card-title"),n(9,"Add credit card"),e(),p(10,"mat-card-subtitle"),e(),t(11,"mat-card-content")(12,"div",7)(13,"div",8)(14,"div",9)(15,"div",10),p(16,"input",11),e(),t(17,"div",12),p(18,"input",13)(19,"input",14)(20,"input",15),e()(),d(21,xe,2,0,"div",16),d(22,Ee,2,0,"div",16),d(23,Fe,2,0,"div",16),e(),t(24,"div",17)(25,"label"),n(26,"Address line 1"),e(),p(27,"input",18),d(28,Ae,3,0,"div",19),e(),t(29,"div",20)(30,"label"),n(31,"Address line 2"),e(),p(32,"input",21),e(),t(33,"div",20)(34,"label"),n(35,"Zip / Postal code"),e(),p(36,"input",22),d(37,Te,3,0,"div",19),e(),t(38,"div",17)(39,"label"),n(40,"City"),e(),p(41,"input",23),d(42,Ve,3,0,"div",19),e(),t(43,"div",24)(44,"label"),n(45,"Country"),e(
1),t(46,"select",25),C(47,qe,2,2,"option",26,g),e(),d(49,Me,3,0,"div",19),e(),t(50,"div",24)(51,"label"),n(52,"State"),e(),t(53,"select",27),C(54,Ne,2,2,"option",26,g),e(),d(56,we,3,0,"div",19),e(),t(57,"div",28)(58,"mat-checkbox",29),x("change",function(){return l.billingDifferent()}),n(59," Billing address is different "),e()(),d(60,De,36,5,"div"),e(),d(61,Le,3,0,"div",30),e(),t(62,"mat-card-actions",31)(63,"button",32),n(64," save "),e()()()()),_&2&&(r(),m(l.aid?1:-1),r(),m(l.aid?-1:2),r(2),m(l.loading?4:-1),r(2),c("formGroup",l.registerForm),r(15),m(l.registerForm.controls.card_number.invalid?21:-1),r(),m(l.registerForm.controls.expiry_month.invalid?22:-1),r(),m(l.registerForm.controls.expiry_year.invalid?23:-1),r(),c("ngClass",y(19,b,!l.registerForm.controls.mailing_address_line_1.valid)),r(4),m(l.registerForm.controls.mailing_address_line_1.invalid===!0?28:-1),r(9),m(l.registerForm.controls.mailing_zip.invalid===!0?37:-1),r(),c("ngClass",y(21,b,!l.registerForm.controls.mailing_city.valid)),r(4),m(l.registerForm.controls.mailing_city.invalid===!0?42:-1),r(),c("ngClass",y(23,b,!l.registerForm.controls.mailing_country.valid)),r(4),v(l.countries),r(2),m(l.registerForm.controls.mailing_country.invalid===!0?49:-1),r(),c("ngClass",y(25,b,!l.registerForm.controls.mailing_state.valid)),r(4),v(l.states),r(2),m(l.registerForm.controls.mailing_state.invalid===!0?56:-1),r(4),m(l.registerForm.value.billing_address_different?60:-1),r(),m(l.registerForm.valid?-1:61),r(2),c("disabled",!l.registerForm.valid||l.loading))},dependencies:[w,N,P,k,oe,H,ee,ie,O,J,X,Y,W,te,ne,Q,K,ae,le,ge,_e,j,z,ue,pe,$,R,G,L,U,Z,D],styles:[".buttons[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}"]})}}return i})();export{ui as default}; 2//# sourceMappingURL=chunk-Y7YAA3FA.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.