PageSourceSearch

https://weely.ai/_next/static/chunks/6674.a04af8977f3f9c94.js

js weely.ai collected 2026-10-05 13:19:29 UTC 6,558 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6674],{48667:function(e,a,t){t.d(a,{default:function(){return n.a}});var r=t(88003),n=t.n(r)},56195:function(e,a,t){t.r(a),t.d(a,{default:function(){return u}});var r=t(57437),n=t(2265),o=t(48667),i=t(18206),s=t(99376),l=t(14879),c=t(31966),d=t(40257);function u(e){let{planId:a,razorpayPlanId:t,billingCycle:u,currency:m,countryCode:p,customer:h,onSuccess:y,onError:f,onCancel:x}=e,[b,g]=(0,n.useState)(!1),[v,j]=(0,n.useState)(!1),[w,k]=(0,n.useState)(!1),[N,C]=(0,n.useState)(null),[z,P]=(0,n.useState)(h),S=(0,s.useRouter)(),_="https://app.weely.ai",E=(0,n.useMemo)(()=>sessionStorage.getItem("auth_token"),[]),I=(0,n.useMemo)(()=>(null==z?void 0:z._id)&&(null==z?void 0:z.name)&&(null==z?void 0:z.email)&&(null==z?void 0:z.phone),[z]);(0,n.useEffect)(()=>{P(h)},[h]),(0,n.useEffect)(()=>{(null==h?void 0:h.id)||A()},[]);let A=(0,n.useCallback)(async()=>{if(E)try{let e=await fetch("".concat(_,"/api/customers"),{headers:{Authorization:"Bearer ".concat(E),"Content-Type":"application/json"}});if(e.ok){let a=await e.json();P(a)}}catch(e){console.error("Error fetching customer data:",e)}},[E,_]),R=(0,n.useCallback)(e=>{P(e)},[]),B=(0,n.useCallback)(async()=>{if(!I){i.Am.error("Please complete your contact information first");return}if(!v){i.Am.info("Payment system is still loading. Please wait a moment.");return}g(!0);try{let e=await fetch("".concat(_,"/api/payment/create-subscription"),{method:"POST",headers:{Authorization:"Bearer ".concat(E),"Content-Type":"application/json"},body:JSON.stringify({planId:a,period:u,razorpayPlanId:t,customerEmail:z.email,customerName:z.name,customerId:z.id,currency:m,countryCode:p})}),r=await e.json();if(!e.ok||!r.id)throw Error(r.message||"Subscription creation failed");let n={key:d.env.NEXT_PUBLIC_RAZORPAY_KEY_ID,subscription_id:r.id,name:"Weely",description:"Subscription - ".concat("annually"===u?"Annual":"Monthly"," Plan"),handler:async e=>{try{let r=await fetch("".concat(_,"/api/payment/verify-subscription"),{method:"POST",headers:{Authorization:"Bearer ".concat(E),"Content-Type":"application/json"},body:JSON.stringify({planId:a,period:u,razorpayPlanId:t,signature:e.razorpay_signature,subscriptionId:e.razorpay_subscription_id,paymentId:e.razorpay_payment_id,customerId:z.id})}),n=await r.json();r.ok?(C({...n,planName:"annually"===u?"Annual":"Monthly"}),k(!0),null==y||y(n)):(console.error(n.message||"Verification failed"),null==f||f(Error(n.message||"Verification failed")))}catch(e){console.error("Verification error",e),null==f||f(e)}},modal:{ondismiss:()=>{null==x||x()}},prefill:{name:z.name,email:z.email,contact:z.phone},theme:{color:"#4285f4"}};if(window.Razorpay)new window.Razorpay(n).open();else throw Error("Razorpay is not loaded")}catch(e){console.error("Subscription error:",e),i.Am.error(e.message||"Payment initialization failed. Please try again."),null==f||f(e)}finally{g(!1)}},[I,v,_,E,a,z,u,y,f,x]),L=(0,n.useCallback)(()=>{j(!0)},[]),M=(0,n.useCallback)(()=>{console.error("Failed to load Razorpay script"),j(!1)},[]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{src:"https://checkout.razorpay.com/v1/checkout.js",onLoad:L,onError:M,strategy:"lazyOnload"}),(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)(c.Z,{customer:z,onCustomerUpdate:R}),(0,r.jsx)("button",{onClick:B,disabled:b||!I||!v,type:"button",className:"w-full py-4 px-6 rounded-xl font-semibold text-base transition-all duration-300 flex items-center justify-center gap-3 transform ".concat(!b&&I&&v?"text-black bg-dark-primary hover:bg-dark-primary/80 active:scale-95 shadow-sm focus:outline-none focus:ring-2 focus:ring-dark-primary/50":"text-gray-500 bg-gray-200 cursor-not-allowed"),children:b?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-5 h-5 border-2 border-black/30 border-t-black rounded-full animate-spin"}),"Processing Payment..."]}):v?I?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"})}),"Continue to Payment"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})}),"Complete Contact Information"]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-5 h-5 border-2 border-gray-400/30 border-t-gray-400 rounded-full animate-spin"}),"Loading Payment System..."]})}),(0,r.jsx)("div",{className:"text-center",children:(0,r.jsxs)("p",{className:"text-xs text-gray-600 leading-relaxed max-w-md mx-auto",children:["By proceeding, you agree to our"," ",(0,r.jsx)("a",{href:"#",className:"text-primary-text underline hover:no-underline font-medium transition-colors",children:"Terms of Service"})," ","and"," ",(0,r.jsx)("a",{href:"#",className:"text-primary-text underline hover:no-underline font-medium transition-color",children:"Privacy Policy"}),". Your subscription will auto-renew"," ","annually"===u?"annually":"monthly","."]})})]}),w&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-sm p-4",children:(0,r.jsx)("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md mx-auto",children:(0,r.jsxs)("div",{className:"p-6 text-center",children:[(0,r.jsx)("div",{className:"w-16 h-16 bg-gradient-to-br from-green-500 to-emerald-600 rounded-full flex items-center justify-center mx-auto mb-4",children:(0,r.jsx)("svg",{className:"w-8 h-8 text-white",f
1ill:"currentColor",viewBox:"0 0 20 20",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}),(0,r.jsx)("h3",{className:"text-xl font-bold text-gray-900 mb-2",children:"Payment Successful!"}),(0,r.jsxs)("p",{className:"text-gray-600 mb-6",children:["Your ",null==N?void 0:N.planName," subscription has been activated successfully."]}),(0,r.jsx)("button",{onClick:()=>{k(!1),S.push(l.Z.dashboardHome)},className:"w-full bg-gradient-to-r from-blue-600 to-indigo-600 text-white py-3 px-6 rounded-lg font-semibold hover:from-blue-700 hover:to-indigo-700 transition-all duration-200",type:"button",children:"Continue"})]})})})]})}}}]);

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.