1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1860],{84052:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/account/subscription",function(){return t(61629)}])},47005:function(e,n,t){"use strict";t.d(n,{Z:function(){return AccountLayout}});var i=t(85893),a=t(16373),l=t(1541),s=t(6154),r=t(12386),o=t(53740),c=t(41664),d=t.n(c),u=t(11163),p=t(57175),h=t.n(p);let{Text:x}=o.default;function AccountSidebar(){let e=(0,u.useRouter)();return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:h().sidebar,children:[(0,i.jsx)(s.Z,{vertical:!0,gap:16,style:{padding:"12px"},children:(0,i.jsx)(x,{children:"Account settings"})}),(0,i.jsx)(r.default,{mode:"inline",selectedKeys:[e.pathname],items:[{text:"Profile Settings",href:"/account/settings"},{text:"Subscriptions",href:"/account/subscription"}].map((e,n)=>({key:e.href,label:(0,i.jsx)(d(),{href:e.href,children:e.text}),icon:e.icon})),style:{border:"none",background:"transparent",padding:0}})]})})}var f=t(87014),g=t(93294),m=t.n(g);let{Header:y,Content:j,Sider:_}=a.default;function AccountLayout(e){let{children:n,...t}=e,{token:{colorBgContainer:s}}=l.default.useToken(),{type:r}=t,o=t.page;return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.default,{style:{minHeight:"100vh"},children:[(0,i.jsx)(y,{style:{background:s,paddingInline:"0px",height:"50px",position:"sticky",top:"0",zIndex:"1000",width:"100%"},children:(0,i.jsx)(f.Z,{})}),(0,i.jsxs)(a.default,{className:m().main,children:[(0,i.jsx)(_,{theme:"light",style:{background:"#fafbff",borderInline:"1px solid #e8e8e8"},children:(0,i.jsx)(AccountSidebar,{page:o})}),(0,i.jsx)(j,{className:m().container,children:n})]})]})})}},87014:function(e,n,t){"use strict";t.d(n,{Z:function(){return main_header}});var i=t(85893),a=t(89607),l=t(65400),s=t.n(l),r=t(6154),o=t(53740),c=t(25675),d=t.n(c),u=t(41664),p=t.n(u),h=t(11163),x=t(16447),f={src:"/_next/static/media/logo.f0e1e49d.svg",height:19,width:98,blurWidth:0,blurHeight:0},g=t(39272),m=t(82627),y=t(35741),j=t(84960),_=t(84996),b=t(82891),v=t(33299),w=t(80130),S=t.n(w);let{Text:C}=o.default;var user_block=function(){var e,n,t,a;let{user:l,error:s,isLoading:o}=(0,x.x)(),handleLogout=()=>{(0,v.signOut)({callbackUrl:"/"})};if(o)return(0,i.jsx)("div",{children:"Loading..."});if(!l&&!s)return(0,i.jsx)(j.Z,{size:30,style:{cursor:"pointer",fontSize:15,background:"#ff4d4f"},children:(0,i.jsx)(m.default,{})});let c=[{label:(0,i.jsx)(p(),{href:"/account/settings",children:l.email}),key:"email",icon:(0,i.jsx)(j.Z,{size:"small",children:(null===(e=l.name)||void 0===e?void 0:e.length)>0?l.name[0]:(null===(n=l.email)||void 0===n?void 0:n.length)>0?l.email[0]:"U"})},{type:"divider"},{label:(0,i.jsx)(p(),{href:"/account/settings",children:"Settings"}),key:"settings",icon:(0,i.jsx)(y.default,{})},{label:(0,i.jsx)(p(),{href:"/account/subscription",children:"Subscription"}),key:"subscription",icon:(0,i.jsx)(g.default,{})},{type:"divider"},{label:"Logout",key:"logout",icon:(0,i.jsx)("i",{className:"fi fi-rr-sign-out-alt",style:{fontSize:12}}),onClick:()=>{handleLogout()}}];return(0,i.jsx)(b.default,{arrow:!0,menu:{items:c},children:(0,i.jsxs)("div",{className:S().userContainer,children:[(0,i.jsx)("div",{className:S().info,children:(0,i.jsxs)(r.Z,{vertical:!0,gap:4,align:"flex-end",children:[(0,i.jsx)(C,{type:"secondary",style:{fontSize:14,lineHeight:1},children:l.name}),(0,i.jsx)(C,{type:"secondary",style:{fontSize:10,lineHeight:1},children:l.email})]})}),(0,i.jsx)(_.Z,{count:l.isPremium?(0,i.jsx)("i",{className:"fi fi-sr-star",style:{fontSize:10,color:"#fff"}}):0,offset:[-4,4],children:(0,i.jsx)(j.Z,{src:l.avatar,alt:l.name,size:30,style:{cursor:"pointer",fontSize:15},children:(null==l?void 0:null===(t=l.name)||void 0===t?void 0:t.length)>0?l.name[0]:(null==l?void 0:null===(a=l.email)||void 0===a?void 0:a.length)>0?l.email[0]:"U"})})]})})},k=t(65817),Z=t.n(k);let{Title:P}=o.default;var main_header=function(e){let{user:n}=(0,x.x)(),{type:t}=e,l=(0,h.useRouter)();return(0,i.jsxs)("div",{className:Z().main,children:[(0,i.jsxs)(r.Z,{align:"center",gap:16,children:[e.onMenuClick&&(0,i.jsx)(s(),{className:Z().menuButton,type:"text",onClick:e.onMenuClick,icon:(0,i.jsx)(a.default,{}),"aria-label":"Open navigation menu"}),("templates"===t||"elements"===t)&&(0,i.jsx)(s(),{type:"text",size:"small",onClick:function(){l.push("/dashboard")},icon:(0,i.jsx)("i",{className:"fi fi-rr-angle-left"})}),(0,i.jsx)(p(),{href:"/dashboard",children:(0,i.jsx)(d(),{src:f,alt:"logo",width:80})}),(0,i.jsx)(P,{level:4,className:Z().pageTitle,style:{margin:0},children:t?t.toUpperCase():null})]}),n&&(0,i.jsx)(user_block,{}),!n&&(0,i.jsxs)("div",{className:Z().guest,children:[(0,i.jsx)("div",{className:Z().login,children:"Login"}),(0,i.jsx)("div",{className:Z().signup,children:"Signup"})]})]})}},26028:function(e,n,t){"use strict";t.d(n,{Z:function(){return AppPlanCard}});var i=t(85893),a=t(65400),l=t.n(a),s=t(70302),r=t(74253),o=t(6154),c=t(10149),d=t(59361),u=t(53740),p=t(41664),h=t.n(p),x=t(5068),f=t(16447),g=t(11187),m=t(56697),y=t(89552),j=t(87066),_=t(67294),utils_CancelModalForm=e=>{let n=e.subscription,t=(null==n?void 0:n.status)==="trialing",a=(null==n?void 0:n.trialEndsAt)||(null==n?void 0:n.nextBillDate),[s,r]=(0,_.useState)(!1),[o,c]=(0,_.useState)(!1),{user:d}=(0,f.x)(),[u,p]=g.ZP.useMessage(),h=t?"Cancel Trial":"Cancel Subscription",x=a?new Date(a).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):null,b=t?"Trial canceled â you won't be charged. You'll be redirected to a short survey.":"Subscription canceled, you will be redirected to the survey shortly",handleClose=()=>r(!1),handleCancel=async()=>{c(!0);let e=await fetch("/api/subscription/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription_id:n._id})});e.ok?(c(!1),r(!1),j.Z.post("https://n8n.premast.com/webhook/3f3a7104-70c2-4558-afe9-523744f8d9c1",{subscription_id:n._id,email:d.email,name:d.name,action:t?"cancel_trial":"cancel",subscription:n}),u.success(b),setTimeout(()=>{window.open("https://tally.so/r/mZZdje","_blank")},1e3)):(u.error("Failed to cancel your subscription, please contact us"),c(!1))};return(0,i.jsxs)(i.Fragment,{children:[p,(0,i.jsx)(l(),{type:"primary",onClick:()=>r(!0),children:h}),(0,i.jsxs)(m.Z,{title:t?"Cancel Your Free Trial":"Cancel Your Subscription",open:s,onCancel:handleClose,width:500,footer:[(0,i.jsx)(l(),{onClick:handleCancel,disabled:o,variant:"outlined",color:"primary",children:h},"cancel"),(0,i.jsxs)(l(),{type:"primary",onClick:handleClose,children:["Keep ",t?"Trial":"Subscription"]},"back")],children:[(0,i.jsx)("p",{children:t?"Cancel your free trial? You'll keep Pro access".concat(x?" until ".concat(x):""," and won't be charged."):"Are you sure you want to cancel your subscription?"}),o&&(0,i.jsx)("div",{style:{textAlign:"center",marginTop:20},children:(0,i.jsx)(y.default,{size:"large",tip:"Loading...",children:(0,i.jsx)("div",{style:{padding:"28px 0px"}})})})]})]})},b=t(21054),v=t(71655),w=t.n(v);let{Title:S,Text:C}=u.default,k={active:"success",past_due:"warning",trialing:"processing",canceled:"default"};function formatDate(e){return e?new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}):null}function AppPlanCard(e){var n,t,a,u;let{user:p,subscriptions:f}
1=e,g=(null==f?void 0:f.provider)!=="stripe"&&!!(null==f?void 0:f.paddleSubscriptionId),m=(null==f?void 0:f.status)==="trialing",{data:y,isLoading:j}=(0,x.ZP)(g?"/api/paddle/plan_details?subscription_id=".concat(f.paddleSubscriptionId):null),_=null==y?void 0:y.paddleSubscription,v=(null==_?void 0:_.state)==="deleted";if(!p||!f)return null;let Z=g&&(null==_?void 0:_.state)?_.state:f.status,P=v||"canceled"===f.status,z=!P&&!!f.cancelAtPeriodEnd,A=m?f.trialEndsAt||f.nextBillDate:g&&(null==_?void 0:null===(n=_.next_payment)||void 0===n?void 0:n.date)?_.next_payment.date:f.nextBillDate,L=g?null==_?void 0:null===(t=_.last_payment)||void 0===t?void 0:t.date:null,N=!!(f.paddleSubscriptionId||f.stripeSubscriptionId),T=N&&!P&&!z&&!!A,D=g&&(null==_?void 0:_.update_url)&&!v&&!z,I=P?"Your subscription has been canceled. You can still use your plan until ".concat(formatDate(A)||"â"):z?m?"Trial canceled â you won't be charged. Access continues until ".concat(formatDate(A)||"â","."):"Subscription canceled â access continues until ".concat(formatDate(A)||"â","."):m?"Trial ends ".concat(formatDate(A)||"â"," â you'll be charged then unless you cancel."):"Next payment: ".concat(formatDate(A)||"â");return(0,i.jsxs)(s.default,{variant:"outlined",styles:{body:{padding:0}},children:[(0,i.jsxs)(o.Z,{align:"center",gap:12,style:{padding:12},children:[(0,i.jsx)(S,{level:5,className:w().title,style:{margin:0},children:"Current Plan"}),(0,i.jsx)(d.default,{color:k[Z]||"default",children:Z}),D&&(0,i.jsx)(l(),{size:"small",href:_.update_url,target:"_blank",children:"Update Payment"})]}),(0,i.jsx)(r.Z,{style:{margin:0}}),(0,i.jsxs)(o.Z,{gap:12,justify:"space-between",wrap:"wrap",style:{padding:12},children:[(0,i.jsxs)(o.Z,{vertical:!0,gap:16,style:{flex:1,minWidth:300},children:[(0,i.jsx)(S,{level:3,className:w().bigText,children:null===(a=f.subscriptionPlan)||void 0===a?void 0:a.name}),g&&j&&(0,i.jsx)(c.default.Input,{active:!0,size:"small",style:{width:200}}),L&&(0,i.jsxs)("p",{children:["Last payment: ",formatDate(L)]}),(0,i.jsx)(h(),{href:"/upgrade",children:(0,i.jsx)(l(),{type:"primary",style:{marginTop:8,maxWidth:200},children:"Upgrade"})})]}),(0,i.jsx)(r.Z,{type:"vertical",style:{height:"auto"}}),(0,i.jsxs)(o.Z,{vertical:!0,gap:8,style:{flex:1,minWidth:300},children:[(0,i.jsxs)(o.Z,{gap:8,justify:"space-between",children:[(0,i.jsxs)(o.Z,{vertical:!0,gap:8,children:[g&&j?(0,i.jsx)(c.default.Input,{active:!0,size:"small",style:{width:200}}):(0,i.jsx)("p",{children:I}),T&&(0,i.jsx)(utils_CancelModalForm,{subscription:f})]}),!P&&(null===(u=f.subscriptionPlan)||void 0===u?void 0:u.price)!=null&&(0,i.jsx)(C,{style:{fontSize:32,color:"var(--ant-color-primary, #1677ff)"},children:"$"+f.subscriptionPlan.price})]}),(0,i.jsx)(r.Z,{style:{margin:0}}),(0,i.jsx)(o.Z,{gap:8,children:(0,i.jsx)(b.Z,{})})]})]})]})}},32854:function(e,n,t){"use strict";t.d(n,{Z:function(){return AuthProtected}});var i=t(85893),a=t(6154),l=t(53740),s=t(5152),r=t.n(s),o=t(11163),c=t(5068),d=t(62787);let u=r()(()=>Promise.all([t.e(296),t.e(9260)]).then(t.t.bind(t,69260,23)),{loadableGenerated:{webpack:()=>[69260]},ssr:!1}),{Text:p}=l.default;function AuthProtected(e){let{children:n}=e,t=(0,c.ZP)("/api/user/current"),l=(0,o.useRouter)();return t.isLoading?(0,i.jsxs)(a.Z,{vertical:!0,align:"center",justify:"center",gap:32,style:{width:"100%",height:"100vh"},children:[(0,i.jsx)(u,{animationData:d,style:{width:200,height:200}}),(0,i.jsx)(p,{type:"secondary",children:"Loading..."})]}):t.data?(0,i.jsx)(i.Fragment,{children:n}):t.data?void 0:(l.push("/login?redirect=".concat(window.location.pathname+window.location.search)),(0,i.jsxs)(a.Z,{vertical:!0,align:"center",justify:"center",gap:32,style:{width:"100%",height:"100vh"},children:[(0,i.jsx)(u,{animationData:d,style:{width:200,height:200}}),(0,i.jsx)(p,{type:"secondary",children:"Redirecting..."})]}))}},21054:function(e,n,t){"use strict";t.d(n,{Z:function(){return DownloadLimitWidget}});var i=t(85893),a=t(16447),l=t(74806),s=t(74048),r=t(53740);let{Text:o}=r.default;function DownloadLimitWidget(){let{user:e,error:n,isLoading:t}=(0,a.x)(),r=null==e?void 0:e.downloadLimit,c=null==e?void 0:e.downloadUsage,d=c>r?100:Math.round(c/r*100);return t?(0,i.jsx)("div",{children:"loading"}):r>=200?(0,i.jsxs)(s.default,{size:8,direction:"horizontal",wrap:!0,children:[(0,i.jsx)("i",{className:"fi fi-rr-infinity",style:{color:"var(--ant-color-primary, #1677ff)",border:"1px solid",borderColor:"var(--ant-color-primary, #1677ff)",borderRadius:"50%",padding:"2px",fontSize:"20px",display:"inline-flex",alignItems:"center",justifyContent:"center"}}),(0,i.jsx)(o,{type:"secondary",style:{fontSize:14,fontWeight:500},children:"Unlimited downloads"})]}):!r&&n?(0,i.jsx)("div",{children:"error"}):e?(0,i.jsxs)(s.default,{direction:"horizontal",size:16,align:"center",children:[(0,i.jsx)(l.default,{type:"circle",percent:d,size:24,strokeWidth:12,strokeLinecap:"round",status:d>80?"exception":"normal",showInfo:!1}),(0,i.jsxs)(s.default,{direction:"vertical",size:0,children:[(0,i.jsx)(o,{type:"secondary",style:{fontSize:12,fontWeight:400},children:"Download limit"}),(0,i.jsxs)(o,{type:"secondary",style:{fontSize:14,fontWeight:500},children:[c," / ",r," downloads"]})]})]}):(0,i.jsx)("div",{})}},61629:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return SubscriptionPage}});var i=t(85893),a=t(32854),l=t(16447),s=t(6154),r=t(53740),o=t(47005),c=t(26028);let{Title:d}=r.default;function SubscriptionPage(){let{user:e,error:n,isLoading:t}=(0,l.x)(),a=["active","trialing","past_due","paused"],r=null==e?void 0:e.subscriptions.filter(e=>!!a.includes(e.status)&&!!(e.paddleSubscriptionId||e.stripeSubscriptionId))[0],o=null==e?void 0:e.subscriptions.filter(e=>!e.paddleSubscriptionId&&!e.stripeSubscriptionId)[0];return t?(0,i.jsx)("div",{children:"Loading..."}):n?(0,i.jsxs)("div",{children:["Error: ",n]}):(0,i.jsxs)(s.Z,{vertical:!0,gap:32,style:{width:"100%"},children:[(0,i.jsx)(d,{level:4,children:"Subscriptions"}),r&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{user:e,subscriptions:r})},r._id),!r&&(0,i.jsx)("div",{children:(0,i.jsx)(c.Z,{user:e,subscriptions:o})},o._id)]})}SubscriptionPage.getLayout=e=>(0,i.jsx)(a.Z,{children:(0,i.jsx)(o.Z,{user:e.user,page:"subscription",children:e})})},93294:function(e){e.exports={root:"AccountLayout_root__XTQbk",mainContainer:"AccountLayout_mainContainer__w1xnK",content:"AccountLayout_content__9FBbK",main:"AccountLayout_main__KSAPw",container:"AccountLayout_container__81ZEz"}},65817:function(e){e.exports={main:"main-header_main__3F0ss",nav:"main-header_nav__skvNj",guest:"main-header_guest__R_lGs",menuButton:"main-header_menuButton__xhQTm",pageTitle:"main-header_pageTitle__uEPyU"}},57175:function(e){e.exports={sidebar:"sidebar_sidebar__vGDWV",mobile:"sidebar_mobile__TkRQN",nav:"sidebar_nav__lMsse",active:"sidebar_active__WUHi4",widget:"sidebar_widget__EzwTx"}},71655:function(e){e.exports={card:"AppPlanCard_card__L_sdE",head:"AppPlanCard_head__QB0Po",body:"AppPlanCard_body__dmtQY",bigText:"Ap
1pPlanCard_bigText__Ys6Wz",planDetailsContainer:"AppPlanCard_planDetailsContainer__Rm3dt",row:"AppPlanCard_row__PCGLg",col:"AppPlanCard_col__ZgHaW"}},80130:function(e){e.exports={userContainer:"user-block_userContainer__wIpBM",info:"user-block_info__2Zgf9",menu:"user-block_menu__83Sjk"}}},function(e){e.O(0,[9389,5400,5675,5415,1664,6713,3740,4804,2043,2074,7412,7917,4960,149,1350,4996,302,7891,9552,4806,5312,6339,9361,2787,9774,2888,179],function(){return e(e.s=84052)}),_N_E=e.O()}]); 2//# sourceMappingURL=subscription-239c989b26004890.js.map
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.