1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9398],{4548:(e,t,a)=>{a.d(t,{D:()=>d});var n=a(95155),r=a(12115),o=a(95215),s=a(65380),l=a(12466),c=a(22663);let i=[{code:"INR",symbol:"â¹",label:"INR"},{code:"USD",symbol:"$",label:"USD"}],d=e=>{let{className:t="",variant:a="toggle",showLabel:d=!1}=e,{currency:u,setCurrency:p,loading:m}=(0,o.e)(),{user:h,refreshUser:y}=(0,s.A)(),[f,x]=(0,r.useState)(!1),b=async e=>{if(e!==u&&!f){x(!0);try{h&&(await l.Ay.patch("/api/auth/settings",{preferredCurrency:e}),await y()),p(e),c.Ay.success("Payment currency changed to ".concat(e),{icon:"INR"===e?"â¹":"$",duration:2e3})}catch(e){console.error("Failed to update currency:",e),c.Ay.error("Failed to update currency")}finally{x(!1)}}};return m?(0,n.jsx)("div",{className:"flex items-center gap-2 ".concat(t),children:(0,n.jsx)("div",{className:"h-10 w-40 bg-surface-2 rounded-lg animate-pulse"})}):"dropdown"===a?(0,n.jsxs)("div",{className:"flex items-center gap-2 ".concat(t),children:[d&&(0,n.jsx)("span",{className:"text-sm text-text-secondary",children:"Currency:"}),(0,n.jsx)("select",{value:u,onChange:e=>b(e.target.value),disabled:f,className:"px-3 py-1.5 text-sm border border-border-strong rounded-lg bg-surface focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent ".concat(f?"opacity-50 cursor-wait":"cursor-pointer"),"aria-label":"Select currency",children:i.map(e=>(0,n.jsxs)("option",{value:e.code,children:[e.symbol," ",e.label]},e.code))})]}):(0,n.jsxs)("div",{className:"inline-flex items-center gap-2 ".concat(t," ").concat(f?"opacity-70":""),children:[d&&(0,n.jsx)("span",{className:"text-sm text-text-secondary mr-1",children:"Currency:"}),(0,n.jsx)("div",{className:"inline-flex rounded-lg border border-border-strong p-0.5 bg-canvas",children:i.map(e=>(0,n.jsxs)("button",{onClick:()=>b(e.code),disabled:f,className:"\n px-6 py-2.5 min-h-[44px] text-sm font-medium rounded-md transition-all duration-200 min-w-[100px]\n ".concat(u===e.code?"bg-surface text-blue-600 shadow-sm":"text-text-secondary hover:text-text-primary hover:bg-surface-2","\n ").concat(f?"cursor-wait":"","\n "),"aria-pressed":u===e.code,"aria-label":"Switch to ".concat(e.code),children:[(0,n.jsx)("span",{className:"mr-1.5 text-base",children:e.symbol}),(0,n.jsx)("span",{children:e.label})]},e.code))})]})}},8465:(e,t,a)=>{a.d(t,{Z:()=>u});var n=a(95155),r=a(12115),o=a(95215);function s(e){let{value:t,onChange:a,savingsPercent:r}=e;return(0,n.jsx)("div",{className:"inline-flex items-center rounded-full border border-border-default bg-surface p-1",children:["monthly","yearly"].map(e=>{let o=t===e;return(0,n.jsxs)("button",{type:"button",onClick:()=>a(e),"aria-pressed":o,className:"px-5 py-2 rounded-full text-sm font-semibold transition-colors flex items-center gap-2 ".concat(o?"bg-blue-500 text-white":"text-text-secondary hover:text-text-primary"),children:["monthly"===e?"Monthly":"Yearly","yearly"===e&&!!r&&r>0&&(0,n.jsxs)("span",{className:"text-[10px] font-bold px-1.5 py-0.5 rounded-full ".concat(o?"bg-white/20 text-white":"bg-emerald-100 text-emerald-700 dark:bg-emerald-500/15 dark:text-emerald-300"),children:["Save up to ",r,"%"]})]},e)})})}let l={blue:{ring:"border-blue-500",label:"text-blue-500",solid:"bg-blue-500 text-white hover:bg-blue-600",outline:"bg-transparent border-2 border-blue-500 text-blue-500 hover:bg-blue-50 dark:hover:bg-blue-500/10",check:"text-blue-500",badge:"bg-blue-600"},teal:{ring:"border-teal-500",label:"text-teal-600 dark:text-teal-300",solid:"bg-teal-600 text-white hover:bg-teal-700",outline:"bg-transparent border-2 border-teal-500 text-teal-600 dark:text-teal-300 hover:bg-teal-50 dark:hover:bg-teal-500/10",check:"text-teal-600",badge:"bg-teal-600"}};function c(e){let{name:t,subtitle:a,accent:r,highlighted:o=!1,badge:s=null,plan:c,monthlyPlan:i=null,isYearly:d,ctaLabel:u,onCta:p,featuresHeading:m,features:h,formatPrice:y,compact:f=!1}=e;if(!c)return null;let x=l[r];return(0,n.jsxs)("div",{className:"relative flex flex-col rounded-2xl bg-surface transition-all duration-200 ".concat(f?"p-6":"p-6 sm:p-8"," ").concat(o?"border-2 ".concat(x.ring," shadow-lg md:scale-[1.02]"):"border border-border-default hover:shadow-md"),children:[s&&(0,n.jsx)("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2 whitespace-nowrap",children:(0,n.jsx)("span",{className:"inline-block px-3 py-1 ".concat(x.badge," text-white text-[10px] sm:text-xs font-bold uppercase tracking-wide rounded-md shadow-md"),children:s})}),(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("p",{className:"".concat(f?"text-xl":"text-2xl sm:text-3xl"," font-extrabold mb-1 ").concat(o?x.label:"text-text-primary"),children:t}),(0,n.jsx)("p",{className:"text-xs text-text-muted mb-5",children:a}),(0,n.jsx)("div",{className:"mb-1 h-6 flex items-center justify-center",children:d&&i?(0,n.jsx)("span",{className:"text-xl font-bold text-text-muted line-through",children:y(Math.round(i.perMonth),{showDecimals:!1})}):(0,n.jsx)("span",{"aria-hidden":"true",children:"\xa0"})}),(0,n.jsxs)("div",{className:"mb-1",children:[(0,n.jsx)("span",{className:"".concat(f?"text-3xl":"text-5xl"," font-bold text-text-primary"),children:y(Math.round(c.perMonth),{showDecimals:!1})}),(0,n.jsx)("span",{className:"text-sm text-text-muted ml-1",children:"/mo"})]}),(0,n.jsxs)("p",{className:"text-[11px] text-text-muted mb-6",children:["+ taxes \xb7 ",d?"".concat(y(c.total,{showDecimals:!1})," billed yearly"):"billed monthly"]}),(0,n.jsx)("button",{onClick:p,className:"w-full min-h-[44px] py-2.5 px-4 roun
1ded-full text-sm font-bold transition-all duration-200 ".concat(o?"".concat(x.solid," shadow-md"):x.outline),children:u})]}),m&&(0,n.jsx)("p",{className:"mt-6 text-xs font-bold text-text-primary text-left",children:m}),(0,n.jsx)("ul",{className:"".concat(m?"mt-2":"mt-6"," space-y-2.5 text-left"),children:h.map(e=>(0,n.jsxs)("li",{className:"flex items-start gap-2",children:[(0,n.jsx)("svg",{className:"flex-shrink-0 w-4 h-4 mt-0.5 ".concat(x.check),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),(0,n.jsx)("span",{className:"".concat(f?"text-xs":"text-sm"," text-text-secondary"),children:function(e){if(!e.bold)return e.text;let t=e.text.indexOf(e.bold);return -1===t?e.text:(0,n.jsxs)(n.Fragment,{children:[e.text.slice(0,t),(0,n.jsx)("strong",{className:"font-bold text-text-primary",children:e.bold}),e.text.slice(t+e.bold.length)]})}(e)})]},e.text))})]})}let i=[{text:"Create unlimited dynamic QR codes",bold:"unlimited dynamic"},{text:"Access 18 different QR types",bold:"18 different"},{text:"Unlimited modifications of QR codes",bold:"Unlimited modifications"},{text:"Unlimited scans",bold:"Unlimited scans"},{text:"3 download formats (PNG, SVG, JPEG)",bold:"3 download formats"}],d=[{text:"Team workspace with 5 seats",bold:"5 seats"},{text:"White-label branding",bold:"White-label"},{text:"Custom domain",bold:"Custom domain"},{text:"Automate & integrate via the API",bold:"Automate & integrate"},{text:"Priority support",bold:"Priority support"}];function u(e){var t,a,l,u;let{onSelect:p,compact:m=!1,defaultCycle:h="yearly"}=e,{pricing:y,formatPrice:f}=(0,o.e)(),[x,b]=(0,r.useState)(h);if(!y)return null;let g="yearly"===x,v=g?y.plans.yearly:y.plans.monthly,w=y.business,k=(null==w||null==(t=w.plans)?void 0:t.yearly)||null,j=w?null!=(u=g?w.plans.yearly:w.plans.monthly)?u:w.plans.yearly:null,N=Math.max((null==(a=y.plans.yearly)?void 0:a.savingsPercent)||0,(null==k?void 0:k.savingsPercent)||0);return(0,n.jsxs)("div",{children:[(0,n.jsx)("div",{className:"flex justify-center mb-8 sm:mb-10",children:(0,n.jsx)(s,{value:x,onChange:b,savingsPercent:N})}),(0,n.jsxs)("div",{className:"grid grid-cols-1 gap-6 sm:gap-8 mx-auto items-stretch ".concat(k?"md:grid-cols-2 max-w-4xl":"max-w-sm"),children:[(0,n.jsx)(c,{name:"Pro",subtitle:"For individuals & freelancers",accent:"blue",plan:v,monthlyPlan:y.plans.monthly,isYearly:g,ctaLabel:"Get Pro",onCta:()=>p(x,"pro"),features:i,formatPrice:f,compact:m}),k&&(0,n.jsx)(c,{name:"Business",subtitle:"For teams & agencies",accent:"teal",highlighted:!0,badge:"Most Popular",plan:j,monthlyPlan:(null==w||null==(l=w.plans)?void 0:l.monthly)||null,isYearly:g,ctaLabel:"Get Business",onCta:()=>p(x,"business"),featuresHeading:"Everything in Pro, plus:",features:d,formatPrice:f,compact:m})]})]})}},20063:(e,t,a)=>{var n=a(47260);a.o(n,"useParams")&&a.d(t,{useParams:function(){return n.useParams}}),a.o(n,"usePathname")&&a.d(t,{usePathname:function(){return n.usePathname}}),a.o(n,"useRouter")&&a.d(t,{useRouter:function(){return n.useRouter}}),a.o(n,"useSearchParams")&&a.d(t,{useSearchParams:function(){return n.useSearchParams}})},26497:(e,t,a)=>{a.d(t,{N:()=>g});var n=a(95155),r=a(12115),o=a(60296),s=a(94416),l=a(86553),c=a(59686),i=a(81402),d=a(53127);function u(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}class p extends r.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=t.offsetParent,a=(0,i.s)(e)&&e.offsetWidth||0,n=this.props.sizeRef.current;n.height=t.offsetHeight||0,n.width=t.offsetWidth||0,n.top=t.offsetTop,n.left=t.offsetLeft,n.right=a-n.width-n.left}return null}componentDidUpdate(){}render(){return this.props.children}}function m(e){let{children:t,isPresent:a,anchorX:o,root:s}=e,l=(0,r.useId)(),c=(0,r.useRef)(null),i=(0,r.useRef)({width:0,height:0,top:0,left:0,right:0}),{nonce:m}=(0,r.useContext)(d.Q),h=function(...e){return r.useCallback(function(...e){return t=>{let a=!1,n=e.map(e=>{let n=u(e,t);return a||"function"!=typeof n||(a=!0),n});if(a)return()=>{for(let t=0;t<n.length;t++){let a=n[t];"function"==typeof a?a():u(e[t],null)}}}}(...e),e)}(c,null==t?void 0:t.ref);return(0,r.useInsertionEffect)(()=>{let{width:e,height:t,top:n,left:r,right:d}=i.current;if(a||!c.current||!e||!t)return;c.current.dataset.motionPopId=l;let u=document.createElement("style");m&&(u.nonce=m);let p=null!=s?s:document.head;return p.appendChild(u),u.sheet&&u.sheet.insertRule('\n [data-motion-pop-id="'.concat(l,'"] {\n position: absolute !important;\n width: ').concat(e,"px !important;\n height: ").concat(t,"px !important;\n ").concat("left"===o?"left: ".concat(r):"right: ".concat(d),"px !important;\n top: ").concat(n,"px !important;\n }\n ")),()=>{p.contains(u)&&p.removeChild(u)}},[a]),(0,n.jsx)(p,{isPresent:a,childRef:c,sizeRef:i,children:r.cloneElement(t,{ref:h})})}let h=e=>{let{children:t,initial:a,isPresent:o,onExitComplete:l,custom:i,presenceAffectsLayout:d,mode:u,anchorX:p,root:h}=e,f=(0,s.M)(y),x=(0,r.useId)(),b=!0,g=(0,r.useMemo)(()=>(b=!1,{id:x,initial:a,isPresent:o,custom:i,onExitComplete:e=>
1{for(let t of(f.set(e,!0),f.values()))if(!t)return;l&&l()},register:e=>(f.set(e,!1),()=>f.delete(e))}),[o,f,l]);return d&&b&&(g={...g}),(0,r.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[o]),r.useEffect(()=>{o||f.size||!l||l()},[o]),"popLayout"===u&&(t=(0,n.jsx)(m,{isPresent:o,anchorX:p,root:h,children:t})),(0,n.jsx)(c.t.Provider,{value:g,children:t})};function y(){return new Map}var f=a(75601);let x=e=>e.key||"";function b(e){let t=[];return r.Children.forEach(e,e=>{(0,r.isValidElement)(e)&&t.push(e)}),t}let g=e=>{let{children:t,custom:a,initial:c=!0,onExitComplete:i,presenceAffectsLayout:d=!0,mode:u="sync",propagate:p=!1,anchorX:m="left",root:y}=e,[g,v]=(0,f.xQ)(p),w=(0,r.useMemo)(()=>b(t),[t]),k=p&&!g?[]:w.map(x),j=(0,r.useRef)(!0),N=(0,r.useRef)(w),P=(0,s.M)(()=>new Map),[S,C]=(0,r.useState)(w),[A,_]=(0,r.useState)(w);(0,l.E)(()=>{j.current=!1,N.current=w;for(let e=0;e<A.length;e++){let t=x(A[e]);k.includes(t)?P.delete(t):!0!==P.get(t)&&P.set(t,!1)}},[A,k.length,k.join("-")]);let R=[];if(w!==S){let e=[...w];for(let t=0;t<A.length;t++){let a=A[t],n=x(a);k.includes(n)||(e.splice(t,0,a),R.push(a))}return"wait"===u&&R.length&&(e=R),_(b(e)),C(w),null}let{forceRender:T}=(0,r.useContext)(o.L);return(0,n.jsx)(n.Fragment,{children:A.map(e=>{let t=x(e),r=(!p||!!g)&&(w===A||k.includes(t));return(0,n.jsx)(h,{isPresent:r,initial:(!j.current||!!c)&&void 0,custom:a,presenceAffectsLayout:d,mode:u,root:y,onExitComplete:r?void 0:()=>{if(!P.has(t))return;P.set(t,!0);let e=!0;P.forEach(t=>{t||(e=!1)}),e&&(null==T||T(),_(N.current),p&&(null==v||v()),i&&i())},anchorX:m,children:e},t)})})}},28749:(e,t,a)=>{a.d(t,{n:()=>m});var n=a(95155),r=a(12115),o=a(20063),s=a(22663),l=a(53170),c=a(34349),i=a(95215),d=a(65380),u=a(60080);let p=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{let a=localStorage.getItem("accessToken");if(!a)return;fetch("".concat("https://api.qrforever.com","/api/track/checkout"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(a)},body:JSON.stringify({event:e,...t}),keepalive:!0}).catch(()=>{})}catch(e){}};function m(e){let{billingCycle:t,tier:a="pro",source:m="billing",promoSlug:h=null,onDone:y,onSuccess:f}=e,[x,b]=(0,r.useState)(!1),{currency:g}=(0,i.e)(),{checkingKillSwitch:v,paymentBlocked:w,blockMessage:k,selectedPlan:j,handleCheckout:N}=function(e){var t,a,n;let{billingCycle:m,tier:h="pro",mode:y="new",promoSlug:f=null,source:x="pricing",onSuccess:b,onError:g}=e,v=(0,o.useRouter)(),{pricing:w,formatPrice:k,getPlan:j,currency:N}=(0,i.e)(),{refreshUser:P,user:S}=(0,d.A)(),[C,A]=(0,r.useState)(!1),[_,R]=(0,r.useState)(!0),[T,z]=(0,r.useState)(!1),[E,I]=(0,r.useState)(""),[M,F]=(0,r.useState)({card:!0,upi:!0,netbanking:!0,wallet:!0}),[D,U]=(0,r.useState)(""),[q,L]=(0,r.useState)(!1),[O,B]=(0,r.useState)(null),[Y,J]=(0,r.useState)(null),V="business"===h?null!=(n=null==w||null==(a=w.business)||null==(t=a.plans)?void 0:t[m])?n:null:j(m),W=(null==V?void 0:V.total)||0,Q=(null==O?void 0:O.discountAmount)||0,G=(null==O?void 0:O.finalAmount)||W;(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("".concat("https://api.qrforever.com","/api/system/payment-status")),t=await e.json();t.success&&(t.data.killSwitch&&(z(!0),I(t.data.message||"Payment processing is temporarily unavailable. Please try again later.")),t.data.paymentMethods&&F({card:t.data.paymentMethods.card,upi:t.data.paymentMethods.upi,netbanking:t.data.paymentMethods.netbanking,wallet:t.data.paymentMethods.wallet}))}catch(e){console.error("Error checking payment config:",e)}finally{R(!1)}})()},[]);let H=(0,r.useCallback)(async(e,t)=>{var a,n,r;if(!e.trim())return void J("Please enter a coupon code");L(!0),J(null);try{let n=await (0,c.Vk)(e.trim().toUpperCase(),t,N);n.success&&(null==(a=n.data)?void 0:a.valid)?(B(n.data),U(n.data.coupon.code),s.Ay.success('Coupon "'.concat(n.data.coupon.code,'" applied!'))):(J(n.message||"Invalid coupon code"),B(null))}catch(e){J((null==(r=e.response)||null==(n=r.data)?void 0:n.message)||"Failed to validate coupon"),B(null)}finally{L(!1)}},[N]),K=(0,r.useCallback)(async()=>{await H(D,m)},[D,m,H]),X=(0,r.useCallback)(()=>{B(null),U(""),J(null)},[]);(0,r.useEffect)(()=>{let e=async()=>{let e=localStorage.getItem("qrforever_promo"),t=f||e;if(t&&!O)try{var a;let e=await (0,c.YV)(t);if(e.success&&(null==(a=e.data)?void 0:a.valid)&&e.data.coupon){let{coupon:t}=e.data;
1t.applicableBillingCycles.includes(m)&&(t.autoApply?(U(t.code),await H(t.code,m)):(U(t.code),s.Ay.success('Promo code "'.concat(t.code,'" found! Click Apply to use it.'),{duration:5e3})))}}catch(e){console.error("Failed to load promo coupon:",e)}finally{localStorage.removeItem("qrforever_promo")}};_||e()},[f,m,O,_,H]),(0,r.useEffect)(()=>{O&&(B(null),U(""),J(null))},[m]);let $=(0,r.useCallback)(async()=>{if(T)return void s.Ay.error("Payment processing is temporarily unavailable");A(!0);try{(0,u.D)("start_checkout",{plan_name:"premium",billing_cycle:m,value:G,currency:N}),p("initiated",{tier:h,plan:"premium",billingCycle:m,currency:N});let e=null==S?void 0:S.subscription,t=((null==e?void 0:e.status)==="pending"||(null==e?void 0:e.status)==="payment_failed")&&(null==e?void 0:e.billingCycle)===m&&(null==e?void 0:e.currency)===N&&((null==e?void 0:e.tier)||"pro")===h?await (0,l.v1)(x):await (0,l.Ky)({qrCount:0,billingCycle:m,plan:"premium",tier:h,currency:N,couponCode:(null==O?void 0:O.coupon.code)||void 0,source:x});if(t.success&&t.data){let{provider:e,subscriptionId:a,razorpayKeyId:n,checkoutUrl:r,customerName:o,customerEmail:c,customerContact:i}=t.data;if(t.data.alreadySubscribed){s.Ay.success(t.message||"You already have an active subscription."),await P(),A(!1),v.push("/dashboard/billing"),null==b||b();return}if("kelviq"===e&&r){p("gateway_reached",{provider:"kelviq",tier:h,billingCycle:m,currency:N}),window.location.href=r;return}if(!n){s.Ay.success("Plan updated successfully!"),(0,s.Ay)("Your card will be charged for the pro-rated amount shortly.",{icon:"\uD83D\uDCB3",duration:5e3}),setTimeout(()=>{let e=new URLSearchParams({subscription_success:"true",transaction_id:a,value:G.toString(),currency:N});"new"===y?v.push("/dashboard?".concat(e.toString())):v.push("/dashboard/billing?".concat(e.toString())),null==b||b()},2500);return}if(!window.Razorpay){let e=document.createElement("script");e.src="https://checkout.razorpay.com/v1/checkout.js",e.async=!0,document.body.appendChild(e),await new Promise(t=>{e.onload=t})}let d=[];M.upi||d.push({method:"upi"}),M.netbanking||d.push({method:"netbanking"}),M.wallet||d.push({method:"wallet"}),"INR"!==N&&M.upi&&!d.find(e=>"upi"===e.method)&&d.push({method:"upi"});let f=d.length>0?{hide:d}:{},x=new window.Razorpay({key:n,subscription_id:a,name:"QRForever",image:"https://qrforever.com/assets/logo.png",prefill:{name:o,email:c,contact:i},config:{display:f},handler:async function(e){try{let t=e.razorpay_subscription_id||a;await (0,l.KF)({razorpay_payment_id:e.razorpay_payment_id,razorpay_subscription_id:t,razorpay_signature:e.razorpay_signature}),await P(),s.Ay.success("Subscription activated successfully!"),(0,u.D)("complete_checkout",{plan_name:"premium",billing_cycle:m,value:G,currency:N}),(0,u.yM)("purchase",{transaction_id:e.razorpay_payment_id,value:G,currency:N,items:JSON.stringify([{item_name:"Premium Subscription",item_category:"subscription",item_variant:m,price:G,quantity:1}])}),(0,u.il)("purchase",{transaction_id:e.razorpay_payment_id,value:G,currency:N}),setTimeout(()=>{let t=new URLSearchParams({subscription_success:"true",transaction_id:e.razorpay_payment_id,value:G.toString(),currency:N});"new"===y?v.push("/dashboard?".concat(t.toString())):v.push("/dashboard/billing?".concat(t.toString())),null==b||b()},1500)}catch(e){console.error("[useCheckout] Verification error:",e),s.Ay.error("Payment successful but verification failed. Contact support."),null==g||g("Verification failed")}},modal:{ondismiss:function(){s.Ay.error("Payment cancelled"),A(!1),fetch("".concat("https://api.qrforever.com","/api/track/razorpay-modal"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("accessToken"))},body:JSON.stringify({event:"closed",reason:"user_dismissed"})}).catch(console.error)}}});try{await fetch("".concat("https://api.qrforever.com","/api/track/razorpay-modal"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("accessToken"))},body:JSON.stringify({event:"opened"})})}catch(e){console.error("Failed to track modal opened:",e)}p("gateway_reached",{provider:"razorpay",tier:h,billingCycle:m,currency:N}),x.open(),x.on("payment.failed",function(e){console.error("[useCheckout] Payment failed:",e.error),s.Ay.error(e.error.description||"Payment failed"),A(!1),null==g||g(e.error.description||"Payment failed"),fetch("".concat("https://api.qrforever.com","/api/track/razorpay-modal"),{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("accessToken"))},body:JSON.stringify({event:"closed",reason:"payment_failed"})}).catch(console.error)})}else p("failed",{reason:t.message||"no_gateway",tier:h,billingCycle:m,currency:N}),s.Ay.error(t.message||"Failed to create subscription"),A(!1),null==g||g(t.message||"Failed to create subscription")}catch(l){var e,t,a,n,r,o,c;console.error("Checkout error:",l),p("failed",{reason:(null==(t=l.response)||null==(e=t.data)?void 0:e.message)||l.message||"exception",status:null==(a=l.response)?void 0:a.status,tier:h,billingCycle:m,currency:N}),s.Ay.error((null==(r=l.response)||null==(n=r.data)?void 0:n.message)||"Failed to process checkout"),A(!1),null==g||g((null==(c=l.response)||null==(o=c.data)?void 0:o.message)||"Failed to process checkout")}},[T,m,h,G,N,S,O,M,y,x,v,P,b,g]);return{loading:C,checkingKillSwitch:_,paymentBlocked:T,blockMessage:E,enabledPaymentMethods:M,couponCode:D,setCouponCode:U,couponLoading:q,appliedCoupon:O,couponError:Y,handleValidateCoupon:K,handleRemoveCoupon:X,originalAmount:W,discountAmount:Q,totalAmount:G,selectedPlan:V,handleCheckout:$}}({billingCycle:t,tier:a,source:m,promoSlug:h,onSuccess:()=>{null==f||f()},onError:()=>{y()}}),P=(0,r.useRef)(!1);return((0,r.useEffect)(()=>
1{if(!P.current&&!v&&!w){if(!j)return void y();P.current=!0,N().finally(()=>b(!0))}},[v,w,j,N,y]),w)?(0,n.jsx)("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",children:(0,n.jsxs)("div",{className:"bg-surface rounded-2xl p-6 max-w-sm w-full text-center shadow-xl",children:[(0,n.jsx)("h2",{className:"text-lg font-bold text-text-primary mb-2",children:"Payment temporarily unavailable"}),(0,n.jsx)("p",{className:"text-sm text-text-secondary mb-4",children:k}),(0,n.jsx)("button",{onClick:y,className:"px-6 py-2.5 rounded-lg font-semibold bg-blue-500 hover:bg-blue-600 text-white",children:"Close"})]})}):x?null:(0,n.jsxs)("div",{className:"fixed inset-0 z-[60] flex flex-col items-center justify-center bg-black/60 p-4",children:[(0,n.jsx)("div",{className:"w-12 h-12 border-4 border-white/30 border-t-white rounded-full animate-spin mb-4"}),(0,n.jsx)("p",{className:"text-white font-medium",children:"Redirecting to paymentâ¦"}),"INR"===g&&(0,n.jsxs)("div",{className:"mt-5 w-full max-w-sm rounded-xl border border-white/20 bg-white/10 p-4 text-center backdrop-blur-sm",children:[(0,n.jsx)("p",{className:"mb-1.5 text-sm font-semibold text-white",children:"Paying by UPI AutoPay?"}),(0,n.jsx)("p",{className:"text-xs leading-relaxed text-white/80",children:"Your UPI app will ask you to approve a mandate with a far-off end date. That is how recurring UPI works: it is permission to charge, not a charge. You are only ever billed your plan amount each cycle, you can cancel whenever you like, and cancelling keeps your access until the end of the period you have paid for."})]})]})}},34349:(e,t,a)=>{a.d(t,{F6:()=>u,H4:()=>m,IN:()=>h,Jw:()=>y,Vk:()=>l,W9:()=>d,XW:()=>i,YI:()=>p,YV:()=>c});var n=a(12466);let r="".concat("https://api.qrforever.com","/api/admin"),o=()=>{let e=localStorage.getItem("adminAccessToken");return{"Content-Type":"application/json",...e&&{Authorization:"Bearer ".concat(e)}}};async function s(e){if(!e.ok)throw Error((await e.json().catch(()=>({message:"An error occurred"}))).message||"HTTP ".concat(e.status,": ").concat(e.statusText));return e.json()}let l=async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"INR";return(await n.Ay.post("/api/coupons/validate",{code:e,billingCycle:t,currency:a})).data},c=async e=>(await n.Ay.get("/api/coupons/promo/".concat(e))).data,i=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:20,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"all",l=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"createdAt",c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"desc",i=new URLSearchParams({page:e.toString(),limit:t.toString(),search:a,status:n,sortBy:l,sortOrder:c});return s(await fetch("".concat(r,"/coupons?").concat(i.toString()),{headers:o()}))},d=async e=>s(await fetch("".concat(r,"/coupons/").concat(e),{headers:o()})),u=async()=>s(await fetch("".concat(r,"/coupons/stats"),{headers:o()})),p=async e=>s(await fetch("".concat(r,"/coupons"),{method:"POST",headers:o(),body:JSON.stringify(e)})),m=async(e,t)=>s(await fetch("".concat(r,"/coupons/").concat(e),{method:"PUT",headers:o(),body:JSON.stringify(t)})),h=async e=>s(await fetch("".concat(r,"/coupons/").concat(e,"/toggle"),{method:"PATCH",headers:o()})),y=async function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return s(await fetch("".concat(r,"/coupons/").concat(e,"?hardDelete=").concat(t),{method:"DELETE",headers:o()}))}},53170:(e,t,a)=>{a.d(t,{KF:()=>c,Ky:()=>r,M2:()=>s,Yx:()=>u,o9:()=>i,pK:()=>l,v1:()=>d,zN:()=>o});var n=a(12466);let r=async e=>(await n.Ay.post("/api/subscription/create",e)).data,o=async()=>(await n.Ay.get("/api/subscription?t=".concat(new Date().getTime()))).data,s=async()=>(await n.Ay.post("/api/subscription/cancel")).data,l=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return(await n.Ay.get("/api/subscription/payments?page=".concat(e,"&limit=").concat(t,"&t=").concat(new Date().getTime()))).data},c=async e=>(await n.Ay.post("/api/subscription/verify",e)).data,i=async()=>(await n.Ay.get("/api/subscription/check-abandoned")).data,d=async(e,t)=>(await n.Ay.post("/api/subscription/retry",{source:e,couponCode:t})).data,u=async()=>(await n.Ay.post("/api/subscription/check-pending")).data}}]);
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.