@stigg/react-sdk 7.13.0 → 7.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4967,7 +4967,7 @@ ${e.o5f}`,e.zBW=r.default`
4967
4967
  display: flex;
4968
4968
  flex-direction: column;
4969
4969
  align-items: center;
4970
- `,_S=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:c,onPlanSelected:p,paywallLocale:h,locale:v,shouldHidePlan:P,selectDefaultTierIndex:x,currentSubscriptionOverride:T,hideCompatibleAddons:I,showWatermark:R})=>{let A=SS(t),O=t.some(Y=>!!Y.description),N=jb(t,xe.Monthly),V=jb(t,xe.Annually),G=ES(t,i,P),X=Bv.useCallback((Y,at,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:at,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),nt=!!n&&n.plan.pricingType===On.Custom,st=Bv.useMemo(()=>G.some(Y=>{var dt;let at=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(dt=Y.paywallCalculatedPricePoints)==null?void 0:dt.find(mt=>mt.billingPeriod===i);return at.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,G]),U=Bv.useMemo(()=>G.some(Y=>!!dm(Y,i,h,v,N).unit),[i,N,v,h,G]),j=Bv.useMemo(()=>!nt&&G.some(Y=>{let at=um({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:T});return Object.values(at).length>0}),[i,n,T,nt,G]),ut=G.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsxRuntime.jsx(hA,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(mA,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(yS,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:A}),jsxRuntime.jsx(fA,{className:"stigg-paywall-plans-layout",children:G.map(Y=>jsxRuntime.jsx(mS,{withUnitPriceRow:U,withTiersRow:j,withTrialLeftRow:ut,shouldShowDescriptionSection:O,hasMonthlyPrice:N,hasAnnuallyPrice:V,plan:Y,withStartingAtRow:st,currentSubscription:n,currentSubscriptionOverride:T,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:c,onPlanSelected:(at,pt)=>X(Y,at,pt),paywallLocale:h,locale:v,customer:e,isCustomerInCustomPlan:nt,selectDefaultTierIndex:x,hideCompatibleAddons:I},Y.id))}),jsxRuntime.jsx(so,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:R})]})})};var zb=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},tl=new zb;function TS(t,e,n){let r=t.flatMap(c=>c.pricePoints).map(c=>c.billingPeriod),i=lodash.countBy(r),o=lodash.uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let c=e.find(p=>p.status===bi.Active);c&&c.prices.length>0&&(s=c==null?void 0:c.prices[0].billingPeriod);}return s||(s=(i[xe.Monthly]||0)>(i[xe.Annually]||0)?xe.Monthly:xe.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function IS(t){return $1__default.default.utc(t).diff($1__default.default.utc(),"days",false)+1}var hm={h1:{fontSize:"24px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"16px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};function el(t,e="px"){if(t)return `${t}${e}`}function mm(t){if(!t)return "normal";switch(t){case gb.Normal:return "normal";case gb.Bold:return "bold";default:return "normal"}}function Gp(t,e){var r,i,o,s,c,p,h,v;let n=e||{h1:{fontSize:"32px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"24px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};return {fontFamilyUrl:(t==null?void 0:t.fontFamily)||void 0,h1:{fontSize:el((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:mm((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:el((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:mm((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:el((c=t==null?void 0:t.h3)==null?void 0:c.fontSize)||n.h3.fontSize,fontWeight:mm((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:el((h=t==null?void 0:t.body)==null?void 0:h.fontSize)||n.body.fontSize,fontWeight:mm((v=t==null?void 0:t.body)==null?void 0:v.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Hb(t){if(t)switch(t){case tm.Left:return "left";case tm.Center:return "center";case tm.Right:return "right";default:return}}function kS(t){let{palette:e,customCss:n,typography:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.paywallBackgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(r),customCss:n||void 0}}function DS(t){let{palette:e,layout:n,customCss:r,typography:i}=t;return {customCss:r||void 0,palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(i),layout:{ctaAlignment:Hb(n==null?void 0:n.alignment),headerAlignment:Hb(n==null?void 0:n.alignment),descriptionAlignment:Hb(n==null?void 0:n.alignment),planMaxWidth:el(n==null?void 0:n.planWidth),planMinWidth:el(n==null?void 0:n.planWidth),planMargin:el(n==null?void 0:n.planMargin),planPadding:el(n==null?void 0:n.planPadding)}}}function AS(t){let{palette:e,typography:n,customCss:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0},backgroundHighlight:(e==null?void 0:e.summaryBackgroundColor)||void 0},typography:Gp(n,hm),customCss:r||void 0}}function CA(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===bi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?IS(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===bi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function RS(t,e,n){var G,X;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:c,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:h,currentPlan:v,isCustomerOnTrial:P,trialDaysLeft:x}=CA(c),T=n==null?void 0:n({currentSubscription:h}),I=(h==null?void 0:h.scheduledUpdates)||[],R=(G=h==null?void 0:h.price)==null?void 0:G.billingPeriod,A=I.find(({subscriptionScheduleType:nt})=>nt===Ui.Downgrade),O=I.find(({subscriptionScheduleType:nt})=>nt===Ui.BillingPeriod),N=px__default.default(r,nt=>nt.order).map(nt=>{var ut;let st=(ut=s==null?void 0:s.eligibleForTrial)==null?void 0:ut.find(Y=>Y.productId===nt.product.id),U=T!=null&&T.planId?(T==null?void 0:T.planId)===nt.id:nt.id===(v==null?void 0:v.id),j=Y=>{var mt;let at=A==null?void 0:A.scheduleVariables,pt=O==null?void 0:O.scheduleVariables,dt=nt.pricePoints.some(Ct=>Ct.billingPeriod===Y);return A?((mt=A.targetPackage)==null?void 0:mt.refId)===nt.id&&(!dt||at.billingPeriod===Y):O&&U?pt.billingPeriod===Y:false};return Pt(W({},nt),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===nt.id),isTriable:!cm__default.default(nt.defaultTrialConfig)&&(!st||st.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:R,isUpcomingPlan:false,trialDaysLeft:x,isNextPlan:j,paywallCurrency:i,scheduledUpdate:A||O})});if(r&&v){let nt=v&&((X=r==null?void 0:r.find(st=>st.id===(v==null?void 0:v.id)))==null?void 0:X.order);cm__default.default(nt)||(N=N.map(st=>Pt(W({},st),{isLowerThanCurrentPlan:nt>st.order})),e&&(N=N.filter(st=>st.order>=nt)));}let V=o?DS(o):void 0;return {currentPlan:v,currentSubscription:h,currentSubscriptionOverride:T,isCustomerOnTrial:P,plans:N,paywallConfiguration:V}}var MS="7.13.0";var NS="@stigg/react-sdk";var jp=Bv__default.default.createContext(null);jp.displayName="StiggContext";var _A="en-US",TA=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:c,locale:p,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,entitlementsFallback:x,stiggClient:T,children:I,offline:R,clientName:A=NS,clientVersion:O=MS})=>{let N=Bv.useRef(t),V={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:x,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,clientName:A,clientVersion:O,offline:R},[G,X]=Bv.useState(()=>({stigg:T!=null?T:bb.initialize(Pt(W({},V),{lazyLoad:true})),locale:p||_A,isInitialized:false,theme:c,refreshData:()=>ce(null,null,function*(){X(nt=>Pt(W({},nt),{customerPortalUpdatedAt:new Date})),yield G.stigg.refresh();})}));return Bv.useEffect(()=>{let nt=true,st=Y=>{nt&&X(Y);},U=()=>st(Y=>Pt(W({},Y),{updatedAt:new Date})),j=Y=>st(at=>(at.stigg&&at.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),Pt(W({},at),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ce(null,null,function*(){let Y=G.stigg;t!==N.current&&(tl.log("Updating stigg client",{apiKey:t}),N.current=t,Y=bb.initialize(W({},V)),st(at=>Pt(W({},at),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),j(Y);}),()=>{nt=false,G.stigg.removeListener("entitlementsUpdated",U),G.stigg.clearCustomer();}},[t]),Bv.useEffect(()=>{let nt=G.stigg;i?nt.setCustomerId(i,o,s):nt.clearCustomer();},[i,o,s]),Bv.useEffect(()=>{X(nt=>Pt(W({},nt),{theme:c}));},[c]),jsxRuntime.jsx(jp.Provider,{value:G,children:jsxRuntime.jsx(nl.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:I})})};function be(t){let{optional:e}=t||{},n=Bv.useContext(jp);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function BS({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:c}=be(),[p,h]=Bv.useState(xe.Annually),[v,P]=Bv.useState([]),[x,T]=Bv.useState(null),[I,R]=Bv.useState(true);Bv.useEffect(()=>{ce(null,null,function*(){try{R(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:V,defaultBillingPeriod:G}=TS(N.plans,N.activeSubscriptions,i);T(N),P(V),h(G);}catch(N){tl.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{R(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let A=RS(x,n,o);return W({customer:(x==null?void 0:x.customer)||null,isLoading:I,selectedBillingPeriod:p,setSelectedBillingPeriod:h,availableBillingPeriods:v,locale:c,configuration:A.paywallConfiguration,showWatermark:s.getShowWatermark()},A)}function US(t){return zD__default.default({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:n=>{var r;return `Start ${(r=n.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:n=>n===xe.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===xe.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var DA=t=>jsxRuntime.jsx("svg",Pt(W({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:jsxRuntime.jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),GS=DA;var AA=Q.div`
4970
+ `,_S=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:c,onPlanSelected:p,paywallLocale:h,locale:v,shouldHidePlan:P,selectDefaultTierIndex:x,currentSubscriptionOverride:T,hideCompatibleAddons:I,showWatermark:R})=>{let A=SS(t),O=t.some(Y=>!!Y.description),N=jb(t,xe.Monthly),V=jb(t,xe.Annually),G=ES(t,i,P),X=Bv.useCallback((Y,at,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:at,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),nt=!!n&&n.plan.pricingType===On.Custom,st=Bv.useMemo(()=>G.some(Y=>{var dt;let at=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(dt=Y.paywallCalculatedPricePoints)==null?void 0:dt.find(mt=>mt.billingPeriod===i);return at.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,G]),U=Bv.useMemo(()=>G.some(Y=>!!dm(Y,i,h,v,N).unit),[i,N,v,h,G]),j=Bv.useMemo(()=>!nt&&G.some(Y=>{let at=um({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:T});return Object.values(at).length>0}),[i,n,T,nt,G]),ut=G.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsxRuntime.jsx(hA,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(mA,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(yS,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:A}),jsxRuntime.jsx(fA,{className:"stigg-paywall-plans-layout",children:G.map(Y=>jsxRuntime.jsx(mS,{withUnitPriceRow:U,withTiersRow:j,withTrialLeftRow:ut,shouldShowDescriptionSection:O,hasMonthlyPrice:N,hasAnnuallyPrice:V,plan:Y,withStartingAtRow:st,currentSubscription:n,currentSubscriptionOverride:T,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:c,onPlanSelected:(at,pt)=>X(Y,at,pt),paywallLocale:h,locale:v,customer:e,isCustomerInCustomPlan:nt,selectDefaultTierIndex:x,hideCompatibleAddons:I},Y.id))}),jsxRuntime.jsx(so,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:R})]})})};var zb=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},tl=new zb;function TS(t,e,n){let r=t.flatMap(c=>c.pricePoints).map(c=>c.billingPeriod),i=lodash.countBy(r),o=lodash.uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let c=e.find(p=>p.status===bi.Active);c&&c.prices.length>0&&(s=c==null?void 0:c.prices[0].billingPeriod);}return s||(s=(i[xe.Monthly]||0)>(i[xe.Annually]||0)?xe.Monthly:xe.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function IS(t){return $1__default.default.utc(t).diff($1__default.default.utc(),"days",false)+1}var hm={h1:{fontSize:"24px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"16px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};function el(t,e="px"){if(t)return `${t}${e}`}function mm(t){if(!t)return "normal";switch(t){case gb.Normal:return "normal";case gb.Bold:return "bold";default:return "normal"}}function Gp(t,e){var r,i,o,s,c,p,h,v;let n=e||{h1:{fontSize:"32px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"24px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};return {fontFamilyUrl:(t==null?void 0:t.fontFamily)||void 0,h1:{fontSize:el((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:mm((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:el((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:mm((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:el((c=t==null?void 0:t.h3)==null?void 0:c.fontSize)||n.h3.fontSize,fontWeight:mm((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:el((h=t==null?void 0:t.body)==null?void 0:h.fontSize)||n.body.fontSize,fontWeight:mm((v=t==null?void 0:t.body)==null?void 0:v.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Hb(t){if(t)switch(t){case tm.Left:return "left";case tm.Center:return "center";case tm.Right:return "right";default:return}}function kS(t){let{palette:e,customCss:n,typography:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.paywallBackgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(r),customCss:n||void 0}}function DS(t){let{palette:e,layout:n,customCss:r,typography:i}=t;return {customCss:r||void 0,palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(i),layout:{ctaAlignment:Hb(n==null?void 0:n.alignment),headerAlignment:Hb(n==null?void 0:n.alignment),descriptionAlignment:Hb(n==null?void 0:n.alignment),planMaxWidth:el(n==null?void 0:n.planWidth),planMinWidth:el(n==null?void 0:n.planWidth),planMargin:el(n==null?void 0:n.planMargin),planPadding:el(n==null?void 0:n.planPadding)}}}function AS(t){let{palette:e,typography:n,customCss:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0},backgroundHighlight:(e==null?void 0:e.summaryBackgroundColor)||void 0},typography:Gp(n,hm),customCss:r||void 0}}function CA(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===bi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?IS(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===bi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function RS(t,e,n){var G,X;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:c,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:h,currentPlan:v,isCustomerOnTrial:P,trialDaysLeft:x}=CA(c),T=n==null?void 0:n({currentSubscription:h}),I=(h==null?void 0:h.scheduledUpdates)||[],R=(G=h==null?void 0:h.price)==null?void 0:G.billingPeriod,A=I.find(({subscriptionScheduleType:nt})=>nt===Ui.Downgrade),O=I.find(({subscriptionScheduleType:nt})=>nt===Ui.BillingPeriod),N=px__default.default(r,nt=>nt.order).map(nt=>{var ut;let st=(ut=s==null?void 0:s.eligibleForTrial)==null?void 0:ut.find(Y=>Y.productId===nt.product.id),U=T!=null&&T.planId?(T==null?void 0:T.planId)===nt.id:nt.id===(v==null?void 0:v.id),j=Y=>{var mt;let at=A==null?void 0:A.scheduleVariables,pt=O==null?void 0:O.scheduleVariables,dt=nt.pricePoints.some(Ct=>Ct.billingPeriod===Y);return A?((mt=A.targetPackage)==null?void 0:mt.refId)===nt.id&&(!dt||at.billingPeriod===Y):O&&U?pt.billingPeriod===Y:false};return Pt(W({},nt),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===nt.id),isTriable:!cm__default.default(nt.defaultTrialConfig)&&(!st||st.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:R,isUpcomingPlan:false,trialDaysLeft:x,isNextPlan:j,paywallCurrency:i,scheduledUpdate:A||O})});if(r&&v){let nt=v&&((X=r==null?void 0:r.find(st=>st.id===(v==null?void 0:v.id)))==null?void 0:X.order);cm__default.default(nt)||(N=N.map(st=>Pt(W({},st),{isLowerThanCurrentPlan:nt>st.order})),e&&(N=N.filter(st=>st.order>=nt)));}let V=o?DS(o):void 0;return {currentPlan:v,currentSubscription:h,currentSubscriptionOverride:T,isCustomerOnTrial:P,plans:N,paywallConfiguration:V}}var MS="7.14.0";var NS="@stigg/react-sdk";var jp=Bv__default.default.createContext(null);jp.displayName="StiggContext";var _A="en-US",TA=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:c,locale:p,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,entitlementsFallback:x,stiggClient:T,children:I,offline:R,clientName:A=NS,clientVersion:O=MS})=>{let N=Bv.useRef(t),V={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:x,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,clientName:A,clientVersion:O,offline:R},[G,X]=Bv.useState(()=>({stigg:T!=null?T:bb.initialize(Pt(W({},V),{lazyLoad:true})),locale:p||_A,isInitialized:false,theme:c,refreshData:()=>ce(null,null,function*(){X(nt=>Pt(W({},nt),{customerPortalUpdatedAt:new Date})),yield G.stigg.refresh();})}));return Bv.useEffect(()=>{let nt=true,st=Y=>{nt&&X(Y);},U=()=>st(Y=>Pt(W({},Y),{updatedAt:new Date})),j=Y=>st(at=>(at.stigg&&at.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),Pt(W({},at),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ce(null,null,function*(){let Y=G.stigg;t!==N.current&&(tl.log("Updating stigg client",{apiKey:t}),N.current=t,Y=bb.initialize(W({},V)),st(at=>Pt(W({},at),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),j(Y);}),()=>{nt=false,G.stigg.removeListener("entitlementsUpdated",U),G.stigg.clearCustomer();}},[t]),Bv.useEffect(()=>{let nt=G.stigg;i?nt.setCustomerId(i,o,s):nt.clearCustomer();},[i,o,s]),Bv.useEffect(()=>{X(nt=>Pt(W({},nt),{theme:c}));},[c]),jsxRuntime.jsx(jp.Provider,{value:G,children:jsxRuntime.jsx(nl.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:I})})};function be(t){let{optional:e}=t||{},n=Bv.useContext(jp);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function BS({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:c}=be(),[p,h]=Bv.useState(xe.Annually),[v,P]=Bv.useState([]),[x,T]=Bv.useState(null),[I,R]=Bv.useState(true);Bv.useEffect(()=>{ce(null,null,function*(){try{R(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:V,defaultBillingPeriod:G}=TS(N.plans,N.activeSubscriptions,i);T(N),P(V),h(G);}catch(N){tl.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{R(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let A=RS(x,n,o);return W({customer:(x==null?void 0:x.customer)||null,isLoading:I,selectedBillingPeriod:p,setSelectedBillingPeriod:h,availableBillingPeriods:v,locale:c,configuration:A.paywallConfiguration,showWatermark:s.getShowWatermark()},A)}function US(t){return zD__default.default({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:n=>{var r;return `Start ${(r=n.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:n=>n===xe.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===xe.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var DA=t=>jsxRuntime.jsx("svg",Pt(W({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:jsxRuntime.jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),GS=DA;var AA=Q.div`
4971
4971
  display: flex;
4972
4972
  flex-direction: column;
4973
4973
  align-items: center;
@@ -5470,7 +5470,7 @@ ${e.o5f}`,e.zBW=r.default`
5470
5470
  margin: 16px 0;
5471
5471
  `,d_=Q(rt)`
5472
5472
  margin-bottom: 8px;
5473
- `;function OL({isLastStep:t,checkoutHasChanges:e,isFreeDowngrade:n,checkoutLocalization:r,isPlanUpdate:i}){return t?e?i?r.checkoutButton.updateText:n?r.checkoutButton.downgradeToFreeText:r.checkoutButton.upgradeText:r.checkoutButton.noChangesText:r.checkoutButton.nextText}var f_=({onCheckout:t,onCheckoutCompleted:e,disablePromotionCode:n,disableSuccessAnimation:r,isFreeDowngrade:i,onMockCheckoutPreview:o,showWatermark:s})=>{var Gn,sn,Ke,un,or;let[c,p]=Bv.useState(false),{setErrorMessage:h,useNewPaymentMethod:v}=Pi(),P=ha(),x=Yu(),{checkoutState:T,checkoutLocalization:I,checkoutSuccess:R,widgetState:A}=ze(),{plan:O,activeSubscription:N}=T||{},V=ng(((Gn=O==null?void 0:O.pricePoints)==null?void 0:Gn.filter(_e=>_e.billingPeriod===x.billingPeriod))||[]),[G,X]=TL__default.default(V,_e=>_e.pricingModel===yn.FlatFee),nt=G[0],st=i||P.isCheckoutComplete&&P.isLastStep,{isZuoraIntegration:U}=Ku(),j=c||R,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y}=yE({onMockCheckoutPreview:o}),{handleSubmit:at,isLoading:pt}=XE({isMocked:!!o,disableSuccessAnimation:r,onCheckout:t,onCheckoutCompleted:e,onSuccess:()=>{p(true),P.markStepAsCompleted(P.progressBarState.activeStep);}}),{handleZuoraSubmit:dt}=ug({onCheckout:t,onCheckoutCompleted:e,disableSuccessAnimation:r,onSuccess:()=>{P.markStepAsCompleted(P.progressBarState.activeStep);}}),mt=_e=>ce(null,null,function*(){if(j)return;let De;U&&!v?De=yield dt():De=yield at(_e);let{errorMessage:vr}=De||{};vr?(h(vr),p(false)):h(void 0);}),Ct=U&&!v?A.readOnly:pt,jt=_e=>ce(null,null,function*(){Ct||(st?yield mt(_e):P.goNext());}),{immediateInvoice:Gt,recurringInvoice:Jt}=ut||{},ee=!!ut&&(!!(Gt!=null&&Gt.proration)||!!ut.hasScheduledUpdates),re=!n&&!i&&!U,Ee=!!(Jt!=null&&Jt.discountDetails)&&!i,je=re||Ee,an=X.some(_e=>_e.pricingModel===yn.UsageBased),Ze=an&&!nt&&X.every(_e=>_e.pricingModel===yn.UsageBased),Pn=typeof I.summary.baseChargeText=="function"?I.summary.baseChargeText({billingPeriod:x.billingPeriod}):I.summary.baseChargeText;return jsxRuntime.jsxs(qv,{children:[jsxRuntime.jsxs(hg,{children:[jsxRuntime.jsx(AL,{variant:"h3",children:I.summary.title}),jsxRuntime.jsxs(da__default.default,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.planName({plan:O})}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),nt&&jsxRuntime.jsx(fg,{checkoutLocalization:I,label:Pn,quantity:1,price:nt}),!nt&&i?jsxRuntime.jsx(s_,{label:Pn}):null,jsxRuntime.jsx(da__default.default,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:X.map(_e=>{var vr,Ve,bt,ar,sr;let De=(vr=x.billableFeatures)==null?void 0:vr.find(Jn=>{var lr;return Jn.featureId===((lr=_e.feature)==null?void 0:lr.featureId)});return jsxRuntime.jsx(fg,{checkoutLocalization:I,label:Wp(((bt=_e.feature)==null?void 0:bt.displayName)||"",(ar=_e.feature)==null?void 0:ar.units,(sr=_e.feature)==null?void 0:sr.unitsPlural),quantity:(De==null?void 0:De.quantity)||1,price:_e},(Ve=_e.feature)==null?void 0:Ve.featureId)})}),!!((sn=x.addons)!=null&&sn.length)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.addonsSectionTitle}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),x.addons.map(_e=>{var Ve,bt;let De=(Ve=_e.addon.pricePoints)==null?void 0:Ve.find(ar=>ar.billingPeriod===x.billingPeriod);if(!De)return null;let vr=_e.quantity&&_e.quantity>0?_e.quantity:1;return jsxRuntime.jsx(fg,{checkoutLocalization:I,label:_e.addon.displayName,quantity:vr,price:De},(bt=_e==null?void 0:_e.addon)==null?void 0:bt.id)})]}),!je&&jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"}),je&&jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.discountsSectionTitle}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),re&&jsxRuntime.jsx(GE,{disabled:Ct||Y,checkoutLocalization:I,onMockCheckoutPreview:o}),Ee&&ut&&jsxRuntime.jsx(l_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),je&&jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"}),jsxRuntime.jsx(u_,{tax:Jt==null?void 0:Jt.tax,taxDetails:Jt==null?void 0:Jt.taxDetails,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),i?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lo,{style:{marginTop:16},children:jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"column",container:true,children:[jsxRuntime.jsxs(da__default.default,{item:true,display:"flex",justifyContent:"space-between",children:[jsxRuntime.jsx(rt,{variant:"h6",children:I.summary.totalText}),jsxRuntime.jsx(rt,{variant:"h6",children:jsxRuntime.jsxs(No,{isLoading:Y,children:[Ze?I.summary.onlyPayAsYouGoText:null,!Ze&&an?I.summary.startsAtText:null,Ze?null:Rn(Pt(W({amount:0},Jt==null?void 0:Jt.total),{minimumFractionDigits:2}))]})})]}),jsxRuntime.jsx(da__default.default,{item:true,children:jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:I.summary.totalBillingPeriodText({billingPeriod:x.billingPeriod})})})]})}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"})]}),(Ke=Gt==null?void 0:Gt.proration)!=null&&Ke.hasProrations&&(Gt!=null&&Gt.subTotal)&&(Gt==null?void 0:Gt.subTotal.amount)>0?jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs(Lo,{children:[jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:I.summary.proratedTotalDueText}),jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:jsxRuntime.jsx(No,{isLoading:Y,children:Rn({amount:Number(((un=Gt==null?void 0:Gt.subTotal)==null?void 0:un.amount)||0)+Number(((or=Gt==null?void 0:Gt.tax)==null?void 0:or.amount)||0),currency:Gt==null?void 0:Gt.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsxRuntime.jsx(c_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs(Lo,{children:[jsxRuntime.jsx(d_,{variant:"h6",children:I.summary.totalDueText}),jsxRuntime.jsx(d_,{variant:"h6",children:jsxRuntime.jsx(No,{isLoading:Y,children:Rn(Pt(W({amount:0},Gt==null?void 0:Gt.total),{minimumFractionDigits:2}))})})]})}),jsxRuntime.jsx(r_,{plan:O,activeSubscription:N,subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I,billingPeriod:x.billingPeriod}),(!st||!U||U&&!v)&&jsxRuntime.jsx($i,{$success:j,$error:st&&i,disabled:Ct||Y||P.progressBarState.isDisabled||st&&!ee,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:_e=>{jt(_e);},fullWidth:true,children:jsxRuntime.jsx(rt,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:j?jsxRuntime.jsx(qn,{icon:"Check",style:{display:"contents"}}):Ct||Y?jsxRuntime.jsx(_3__default.default,{size:20,sx:{color:"white"}}):OL({isLastStep:st,checkoutHasChanges:ee,isFreeDowngrade:i,checkoutLocalization:I,isPlanUpdate:!!N&&(N==null?void 0:N.plan.id)===(O==null?void 0:O.id)})})})]}),jsxRuntime.jsx(so,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&j&&jsxRuntime.jsx(KE,{checkoutLocalization:I})]})};var h_=({showWatermark:t})=>jsxRuntime.jsxs(qv,{children:[jsxRuntime.jsxs(hg,{children:[jsxRuntime.jsxs(uc,{$flexDirection:"column",$gap:24,children:[jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20})]}),jsxRuntime.jsxs(uc,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsxRuntime.jsx(Un,{height:20}),jsxRuntime.jsx(Un,{height:20}),jsxRuntime.jsx(Un,{height:20})]}),jsxRuntime.jsx(Lp,{flex:1,marginTop:5,children:jsxRuntime.jsx(Un,{height:34})})]}),jsxRuntime.jsx(so,{source:"checkout",showWatermark:t,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var g_=Q(da__default.default)`
5473
+ `;function OL({isLastStep:t,checkoutHasChanges:e,isFreeDowngrade:n,checkoutLocalization:r,isPlanUpdate:i}){return t?e?i?r.checkoutButton.updateText:n?r.checkoutButton.downgradeToFreeText:r.checkoutButton.upgradeText:r.checkoutButton.noChangesText:r.checkoutButton.nextText}var f_=({onCheckout:t,onCheckoutCompleted:e,disablePromotionCode:n,disableSuccessAnimation:r,isFreeDowngrade:i,onMockCheckoutPreview:o,showWatermark:s})=>{var Gn,sn,Ke,un,or;let[c,p]=Bv.useState(false),{setErrorMessage:h,useNewPaymentMethod:v}=Pi(),P=ha(),x=Yu(),{checkoutState:T,checkoutLocalization:I,checkoutSuccess:R,widgetState:A}=ze(),{plan:O,activeSubscription:N}=T||{},V=ng(((Gn=O==null?void 0:O.pricePoints)==null?void 0:Gn.filter(_e=>_e.billingPeriod===x.billingPeriod))||[]),[G,X]=TL__default.default(V,_e=>_e.pricingModel===yn.FlatFee),nt=G[0],st=i||P.isCheckoutComplete&&P.isLastStep,{isZuoraIntegration:U}=Ku(),j=c||R,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y}=yE({onMockCheckoutPreview:o}),{handleSubmit:at,isLoading:pt}=XE({isMocked:!!o,disableSuccessAnimation:r,onCheckout:t,onCheckoutCompleted:e,onSuccess:()=>{p(true),P.markStepAsCompleted(P.progressBarState.activeStep);}}),{handleZuoraSubmit:dt}=ug({onCheckout:t,onCheckoutCompleted:e,disableSuccessAnimation:r,onSuccess:()=>{P.markStepAsCompleted(P.progressBarState.activeStep);}}),mt=_e=>ce(null,null,function*(){if(j)return;let De;U&&!v?De=yield dt():De=yield at(_e);let{errorMessage:vr}=De||{};vr?(h(vr),p(false)):h(void 0);}),Ct=U&&!v?A.readOnly:pt,jt=_e=>ce(null,null,function*(){Ct||(st?yield mt(_e):P.goNext());}),{immediateInvoice:Gt,recurringInvoice:Jt}=ut||{},ee=!!ut&&(!!(Gt!=null&&Gt.proration)||!!ut.hasScheduledUpdates),re=!n&&!i&&!U,Ee=!!(Jt!=null&&Jt.discountDetails)&&!i,je=re||Ee,an=X.some(_e=>_e.pricingModel===yn.UsageBased),Ze=an&&!nt&&X.every(_e=>_e.pricingModel===yn.UsageBased),Pn=typeof I.summary.baseChargeText=="function"?I.summary.baseChargeText({billingPeriod:x.billingPeriod}):I.summary.baseChargeText;return jsxRuntime.jsxs(qv,{className:"stigg-checkout-summary-container",children:[jsxRuntime.jsxs(hg,{children:[jsxRuntime.jsx(AL,{variant:"h3",children:I.summary.title}),jsxRuntime.jsxs(da__default.default,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.planName({plan:O})}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),nt&&jsxRuntime.jsx(fg,{checkoutLocalization:I,label:Pn,quantity:1,price:nt}),!nt&&i?jsxRuntime.jsx(s_,{label:Pn}):null,jsxRuntime.jsx(da__default.default,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:X.map(_e=>{var vr,Ve,bt,ar,sr;let De=(vr=x.billableFeatures)==null?void 0:vr.find(Jn=>{var lr;return Jn.featureId===((lr=_e.feature)==null?void 0:lr.featureId)});return jsxRuntime.jsx(fg,{checkoutLocalization:I,label:Wp(((bt=_e.feature)==null?void 0:bt.displayName)||"",(ar=_e.feature)==null?void 0:ar.units,(sr=_e.feature)==null?void 0:sr.unitsPlural),quantity:(De==null?void 0:De.quantity)||1,price:_e},(Ve=_e.feature)==null?void 0:Ve.featureId)})}),!!((sn=x.addons)!=null&&sn.length)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.addonsSectionTitle}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),x.addons.map(_e=>{var Ve,bt;let De=(Ve=_e.addon.pricePoints)==null?void 0:Ve.find(ar=>ar.billingPeriod===x.billingPeriod);if(!De)return null;let vr=_e.quantity&&_e.quantity>0?_e.quantity:1;return jsxRuntime.jsx(fg,{checkoutLocalization:I,label:_e.addon.displayName,quantity:vr,price:De},(bt=_e==null?void 0:_e.addon)==null?void 0:bt.id)})]}),!je&&jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"}),je&&jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.discountsSectionTitle}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),re&&jsxRuntime.jsx(GE,{disabled:Ct||Y,checkoutLocalization:I,onMockCheckoutPreview:o}),Ee&&ut&&jsxRuntime.jsx(l_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),je&&jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"}),jsxRuntime.jsx(u_,{tax:Jt==null?void 0:Jt.tax,taxDetails:Jt==null?void 0:Jt.taxDetails,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),i?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Lo,{style:{marginTop:16},children:jsxRuntime.jsxs(da__default.default,{display:"flex",flexDirection:"column",container:true,children:[jsxRuntime.jsxs(da__default.default,{item:true,display:"flex",justifyContent:"space-between",children:[jsxRuntime.jsx(rt,{variant:"h6",children:I.summary.totalText}),jsxRuntime.jsx(rt,{variant:"h6",children:jsxRuntime.jsxs(No,{isLoading:Y,children:[Ze?I.summary.onlyPayAsYouGoText:null,!Ze&&an?I.summary.startsAtText:null,Ze?null:Rn(Pt(W({amount:0},Jt==null?void 0:Jt.total),{minimumFractionDigits:2}))]})})]}),jsxRuntime.jsx(da__default.default,{item:true,children:jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:I.summary.totalBillingPeriodText({billingPeriod:x.billingPeriod})})})]})}),jsxRuntime.jsx(Xu,{className:"stigg-checkout-summary-divider"})]}),(Ke=Gt==null?void 0:Gt.proration)!=null&&Ke.hasProrations&&(Gt!=null&&Gt.subTotal)&&(Gt==null?void 0:Gt.subTotal.amount)>0?jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs(Lo,{children:[jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:I.summary.proratedTotalDueText}),jsxRuntime.jsx(rt,{variant:"body1",color:"secondary",children:jsxRuntime.jsx(No,{isLoading:Y,children:Rn({amount:Number(((un=Gt==null?void 0:Gt.subTotal)==null?void 0:un.amount)||0)+Number(((or=Gt==null?void 0:Gt.tax)==null?void 0:or.amount)||0),currency:Gt==null?void 0:Gt.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsxRuntime.jsx(c_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),jsxRuntime.jsx(ma,{children:jsxRuntime.jsxs(Lo,{children:[jsxRuntime.jsx(d_,{variant:"h6",children:I.summary.totalDueText}),jsxRuntime.jsx(d_,{variant:"h6",children:jsxRuntime.jsx(No,{isLoading:Y,children:Rn(Pt(W({amount:0},Gt==null?void 0:Gt.total),{minimumFractionDigits:2}))})})]})}),jsxRuntime.jsx(r_,{plan:O,activeSubscription:N,subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I,billingPeriod:x.billingPeriod}),(!st||!U||U&&!v)&&jsxRuntime.jsx($i,{$success:j,$error:st&&i,disabled:Ct||Y||P.progressBarState.isDisabled||st&&!ee,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:_e=>{jt(_e);},fullWidth:true,children:jsxRuntime.jsx(rt,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:j?jsxRuntime.jsx(qn,{icon:"Check",style:{display:"contents"}}):Ct||Y?jsxRuntime.jsx(_3__default.default,{size:20,sx:{color:"white"}}):OL({isLastStep:st,checkoutHasChanges:ee,isFreeDowngrade:i,checkoutLocalization:I,isPlanUpdate:!!N&&(N==null?void 0:N.plan.id)===(O==null?void 0:O.id)})})})]}),jsxRuntime.jsx(so,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&j&&jsxRuntime.jsx(KE,{checkoutLocalization:I})]})};var h_=({showWatermark:t})=>jsxRuntime.jsxs(qv,{children:[jsxRuntime.jsxs(hg,{children:[jsxRuntime.jsxs(uc,{$flexDirection:"column",$gap:24,children:[jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20}),jsxRuntime.jsx(Un,{width:120,height:20})]}),jsxRuntime.jsxs(uc,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsxRuntime.jsx(Un,{height:20}),jsxRuntime.jsx(Un,{height:20}),jsxRuntime.jsx(Un,{height:20})]}),jsxRuntime.jsx(Lp,{flex:1,marginTop:5,children:jsxRuntime.jsx(Un,{height:34})})]}),jsxRuntime.jsx(so,{source:"checkout",showWatermark:t,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var g_=Q(da__default.default)`
5474
5474
  width: 100%;
5475
5475
  gap: 8px;
5476
5476
  `,y_=Q(da__default.default)`
@@ -4967,7 +4967,7 @@ ${e.o5f}`,e.zBW=r.default`
4967
4967
  display: flex;
4968
4968
  flex-direction: column;
4969
4969
  align-items: center;
4970
- `,_S=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:c,onPlanSelected:p,paywallLocale:h,locale:v,shouldHidePlan:P,selectDefaultTierIndex:x,currentSubscriptionOverride:T,hideCompatibleAddons:I,showWatermark:R})=>{let A=SS(t),O=t.some(Y=>!!Y.description),N=jb(t,xe.Monthly),V=jb(t,xe.Annually),G=ES(t,i,P),X=useCallback((Y,at,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:at,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),nt=!!n&&n.plan.pricingType===On.Custom,st=useMemo(()=>G.some(Y=>{var dt;let at=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(dt=Y.paywallCalculatedPricePoints)==null?void 0:dt.find(mt=>mt.billingPeriod===i);return at.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,G]),U=useMemo(()=>G.some(Y=>!!dm(Y,i,h,v,N).unit),[i,N,v,h,G]),j=useMemo(()=>!nt&&G.some(Y=>{let at=um({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:T});return Object.values(at).length>0}),[i,n,T,nt,G]),ut=G.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsx(hA,{className:"stigg-paywall-container",children:jsxs(mA,{className:"stigg-paywall-layout",children:[jsx(yS,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:A}),jsx(fA,{className:"stigg-paywall-plans-layout",children:G.map(Y=>jsx(mS,{withUnitPriceRow:U,withTiersRow:j,withTrialLeftRow:ut,shouldShowDescriptionSection:O,hasMonthlyPrice:N,hasAnnuallyPrice:V,plan:Y,withStartingAtRow:st,currentSubscription:n,currentSubscriptionOverride:T,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:c,onPlanSelected:(at,pt)=>X(Y,at,pt),paywallLocale:h,locale:v,customer:e,isCustomerInCustomPlan:nt,selectDefaultTierIndex:x,hideCompatibleAddons:I},Y.id))}),jsx(so,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:R})]})})};var zb=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},tl=new zb;function TS(t,e,n){let r=t.flatMap(c=>c.pricePoints).map(c=>c.billingPeriod),i=countBy(r),o=uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let c=e.find(p=>p.status===bi.Active);c&&c.prices.length>0&&(s=c==null?void 0:c.prices[0].billingPeriod);}return s||(s=(i[xe.Monthly]||0)>(i[xe.Annually]||0)?xe.Monthly:xe.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function IS(t){return $1.utc(t).diff($1.utc(),"days",false)+1}var hm={h1:{fontSize:"24px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"16px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};function el(t,e="px"){if(t)return `${t}${e}`}function mm(t){if(!t)return "normal";switch(t){case gb.Normal:return "normal";case gb.Bold:return "bold";default:return "normal"}}function Gp(t,e){var r,i,o,s,c,p,h,v;let n=e||{h1:{fontSize:"32px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"24px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};return {fontFamilyUrl:(t==null?void 0:t.fontFamily)||void 0,h1:{fontSize:el((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:mm((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:el((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:mm((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:el((c=t==null?void 0:t.h3)==null?void 0:c.fontSize)||n.h3.fontSize,fontWeight:mm((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:el((h=t==null?void 0:t.body)==null?void 0:h.fontSize)||n.body.fontSize,fontWeight:mm((v=t==null?void 0:t.body)==null?void 0:v.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Hb(t){if(t)switch(t){case tm.Left:return "left";case tm.Center:return "center";case tm.Right:return "right";default:return}}function kS(t){let{palette:e,customCss:n,typography:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.paywallBackgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(r),customCss:n||void 0}}function DS(t){let{palette:e,layout:n,customCss:r,typography:i}=t;return {customCss:r||void 0,palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(i),layout:{ctaAlignment:Hb(n==null?void 0:n.alignment),headerAlignment:Hb(n==null?void 0:n.alignment),descriptionAlignment:Hb(n==null?void 0:n.alignment),planMaxWidth:el(n==null?void 0:n.planWidth),planMinWidth:el(n==null?void 0:n.planWidth),planMargin:el(n==null?void 0:n.planMargin),planPadding:el(n==null?void 0:n.planPadding)}}}function AS(t){let{palette:e,typography:n,customCss:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0},backgroundHighlight:(e==null?void 0:e.summaryBackgroundColor)||void 0},typography:Gp(n,hm),customCss:r||void 0}}function CA(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===bi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?IS(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===bi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function RS(t,e,n){var G,X;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:c,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:h,currentPlan:v,isCustomerOnTrial:P,trialDaysLeft:x}=CA(c),T=n==null?void 0:n({currentSubscription:h}),I=(h==null?void 0:h.scheduledUpdates)||[],R=(G=h==null?void 0:h.price)==null?void 0:G.billingPeriod,A=I.find(({subscriptionScheduleType:nt})=>nt===Ui.Downgrade),O=I.find(({subscriptionScheduleType:nt})=>nt===Ui.BillingPeriod),N=px(r,nt=>nt.order).map(nt=>{var ut;let st=(ut=s==null?void 0:s.eligibleForTrial)==null?void 0:ut.find(Y=>Y.productId===nt.product.id),U=T!=null&&T.planId?(T==null?void 0:T.planId)===nt.id:nt.id===(v==null?void 0:v.id),j=Y=>{var mt;let at=A==null?void 0:A.scheduleVariables,pt=O==null?void 0:O.scheduleVariables,dt=nt.pricePoints.some(Ct=>Ct.billingPeriod===Y);return A?((mt=A.targetPackage)==null?void 0:mt.refId)===nt.id&&(!dt||at.billingPeriod===Y):O&&U?pt.billingPeriod===Y:false};return Pt(W({},nt),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===nt.id),isTriable:!cm(nt.defaultTrialConfig)&&(!st||st.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:R,isUpcomingPlan:false,trialDaysLeft:x,isNextPlan:j,paywallCurrency:i,scheduledUpdate:A||O})});if(r&&v){let nt=v&&((X=r==null?void 0:r.find(st=>st.id===(v==null?void 0:v.id)))==null?void 0:X.order);cm(nt)||(N=N.map(st=>Pt(W({},st),{isLowerThanCurrentPlan:nt>st.order})),e&&(N=N.filter(st=>st.order>=nt)));}let V=o?DS(o):void 0;return {currentPlan:v,currentSubscription:h,currentSubscriptionOverride:T,isCustomerOnTrial:P,plans:N,paywallConfiguration:V}}var MS="7.13.0";var NS="@stigg/react-sdk";var jp=Bv.createContext(null);jp.displayName="StiggContext";var _A="en-US",TA=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:c,locale:p,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,entitlementsFallback:x,stiggClient:T,children:I,offline:R,clientName:A=NS,clientVersion:O=MS})=>{let N=useRef(t),V={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:x,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,clientName:A,clientVersion:O,offline:R},[G,X]=useState(()=>({stigg:T!=null?T:bb.initialize(Pt(W({},V),{lazyLoad:true})),locale:p||_A,isInitialized:false,theme:c,refreshData:()=>ce(null,null,function*(){X(nt=>Pt(W({},nt),{customerPortalUpdatedAt:new Date})),yield G.stigg.refresh();})}));return useEffect(()=>{let nt=true,st=Y=>{nt&&X(Y);},U=()=>st(Y=>Pt(W({},Y),{updatedAt:new Date})),j=Y=>st(at=>(at.stigg&&at.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),Pt(W({},at),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ce(null,null,function*(){let Y=G.stigg;t!==N.current&&(tl.log("Updating stigg client",{apiKey:t}),N.current=t,Y=bb.initialize(W({},V)),st(at=>Pt(W({},at),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),j(Y);}),()=>{nt=false,G.stigg.removeListener("entitlementsUpdated",U),G.stigg.clearCustomer();}},[t]),useEffect(()=>{let nt=G.stigg;i?nt.setCustomerId(i,o,s):nt.clearCustomer();},[i,o,s]),useEffect(()=>{X(nt=>Pt(W({},nt),{theme:c}));},[c]),jsx(jp.Provider,{value:G,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:I})})};function be(t){let{optional:e}=t||{},n=useContext(jp);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function BS({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:c}=be(),[p,h]=useState(xe.Annually),[v,P]=useState([]),[x,T]=useState(null),[I,R]=useState(true);useEffect(()=>{ce(null,null,function*(){try{R(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:V,defaultBillingPeriod:G}=TS(N.plans,N.activeSubscriptions,i);T(N),P(V),h(G);}catch(N){tl.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{R(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let A=RS(x,n,o);return W({customer:(x==null?void 0:x.customer)||null,isLoading:I,selectedBillingPeriod:p,setSelectedBillingPeriod:h,availableBillingPeriods:v,locale:c,configuration:A.paywallConfiguration,showWatermark:s.getShowWatermark()},A)}function US(t){return zD({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:n=>{var r;return `Start ${(r=n.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:n=>n===xe.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===xe.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var DA=t=>jsx("svg",Pt(W({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),GS=DA;var AA=Q.div`
4970
+ `,_S=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:c,onPlanSelected:p,paywallLocale:h,locale:v,shouldHidePlan:P,selectDefaultTierIndex:x,currentSubscriptionOverride:T,hideCompatibleAddons:I,showWatermark:R})=>{let A=SS(t),O=t.some(Y=>!!Y.description),N=jb(t,xe.Monthly),V=jb(t,xe.Annually),G=ES(t,i,P),X=useCallback((Y,at,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:at,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),nt=!!n&&n.plan.pricingType===On.Custom,st=useMemo(()=>G.some(Y=>{var dt;let at=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(dt=Y.paywallCalculatedPricePoints)==null?void 0:dt.find(mt=>mt.billingPeriod===i);return at.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,G]),U=useMemo(()=>G.some(Y=>!!dm(Y,i,h,v,N).unit),[i,N,v,h,G]),j=useMemo(()=>!nt&&G.some(Y=>{let at=um({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:T});return Object.values(at).length>0}),[i,n,T,nt,G]),ut=G.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsx(hA,{className:"stigg-paywall-container",children:jsxs(mA,{className:"stigg-paywall-layout",children:[jsx(yS,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:A}),jsx(fA,{className:"stigg-paywall-plans-layout",children:G.map(Y=>jsx(mS,{withUnitPriceRow:U,withTiersRow:j,withTrialLeftRow:ut,shouldShowDescriptionSection:O,hasMonthlyPrice:N,hasAnnuallyPrice:V,plan:Y,withStartingAtRow:st,currentSubscription:n,currentSubscriptionOverride:T,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:c,onPlanSelected:(at,pt)=>X(Y,at,pt),paywallLocale:h,locale:v,customer:e,isCustomerInCustomPlan:nt,selectDefaultTierIndex:x,hideCompatibleAddons:I},Y.id))}),jsx(so,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:R})]})})};var zb=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},tl=new zb;function TS(t,e,n){let r=t.flatMap(c=>c.pricePoints).map(c=>c.billingPeriod),i=countBy(r),o=uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let c=e.find(p=>p.status===bi.Active);c&&c.prices.length>0&&(s=c==null?void 0:c.prices[0].billingPeriod);}return s||(s=(i[xe.Monthly]||0)>(i[xe.Annually]||0)?xe.Monthly:xe.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function IS(t){return $1.utc(t).diff($1.utc(),"days",false)+1}var hm={h1:{fontSize:"24px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"16px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};function el(t,e="px"){if(t)return `${t}${e}`}function mm(t){if(!t)return "normal";switch(t){case gb.Normal:return "normal";case gb.Bold:return "bold";default:return "normal"}}function Gp(t,e){var r,i,o,s,c,p,h,v;let n=e||{h1:{fontSize:"32px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"24px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};return {fontFamilyUrl:(t==null?void 0:t.fontFamily)||void 0,h1:{fontSize:el((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:mm((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:el((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:mm((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:el((c=t==null?void 0:t.h3)==null?void 0:c.fontSize)||n.h3.fontSize,fontWeight:mm((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:el((h=t==null?void 0:t.body)==null?void 0:h.fontSize)||n.body.fontSize,fontWeight:mm((v=t==null?void 0:t.body)==null?void 0:v.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Hb(t){if(t)switch(t){case tm.Left:return "left";case tm.Center:return "center";case tm.Right:return "right";default:return}}function kS(t){let{palette:e,customCss:n,typography:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.paywallBackgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(r),customCss:n||void 0}}function DS(t){let{palette:e,layout:n,customCss:r,typography:i}=t;return {customCss:r||void 0,palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,backgroundHighlight:(e==null?void 0:e.currentPlanBackground)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0}},typography:Gp(i),layout:{ctaAlignment:Hb(n==null?void 0:n.alignment),headerAlignment:Hb(n==null?void 0:n.alignment),descriptionAlignment:Hb(n==null?void 0:n.alignment),planMaxWidth:el(n==null?void 0:n.planWidth),planMinWidth:el(n==null?void 0:n.planWidth),planMargin:el(n==null?void 0:n.planMargin),planPadding:el(n==null?void 0:n.planPadding)}}}function AS(t){let{palette:e,typography:n,customCss:r}=t;return {palette:{primary:(e==null?void 0:e.primary)||void 0,backgroundPaper:(e==null?void 0:e.backgroundColor)||void 0,outlinedBorder:(e==null?void 0:e.borderColor)||void 0,text:{primary:(e==null?void 0:e.textColor)||void 0},backgroundHighlight:(e==null?void 0:e.summaryBackgroundColor)||void 0},typography:Gp(n,hm),customCss:r||void 0}}function CA(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===bi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?IS(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===bi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function RS(t,e,n){var G,X;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:c,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:h,currentPlan:v,isCustomerOnTrial:P,trialDaysLeft:x}=CA(c),T=n==null?void 0:n({currentSubscription:h}),I=(h==null?void 0:h.scheduledUpdates)||[],R=(G=h==null?void 0:h.price)==null?void 0:G.billingPeriod,A=I.find(({subscriptionScheduleType:nt})=>nt===Ui.Downgrade),O=I.find(({subscriptionScheduleType:nt})=>nt===Ui.BillingPeriod),N=px(r,nt=>nt.order).map(nt=>{var ut;let st=(ut=s==null?void 0:s.eligibleForTrial)==null?void 0:ut.find(Y=>Y.productId===nt.product.id),U=T!=null&&T.planId?(T==null?void 0:T.planId)===nt.id:nt.id===(v==null?void 0:v.id),j=Y=>{var mt;let at=A==null?void 0:A.scheduleVariables,pt=O==null?void 0:O.scheduleVariables,dt=nt.pricePoints.some(Ct=>Ct.billingPeriod===Y);return A?((mt=A.targetPackage)==null?void 0:mt.refId)===nt.id&&(!dt||at.billingPeriod===Y):O&&U?pt.billingPeriod===Y:false};return Pt(W({},nt),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===nt.id),isTriable:!cm(nt.defaultTrialConfig)&&(!st||st.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:R,isUpcomingPlan:false,trialDaysLeft:x,isNextPlan:j,paywallCurrency:i,scheduledUpdate:A||O})});if(r&&v){let nt=v&&((X=r==null?void 0:r.find(st=>st.id===(v==null?void 0:v.id)))==null?void 0:X.order);cm(nt)||(N=N.map(st=>Pt(W({},st),{isLowerThanCurrentPlan:nt>st.order})),e&&(N=N.filter(st=>st.order>=nt)));}let V=o?DS(o):void 0;return {currentPlan:v,currentSubscription:h,currentSubscriptionOverride:T,isCustomerOnTrial:P,plans:N,paywallConfiguration:V}}var MS="7.14.0";var NS="@stigg/react-sdk";var jp=Bv.createContext(null);jp.displayName="StiggContext";var _A="en-US",TA=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:c,locale:p,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,entitlementsFallback:x,stiggClient:T,children:I,offline:R,clientName:A=NS,clientVersion:O=MS})=>{let N=useRef(t),V={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:x,cacheTtlMs:h,useEntitlementPolling:v,entitlementPollingInterval:P,clientName:A,clientVersion:O,offline:R},[G,X]=useState(()=>({stigg:T!=null?T:bb.initialize(Pt(W({},V),{lazyLoad:true})),locale:p||_A,isInitialized:false,theme:c,refreshData:()=>ce(null,null,function*(){X(nt=>Pt(W({},nt),{customerPortalUpdatedAt:new Date})),yield G.stigg.refresh();})}));return useEffect(()=>{let nt=true,st=Y=>{nt&&X(Y);},U=()=>st(Y=>Pt(W({},Y),{updatedAt:new Date})),j=Y=>st(at=>(at.stigg&&at.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),Pt(W({},at),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ce(null,null,function*(){let Y=G.stigg;t!==N.current&&(tl.log("Updating stigg client",{apiKey:t}),N.current=t,Y=bb.initialize(W({},V)),st(at=>Pt(W({},at),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),j(Y);}),()=>{nt=false,G.stigg.removeListener("entitlementsUpdated",U),G.stigg.clearCustomer();}},[t]),useEffect(()=>{let nt=G.stigg;i?nt.setCustomerId(i,o,s):nt.clearCustomer();},[i,o,s]),useEffect(()=>{X(nt=>Pt(W({},nt),{theme:c}));},[c]),jsx(jp.Provider,{value:G,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:I})})};function be(t){let{optional:e}=t||{},n=useContext(jp);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function BS({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:c}=be(),[p,h]=useState(xe.Annually),[v,P]=useState([]),[x,T]=useState(null),[I,R]=useState(true);useEffect(()=>{ce(null,null,function*(){try{R(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:V,defaultBillingPeriod:G}=TS(N.plans,N.activeSubscriptions,i);T(N),P(V),h(G);}catch(N){tl.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{R(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let A=RS(x,n,o);return W({customer:(x==null?void 0:x.customer)||null,isLoading:I,selectedBillingPeriod:p,setSelectedBillingPeriod:h,availableBillingPeriods:v,locale:c,configuration:A.paywallConfiguration,showWatermark:s.getShowWatermark()},A)}function US(t){return zD({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:n=>{var r;return `Start ${(r=n.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:n=>n===xe.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===xe.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var DA=t=>jsx("svg",Pt(W({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),{children:jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),GS=DA;var AA=Q.div`
4971
4971
  display: flex;
4972
4972
  flex-direction: column;
4973
4973
  align-items: center;
@@ -5470,7 +5470,7 @@ ${e.o5f}`,e.zBW=r.default`
5470
5470
  margin: 16px 0;
5471
5471
  `,d_=Q(rt)`
5472
5472
  margin-bottom: 8px;
5473
- `;function OL({isLastStep:t,checkoutHasChanges:e,isFreeDowngrade:n,checkoutLocalization:r,isPlanUpdate:i}){return t?e?i?r.checkoutButton.updateText:n?r.checkoutButton.downgradeToFreeText:r.checkoutButton.upgradeText:r.checkoutButton.noChangesText:r.checkoutButton.nextText}var f_=({onCheckout:t,onCheckoutCompleted:e,disablePromotionCode:n,disableSuccessAnimation:r,isFreeDowngrade:i,onMockCheckoutPreview:o,showWatermark:s})=>{var Gn,sn,Ke,un,or;let[c,p]=useState(false),{setErrorMessage:h,useNewPaymentMethod:v}=Pi(),P=ha(),x=Yu(),{checkoutState:T,checkoutLocalization:I,checkoutSuccess:R,widgetState:A}=ze(),{plan:O,activeSubscription:N}=T||{},V=ng(((Gn=O==null?void 0:O.pricePoints)==null?void 0:Gn.filter(_e=>_e.billingPeriod===x.billingPeriod))||[]),[G,X]=TL(V,_e=>_e.pricingModel===yn.FlatFee),nt=G[0],st=i||P.isCheckoutComplete&&P.isLastStep,{isZuoraIntegration:U}=Ku(),j=c||R,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y}=yE({onMockCheckoutPreview:o}),{handleSubmit:at,isLoading:pt}=XE({isMocked:!!o,disableSuccessAnimation:r,onCheckout:t,onCheckoutCompleted:e,onSuccess:()=>{p(true),P.markStepAsCompleted(P.progressBarState.activeStep);}}),{handleZuoraSubmit:dt}=ug({onCheckout:t,onCheckoutCompleted:e,disableSuccessAnimation:r,onSuccess:()=>{P.markStepAsCompleted(P.progressBarState.activeStep);}}),mt=_e=>ce(null,null,function*(){if(j)return;let De;U&&!v?De=yield dt():De=yield at(_e);let{errorMessage:vr}=De||{};vr?(h(vr),p(false)):h(void 0);}),Ct=U&&!v?A.readOnly:pt,jt=_e=>ce(null,null,function*(){Ct||(st?yield mt(_e):P.goNext());}),{immediateInvoice:Gt,recurringInvoice:Jt}=ut||{},ee=!!ut&&(!!(Gt!=null&&Gt.proration)||!!ut.hasScheduledUpdates),re=!n&&!i&&!U,Ee=!!(Jt!=null&&Jt.discountDetails)&&!i,je=re||Ee,an=X.some(_e=>_e.pricingModel===yn.UsageBased),Ze=an&&!nt&&X.every(_e=>_e.pricingModel===yn.UsageBased),Pn=typeof I.summary.baseChargeText=="function"?I.summary.baseChargeText({billingPeriod:x.billingPeriod}):I.summary.baseChargeText;return jsxs(qv,{children:[jsxs(hg,{children:[jsx(AL,{variant:"h3",children:I.summary.title}),jsxs(da,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.planName({plan:O})}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),nt&&jsx(fg,{checkoutLocalization:I,label:Pn,quantity:1,price:nt}),!nt&&i?jsx(s_,{label:Pn}):null,jsx(da,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:X.map(_e=>{var vr,Ve,bt,ar,sr;let De=(vr=x.billableFeatures)==null?void 0:vr.find(Jn=>{var lr;return Jn.featureId===((lr=_e.feature)==null?void 0:lr.featureId)});return jsx(fg,{checkoutLocalization:I,label:Wp(((bt=_e.feature)==null?void 0:bt.displayName)||"",(ar=_e.feature)==null?void 0:ar.units,(sr=_e.feature)==null?void 0:sr.unitsPlural),quantity:(De==null?void 0:De.quantity)||1,price:_e},(Ve=_e.feature)==null?void 0:Ve.featureId)})}),!!((sn=x.addons)!=null&&sn.length)&&jsxs(Fragment,{children:[jsxs(da,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.addonsSectionTitle}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),x.addons.map(_e=>{var Ve,bt;let De=(Ve=_e.addon.pricePoints)==null?void 0:Ve.find(ar=>ar.billingPeriod===x.billingPeriod);if(!De)return null;let vr=_e.quantity&&_e.quantity>0?_e.quantity:1;return jsx(fg,{checkoutLocalization:I,label:_e.addon.displayName,quantity:vr,price:De},(bt=_e==null?void 0:_e.addon)==null?void 0:bt.id)})]}),!je&&jsx(Xu,{className:"stigg-checkout-summary-divider"}),je&&jsxs(da,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.discountsSectionTitle}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),re&&jsx(GE,{disabled:Ct||Y,checkoutLocalization:I,onMockCheckoutPreview:o}),Ee&&ut&&jsx(l_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),je&&jsx(Xu,{className:"stigg-checkout-summary-divider"}),jsx(u_,{tax:Jt==null?void 0:Jt.tax,taxDetails:Jt==null?void 0:Jt.taxDetails,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),i?null:jsxs(Fragment,{children:[jsx(Lo,{style:{marginTop:16},children:jsxs(da,{display:"flex",flexDirection:"column",container:true,children:[jsxs(da,{item:true,display:"flex",justifyContent:"space-between",children:[jsx(rt,{variant:"h6",children:I.summary.totalText}),jsx(rt,{variant:"h6",children:jsxs(No,{isLoading:Y,children:[Ze?I.summary.onlyPayAsYouGoText:null,!Ze&&an?I.summary.startsAtText:null,Ze?null:Rn(Pt(W({amount:0},Jt==null?void 0:Jt.total),{minimumFractionDigits:2}))]})})]}),jsx(da,{item:true,children:jsx(rt,{variant:"body1",color:"secondary",children:I.summary.totalBillingPeriodText({billingPeriod:x.billingPeriod})})})]})}),jsx(Xu,{className:"stigg-checkout-summary-divider"})]}),(Ke=Gt==null?void 0:Gt.proration)!=null&&Ke.hasProrations&&(Gt!=null&&Gt.subTotal)&&(Gt==null?void 0:Gt.subTotal.amount)>0?jsx(ma,{children:jsxs(Lo,{children:[jsx(rt,{variant:"body1",color:"secondary",children:I.summary.proratedTotalDueText}),jsx(rt,{variant:"body1",color:"secondary",children:jsx(No,{isLoading:Y,children:Rn({amount:Number(((un=Gt==null?void 0:Gt.subTotal)==null?void 0:un.amount)||0)+Number(((or=Gt==null?void 0:Gt.tax)==null?void 0:or.amount)||0),currency:Gt==null?void 0:Gt.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsx(c_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),jsx(ma,{children:jsxs(Lo,{children:[jsx(d_,{variant:"h6",children:I.summary.totalDueText}),jsx(d_,{variant:"h6",children:jsx(No,{isLoading:Y,children:Rn(Pt(W({amount:0},Gt==null?void 0:Gt.total),{minimumFractionDigits:2}))})})]})}),jsx(r_,{plan:O,activeSubscription:N,subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I,billingPeriod:x.billingPeriod}),(!st||!U||U&&!v)&&jsx($i,{$success:j,$error:st&&i,disabled:Ct||Y||P.progressBarState.isDisabled||st&&!ee,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:_e=>{jt(_e);},fullWidth:true,children:jsx(rt,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:j?jsx(qn,{icon:"Check",style:{display:"contents"}}):Ct||Y?jsx(_3,{size:20,sx:{color:"white"}}):OL({isLastStep:st,checkoutHasChanges:ee,isFreeDowngrade:i,checkoutLocalization:I,isPlanUpdate:!!N&&(N==null?void 0:N.plan.id)===(O==null?void 0:O.id)})})})]}),jsx(so,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&j&&jsx(KE,{checkoutLocalization:I})]})};var h_=({showWatermark:t})=>jsxs(qv,{children:[jsxs(hg,{children:[jsxs(uc,{$flexDirection:"column",$gap:24,children:[jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20})]}),jsxs(uc,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsx(Un,{height:20}),jsx(Un,{height:20}),jsx(Un,{height:20})]}),jsx(Lp,{flex:1,marginTop:5,children:jsx(Un,{height:34})})]}),jsx(so,{source:"checkout",showWatermark:t,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var g_=Q(da)`
5473
+ `;function OL({isLastStep:t,checkoutHasChanges:e,isFreeDowngrade:n,checkoutLocalization:r,isPlanUpdate:i}){return t?e?i?r.checkoutButton.updateText:n?r.checkoutButton.downgradeToFreeText:r.checkoutButton.upgradeText:r.checkoutButton.noChangesText:r.checkoutButton.nextText}var f_=({onCheckout:t,onCheckoutCompleted:e,disablePromotionCode:n,disableSuccessAnimation:r,isFreeDowngrade:i,onMockCheckoutPreview:o,showWatermark:s})=>{var Gn,sn,Ke,un,or;let[c,p]=useState(false),{setErrorMessage:h,useNewPaymentMethod:v}=Pi(),P=ha(),x=Yu(),{checkoutState:T,checkoutLocalization:I,checkoutSuccess:R,widgetState:A}=ze(),{plan:O,activeSubscription:N}=T||{},V=ng(((Gn=O==null?void 0:O.pricePoints)==null?void 0:Gn.filter(_e=>_e.billingPeriod===x.billingPeriod))||[]),[G,X]=TL(V,_e=>_e.pricingModel===yn.FlatFee),nt=G[0],st=i||P.isCheckoutComplete&&P.isLastStep,{isZuoraIntegration:U}=Ku(),j=c||R,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y}=yE({onMockCheckoutPreview:o}),{handleSubmit:at,isLoading:pt}=XE({isMocked:!!o,disableSuccessAnimation:r,onCheckout:t,onCheckoutCompleted:e,onSuccess:()=>{p(true),P.markStepAsCompleted(P.progressBarState.activeStep);}}),{handleZuoraSubmit:dt}=ug({onCheckout:t,onCheckoutCompleted:e,disableSuccessAnimation:r,onSuccess:()=>{P.markStepAsCompleted(P.progressBarState.activeStep);}}),mt=_e=>ce(null,null,function*(){if(j)return;let De;U&&!v?De=yield dt():De=yield at(_e);let{errorMessage:vr}=De||{};vr?(h(vr),p(false)):h(void 0);}),Ct=U&&!v?A.readOnly:pt,jt=_e=>ce(null,null,function*(){Ct||(st?yield mt(_e):P.goNext());}),{immediateInvoice:Gt,recurringInvoice:Jt}=ut||{},ee=!!ut&&(!!(Gt!=null&&Gt.proration)||!!ut.hasScheduledUpdates),re=!n&&!i&&!U,Ee=!!(Jt!=null&&Jt.discountDetails)&&!i,je=re||Ee,an=X.some(_e=>_e.pricingModel===yn.UsageBased),Ze=an&&!nt&&X.every(_e=>_e.pricingModel===yn.UsageBased),Pn=typeof I.summary.baseChargeText=="function"?I.summary.baseChargeText({billingPeriod:x.billingPeriod}):I.summary.baseChargeText;return jsxs(qv,{className:"stigg-checkout-summary-container",children:[jsxs(hg,{children:[jsx(AL,{variant:"h3",children:I.summary.title}),jsxs(da,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.planName({plan:O})}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),nt&&jsx(fg,{checkoutLocalization:I,label:Pn,quantity:1,price:nt}),!nt&&i?jsx(s_,{label:Pn}):null,jsx(da,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:X.map(_e=>{var vr,Ve,bt,ar,sr;let De=(vr=x.billableFeatures)==null?void 0:vr.find(Jn=>{var lr;return Jn.featureId===((lr=_e.feature)==null?void 0:lr.featureId)});return jsx(fg,{checkoutLocalization:I,label:Wp(((bt=_e.feature)==null?void 0:bt.displayName)||"",(ar=_e.feature)==null?void 0:ar.units,(sr=_e.feature)==null?void 0:sr.unitsPlural),quantity:(De==null?void 0:De.quantity)||1,price:_e},(Ve=_e.feature)==null?void 0:Ve.featureId)})}),!!((sn=x.addons)!=null&&sn.length)&&jsxs(Fragment,{children:[jsxs(da,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.addonsSectionTitle}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),x.addons.map(_e=>{var Ve,bt;let De=(Ve=_e.addon.pricePoints)==null?void 0:Ve.find(ar=>ar.billingPeriod===x.billingPeriod);if(!De)return null;let vr=_e.quantity&&_e.quantity>0?_e.quantity:1;return jsx(fg,{checkoutLocalization:I,label:_e.addon.displayName,quantity:vr,price:De},(bt=_e==null?void 0:_e.addon)==null?void 0:bt.id)})]}),!je&&jsx(Xu,{className:"stigg-checkout-summary-divider"}),je&&jsxs(da,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(rt,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:I.summary.discountsSectionTitle}),jsx(Xu,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),re&&jsx(GE,{disabled:Ct||Y,checkoutLocalization:I,onMockCheckoutPreview:o}),Ee&&ut&&jsx(l_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),je&&jsx(Xu,{className:"stigg-checkout-summary-divider"}),jsx(u_,{tax:Jt==null?void 0:Jt.tax,taxDetails:Jt==null?void 0:Jt.taxDetails,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),i?null:jsxs(Fragment,{children:[jsx(Lo,{style:{marginTop:16},children:jsxs(da,{display:"flex",flexDirection:"column",container:true,children:[jsxs(da,{item:true,display:"flex",justifyContent:"space-between",children:[jsx(rt,{variant:"h6",children:I.summary.totalText}),jsx(rt,{variant:"h6",children:jsxs(No,{isLoading:Y,children:[Ze?I.summary.onlyPayAsYouGoText:null,!Ze&&an?I.summary.startsAtText:null,Ze?null:Rn(Pt(W({amount:0},Jt==null?void 0:Jt.total),{minimumFractionDigits:2}))]})})]}),jsx(da,{item:true,children:jsx(rt,{variant:"body1",color:"secondary",children:I.summary.totalBillingPeriodText({billingPeriod:x.billingPeriod})})})]})}),jsx(Xu,{className:"stigg-checkout-summary-divider"})]}),(Ke=Gt==null?void 0:Gt.proration)!=null&&Ke.hasProrations&&(Gt!=null&&Gt.subTotal)&&(Gt==null?void 0:Gt.subTotal.amount)>0?jsx(ma,{children:jsxs(Lo,{children:[jsx(rt,{variant:"body1",color:"secondary",children:I.summary.proratedTotalDueText}),jsx(rt,{variant:"body1",color:"secondary",children:jsx(No,{isLoading:Y,children:Rn({amount:Number(((un=Gt==null?void 0:Gt.subTotal)==null?void 0:un.amount)||0)+Number(((or=Gt==null?void 0:Gt.tax)==null?void 0:or.amount)||0),currency:Gt==null?void 0:Gt.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsx(c_,{subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I}),jsx(ma,{children:jsxs(Lo,{children:[jsx(d_,{variant:"h6",children:I.summary.totalDueText}),jsx(d_,{variant:"h6",children:jsx(No,{isLoading:Y,children:Rn(Pt(W({amount:0},Gt==null?void 0:Gt.total),{minimumFractionDigits:2}))})})]})}),jsx(r_,{plan:O,activeSubscription:N,subscriptionPreview:ut,isFetchingSubscriptionPreview:Y,checkoutLocalization:I,billingPeriod:x.billingPeriod}),(!st||!U||U&&!v)&&jsx($i,{$success:j,$error:st&&i,disabled:Ct||Y||P.progressBarState.isDisabled||st&&!ee,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:_e=>{jt(_e);},fullWidth:true,children:jsx(rt,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:j?jsx(qn,{icon:"Check",style:{display:"contents"}}):Ct||Y?jsx(_3,{size:20,sx:{color:"white"}}):OL({isLastStep:st,checkoutHasChanges:ee,isFreeDowngrade:i,checkoutLocalization:I,isPlanUpdate:!!N&&(N==null?void 0:N.plan.id)===(O==null?void 0:O.id)})})})]}),jsx(so,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&j&&jsx(KE,{checkoutLocalization:I})]})};var h_=({showWatermark:t})=>jsxs(qv,{children:[jsxs(hg,{children:[jsxs(uc,{$flexDirection:"column",$gap:24,children:[jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20}),jsx(Un,{width:120,height:20})]}),jsxs(uc,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsx(Un,{height:20}),jsx(Un,{height:20}),jsx(Un,{height:20})]}),jsx(Lp,{flex:1,marginTop:5,children:jsx(Un,{height:34})})]}),jsx(so,{source:"checkout",showWatermark:t,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var g_=Q(da)`
5474
5474
  width: 100%;
5475
5475
  gap: 8px;
5476
5476
  `,y_=Q(da)`
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.13.0",
2
+ "version": "7.14.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/stigg-sdk.cjs.js",
5
5
  "types": "dist/index.d.ts",