PageSourceSearch

https://www.skribil.ai/_next/static/chunks/pages/billing-33810b96d43f7387.js

js skribil.ai collected 2026-10-05 13:32:21 UTC 35,928 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6067],{87789:function(e,t,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/billing",function(){return s(76578)}])},92761:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},23346:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},60493:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("CheckCircle",[["path",{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14",key:"g774vq"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]])},50039:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]])},2553:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},3350:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("MapPin",[["path",{d:"M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z",key:"2oe9fu"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]])},4270:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},69819:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("Save",[["path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z",key:"1owoqh"}],["polyline",{points:"17 21 17 13 7 13 7 21",key:"1md35c"}],["polyline",{points:"7 3 7 8 15 8",key:"8nz8an"}]])},37864:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(63759).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},28327:function(e,t,s){"use strict";s.d(t,{a:function(){return l}});var a=s(67294);let l=e=>{let[t,s]=(0,a.useState)({days:0,hours:0,minutes:0,seconds:0,expired:!1});return(0,a.useEffect)(()=>{if(!e){s({days:0,hours:0,minutes:0,seconds:0,expired:!0});return}let t=()=>{let t=new Date().getTime(),a=new Date(e).getTime()-t;if(a<=0){s({days:0,hours:0,minutes:0,seconds:0,expired:!0});return}s({days:Math.floor(a/864e5),hours:Math.floor(a%864e5/36e5),minutes:Math.floor(a%36e5/6e4),seconds:Math.floor(a%6e4/1e3),expired:!1})};t();let a=setInterval(t,1e3);return()=>clearInterval(a)},[e]),t}},76578:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return M}});var a=s(85893),l=s(16113),n=s(36197),r=s(11163),i=s(41664),d=s.n(i),c=s(67294),o=s(92761),x=s(43765),m=s(60641),u=s(62190),h=s(46611),p=s(50039),y=s(23346),g=s(14235),b=s(3350),f=s(2553),j=s(4270),v=s(37864),N=s(74442),w=s(69819),k=s(2859),S=s(31596),C=s(60493);let Z=(0,k.J)("pk_live_51RongPDoFpnm35sXW8MGikMf2RduaBrTEBwfHhPBtb0SWo0JdXwJFAu472xkEuCHGPlU4CzLh41MHpUqKAMzk5aq0013XYKJs7"),A=e=>{let{onSuccess:t,onCancel:s}=e,l=(0,S.MD)(),n=(0,S.lq)(),[r,i]=(0,c.useState)(!1),[d,o]=(0,c.useState)(null),[h,p]=(0,c.useState)(null);(0,c.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/stripe/create-setup-intent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))}});if(e.ok){let t=await e.json();p(t.data.clientSecret)}else{let t=await e.json();o(t.message||"Failed to initialize payment form")}}catch(e){o("Failed to initialize payment form")}})()},[]);let y=async e=>{if(e.preventDefault(),!l||!n||!h)return;i(!0),o(null);let s=n.getElement(S.NZ);if(!s){o("Card element not found"),i(!1);return}try{let{error:e,setupIntent:a}=await l.confirmCardSetup(h,{payment_method:{card:s}});if(e){o(e.message||"Failed to add card"),i(!1);return}if((null==a?void 0:a.status)==="succeeded"){let e=await fetch("/api/stripe/attach-payment-method",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))},body:JSON.stringify({paymentMethodId:a.payment_method})});if(e.ok)t();else{let t=await e.json();o(t.message||"Failed to save payment method")}}}catch(e){o(e.message||"An error occurred")}finally{i(!1)}};return(0,a.jsxs)("form",{onSubmit:y,className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Card Details"}),(0,a.jsx)("div",{className:"px-3 py-2 border border-gray-300 rounded-lg focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500 transition-all",children:(0,a.jsx)(S.NZ,{options:{style:{base
1:{fontSize:"16px",color:"#1f2937",fontFamily:"system-ui, -apple-system, sans-serif","::placeholder":{color:"#9ca3af"}},invalid:{color:"#dc2626",iconColor:"#dc2626"}}}})})]}),d&&(0,a.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-3 flex items-center space-x-2",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-red-600 flex-shrink-0"}),(0,a.jsx)("p",{className:"text-red-800 text-sm",children:d})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-gray-200",children:[(0,a.jsxs)("button",{type:"button",onClick:s,disabled:r,className:"px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-2 disabled:opacity-50 disabled:cursor-not-allowed",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Cancel"})]}),(0,a.jsx)("button",{type:"submit",disabled:!l||r||!h,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed text-white rounded-lg transition-colors flex items-center space-x-2",children:r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 animate-spin"}),(0,a.jsx)("span",{children:"Adding Card..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(C.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Add Card"})]})})]})]})};var P=e=>{let{onSuccess:t,onCancel:s}=e;return(0,a.jsx)(S.eK,{stripe:Z,options:{mode:"setup",currency:"usd"},children:(0,a.jsx)(A,{onSuccess:t,onCancel:s})})},E=s(28327),M=()=>{var e,t,s,i,k,S,C;let{user:Z,authFetch:A}=(0,n.a)(),M=(0,r.useRouter)(),I=(0,c.useRef)(!1),[T,_]=(0,c.useState)(!0),[D,z]=(0,c.useState)(null),[F,B]=(0,c.useState)([]),[U,q]=(0,c.useState)([]),[H,L]=(0,c.useState)(null),[O,R]=(0,c.useState)(null),[J,G]=(0,c.useState)("payment"),[V,W]=(0,c.useState)(!1),[Y,K]=(0,c.useState)(!1),[X,$]=(0,c.useState)({line1:"",line2:"",city:"",state:"",postal_code:"",country:"US"}),[Q,ee]=(0,c.useState)(!1),[et,es]=(0,c.useState)({active:!1,plan:null}),[ea,el]=(0,c.useState)(null),[en,er]=(0,c.useState)(!1),ei=(null==O?void 0:O.trialEnd)||(null==Z?void 0:null===(e=Z.stripeInfo)||void 0===e?void 0:e.trialEndsAt)||null,ed=(0,E.a)(ei);(0,c.useEffect)(()=>{ec()},[]),(0,c.useEffect)(()=>{if(!M.isReady||I.current)return;let e=M.query.switchPlan;if("1"!==e&&"true"!==e)return;let t=M.query.plan;("pro-monthly"===t||"pro-yearly"===t||"humanizer"===t)&&(I.current=!0,es({active:!0,plan:t}),G("payment"),M.replace("/billing",void 0,{shallow:!0}))},[M.isReady,M.query.switchPlan,M.query.plan]);let ec=async()=>{try{_(!0),z(null);let[e,t,s,a]=await Promise.all([fetch("/api/stripe/payment-methods",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))}}).catch(()=>null),fetch("/api/stripe/invoices",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))}}).catch(()=>null),fetch("/api/stripe/address",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))}}).catch(()=>null),fetch("/api/stripe/subscription",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))}}).catch(()=>null)]);if(null==e?void 0:e.ok){let t=await e.json();B(t.data||[])}if(null==t?void 0:t.ok){let e=await t.json();q(e.data||[])}if(null==s?void 0:s.ok){let e=await s.json();e.data&&(L(e.data),$(e.data))}if(null==a?void 0:a.ok){let e=await a.json();e.data&&R(e.data)}}catch(e){z("Failed to load billing information. Please try again."),console.error("Billing data error:",e)}finally{_(!1)}},eo=async e=>{try{let t=await fetch("/api/stripe/set-default-payment-method",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))},body:JSON.stringify({paymentMethodId:e})});if(t.ok)await ec();else{let e=await t.json();alert(e.message||"Failed to update default payment method")}}catch(e){alert("Failed to update default payment method")}},ex=async e=>{if(confirm("Are you sure you want to remove this payment method?"))try{let t=await fetch("/api/stripe/delete-payment-method",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))},body:JSON.stringify({paymentMethodId:e})});if(t.ok)await ec();else{let e=await t.json();alert(e.message||"Failed to delete payment method")}}catch(e){alert("Failed to delete payment method")}},em=async()=>{try{ee(!0);
1let e=await fetch("/api/stripe/update-address",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(localStorage.getItem("token"))},body:JSON.stringify(X)});if(e.ok){let t=await e.json();L(t.data||X),K(!1),alert("Address updated successfully")}else{let t=await e.json();alert(t.message||"Failed to update address")}}catch(e){alert("Failed to update address")}finally{ee(!1)}},eu=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"usd";return new Intl.NumberFormat("en-US",{style:"currency",currency:t.toUpperCase()}).format(e/100)},eh=e=>new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),ep="pro-monthly"===et.plan?"Pro (monthly)":"pro-yearly"===et.plan?"Power (yearly)":"humanizer"===et.plan?"Content Humanizer + Creator":"",ey=async()=>{if(et.plan){el(null),er(!0);try{let e=await A("/api/stripe/switch-plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plan:et.plan})}),t=await e.json().catch(()=>({}));if(e.ok){es({active:!1,plan:null}),await ec();return}el(t.message||"Could not switch plans. Please try again.")}catch(e){el(e instanceof Error?e.message:"Something went wrong.")}finally{er(!1)}}};return(0,a.jsx)(l.Z,{children:(0,a.jsxs)("div",{className:"min-h-screen bg-gray-50 flex flex-col",children:[(0,a.jsx)("header",{className:"bg-white shadow-sm border-b border-gray-200",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:(0,a.jsxs)("div",{className:"flex items-center justify-between h-16",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 sm:space-x-4 flex-1 min-w-0",children:[(0,a.jsxs)("button",{onClick:()=>M.back(),className:"flex items-center text-gray-600 hover:text-gray-900 transition-colors flex-shrink-0",children:[(0,a.jsx)(o.Z,{className:"w-5 h-5 sm:mr-2"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Back"})]}),(0,a.jsx)("div",{className:"h-6 w-px bg-gray-300 hidden sm:block"}),(0,a.jsx)("h1",{className:"text-lg sm:text-xl font-semibold text-gray-900 truncate",children:"Billing"})]}),(0,a.jsx)("div",{className:"text-xs sm:text-sm text-gray-600 hidden sm:block ml-4",children:(null==Z?void 0:Z.name)&&(0,a.jsxs)("span",{children:["Welcome, ",Z.name]})})]})})}),(0,a.jsxs)("main",{className:"flex-1",children:["subscription_required"===M.query.reason&&(0,a.jsx)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 pt-6",children:(0,a.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 rounded-r-lg p-4",children:(0,a.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-yellow-800 mb-1",children:"Action Required"}),(0,a.jsx)("p",{className:"text-sm text-yellow-700",children:"Add a payment method to start using the services."})]})]})})}),(0,a.jsxs)("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",children:[et.active&&et.plan&&(0,a.jsx)("div",{className:"mb-6 rounded-lg border border-blue-200 bg-blue-50 p-4 sm:p-5",children:(0,a.jsxs)("div",{className:"flex justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h2",{className:"font-semibold text-blue-900",children:"Switch your plan"}),(0,a.jsxs)("p",{className:"mt-2 text-sm text-blue-800",children:["You selected ",(0,a.jsx)("strong",{children:ep}),". Add a payment method in the Payment methods tab below if you do not have one yet, then confirm your plan change here."]}),ea&&(0,a.jsx)("p",{className:"mt-2 text-sm text-red-700",role:"alert",children:ea}),!T&&0===F.length&&(0,a.jsx)("p",{className:"mt-2 text-sm font-medium text-blue-900",children:"Add a card in the section below, then return here to confirm."}),!T&&F.length>0&&(0,a.jsx)("button",{type:"button",onClick:()=>void ey(),disabled:en,className:"mt-4 inline-flex items-center rounded-lg bg-blue-600 px-4 py-2 text-sm font-semibold text-white hover:bg-blue-700 disabled:cursor-not-allowed disabled:opacity-50",children:en?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Updating…"]}):"Confirm ".concat(ep)})]}),(0,a.jsx)("button",{type:"button","aria-label":"Dismiss",onClick:()=>{es({active:!1,plan:null}),el(null)},className:"flex-shrink-0 text-blue-700 hover:text-blue-900",children:(0,a.jsx)(u.Z,{className:"h-5 w-5"})})]})}),T&&(0,a.jsx)("div",{className:"flex items-center justify-center min-h-[400px]",children:(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)(m.Z,{className:"w-8 h-8 animate-spin text-blue-600 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"Loading billing information..."})]})}),D&&(0,a.jsxs)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-red-600 mr-2"}),(0,a.jsx)("p",{className:"text-red-800",children:D})]}),(0,a.jsx)("button",{onClick:ec,className:"mt-4 text-sm text-red-600 hover:text-red-700 underline",children:"Try again"})]}),!T&&!D&&(0,a.jsxs)(a.Fragment,{children:[(O||(null==Z?void 0:Z.stripeInfo))&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 sm:p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between mb-4 gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Subscription Details"}),(0,a.jsx)("div",{className:"flex items-center flex-wrap gap-2 sm:space-x-3",children:(0,a.jsx)("span",{className:"px-2 sm:px-3 py-1 rounded-full text-xs font-medium whitespace-nowrap ".concat((null==O?void 0:O.status)==="active"||(null==Z?void 0:null===(t=Z.stripeInfo)||void 0===t?void 0:t.status)==="active"?"bg-green-100 text-green-800":(null==O?void 0:O.status)==="trialing"||(null==Z?void 0:null===(s=Z.str
1ipeInfo)||void 0===s?void 0:s.status)==="trialing"?"bg-blue-100 text-blue-800":"bg-gray-100 text-gray-800"),children:(null==O?void 0:O.status)==="active"||(null==Z?void 0:null===(i=Z.stripeInfo)||void 0===i?void 0:i.status)==="active"?"Active":(null==O?void 0:O.status)==="trialing"||(null==Z?void 0:null===(k=Z.stripeInfo)||void 0===k?void 0:k.status)==="trialing"?"Trial":"Inactive"})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[O&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-gray-600",children:[(0,a.jsx)(h.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Current Plan"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:function(e,t){var s,a,l;let n=null!==(a=e.id)&&void 0!==a?a:"",r=(null!==(l=e.name)&&void 0!==l?l:"").trim(),i="";if(r&&!r.startsWith("price_")){let e=r.toLowerCase();return"humanizer"===e||e.includes("humanizer")?"Content Humanizer + Creator":"pro-monthly"===r||e.includes("monthly")?"Pro Plan":"pro-yearly"===r||e.includes("yearly")?"Power Plan":r}return n&&""===n?"Pro Plan":n&&""===n?"Power Plan":n&&n===i?"Content Humanizer + Creator":r.startsWith("price_")||n.startsWith("price_")?"Subscription plan":r||"Subscription plan"}(O.plan)}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["$",(O.plan.amount/100).toFixed(2),"/","month"===O.plan.interval?"month":"year"===O.plan.interval?"year":O.plan.interval]}),(0,a.jsx)(d(),{href:"/pricing",className:"text-sm text-blue-600 hover:text-blue-700 underline mt-2 inline-block",children:"Switch Plan"})]})]}),((null==O?void 0:O.trialEnd)||(null==Z?void 0:null===(S=Z.stripeInfo)||void 0===S?void 0:S.trialEndsAt))&&((null==O?void 0:O.status)==="trialing"||(null==Z?void 0:null===(C=Z.stripeInfo)||void 0===C?void 0:C.status)==="trialing")&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-gray-600",children:[(0,a.jsx)(p.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Trial Ends In"})]}),ed.expired?(0,a.jsx)("p",{className:"text-lg font-semibold text-red-600",children:"Trial Has Ended"}):(0,a.jsxs)("div",{className:"flex items-center justify-center space-x-2 sm:space-x-4",children:[(0,a.jsxs)("div",{className:"text-center flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl font-bold text-blue-600",children:ed.days}),(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Days"})]}),(0,a.jsxs)("div",{className:"text-center flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl font-bold text-blue-600",children:ed.hours}),(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Hours"})]}),(0,a.jsxs)("div",{className:"text-center flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl font-bold text-blue-600",children:ed.minutes}),(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Minutes"})]}),(0,a.jsxs)("div",{className:"text-center flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xl sm:text-2xl font-bold text-blue-600",children:ed.seconds}),(0,a.jsx)("p",{className:"text-xs text-gray-600",children:"Seconds"})]})]}),(null==O?void 0:O.trialEnd)&&(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["Ends on"," ",new Date(O.trialEnd).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]})]}),O&&"active"===O.status&&!O.cancelAtPeriodEnd&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-gray-600",children:[(0,a.jsx)(y.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Next Payment Date"})]}),(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:new Date(O.currentPeriodEnd).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,a.jsxs)("p",{className:"text-xs text-gray-500",children:["$",(O.plan.amount/100).toFixed(2)," ","will be charged"]})]}),O&&O.billingCycleAnchor&&"active"===O.status&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-gray-600",children:[(0,a.jsx)(y.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{className:"text-sm font-medium",children:"Billing Anchor Date"})]}),(0,a.jsx)("p",{className:"text-lg font-semibold text-gray-900",children:new Date(O.billingCycleAnchor).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})}),(0,a.jsx)("p",{className:"text-xs text-gray-500",children:"Your billing cycle is anchored to this date"})]}),(null==O?void 0:O.cancelAtPeriodEnd)&&(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2 text-gray-600",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-orange-600"}),(0,a.jsx)("span",{className:"text-sm font-medium text-orange-600",children:"Subscription 
1Ending"})]}),(0,a.jsxs)("p",{className:"text-sm text-gray-900",children:["Your subscription will end on"," ",new Date(O.currentPeriodEnd).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"})]})]})]})]}),(()=>{var e,t;let s=(null==O?void 0:O.status)&&"active"!==O.status&&"trialing"!==O.status||(null==Z?void 0:null===(e=Z.stripeInfo)||void 0===e?void 0:e.status)&&"active"!==Z.stripeInfo.status&&"trialing"!==Z.stripeInfo.status,l=0===F.length,n=((null==O?void 0:O.status)==="trialing"||(null==Z?void 0:null===(t=Z.stripeInfo)||void 0===t?void 0:t.status)==="trialing")&&l;return s||l||n?(0,a.jsx)("div",{className:"bg-yellow-50 border-l-4 border-yellow-400 rounded-r-lg p-4 mb-6",children:(0,a.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,a.jsx)(x.Z,{className:"w-5 h-5 text-yellow-600 flex-shrink-0 mt-0.5"}),(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-yellow-800 mb-1",children:"Action Required"}),(0,a.jsx)("p",{className:"text-sm text-yellow-700",children:l&&n?"Add a payment method before your trial ends to continue your subscription without interruption.":l?"Add a payment method to continue your subscription and avoid service interruption.":"Your subscription is inactive. Add a payment method to reactivate your subscription. (If you have just updated the payment method, please wait for it to be processed)"}),(0,a.jsxs)("p",{className:"text-sm text-yellow-800 mt-3",children:["Use"," ",(0,a.jsx)("strong",{className:"font-semibold",children:"Add Payment Method"})," ","in the Payment Methods section below."]})]})]})}):null})(),(0,a.jsx)("div",{className:"border-b border-gray-200 mb-6 overflow-x-visible",children:(0,a.jsxs)("nav",{className:"-mb-px flex space-x-4 sm:space-x-8 min-w-max sm:min-w-0",children:[(0,a.jsxs)("button",{onClick:()=>G("payment"),className:"".concat("payment"===J?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"," whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2"),children:[(0,a.jsx)(g.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Payment Methods"}),(0,a.jsx)("span",{className:"sm:hidden",children:"Payment"})]}),(0,a.jsxs)("button",{onClick:()=>G("address"),className:"".concat("address"===J?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"," whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2"),children:[(0,a.jsx)(b.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Update Address"}),(0,a.jsx)("span",{className:"sm:hidden",children:"Address"})]}),(0,a.jsxs)("button",{onClick:()=>G("history"),className:"".concat("history"===J?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300"," whitespace-nowrap py-4 px-1 border-b-2 font-medium text-sm flex items-center space-x-2"),children:[(0,a.jsx)(f.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Billing History"}),(0,a.jsx)("span",{className:"sm:hidden",children:"History"})]})]})}),"payment"===J&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Payment Methods"}),(0,a.jsxs)("button",{onClick:()=>W(!V),className:"flex items-center justify-center space-x-2 bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg transition-colors w-full sm:w-auto",children:[(0,a.jsx)(j.Z,{className:"w-5 h-5"}),(0,a.jsx)("span",{children:"Add Payment Method"})]})]}),V&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-md font-semibold text-gray-900",children:"Add New Payment Method"}),(0,a.jsx)("button",{onClick:()=>W(!1),className:"text-gray-400 hover:text-gray-600",children:(0,a.jsx)(u.Z,{className:"w-5 h-5"})})]}),(0,a.jsx)("div",{className:"bg-blue-50 border border-blue-200 rounded-lg p-3 mb-4",children:(0,a.jsx)("p",{className:"text-blue-800 text-xs",children:"Your card details are securely processed by Stripe and never stored on our servers."})}),(0,a.jsx)(P,{onSuccess:()=>{W(!1),ec()},onCancel:()=>W(!1)})]}),F.length>0?(0,a.jsx)("div",{className:"space-y-4",children:F.map(e=>{var t,s,l,n;return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 sm:p-6",children:(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-3 sm:space-x-4 flex-1 min-w-0",children:[(0,a.jsx)(g.Z,{className:"w-6 h-6 sm:w-8 sm:h-8 text-gray-400 flex-shrink-0"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("p",{className:"font-medium text-gray-900 truncate",children:[null===(t=e.card)||void 0===t?void 0:t.brand.toUpperCase()," ••••"," ",null===(s=e.card)||void 0===s?void 0:s.last4]}),e.isDefault&&(0,a.jsx)("span",{className:"bg-green-100 text-green-800 text-xs font-medium px-2 py-1 rounded flex-shrink-0",children:"Default"})]}),(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:["Expires ",null===(l=e.card)||void 0===l?void 0:l.exp_month,"/",null===(n=e.card)||void 0===n?void 0:n.exp_year]})]})]}),(0,a.jsxs)("div",{className:"flex items-center flex-wrap gap-2 sm:space-x-2",children:[!e.isDefault&&(0,a.jsx)("button",{onClick:()=>eo(e.id),className:"text-blue-600 hover:text-blue-700 text-sm font-medium whitespace-nowrap",children:"Set as Default"}),F.length>1&&(0,a.jsxs)("button",{onClick:()=>ex(e.id),className:"text-red-600 hover:text-red-700 text-sm font-medium flex items-center space-x-1 whitespace-nowrap",children:[(0,a.jsx)(v.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Remove"})]})]})]})},e.id)})}):(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6 text-center",children:[(0,a.jsx)(g.Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,a.jsxs)("p",{className:"text-gray-600",children:["No payment methods on file. Use"," ",(0,a.jsx)("strong",{className:"font-semibold text-gray-800",children:"Add Payment Method"})," ","above to add a card."]})]})]}),"address"===J&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Billing Details"}),!Y&&(0,a.jsxs)("button",{onClick:()=>K(!0),className:"flex items-center justify-center sm:justify-start space-x-2 text-blue-600 hover:text-blue-700 w-full sm:w-auto",children:[(0,a.jsx)(N.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Edit Address"})]})]}),Y?(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 sm:p-6",children:[(0,a.jsx)("h3",{className:"text-md font-semibold text-gray-900 mb-4",children:"Update Billing Address"}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Address Line 1 *"}),(0,a.jsx)("input",{type:"text",value:X.line1,onChange:e=>$({...X,line1:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Address Line 2"}),(0,a.jsx)("input",{type:"text",value:X.line2||"",onChange:e=>$({...X,line2:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"City *"}),(0,a.jsx)("input",{type:"text",value:X.city,onChange:e=>$({...X,city:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"State *"}),(0,a.jsx)("input",{type:"text",value:X.state,onChange:e=>$({...X,state:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Postal Code *"}),(0,a.jsx)("input",{type:"text",value:X.postal_code,onChange:e=>$({...X,postal_code:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Country *"}),(0,a.jsxs)("select",{value:X.country,onChange:e=>$({...X,country:e.target.value}),className:"w-full px-3 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-blue-500",required:!0,children:[(0,a.jsx)("option",{value:"US",children:"United States"}),(0,a.jsx)("option",{value:"CA",children:"Canada"}),(0,a.jsx)("option",{value:"GB",children:"United Kingdom"}),(0,a.jsx)("option",{value:"AU",children:"Australia"}),(0,a.jsx)("option",{value:"DE",children:"Germany"}),(0,a.jsx)("option",{value:"FR",children:"France"}),(0,a.jsx)("option",{value:"IT",children:"Italy"}),(0,a.jsx)("option",{value:"ES",children:"Spain"}),(0,a.jsx)("option",{value:"NL",children:"Netherlands"}),(0,a.jsx)("option",{value:"BE",children:"Belgium"}),(0,a.jsx)("option",{value:"CH",children:"Switzerland"}),(0,a.jsx)("option",{value:"AT",children:"Austria"}),(0,a.jsx)("option",{value:"SE",children:"Sweden"}),(0,a.jsx)("option",{value:"NO",children:"Norway"}),(0,a.jsx)("option",{value:"DK",children:"Denmark"}),(0,a.jsx)("option",{value:"FI",children:"Finland"}),(0,a.jsx)("option",{value:"IE",children:"Ireland"}),(0,a.jsx)("option",{value:"PT",children:"Portugal"}),(0,a.jsx)("option",{value:"PL",children:"Poland"}),(0,a.jsx)("option",{value:"CZ",children:"Czech Republic"})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-end space-x-3 pt-4 border-t border-gray-200",children:[(0,a.jsxs)("button",{onClick:()=>{H?$(H):$({line1:"",line2:"",city:"",state:"",postal_code:"",country:"US"}),K(!1)},disabled:Q,className:"px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50 transition-colors flex items-center space-x-2",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Cancel"})]}
1),(0,a.jsx)("button",{onClick:em,disabled:Q||!X.line1||!X.city||!X.state||!X.postal_code,className:"px-4 py-2 bg-blue-600 hover:bg-blue-700 disabled:bg-gray-400 disabled:cursor-not-allowed text-white rounded-lg transition-colors flex items-center space-x-2",children:Q?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(m.Z,{className:"w-4 h-4 animate-spin"}),(0,a.jsx)("span",{children:"Saving..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(w.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Save Address"})]})})]})]})]}):(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-4 sm:p-6",children:H?(0,a.jsx)("div",{className:"space-y-2",children:(0,a.jsxs)("div",{className:"flex items-start space-x-3",children:[(0,a.jsx)(b.Z,{className:"w-5 h-5 text-gray-400 mt-1"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"font-medium text-gray-900",children:H.line1}),H.line2&&(0,a.jsx)("p",{className:"text-gray-700",children:H.line2}),(0,a.jsxs)("p",{className:"text-gray-700",children:[H.city,", ",H.state," ",H.postal_code]}),(0,a.jsx)("p",{className:"text-gray-700",children:H.country})]})]})}):(0,a.jsxs)("div",{className:"text-center py-8",children:[(0,a.jsx)(b.Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600 mb-4",children:"No billing address on file."}),(0,a.jsx)("button",{onClick:()=>K(!0),className:"text-blue-600 hover:text-blue-700 underline",children:"Add billing address"})]})})]}),"history"===J&&(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:"Billing History"}),U.length>0?(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden",children:(0,a.jsx)("div",{className:"overflow-x-auto",children:(0,a.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"px-3 sm:px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Date"}),(0,a.jsx)("th",{className:"px-3 sm:px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Amount"}),(0,a.jsx)("th",{className:"px-3 sm:px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Status"}),(0,a.jsx)("th",{className:"px-3 sm:px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider",children:"Actions"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:U.map(e=>(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"px-3 sm:px-6 py-4 whitespace-nowrap text-sm text-gray-900",children:eh(e.date)}),(0,a.jsx)("td",{className:"px-3 sm:px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900",children:eu(e.amount,e.currency)}),(0,a.jsx)("td",{className:"px-3 sm:px-6 py-4 whitespace-nowrap",children:(0,a.jsx)("span",{className:"px-2 inline-flex text-xs leading-5 font-semibold rounded-full ".concat("paid"===e.status?"bg-green-100 text-green-800":"open"===e.status?"bg-yellow-100 text-yellow-800":"bg-red-100 text-red-800"),children:e.status.charAt(0).toUpperCase()+e.status.slice(1)})}),(0,a.jsx)("td",{className:"px-3 sm:px-6 py-4 whitespace-nowrap text-sm text-gray-500",children:e.hosted_invoice_url&&(0,a.jsxs)("a",{href:e.hosted_invoice_url,target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:text-blue-700 flex items-center space-x-1",children:[(0,a.jsx)(f.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"View Invoice"}),(0,a.jsx)("span",{className:"sm:hidden",children:"View"})]})})]},e.id))})]})})}):(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-gray-200 p-6 text-center",children:[(0,a.jsx)(f.Z,{className:"w-12 h-12 text-gray-400 mx-auto mb-4"}),(0,a.jsx)("p",{className:"text-gray-600",children:"No billing history available."})]})]})]})]})]})]})})}}},function(e){e.O(0,[4836,2888,9774,179],function(){return e(e.s=87789)}),_N_E=e.O()}]);

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.