1import{a as N}from"./chunk-3CMFNFY3.js";import{a as B}from"./chunk-HV6W3HS3.js";import{c as Q}from"./chunk-4TLFZBIT.js";import"./chunk-Y7UKFOBD.js";import{a as I}from"./chunk-DAJ4XMZ3.js";import"./chunk-UDVNABZO.js";import{c as U}from"./chunk-NETIIAB6.js";import"./chunk-I4YYPFKR.js";import"./chunk-VZS7PRIT.js";import"./chunk-WJK2THVF.js";import"./chunk-TNYTWBPN.js";import"./chunk-KI5KWZ6P.js";import"./chunk-PEU67C6J.js";import"./chunk-4RQKLANU.js";import"./chunk-U37OFNKH.js";import"./chunk-ZH66IXOP.js";import"./chunk-F25Q44KB.js";import"./chunk-IAHJFMAZ.js";import"./chunk-DF7G2DJU.js";import"./chunk-NXU5XRGR.js";import{o as j}from"./chunk-IJGV6PEH.js";import"./chunk-UXFYXNZB.js";import"./chunk-2PZQVO5M.js";import"./chunk-5J364GZE.js";import{ea as M}from"./chunk-24RBYWHK.js";import{x as O}from"./chunk-LYGGRJPP.js";import"./chunk-CLFYICNC.js";import"./chunk-U7N5LJKI.js";import"./chunk-65TISXPA.js";import"./chunk-CQVGPCJN.js";import"./chunk-VU6FXXNN.js";import"./chunk-R65BPLEU.js";import"./chunk-66W4FRMO.js";import{b as n}from"./chunk-Q2HHPJLL.js";import"./chunk-WCZ7ODOR.js";import{d as R}from"./chunk-MRPA26HF.js";import"./chunk-YNOYMHTV.js";import"./chunk-RYYSJJVE.js";import{$ as E,b as A,da as w}from"./chunk-DSTH3QV4.js";import{Ab as g,Bb as y,Fb as k,Gb as v,Ka as h,Kc as C,O as o,Ob as S,Qa as a,Wb as f,Ya as l,a as c,d as m,fb as p,hd as T,id as x,jc as P,jd as _,kc as b,la as u,zb as d}from"./chunk-6KO6CXQN.js";import"./chunk-Q5ZUIUCT.js";function Z(r,q){if(r&1&&(k(0),d(1,"main",1),P(2,"async"),y(3,"popsy-lottie-animation",2),g(),v()),r&2){let e=S();h(),f("rtl",b(2,2,e.rtlMode$))}}var Y=2e3,L=10,gt=(()=>{class r{constructor(e,t,i,D,F,$,G,H,z,V,W){this.zone=e,this.meta=t,this.tidioService=i,this.akitaScreenQuery=D,this.translateService=F,this.akitaRouterQuery=$,this.googleAnalyticsService=G,this.purchaseTrackingService=H,this.akitaRouterService=z,this.akitaProductsQuery=V,this.akitaCheckoutService=W,this.retryPaymentStatusCounter=0,this.sessionProducts=[],this.sessionInsurances=[],this.hasBuyback=!1,this.isProtected=!1,this.protectionPrice=0,this.discountAmount=0,this.destroySubject=new m,this.subscriptions=new c,this.rtlMode$=this.akitaRouterQuery.selectIsRtlLayout(),this.isBrowser=this.akitaRouterQuery.isBrowser,this.lessThan$=this.akitaScreenQuery.selectLessThan(),this.subscriptions.add(this.translateService.langChanges$.pipe(o(this.destroySubject)).subscribe({next:()=>{let s=this.translateService.translate("title_delivery_status_processing");this.meta.setTitle("title_delivery_status_processing",!0),this.meta.setCanonical(),this.meta.setAlternateHreflangsTags(null),this.meta.setTags([{name:"og:url",content:`${A.getLocationHref()||""}`},{name:"og:type",content:"website"},{name:"og:description",content:s},{name:"description",content:s}])},error:()=>{}}))}ngAfterViewInit(){let e=`${this.akitaRouterQuery.viewStep||""}`.replace("TAMAM_",""),t=this.akitaRouterQuery.queryParams.pid||this.akitaRouterQuery.params.pid||"";this.tidioService.addVisitorTags([`cko_${e}`.toLowerCase()]),this.tidioService.track(`cko_${e}`.toLowerCase()),e==="SUCCESS"?this.handlePaymentSuccess(t):e==="FAILURE"&&this.handlePaymentError(t)}handlePaymentSuccess(e){M(this.googleAnalyticsService.logEventWrapper,"CHECKOUT",this.akitaProductsQuery.country),this.subscriptions.add(this.akitaCheckoutService.fetchSession(e).pipe(o(this.destroySubject)).subscribe({next:t=>{this.sessionProducts=t?.order||[],this.sessionInsurances=t?.insurances||[],this.hasBuyback=!!t?.buyBackCart||!1,this.isProtected=!!t?.protectionPrice||!1,this.protectionPrice=t?.protectionPrice?.amount||0,this.discountAmount=t?.discount?.amount||0,this.fetchPaymentStatus(t?.id||e,t?.orderId||null)},error:()=>{}}))}handlePaymentError(e){this.navigateToPaymentErrorPage(e)}navigateToSuccessPage(e){this.akitaCheckoutService.updateCheckoutStep("SUCCESS");let t=this.akitaRouterQuery.homeUrlFragment;e&&(t.push("checkout"),t.push(e),t.push("overview")),n.addBreadcrumb({category:"Payment Callback",message:"User redirected to success page from Checkout.com",level:"info",type:"navigation"}),this.akitaRouterService.navigate(t,{cko:"success"},{replaceUrl:!0})}navigateToPaymentErrorPage(e){this.akitaCheckoutService.updateCheckoutStep("FAILURE");let t=this.akitaRouterQuery.homeUrlFragment;console.log("navigateToPaymentErrorPage",e),e&&(t.push("checkout"),t.push(e),t.push("overview")),n.addBreadcrumb({category:"Payment Callback",message:"User redirected to error page from Checkout.com",level:"info",type:"navigation"}),this.akitaRouterService.navigate(t,{cko:"error"},{replaceUrl:!0})}navigateToTrackinOrderPage(e){let t=this.akitaRouterQuery.homeUrlFragment;console.log("navigateTrackinOrderPage",e),e&&(t.push("order"),t.push(e)),n.addBreadcrumb({category:"Payment Callback",message:"User redirected to error page from Checkout.com",level:"info",type:"navigation"}),this.akitaRouterService.navigate(t,{replaceUrl:!0})}fetchPaymentStatus(e,t){this.zone.runOutsideAngular(()=>{this.subscriptions.add(this.akitaCheckoutService.fetchPayment(t).pipe(o(this.destroySubject)).subscribe({next:i=>{i?.paymentState==="APPROVED"||i?.paymentState==="COMPLETE"?this.purchaseTrackingService.emitOnce({orderId:t,payment:i,products:this.sessionProducts,insurances:this.sessionInsurances,callSite:"tamam-callback",listName:"redirect",isProtected:this.isProtected,protectionPrice:this.protectionPrice,discountAmount:this.discountAmount,isAbandoned:null,hasBuyback:this.hasBuyback}).finally(()=>this.navigateToSuccessPage(e||null)):(i?.paymentState==="PENDING"||i?.paymentState==="WAITING")&&this.retryPaymentStatusCounter<L?this.akitaRouterQuery.isBrowser&&setTimeout(()=>{this.retryPaymentStatusCounter+=1,this.fetchPaymentStatus(e,t)},Y):(i?.paymentState==="PENDING"||i?.paymentState==="WAITING")&&this.retryPaymentStatusCounter>L?this.navigateToTrackinOrderPage(t||null):this.navigateToPaymentErrorPage(e||null)},error:i=>{n.addBreadcrumb({category:"Payment Callback",message:"Error while fetching payment status from Checkout.com",level:"error",type:"network"}),n.reportException(i,!1),this.navigateToPaymentErrorPage(e||null)}}))})}ngOnDestroy(){this.destroySubject.next(),this.destroySubject.complete(),this.subscriptions&&this.subscriptions.unsubscribe()}static{this.\u0275fac=function(t){return new(t||r)(a(u),a(w),a(N),a(R),a(T),a(E),a(O),a(B),a(I),a(j),a(Q))}}static{this.\u0275cmp=l({type:r,selectors:[["app-tamam-callback"]],decls:1,vars:0,consts:[[4,"transloco"],[1,"tamam-callback-component"],["animation","popsy-loading",1,"animation"]],template:function(t,i){t&1&&p(0,Z,4,4,"ng-container",0)},dependencies:[_,x,U,C],styles:["@keyframes _ngcontent-%COMP%_loading{0%{transform:translate(-45%)}to{transform:translate(345%)}}
1.tamam-callback-component[_ngcontent-%COMP%]{display:block;position:relative;box-sizing:border-box;backface-visibility:hidden;transform:translateZ(0);transform-origin:50% 51%;display:flex;align-items:center;justify-content:center;height:100%;min-height:100%;max-width:350px;margin:0 auto}.tamam-callback-component[_ngcontent-%COMP%] .payment-success-info[_ngcontent-%COMP%]{text-align:center;margin:0 auto}.tamam-callback-component[_ngcontent-%COMP%] .animation[_ngcontent-%COMP%]{display:block;position:relative;box-sizing:border-box;backface-visibility:hidden;transform:translateZ(0);transform-origin:50% 51%;margin:0 auto;width:250px;height:250px;min-width:250px;min-height:250px;max-width:250px;max-height:250px}.tamam-callback-component[_ngcontent-%COMP%] .animation.small[_ngcontent-%COMP%]{width:150px;height:150px;min-width:150px;min-height:150px;max-width:150px;max-height:150px}.button[_ngcontent-%COMP%]{margin:0 auto}.icon[_ngcontent-%COMP%]{display:block;height:35px}.header[_ngcontent-%COMP%]{position:absolute;top:0;padding:16px 0;width:91%}"]})}}return r})();export{L as MAX_PAYMENT_STATUS_FETCH_RETRIES,Y as PAYMENT_STATUS_FETCH_INTERVAL,gt as TamamCallbackComponent};
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.