1"use strict";(self.webpackChunksimplified_web=self.webpackChunksimplified_web||[]).push([[5399,5868],{755399:(e,o,l)=>{l.r(o),l.d(o,{default:()=>M});var n=l(104399),i=l(764293),t=l(379274),r=l(587383),d=l(692877),a=l(351839),s=l(553218),c=l(828865),u=l(741065),v=l(349798),p=l(903337),m=l(408499),_=l(282542),x=l(691275),h=l(129944),g=l(313773),f=l(774181),C=l(116118),b=l(688158),S=l(228993);const j=e=>{let{onClose:o,selectedProduct:l}=e;const{colorMode:t}=(0,x.If)(),{i18n:r}=(0,m.$)(["billing","common"]),d=(0,i.v9)(e=>{var o;return null===(o=e.apps.common)||void 0===o?void 0:o.currentPlanId}),a=(0,i.v9)(e=>{var o;return null===(o=e.apps.common)||void 0===o?void 0:o.currentPlanStatus}),s=(0,b.Z)(),{handlePlanSelected:c,showModal:u,modalProps:v}=(0,C.Z)({onSuccess:o});return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(h.M,{w:"full",children:(0,S.jsx)(f.Z,{language:(null===r||void 0===r?void 0:r.language)||"en",pageType:"private",theme:t,currentPlanId:null!==d&&void 0!==d?d:void 0,accessToken:(0,n.getAuthToken)(),appUrl:window.location.origin,apiUrl:g.uyl,isFreePlan:!d,subscriptionStatus:null!==a&&void 0!==a?a:void 0,trialEligible:(0,n.canStartTrial)(s),onTrialPlanSwitch:c})}),u&&(0,S.jsx)(p.L8,{...v})]})};var y=l(683017),T=l(747676),I=l(514077),O=l(501271),E=l(273037),A=l(778625),P=l(774770),w=l(655868),k=l(778145),R=l(659840);const L=()=>{var e,o;const l=new AbortController,{t:x}=(0,m.$)(["common","tools","billing","addons","accounts"]),h=(0,t.TH)(),[f,C]=(0,r.k)(),b=(0,i.I0)(),L=(0,R.k6)(),N=(0,n.useQuery)(),D=(0,t.UO)(),[U]=(0,n.useLocalStorage)(n.LAST_SELECTED_SECTION_KEY),M=(0,i.v9)(e=>{var o,l,n,i;return null===(o=e.auth.payload)||void 0===o||null===(l=o.user)||void 0===l||null===(n=l.context)||void 0===n||null===(i=n.ui_state)||void 0===i?void 0:i.selected_product})||U,B=(null===D||void 0===D?void 0:D.env)||M,z=(0,d.S)({base:!0,md:!1}),F=(0,i.v9)(e=>e.auth),$=(0,i.v9)(e=>e.mobileApp),K=(0,i.v9)(e=>e.apps.common.currentPlanSource),W=(0,y.useMemo)(()=>(0,n.isMobileApp)(),[]),Y=K===n.PaymentSources.STRIPE,{addon:G,trial:H,plans:Z}=(0,i.v9)(e=>e.pricingStore),V=(0,i.v9)(e=>e.apps[null===G||void 0===G?void 0:G.product]||e.apps[n.PRODUCTS.ALL]),J=(0,i.v9)(e=>e.apps[null===H||void 0===H?void 0:H.product]||e.apps[n.PRODUCTS.ALL]),X=(0,i.v9)(e=>e.apps.common.currentPlanBillingUnitId),{canChangeSubscription:q}=(0,i.v9)(e=>e.permissions.workspacePermissionChecks),Q=(0,i.v9)(e=>{var o;return null===(o=e.apps.common)||void 0===o?void 0:o.features}),ee=(0,y.useMemo)(()=>{var e;return(null===h||void 0===h||null===(e=h.state)||void 0===e?void 0:e.addonCategory)||N.get("addonCategory")},[null===h||void 0===h||null===(e=h.state)||void 0===e?void 0:e.addonCategory,N]),oe=(0,y.useMemo)(()=>{var e;return(null===h||void 0===h||null===(e=h.state)||void 0===e?void 0:e.from)===n.TIKTOK_APP_STORE_APP_AUTH},[null===h||void 0===h||null===(o=h.state)||void 0===o?void 0:o.from]),le=()=>{if(ee){const{state:e}=h,{addonCategory:o,...l}=e||{};N.delete("addonCategory"),L.replace({pathname:h.pathname,search:N.toString(),state:l})}b((0,_.zv)()),b((0,_._f)())},ne=()=>{b((0,_.LO)()),b((0,_._f)())},ie=async()=>{(0,n.analyticsTrackEvent)("startSubscriptionButtonClicked",{product:(null===H||void 0===H?void 0:H.product)||(null===G||void 0===G?void 0:G.product)}),C.on();try{var e,o,i,t,r,d,a,s,c,u,v,p,m,_,h,f;const C=await(0,g.weM)((null===H||void 0===H||null===(e=H.subscription)||void 0===e||null===(o=e.subscriptions)||void 0===o||null===(i=o[0])||void 0===i?void 0:i.id)||(null===J||void 0===J?void 0:J.id)||(null===V||void 0===V?void 0:V.id)),S=null===C||void 0===C?void 0:C.data,j=(null===S||void 0===S||null===(t=S.extra)||void 0===t||null===(r=t.current_plan)||void 0===r?void 0:r.tldr_plan_id)||(null===S||void 0===S||null===(d=S.plan)||void 0===d?void 0:d.id),y=Number((null===S||void 0===S||null===(a=S.extra)||void 0===a||null===(s=a.current_plan)||void 0===s?void 0:s.price)||(null===S||void 0===S||null===(c=S.plan)||void 0===c?void 0:c.amount)),O=await(0,g.TMX)(null===S||void 0===S?void 0:S.id,l.signal);(0,n.analyticsTrackEvent)("upgrade.checkoutComplete",{plan:j,price:y,unit:null===S||void 0===S||null===(u=S.extra)||void 0===u||null===(v=u.current_plan)||void 0===v||null===(p=v.currency)||void 0===p?void 0:p.toUpperCase(),product:null===S||void 0===S||null===(m=S.t_plan)||void 0===m?void 0:m.product_env}),await(0,n.delay)(2e3),await b((0,T.k)(null===F||void 0===F||null===(_=F.payload)||void 0===_||null===(h=_.user)||void 0===h?void 0:h.pk)),(0,I.CFj)({status:"success",description:(null===O||void 0===O||null===(f=O.data)||void 0===f?void 0:f.message)||x("subscription_updated",{ns:"billing"}),title:x("braintree_modal.success.title")}),G.show||window.location.reload()}catch(S){(0,n.analyticsTrackEvent)("endTrialFailed"),b((0,O.iM)(S,{history:L}))}finally{C.off()}},te=()=>{var e,o;b((0,T.k)(null===F||void 0===F||null===(e=F.payload)||void 0===e||null===(o=e.user)||void 0===o?void 0:o.pk))},re=()=>{b((0,_.zv)())},de=()=>{(0,n.openIntercom)()};if((0,y.useEffect)(()=>{ee&&B&&b((0,_.HJ)({addonCategory:ee,product:B,addonType:n.ONE_TIME_ADDON,hideToggleSwitch:!0}))},[ee]),(0,y.useEffect)(()=>
1{if(Z.show&&W&&!Y)return re(),(0,n.sendEventToMobileApp)(n.NativeOutgoingEvents.SHOW_PAYWALL,{product:B})},[W,Y,Z.show]),(0,y.useEffect)(()=>{if(Z.show&&W&&Y)return ne(),re(),void(0,I.j9B)({description:x("webview_message",{ns:"billing"}),status:"info"})},[Z.show,W,Y]),"billing"===N.get("show"))return(0,S.jsx)(w.default,{});if(H.show)return(0,S.jsx)(p.wv,{onConfirm:ie,onClose:ne,isLoading:f,billingUnitId:X});if(Z.show){if(W&&!Y)return null;if(W&&Y)return null;const e=(0,S.jsxs)(a.k,{align:"center",justify:"space-between",gap:2,children:[(0,S.jsx)(s.U,{align:"center",children:(0,S.jsx)(c.h,{"aria-label":"Go back",onClick:re,variant:"ghost",icon:(0,S.jsx)(k.FaArrowLeft,{})})}),(0,S.jsx)(s.U,{align:"center",w:"max-content",mr:12,children:!z&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(u.x,{flex:1,fontSize:["xs","xs","xs","sm"],fontWeight:"normal",children:x("have_billing_questions",{ns:"billing"})}),(0,S.jsx)(a.k,{children:(0,S.jsx)(v.z,{flex:1,size:"sm",onClick:de,children:x("chat_with_us",{ns:"common"})})})]})})]});return(0,S.jsxs)(E.Z,{onClose:re,modalFooter:W?(0,S.jsx)(P.Z,{}):null,modalHeader:e,children:[(0,S.jsx)(A.Z,{t:x}),(0,S.jsx)(j,{onClose:re,selectedProduct:null===Z||void 0===Z?void 0:Z.product})]})}if(G.show){var ae;let e="";const o=null===n.ADDON_PRODUCTS||void 0===n.ADDON_PRODUCTS||null===(ae=n.ADDON_PRODUCTS[null===G||void 0===G?void 0:G.addonCategory])||void 0===ae?void 0:ae.modal;let l=x(null===o||void 0===o?void 0:o.subtitle,{ns:null===o||void 0===o?void 0:o.ns});const i=null===n.AddonFeatureCodes||void 0===n.AddonFeatureCodes?void 0:n.AddonFeatureCodes[null===G||void 0===G?void 0:G.addonCategory],t=null===Q||void 0===Q?void 0:Q.find(e=>e.feature_code===i);return e=(null===t||void 0===t?void 0:t.current_usage)>=(null===t||void 0===t?void 0:t.usage_limit)&&null!==o&&void 0!==o&&o.alt_title?x(null===o||void 0===o?void 0:o.alt_title,{ns:null===o||void 0===o?void 0:o.ns}):x(null===o||void 0===o?void 0:o.title,{ns:null===o||void 0===o?void 0:o.ns}),G.addonType===n.SUBSCRIPTION_BASED_ADDON&&(null===V||void 0===V?void 0:V.status)===n.BILLING_SUBSCRIBED_PLAN_STATUS_TRIAL?(0,S.jsx)(p.wv,{onConfirm:ie,onClose:ne,isLoading:f,billingUnitId:X,continueToAddon:!0}):G.addonType===n.SUBSCRIPTION_BASED_ADDON&&W?(b((0,_._f)()),null):(0,S.jsx)(p.f_,{title:e,subtitle:l,t:x,onClose:le,category:null===G||void 0===G?void 0:G.addonCategory,type:null===G||void 0===G?void 0:G.addonType,hideAddonTypeSelection:(null===G||void 0===G?void 0:G.hideToggleSwitch)||!1,refreshData:te,product:null===G||void 0===G?void 0:G.product,selectedAppSubscription:V,mobileApp:$,canChangeSubscription:q,renderPlans:(0,S.jsx)(j,{onClose:le,selectedProduct:null===G||void 0===G?void 0:G.product}),setShowPlans:e=>{if(W&&!Y)return(0,n.sendEventToMobileApp)(n.NativeOutgoingEvents.SHOW_PAYWALL,{product:B});b((0,_.$$)(e))},onGoToPath:e=>{var o;return L.push({pathname:e,state:{from:null===h||void 0===h||null===(o=h.state)||void 0===o?void 0:o.from}})},isComingFromTiktokAppCenter:oe})}return null};var N=l(493568),D=l(963166);const U=()=>{const{t:e}=(0,m.$)(["billing","common","accounts"]),o=(0,i.I0)(),[l]=(0,n.useLocalStorage)(n.LAST_SELECTED_SECTION_KEY),t=(0,i.v9)(e=>{var o,l,n,i;return null===(o=e.auth.payload)||void 0===o||null===(l=o.user)||void 0===l||null===(n=l.context)||void 0===n||null===(i=n.ui_state)||void 0===i?void 0:i.selected_product})||l,r=(0,i.v9)(e=>e.apps[t]||e.apps[n.PRODUCTS.ALL]),{showStorageUpgradeModal:d}=(0,i.v9)(e=>e.storageStore),a=!(null!==r&&void 0!==r&&r.is_free_plan),s=(0,y.useCallback)(()=>{o((0,_.HJ)({addonType:n.SUBSCRIPTION_BASED_ADDON,addonCategory:n.AddonCategories.WORKSPACE_STORAGE,product:t,hideToggleSwitch:!0}))},[o,t]),c=()=>{o((0,N.nL)(!1))};return(0,y.useEffect)(()=>{if(d&&a)return s(),void c()},[s,a,d]),d?a?null:(0,S.jsx)(I.XLS,{t:e,image:n.FILE_STORAGE_IMAGE_URL,imageTextPrimary:e("modal.file",{ns:"common"}),imageTextSecondary:e("modal.storage",{ns:"common"}),title:e("file_storage_modal.title",{ns:"billing"}),subtitle:e("file_storage_modal.subtitle",{ns:"billing"}),featureList:null===n.fileStorageFeatures||void 0===n.fileStorageFeatures?void 0:n.fileStorageFeatures.map(o=>({...o,title:e(o.title,{ns:o.translation}),info:e(o.info,{ns:o.translation})})),onHide:c,onViewPlansHandler:()=>{(0,D.XA)(o,t),c()}}):null},M=()=>{const{isAuthenticated:e}=(0,i.v9)(e=>e.auth),o=(0,t.TH)(),l=[n.DYNAMIC_RENDER_PREVIEW].some(e=>(0,R.LX)(o.pathname,{path:e,exact:!0}));return e&&!l?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(U,{}),(0,S.jsx)(L,{})]}):null}},273037:(e,o,l)=>{l.d(o,{Z:()=>u});var n=l(524943),i=l(807523),t=l(53004),r=l(177612),d=l(921902),a=l(677360),s=l(357023),c=l(228993);const u=e=>{let{onClose:o,modalHeader:l,modalFooter:u,children:v}=e;return(0,c.jsxs)(n.u_,{isCentered:!0,isOpen:!0,onClose:o,size:"full",scrollBehavior:"inside",closeOnOverlayClick:!1,closeOnEsc:!1,autoFocus:!1,children:[(0,c.jsx)(i.Z,{}),(0,c.jsxs)(t.h,{height:"full",backgroundColor:"base_level_1",overflowX:"hidden",children:[l&&(0,c.jsx)(r.x,{children:l}),(0,c.jsx)(d.o,{mt:2,size:"md"}),(0,c.jsx)(a.f,{pt:0,overflowX:"hidden",children:v}),u&&(0,c.jsx)(s.m,{justifyContent:"center",children:u})]})]})}}
1,778625:(e,o,l)=>{l.d(o,{Z:()=>u});var n=l(129944),i=l(351839),t=l(298249),r=l(741065),d=l(104399),a=l(295903),s=(l(683017),l(228993));const c=()=>(0,s.jsxs)(n.M,{flexDirection:"column",children:[(0,s.jsx)(i.k,{p:2,align:"center",justify:"center",mb:4,children:(0,s.jsx)(a.O,{h:"48px",w:"48px",borderRadius:"lg"})}),(0,s.jsx)(a.O,{h:"36px",w:"full",maxW:"175px",mb:2}),(0,s.jsx)(a.O,{h:"24px",w:"full",maxW:"450px",mb:6})]}),u=e=>{let{t:o,isLoading:l=!1,isCheckoutPage:a}=e;const u=d.PRODUCTS.SUITE;return a?null:l?(0,s.jsx)(c,{}):(()=>{var e,l,a;return(0,s.jsxs)(n.M,{flexDirection:"column",children:[(0,s.jsx)(i.k,{p:2,align:"center",justify:"center",borderRadius:"lg",mb:2,children:(0,s.jsx)(t.J,{as:null===d.SUBSCRIPTION_PRODUCT_ICONS||void 0===d.SUBSCRIPTION_PRODUCT_ICONS||null===(e=d.SUBSCRIPTION_PRODUCT_ICONS[u])||void 0===e?void 0:e.icon,color:"content_active",fontSize:56})}),(0,s.jsx)(r.x,{fontSize:["lg","lg","lg","xl"],color:"content_active",fontWeight:"medium",mb:1,children:o(null===(l=d.SUBSCRIPTION_PRODUCTS[u])||void 0===l?void 0:l.name,{ns:"common"})}),(0,s.jsx)(r.x,{fontSize:"sm",color:"content_details",textAlign:"center",mb:6,children:o(null===d.SUBSCRIPTION_PRODUCTS||void 0===d.SUBSCRIPTION_PRODUCTS||null===(a=d.SUBSCRIPTION_PRODUCTS[u])||void 0===a?void 0:a.subtitle,{ns:"common"})||o("payment_workflow_common_subtitle")})]})})()}},774770:(e,o,l)=>{l.d(o,{Z:()=>s});var n=l(351839),i=l(741065),t=l(957711),r=l(408499),d=l(104399),a=l(228993);const s=()=>{const{t:e}=(0,r.$)(["auth","common"]);return(0,a.jsxs)(n.k,{direction:"column",justify:"center",align:"center",color:"content_details",fontSize:"xs",gap:1,children:[(0,a.jsx)(i.x,{children:e("auto_renew",{ns:"common"})}),(0,a.jsxs)(n.k,{gap:1,textAlign:"center",children:[(0,a.jsx)(t.r,{color:"content_details",onClick:()=>(0,d.openUrl)(d.SIMPLIFIED_TERMS_OF_SERVICE_LINK,"_blank"),textDecor:"underline",children:e("register.tnc",{ns:"auth"})})," ","|",(0,a.jsx)(t.r,{color:"content_details",onClick:()=>(0,d.openUrl)(d.SIMPLIFIED_PRIVACY_POLICY_LINK,"_blank"),textDecor:"underline",children:e("privacy_policy",{ns:"common"})})]})]})}},655868:(e,o,l)=>{l.r(o),l.d(o,{default:()=>me});var n=l(683017),i=l(764293),t=l(791048),r=l(408499),d=l(692877),a=l(587383),s=l(298249),c=l(351839),u=l(828865),v=l(741065),p=l(904728),m=l(250090),_=l(553218),x=l(349798),h=l(129944),g=l(379274),f=l(817745),C=l(104399),b=l(313773),S=l(747676),j=l(501271),y=l(270858),T=l(295903),I=l(902352),O=l(228993);function E(){return(0,O.jsx)(y.x,{p:[0,0,0,4],mb:8,w:"full",maxW:"1200px",children:(0,O.jsxs)(p.r,{templateColumns:{base:"1fr",lg:"minmax(0, 1fr) 400px"},templateAreas:{base:'"plan" "summary" "addons"',lg:'"plan summary" "addons summary"'},alignItems:"start",gap:4,children:[(0,O.jsx)(m.P,{area:"plan",w:"full",children:(0,O.jsxs)(y.x,{p:4,borderRadius:"lg",border:"1px solid",borderColor:"content_alpha_100",children:[(0,O.jsxs)(c.k,{align:"center",gap:2,mb:2,children:[(0,O.jsx)(T.O,{borderRadius:"full",boxSize:12,flexShrink:0}),(0,O.jsxs)(y.x,{flex:1,children:[(0,O.jsx)(T.O,{h:5,w:"40%",mb:2}),(0,O.jsx)(T.O,{h:4,w:"65%"})]})]}),(0,O.jsx)(T.O,{h:4,w:"55%",mb:4}),(0,O.jsx)(T.O,{h:"34px",w:"45%",mb:2}),(0,O.jsx)(T.O,{h:4,w:"60%",mb:6}),(0,O.jsxs)(y.x,{display:{base:"none",lg:"block"},children:[(0,O.jsx)(T.O,{h:4,w:"30%",mb:3}),Array.from({length:6}).map((e,o)=>(0,O.jsx)(T.O,{h:4,w:68-5*o+"%",mb:3},o))]})]})}),(0,O.jsx)(m.P,{area:"addons",w:"full",children:(0,O.jsxs)(y.x,{mt:[6,6,6,2],mb:8,children:[(0,O.jsx)(T.O,{h:5,w:40,mb:3}),(0,O.jsx)(c.k,{direction:"column",gap:"2.5",children:Array.from({length:4}).map((e,o)=>(0,O.jsx)(T.O,{height:"65px",borderRadius:"lg"},o))})]})}),(0,O.jsxs)(m.P,{area:"summary",w:"full",position:{base:"static",lg:"sticky"},top:4,p:4,bg:"base_level_3",borderRadius:"lg",border:"2px solid",borderColor:"content_alpha_100",children:[(0,O.jsx)(T.O,{h:5,w:"60%",mb:2}),(0,O.jsx)(T.O,{h:4,w:"35%",mb:4}),(0,O.jsx)(I.i,{mb:4}),(0,O.jsx)(T.O,{h:4,w:"30%",mb:2}),(0,O.jsx)(T.O,{h:"44px",w:"50%",mb:2}),(0,O.jsx)(T.O,{h:3,w:"70%",mb:4}),(0,O.jsx)(T.O,{height:"62px",borderRadius:"md",mb:4}),(0,O.jsxs)(c.k,{justify:"space-between",mb:4,children:[(0,O.jsx)(T.O,{h:4,w:"30%"}),(0,O.jsx)(T.O,{h:4,w:"22%"})]}),(0,O.jsx)(I.i,{mb:4}),(0,O.jsx)(T.O,{h:4,w:"40%",mb:4}),(0,O.jsx)(T.O,{height:"44px",borderRadius:"md",mb:3}),(0,O.jsx)(T.O,{h:3,w:"90%"})]})]})})}var A=l(125138),P=l(107337),w=l(691275),k=l(903337),R=l(919941),L=l(720637),N=l(532003),D=l(223700),U=l(314134),M=l(906193),B=l(759823),z=l(489430),F=l(514077),$=l(778145),K=l(883979),W=l(659840);const Y=function(e){var o,l,t,r,d,u,p,m,_,x,h;let{addon:f,cartItems:S,updateCart:T}=e;
1const[I,E]=(0,n.useState)(0),[A,P]=(0,a.k)(),w=(0,g.TH)(),k=(0,W.k6)(),R=(0,i.I0)(),Y=new URLSearchParams((0,g.TH)().search),G=(0,n.useRef)(!1),H=Y.get("addon_seats"),Z=Y.get("addon_accounts"),V=Y.get("addon_ai_credits"),J=Y.get("addon_category"),X=Y.get("addon_clips"),q=Y.get("addon_subtitles"),Q=Y.get("addon_brandbooks"),ee=(0,K.Z)(),oe=((0,i.v9)(e=>e.apps[ee]||e.apps[C.PRODUCTS.ALL]),(0,n.useCallback)(e=>{if(!e)return 0;let o=Number(e);return o>C.ADDON_MAX_LIMIT?C.ADDON_MAX_LIMIT:o},[])),le=(0,n.useMemo)(()=>H?oe(H):0,[H]),ne=(0,n.useMemo)(()=>Z?oe(Z):0,[Z]),ie=(0,n.useMemo)(()=>V?oe(V):0,[V]),te=(0,n.useMemo)(()=>X?oe(X):0,[X]),re=(0,n.useMemo)(()=>q?oe(q):0,[q]),de=(0,n.useMemo)(()=>Q?oe(Q):0,[Q]),ae=(0,n.useMemo)(()=>{switch(null===f||void 0===f?void 0:f.category){case C.AddonCategories.PREPAID_SEATS:return"addon_seats";case C.AddonCategories.SOCIAL_MEDIA:return"addon_accounts";case C.AddonCategories.AI_WRITER:return"addon_ai_credits";case C.AddonCategories.VIDEO_CLIP:return"addon_clips";case C.AddonCategories.VIDEO_SUBTITLE:return"addon_subtitles";case C.AddonCategories.BRANDBOOK:return"addon_brandbooks";default:return null}},[null===f||void 0===f?void 0:f.category]);function se(e){if(E(e),0===Number(e))return ae&&(Y.delete(ae),k.replace({pathname:w.pathname,search:Y.toString()})),void ue(f);ae&&(Y.set(ae,String(e)),k.replace({pathname:w.pathname,search:Y.toString()})),ce(f,e)}(0,n.useEffect)(()=>{var e,o;(null===f||void 0===f?void 0:f.category)===C.AddonCategories.PREPAID_SEATS&&le>0?se(le):(null===f||void 0===f?void 0:f.category)===C.AddonCategories.SOCIAL_MEDIA&&ne>0?se(ne):(null===f||void 0===f?void 0:f.category)===C.AddonCategories.AI_WRITER&&ie>0?se(ie):(null===f||void 0===f||null===(e=f.extra)||void 0===e||null===(o=e.cms)||void 0===o?void 0:o.control_type)===C.ADDON_CONTROL_TYPES.SWITCH&&J&&J.split(",").includes(null===f||void 0===f?void 0:f.category)?ce(f):(null===f||void 0===f?void 0:f.category)===C.AddonCategories.VIDEO_CLIP&&te>0?se(te):(null===f||void 0===f?void 0:f.category)===C.AddonCategories.VIDEO_SUBTITLE&&re>0?se(re):(null===f||void 0===f?void 0:f.category)===C.AddonCategories.BRANDBOOK&&de>0&&se(de)},[null===f||void 0===f?void 0:f.category,le,ne,ie,te,re,de]);const ce=function(e){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;G.current||(G.current=!0,P.on(),(0,b.XDq)({product_code:null===e||void 0===e?void 0:e.code,quantity:["Social Inbox","Analytics Pack",C.AddonCategories.CLIENT_REVIEW,C.AddonCategories.BULK_IMPORT,C.AddonCategories.SOCIAL_INBOX].includes(null===e||void 0===e?void 0:e.category)?1:o}).then(e=>T(e.data)).catch(e=>R((0,j.iM)(e))).finally(()=>{G.current=!1,P.off()}))},ue=e=>{P.on(),(0,b.DQI)({product_code:null===e||void 0===e?void 0:e.code}).then(e=>T(e.data)).catch(e=>R((0,j.iM)(e))).finally(()=>P.off())},ve=(0,n.useMemo)(()=>{var e;return-1!==(null===S||void 0===S||null===(e=S.items)||void 0===e?void 0:e.findIndex(e=>(null===e||void 0===e?void 0:e.product_code)===(null===f||void 0===f?void 0:f.code)))},[null===f||void 0===f?void 0:f.code,null===S||void 0===S?void 0:S.items]);return(0,O.jsxs)(c.k,{bg:"base_level_2",border:"1px solid",borderColor:"content_alpha_100",borderRadius:"lg",py:2,px:3,align:"center",children:[(0,O.jsxs)(c.k,{flex:1,gap:1.5,align:"center",children:[(0,O.jsx)(c.k,{p:3,bg:"content_alpha_100",borderRadius:"lg",mr:1.5,children:(0,O.jsx)(s.J,{as:null===C.ADDON_PRODUCTS||void 0===C.ADDON_PRODUCTS||null===(o=C.ADDON_PRODUCTS[null===f||void 0===f?void 0:f.category])||void 0===o?void 0:o.icon,color:null===C.ADDON_PRODUCTS||void 0===C.ADDON_PRODUCTS||null===(l=C.ADDON_PRODUCTS[null===f||void 0===f?void 0:f.category])||void 0===l?void 0:l.color,fontSize:"20"})}),(0,O.jsxs)(y.x,{children:[(0,O.jsxs)(c.k,{gap:.5,align:"center",children:[(0,O.jsx)(v.x,{fontWeight:"medium",color:"content_active",mb:.5,children:null===f||void 0===f?void 0:f.description}),(0,O.jsxs)(L.J,{placement:"auto",trigger:"hover",children:[(0,O.jsx)(N.x,{children:(0,O.jsx)(c.k,{align:"center",ml:1,children:(0,O.jsx)(s.J,{boxSize:4,as:$.FaInfoCircle})})}),(0,O.jsxs)(D.y,{children:[(0,O.jsx)(U.Q,{}),(0,O.jsx)(M.Y,{fontWeight:"medium",border:"0",fontSize:"lg",children:null===f||void 0===f?void 0:f.name}),(0,O.jsxs)(B.b,{sx:{pt:"0 !important"},fontSize:"lg",children:[null===f||void 0===f||null===(t=f.extra)||void 0===t||null===(r=t.cms
1)||void 0===r?void 0:r.tooltip," "]})]})]})]}),(0,O.jsxs)(v.x,{color:"content_details",fontSize:"sm",children:[(0,C.currencyFormatter)(null===f||void 0===f||null===(d=f.stripe_price)||void 0===d||null===(u=d.currency)||void 0===u?void 0:u.unit_amount,null===f||void 0===f||null===(p=f.stripe_price)||void 0===p||null===(m=p.currency)||void 0===m?void 0:m.currency)," ","/ ","M"===(null===f||void 0===f||null===(_=f.extra)||void 0===_?void 0:_.billing_cycle)?"month":"year"]})]})]}),(0,O.jsx)(y.x,{alignSelf:["flex-end","flex-end","flex-end","center"],mt:[1.5,1,5,1.5,0],children:(null===f||void 0===f||null===(x=f.extra)||void 0===x||null===(h=x.cms)||void 0===h?void 0:h.control_type)===C.ADDON_CONTROL_TYPES.SWITCH?(0,O.jsx)(O.Fragment,{children:A?(0,O.jsx)(F.p9A,{size:"sm"}):(0,O.jsx)(z.r,{onChange:e=>{if(e.target.checked)ce(f),Y.set("addon_category",J?`${J},${null===f||void 0===f?void 0:f.category}`:null===f||void 0===f?void 0:f.category),k.replace({pathname:w.pathname,search:Y.toString()});else{const e=null===J||void 0===J?void 0:J.split(",");e&&(null===e||void 0===e?void 0:e.length)>1?Y.set("addon_category",e.filter(e=>e!==(null===f||void 0===f?void 0:f.category)).join(",")):Y.delete("addon_category"),k.replace({pathname:w.pathname,search:Y.toString()}),ue(f)}},isChecked:ve,disabled:A,mb:0})}):(0,O.jsx)(F.EsK,{min:0,max:C.ADDON_MAX_LIMIT,step:1,defaultValue:0,value:I,onChange:se})})]})};var G=l(783786),H=l(976166),Z=l(842554),V=l(703921),J=l(500981),X=l(206782),q=l(413541),Q=l(957711),ee=l(688158);const oe="pricing-table",le={"smp-one-pro":{essentials:3,aiStudio:7,included:7,addons:3},"smp-one-business":{essentials:4,aiStudio:7,included:6,addons:4},"smp-one-growth":{essentials:4,aiStudio:7,included:6,addons:3}},ne=new Set(["Pro","Business","Growth"]),ie=e=>Array.from({length:e},(e,o)=>o),te=e=>{let{text:o,tooltip:l,popoverTrigger:n="hover",iconColor:i}=e;const{t:t}=(0,r.$)(["common"]);return(0,O.jsxs)(Z.HC,{display:"flex",alignItems:"flex-start",my:[1,1,1,2],position:"relative",children:[(0,O.jsx)(Z.DE,{fontSize:"sm",color:i,mx:3,mt:1,mb:2,as:$.FaCheck}),(0,O.jsxs)(c.k,{align:"center",gap:2,children:[(0,O.jsx)(v.x,{color:"content_details",fontSize:"sm",children:o}),l&&(0,O.jsxs)(L.J,{trigger:n,placement:"auto",children:[(0,O.jsx)(N.x,{children:"click"===n?(0,O.jsx)(u.h,{variant:"ghost",size:"xs",minW:{base:"44px",md:"24px"},h:{base:"44px",md:"24px"},my:{base:"-14px",md:"-6px"},mx:{base:"-14px",md:"-6px"},"aria-label":t("learn_more",{ns:"common"}),icon:(0,O.jsx)(s.J,{as:$.FaInfoCircle,color:"content_inactive"})}):(0,O.jsx)(y.x,{children:(0,O.jsx)(s.J,{as:$.FaInfoCircle,color:"content_inactive"})})}),(0,O.jsxs)(D.y,{children:[(0,O.jsx)(U.Q,{}),(0,O.jsx)(B.b,{fontSize:"sm",children:l})]})]})]})]})},re=e=>{let{viewMore:o,label:l,onToggle:n,iconColor:i,...t}=e;return(0,O.jsx)(c.k,{justify:"left",mt:2,children:(0,O.jsx)(x.z,{leftIcon:(0,O.jsx)(s.J,{as:o?$.FaMinus:$.FaPlus,color:i}),size:"sm",onClick:n,...t,children:l})})},de=e=>{var o,l,i,t,d,u,p,m,_,x,f,b,S,j,T,I,E,A;let{plan:P,isPromoCodeCheckout:w,appliedPromoCode:k,cartItems:R}=e;const{t:L}=(0,r.$)(["billing","common",oe]),N=(0,V.m)("RadioGroup",{variant:"switch"}),[D,U]=(0,a.k)(),M=(0,W.k6)(),B=(0,g.TH)(),z=(0,ee.Z)(),F=(0,C.getTrialPeriod)(P),$=null===P||void 0===P||null===(o=P.extra)||void 0===o||null===(l=o.discount)||void 0===l?void 0:l.active,K=null===P||void 0===P||null===(i=P.feature_list)||void 0===i?void 0:i.features,Y=(null===P||void 0===P||null===(t=P.extra)||void 0===t||null===(d=t.discount)||void 0===d?void 0:d.amount)||0,G=null===P||void 0===P||null===(u=P.extra)||void 0===u||null===(p=u.discount)||void 0===p?void 0:p.unit,de=null===P||void 0===P||null===(m=P.extra)||void 0===m?void 0:m.related_plan,ae=(null===P||void 0===P||null===(_=P.stripe_price)||void 0===_||null===(x=_.currency)||void 0===x?void 0:x.unit_amount)||(null===P||void 0===P?void 0:P.price),se=null===C.SUBSCRIPTION_PRODUCTS||void 0===C.SUBSCRIPTION_PRODUCTS?void 0:C.SUBSCRIPTION_PRODUCTS[null===P||void 0===P?void 0:P.product_env],ce=null===P||void 0===P?void 0:P.billing_cycle,ue=(null===P||void 0===P||null===(f=P.stripe_price)||void 0===f||null===(b=f.currency)||void 0===b?void 0:b.currency)||(null===z||void 0===z||null===(S=z.extra)||void 0===S||null===(j=S.current_plan)||void 0===j?void 0:j.currency),ve=(0,n.useMemo)(()=>(0,C.isTrialAvailableAtCheckout)(z,P,w),[z,P,w]),pe=(0,n.useMemo)(()=>{var e;return null===R||void 0===R||null===(e=R.items)||void 0===e?void 0:e.filter(e=>"plan"===(null===e||void 0===e?void 0:e.product_type)).reduce((e,o)=>{var l;return e+(null!==(l=o.subtotal)&&void 0!==l?l:o.unit_price*o.quantity)},0)},[null===R||void 0===R?void 0:R.items]),me=(0,n.useMemo)(()=>((e,o)=>{const l=le[(e=>(e||"").replace(/-[a-z]+-v\d+$/,""))(e)];if(!l||!o||!ne.has(o))return null;const n=o;return[{titleKey:`${n}.essential_features.title`,items:ie(l.essentials).map(e=>{return{textKey:`${n}.essential_features.${e}`,tooltipKey:e<3?(o=n,l=e,`${o}.essential_features.${0===l?"O":l}_tooltip`):void 0};var o,l})},{titleKey:`${n}.ai_studio.title`,items:ie(l.aiStudio).map(e=>({textKey:`${n}.ai_studio.${e}`,tooltipKey:e<5?`${n}.ai_studio.${e}_tooltip`:void 0}))},{titleKey:`${n}.whats_included.title`,secondary:!0,items:ie(l.included).map(e=>({textKey:`${n}.whats_included.${e}`}))},{titleKey:`${n}.addons_available.title`,secondary:!0,items:ie(l.addons).map(e=>({textKey:`${n}.addons_available.${e}`}))}]})(null===P||void 0===P?void 0:P.slug,null===P||void 0===P?void 0:P.display_name),[null===P||void 0===P?void 0:P.slug,null===P||void 0===P?void 0:P.display_name]),_e=(null===P||void 0===P?void 0:P.product_env)===C.PRODUCTS.ALL?"content_active":(null===se||void 0===se?void 0:se.color)||"content_active",xe=(0,n.useCallback)(()=>D?K:null===K||void 0===K?void 0:K.slice(0,10),[D,K]),he=(0,n.useCallback)(e=>G===C.DISCOUNT_UNIT_FLAT?e-Y:((100-Y)/100*e).toFixed(2),[Y,G]),ge=(0,n.useCallback)(()=>G===C.DISCOUNT_UNIT_FLAT?`${L("flat",{ns:"billing"})} ${(0,C.currencyFormatter)(Y,ue)}`:`${Math.round(Y)}%`,[Y,G,ue,L]),fe=w&&void 0!==pe?pe:ae,Ce=fe/12,be=fe,Se=(0,n.useMemo)(()=>Number(he(ae)),[he,ae]),je=(0,n.useMemo)(()=>$&&!w?ce===C.BILLING_CYCLE_YEAR?Se/12:Se:ce===C.BILLING_CYCLE_YEAR?Ce:be,[$,w,Se,ce,Ce,be]),ye=(0,n.useMemo)(()=>ce===C.BILLING_CYCLE_YEAR?$&&!w?Se:fe:null,[ce,$,w,Se,fe]);return(0,O.jsxs)(c.k,{direction:"column",p:4,gap:2,w:"full",borderRadius:"lg",border:"1px solid",position:"relative",bgColor:"base_level_2",borderColor:null!==P&&void 0!==P&&P.promoted?"common.primary_400":"content_alpha_100",children:[(0,O.jsxs)(c.k,{align:"center",gap:2,direction:["column","column","row"],children:[(0,O.jsx)(h.M,{children:(0,O.jsx)(s.J,{fontSize:48,as:null===se||void 0===se?void 0:se.icon,color:(null===se||void 0===se?void 0:se.color)||"content_active"})}),(0,O.jsxs)(c.k,{direction:"column",flex:1,align:["center","center","center","flex-start"],lineHeight:4,py:1,children:[null!==P&&void 0!==P&&P.promoted?(0,O.jsx)(J.C,{px:2.5,py:1,top:"-3",right:"2",borderRadius:"full",position:"absolute",color:"content_onprimary",bgColor:"common.primary_400",children:L("popular")}):null,(0,O.jsx)(v.x,{fontSize:"2xl",fontWeight:"medium",color:"content_inactive",pb:3,children:null===P||void 0===P?void 0:P.display_name}),(0,O.jsx)(v.x,{color:"content_inactive",fontSize:"sm",children:null===P||void 0===P||null===(T=P.feature_list)||void 0===T?void 0:T.description_1})]}),(0,O.jsx)(h.M,{children:(0,O.jsxs)(X.E,{value:ce,variant:"switch",size:"sm",sx:{...N},onChange:()=>{if(de){const e=(0,H.Gn)(C.BILLING_CHECKOUT_WITH_PLAN_PATH,{plan_code:de});M.push({pathname:e,search:B.search})}},children:[(0,O.jsx)(q.Y,{value:C.BILLING_CYCLE_MONTH,children:(0,O.jsx)(v.x,{color:"content_inactive",fontSize:"md",fontWeight:"medium",textTransform:"capitalize",children:L("interval_monthly")})}),(0,O.jsx)(q.Y,{value:C.BILLING_CYCLE_YEAR,children:(0,O.jsx)(v.x,{color:"content_inactive",fontSize:"md",fontWeight:"medium",textTransform:"capitalize",children:L("interval_yearly")})})]})})]}),(0,O.jsx)(v.x,{fontSize:"xs",color:"content_details",pb:3,children:L("billingcard.customize")}),(0,O.jsx)(c.k,{align:"center",py:2,gap:2,children:(0,O.jsxs)(y.x,{lineHeight:"normal",children:[(0,O.jsxs)(c.k,{align:"baseline",gap:2,wrap:"wrap",children:[(0,O.jsx)(v.x,{color:"content_active",fontSize:"2xl",fontWeight:"bold",children:(0,C.currencyFormatter)(je,ue)}),(0,O.jsx)(v.x,{fontSize:"sm",fontWeight:"medium",color:"content_inactive",children:L("interval_monthly",{ns:"billing"})}),$&&(0,O.jsxs)(J.C,{fontSize:"sm",fontWeight:"medium",border:"1px solid",borderRadius:"full",color:"content_inverse",bgColor:"common.success",px:4,py:"2px",children:[w?null!==k&&void 0!==k&&null!==(I=k.data)&&void 0!==I&&I.amount_off?(0,C.currencyFormatter)(k.data.amount_off/100,ue):null!==k&&void 0!==k&&null!==(E=k.data)&&void 0!==E&&E.percent_off?`${k.data.percent_off}%`:"":ge()," ",L("off",{ns:"billing"})]}),ce===C.BILLING_CYCLE_YEAR&&!(null!==P&&void 0!==P&&P.is_free)&&null===ye&&(0,O.jsxs)(c.k,{direction:"column",lineHeight:"tight",pt:"3px",children:[(0,O.jsx)(v.x,{fontSize:"xs",color:"content_inactive",textTransform:"lowercase",children:L("billed",{ns:"billing"})}),(0,O.jsx)(v.x,{fontSize:"xs",color:"content_inactive",textTransform:"lowercase",children:L("annually",{ns:"billing"})})]})]}),$&&!w&&(0,O.jsxs)(v.x,{fontSize:"sm",textDecoration:"line-through",color:"content_inactive",fontWeight:"medium",children:[ce===C.BILLING_CYCLE_YEAR?(0,C.currencyFormatter)(ae/12,ue).split(".")[0]:(0,C.currencyFormatter)(ae,ue).split(".")[0],L("billingcard.per_month")]}),null!==ye?(0,O.jsx)(v.x,{fontSize:"xs",color:"content_details",mt:1,children:L("checkout.billed_annually_total",{monthly:(0,C.currencyFormatter)(ye/12,ue),amount:(0,C.currencyFormatter)(ye,ue)})}):null,ve&&(0,O.jsx)(v.x,{fontSize:"xs",color:"content_details",children:L("billingcard.trial_available_fee",{default_trial_days:F,amount:(0,C.currencyFormatter)(C.TRIAL_VERIFICATION_FEE,ue)})})]})}),me?(0,O.jsxs)(y.x,{display:{base:"none",lg:"block"},children:[me.filter(e=>D||!e.secondary).map(e=>(0,O.jsxs)(y.x,{mb:3,children:[(0,O.jsx)(v.x,{fontWeight:"medium",color:"content_active",fontSize:"sm",mb:1,children:L(e.titleKey,{ns:oe})}),(0,O.jsx)(Z.aV,{textAlign:"left",rowGap:2,children:e.items.map(e=>(0,O.jsx)(te,{text:L(e.textKey,{ns:oe}),tooltip:e.tooltipKey&&L(e.tooltipKey,{ns:oe}),popoverTrigger:"click",iconColor:_e},e.textKey))})]},e.titleKey)),(0,O.jsx)(re,{viewMore:D,onToggle:U.toggle,variant:"ghost",px:2,color:"content_details",label:D?L("view_less"):L("checkout.show_all_features",{count:(Te=me,Te.reduce((e,o)=>e+o.items.length,0))})})]}):(0,O.jsxs)(y.x,{display:{base:"none",lg:"block"},children:[(0,O.jsx)(Z.aV,{textAlign:"left",rowGap:2,children:Array.isArray(K)&&(null===(A=xe())||void 0===A?void 0:A.map((e,o)=>(0,O.jsx)(te,{text:"object"===typeof e?null===e||void 0===e?void 0:e.text:e,tooltip:"object"===typeof e&&(0,O.jsxs)(v.x,{children:[null===e||void 0===e?void 0:e.tooltip," ",(null===e||void 0===e?void 0:e.help_article)&&(0,O.jsx)(Q.r,{href:null===e||void 0===e?void 0:e.help_article,isExternal:!0,fontSize:"sm",color:"common.primary_400",cursor:"pointer",children:L("learn_more",{ns:"common"})})]}),popoverTrigger:"hover",iconColor:_e},o)))}),Array.isArray(K)&&(null===K||void 0===K?void 0:K.length)>10&&(0,O.jsx)(re,{viewMore:D,onToggle:U.toggle,iconColor:null===se||void 0===se?void 0:se.color,label:D?L("view_less"):L("more_features",{count:(null===K||void 0===K?void 0:K.length)-10})})]})]});var Te},ae=e=>{let{selectedPlan:o,fromUrl:l}=e;const{t:d}=(0,r.$)(["billing","common","addons"]),s=(0,P.useStripe)(),u=(0,i.I0)(),_=(0,g.TH)(),x=(0,W.k6)(),h=A.parse(_.search).promo_code,[f,T]=(0,n.use
1State)(null),[I,L]=(0,a.k)(),[N,D]=(0,a.k)(),[U,M]=(0,n.useState)(!1),[B,z]=(0,n.useState)(h||""),[$,K]=(0,n.useState)({data:{},error:null,isLoading:!1}),{colorMode:H}=(0,w.If)(),Z=(0,ee.Z)(),{payload:{user:V}}=(0,i.v9)(e=>e.auth),{canChangeSubscription:J}=(0,i.v9)(e=>e.permissions.workspacePermissionChecks),X=(0,C.getTrialPeriod)(o),q=(0,n.useMemo)(()=>(0,C.isTrialAvailableAtCheckout)(Z,o,U),[Z,o,U]),Q=(0,n.useCallback)(()=>{var e;const l=(null===o||void 0===o?void 0:o.id)||(null===o||void 0===o||null===(e=o.stripe_price)||void 0===e?void 0:e.id)||(null===o||void 0===o?void 0:o.bt_plan);L.on(),(0,b.tK6)({tplan:l,seats:0}).then(e=>{T(e.data)}).catch(e=>{u((0,j.iM)(e))}).finally(()=>{L.off()})},[o,L,T,u]),oe=e=>{T(e)};return(0,n.useEffect)(()=>{(0,C.setAxiosSubscriptionHeader)(null===Z||void 0===Z?void 0:Z.id),Q()},[]),J?(0,O.jsx)(O.Fragment,{children:I?(0,O.jsx)(E,{}):f?(0,O.jsx)(y.x,{p:[0,0,0,4],mb:8,w:"full",maxW:"1200px",children:(0,O.jsxs)(p.r,{templateColumns:{base:"1fr",lg:"minmax(0, 1fr) 400px"},templateAreas:{base:'"plan" "summary" "addons"',lg:'"plan summary" "addons summary"'},alignItems:"start",gap:4,children:[(0,O.jsx)(m.P,{area:"plan",w:"full",children:(0,O.jsx)(de,{plan:o,isPromoCodeCheckout:U,appliedPromoCode:$,cartItems:f})}),(0,O.jsx)(m.P,{area:"addons",w:"full",children:!(0,t.isEmpty)(null===o||void 0===o?void 0:o.promoted_addons)&&(0,O.jsxs)(y.x,{mt:[6,6,6,2],mb:8,children:[(0,O.jsx)(v.x,{fontWeight:"medium",color:"content_active",children:d("customise_plan_addons")}),(0,O.jsx)(c.k,{direction:"column",gap:"2.5",mt:3,children:null===o||void 0===o?void 0:o.promoted_addons.map(e=>(0,O.jsx)(Y,{addon:e,cartItems:f,updateCart:oe},e.id))})]})}),(0,O.jsx)(m.P,{area:"summary",w:"full",position:{base:"static",lg:"sticky"},top:4,p:4,bg:"base_level_3",borderRadius:"lg",border:"2px solid",borderColor:"color-mix(in srgb, var(--chakra-colors-common-candy) 50%, transparent)",backgroundImage:`url(${H===C.COLOR_MODE_DARK?C.BILLING_CARD_BG_IMAGE_DARK_URL:C.BILLING_CARD_BG_IMAGE_LIGHT_URL})`,backgroundRepeat:"no-repeat",backgroundSize:"cover",children:(0,O.jsx)(k.jY,{t:d,handleStripeCheckout:(e,o)=>{var n,i;const t=new URLSearchParams((null===_||void 0===_?void 0:_.search)||(null===_||void 0===_||null===(n=_.state)||void 0===n?void 0:n.search));let r=l;(null===t||void 0===t?void 0:t.get("action"))===C.PostLoginAction.CLONE_TEMPLATE?r=null===t||void 0===t?void 0:t.get("redirect"):(null===_||void 0===_||null===(i=_.state)||void 0===i?void 0:i.action)===C.PostLoginAction.CLONE_TEMPLATE&&(r=_.state.redirect),D.on();const a={plan:e.id,promo_code:localStorage.getItem(C.PROMO_CODE_KEY)||B,allow_promocode:localStorage.getItem(C.ALLOW_PROMO_CODE_KEY),coupon:localStorage.getItem(C.COUPON_KEY),subscription:null===Z||void 0===Z?void 0:Z.id,redirect_url:r&&!r.includes("null")?r:`${window.location.origin}${C.ROOT}`,cancel_url:window.location.href};q&&(a.trial_days=X),(0,b.USl)(null===Z||void 0===Z?void 0:Z.id,a).then(l=>{var n,i,t,r,d;localStorage.removeItem(C.PROMO_CODE_KEY),localStorage.removeItem(C.ALLOW_PROMO_CODE_KEY),localStorage.removeItem(C.COUPON_KEY);let a={plan:null===e||void 0===e?void 0:e.display_name,price:o,unit:null===e||void 0===e||null===(n=e.stripe_price)||void 0===n||null===(i=n.currency)||void 0===i||null===(t=i.currency)||void 0===t?void 0:t.toUpperCase(),trial:q,id:null===e||void 0===e?void 0:e.id,session_id:null===(r=l.data)||void 0===r?void 0:r.session_id,subscription_id:null===Z||void 0===Z?void 0:Z.id,source:C.PaymentSources.STRIPE};if((0,R.$T)(C.PAYMENT_CHECKOUT_CART,a),(0,C.analyticsTrackEvent)(q?"trial.checkoutStarted":"upgrade.checkoutStarted",a),null!==(d=l.data)&&void 0!==d&&d.session_url)return window.location.href=l.data.session_url,null;s.redirectToCheckout({sessionId:l.data.session_id})}).catch(e=>{var o,l,n,i,t,r,a,s;(0,F.CFj)({description:(null===e||void 0===e||null===(o=e.response)||void 0===o||null===(l=o.data)||void 0===l||null===(n=l.detail)||void 0===n?void 0:n.message)||(null===e||void 0===e||null===(i=e.response)||void 0===i||null===(t=i.data)||void 0===t||null===(r=t.promo_code)||void 0===r||null===(a=r[0])||void 0===a?void 0:a.message)||(null===e||void 0===e||null===(s=e.response)||void 0===s?void 0:s.data[0])||`${d("payment_status_modal.modal_title_failed")}. ${d("payment_status_modal.modal_error_msg_second")}`,title:d("failed",{ns:"common"}),status:"error"}),localStorage.removeItem(C.PROMO_CODE_KEY),localStorage.removeItem(C.ALLOW_PROMO_CODE_KEY),localStorage.removeItem(C.COUPON_KEY),(0,R.tL)(C.PAYMENT_CHECKOUT_CART)}).finally(()=>{D.off()})},cartItems:f,isLoading:N,selectedPlan:o,isPromoCodeCheckout:U,onPromoCodeCheckout:e=>M(e),promoCode:B,onSetPromoCode:e=>z(e),onGoToPath:e=>x.push(e),selectedAppSubscription:Z,canChangeSubscription:J,onUpdateAppwiseSubscriptionData:()=>u((0,S.k)(null===V||void 0===V?void 0:V.pk)),onSyncWorkspaces:()=>u((0,G.Tp)()),updateCart:oe,appliedPromoCode:$,setAppliedPromoCode:K})})]})}):null}):x.replace(C.ACCESS_DENIED_ROUTE)};var se=l(778625),ce=l(774770),ue=l(273037),ve=l(193691);const pe=["smp-link-bio-pro-m","smp-link-bio-pro-y"],me=()=>{var e,o,l;const{t:y}=(0,r.$)(["billing","common"]),T=(0,d.S)({base:!0,md:!1}),I=(0,W.k6)(),A=(0,g.TH)(),P=(0,i.I0)(),w=new URLSearchParams((null===A||void 0===A?void 0:A.search)||window.location.search),{plan_code:k=""}=(0,g.UO)(),R=k||w.get("plan")||"",L=pe.includes(R),{isDelegateFlowApp:N}=(0,C.useGetCurrentSite)(),D=(0,K.Z)(),U=(0,ee.Z)(),{payload:{user:M}}=(0,i.v9)(e=>
1e.auth),[B,z]=(0,n.useState)(null),[F,$]=(0,a.k)(!1),Y=window.location.origin,G=(0,n.useMemo)(()=>(0,C.isMobileApp)(),[]),H=null!==A&&void 0!==A&&A.search?`${Y}${w.get("from")}`:null!==A&&void 0!==A&&null!==(e=A.state)&&void 0!==e&&e.from?`${Y}${A.state.from}`:null!==C.ENVIRONMENT_ROOT&&void 0!==C.ENVIRONMENT_ROOT&&C.ENVIRONMENT_ROOT[D]?`${Y}/${null===C.ENVIRONMENT_ROOT||void 0===C.ENVIRONMENT_ROOT?void 0:C.ENVIRONMENT_ROOT[D]}`:Y,Z=(0,n.useCallback)(()=>{var e,o,l,n;if(null!==A&&void 0!==A&&A.search&&null!==w&&void 0!==w&&w.get("from")&&I.length>1)I.goBack();else if(null!==A&&void 0!==A&&A.search&&null!==w&&void 0!==w&&w.get("from")){const e=new URL(`${Y}${w.get("from")}`);if(C.SSR_ROUTES.includes(e.pathname)||e.pathname.includes(`${C.GRAPHIC_TEMPLATES_SCREEN}/`)){let o=e.pathname;const l=w.get("addonProductCategory");return l&&(o=o+"?addonCategory="+l),window.location.href=o}window.location.href=e.pathname}else if(null!==(e=A.state)&&void 0!==e&&e.from&&null!==(o=A.state)&&void 0!==o&&o.addonProductCategory){var i,t;const e=null===(i=A.state)||void 0===i?void 0:i.addonProductCategory;I.replace({pathname:null===(t=A.state)||void 0===t?void 0:t.from,state:{addonCategory:e}})}else if(null!==(l=A.state)&&void 0!==l&&l.from&&I.length>1)I.goBack();else if(null!==(n=A.state)&&void 0!==n&&n.from){var r;I.replace(null===(r=A.state)||void 0===r?void 0:r.from)}else"billing"===w.get("show")?(w.delete("show"),w.delete("plan"),I.replace({search:w.toString()})):I.length>1?I.goBack():I.replace(C.ROOT)},[]);(0,n.useEffect)(()=>{L||P((0,S.k)(null===M||void 0===M?void 0:M.pk)).then(()=>{V()})},[null===M||void 0===M?void 0:M.pk,R]),(0,n.useEffect)(()=>()=>{z(null)},[]);const V=(0,n.useCallback)(async()=>{$.on();try{var e;if(R){const e=await(0,b.bkq)(R,"",{expand:"promoted_addons"});return void z(e.data)}if(null!==U&&void 0!==U&&null!==(e=U.t_plan)&&void 0!==e&&e.product_env){const e={platform:N?"delegate.com":"app.com",product_env:C.PRODUCTS.SUITE},o=await(0,b.T9t)(e),l=(0,t.orderBy)(o.data.results,["order"],["asc"]),n=l.find(e=>{var o;return(e.display_name===(null===A||void 0===A||null===(o=A.state)||void 0===o?void 0:o.plan)||e.display_name===C.BILLING_PLAN_BUSINESS)&&e.billing_cycle===C.BILLING_CYCLE_YEAR||e.price>0});z((0,t.isEmpty)(n)?(null===l||void 0===l?void 0:l.length)>=3?l[3]:l[(null===l||void 0===l?void 0:l.length)-1]:n)}}catch(o){P((0,j.iM)(o,{history:I}))}finally{$.off()}},[R,P,$,z,b.bkq,b.T9t,null===A||void 0===A||null===(o=A.state)||void 0===o?void 0:o.plan]),J=(0,O.jsx)(s.J,{as:null===(l=C.SUBSCRIPTION_PRODUCT_ICONS[C.PRODUCTS.SUITE])||void 0===l?void 0:l.icon,boxSize:6,color:"content_active"}),X=T?(0,O.jsxs)(c.k,{align:"center",justify:"flex-start",gap:2,children:[(0,O.jsx)(u.h,{"aria-label":y("go_back",{ns:"common"}),onClick:Z,variant:"ghost",icon:(0,O.jsx)(ve.sfB,{})}),J,(0,O.jsx)(v.x,{children:y("choose_plan_and_pay_modal.checkout_btn",{ns:"billing"})})]}):(0,O.jsxs)(p.r,{templateColumns:"1fr auto 1fr",alignItems:"center",w:"full",children:[(0,O.jsx)(m.P,{justifySelf:"start",children:(0,O.jsx)(u.h,{"aria-label":y("go_back",{ns:"common"}),onClick:Z,variant:"ghost",icon:(0,O.jsx)(ve.sfB,{})})}),(0,O.jsx)(m.P,{justifySelf:"center",children:J}),(0,O.jsx)(m.P,{justifySelf:"end",children:(0,O.jsxs)(_.U,{align:"center",w:"max-content",mr:12,children:[(0,O.jsx)(v.x,{flex:1,fontSize:["xs","xs","xs","sm"],fontWeight:"normal",children:y("have_billing_questions",{ns:"billing"})}),(0,O.jsx)(c.k,{children:(0,O.jsx)(x.z,{flex:1,size:"sm",onClick:()=>{(0,C.openIntercom)()},children:y("chat_with_us",{ns:"common"})})})]})})]});return L?(0,O.jsx)(W.l_,{to:C.PRICING_PAGE_PATH}):(0,O.jsx)(ue.Z,{onClose:Z,modalHeader:X,modalFooter:G?(0,O.jsx)(ce.Z,{}):null,children:(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(se.Z,{t:y,isLoading:F||(0,t.isEmpty)(B),isCheckoutPage:!0}),!F&&!(0,t.isEmpty)(B)&&(0,O.jsxs)(v.x,{fontSize:"xs",color:"content_details",mb:4,textAlign:"center",children:[y("payment_detail_modal.looking_for_other_plans",{ns:"billing"})," ",(0,O.jsx)(x.z,{variant:"link",as:f.rU,to:C.PRICING_PAGE_PATH,fontSize:"xs",fontWeight:"normal",children:y("payment_detail_modal.explore_here",{ns:"billing"})})]}),(0,O.jsx)(h.M,{alignItems:"flex-start",w:"full",mt:4,children:F||(0,t.isEmpty)(B)?(0,O.jsx)(E,{}):(0,O.jsx)(ae,{selectedPlan:B,fromUrl:H})})]})})}},774181:(e,o,l)=>{l.d(o,{Z:()=>g});var n=l(308974),i=l(462134),t=l(351839),r=l(741065),d=l(349798),a=l(683017),s=l(408499),c=l(104399),u=l(491686),v=l(692877),p=l(295903),m=l(129944),_=l(228993);const x=()=>{const e=(0,v.S)({base:!0,md:!1});return(0,_.jsxs)(t.k,{direction:"column",align:"center",w:"inherit",children:[(0,_.jsx)(t.k,{w:"full",justify:"center",children:(0,_.jsx)(p.O,{borderRadius:"full",w:"270px",h:"36px"})}),(0,_.jsx)(t.k,{sx:{flexWrap:"wrap","@media(min-width: 900px)":{flexWrap:"wrap"},"@media(min-width: 1245px)":{flexWrap:"nowrap"}},justify:"center",gap:"4",my:"4",mx:4,children:[1,2,3].map(o=>(0,_.jsx)(p.O,{h:e?"220px":"600px",w:"350px",borderRadius:"lg"},o))}),(0,_.jsx)(m.M,{children:(0,_.jsx)(p.O,{w:"200px",h:"40px",borderRadius:"lg"})})]})},h="simplified-pricing-table",g=e=>{let{language:o,pageType:l,theme:v,currentPlanId:p,accessToken:m,appUrl:g,apiUrl:f,isFreePlan:C,subscriptionStatus:b,trialEligible:S,onTrialPlanSwitch:j}=e;const{t:y}=(0,s.$)(["billing","common"]),{isLoaded:T,error:I,reload:O}=(0,u.F)(c.SIMPLIFIED_PRICING_TABLE_SCRIPT_URL),E=(0,a.useRef)(null),[A,P]=(0,a.useState)(!1),[w,k]=(0,a.useState)(0),[R,L]=(0,a.useState)(!1),[N,D]=(0,a.useState)(!1);(0,a.useEffect)(()=>
1{if(!T)return L(!1),void D(!1);if(customElements.get(h))return void L(!0);let e=!1;const o=setTimeout(()=>{e||D(!0)},5e3);return customElements.whenDefined(h).then(()=>{e||(L(!0),clearTimeout(o))}),()=>{e=!0,clearTimeout(o)}},[T,w]),(0,a.useEffect)(()=>{if(!R||A)return;const e=setTimeout(()=>{const e=E.current;e&&0===e.childElementCount&&P(!0)},8e3),o=E.current,l=()=>P(!0);return null===o||void 0===o||o.addEventListener("simplified-pricing-error",l),()=>{clearTimeout(e),null===o||void 0===o||o.removeEventListener("simplified-pricing-error",l)}},[R,w,A]);const U=(0,a.useCallback)(e=>{const o=e.detail;null===j||void 0===j||j(o)},[j]);(0,a.useEffect)(()=>{const e=E.current;if(e&&R&&j)return e.addEventListener("simplified-pricing-plan-switch",U),()=>{e.removeEventListener("simplified-pricing-plan-switch",U)}},[R,w,U,j]);const M=()=>{P(!1),D(!1),L(!1),customElements.get(h)||O(),k(e=>e+1)};return I||N||A?(0,_.jsxs)(n.b,{status:"error",borderRadius:"lg",maxW:"md",children:[(0,_.jsx)(i.z,{}),(0,_.jsxs)(t.k,{flex:"1",ml:2,justify:"space-between",align:"center",children:[(0,_.jsx)(r.x,{children:y("pricing_table_error",{ns:"billing"})}),(0,_.jsx)(d.z,{size:"sm",onClick:M,children:y("refresh",{ns:"common"})})]})]}):T&&R?(0,_.jsx)("simplified-pricing-table",{ref:E,style:{display:"block",width:"100%",overflowX:"hidden"},language:o,page_type:l,theme:v,current_plan_id:p,access_token:m,app_url:g,api_url:f,is_free_plan:void 0!==C?String(C):void 0,subscription_status:b,trial_eligible:void 0!==S?String(S):void 0},w):(0,_.jsx)(x,{})}},491686:(e,o,l)=>{l.d(o,{F:()=>i});var n=l(683017);const i=e=>
1{const[o,l]=(0,n.useState)(!1),[i,t]=(0,n.useState)(!1),[r,d]=(0,n.useState)(0),[a,s]=(0,n.useState)(0),c=(0,n.useRef)(),u=(0,n.useCallback)(()=>{const o=document.querySelector(`script[src="${e}"]`);o&&o.remove(),l(!1),t(!1),d(0),s(e=>e+1)},[e]);return(0,n.useEffect)(()=>{if(document.querySelector(`script[src="${e}"]`))return void l(!0);l(!1),t(!1),d(0);const o=n=>{const i=document.createElement("script");i.src=e,i.async=!0;const r=()=>{l(!0),t(!1),i.removeEventListener("load",r),i.removeEventListener("error",a)},a=()=>{if(console.error(`Failed to load script: ${e} (attempt ${n+1}/4)`),i.remove(),i.removeEventListener("load",r),i.removeEventListener("error",a),n<3){d(n+1);const e=1e3*Math.pow(2,n);console.log(`Retrying script load in ${e}ms...`),c.current=setTimeout(()=>{o(n+1)},e)}else t(!0),console.error(`Failed to load script after 4 attempts: ${e}`)};i.addEventListener("load",r),i.addEventListener("error",a),document.body.appendChild(i)};return o(0),()=>{c.current&&clearTimeout(c.current)}},[e,a]),{isLoaded:o,error:i,retryCount:r,reload:u}}},116118:(e,o,l)=>{l.d(o,{Z:()=>v});var n=l(683017),i=l(764293),t=l(408499),r=l(313773),d=l(104399),a=l(514077),s=l(747676),c=l(783786),u=l(688158);const v=function(){var e,o,l,v,p,m,_;let{onSuccess:x}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const[h,g]=(0,n.useState)(null),[f,C]=(0,n.useState)(null),[b,S]=(0,n.useState)(!1),[j,y]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),[O,E]=(0,n.useState)(!1),A=(0,i.I0)(),{t:P}=(0,t.$)(["billing","common","addons"]),w=(0,u.Z)(),k=(0,i.v9)(e=>{var o,l,n;return null===(o=e.auth)||void 0===o||null===(l=o.payload)||void 0===l||null===(n=l.user)||void 0===n?void 0:n.pk}),{canChangeSubscription:R}=(0,i.v9)(e=>e.permissions.workspacePermissionChecks),L=(null===w||void 0===w?void 0:w.status)===d.BILLING_SUBSCRIBED_PLAN_STATUS_TRIAL,N=Number((null===w||void 0===w||null===(e=w.extra)||void 0===e||null===(o=e.current_plan)||void 0===o?void 0:o.price)||(null===w||void 0===w||null===(l=w.plan)||void 0===l?void 0:l.amount)),D=(0,n.useCallback)(async e=>{S(!0);try{const[o,l]=await Promise.all([(0,r.bkq)(e.planSlug,"",{expand:"promoted_addons"}),(0,r.tK6)({tplan:e.planId,seats:0})]);g(o.data),C(l.data)}catch(n){var o,l;(0,a.CFj)({status:"error",description:(null===n||void 0===n||null===(o=n.response)||void 0===o||null===(l=o.data)||void 0===l?void 0:l.detail)||P("errors.contact_support",{ns:"common"}),title:P("failed",{ns:"common"})})}finally{S(!1)}},[P]),U=(0,n.useCallback)(async()=>{if(null!==w&&void 0!==w&&w.id&&null!==h&&void 0!==h&&h.id){y(!0);try{var e,o,l,n,i,t;await(0,r.MgE)({plan:h.id,subscription:w.id});const u=Number(null===h||void 0===h||null===(e=h.stripe_price)||void 0===e||null===(o=e.currency)||void 0===o?void 0:o.unit_amount)||Number(null===h||void 0===h?void 0:h.price),v=(null===h||void 0===h||null===(l=h.stripe_price)||void 0===l||null===(n=l.currency)||void 0===n?void 0:n.currency)||(null===w||void 0===w||null===(i=w.extra)||void 0===i||null===(t=i.current_plan)||void 0===t?void 0:t.currency),p=L?"trial.planSwitched":N>u?"downgrade.checkoutComplete":"upgrade.checkoutComplete";(0,d.analyticsTrackEvent)(p,{plan:h.display_name,price:u,unit:null===v||void 0===v?void 0:v.toUpperCase(),product:h.product_env}),(0,a.CFj)({status:"success",description:P("subscription_updated",{ns:"billing"}),title:P("braintree_modal.success.title",{ns:"billing"})}),await A((0,s.k)(k)),A((0,c.Tp)()),g(null),C(null),I(""),E(!1),null===x||void 0===x||x()}catch(b){var u,v,p,m,_,f;(0,a.CFj)({status:"error",description:(null===b||void 0===b||null===(u=b.response)||void 0===u||null===(v=u.data)||void 0===v?void 0:v.detail)||(null===b||void 0===b||null===(p=b.response)||void 0===p||null===(m=p.data)||void 0===m||null===(_=m.plan)||void 0===_||null===(f=_[0])||void 0===f?void 0:f.message)||P("errors.contact_support",{ns:"common"}),title:P("failed",{ns:"common"})})}finally{y(!1)}}},[null===w||void 0===w?void 0:w.id,null===w||void 0===w||null===(v=w.extra)||void 0===v||null===(p=v.current_plan)||void 0===p?void 0:p.currency,h,N,L,k,A,P,x]),M=(0,n.useCallback)(()=>{g(null),C(null),I(""),E(!1)},[]),B=h?Number(null===h||void 0===h||null===(m=h.stripe_price)||void 0===m||null===(_=m.currency)||void 0===_?void 0:_.unit_amount)||Number(null===h||void 0===h?void 0:h.price):0;return{handlePlanSelected:D,showModal:!!h&&!!f,isLoadingCart:b,modalProps:{show:!!h&&!!f,onHide:M,onYes:U,loading:j,grade:N>B?"downgrade":"upgrade",newSubscription:h,cartData:f,isPromoCodeCheckout:O,onPromoCodeCheckout:E,promoCode:T,onSetPromoCode:I,t:P,selectedAppSubscription:w,canChangeSubscription:R,updateCart:C}}}}}]); 2//# sourceMappingURL=5399.79299ab2.chunk.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.