PageSourceSearch

https://javamoose.com/cdn/shopifycloud/checkout-web/assets/c1/component-PaymentChallengeModal.qoYuE2wO.js

js javamoose.com collected 2026-09-26 21:22:28 UTC 6,929 bytes, 1 lines download raw bytes

1import{k as I,A,h as S,u as e,F as V,T as Y,q as H,S as E}from"./esnext-vendor.B9Da21W6.js";import{z as W,P as k,F as X,B as R,G as j,k as u,j as B,I as J,b,bu as K,bB as Z}from"./hydrate.DZ4YTm7p.js";import{Q as ee,C as ne}from"./QRCode.CJw16n0F.js";import"./app.DbSrjjlA.js";import{bH as te,S as M,H as ae,bI as oe}from"./addresses-is-address-empty.Bn2lNY_L.js";import"./graphql-PaymentSessionMutation.CAXCwUvV.js";import"./hooks-useShopPayExternalAppContext.DWwMuRnz.js";import"./hooks-useReplaceShopPayInHistory.DPpLejwu.js";var C={Countdown:"_1cm3fw02 _1cm3fw01 _1fragem6t _1fragemzf _1fragem82",Bar:"_1cm3fw04 _1cm3fw03 _1fragemup _1fragemv4 _1fragemzf _1fragem32",BarFill:"_1cm3fw06 _1cm3fw05 _1fragem4q",fillSizeVar:"var(--_1cm3fw00)"};const ie=X("Countdown");function se({duration:n=0,defaultValue:t=n,label:o,onEnd:a}){const d=W(void 0,ie),[r]=I(()=>Date.now()+t),[l,m]=I(()=>Math.max(t,0)),y=A(a),s=A(!1);y.current=a,S(()=>{let p;const i=()=>{const g=Math.max(r-Date.now(),0);if(m(g),g===0){s.current||(s.current=!0,y.current?.());return}p=setTimeout(i,g%1e3||1e3)};return i(),()=>clearTimeout(p)},[r]);const w=n>0?Math.min(Math.max((n-l)/n*100,0),100):0;return e("div",{role:o?"timer":void 0,"aria-labelledby":o?d:void 0,className:C.Countdown,children:[e("div",{"aria-hidden":!0,className:C.Bar,style:V({[C.fillSizeVar]:`${w}%`}),children:e("div",{className:C.BarFill})}),o&&e(k,{id:d,accessibilityVisibility:"hidden",type:"small",textAlign:"center",color:"subdued",children:o(l)})]})}function N(n=navigator.userAgent,t){return te(n)||/Shop App\/[^/]+\/iOS\//.test(n)||t!=null&&t!=="WEB"}const re="modal_rendered",le="buyer_action_timeout",ce="buyer_closes_modal",de="qr_code_rendered",me="buyer_copies_to_clipboard",_e="external_action_rendered";function ue(n){const{paymentMethod:t}=n,{userEvents:o,shop:{id:a},source:d}=M(),r=l=>o.monorailEvent({schemaId:"checkout_buyer_action_required_events/1.0",payload:{eventTriggerReason:l,paymentMethodDisplayName:t.name,checkoutSessionIdentifier:d.checkoutSessionIdentifier||"",shopId:parseInt(ae(a),10)}});return{onModalRendered:()=>r(re),onModalTimeout:()=>r(le),onModalExit:()=>r(ce),onCopiedToClipboard:()=>r(me),onChallengeRendered:l=>{switch(l){case"QR_CODE":r(de);break;case"EXTERNAL":r(_e);break}}}}const pe="/cdn/shopifycloud/checkout-web/assets/c1/assets/blik.DVGmDGpj.svg",ge="/cdn/shopifycloud/checkout-web/assets/c1/assets/bogus.Dgqxw51f.svg",fe="/cdn/shopifycloud/checkout-web/assets/c1/assets/pix.D3fYfWH5.svg",he="/cdn/shopifycloud/checkout-web/assets/c1/assets/swish.Bmk5gRpD.svg",be="https://cdn.shopify.com/static/retail/lpm-icons/png/square-icons",ye=new Set(["alipay","bancontact","blik","eps","ideal","klarna","mobilepay","multibanco","paypal","przelewy24","satispay","sofort","swish","twint","usdc","wechatpay"]);function Ie(n){return n.toLowerCase().replace(/[\s_-]+/gu,"")}function Ce(n){for(const t of n){if(typeof t!="string"||t==="")continue;const o=Ie(t);if(ye.has(o))return`${be}/${o}.png`}}const Se=n=>{const t=Math.floor(n/36e5),o=String(Math.floor(n%36e5/6e4)).padStart(2,"0"),a=String(Math.floor(n%6e4/1e3)).padStart(2,"0");return t>0?`${t}:${o}:${a}`:`${o}:${a}`},we=n=>{const t=oe(n);return t?Ee[t]:null},xe=(n,t)=>t!=null?Math.max(t-Date.now(),0):n&&Z(n)&&n.timeout?.millisecondsRemaining||0,Ee={bogus_app_coin:ge,pix:fe,blik:pe,swish:he},Re=["wechat_pay","paynow"];function Ne({challengeType:n,challengeData:t,receipt:o,paymentMethod:a,onModalRender:d,challengeExpiresAt:r}){const l=xe(o,r),[m,y]=I(!1),[s,w]=I(),[p]=I(l),{i18n:i,client:g,embed:D}=M(),c=ue({paymentMethod:a});Y(()=>{m&&d&&setTimeout(()=>{d()},1e3)},[m,d]);const L=()=>{c.onModalExit(),window.location.reload()},q=H(()=>(o&&(c.onModalTimeout(),y(!1)),null),[o,c]);S(()=>{n&&t&&p&&(w(JSON.parse(t)),y(!0))},[n,t,p]);let f,h,O=!1,v;switch(n){case"QR_CODE":if(f=i.translate("payment_challenge_modal.qr_code.instructions",{paymentMethod:a.name}),s){const _=JSON.parse(s.data);h=_?.mobile_app_universal_url,v=_?.instruction,O=Re.includes(_?.instruction),_?.instruction==="wechat_pay"?f=N(g.userAgent,D?.platform)?i.translate("payment_challenge_modal.qr_code.wechat_instructions_mobile"):i.translate("payment_challenge_modal.qr_code.wechat_instructions"):_?.instruction==="paynow"&&(f=N(g.userAgent,D?.platform)?i.translate("payment_challenge_modal.qr_code.paynow_instructions_mobile"):i.translate("payment_challenge_modal.qr_code.paynow_instructions"))}break;case"EXTERNAL":f=i.translate("payment_challenge_modal.external.instructions",{paymentMethod:a.name});break;default:f=i.translate("payment_challenge_modal.instructions",{paymentMethod:a.name});break}S(()=>{m&&s&&c.onModalRendered()},[m,s,c]),S(()=>{s&&c.onChallengeRendered(n)},[c,s,n]);const P=_=>i.translate("payment_challenge_modal.timer_message",{timeLeft:Se(_)}),Q=i.translate("payment_challenge_modal.copy_text",{paymentMethod:a.name}),U=i.translate("payment_challenge_modal.open_app_text",{paymentMethod:a.name}),$=h?U:Q,z=i.translate("payment_challenge_modal.header",{paymentMethod:a.name}),F=i.translate("payment_challenge_modal.close"),T=we(a),x=n==="QR_CODE"?Ce([v,...a.paymentBrands??[]]):void 0,G=()=>{h&&(window.open(h,"_blank"),c.onChallengeRendered("QR_CODE"))};return o&&e(K,{open:m,blocking:!0,accessibilityLabel:z,size:"base",children:e(R,{children:[e(j,{gridAutoFlow:"column",gridTemplateColumns:"minmax(0, 1fr) minmax(auto, max-content)",gridTemplateRows:"minmax(0, 1fr)",gap:"large-300",alignItems:"center",alignContent:"center",children:[e(k,{size:"large",textAlign:"start",children:z}),e(u,{gap:"small-400",alignItems:"end",children:e(B,{onClick:()=>L(),variant:"plain",tone:"monochrome",inlineAlignment:"end",accessibilityLabel:F,children:e(J,{type:"x"})})})]}),e(R,{children:[e(b,{blockSize:"base"}),T&&!x&&e(E,{children:[e(u,{gap:"large-300",alignItems:"center",children:e("img",{src:T,alt:a.name})}),e(b,{blockSize:"small-400"})]}),e(u,{gap:"large-300",alignItems:"center",children:e(k,{size:"base",textAlign:"center",textWrap:"pretty",children:f})}),n==="QR_CODE"&&s&&e(E,{children:[e(b,{blockSize:"base"}),e(u,{gap:"base",alignItems:"center",children:[e(u,{gap:"base",maxInlineSize:"150px",minInlineSize:"150px",alignItems:"center",children:e(ee,{content:s?.code,size:"fill",logo:x},x)}),!O&&e(E,{children:[e(b,{blockSize:"large-200"}),e(u,{gap:"base",alignItems:"center",maxInlineSize:"400px",minInlineSize:"@media (inline-size >= extraSmall) 400px, 100%",children:e(B,{commandFor:"qr-code-challenge-data-code",command:h?void 0:"--copy",inlineSize:"fill",inlineAlignment:"center",onClick:G,children:$})}),!h&&e(ne,{text:s?.code,id:"qr-code-challenge-data-code",onCopy:()=>c.onCopiedToClipboard()})]})]})]}),e(b,{blockSize:"large-200"}),e(u,{alignItems:"center",children:e(R,{maxInlineSize:"150px",minInlineSize:"150px",children:e(se,{duration:p,defaultValue:l,label:P,onEnd:q})})}),e(b,{blockSize:"large-200"})]})]})})}export{Ee as SUPPORTED_PAYMENT_METHOD_BRAND_ICONS,Ne as default};

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.