1import{o as e,t}from"./cvnAX2O.js";import{Kt as n,Nt as r,Xt as i,wt as a}from"./Cauabew.js";import{a as o}from"./m2QH5QC.js";import{a as s}from"./iNYF8an.js";import{n as c,t as l}from"./GOuHwzC.js";import{t as u}from"./CJ40dAW.js";import{c as d,l as f,p,u as m}from"./Cfmob-r.js";import{n as h,t as g}from"./BRaJy6S.js";import{t as _}from"./B0-g8y_.js";var v=e(i(),1),y=t();function b(e){if(e.trialOffer)return e.trialOffer;let t=e.access.stage===`preview`&&!e.access.trialStartedAt?7:0;return{standardDays:t,agencyDays:t,salesTeamDays:t}}function x(e,t){return t===`agency`?e.agencyDays:t===`sales_team`?e.salesTeamDays:e.standardDays}function S(e){let{plan:t,stage:n,trialStartedAt:r,trialEndsAt:i}=e.access;if(n!==`trial`||!r||!i)return null;let a=(Date.parse(i)-Date.parse(r))/864e5;return Math.round(a)===21?t===`agency`?`Agency`:t===`sales_team`?`Sales Team`:null:null}var C=null,w=new WeakMap;function T(){let e=window.Paddle;return e?Promise.resolve(e):C||(C=new Promise((e,t)=>{let n=`https://cdn.paddle.com/paddle/v2/paddle.js`,r=document.querySelector(`script[src="${n}"]`),i=r??document.createElement(`script`),a=()=>{clearTimeout(o),i.removeEventListener(`load`,a),i.removeEventListener(`error`,a);let n=window.Paddle;n?e(n):(i.remove(),t(Error(`Secure checkout could not load. Try again.`)))},o=window.setTimeout(a,15e3);i.addEventListener(`load`,a),i.addEventListener(`error`,a),r||(i.src=n,i.async=!0,i.dataset.paddle=`true`,document.head.appendChild(i))}).catch(e=>{throw C=null,e}),C)}async function E(e){let t=await T(),n=w.get(t);if(!n)t.Environment?.set(e.environment),t.Initialize({token:e.clientToken,...e.eventCallback?{eventCallback:e.eventCallback}:{}}),w.set(t,e.clientToken);else if(n!==e.clientToken)throw Error(`Refresh the page before opening checkout again.`);else e.eventCallback&&t.Update({eventCallback:e.eventCallback});return t}async function D(e,t){(await E({clientToken:e.clientToken,environment:e.environment,eventCallback:t})).Checkout.open({transactionId:e.transactionId})}var O=`privly:billing-changed`;function k(){s(),window.dispatchEvent(new Event(O))}var A=`Checkout completed. Your plan will update after Paddle confirms it.`;function j({setNotice:e,setPending:t,token:n,workspaceId:r}){return(0,v.useCallback)(async i=>{t(`portal`),e(null);try{let e=await f(r,n);window.location.assign(i&&e.cancelUrl?e.cancelUrl:e.overviewUrl)}catch(n){e(n instanceof Error?n.message:`Billing could not open. Try again.`),t(null)}},[e,t,n,r])}async function M(e){try{let t;for(let n=0;n<10&&(t=await d(e.workspaceId,e.token,{checkoutSessionId:e.checkoutSessionId,transactionId:e.transactionId}),t.state!==`confirmed`);n+=1)n<9&&await new Promise(e=>window.setTimeout(e,1500));e.setNotice(t?.state===`confirmed`?`Checkout confirmed. Your plan is now active.`:A)}catch{e.setNotice(A)}finally{k(),await Promise.resolve(e.onCheckoutComplete?.()).catch(()=>void 0)}}function N(e){return(0,v.useCallback)(async(t,n=e.addons??{})=>{e.setPending(`checkout`),e.setNotice(null);try{let r=await p(e.workspaceId,e.token,{addonSenders:n.senders??0,addonWorkspaces:n.workspaces??0,addonLeadPacks:t===`agency`?0:n.leadPacks??0,period:e.period,plan:t});await D(r,t=>{t.name===`checkout.completed`&&M({checkoutSessionId:r.checkoutSessionId,onCheckoutComplete:e.onCheckoutComplete,setNotice:e.setNotice,token:e.token,transactionId:r.transactionId,workspaceId:e.workspaceId})}),e.onCheckoutOpened?.()}catch(t){e.setNotice(t instanceof Error?t.message:`Checkout could not open. Try again.`)}finally{e.setPending(null)}},[e])}function P({initialPeriod:e=`monthly`,initialAddons:t={senders:0,workspaces:0,leadPacks:0},onCheckoutComplete:n,onCheckoutOpened:r,token:i,workspaceId:a}){let[o,s]=(0,v.useState)(e),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),[f,p]=(0,v.useState)(t);return{addons:f,setAddons:p,checkout:N({addons:f,onCheckoutComplete:n,onCheckoutOpened:r,period:o,setNotice:d,setPending:l,token:i,workspaceId:a}),notice:u,pending:c,period:o,portal:j({setNotice:d,setPending:l,token:i,workspaceId:a}),setNotice:d,setPeriod:s}}function F(e,t){return h.filter(({capacity:n}
1)=>e?e.kind===`member`?n.members===null||n.members>=e.minimum:(e.kind===`workspace`?n.workspaces+t.workspaces:n.senders+t.senders+t.workspaces)>=e.minimum:!0)}var I=[{key:`senders`,label:`Extra LinkedIn senders`,monthly:49,yearly:490,description:`Each adds 1 sender, 500 active leads, and 100 monthly email credits.`},{key:`workspaces`,label:`Extra client workspaces`,monthly:79,yearly:790,description:`Each adds 1 workspace, 1 sender, 500 active leads, and 100 monthly email credits.`},{key:`leadPacks`,label:`Extra 1,000 active leads`,monthly:39,yearly:390,description:`Each adds space for 1,000 active leads. Not charged with Agency's unlimited leads.`}];function L(e){let[t,n]=(0,v.useState)(!1);return(0,y.jsxs)(`div`,{className:`billing-addon-heading`,onMouseLeave:()=>n(!1),children:[(0,y.jsx)(`label`,{htmlFor:e.id,children:e.label}),(0,y.jsxs)(`span`,{className:`billing-addon-help`,children:[(0,y.jsx)(`button`,{"aria-describedby":`${e.id}-help`,"aria-label":`About ${e.label.toLowerCase()}`,onBlur:()=>n(!1),onClick:()=>n(!0),onFocus:()=>n(!0),onMouseEnter:()=>n(!0),onKeyDown:e=>{e.key!==`Escape`||!t||(e.preventDefault(),e.stopPropagation(),n(!1))},type:`button`,children:(0,y.jsx)(a,{"aria-hidden":`true`})}),(0,y.jsx)(`span`,{hidden:!t,id:`${e.id}-help`,role:`tooltip`,children:e.description})]})]})}function R(e){let t=(0,v.useId)();return(0,y.jsxs)(`fieldset`,{className:`billing-addon-fields`,disabled:e.disabled,children:[(0,y.jsx)(`legend`,{children:`Optional add-ons`}),I.map(n=>(0,y.jsxs)(`div`,{className:`billing-addon-field`,children:[(0,y.jsx)(L,{description:n.description,id:`${t}-${n.key}`,label:n.label}),(0,y.jsxs)(`span`,{className:`billing-addon-price`,id:`${t}-${n.key}-price`,children:[`$`,n[e.period],` each/`,e.period===`yearly`?`year`:`month`]}),(0,y.jsx)(`input`,{"aria-describedby":`${t}-${n.key}-price ${t}-${n.key}-help`,"aria-label":n.label,id:`${t}-${n.key}`,type:`number`,min:e.minimum?.[n.key]??0,max:100,step:1,value:e.value[n.key],disabled:n.key===`leadPacks`&&e.unlimitedLeads,onChange:t=>e.change({...e.value,[n.key]:Number(t.target.value)})})]},n.key))]})}var z={standardDays:0,agencyDays:0,salesTeamDays:0};function B(e){let[t,n]=(0,v.useState)(null),[r,i]=(0,v.useState)(0),{open:a,token:o,workspaceId:s,trialEligible:c}=e;(0,v.useEffect)(()=>{if(n(null),!a||c===!1)return;let e=!0;return m(s,o,!0).then(t=>{e&&n({offer:b(t),error:null,token:o,workspaceId:s})}).catch(()=>{e&&n({offer:z,error:`Your plan could not be loaded. Try again before choosing a plan.`,token:o,workspaceId:s})}),()=>{e=!1}},[r,a,o,c,s]);let l=t?.token===o&&t.workspaceId===s?t:null,u=c===!1?z:l?.offer??z;return{trialEligible:u.standardDays>0,trialOffer:u,pilotEligible:u.agencyDays===21||u.salesTeamDays===21,checking:a&&c!==!1&&!l,error:c===!1?null:l?.error??null,retry:()=>{n(null),i(e=>e+1)}}}function V(e,t){let n=t===`yearly`?e.yearly/12:e.monthly;return n.toFixed(Number.isInteger(n)?0:2)}function H(e,t,n){return t?`Opening checkoutâ¦`:n?`Start ${n}-day trial`:`Choose ${e.name}`}function U(e){let t=e.period===`yearly`;return(0,y.jsxs)(`article`,{className:e.plan.plan===`sales_team`?`surface tp-card recommended`:`surface tp-card`,children:[e.plan.plan===`sales_team`?(0,y.jsx)(`span`,{className:`status-badge tp-badge`,children:`Recommended`}):null,(0,y.jsx)(`strong`,{className:e.plan.plan,children:e.plan.name}),(0,y.jsxs)(`h3`,{children:[(0,y.jsxs)(`span`,{className:`tp-price`,children:[`$`,V(e.plan,e.period)]},e.period),` `,(0,y.jsx)(`small`,{children:`/mo`})]}),(0,y.jsx)(`p`,{children:t?`$${e.plan.yearly} billed yearly`:`Billed monthly`}),(0,y.jsx)(`small`,{children:e.plan.tagline}),(0,y.jsx)(`ul`,{children:e.plan.features.map(e=>(0,y.jsxs)(`li`,{children:[(0,y.jsx)(r,{"aria-hidden":`true`}),e]},e))}),(0,y.jsxs)(`button`,{className:e.plan.plan===`sales_team`?`button btn-p button-wide`:`button btn-s button-wide`,disabled:e.disabled||e.pending,onClick:()=>e.choose(e.plan.plan),type:`button`,children:[H(e.plan,e.pending,e.trialDays),(0,y.jsx)(n,{"aria-hidden":`true`})]})]})}function W(e,t){e.setPeriod(`yearly`),e.setNotice(null),t()}async function G(e,t){let n=await m(e.workspaceId,e.token);[`trial`,`paid`,`legacy_exempt`].includes(n.access.stage)&&(await e.onCheckoutComplete(),t())}function K(e){function t(){W(n,e.close)}let n=P({initialPeriod:e.initialPeriod??`yearly`,...e.initialAddons?{initialAddons:e.initialAddons}:{},onCheckoutComplete:()=>G(e,t),onCheckoutOpened:t,token:e.token,workspaceId:e.workspaceId});return{actions:n,close:t}}function q(e){let t=F(e.capacityRequirement,e.actions.addons);return t.length?(0,y.jsx)(`div`,{className:`tp-grid`,children:t.map(t=>(0,y.jsx)(U,{choose:t=>{o(`lead_onboarding_upgrade_clicked`,{plan:t,period:e.actions.period}
1),e.actions.checkout(t,{senders:e.addonSenders,workspaces:e.addonWorkspaces,leadPacks:e.addonLeadPacks})},disabled:e.disabled,pending:e.actions.pending===`checkout`,period:e.actions.period,plan:t,trialDays:x(e.trialOffer,t.plan)},t.plan))}):(0,y.jsx)(_,{tone:`info`,children:`Increase the relevant add-on quantity above to make room for the additional capacity.`})}function J(e){let t=(0,v.useRef)(null);return(0,v.useEffect)(()=>{t.current?.focus()},[e.message]),(0,y.jsx)(`div`,{className:`tp-error`,ref:t,tabIndex:-1,children:(0,y.jsx)(_,{tone:`error`,actions:e.retry?(0,y.jsx)(`button`,{className:`button btn-s`,onClick:e.retry,type:`button`,children:`Try again`}):void 0,children:e.message})})}function Y(e){return(0,y.jsxs)(`footer`,{className:`tp-footer`,children:[(0,y.jsx)(`span`,{children:e.pilotEligible?`Trial length shown on each plan · Cancel anytime`:e.trialEligible?`7-day trial · Cancel anytime`:`Cancel anytime`}),(0,y.jsx)(c,{className:`lr-action`,onClick:e.close,type:`button`,children:`Not now`})]})}function X({actions:e,close:t,eligibility:n,capacityRequirement:r}){let{trialEligible:i}=n;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:`sr-only`,children:i?`Choose a plan and billing period. Your free trial begins after secure card checkout. You are charged automatically when the trial ends unless you cancel.`:`Choose a plan and billing period to continue.`}),!i&&!n.checking&&!n.error?(0,y.jsx)(`div`,{className:`tp-addons`,children:(0,y.jsx)(R,{value:e.addons,change:e.setAddons,period:e.period,disabled:e.pending!==null})}):null,(0,y.jsx)(q,{capacityRequirement:r,addonSenders:e.addons.senders,addonWorkspaces:e.addons.workspaces,addonLeadPacks:e.addons.leadPacks,actions:e,disabled:n.checking||!!n.error,trialOffer:n.trialOffer}),n.checking?(0,y.jsx)(`p`,{className:`tp-error`,role:`status`,children:`Loading your planâ¦`}):null,n.error?(0,y.jsx)(J,{message:n.error,retry:n.retry}):null,e.notice?(0,y.jsx)(J,{message:e.notice}):null,(0,y.jsx)(Y,{close:t,trialEligible:i,pilotEligible:n.pilotEligible})]})}function Z(e){let{actions:t,close:n}=K(e),r=B(e);return u(`trial_cta_viewed`,e.open?e.workspaceId:null),(0,y.jsx)(l,{className:`tp-dialog`,close:n,headerAccessory:(0,y.jsx)(g,{className:`tp-period`,period:t.period,savingsLabel:`Save up to 25%`,savingsYearlyOnly:!0,setPeriod:t.setPeriod}),open:e.open,title:r.pilotEligible?`Your 21-day pilot`:r.trialEligible?`Choose your 7-day trial`:`Choose your plan`,children:(0,y.jsx)(X,{capacityRequirement:e.capacityRequirement,actions:t,close:n,eligibility:r})})}export{O as a,S as c,P as i,x as l,R as n,k as o,I as r,E as s,Z as t,b as u};
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.