1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3971],{9964:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/subscription/success",function(){return t(8734)}])},8734:function(e,s,t){"use strict";t.r(s),t.d(s,{__N_SSG:function(){return y}});var r=t(5893),i=t(2209),n=t(9376),a=t(9188),c=t(2027),l=t(3299),d=t(9510),o=t(2962),u=t(1664),m=t.n(u),x=t(7294),p=t(1163),h=t(6484),_=t(9617),b=t(5343),g=t(7066),f=t(1165);let j=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function N(e){let s=new Date(e);if(isNaN(s.getTime()))return e;let t=String(s.getDate()).padStart(2,"0"),r=j[s.getMonth()],i=s.getFullYear();return"".concat(t," ").concat(r," ").concat(i)}var y=!0;s.default=()=>{let{t:e}=(0,d.$G)("common"),{status:s,data:t}=(0,l.useSession)(),u=(0,p.useRouter)(),[j,y]=(0,x.useState)("checking"),[v,w]=(0,x.useState)(null),[S,I]=(0,x.useState)(null),T=(0,x.useRef)(null),E=(0,x.useRef)(null),R=(0,x.useRef)(0);(0,x.useEffect)(()=>{"unauthenticated"===s&&u.push("/login")},[s,u]),(0,x.useEffect)(()=>()=>{T.current&&clearTimeout(T.current),E.current&&clearTimeout(E.current)},[]);let Z=async()=>{if(!(null==t?void 0:t.jwt))return;R.current+=1;let s=R.current;try{var r,i;let n=await g.Z.get("".concat(f.O.NEXT_PUBLIC_STRAPI_BASE_URL).concat(a.Hv.SUBSCRIPTION_MY_SUBSCRIPTION),{params:{locale:null!==(i=u.locale)&&void 0!==i?i:"en"},headers:{Authorization:"Bearer ".concat(t.jwt)}});if(null===(r=n.data.data)||void 0===r?void 0:r.is_access_active){w(n.data.data),y("success"),E.current=setTimeout(()=>{u.push("/my-subscription")},15e3);return}if(s>=10){y("error"),I(e("subscription_setup_taking_longer"));return}T.current=setTimeout(Z,3e3)}catch(t){if(s>=10){y("error"),I((0,c.dr)(t,e("subscription_verify_failed")));return}T.current=setTimeout(Z,3e3)}},C=async s=>{if(null==t?void 0:t.jwt)try{let r=(await g.Z.get("".concat(f.O.NEXT_PUBLIC_STRAPI_BASE_URL).concat(a.Hv.SUBSCRIPTION_VERIFY_SESSION),{params:{session_id:s},headers:{Authorization:"Bearer ".concat(t.jwt)}})).data.data;if("paid"!==r.stripe_payment_status){y("error"),I(e("subscription_payment_not_completed"));return}if(r.webhook_processed&&r.user_subscription){w(r.user_subscription),y("success"),E.current=setTimeout(()=>{u.push("/my-subscription")},15e3);return}y("provisioning"),R.current=0,Z()}catch(s){y("error"),I((0,c.dr)(s,e("subscription_verify_failed")))}};return((0,x.useEffect)(()=>{if(!u.isReady||"authenticated"!==s||!(null==t?void 0:t.jwt))return;let r=u.query.session_id;if(!r){y("error"),I(e("subscription_missing_session"));return}C(r)},[u.isReady,s,null==t?void 0:t.jwt]),"loading"===s||"unauthenticated"===s)?(0,r.jsx)(n.I6,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.PB,{title:e("subscription_verifying")}),(0,r.jsx)("section",{className:"py-10 md:py-16",children:(0,r.jsx)("div",{className:"container-bootstrap",children:(0,r.jsxs)("div",{className:"mx-auto max-w-2xl",children:["checking"===j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.NZ,{heading:1,CustomIcon:h.Z,children:e("subscription_verifying")}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border border-gray-200 bg-white p-8 text-center",children:[(0,r.jsx)("div",{className:"mb-4 flex justify-center",children:(0,r.jsx)("div",{className:"h-12 w-12 animate-spin rounded-full border-b-2 border-brand-red"})}),(0,r.jsx)("p",{className:"text-gray-600",children:e("subscription_verifying_message")})]})]}),"provisioning"===j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.NZ,{heading:1,CustomIcon:h.Z,children:e("subscription_setting_up")}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border border-green-200 bg-white p-8 text-center",children:[(0,r.jsx)("div",{className:"mb-4 flex items-center justify-center",children:(0,r.jsx)(_.Z,{size:64,className:"text-green-500",weight:"fill"})}),(0,r.jsx)("p",{className:"mb-4 text-lg text-gray-700",children:e("subscription_payment_successful")}),(0,r.jsx)("div",{className:"flex justify-center",children:(0,r.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-b-2 border-brand-red"})}),(0,r.jsx)("p",{className:"mt-4 text-sm text-gray-500",children:e("subscription_setting_up_message")})]})]}),"success"===j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.NZ,{heading:1,CustomIcon:_.Z,children:e("subscription_activated")}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border border-green-200 bg-white p-8",children:[(0,r.jsx)("div",{className:"mb-4 flex items-center justify-center",children:(0,r.jsx)(_.Z,{size:64,className:"text-green-500",weight:"fill"})}),(0,r.jsxs)("div",{className:"space-y-4 text-center",children:[(0,r.jsx)("p",{className:"text-lg text-gray-700",children:e("subscription_activated_message")}),v&&(0,r.jsxs)("div",{className:"mt-6 space-y-2 rounded-lg bg-gray-50 p-4 text-left",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"font-semibold text-gray-700",children:[e("subscription_plans"),":"]}),(0,r.jsx)("span",{className:"text-gray-900",children:v.plan.name})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"font-semibold text-gray-700",children:[e("subscription_period_start"),":"]}),(0,r.jsx)("span",{className:"text-gray-900",children:N(v.current_period_start)})]}),(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"font-semibold text-gray-700",children:[e("subscription_period_end"),":"]}),(0,r.jsx)("span",{className:"text-gray-900",children:N(v.current_period_end)})]}),v.trial_end&&(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsxs)("span",{className:"font-semibold text-gray-700",children:[e("subscription_trial_ends_on"),":"]}),(0,r.jsx)("span",{className:"text-gray-900",children:N(v.trial_end)})]})]}),(0,r.jsx)("div",{className:"mt-6",children:(0,r.jsx)(m(),{href:"/my-subscription",className:"inline-block rounded-md bg-brand-red px-6 py-3 font-semibold text-white transition-colors hover:bg-red-700",children:e("subscription_go_to_dashboard")})}),(0,r.jsx)("p",{className:"mt-4 text-sm text-gray-500",children:e("subscription_redirecting_note")})]})]})]}),"error"===j&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.NZ,{heading:1,CustomIcon:b.Z,children:e("error")}),(0,r.jsxs)("div",{className:"mt-8 rounded-lg border border-red-200 bg-white p-8",children:[(0,r.jsx)("div",{className:"mb-4 flex items-center justify-center",children:(0,r.jsx)(b.Z,{size:64,className:"text-red-500",weight:"fill"})}),(0,r.jsxs)("div",{className:"space-y-4 text-center",children:[(0,r.jsx)("p",{className:"text-lg text-gray-700",children:S||e("subscription_verify_failed")}),(0,r.jsxs)("div",{className:"mt-6 flex justify-center gap-4",children:[(0,r.jsx)(m(),{href:"/subscription",className:"rounded-md bg-brand-red px-6 py-3 font-semibold text-white transition-colors hover:bg-red-700",children:e("subscription_return_to_plans")}),(0,r.jsx)("button",{onClick:()=>{let e=u.query.session_id;e&&(I(null),y("checking"),C(e))},className:"rounded-md border-2 border-brand-red px-6 py-3 font-semibold text-brand-red transition-colors hover:bg-red-50",children:e("try_again")})]})]})]})]})]})})})]})}}},function(e){e.O(0,[2888,9774,179],function(){return e(e.s=9964)}),_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.