PageSourceSearch

https://evatolab.com/assets/PaymentFlow-Cf3_1_UZ.js

js evatolab.com collected 2026-10-09 22:04:37 UTC 33,033 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CR8jIHGL.js","assets/index-UrNtwQ3U.css"])))=>i.map(i=>d[i]);
2import{j as e,u as Ve,r as i,s as M,m as x,A as Ue,d as S,L as fe,_ as he}from"./index-CR8jIHGL.js";import{v as Qe}from"./recipientValidation-D21b1IsT.js";import{haptics as G}from"./haptics-YKMSwVex.js";import{b as Ge}from"./permissions-CQjybjgl.js";import{fireSuccessConfetti as qe}from"./confetti-zcttjeaJ.js";import{g as ge,t as He}from"./balanceStore-MOHZ5Zc2.js";import{v as Ke}from"./verifyPin-DFbbL5Ko.js";import{D as Ye,c as Je}from"./DailyLimitBadge-CcOp0vV_.js";import{a as We,s as Xe}from"./Index-Dhox3xuJ.js";import{g as Ze,c as ye,a as je,r as et}from"./couponStore-DPu18nem.js";import{S as tt}from"./SlideToConfirm-o2rnFqgQ.js";import{S as st}from"./ShareReceiptSheet-CAF-XW8N.js";import{A as at}from"./AvailableBalanceBadge-BCF-JYuD.js";import{S as nt,a as rt,b as it,c as ot}from"./sheet-_lr_0sxz.js";import{I as be}from"./input-CBgH9T9i.js";import lt from"./QrScannerModal-Bd3DbmSy.js";import{F as dt}from"./FeatureGuard-DXb_Akz0.js";import{C as ct,a as ve}from"./CouponSummaryLine-DzzGWVkZ.js";import{C as Ne}from"./chevron-left-DZq2ZXKa.js";import{H as mt}from"./hash-ZdgtTrYN.js";import{Q as ut}from"./qr-code-C63N5yIq.js";import{C as E}from"./circle-alert-zn_RedqF.js";import{S as we}from"./shopping-bag-Bb3nI1F0.js";import{C as Z}from"./credit-card-CoDepcSc.js";import{T as ee}from"./ticket-pf0k8qei.js";import{C as xt}from"./chevron-right-Ifx_tJr5.js";import{C as pt}from"./circle-check-FO8rVln-.js";import"./auth-BUl0x90n.js";import"./trending-up-nG-rI339.js";import"./Seo-Bvm9iGRd.js";import"./inboxStore-Dnh7ajfl.js";import"./layout-dashboard-C8dNY4wG.js";import"./scan-line-Bcnz1Fq_.js";import"./message-circle-BFV6bADS.js";import"./QuickActionIcons-Bfdxm-Ke.js";import"./zap-DXS-ko3H.js";import"./shield-KEBAwAUq.js";import"./wifi-Bp8qGX8q.js";import"./download-BS5NsxsA.js";import"./smartphone-c2wtxeoU.js";import"./use-kyc-status-C_EIRkSt.js";import"./qrParser-yVSsZLBI.js";import"./use-future-features-DxzIzt2r.js";import"./use-global-toggles-DRkl9geA.js";import"./check-check-DPiogBoc.js";import"./trash-2-Cso3Gx0t.js";import"./truck-BY32-zuT.js";import"./moon-DXOQ7ZN4.js";import"./formatDistanceToNow-CY-m9BAl.js";import"./constructNow-Ce5XvxA3.js";import"./format-CZost_lC.js";import"./differenceInCalendarMonths-CoHaFYIE.js";import"./endOfDay-DATwVblq.js";import"./endOfMonth-DxzTWKNN.js";import"./coins-DezmEdR3.js";import"./gift-BiP0Sbiv.js";import"./copy-CBCwGpHF.js";import"./external-link-B3Et6MzL.js";import"./tag-DLAqt58P.js";import"./arrow-up-right-D1gM8AWu.js";import"./sun-B8cobErW.js";import"./search-DJ1zHrUy.js";import"./UserQrModal-AtMK0CgU.js";import"./browser-JP79f-a9.js";import"./walletId-DNSBuUjj.js";import"./use-profile-C88j7IAK.js";import"./share-2-k_mGH8kF.js";import"./printer-CePELZYh.js";import"./index-BZMZauxs.js";import"./eye-off-HKMF2PNY.js";import"./eye-DgDkV2gx.js";import"./TransactionStatusTimeline-BMbr3wZd.js";import"./rotate-ccw-Dw05o2mg.js";import"./clock-BRuMITIk.js";import"./circle-x-tD4ABO1B.js";import"./send-D1X2wYJv.js";import"./circle-dot-D-m8Z08O.js";import"./use-customization-BHtAxjNj.js";import"./chevron-up-CRjmFfp2.js";import"./sparkles-_ewb4KdX.js";import"./lock-CZskgewM.js";import"./use-transactions-V5K-KOwA.js";import"./txnReceiptPdf-DJjxgQiQ.js";import"./jspdf.es.min-DYJrId12.js";import"./jspdf.plugin.autotable-CyVc7Jkq.js";import"./file-text-DZsJjycF.js";import"./user-CLzIiMal.js";import"./phone-BsHJWvjh.js";import"./shield-check-JTIKhhRg.js";import"./use-transform-D79JgFKm.js";import"./wallet-BVSZjyQE.js";import"./index-DT5oeEbX.js";import"./index-gTm__Gfr.js";import"./scan-text-CC690L1J.js";const ft=[50,100,200,500,1e3,2e3],T=["merchant","amount","review","pin"],ht={enter:m=>({x:m>0?"100%":"-100%",opacity:0}
2),center:{x:0,opacity:1},exit:m=>({x:m<0?"100%":"-100%",opacity:0})},gt=({pin:m,onChange:R,error:P})=>e.jsxs("div",{className:"relative space-y-5",children:[e.jsx("div",{className:"flex justify-center gap-4",children:[0,1,2,3].map(h=>e.jsx(x.div,{animate:{scale:m.length>h?1.15:1},transition:{type:"spring",stiffness:400,damping:20},className:`w-5 h-5 rounded-full border-2 transition-colors ${m.length>h?"gradient-payment border-transparent shadow-md":"border-muted-foreground/40 bg-transparent"}`},h))}),P&&e.jsxs("p",{className:"text-xs text-destructive flex items-center justify-center gap-1",children:[e.jsx(E,{size:12})," ",P]}),e.jsx("input",{type:"password",inputMode:"numeric",pattern:"[0-9]*",maxLength:4,value:m,onChange:h=>{const l=h.target.value.replace(/\D/g,"").slice(0,4);l.length>m.length&&G.light(),R(l)},autoFocus:!0,className:"absolute inset-0 w-full h-full opacity-0 cursor-text",placeholder:"••••"})]}),yt=({onClose:m,onDynamicQr:R,onRouteToCashOut:P,prefilledMerchantId:h})=>{const{t:l}=Ve(),[u,te]=i.useState("merchant"),[se,ae]=i.useState(1),[s,C]=i.useState(null),[q,F]=i.useState(""),[v,ne]=i.useState(""),[N,Se]=i.useState(""),[L,$]=i.useState(""),[_,c]=i.useState(""),[d,H]=i.useState(()=>Ze("payment")),[Ce,re]=i.useState(!1),[_e,ie]=i.useState(!1),[z,Ie]=i.useState([]),[oe,K]=i.useState(null),[Y,B]=i.useState(""),[J,b]=i.useState(!1),[le,p]=i.useState(""),[ke,O]=i.useState(!1),[V,de]=i.useState([]),[Me,ce]=i.useState(!1),D=i.useRef(new Date),me=()=>{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";let n="";for(let a=0;a<12;a++)n+=t[Math.floor(Math.random()*36)];return n},I=i.useRef(me()),ue=i.useRef(!1);i.useEffect(()=>{if(!h||ue.current)return;ue.current=!0,(async()=>{F(h),k(!0),c("");const n=await X(h);if(k(!1),!n.exists){c("Merchant not found. Please enter a valid Merchant ID or phone.");return}W(n.phone||""),K(n.userId||null),C({id:"prefilled",name:n.name||"Merchant",merchantId:h,category:"Payment",initials:"MR",gradient:"gradient-payment"}),y("amount")})()},[h]);const xe=["gradient-payment","gradient-addmoney","gradient-accent","gradient-cashout","gradient-send"];i.useEffect(()=>{(async()=>{const{data:{session:t}}=await M.auth.getSession();if(!(t!=null&&t.user))return;const{data:n}=await M.from("transactions").select("*").eq("user_id",t.user.id).eq("type","payment").order("created_at",{ascending:!1});if(!n)return;const a=new Set,o=[];for(const r of n){const f=r.recipient_phone;if(!f||a.has(f))continue;a.add(f);const w=r.recipient_name||"Merchant";if(o.push({id:r.id,name:w,merchantId:f,category:"Payment",initials:w.slice(0,2).toUpperCase(),gradient:xe[o.length%xe.length]}),o.length>=5)break}Ie(o)})()},[]),i.useEffect(()=>{u==="success"&&(qe(),We(),I.current=me())},[u]);const U=T.indexOf(u),y=t=>{G.medium(),ae(T.indexOf(t)>U?1:-1),te(t),c("")},Pe=()=>{if(G.medium(),u==="merchant"){m();return}if(u==="amount"){y("merchant");return}if(u==="review"){y("amount");return}if(u==="pin"){$(""),y("review");return}},Le=t=>{C(t),F(t.merchantId),y("amount")},[jt,k]=i.useState(!1),[De,W]=i.useState(""),X=async t=>{const{data:n,error:a}=await M.rpc("resolve_transfer_recipient",{p_identifier:t,p_flow:"payment"});if(a)return{exists:!1};const o=typeof n=="string"?JSON.parse(n):n;return o!=null&&o.found?{exists:!0,name:o.recipient_name||void 0,phone:o.recipient_phone,userId:o.recipient_id}:{exists:!1}},Ae=async()=>{const t=Y.trim();if(!t)return;const n=parseFloat(v)||0;if(n<=0){p("Enter an amount first");return}b(!0),p("");try{const{data:a,error:o}=await M.functions.invoke("apply-coupon",{body:{code:t,cart_total:n,merchant_id:oe||null}});if(o){p("Failed to validate coupon"),b(!1);return}if((a==null?void 0:a.valid)===!1){p(a.error||"Invalid coupon"),b(!1);return}const r=(a==null?void 0:a.coupon)||a;r!=null&&r.id?(H({id:r.id,code:r.code||t,discount_type:r.discount_type,discount_value:r.discount_value,max_discount:r.max_discount||null,min_order_amount:r.min_order_amount||null,applicable_flow:r.applicable_flow||"payment"}),O(!1),B("")):p("Invalid coupon code")}catch{p("Something went wrong")}b(!1)},Te=async()=>{ce(!0);try{const t=new Date().toISOString(),{data:n}=await M.from("coupons").select("*").eq("is_active",!0).or("applicable_flow.is.null,applicable_flow.eq.payment,applicable_flow.eq.all").or(`expires_at.is.null,expires_at.gt.${t}`).order("created_at",{ascending:!1}).limit(20);de(n||[])}catch{de([])}ce(!1)},Ee=()=>{O(!0),Te()},Re=t=>{B(t);const n=parseFloat(v)||0;if(n<=0){p("Enter an amount first");return}b(!0),p(""),M.functions.invoke("apply-coupon",{body:{code:t,cart_total:n,merchant_id:oe||null}}).then(({data:a,error:o})=>{if(o){p("Failed to validate coupon"),b(!1);return}if((a==null?void 0:a.valid)===!1){p(a.error||"Invalid coupon"),b(!1);return}const r=(a==null?void 0:a.coupon)||a;r!=null&&r.id?(H({id:r.id,code:r.code||t,discount_type:r.discount_type,discount_value:r.discount_value,max_discount:r.max_discount||null,min_order_amount:r.min_order_amount||null,applicable_flow:r.applicable_flow||"payment"}),O(!1),B("")):p("Invalid coupon code"),b(!1)}).catch(()=>{p("Something went wrong"),b(!1)})},Fe=async t=>{const{parseQrData:n}=await he(async()=>{const{parseQrData:w}=await import("./qrParser-yVSsZLBI.js");return{parseQrData:w}},[]),a=n(t);if(a.flow==="dynamic_payment"&&a.sessionId&&R){R({sessionId:a.sessionId,merchantId:a.identifier,amount:a.amount,ref:a.ref}),m();return}if(a.flow==="cashout"&&P){P(a.identifier),m();return}const o=a.flow==="payment"?a.identifier:t;F(o),k(!0),c("");const r=await X(o);if(k(!1),!r.exists){c("Merchant not found. Please enter a valid Merchant ID or phone.");return}W(r.phone||""),K(r.userId||null);const f=z.find(w=>w.merchantId.toLowerCase()===o.toLowerCase());
2C(f||{id:"qr",name:r.name||"Merchant",merchantId:o,category:"Payment",initials:"MR",gradient:"gradient-payment"}),y("amount")},$e=async()=>{const t=q.trim();if(t.length<5){c("Enter a valid Merchant ID.");return}k(!0),c("");const n=await X(t);if(k(!1),!n.exists){c("Merchant not found. Please enter a valid Merchant ID or phone.");return}W(n.phone||""),K(n.userId||null);const a=z.find(o=>o.merchantId.toLowerCase()===t.toLowerCase());C(a||{id:"custom",name:n.name||"Merchant",merchantId:t,category:"Payment",initials:"MR",gradient:"gradient-payment"}),y("amount")},ze=()=>{const t=parseFloat(v);if(!v||isNaN(t)||t<=0){c("Enter a valid amount.");return}if(t<1){c("Minimum payment is à§³1.");return}y("review")},Be=()=>y("pin"),[pe,Q]=i.useState(!1),Oe=async()=>{if(L.length<4){c("Enter your 4-digit PIN.");return}if(pe)return;if(Q(!0),!await Ke(L)){c("Incorrect PIN. Please try again."),$(""),Q(!1);return}const n=parseFloat(v)||0,a=await Je("payment",n);if(!a.allowed){c(`Daily limit exceeded. Used à§³${a.used.toLocaleString()} of à§³${a.limit.toLocaleString()} today.`),Q(!1);return}Ge().catch(()=>{}),G.success(),D.current=new Date;const o=d?ye(d,n):0,r=Math.max(0,n-o);try{await He({recipientPhone:(De||(s==null?void 0:s.merchantId))??"",amount:r,fee:0,type:"payment",recipientName:s==null?void 0:s.name,description:(d?`[Coupon: ${d.code}] `:"")+(N||`Payment to ${s==null?void 0:s.name}`),reference:I.current})}catch(f){c(f.message??"Payment failed"),$(""),Q(!1);return}d&&(await et({code:d.code,flow:"payment",txnId:I.current,discount:o}),je()),Xe({type:"Payment",amount:`à§³${r.toLocaleString("en-BD",{minimumFractionDigits:2})}`,gradient:"gradient-payment"}),ae(1),te("success"),he(async()=>{const{activityTracker:f}=await import("./index-CR8jIHGL.js").then(w=>
2w.bl);return{activityTracker:f}},__vite__mapDeps([0,1])).then(({activityTracker:f})=>f.transaction("payment_success",{amount:r,txn_id:I.current}))},g=parseFloat(v)||0,j=d?ye(d,g):0,A=Math.max(0,g-j);return e.jsxs(x.div,{initial:{y:"100%"},animate:{y:0},exit:{y:"100%"},transition:{type:"spring",stiffness:500,damping:40},className:"fixed inset-0 z-50 bg-background flex flex-col max-w-md sm:max-w-xl mx-auto",role:"dialog","aria-modal":"true",children:[u!=="success"&&e.jsxs(x.div,{className:"gradient-send px-4 pt-3 pb-3 text-primary-foreground",initial:{y:-60,opacity:0},animate:{y:0,opacity:1},transition:{type:"spring",stiffness:300,damping:28,duration:.4},children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsx("button",{type:"button",onClick:Pe,"aria-label":"Go back",className:"w-10 h-10 rounded-full bg-white/20 ring-1 ring-white/30 backdrop-blur-sm flex items-center justify-center active:scale-95 transition-transform shrink-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",children:e.jsx(Ne,{size:20,"aria-hidden":"true"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h1",{className:"text-xl font-extrabold tracking-tight",children:l("flowPayment")}),e.jsx("p",{className:"text-xs text-white/70 mt-0.5",children:l("flowMerchantQr")})]})]}),e.jsx("div",{className:"h-1.5 rounded-full bg-white/20 overflow-hidden",role:"progressbar","aria-valuemin":0,"aria-valuemax":T.length,"aria-valuenow":U+1,"aria-label":`Step ${U+1} of ${T.length}`,children:e.jsx(x.div,{className:"h-full bg-white rounded-full shadow-[0_0_8px_2px_rgba(255,255,255,0.55)]",animate:{width:`${(U+1)/T.length*100}%`},transition:{type:"spring",stiffness:200,damping:28}})})]}),e.jsx("div",{className:"flex-1 overflow-hidden relative",children:e.jsx(Ue,{custom:se,mode:"wait",children:e.jsxs(x.div,{custom:se,variants:ht,initial:"enter",animate:"center",exit:"exit",transition:{type:"spring",stiffness:320,damping:32},className:"absolute inset-0 overflow-y-auto scrollbar-none",children:[u==="merchant"&&e.jsxs("div",{className:"px-4 pt-6 pb-32 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-semibold text-foreground",children:l("merchantId")}),e.jsxs("div",{className:"relative",children:[e.jsx(mt,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground"}),e.jsx(be,{type:"text",placeholder:"e.g. MRC-88901",value:q,onChange:t=>{F(t.target.value),c("")},className:"pl-9 pr-12 h-12 text-base bg-card border-border uppercase"}),e.jsx("button",{onClick:()=>re(!0),className:"absolute right-3 top-1/2 -translate-y-1/2 w-7 h-7 rounded-lg bg-muted flex items-center justify-center hover:bg-muted/80 transition-colors",children:e.jsx(ut,{size:16,className:"text-muted-foreground"})})]}),_&&e.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[e.jsx(E,{size:12})," ",_]}),(()=>{const t=Qe("merchantId",q);return e.jsxs(e.Fragment,{children:[!_&&t.errorMessage&&e.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1 animate-fade-in",children:[e.jsx(E,{size:12})," ",t.errorMessage]}),t.isValid&&e.jsx(S,{className:"w-full h-11 mt-3 gradient-payment border-0 text-white font-semibold animate-fade-in",onClick:$e,children:l("continue")})]})})()]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex-1 h-px bg-border"}),e.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[e.jsx(we,{size:11})," ",l("recentMerchants")]}),e.jsx("div",{className:"flex-1 h-px bg-border"})]}),e.jsx("div",{className:"space-y-2",children:z.length===0?e.jsxs(x.div,{initial:{opacity:0,scale:.9,y:12},animate:{opacity:1,scale:1,y:0},transition:{duration:.5,ease:"easeOut"},className:"flex flex-col items-center justify-center py-8 text-center",children:[e.jsx(x.div,{animate:{y:[0,-4,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"w-14 h-14 bg-muted rounded-full flex items-center justify-center mb-3",children:e.jsx(we,{className:"w-7 h-7 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-semibold text-foreground",children:"No recent merchants"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Your payment history will appear here"})]}):z.map(t=>e.jsxs("button",{onClick:()=>Le(t),className:"w-full flex items-center gap-3 p-3 rounded-2xl bg-card border border-border shadow-card hover:shadow-elevated active:scale-[0.98] transition-all text-left",children:[e.jsx("div",{className:`${t.gradient} w-11 h-11 rounded-xl flex items-center justify-center text-white font-bold text-sm shrink-0`,children:t.initials}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:t.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.merchantId," · ",t.category]})]}),e.jsx(Ne,{size:16,className:"text-muted-foreground rotate-180 shrink-0"})]},t.id))})]}),u==="amount"&&e.jsxs("div",{className:"px-4 pt-6 pb-32 space-y-6",children:[d&&e.jsx(ct,{coupon:d,discount:j,onRemove:()=>{je(),H(null)}}),s&&e.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-2xl bg-card border border-border shadow-card",children:[e.jsx("div",{className:`${s.gradient} w-11 h-11 rounded-xl flex items-center justify-center text-white shrink-0`,children:e.jsx(Z,{size:20})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:l("payingTo")}),e.jsx("p",{className:"text-sm font-bold text-foreground",children:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.merchantId," · ",s.category]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-sm font-semibold text-foreground",children:l("enterAmount")}),e.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[e.jsx(at,{}),e.jsx(Ye,{txnType:"payment"})]})]}),e.jsxs("div",{className:"relative flex items-center",children:[e.jsx("span",{className:"absolute left-4 text-2xl font-bold text-muted-foreground",children:"৳"}),e.jsx("input",{type:"text",inputMode:"decimal",placeholder:"0",value:v,onCh
2ange:t=>{const n=t.target.value;(n===""||/^\d*\.?\d*$/.test(n))&&(ne(n),c(""))},onKeyDown:t=>{t.key==="Enter"&&t.target.blur()},className:"w-full pl-10 pr-4 h-16 text-3xl font-bold text-foreground bg-card border border-border rounded-2xl focus:outline-none focus:ring-2 focus:ring-primary placeholder:text-muted-foreground/40 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"})]}),_&&e.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[e.jsx(E,{size:12})," ",_]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:l("quickSelect")}),e.jsx("div",{className:"grid grid-cols-3 gap-2",children:ft.map(t=>e.jsxs("button",{onClick:()=>ne(String(t)),className:`py-2.5 rounded-xl text-sm font-semibold border transition-all active:scale-95 ${v===String(t)?"gradient-payment text-white border-transparent shadow-card":"bg-card border-border text-foreground hover:border-primary/50"}`,children:["৳",t.toLocaleString()]},t))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-semibold text-foreground",children:l("noteOptional")}),e.jsx(be,{placeholder:"Invoice / reference…",value:N,onChange:t=>Se(t.target.value),className:"bg-card border-border"})]}),d?null:e.jsxs(x.button,{type:"button",onClick:Ee,whileTap:{scale:.97},className:"w-full relative flex items-center gap-3 px-4 py-3 rounded-xl border-2 border-dashed border-primary/25 bg-gradient-to-r from-primary/[0.04] via-transparent to-primary/[0.04] overflow-hidden group",children:[e.jsx("span",{className:"absolute inset-0 -translate-x-full group-hover:translate-x-full transition-transform duration-700 bg-gradient-to-r from-transparent via-primary/[0.06] to-transparent pointer-events-none"}),e.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:e.jsx(ee,{size:18,className:"text-primary"})}),e.jsxs("div",{className:"flex-1 text-left",children:[e.jsx("p",{className:"text-sm font-semibold text-foreground leading-tight",children:"কুপন / প্রোমো কোড"}),e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5",children:"ট্যাপ করে কুপন যোগ করুন বা বেছে নিন"})]}),e.jsx(xt,{size:16,className:"text-muted-foreground/50 shrink-0"})]}),e.jsx(nt,{open:ke,onOpenChange:O,children:e.jsxs(rt,{side:"bottom",className:"rounded-t-3xl max-h-[75vh] overflow-y-auto px-0 pb-8 pt-0",children:[e.jsxs("div",{className:"relative bg-gradient-to-br from-primary/15 via-primary/5 to-transparent px-5 pt-5 pb-4",children:[e.jsx("div",{className:"absolute top-0 left-0 right-0 h-1 bg-gradient-to-r from-primary/40 via-primary to-primary/40"}),e.jsx(it,{className:"flex flex-row items-center justify-between p-0",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/15 flex items-center justify-center",children:e.jsx(ee,{size:16,className:"text-primary"})}),e.jsxs(ot,{className:"text-base font-bold text-foreground",children:["কুপন ওয়ালেট ",V.length>0&&e.jsx("span",{className:"ml-1.5 text-xs font-semibold text-primary bg-primary/10 px-2 py-0.5 rounded-full",children:V.length})]})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3.5 py-2.5 rounded-xl bg-background/80 backdrop-blur border border-border shadow-sm",children:[e.jsx("span",{className:"text-sm text-muted-foreground/60",children:"✂"}),e.jsx("input",{placeholder:"কুপন কোড লিখুন",value:Y,onChange:t=>{B(t.target.value.toUpperCase()),p("")},className:"flex-1 bg-transparent text-sm font-mono font-semibold tracking-widest uppercase placeholder:font-sans placeholder:normal-case placeholder:tracking-normal placeholder:font-normal placeholder:text-muted-foreground/50 outline-none text-foreground"})]}),e.jsx(S,{size:"sm",onClick:Ae,disabled:J||!Y.trim(),className:"h-10 px-5 font-bold rounded-xl shadow-sm",children:J?e.jsx(fe,{size:16,className:"animate-spin"}):"যোগ করুন"})]}),le&&e.jsxs("p",{className:"text-[11px] text-destructive flex items-center gap-1 px-1 mt-1.5",children:[e.jsx(E,{size:11})," ",le]})]}),e.jsx("div",{className:"px-5 mt-4 space-y-3",children:Me?e.jsx("div",{className:"flex justify-center py-8",children:e.jsx(fe,{size:22,className:"animate-spin text-muted-foreground"})}):V.length===0?e.jsxs("div",{className:"text-center py-10 text-muted-foreground",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-muted/50 flex items-center justify-center mx-auto mb-3",children:e.jsx(ee,{size:28,className:"opacity-30"})}),e.jsx("p",{className:"text-sm font-medium",children:"কোনো কুপন পাওয়া যায়নি"}),e.jsx("p",{className:"text-xs mt-1 opacity-60",children:"উপরে ম্যানুয়ালি কোড যোগ করুন"})]}):V.map((t,n)=>e.jsxs(x.div,{initial:{opacity:0,y:12}
2,animate:{opacity:1,y:0},transition:{delay:n*.06,duration:.25},className:"relative flex rounded-2xl overflow-hidden border border-border bg-card shadow-sm",children:[e.jsxs("div",{className:"w-[72px] shrink-0 bg-gradient-to-b from-primary to-primary/80 flex flex-col items-center justify-center text-primary-foreground relative",children:[e.jsx("span",{className:"text-xl font-black leading-none",children:t.discount_type==="percentage"?`${t.discount_value}%`:`৳${t.discount_value}`}),e.jsx("span",{className:"text-[9px] font-bold uppercase tracking-wider mt-0.5 opacity-80",children:"ছাড়"}),e.jsx("div",{className:"absolute -right-[6px] top-1/2 -translate-y-1/2 flex flex-col gap-1.5",children:[...Array(5)].map((a,o)=>e.jsx("div",{className:"w-3 h-3 rounded-full bg-background"},o))})]}),e.jsxs("div",{className:"flex-1 flex items-center justify-between px-3.5 py-3 min-w-0",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-[13px] font-mono font-bold text-foreground tracking-wider",children:t.code}),t.description&&e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5 truncate",children:t.description}),e.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[t.min_order_amount&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/70 bg-muted/50 px-1.5 py-0.5 rounded",children:["Min ৳",t.min_order_amount]}),t.max_discount&&t.discount_type==="percentage"&&e.jsxs("span",{className:"text-[10px] text-muted-foreground/70 bg-muted/50 px-1.5 py-0.5 rounded",children:["Max ৳",t.max_discount]})]})]}),e.jsx(S,{size:"sm",variant:"ghost",onClick:()=>Re(t.code),disabled:J,className:"h-8 px-3 text-xs font-bold text-primary hover:text-primary hover:bg-primary/10 shrink-0 ml-2 rounded-lg",children:"ব্যবহার করুন"})]})]},t.id))})]})}),g>0&&A>ge()&&e.jsx("p",{className:"text-center text-sm text-destructive font-medium",children:"Insufficient balance"}),g>0&&A<=ge()&&e.jsx(x.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.2},children:e.jsx(S,{className:"w-full h-12 gradient-payment border-0 text-white font-semibold text-base",onClick:ze,children:"Review Payment"})})]}),u==="review"&&e.jsxs("div",{className:"px-4 pt-6 pb-32 space-y-5",children:[e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:l("paying")}),e.jsxs("p",{className:"text-4xl font-extrabold text-foreground",children:["৳",g.toLocaleString()]})]}),e.jsxs("div",{className:"rounded-2xl bg-card border border-border p-4 flex items-center gap-3",children:[e.jsx("div",{className:`${s==null?void 0:s.gradient} w-11 h-11 rounded-xl flex items-center justify-center text-white font-bold shrink-0`,children:s==null?void 0:s.initials}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"font-bold text-foreground text-sm truncate",children:s==null?void 0:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[s==null?void 0:s.merchantId," · ",s==null?void 0:s.category]})]})]}),e.jsxs("div",{className:"rounded-2xl bg-card border border-border p-4 space-y-2.5 text-sm",children:[e.jsx("p",{className:"font-semibold text-foreground",children:"Payment Summary"}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:l("amount")}),e.jsxs("span",{className:"text-foreground font-medium",children:["৳",g.toLocaleString()]})]}),j>0&&d&&e.jsx(ve,{code:d.code,discount:j}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:l("fee")}),e.jsx("span",{className:"text-primary font-semibold",children:l("free")})]}),e.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground/70",children:[e.jsx("span",{children:"Fee source"}),e.jsx("span",{className:"text-primary font-medium",children:"From your balance"})]}),e.jsx("div",{className:"h-px bg-border"}),e.jsxs("div",{className:"flex justify-between font-bold text-foreground",children:[e.jsx("span",{children:l("total")}
2),e.jsxs("span",{children:["৳",A.toLocaleString()]})]})]}),e.jsx(S,{className:"w-full h-12 gradient-payment border-0 text-white font-semibold text-base rounded-xl",onClick:Be,children:"Confirm & Enter PIN"}),e.jsx(S,{variant:"ghost",className:"w-full",onClick:()=>y("amount"),children:"Edit Amount"})]}),u==="pin"&&e.jsxs("div",{className:"px-4 pt-6 pb-32 space-y-6",children:[e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:l("paying")}),e.jsxs("p",{className:"text-4xl font-extrabold text-foreground",children:["৳",g.toLocaleString()]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["to ",e.jsx("span",{className:"font-semibold text-foreground",children:s==null?void 0:s.name})]})]}),e.jsxs("div",{className:"rounded-2xl bg-card border border-border shadow-card p-4 flex items-center gap-3",children:[e.jsx("div",{className:`${s==null?void 0:s.gradient} w-11 h-11 rounded-xl flex items-center justify-center text-white shrink-0`,children:e.jsx(Z,{size:18})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-foreground text-sm",children:s==null?void 0:s.name}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s==null?void 0:s.merchantId," · ",s==null?void 0:s.category]})]})]}),N&&e.jsxs("div",{className:"bg-muted/50 rounded-xl px-3 py-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Note: "}),N]}),e.jsx(gt,{pin:L,onChange:t=>{$(t),c("")},error:_}),e.jsx(tt,{onConfirm:Oe,label:l("slideToPayment"),gradient:"gradient-payment",disabled:L.length<4||pe,pinComplete:L.length===4,icon:Z})]}),u==="success"&&e.jsxs("div",{className:"flex flex-col items-center justify-center min-h-full px-6 py-16 text-center space-y-6",children:[e.jsx(x.div,{initial:{scale:0,rotate:-15},animate:{scale:1,rotate:0},transition:{type:"spring",stiffness:260,damping:20,delay:.1},className:"w-24 h-24 gradient-payment rounded-full flex items-center justify-center shadow-glow",children:e.jsx(pt,{size:52,className:"text-white"})}),e.jsxs(x.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.3},className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-extrabold text-foreground",children:l("paymentSuccessful")}),e.jsxs("p",{className:"text-muted-foreground text-sm",children:["৳",g.toLocaleString()," paid to"," ",e.jsx("span",{className:"font-semibold text-foreground",children:s==null?void 0:s.name})]})]}),e.jsxs(x.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.45},className:"w-full rounded-2xl bg-card border border-border shadow-elevated p-4 text-sm space-y-3",children:[e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Merchant"}),e.jsx("span",{className:"text-foreground font-medium",children:s==null?void 0:s.name})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Merchant ID"}),e.jsx("span",{className:"text-foreground font-medium",children:s==null?void 0:s.merchantId})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Category"}),e.jsx("span",{className:"text-foreground font-medium",children:s==null?void 0:s.category})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Amount"}),e.jsxs("span",{className:"text-foreground font-medium",children:["৳",g.toLocaleString()]})]}),j>0&&d&&e.jsx(ve,{code:d.code,discount:j}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Fee"}),e.jsx("span",{className:"text-primary font-semibold",children:"Free"})]}),j>0&&e.jsxs("div",{className:"flex justify-between font-bold text-foreground",children:[e.jsx("span",{children:"You Pay"}),e.jsxs("span",{children:["৳",A.toLocaleString()]})]}),N&&e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Note"}),e.jsx("span",{className:"text-foreground font-medium",children:N})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Date"}),e.jsx("span",{className:"text-foreground font-medium",children:D.current.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})})]}),e.jsxs("div",{className:"flex justify-between text-muted-foreground",children:[e.jsx("span",{children:"Time"}),e.jsx("span",{className:"text-foreground font-medium",children:D.current.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!0})})]}),e.jsx("div",{className:"h-px bg-border"}),e.jsxs("div",{className:"flex justify-between font-bold text-foreground",children:[e.jsx("span",{children:"Transaction ID"}),e.jsx("span",{className:"text-primary",children:I.current})]})]}),e.jsxs(x.div,{initial:{opacity:0}
2,animate:{opacity:1},transition:{delay:.6},className:"w-full space-y-3",children:[e.jsx(S,{className:"w-full h-12 gradient-payment border-0 text-white font-semibold",onClick:m,children:l("backToHome")}),e.jsx(S,{variant:"outline",className:"w-full h-11",onClick:()=>ie(!0),children:l("shareReceipt")})]})]})]},u)})}),e.jsx(lt,{open:Ce,onClose:()=>re(!1),onScan:Fe,title:l("scanMerchantQr")}),e.jsx(st,{open:_e,onClose:()=>ie(!1),receipt:{title:"Payment Successful",amount:`৳${g.toLocaleString()}`,gradient:"gradient-payment",txnId:I.current,rows:[{label:"Merchant",value:(s==null?void 0:s.name)??""},{label:"Merchant ID",value:(s==null?void 0:s.merchantId)??""},{label:"Category",value:(s==null?void 0:s.category)??""},{label:"Amount",value:`৳${g.toLocaleString()}`},...j>0?[{label:`🎟️ Coupon (${d==null?void 0:d.code})`,value:`-৳${j.toFixed(2)}`}]:[],{label:"Fee",value:"Free"},...j>0?[{label:"You Paid",value:`৳${A.toLocaleString()}`}]:[],...N?[{label:"Note",value:N}]:[],{label:"Date",value:D.current.toLocaleDateString("en-GB",{day:"2-digit",month:"short",year:"numeric"})},{label:"Time",value:D.current.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0})}]}})]})},ia=m=>e.jsx(dt,{featureKey:"payment",onClose:m.onClose,children:e.jsx(yt,{...m})});export{ia 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.