PageSourceSearch

https://cling-ai.com/assets/paymentRescueModalLoader-DIMTqqwD.js

js cling-ai.com collected 2026-10-07 03:31:30 UTC 12,514 bytes, 1 lines download raw bytes

1import{a as e}from"./rolldown-runtime-BEU_UCik.js";import{B as t,K as r,et as a,j as n,mt as o,w as i}from"./app-bootstrap-2kFCW_6Z.js";import{F as s,Y as d,c as l,u as c}from"./vendor-react-JhNq9muS.js";import{t as u}from"./I18nextProvider-DHX6N185.js";import{t as p}from"./wallet-DnqwNF7e.js";import{At as m,Ut as h,Xt as x,en as y,n as b,rt as f,t as g}from"./vendor-ui-CFmqwDoN.js";import{a as w,i as v,s as j}from"./analytics-1nNoyuNO.js";import{t as k}from"./paymentOrderState-D9okyqe3.js";import{E as N,a as I,f as C,i as T,l as S,m as U,n as E,r as R,t as F,u as $,y as P}from"./paymentSuccessNotice-CEMZuXiQ.js";import{n as A}from"./PaymentMethodSelector-BrsnPCvt.js";t({paymentRescue:{contactSupport:"Still stuck? Contact support",back:"Back",chooseCoin:"Choose a coin",noAlternatives:"No alternative methods in your region - please contact support.",coinSubtitle:"${{amount}} - scan and we credit automatically",coinHint:{usdttrc20:"Fastest - lowest fee",usdterc20:"If your wallet is ERC20",btc:"10-60 min settlement",eth:"Native L1 - gas applies"},variantA:{title:"Payment didn't go through",subtitle:"${{price}} - a different method often works"},variantB:{title:"Try another way",subtitle:"${{price}} - these methods work more reliably in your region"}}});var B=e(d(),1),z=c();function L({isOpen:e,onClose:t,pending:o,trigger:i,userId:s,copyVariant:d="A"}){const{t:l}=n(),c=a(),u=r(c),[x,y]=(0,B.useState)([]),[g,L]=(0,B.useState)(!0),[V,M]=(0,B.useState)(null),[O,H]=(0,B.useState)(!1),[W,q]=(0,B.useState)("methods"),[D,X]=(0,B.useState)(null),[Y,_]=(0,B.useState)(null);!function(e){(0,B.useEffect)(()=>{if(!e)return;const t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=t}},[e])}(e),(0,B.useEffect)(()=>{if(!e)return;const r=e=>{e.detail?.orderId===o.orderId&&t()};return window.addEventListener(F,r),()=>window.removeEventListener(F,r)},[e,t,o.orderId]);const G=async()=>{if("ccpay"!==o.provider)return!0;const e=await p.getPaymentOrderStatus(o.orderId);return"confirmed"===k(e)?(E({orderId:o.orderId,productId:o.productId}),t(),!1):!!["failed","cancelled","expired"].includes(String(e.status).toLowerCase())||(t(),!1)};(0,B.useEffect)(()=>{if(!e)return H(!1),q("methods"),X(null),void _(null);requestAnimationFrame(()=>requestAnimationFrame(()=>H(!0)))},[e]),(0,B.useEffect)(()=>{e&&(S(),C(s),j({orderId:o.orderId,provider:o.provider,methodType:o.methodType,amountUsd:o.amountUsd,trigger:i}))},[e,o.orderId]),(0,B.useEffect)(()=>{if(!e)return;let t=!1;return L(!0),p.getExternalPaymentMethods({productId:o.productId}).then(e=>
1{t||y(N(e.methods,{defaultMethodType:"unknown"}))}).catch(()=>{t||y([])}).finally(()=>{t||L(!1)}),()=>{t=!0}},[e,o.productId]);const J=(0,B.useMemo)(()=>{const e=[];for(const t of x){const r=P(t)&&"crypto"===o.methodType;if((t.provider!==o.provider||r)&&((!t.methodType||!o.methodType||"unknown"===o.methodType||t.methodType!==o.methodType||r)&&(e.push(t),e.length>=4)))break}return e},[x,o.provider,o.methodType]),Q=function(e,t,r){return"B"===t?{title:e("paymentRescue.variantB.title",{defaultValue:"Try another way"}),subtitle:e("paymentRescue.variantB.subtitle",{price:r,defaultValue:"${{price}} - these methods work more reliably in your region"})}:{title:e("paymentRescue.variantA.title",{defaultValue:"Payment didn't go through"}),subtitle:e("paymentRescue.variantA.subtitle",{price:r,defaultValue:"${{price}} - a different method often works"})}}(l,d,o.amountUsd.toFixed(2)),Z=()=>{V||Y||($(o.orderId),v({orderId:o.orderId,provider:o.provider,methodType:o.methodType}),t())};return e&&"undefined"!=typeof document?(0,z.jsxs)("div",{className:"fixed inset-0 z-[9999] flex items-end sm:items-center justify-center",children:[(0,z.jsx)("button",{type:"button","aria-label":l("common.close","Close"),className:"absolute inset-0 bg-black/70 backdrop-blur-sm transition-opacity duration-200 "+(O?"opacity-100":"opacity-0"),onClick:Z}),(0,z.jsxs)("div",{className:["relative w-full max-w-[400px] rounded-t-[28px] sm:rounded-[28px]","bg-surface-base border border-divider shadow-2xl overflow-hidden","transition-all duration-300 ease-out will-change-transform",O?"translate-y-0 opacity-100 sm:scale-100":"translate-y-[30%] sm:translate-y-3 opacity-0 sm:scale-[0.97]"].join(" "),role:"dialog","aria-modal":"true","aria-labelledby":"rescue-modal-title",children:[(0,z.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-x-0 top-0 h-[120px] bg-gradient-to-b from-amber-500/[0.04] via-transparent to-transparent"}),(0,z.jsx)("button",{type:"button",onClick:Z,className:"absolute top-3.5 right-3.5 z-10 w-8 h-8 rounded-full bg-white/[0.04] border border-white/[0.06] flex items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-white/[0.08] transition-all","aria-label":l("common.close","Close"),children:(0,z.jsx)(b,{size:14})}),"methods"===W?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{className:"relative px-6 pt-7 pb-4",children:[(0,z.jsx)("div",{className:["inline-flex items-center justify-center w-11 h-11 rounded-2xl","bg-gradient-to-br from-amber-500/[0.12] to-amber-500/[0.04]","border border-amber-500/15 ring-1 ring-inset ring-white/[0.04]","mb-3.5"].join(" "),children:(0,z.jsx)(m,{className:"h-[18px] w-[18px] text-amber-200/90",strokeWidth:2.2})}),(0,z.jsx)("h2",{id:"rescue-modal-title",className:"text-[17px] font-black text-text-primary leading-tight tracking-tight",children:Q.title}),(0,z.jsx)("p",{className:"mt-1 text-[13px] text-text-secondary leading-snug",children:Q.subtitle})]}),(0,z.jsx)("div",{className:"px-4 pb-3",children:g?(0,z.jsx)("div",{className:"space-y-2 px-2",children:[0,1,2].map(e=>(0,z.jsx)("div",{className:"h-[56px] w-full rounded-2xl bg-white/[0.03] animate-pulse"},e))}):0===J.length?(0,z.jsx)("div",{className:"mx-2 rounded-2xl border border-divider bg-white/[0.02] p-4 text-center",children:(0,z.jsx)("p",{className:"text-[13px] text-text-secondary leading-relaxed",children:l("paymentRescue.noAlternatives","No alternative methods in your region - please contact support.")})}):(0,z.jsx)("div",{className:"space-y-1.5",children:J.map(e=>{const r=A(e,l),a=V===e.provider;return(0,z.jsxs)("button",{type:"button",disabled:!!V,onClick:()=>{(async e=>{if(V)return;if(w({originalOrderId:o.orderId,originalProvider:o.provider,newProvider:e.provider,newMethodType:e.methodType||"unknown",amountUsd:o.amountUsd}),P(e))return X(e),void q("cryptoPicker");M(e.provider);const r=I(e.methodType,e.provider);try{if(!(await G()))return R(r),void M(null);const a=await p.createExternalCheckout(o.productId,e.provider,e.account||void 0);if(U({orderId:a.orderId,productId:o.productId,provider:e.provider,account:e.account,methodType:e.methodType||"unknown",amountUsd:o.amountUsd,productLabel:o.productLabel,rescueShown:!1},o),a.checkoutUrl)return T(r,a.checkoutUrl)?void t():void(window.location.href=a.checkoutUrl);R(r),window.location.href=`/recharge?tab=coins&package=${o.productId}`}catch(a){R(r),M(null)}})(e)},className:["group w-full flex items-center gap-3 min-h-[56px] py-2 px-3 rounded-2xl","transition-all duration-150",a?"bg-gradient-to-r from-premium/[0.12] to-premium-light/[0.06] border border-premium/40 ring-1 ring-premium/20":"bg-white/[0.03] border border-white/[0.06] hover:bg-white/[0.05] hover:border-white/[0.12] active:scale-[0.995]",null===V||a?"":"opacity-40"].join(" "),children:[(0,z.jsx)("span",{className:["flex-shrink-0 flex items-center justify-center w-9 h-9 rounded-xl","bg-white/[0.04] border border-white/[0.06]",a?r.accent:"text-text-secondary","transition-colors"].join(" "),children:r.icon}),(0,z.jsx)("span",{className:"flex-1 min-w-0 text-left",children:(0,z.jsx)("span",{className:"block text-[14px] font-semibold text-text-primary truncate leading-tight",children:e.label})}),a?(0,z.jsx)("span",{className:"flex-shrink-0 w-[18px] h-[18px] border-[2px] border-premium-light/70 border-t-transparent roun
1ded-full animate-spin"}):(0,z.jsx)(h,{size:16,className:"flex-shrink-0 text-text-tertiary group-hover:text-premium-light transition-colors"})]},`${e.provider}:${e.account||"default"}`)})})}),(0,z.jsx)("div",{className:"px-6 pb-5 pt-1 flex items-center justify-center",children:(0,z.jsxs)("button",{type:"button",onClick:()=>{t(),window.location.href=`mailto:${u}?subject=Payment%20issue`},className:"inline-flex items-center gap-1.5 text-[11px] text-text-tertiary hover:text-text-secondary transition-colors",children:[(0,z.jsx)(f,{size:12}),l("paymentRescue.contactSupport")]})})]}):(0,z.jsx)(K,{amountUsd:o.amountUsd,loadingCoin:Y,onBack:()=>{Y||q("methods")},onSelect:e=>{(async e=>{if(!Y){_(e);try{if(!(await G()))return void _(null);const t=await p.createCryptoPayment(o.productId,e,void 0,D?.provider,D?.account);if(U({orderId:t.orderId,productId:o.productId,provider:D?.provider||"nowpayments",methodType:"crypto",amountUsd:o.amountUsd,productLabel:o.productLabel,rescueShown:!1},o),"hosted_invoice"===t.fallback&&t.redirectUrl)return void(window.location.href=t.redirectUrl);window.location.href=`/pay/crypto/${encodeURIComponent(t.orderId)}`}catch(t){_(null)}}})(e)}})]})]}):null}var V=[{key:"usdttrc20",label:"USDT",network:"Tron (TRC20)",hintKey:"usdttrc20",hintFallback:"Fastest - lowest fee"},{key:"usdterc20",label:"USDT",network:"Ethereum (ERC20)",hintKey:"usdterc20",hintFallback:"If your wallet is ERC20"},{key:"btc",label:"BTC",network:"Bitcoin",hintKey:"btc",hintFallback:"10-60 min settlement"},{key:"eth",label:"ETH",network:"Ethereum",hintKey:"eth",hintFallback:"Native L1 - gas applies"}];function K({amountUsd:e,loadingCoin:t,onBack:r,onSelect:a}){const{t:o}=n(),i=(Number.isFinite(e)?e:0).toFixed(2);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)("div",{className:"relative px-6 pt-6 pb-3 flex items-start gap-3",children:[(0,z.jsx)("button",{type:"button",onClick:r,disabled:!!t,className:"flex-shrink-0 mt-0.5 w-8 h-8 rounded-full bg-white/[0.04] border border-white/[0.06] flex items-center justify-center text-text-tertiary hover:text-text-primary hover:bg-white/[0.08] transition-all disabled:opacity-40","aria-label":o("paymentRescue.back"),children:(0,z.jsx)(y,{size:14})}),(0,z.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,z.jsx)("h2",{className:"text-[17px] font-black text-text-primary leading-tight tracking-tight",children:o("paymentRescue.chooseCoin")}),(0,z.jsx)("p",{className:"mt-1 text-[13px] text-text-secondary leading-snug",children:o("paymentRescue.coinSubtitle",{amount:i,defaultValue:"${{amount}} - scan and we credit automatically"})})]})]}),(0,z.jsx)("div",{className:"px-4 pb-5",children:(0,z.jsx)("div",{className:"space-y-1.5",children:V.map(e=>{const r=t===e.key;return(0,z.jsxs)("button",{type:"button",disabled:!!t,onClick:()=>a(e.key),className:["group w-full flex items-center gap-3 min-h-[56px] py-2 px-3 rounded-2xl","transition-all duration-150",r?"bg-gradient-to-r from-premium/[0.12] to-premium-light/[0.06] border border-premium/40 ring-1 ring-premium/20":"bg-white/[0.03] border border-white/[0.06] hover:bg-white/[0.05] hover:border-white/[0.12] active:scale-[0.995]",null===t||r?"":"opacity-40"].join(" "),children:[(0,z.jsx)("span",{className:["flex-shrink-0 flex items-center justify-center w-9 h-9 rounded-xl","bg-white/[0.04] border border-white/[0.06]",r?"text-amber-400":"text-text-secondary","transition-colors"].join(" "),children:"usdttrc20"===e.key?(0,z.jsx)(g,{size:18,strokeWidth:2.2}):(0,z.jsx)(x,{size:18,strokeWidth:2.2})}),(0,z.jsxs)("span",{className:"flex-1 min-w-0 text-left",children:[(0,z.jsxs)("span",{className:"flex items-baseline gap-1.5",children:[(0,z.jsx)("span",{className:"text-[14px] font-semibold text-text-primary leading-tight truncate",children:e.label}),(0,z.jsx)("span",{className:"text-[11px] text-text-tertiary truncate",children:e.network})]}),(0,z.jsx)("span",{className:"block text-[11px] text-text-tertiary truncate leading-tight mt-0.5",children:o(`paymentRescue.coinHint.${e.hintKey}`,e.hintFallback)})]}),r?(0,z.jsx)("span",{className:"flex-shrink-0 w-[18px] h-[18px] border-[2px] border-premium-light/70 border-t-transparent roun
1ded-full animate-spin"}):(0,z.jsx)(h,{size:16,className:"flex-shrink-0 text-text-tertiary group-hover:text-premium-light transition-colors"})]},e.key)})})})]})}function M(e){return(0,z.jsx)(l,{client:o,children:(0,z.jsx)(s,{children:(0,z.jsx)(u,{i18n:i,children:(0,z.jsx)(L,{isOpen:!0,onClose:e.onClose,pending:e.pending,trigger:e.trigger,userId:e.userId,copyVariant:e.copyVariant??"A"})})})})}export{M as renderPaymentRescue};

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.