1import{D as I,q as g,W as M,j as s,R as N,F as b,sk as T,v3 as O,uS as _,so as v,v4 as x,sn as U,a$ as D,ss as j,v5 as k,a6 as $,c as B,a as m,v6 as G,v0 as W,e6 as V,X as z,v1 as K,r as c,v7 as X,v8 as Y,sr as q}from"./index-CQaiPqwp.js";import{a as H,C as Q}from"./CardLayout.component-BflI0h-4.js";import{a as J}from"./Error.component-Bwgogc-p.js";import{A as Z}from"./AppLayout.component-B34jiFc-.js";import{w as R}from"./timer-CPqfzdCq.js";import{c as tt}from"./appError.selector-DKkfyGQw.js";import"./react-select.esm-BTkEaSrm.js";import"./RichTextLink.component-BuB0fEgt.js";import"./PrivateContent.component-CA0ub5Pl.js";const et=g.div` 2 ${H} { 3 4 @media ${I.TABLET} { 5 padding: 60px 80px; 6 } 7 8 @media ${I.DESKTOP} { 9 padding: 60px 80px; 10 } 11 } 12`,at=M` 13 0%, 80%, 100% { 14 transform: scale(0.6); 15 opacity: 0.35; 16 } 17 40% { 18 transform: scale(1.2); 19 opacity: 1; 20 } 21`,nt=g.div` 22 display: flex; 23 justify-content: center; 24 align-items: center; 25`,rt=g.section` 26 display: flex; 27 flex-direction: column; 28 align-items: center; 29 gap: 10px; 30`,st=g.div` 31 display: flex; 32 align-items: center; 33 gap: 10px; 34`,E=g.div` 35 width: 14px; 36 height: 14px; 37 border-radius: 50%; 38 background: ${t=>t.theme.primary}; 39 animation: ${at} 1.2s ease-in-out infinite; 40 41 &:nth-child(1) { animation-delay: 0s; } 42 &:nth-child(2) { animation-delay: 0.2s; } 43 &:nth-child(3) { animation-delay: 0.4s; } 44`,ot=({document:t})=>s.jsx(nt,{children:s.jsxs(rt,{children:[s.jsxs(st,{children:[s.jsx(E,{"aria-hidden":"true"}),s.jsx(E,{"aria-hidden":"true"}),s.jsx(E,{"aria-hidden":"true"})]}),t&&s.jsx(N,{document:t,defaultFontSize:b.TEXT_SMD})]})}),{PaymentStatus:l}=_,it=3e5,w=15e3,ct=[l.FAILED,l.REFUSED,l.TIMEOUT,l.REFUND_FAILED],lt=[k,j];function dt(t){return async(e,o,n)=>{try{let a=T(o());const i=O(o());if(i&&[l.CANCELED,l.SUCCESS].includes(i)&&!a&&(n.logger.info("[Processing payment] Begin polling order creation",{orderId:a}),a=await ut(t,e,o,n)),a){n.logger.info("[Processing payment] Order id retrieved and redirect to /confirmation page",{orderId:a}),mt(t,a);return}await e(v()),await e(x())}catch(a){n.logger.error("[Processing payment] Fatal error during payment processing",{error:a}),await e(x())}}}function mt(t,e){D.setItem(D.Key.ORDER_ID,e,1),t.replace(j)}async function ut(t,e,o,n){const a=Date.now(),i=()=>Date.now()-a<it;let u=!1;for(;i();){try{if(!A(t))return;await e(v());const r=O(o());if(r&&ct.includes(r))return;if(r===l.SUCCESS){u=!0;break}}catch(r){n.logger.error("[Processing payment] Failed to retrieve payment status during polling",{error:r})}await R(w)}if(u)for(;i();){try{if(!A(t))return;await e(U());const r=T(o());if(r)return r}catch(r){n.logger.error("[Processing payment] Failed to load cart order ID during polling",{error:r})}await R(w)}}const A=t=>lt.includes(t.location.pathname),L=_.PaymentStatus,pt="msg.loader.waiting",Dt=()=>{const t=$(),e=B(),o=m(G),n=m(W),a=m(V),i=m(z(pt)),u=m(tt),r=m(K),S=n?.paymentStatus,f=S&&[L.CANCELED,L.SUCCESS].includes(S),P=c.useRef(!1),h=c.useRef(f);h.current=f;const d=u||r,y=!!(d&&!!(f&&o)),C=c.useRef(!1);c.useEffect(()=>{d&&!C.current&&(t(X(d)),C.current=!0)},[d,t]),c.useEffect(()=>(t(dt(e)),P.current=!0,()=>{h.current&&t(Y(void 0))}),[t,e]),c.useEffect(()=>{P.current&&!y&&e.push(q)},[y,e]);const F=c.useMemo(()=>{if(!y)return null;const p=new Map;return p.set("%paiement_id%",d),p.set("%user_email%",a||""),p.set("%cart_amount%",n?.amount?.toString()||""),p.set("%cart_currency%",n?.currencyCode||""),p},[y,d,a,n]);return s.jsx(Z,{children:s.jsx(et,{children:s.jsx(Q,{children:s.jsx(J,{returnOnLastFunnel:void 0,httpError:o,placeholderMap:F,children:s.jsx(ot,{document:i})})})})})};export{Dt as ProcessingPaymentPresentation};
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.