1import{b as A}from"./chunk-DS26UMK5.js";import"./chunk-PFJOSMBQ.js";import"./chunk-ZGQ2OYA5.js";import{H as T}from"./chunk-VDWXESJF.js";import"./chunk-JCOTUPE5.js";import{Bc as E,_ as P,da as R,gc as k,ha as D}from"./chunk-TXT3R3MF.js";import{Hc as v,Ja as a,L as u,S as y,Ya as h,ad as C,bd as S,cd as b,fc as g,k as s,ta as f,ua as l,x as m,xa as c,y as p}from"./chunk-PWAHSUDZ.js";import"./chunk-2BAXZMGZ.js";var w=["threeDS2Container"],I=class d{constructor(){this.activeCartFacade=a(T);this.destroyRef=a(h);this.paymentService=a(A);this.router=a(R);this.routingService=a(E);this.userIdService=a(k)}ngAfterViewInit(){this.router.events.pipe(D(this.destroyRef),f(null),u(e=>!e||e instanceof P),m(()=>this.getCheckoutPaymentResponse()),l(e=>e?this.paymentService.getAdyenCheckout(e).pipe(c(t=>this.initializeChallenge(t,e))):(console.error("No Payment Response data in navigation state!"),this.paymentService.onError(!0),s))).subscribe()}getCheckoutPaymentResponse(){return(this.router.currentNavigation()??this.router.lastSuccessfulNavigation())?.extras.state}initializeChallenge(e,t){let i=t.fingerPrintToken,n=t.challengeToken,r=t.paymentData;if(!r?.length||!i?.length&&!n?.length)return console.error("Payment Response data is invalid! [PaymentData, FingerPrintToken, ChallengeToken]:",r,i,n),this.paymentService.onError(!0);i?.length?e.create("threeDS2DeviceFingerprint",{fingerprintToken:i,onComplete:o=>this.onComplete(o,r),onError:o=>console.debug("Error during the Identify step!",o)}).mount(this.threeDS2Container?.nativeElement):n?.length&&e.create("threeDS2Challenge",{challengeToken:n,size:"05",onComplete:o=>this.onComplete(o,r),onError:o=>console.debug("Error during the Challenge step!",o)}).mount(this.threeDS2Container?.nativeElement)}onComplete(e,t){let i={challengeResult:e.data.details["threeds2.challengeResult"],fingerprintResult:e.data.details["threeds2.fingerprint"],paymentData:t};p([this.userIdService.takeUserId(),this.activeCartFacade.takeActiveCartId()]).pipe(l(([n,r])=>this.paymentService.submit3DS2(i,n,r).pipe(y(()=>(this.paymentService.onError(),s)),c(o=>this.paymentService.handlePaymentResponse(o,n,r))))).subscribe()}static{this.\u0275fac=function(t){return new(t||d)}}static{this.\u0275cmp=g({type:d,selectors:[["bonfiglioli-payment-3ds2-adyen"]],viewQuery:function(t,i){if(t&1&&C(w,5),t&2){let n;S(n=b())&&(i.threeDS2Container=n.first)}},standalone:!1,decls:2,vars:0,consts:[["threeDS2Container",""]],template:function(t,i){t&1&&v(0,"div",null,0)},encapsulation:2})}};export{I as BonfiglioliPayment3ds2AdyenComponent};
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.