@stigg/react-sdk 7.16.0 → 7.16.1

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.
@@ -5119,7 +5119,7 @@ ${e.o5f}`,e.zBW=r.default`
5119
5119
  display: flex;
5120
5120
  flex-direction: column;
5121
5121
  align-items: center;
5122
- `,yx=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:l,onPlanSelected:p,paywallLocale:f,locale:b,shouldHidePlan:S,selectDefaultTierIndex:P,currentSubscriptionOverride:I,hideCompatibleAddons:T,showWatermark:F})=>{let k=fx(t),R=t.some(Y=>!!Y.description),N=yv(t,Se.Monthly),j=yv(t,Se.Annually),H=gx(t,i,S),Q=h0.useCallback((Y,ot,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:ot,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),it=!!n&&n.plan.pricingType===On.Custom,ct=h0.useMemo(()=>H.some(Y=>{var lt;let ot=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(lt=Y.paywallCalculatedPricePoints)==null?void 0:lt.find(mt=>mt.billingPeriod===i);return ot.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,H]),U=h0.useMemo(()=>H.some(Y=>!!Eh(Y,i,f,b,N).unit),[i,N,b,f,H]),V=h0.useMemo(()=>!it&&H.some(Y=>{let ot=_h({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:I});return Object.values(ot).length>0}),[i,n,I,it,H]),dt=H.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsxRuntime.jsx(_F,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(EF,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(lx,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:k}),jsxRuntime.jsx(PF,{className:"stigg-paywall-plans-layout",children:H.map(Y=>jsxRuntime.jsx(sx,{withUnitPriceRow:U,withTiersRow:V,withTrialLeftRow:dt,shouldShowDescriptionSection:R,hasMonthlyPrice:N,hasAnnuallyPrice:j,plan:Y,withStartingAtRow:ct,currentSubscription:n,currentSubscriptionOverride:I,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:l,onPlanSelected:(ot,pt)=>Q(Y,ot,pt),paywallLocale:f,locale:b,customer:e,isCustomerInCustomPlan:it,selectDefaultTierIndex:P,hideCompatibleAddons:T},Y.id))}),jsxRuntime.jsx(go,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:F})]})})};var vv=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},sc=new vv;function bx(t,e,n){let r=t.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),i=lodash.countBy(r),o=lodash.uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let l=e.find(p=>p.status===Pi.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(i[Se.Monthly]||0)>(i[Se.Annually]||0)?Se.Monthly:Se.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function Cx(t){return _1__default.default.utc(t).diff(_1__default.default.utc(),"days",false)+1}var wh={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 cc(t,e="px"){if(t)return `${t}${e}`}function Ah(t){if(!t)return "normal";switch(t){case Hb.Normal:return "normal";case Hb.Bold:return "bold";default:return "normal"}}function rf(t,e){var r,i,o,s,l,p,f,b;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:cc((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:Ah((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:cc((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:Ah((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:cc((l=t==null?void 0:t.h3)==null?void 0:l.fontSize)||n.h3.fontSize,fontWeight:Ah((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:cc((f=t==null?void 0:t.body)==null?void 0:f.fontSize)||n.body.fontSize,fontWeight:Ah((b=t==null?void 0:t.body)==null?void 0:b.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Cv(t){if(t)switch(t){case mh.Left:return "left";case mh.Center:return "center";case mh.Right:return "right";default:return}}function Sx(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:rf(r),customCss:n||void 0}}function xx(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:rf(i),layout:{ctaAlignment:Cv(n==null?void 0:n.alignment),headerAlignment:Cv(n==null?void 0:n.alignment),descriptionAlignment:Cv(n==null?void 0:n.alignment),planMaxWidth:cc(n==null?void 0:n.planWidth),planMinWidth:cc(n==null?void 0:n.planWidth),planMargin:cc(n==null?void 0:n.planMargin),planPadding:cc(n==null?void 0:n.planPadding)}}}function Px(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:rf(n,wh),customCss:r||void 0}}function DF(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===Pi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?Cx(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===Pi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function Ex(t,e,n){var H,Q;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:l,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:f,currentPlan:b,isCustomerOnTrial:S,trialDaysLeft:P}=DF(l),I=n==null?void 0:n({currentSubscription:f}),T=(f==null?void 0:f.scheduledUpdates)||[],F=(H=f==null?void 0:f.price)==null?void 0:H.billingPeriod,k=T.find(({subscriptionScheduleType:it})=>it===Hi.Downgrade),R=T.find(({subscriptionScheduleType:it})=>it===Hi.BillingPeriod),N=i___default.default(r,it=>it.order).map(it=>{var dt;let ct=(dt=s==null?void 0:s.eligibleForTrial)==null?void 0:dt.find(Y=>Y.productId===it.product.id),U=I!=null&&I.planId?(I==null?void 0:I.planId)===it.id:it.id===(b==null?void 0:b.id),V=Y=>{var mt;let ot=k==null?void 0:k.scheduleVariables,pt=R==null?void 0:R.scheduleVariables,lt=it.pricePoints.some(bt=>bt.billingPeriod===Y);return k?((mt=k.targetPackage)==null?void 0:mt.refId)===it.id&&(!lt||ot.billingPeriod===Y):R&&U?pt.billingPeriod===Y:false};return vt(q({},it),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===it.id),isTriable:!Ph__default.default(it.defaultTrialConfig)&&(!ct||ct.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:F,isUpcomingPlan:false,trialDaysLeft:P,isNextPlan:V,paywallCurrency:i,scheduledUpdate:k||R})});if(r&&b){let it=b&&((Q=r==null?void 0:r.find(ct=>ct.id===(b==null?void 0:b.id)))==null?void 0:Q.order);Ph__default.default(it)||(N=N.map(ct=>vt(q({},ct),{isLowerThanCurrentPlan:it>ct.order})),e&&(N=N.filter(ct=>ct.order>=it)));}let j=o?xx(o):void 0;return {currentPlan:b,currentSubscription:f,currentSubscriptionOverride:I,isCustomerOnTrial:S,plans:N,paywallConfiguration:j}}var Ix="7.16.0";var wx="@stigg/react-sdk";var of=h0__default.default.createContext(null);of.displayName="StiggContext";var NF="en-US",MF=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:l,locale:p,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,entitlementsFallback:P,stiggClient:I,children:T,offline:F,clientName:k=wx,clientVersion:R=Ix})=>{let N=h0.useRef(t),j={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:P,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,clientName:k,clientVersion:R,offline:F},[H,Q]=h0.useState(()=>({stigg:I!=null?I:Wb.initialize(vt(q({},j),{lazyLoad:true})),locale:p||NF,isInitialized:false,theme:l,refreshData:()=>ie(null,null,function*(){Q(it=>vt(q({},it),{customerPortalUpdatedAt:new Date})),yield H.stigg.refresh();})}));return h0.useEffect(()=>{let it=true,ct=Y=>{it&&Q(Y);},U=()=>ct(Y=>vt(q({},Y),{updatedAt:new Date})),V=Y=>ct(ot=>(ot.stigg&&ot.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),vt(q({},ot),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ie(null,null,function*(){let Y=H.stigg;t!==N.current&&(sc.log("Updating stigg client",{apiKey:t}),N.current=t,Y=Wb.initialize(q({},j)),ct(ot=>vt(q({},ot),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),V(Y);}),()=>{it=false,H.stigg.removeListener("entitlementsUpdated",U),H.stigg.clearCustomer();}},[t]),h0.useEffect(()=>{let it=H.stigg;i?it.setCustomerId(i,o,s):it.clearCustomer();},[i,o,s]),h0.useEffect(()=>{Q(it=>vt(q({},it),{theme:l}));},[l]),jsxRuntime.jsx(of.Provider,{value:H,children:jsxRuntime.jsx(lc.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:T})})};function ce(t){let{optional:e}=t||{},n=h0.useContext(of);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function Dx({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:l}=ce(),[p,f]=h0.useState(Se.Annually),[b,S]=h0.useState([]),[P,I]=h0.useState(null),[T,F]=h0.useState(true);h0.useEffect(()=>{ie(null,null,function*(){try{F(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:j,defaultBillingPeriod:H}=bx(N.plans,N.activeSubscriptions,i);I(N),S(j),f(H);}catch(N){sc.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{F(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let k=Ex(P,n,o);return q({customer:(P==null?void 0:P.customer)||null,isLoading:T,selectedBillingPeriod:p,setSelectedBillingPeriod:f,availableBillingPeriods:b,locale:l,configuration:k.paywallConfiguration,showWatermark:s.getShowWatermark()},k)}function kx(t){return t2__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===Se.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===Se.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var GF=t=>jsxRuntime.jsx("svg",vt(q({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"})})),Rx=GF;var $F=W.div`
5122
+ `,yx=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:l,onPlanSelected:p,paywallLocale:f,locale:b,shouldHidePlan:S,selectDefaultTierIndex:P,currentSubscriptionOverride:I,hideCompatibleAddons:T,showWatermark:F})=>{let k=fx(t),R=t.some(Y=>!!Y.description),N=yv(t,Se.Monthly),j=yv(t,Se.Annually),H=gx(t,i,S),Q=h0.useCallback((Y,ot,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:ot,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),it=!!n&&n.plan.pricingType===On.Custom,ct=h0.useMemo(()=>H.some(Y=>{var lt;let ot=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(lt=Y.paywallCalculatedPricePoints)==null?void 0:lt.find(mt=>mt.billingPeriod===i);return ot.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,H]),U=h0.useMemo(()=>H.some(Y=>!!Eh(Y,i,f,b,N).unit),[i,N,b,f,H]),V=h0.useMemo(()=>!it&&H.some(Y=>{let ot=_h({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:I});return Object.values(ot).length>0}),[i,n,I,it,H]),dt=H.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsxRuntime.jsx(_F,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(EF,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(lx,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:k}),jsxRuntime.jsx(PF,{className:"stigg-paywall-plans-layout",children:H.map(Y=>jsxRuntime.jsx(sx,{withUnitPriceRow:U,withTiersRow:V,withTrialLeftRow:dt,shouldShowDescriptionSection:R,hasMonthlyPrice:N,hasAnnuallyPrice:j,plan:Y,withStartingAtRow:ct,currentSubscription:n,currentSubscriptionOverride:I,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:l,onPlanSelected:(ot,pt)=>Q(Y,ot,pt),paywallLocale:f,locale:b,customer:e,isCustomerInCustomPlan:it,selectDefaultTierIndex:P,hideCompatibleAddons:T},Y.id))}),jsxRuntime.jsx(go,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:F})]})})};var vv=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},sc=new vv;function bx(t,e,n){let r=t.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),i=lodash.countBy(r),o=lodash.uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let l=e.find(p=>p.status===Pi.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(i[Se.Monthly]||0)>(i[Se.Annually]||0)?Se.Monthly:Se.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function Cx(t){return _1__default.default.utc(t).diff(_1__default.default.utc(),"days",false)+1}var wh={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 cc(t,e="px"){if(t)return `${t}${e}`}function Ah(t){if(!t)return "normal";switch(t){case Hb.Normal:return "normal";case Hb.Bold:return "bold";default:return "normal"}}function rf(t,e){var r,i,o,s,l,p,f,b;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:cc((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:Ah((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:cc((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:Ah((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:cc((l=t==null?void 0:t.h3)==null?void 0:l.fontSize)||n.h3.fontSize,fontWeight:Ah((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:cc((f=t==null?void 0:t.body)==null?void 0:f.fontSize)||n.body.fontSize,fontWeight:Ah((b=t==null?void 0:t.body)==null?void 0:b.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Cv(t){if(t)switch(t){case mh.Left:return "left";case mh.Center:return "center";case mh.Right:return "right";default:return}}function Sx(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:rf(r),customCss:n||void 0}}function xx(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:rf(i),layout:{ctaAlignment:Cv(n==null?void 0:n.alignment),headerAlignment:Cv(n==null?void 0:n.alignment),descriptionAlignment:Cv(n==null?void 0:n.alignment),planMaxWidth:cc(n==null?void 0:n.planWidth),planMinWidth:cc(n==null?void 0:n.planWidth),planMargin:cc(n==null?void 0:n.planMargin),planPadding:cc(n==null?void 0:n.planPadding)}}}function Px(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:rf(n,wh),customCss:r||void 0}}function DF(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===Pi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?Cx(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===Pi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function Ex(t,e,n){var H,Q;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:l,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:f,currentPlan:b,isCustomerOnTrial:S,trialDaysLeft:P}=DF(l),I=n==null?void 0:n({currentSubscription:f}),T=(f==null?void 0:f.scheduledUpdates)||[],F=(H=f==null?void 0:f.price)==null?void 0:H.billingPeriod,k=T.find(({subscriptionScheduleType:it})=>it===Hi.Downgrade),R=T.find(({subscriptionScheduleType:it})=>it===Hi.BillingPeriod),N=i___default.default(r,it=>it.order).map(it=>{var dt;let ct=(dt=s==null?void 0:s.eligibleForTrial)==null?void 0:dt.find(Y=>Y.productId===it.product.id),U=I!=null&&I.planId?(I==null?void 0:I.planId)===it.id:it.id===(b==null?void 0:b.id),V=Y=>{var mt;let ot=k==null?void 0:k.scheduleVariables,pt=R==null?void 0:R.scheduleVariables,lt=it.pricePoints.some(bt=>bt.billingPeriod===Y);return k?((mt=k.targetPackage)==null?void 0:mt.refId)===it.id&&(!lt||ot.billingPeriod===Y):R&&U?pt.billingPeriod===Y:false};return vt(q({},it),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===it.id),isTriable:!Ph__default.default(it.defaultTrialConfig)&&(!ct||ct.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:F,isUpcomingPlan:false,trialDaysLeft:P,isNextPlan:V,paywallCurrency:i,scheduledUpdate:k||R})});if(r&&b){let it=b&&((Q=r==null?void 0:r.find(ct=>ct.id===(b==null?void 0:b.id)))==null?void 0:Q.order);Ph__default.default(it)||(N=N.map(ct=>vt(q({},ct),{isLowerThanCurrentPlan:it>ct.order})),e&&(N=N.filter(ct=>ct.order>=it)));}let j=o?xx(o):void 0;return {currentPlan:b,currentSubscription:f,currentSubscriptionOverride:I,isCustomerOnTrial:S,plans:N,paywallConfiguration:j}}var Ix="7.16.1";var wx="@stigg/react-sdk";var of=h0__default.default.createContext(null);of.displayName="StiggContext";var NF="en-US",MF=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:l,locale:p,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,entitlementsFallback:P,stiggClient:I,children:T,offline:F,clientName:k=wx,clientVersion:R=Ix})=>{let N=h0.useRef(t),j={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:P,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,clientName:k,clientVersion:R,offline:F},[H,Q]=h0.useState(()=>({stigg:I!=null?I:Wb.initialize(vt(q({},j),{lazyLoad:true})),locale:p||NF,isInitialized:false,theme:l,refreshData:()=>ie(null,null,function*(){Q(it=>vt(q({},it),{customerPortalUpdatedAt:new Date})),yield H.stigg.refresh();})}));return h0.useEffect(()=>{let it=true,ct=Y=>{it&&Q(Y);},U=()=>ct(Y=>vt(q({},Y),{updatedAt:new Date})),V=Y=>ct(ot=>(ot.stigg&&ot.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),vt(q({},ot),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ie(null,null,function*(){let Y=H.stigg;t!==N.current&&(sc.log("Updating stigg client",{apiKey:t}),N.current=t,Y=Wb.initialize(q({},j)),ct(ot=>vt(q({},ot),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),V(Y);}),()=>{it=false,H.stigg.removeListener("entitlementsUpdated",U),H.stigg.clearCustomer();}},[t]),h0.useEffect(()=>{let it=H.stigg;i?it.setCustomerId(i,o,s):it.clearCustomer();},[i,o,s]),h0.useEffect(()=>{Q(it=>vt(q({},it),{theme:l}));},[l]),jsxRuntime.jsx(of.Provider,{value:H,children:jsxRuntime.jsx(lc.SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:T})})};function ce(t){let{optional:e}=t||{},n=h0.useContext(of);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function Dx({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:l}=ce(),[p,f]=h0.useState(Se.Annually),[b,S]=h0.useState([]),[P,I]=h0.useState(null),[T,F]=h0.useState(true);h0.useEffect(()=>{ie(null,null,function*(){try{F(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:j,defaultBillingPeriod:H}=bx(N.plans,N.activeSubscriptions,i);I(N),S(j),f(H);}catch(N){sc.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{F(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let k=Ex(P,n,o);return q({customer:(P==null?void 0:P.customer)||null,isLoading:T,selectedBillingPeriod:p,setSelectedBillingPeriod:f,availableBillingPeriods:b,locale:l,configuration:k.paywallConfiguration,showWatermark:s.getShowWatermark()},k)}function kx(t){return t2__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===Se.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===Se.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var GF=t=>jsxRuntime.jsx("svg",vt(q({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"})})),Rx=GF;var $F=W.div`
5123
5123
  display: flex;
5124
5124
  flex-direction: column;
5125
5125
  align-items: center;
@@ -5461,7 +5461,7 @@ ${e.o5f}`,e.zBW=r.default`
5461
5461
  ${({theme:t,$highlight:e})=>e&&`background-color: ${t.stigg.palette.backgroundSection}`};
5462
5462
  `;function zP({entitlement:t,subscriptionPrice:e,onManageSubscription:n,onBuyMore:r,hasCustomSubscription:i,canUpgradeSubscription:o}){var p,f,b;let{theme:s}=ur(),l=!t.hasUnlimitedUsage&&t.currentUsage>t.usageLimit;return t.feature?jsxRuntime.jsxs(jP,{$highlight:!!e,$borderColor:s.borderColor,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsxRuntime.jsx(dc,{variant:"body1",children:t.feature&&VP(t.feature)}),e&&jsxRuntime.jsx(cs,{title:jsxRuntime.jsx(J,{variant:"body1",children:e.billingModel===hn.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsxRuntime.jsx(zn,{icon:"DollarCoin",svgStrokeColor:s.iconsColor})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[jsxRuntime.jsxs(dc,{variant:"body1",color:l?"error":"primary","data-testid":`usage-data-${(p=t.feature)==null?void 0:p.refId}`,children:[(f=t.currentUsage)==null?void 0:f.toLocaleString(),!t.hasUnlimitedUsage&&` / ${(b=t.usageLimit)==null?void 0:b.toLocaleString()} (${sd(t.currentUsage||0,t.usageLimit)}%)`]}),jsxRuntime.jsx(Vh,{entitlement:t,feature:t.feature,onBuyMore:r,canBuyMore:!!e,onManageSubscription:n,canUpgradeSubscription:o,hasCustomSubscription:i})]}),jsxRuntime.jsx(Gh,{entitlement:t}),!t.hasUnlimitedUsage&&!HP__default.default(t.usageLimit)&&!HP__default.default(t.currentUsage)&&t.resetPeriod&&t.usagePeriodEnd?jsxRuntime.jsx(J,{color:"secondary",children:TP(t)}):null,t.hasUnlimitedUsage&&jsxRuntime.jsx(J,{color:"secondary",children:"In current billing period"})]}):null}var qP=W.div`
5463
5463
  margin-top: 32px;
5464
- `;function YP(){let t=Ei("md");return jsxRuntime.jsx(Ea__default.default,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:lodash.range(6).map(e=>jsxRuntime.jsx(Ea__default.default,{item:true,xs:t?4:12,children:jsxRuntime.jsx(lc__default.default,{width:280,height:120})},e))})}var ZP=6;function Xh({onManageSubscription:t,onBuyMore:e,filterEntitlements:n}){var dt,Y;let[r,i]=h0.useState(false),o=Ei("md"),{customerPortal:s,isLoading:l,textOverrides:p,theme:f}=ur(),b=l||!s,{entitlements:S,subscriptions:P}=s||{},I=S==null?void 0:S.filter(ot=>{var pt,lt;return ((pt=ot.feature)==null?void 0:pt.meterType)===zb.Fluctuating||((lt=ot.feature)==null?void 0:lt.meterType)===zb.Incremental}),T=P==null?void 0:P.find(({status:ot})=>ot===Pi.Active),F=(T==null?void 0:T.pricingType)===On.Custom,k=!!(s!=null&&s.canUpgradeSubscription),R=lodash.keyBy((dt=T==null?void 0:T.prices)!=null?dt:[],"feature.refId"),N=lodash.keyBy(I!=null?I:[],"feature.refId"),j=lodash.compact(((Y=T==null?void 0:T.prices)!=null?Y:[]).map(ot=>ot.feature&&N[ot.feature.refId]||void 0)),H=lodash.compact((I!=null?I:[]).filter(ot=>!R[ot.feature.refId])),Q=[...j,...H].filter(ot=>ot.usageLimit!==0),it=n?n(Q):Q,ct=o?it.length>2?4:6:12,U=r?it:it.slice(0,ZP),V=()=>i(ot=>!ot);return !b&&!(I!=null&&I.length)?null:jsxRuntime.jsxs(Ta,{className:"stigg-subscription-usage-layout",$backgroundColor:f.backgroundColor,$borderColor:f.borderColor,children:[jsxRuntime.jsx(Pa,{children:jsxRuntime.jsx(_a,{title:p.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:b})}),b?jsxRuntime.jsx(YP,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ea__default.default,{container:true,spacing:4,children:U.map(ot=>jsxRuntime.jsx(Ea__default.default,{className:`stigg-entitlement-usage-${ot.feature.refId}`,item:true,xs:ct,children:jsxRuntime.jsx(zP,{subscriptionPrice:R[ot.feature.refId],entitlement:ot,onManageSubscription:t,onBuyMore:e,hasCustomSubscription:F,canUpgradeSubscription:k},ot.feature.refId)},ot.feature.refId))}),it.length>ZP&&jsxRuntime.jsx(qP,{children:jsxRuntime.jsx(uc,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:r?jsxRuntime.jsx(reactFeather.Minus,{}):jsxRuntime.jsx(reactFeather.Plus,{}),onClick:V,children:r?"Show less":"Show more"})})]})]})}function e_({onManageSubscription:t,onBuyMore:e,onCancelScheduledUpdates:n,onContactSupport:r,paywallComponent:i,hiddenSections:o,filterEntitlements:s}){let{customerPortal:l,textOverrides:p,theme:f,isLoading:b,showWatermark:S}=ur(),P=h0.useRef(null),I=({intentionType:R})=>{var N,j;t?t({intentionType:R,customerSubscriptions:(N=l==null?void 0:l.subscriptions)!=null?N:[]}):(j=P==null?void 0:P.current)==null||j.scrollIntoView({behavior:"smooth"});},T=!(o!=null&&o.some(R=>R==="usage")),F=!(o!=null&&o.some(R=>R==="paymentDetails"||R==="billingInformation")),k=!(o!=null&&o.some(R=>R==="invoices"||R==="billingInformation"));return jsxRuntime.jsxs(GP,{className:"stigg-customer-portal-layout",children:[jsxRuntime.jsx(OP,{showWatermark:S}),jsxRuntime.jsxs($P,{className:"stigg-customer-portal-sections",children:[jsxRuntime.jsx(Hh,{onCancelScheduledUpdates:n,onBuyMore:e,onManageSubscription:I,onContactSupport:r,hiddenSections:o,cancelScheduledUpdatesButtonTitle:p.cancelScheduledUpdatesButtonTitle}),T&&jsxRuntime.jsx(Xh,{onManageSubscription:I,onBuyMore:e,filterEntitlements:s}),jsxRuntime.jsx(Bv,{ref:P,paywallComponent:i,theme:f,title:p.paywallSectionTitle,isLoading:!l||b}),F&&jsxRuntime.jsx(Kh,{}),k&&jsxRuntime.jsx(Zh,{})]})]})}function r_(o){var s=o,{textOverrides:t,theme:e,resourceId:n,productId:r}=s,i=Rn(s,["textOverrides","theme","resourceId","productId"]);return jsxRuntime.jsx(kh,{textOverrides:t,theme:e,resourceId:n,productId:r,children:jsxRuntime.jsx(e_,q({},i))})}function Zh(){let{customerPortal:t,isLoading:e,textOverrides:n,theme:r}=ur(),i=!t||e,o=i?jsxRuntime.jsx(qh,{}):t!=null&&t.billingPortalUrl?jsxRuntime.jsx(zh,{url:t.billingPortalUrl,text:n.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !i&&!(t!=null&&t.billingPortalUrl)?null:jsxRuntime.jsx(Ta,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxRuntime.jsxs(Pa,{className:"stigg-invoices-section-header",children:[jsxRuntime.jsx(_a,{isLoading:i,className:"stigg-invoices-section-title",title:n.invoicesTitle}),o]})})}var o_=t=>i___default.default(t,"displayName"),$v=t=>i___default.default(t,"addon.displayName");function AO(t,e){return t.pricePoints.some(n=>n.billingPeriod===e)}function a_({addon:t,currency:e,billingCountryCode:n}){return vt(q({},t),{pricePoints:t.pricePoints.filter(r=>r.currency===e&&(n?r.billingCountryCode===n:true))})}function s_({addons:t,billingCountryCode:e,currency:n}){var r;return ((r=t==null?void 0:t.filter(i=>{var o;return !((o=i.hiddenFromWidgets)!=null&&o.includes(Ju.Checkout))}))==null?void 0:r.map(i=>a_({addon:i,currency:n,billingCountryCode:e})))||[]}function c_({addons:t,billingPeriod:e,billingCountryCode:n,currency:r}){var i;return ((i=t==null?void 0:t.filter(o=>AO(o.addon,e)))==null?void 0:i.map(o=>vt(q({},o),{addon:a_({addon:o.addon,currency:r,billingCountryCode:n})})))||[]}function l_({activeSubscription:t,plan:e,billingCountryCode:n}){var l,p;let r=[],i=((p=(l=e==null?void 0:e.pricePoints)==null?void 0:l[0])==null?void 0:p.currency)||Zu.Usd,o=o_(s_({addons:e==null?void 0:e.compatibleAddons,billingCountryCode:n,currency:i})),s=c_({addons:t==null?void 0:t.addons,billingCountryCode:n,currency:i});return s!=null&&s.length&&(o!=null&&o.length)&&(r=$v(s.filter(f=>o.some(b=>b.id===f.addon.id)))),{addons:r,initialAddons:DO__default.default(r),availableAddons:o}}function FO(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.addonsStep.addons.find(o=>o.addon.id===e.id);i?i.quantity=n:(r.addonsStep.addons.push({addon:e,quantity:n}),r.addonsStep.addons=$v(r.addonsStep.addons));})}function RO(){let[,t]=Ve();return e=>t(n=>{kO__default.default(n.addonsStep.addons,r=>r.addon.id===e);})}function OO(){let[{addonsStep:t}]=Ve();return t}function u_(){let t=OO();return vt(q({},t),{setAddon:FO(),removeAddon:RO()})}function NO(){let[{checkout:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}]=Ve();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}}function MO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.readOnly=e;})}function LO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.isValid=e;})}function BO(){let[,t]=Ve();return e=>t(n=>{n.checkoutSuccess=e;})}function je(){let{checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}=NO();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r,setWidgetReadOnly:MO(),setIsValid:LO(),setCheckoutSuccess:BO()}}function p_({planId:t,resourceId:e,billingCountryCode:n,onMockCheckoutState:r}){let{stigg:i}=ce(),[o,s]=h0.useState(true),[l,p]=h0.useState();return h0.useEffect(()=>{let f=()=>ie(null,null,function*(){try{let b=yield i.getCheckoutState({planId:t,resourceId:e,billingCountryCode:n});p(b);}catch(b){sc.error(`Failed to load checkout ${b==null?void 0:b.message}`,b);}finally{s(false);}});if(r){s(false),p(r({planId:t,resourceId:e,billingCountryCode:n}));return}i.isCustomerLoaded&&(s(true),f());},[i,i.isCustomerLoaded,e,t,n,r]),{checkout:l,isLoading:o,showWatermark:i.getShowWatermark()}}var dd=$1(o0());var hg=(t,e)=>t.minUnitQuantity&&e<t.minUnitQuantity?t.minUnitQuantity:t.maxUnitQuantity&&e>t.maxUnitQuantity?t.maxUnitQuantity:e;var a0=$1(o0()),s0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Monthly)),c0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Annually)),Z_=t=>s0(t)&&c0(t);var eE=(t,e,n)=>t===dd.BillingPeriod.Monthly&&e||t===dd.BillingPeriod.Annually&&n?t:null,nE=({pricingModel:t})=>t===hn.PerUnit;function qL(t,e,n){var o;if(!e)return [];let r=J___default.default(t,"featureId"),i=J___default.default(tE__default.default((o=n==null?void 0:n.prices)==null?void 0:o.map(s=>{let{feature:l}=s;return !l||!nE(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return tE__default.default(e==null?void 0:e.map(s=>{var b,S,P;let l=(b=s.feature)==null?void 0:b.featureId;if(!l||!nE(s))return null;let p,f=((S=r[l])==null?void 0:S.quantity)||((P=i[l])==null?void 0:P.quantity);return p=hg(s,f||1),s.isTieredPrice&&!Xp(s.tiers)&&(p=sv(s.tiers,p).upTo),{featureId:l,quantity:p}}))}function YL({plan:t,activeSubscription:e,preferredBillingPeriod:n}){var s,l;let r=s0(t),i=c0(t);if(n){let p=eE(n,r,i);if(p)return p}if(((s=e==null?void 0:e.plan)==null?void 0:s.id)===(t==null?void 0:t.id))return ((l=e==null?void 0:e.price)==null?void 0:l.billingPeriod)||dd.BillingPeriod.Monthly;if(e!=null&&e.prices&&(e==null?void 0:e.prices.length)>0){let p=eE(e==null?void 0:e.prices[0].billingPeriod,r,i);if(p)return p}return i?dd.BillingPeriod.Annually:dd.BillingPeriod.Monthly}function rE({preferredBillingPeriod:t,plan:e,activeSubscription:n,billingCountryCode:r,preconfiguredBillableFeatures:i}){let o=YL({plan:e,activeSubscription:n,preferredBillingPeriod:t}),s=e==null?void 0:e.pricePoints.filter(p=>p.billingPeriod===o),l=qL(i,s,n);return {billingPeriod:o,billableFeatures:l,billingCountryCode:r}}function KL(){let[{planStep:t}]=Ve();return t}function QL(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.planStep.billableFeatures.find(o=>o.featureId===e);i?i.quantity=n:r.planStep.billableFeatures.push({featureId:e,quantity:n});})}function XL(){let[,t]=Ve();return e=>t(n=>{n.planStep.billingPeriod=e,n.addonsStep.addons=n.addonsStep.addons.filter(r=>r.addon.pricePoints.some(i=>i.billingPeriod===e));})}function yo(){let t=KL();return vt(q({},t),{setBillingPeriod:XL(),setBillableFeature:QL()})}var oE=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],iE={activeStep:0,completedSteps:[],steps:oE,isDisabled:false},JL=(t,e,n,r)=>{if(Z_(t)&&!r)return false;let i=e.map(s=>s.featureId),o=n.map(s=>s.featureId);return !(i.length!==o.length||!i.every(s=>o.includes(s)))};function aE({isLoading:t,skipCheckoutSteps:e,plan:n,availableAddons:r,availableCharges:i,preferredBillingPeriod:o,preconfiguredBillableFeatures:s}){if(t||!n)return iE;let l=[];return e.includes("PLAN")&&JL(n,i,s,o)&&l.push("PLAN"),((r==null?void 0:r.length)===0||e.includes("ADDONS"))&&l.push("ADDONS"),vt(q({},iE),{steps:oE.filter(p=>!l.includes(p.key))})}function t3(){let[{progressBar:t}]=Ve();return t}function e3(){let[t,e]=Ve();return n=>ie(null,null,function*(){let{progressBar:r,planStep:i,addonsStep:o,paymentStep:s,onBeforeStepChange:l}=t;if(n!==r.activeStep&&l){let p=r.steps[r.activeStep],f=r.steps[n];if(p&&f){let b={planStep:i,addonsStep:o,paymentStep:s};if(!(yield l({from:p.key,to:f.key,state:b})))return}}e(({progressBar:p})=>{p.activeStep=n;});})}function n3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.completedSteps.push(e);})}function r3(t){return t.completedSteps.length>=t.steps.length-1}function i3(){let[t,e]=Ve();return ()=>ie(null,null,function*(){let{progressBar:n,planStep:r,addonsStep:i,paymentStep:o,onBeforeStepChange:s}=t;if(n.isDisabled)return;let l=n.steps[n.activeStep],p=n.steps[n.activeStep+1];if(p&&s){let f={planStep:r,addonsStep:i,paymentStep:o};if(!(yield s({from:l.key,to:p.key,state:f})))return}e(({progressBar:f})=>{f.completedSteps.includes(f.activeStep)||f.completedSteps.push(f.activeStep),f.activeStep<f.steps.length-1&&(f.activeStep+=1);});})}function o3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.isDisabled=!!e;})}function wa(){let t=t3();return {currentStep:t.steps[t.activeStep],progressBarState:t,isLastStep:t.activeStep===t.steps.length-1,isCheckoutComplete:r3(t),setActiveStep:e3(),markStepAsCompleted:n3(),goNext:i3(),setIsDisabled:o3()}}function pd(){let[{planStep:t,addonsStep:e,promotionCode:n,paymentStep:r}]=Ve();return vt(q({},t),{addons:e.addons,promotionCode:n,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function gg({billingAddress:t,taxPercentage:e,taxIds:n}){if(!t&&!e&&!(n!=null&&n.length))return {};let r=n!=null&&n.length?n==null?void 0:n.filter(i=>i.value&&i.type):void 0;return {billingInformation:vt(q(q({},t?{billingAddress:t}:{}),e?{taxPercentage:e}:{}),{taxIds:r})}}var l3=I=>ie(null,[I],function*({stigg:t,customerId:e,planId:n,resourceId:r,promotionCode:i,addons:o,billableFeatures:s,billingCountryCode:l,billingPeriod:p,billingAddress:f,taxPercentage:b,taxIds:S,onMockCheckoutPreview:P}){var R;let T=o.map(({addon:N,quantity:j})=>({addonId:N.id,quantity:j})),F=null,k=null;try{if(e&&n){let N=q({customerId:e,planId:n,resourceId:r,billingCountryCode:l,addons:T,billingPeriod:p,promotionCode:i,billableFeatures:fR__default.default(s)?void 0:s},gg({billingAddress:f,taxPercentage:b,taxIds:S}));F=P?P(N):yield t.previewSubscription(N);}}catch(N){let[,j]=((R=N==null?void 0:N.message)==null?void 0:R.split("Error:"))||[];k=j==null?void 0:j.trim();}return {subscriptionPreview:F,errorMessage:k}}),u0=({onMockCheckoutPreview:t}={})=>{let{stigg:e}=ce(),n=pd(),[{resourceId:r}]=Ve(),{checkoutState:i,widgetState:o}=je(),{plan:s,customer:l}=i||{};return {previewSubscriptionAction:h0.useCallback((...b)=>ie(null,[...b],function*({promotionCode:f}={}){return o.isValid?l3({stigg:e,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:n.addons,billableFeatures:n.billableFeatures,billingCountryCode:n.billingCountryCode,billingPeriod:n.billingPeriod,billingAddress:n.billingAddress,taxPercentage:n.taxPercentage,promotionCode:f!=null?f:n.promotionCode,taxIds:n.taxId?[n.taxId]:void 0,onMockCheckoutPreview:t}):{subscriptionPreview:null,errorMessage:null}}),[e,l==null?void 0:l.id,s==null?void 0:s.id,r,n.addons,n.billableFeatures,n.billingCountryCode,n.billingPeriod,n.billingAddress,n.taxPercentage,n.taxId,n.promotionCode,o.isValid,t])}},u3=500,sE=({onMockCheckoutPreview:t}={})=>{let[e,n]=h0.useState(null),[r,i]=h0.useState(null),[o,s]=h0.useState(false),{previewSubscriptionAction:l}=u0({onMockCheckoutPreview:t});return h0.useEffect(()=>{let p=()=>ie(null,null,function*(){let{subscriptionPreview:b,errorMessage:S}=yield l();b&&(n(b),i(null)),S&&(i(S),n(null)),s(false);});s(true);let f=setTimeout(()=>{s(true),p();},u3);return ()=>{clearTimeout(f);}},[l]),{subscriptionPreview:e,isFetchingSubscriptionPreview:o,errorMessage:r}};function cE({customer:t,taxPercentage:e,taxId:n}){return {useNewPaymentMethod:!(t!=null&&t.paymentMethodDetails),taxPercentage:e,taxId:n}}function d3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.useNewPaymentMethod=e;}),[t])}function p3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.errorMessage=e;}),[t])}function f3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.billingAddress=e;}),[t])}function m3(){let[{paymentStep:t}]=Ve();return t}function h3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.taxId=e;}),[t])}function Yr(){let t=m3();return vt(q({},t),{setUseNewPaymentMethod:d3(),setErrorMessage:p3(),setBillingAddress:f3(),setTaxId:h3()})}function lE(t){return t2__default.default({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:n})=>n===Se.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:n})=>`${n.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:n})=>`Billed ${n.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:n})=>`Your account will be granted credits worth ${n} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:n,currency:r})=>{let i="";n.type===jb.Percentage?i=`${n.value}% off`:i=`${Nn({amount:n.value,currency:r})}`;let o="";switch(n.durationType){case hh.Once:{o=" once";break}case hh.Repeating:{o=`${n.type===jb.Fixed?" per month":""} for ${n.durationInMonths} months`;break}case hh.Forever:default:o="";}return `${i}${o}`},taxTitle:({taxDetails:n})=>`Tax (${n==null?void 0:n.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:n})=>`Your changes will take effect at the end of your current billing cycle on ${_1__default.default(n).format("MMMM D, YYYY")}.`,checkoutSuccessText:"Changes applied",payAsYouGoTooltipText:"Billed according to actual usage"},checkoutButton:{nextText:"Next",noChangesText:"No changes",updateText:"Update subscription",downgradeToFreeText:"Cancel subscription",upgradeText:"Subscribe"},downgradeToFree:{alertText:()=>"We\u2019re sorry to see you cancel your paid subscription \u{1F62D}",freePlanHeader:()=>"New plan",freePlanName:({plan:n})=>`${n.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:n})=>`${n.displayName}`,paidPlanPriceText:({billingPeriod:n})=>`Paid plan${n?`, billed ${n.toLowerCase()}`:""}`},nextBillingCaption:()=>""},t)}var gf={primary:"rgb(50, 126, 238)",textColor:"rgb(0, 30, 108)",backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(235, 237, 243)",summaryBackgroundColor:"rgb(109, 121, 144)"};function uE(t,e,n){let{palette:r}=t||{};return {primary:(e==null?void 0:e.primary)||(r==null?void 0:r.primary)||gf.primary,textColor:(e==null?void 0:e.textColor)||(r==null?void 0:r.text.primary)||gf.textColor,backgroundColor:(e==null?void 0:e.backgroundColor)||(r==null?void 0:r.backgroundPaper)||gf.backgroundColor,borderColor:(e==null?void 0:e.borderColor)||(r==null?void 0:r.outlinedBorder)||gf.borderColor,summaryBackgroundColor:(e==null?void 0:e.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||gf.summaryBackgroundColor,paymentInputBackgroundColor:e==null?void 0:e.paymentInputBackgroundColor,paymentInputBorderColor:e==null?void 0:e.paymentInputBorderColor,paymentInputBorderRadius:e==null?void 0:e.paymentInputBorderRadius}}var p0=h0__default.default.createContext(null);p0.displayName="CheckoutContext";var Ve=()=>{let t=h0.useContext(p0);if(!t)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return t},_3=({children:t,initialState:e})=>{let[n,r]=h0.useState(e);h0.useEffect(()=>{r(e);},[e]);let i=h0.useCallback(l=>r(p=>immer.produce(p,f=>l(f))),[r]),[o,s]=h0.useMemo(()=>[n,i],[i,n]);return jsxRuntime.jsx(p0.Provider,{value:[o,s],children:t})};function pE({children:t,textOverrides:e,theme:n,preferredBillingPeriod:r,billableFeatures:i,resourceId:o,planId:s,billingCountryCode:l,billingInformation:p,onMockCheckoutState:f,skipCheckoutSteps:b,onBeforeStepChange:S}){var N;let{checkout:P,isLoading:I,showWatermark:T}=p_({resourceId:o,planId:s,billingCountryCode:l,onMockCheckoutState:f}),F=P!=null&&P.configuration?Px(P.configuration):{typography:rf(null,wh)},k=_l(F),R=h0.useMemo(()=>{var dt,Y;let j=uE(k,n,P==null?void 0:P.configuration),H=lE(e),Q=rE({preferredBillingPeriod:r,plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:i!=null?i:[]}),it=l_({plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription}),ct=cE({customer:P==null?void 0:P.customer,taxPercentage:(dt=p==null?void 0:p.taxDetails)==null?void 0:dt.taxPercentage}),U=aE({isLoading:I,skipCheckoutSteps:b!=null?b:[],plan:P==null?void 0:P.plan,availableAddons:it.availableAddons,availableCharges:Q.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:i!=null?i:[]});return {checkout:P,checkoutLocalization:H,stiggTheme:k,theme:j,progressBar:U,planStep:Q,addonsStep:it,paymentStep:ct,resourceId:(Y=P==null?void 0:P.resource)==null?void 0:Y.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:I},showWatermark:T,checkoutSuccess:false,onBeforeStepChange:S}},[r,l,P,I,b,(N=p==null?void 0:p.taxDetails)==null?void 0:N.taxPercentage,S]);return jsxRuntime.jsx(Xn,{componentTheme:F,children:jsxRuntime.jsx(_3,{initialState:R,children:t})},P==null?void 0:P.plan.id)}var fE="920px",hE=W.div`
5464
+ `;function YP(){let t=Ei("md");return jsxRuntime.jsx(Ea__default.default,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:lodash.range(6).map(e=>jsxRuntime.jsx(Ea__default.default,{item:true,xs:t?4:12,children:jsxRuntime.jsx(lc__default.default,{width:280,height:120})},e))})}var ZP=6;function Xh({onManageSubscription:t,onBuyMore:e,filterEntitlements:n}){var dt,Y;let[r,i]=h0.useState(false),o=Ei("md"),{customerPortal:s,isLoading:l,textOverrides:p,theme:f}=ur(),b=l||!s,{entitlements:S,subscriptions:P}=s||{},I=S==null?void 0:S.filter(ot=>{var pt,lt;return ((pt=ot.feature)==null?void 0:pt.meterType)===zb.Fluctuating||((lt=ot.feature)==null?void 0:lt.meterType)===zb.Incremental}),T=P==null?void 0:P.find(({status:ot})=>ot===Pi.Active),F=(T==null?void 0:T.pricingType)===On.Custom,k=!!(s!=null&&s.canUpgradeSubscription),R=lodash.keyBy((dt=T==null?void 0:T.prices)!=null?dt:[],"feature.refId"),N=lodash.keyBy(I!=null?I:[],"feature.refId"),j=lodash.compact(((Y=T==null?void 0:T.prices)!=null?Y:[]).map(ot=>ot.feature&&N[ot.feature.refId]||void 0)),H=lodash.compact((I!=null?I:[]).filter(ot=>!R[ot.feature.refId])),Q=[...j,...H].filter(ot=>ot.usageLimit!==0),it=n?n(Q):Q,ct=o?it.length>2?4:6:12,U=r?it:it.slice(0,ZP),V=()=>i(ot=>!ot);return !b&&!(I!=null&&I.length)?null:jsxRuntime.jsxs(Ta,{className:"stigg-subscription-usage-layout",$backgroundColor:f.backgroundColor,$borderColor:f.borderColor,children:[jsxRuntime.jsx(Pa,{children:jsxRuntime.jsx(_a,{title:p.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:b})}),b?jsxRuntime.jsx(YP,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Ea__default.default,{container:true,spacing:4,children:U.map(ot=>jsxRuntime.jsx(Ea__default.default,{className:`stigg-entitlement-usage-${ot.feature.refId}`,item:true,xs:ct,children:jsxRuntime.jsx(zP,{subscriptionPrice:R[ot.feature.refId],entitlement:ot,onManageSubscription:t,onBuyMore:e,hasCustomSubscription:F,canUpgradeSubscription:k},ot.feature.refId)},ot.feature.refId))}),it.length>ZP&&jsxRuntime.jsx(qP,{children:jsxRuntime.jsx(uc,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:r?jsxRuntime.jsx(reactFeather.Minus,{}):jsxRuntime.jsx(reactFeather.Plus,{}),onClick:V,children:r?"Show less":"Show more"})})]})]})}function e_({onManageSubscription:t,onBuyMore:e,onCancelScheduledUpdates:n,onContactSupport:r,paywallComponent:i,hiddenSections:o,filterEntitlements:s}){let{customerPortal:l,textOverrides:p,theme:f,isLoading:b,showWatermark:S}=ur(),P=h0.useRef(null),I=({intentionType:R})=>{var N,j;t?t({intentionType:R,customerSubscriptions:(N=l==null?void 0:l.subscriptions)!=null?N:[]}):(j=P==null?void 0:P.current)==null||j.scrollIntoView({behavior:"smooth"});},T=!(o!=null&&o.some(R=>R==="usage")),F=!(o!=null&&o.some(R=>R==="paymentDetails"||R==="billingInformation")),k=!(o!=null&&o.some(R=>R==="invoices"||R==="billingInformation"));return jsxRuntime.jsxs(GP,{className:"stigg-customer-portal-layout",children:[jsxRuntime.jsx(OP,{showWatermark:S}),jsxRuntime.jsxs($P,{className:"stigg-customer-portal-sections",children:[jsxRuntime.jsx(Hh,{onCancelScheduledUpdates:n,onBuyMore:e,onManageSubscription:I,onContactSupport:r,hiddenSections:o,cancelScheduledUpdatesButtonTitle:p.cancelScheduledUpdatesButtonTitle}),T&&jsxRuntime.jsx(Xh,{onManageSubscription:I,onBuyMore:e,filterEntitlements:s}),jsxRuntime.jsx(Bv,{ref:P,paywallComponent:i,theme:f,title:p.paywallSectionTitle,isLoading:!l||b}),F&&jsxRuntime.jsx(Kh,{}),k&&jsxRuntime.jsx(Zh,{})]})]})}function r_(o){var s=o,{textOverrides:t,theme:e,resourceId:n,productId:r}=s,i=Rn(s,["textOverrides","theme","resourceId","productId"]);return jsxRuntime.jsx(kh,{textOverrides:t,theme:e,resourceId:n,productId:r,children:jsxRuntime.jsx(e_,q({},i))})}function Zh(){let{customerPortal:t,isLoading:e,textOverrides:n,theme:r}=ur(),i=!t||e,o=i?jsxRuntime.jsx(qh,{}):t!=null&&t.billingPortalUrl?jsxRuntime.jsx(zh,{url:t.billingPortalUrl,text:n.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !i&&!(t!=null&&t.billingPortalUrl)?null:jsxRuntime.jsx(Ta,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxRuntime.jsxs(Pa,{className:"stigg-invoices-section-header",children:[jsxRuntime.jsx(_a,{isLoading:i,className:"stigg-invoices-section-title",title:n.invoicesTitle}),o]})})}var o_=t=>i___default.default(t,"displayName"),$v=t=>i___default.default(t,"addon.displayName");function AO(t,e){return t.pricePoints.some(n=>n.billingPeriod===e)}function a_({addon:t,currency:e,billingCountryCode:n}){return vt(q({},t),{pricePoints:t.pricePoints.filter(r=>r.currency===e&&(n?r.billingCountryCode===n:true))})}function s_({addons:t,billingCountryCode:e,currency:n}){var r;return ((r=t==null?void 0:t.filter(i=>{var o;return !((o=i.hiddenFromWidgets)!=null&&o.includes(Ju.Checkout))}))==null?void 0:r.map(i=>a_({addon:i,currency:n,billingCountryCode:e})))||[]}function c_({addons:t,billingPeriod:e,billingCountryCode:n,currency:r}){var i;return ((i=t==null?void 0:t.filter(o=>AO(o.addon,e)))==null?void 0:i.map(o=>vt(q({},o),{addon:a_({addon:o.addon,currency:r,billingCountryCode:n})})))||[]}function l_({activeSubscription:t,plan:e,billingCountryCode:n,billingPeriod:r}){var p,f;let i=[],o=((f=(p=e==null?void 0:e.pricePoints)==null?void 0:p[0])==null?void 0:f.currency)||Zu.Usd,s=o_(s_({addons:e==null?void 0:e.compatibleAddons,billingCountryCode:n,currency:o})),l=c_({addons:t==null?void 0:t.addons,billingPeriod:r,billingCountryCode:n,currency:o});return l!=null&&l.length&&(s!=null&&s.length)&&(i=$v(l.filter(b=>s.some(S=>S.id===b.addon.id)))),{addons:i,initialAddons:DO__default.default(i),availableAddons:s}}function FO(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.addonsStep.addons.find(o=>o.addon.id===e.id);i?i.quantity=n:(r.addonsStep.addons.push({addon:e,quantity:n}),r.addonsStep.addons=$v(r.addonsStep.addons));})}function RO(){let[,t]=Ve();return e=>t(n=>{kO__default.default(n.addonsStep.addons,r=>r.addon.id===e);})}function OO(){let[{addonsStep:t}]=Ve();return t}function u_(){let t=OO();return vt(q({},t),{setAddon:FO(),removeAddon:RO()})}function NO(){let[{checkout:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}]=Ve();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}}function MO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.readOnly=e;})}function LO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.isValid=e;})}function BO(){let[,t]=Ve();return e=>t(n=>{n.checkoutSuccess=e;})}function je(){let{checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}=NO();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r,setWidgetReadOnly:MO(),setIsValid:LO(),setCheckoutSuccess:BO()}}function p_({planId:t,resourceId:e,billingCountryCode:n,onMockCheckoutState:r}){let{stigg:i}=ce(),[o,s]=h0.useState(true),[l,p]=h0.useState();return h0.useEffect(()=>{let f=()=>ie(null,null,function*(){try{let b=yield i.getCheckoutState({planId:t,resourceId:e,billingCountryCode:n});p(b);}catch(b){sc.error(`Failed to load checkout ${b==null?void 0:b.message}`,b);}finally{s(false);}});if(r){s(false),p(r({planId:t,resourceId:e,billingCountryCode:n}));return}i.isCustomerLoaded&&(s(true),f());},[i,i.isCustomerLoaded,e,t,n,r]),{checkout:l,isLoading:o,showWatermark:i.getShowWatermark()}}var dd=$1(o0());var hg=(t,e)=>t.minUnitQuantity&&e<t.minUnitQuantity?t.minUnitQuantity:t.maxUnitQuantity&&e>t.maxUnitQuantity?t.maxUnitQuantity:e;var a0=$1(o0()),s0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Monthly)),c0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Annually)),Z_=t=>s0(t)&&c0(t);var eE=(t,e,n)=>t===dd.BillingPeriod.Monthly&&e||t===dd.BillingPeriod.Annually&&n?t:null,nE=({pricingModel:t})=>t===hn.PerUnit;function qL(t,e,n){var o;if(!e)return [];let r=J___default.default(t,"featureId"),i=J___default.default(tE__default.default((o=n==null?void 0:n.prices)==null?void 0:o.map(s=>{let{feature:l}=s;return !l||!nE(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return tE__default.default(e==null?void 0:e.map(s=>{var b,S,P;let l=(b=s.feature)==null?void 0:b.featureId;if(!l||!nE(s))return null;let p,f=((S=r[l])==null?void 0:S.quantity)||((P=i[l])==null?void 0:P.quantity);return p=hg(s,f||1),s.isTieredPrice&&!Xp(s.tiers)&&(p=sv(s.tiers,p).upTo),{featureId:l,quantity:p}}))}function YL({plan:t,activeSubscription:e,preferredBillingPeriod:n}){var s,l;let r=s0(t),i=c0(t);if(n){let p=eE(n,r,i);if(p)return p}if(((s=e==null?void 0:e.plan)==null?void 0:s.id)===(t==null?void 0:t.id))return ((l=e==null?void 0:e.price)==null?void 0:l.billingPeriod)||dd.BillingPeriod.Monthly;if(e!=null&&e.prices&&(e==null?void 0:e.prices.length)>0){let p=eE(e==null?void 0:e.prices[0].billingPeriod,r,i);if(p)return p}return i?dd.BillingPeriod.Annually:dd.BillingPeriod.Monthly}function rE({preferredBillingPeriod:t,plan:e,activeSubscription:n,billingCountryCode:r,preconfiguredBillableFeatures:i}){let o=YL({plan:e,activeSubscription:n,preferredBillingPeriod:t}),s=e==null?void 0:e.pricePoints.filter(p=>p.billingPeriod===o),l=qL(i,s,n);return {billingPeriod:o,billableFeatures:l,billingCountryCode:r}}function KL(){let[{planStep:t}]=Ve();return t}function QL(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.planStep.billableFeatures.find(o=>o.featureId===e);i?i.quantity=n:r.planStep.billableFeatures.push({featureId:e,quantity:n});})}function XL(){let[,t]=Ve();return e=>t(n=>{n.planStep.billingPeriod=e,n.addonsStep.addons=n.addonsStep.addons.filter(r=>r.addon.pricePoints.some(i=>i.billingPeriod===e));})}function yo(){let t=KL();return vt(q({},t),{setBillingPeriod:XL(),setBillableFeature:QL()})}var oE=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],iE={activeStep:0,completedSteps:[],steps:oE,isDisabled:false},JL=(t,e,n,r)=>{if(Z_(t)&&!r)return false;let i=e.map(s=>s.featureId),o=n.map(s=>s.featureId);return !(i.length!==o.length||!i.every(s=>o.includes(s)))};function aE({isLoading:t,skipCheckoutSteps:e,plan:n,availableAddons:r,availableCharges:i,preferredBillingPeriod:o,preconfiguredBillableFeatures:s}){if(t||!n)return iE;let l=[];return e.includes("PLAN")&&JL(n,i,s,o)&&l.push("PLAN"),((r==null?void 0:r.length)===0||e.includes("ADDONS"))&&l.push("ADDONS"),vt(q({},iE),{steps:oE.filter(p=>!l.includes(p.key))})}function t3(){let[{progressBar:t}]=Ve();return t}function e3(){let[t,e]=Ve();return n=>ie(null,null,function*(){let{progressBar:r,planStep:i,addonsStep:o,paymentStep:s,onBeforeStepChange:l}=t;if(n!==r.activeStep&&l){let p=r.steps[r.activeStep],f=r.steps[n];if(p&&f){let b={planStep:i,addonsStep:o,paymentStep:s};if(!(yield l({from:p.key,to:f.key,state:b})))return}}e(({progressBar:p})=>{p.activeStep=n;});})}function n3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.completedSteps.push(e);})}function r3(t){return t.completedSteps.length>=t.steps.length-1}function i3(){let[t,e]=Ve();return ()=>ie(null,null,function*(){let{progressBar:n,planStep:r,addonsStep:i,paymentStep:o,onBeforeStepChange:s}=t;if(n.isDisabled)return;let l=n.steps[n.activeStep],p=n.steps[n.activeStep+1];if(p&&s){let f={planStep:r,addonsStep:i,paymentStep:o};if(!(yield s({from:l.key,to:p.key,state:f})))return}e(({progressBar:f})=>{f.completedSteps.includes(f.activeStep)||f.completedSteps.push(f.activeStep),f.activeStep<f.steps.length-1&&(f.activeStep+=1);});})}function o3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.isDisabled=!!e;})}function wa(){let t=t3();return {currentStep:t.steps[t.activeStep],progressBarState:t,isLastStep:t.activeStep===t.steps.length-1,isCheckoutComplete:r3(t),setActiveStep:e3(),markStepAsCompleted:n3(),goNext:i3(),setIsDisabled:o3()}}function pd(){let[{planStep:t,addonsStep:e,promotionCode:n,paymentStep:r}]=Ve();return vt(q({},t),{addons:e.addons,promotionCode:n,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function gg({billingAddress:t,taxPercentage:e,taxIds:n}){if(!t&&!e&&!(n!=null&&n.length))return {};let r=n!=null&&n.length?n==null?void 0:n.filter(i=>i.value&&i.type):void 0;return {billingInformation:vt(q(q({},t?{billingAddress:t}:{}),e?{taxPercentage:e}:{}),{taxIds:r})}}var l3=I=>ie(null,[I],function*({stigg:t,customerId:e,planId:n,resourceId:r,promotionCode:i,addons:o,billableFeatures:s,billingCountryCode:l,billingPeriod:p,billingAddress:f,taxPercentage:b,taxIds:S,onMockCheckoutPreview:P}){var R;let T=o.map(({addon:N,quantity:j})=>({addonId:N.id,quantity:j})),F=null,k=null;try{if(e&&n){let N=q({customerId:e,planId:n,resourceId:r,billingCountryCode:l,addons:T,billingPeriod:p,promotionCode:i,billableFeatures:fR__default.default(s)?void 0:s},gg({billingAddress:f,taxPercentage:b,taxIds:S}));F=P?P(N):yield t.previewSubscription(N);}}catch(N){let[,j]=((R=N==null?void 0:N.message)==null?void 0:R.split("Error:"))||[];k=j==null?void 0:j.trim();}return {subscriptionPreview:F,errorMessage:k}}),u0=({onMockCheckoutPreview:t}={})=>{let{stigg:e}=ce(),n=pd(),[{resourceId:r}]=Ve(),{checkoutState:i,widgetState:o}=je(),{plan:s,customer:l}=i||{};return {previewSubscriptionAction:h0.useCallback((...b)=>ie(null,[...b],function*({promotionCode:f}={}){return o.isValid?l3({stigg:e,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:n.addons,billableFeatures:n.billableFeatures,billingCountryCode:n.billingCountryCode,billingPeriod:n.billingPeriod,billingAddress:n.billingAddress,taxPercentage:n.taxPercentage,promotionCode:f!=null?f:n.promotionCode,taxIds:n.taxId?[n.taxId]:void 0,onMockCheckoutPreview:t}):{subscriptionPreview:null,errorMessage:null}}),[e,l==null?void 0:l.id,s==null?void 0:s.id,r,n.addons,n.billableFeatures,n.billingCountryCode,n.billingPeriod,n.billingAddress,n.taxPercentage,n.taxId,n.promotionCode,o.isValid,t])}},u3=500,sE=({onMockCheckoutPreview:t}={})=>{let[e,n]=h0.useState(null),[r,i]=h0.useState(null),[o,s]=h0.useState(false),{previewSubscriptionAction:l}=u0({onMockCheckoutPreview:t});return h0.useEffect(()=>{let p=()=>ie(null,null,function*(){let{subscriptionPreview:b,errorMessage:S}=yield l();b&&(n(b),i(null)),S&&(i(S),n(null)),s(false);});s(true);let f=setTimeout(()=>{s(true),p();},u3);return ()=>{clearTimeout(f);}},[l]),{subscriptionPreview:e,isFetchingSubscriptionPreview:o,errorMessage:r}};function cE({customer:t,taxPercentage:e,taxId:n}){return {useNewPaymentMethod:!(t!=null&&t.paymentMethodDetails),taxPercentage:e,taxId:n}}function d3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.useNewPaymentMethod=e;}),[t])}function p3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.errorMessage=e;}),[t])}function f3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.billingAddress=e;}),[t])}function m3(){let[{paymentStep:t}]=Ve();return t}function h3(){let[,t]=Ve();return h0.useCallback(e=>t(n=>{n.paymentStep.taxId=e;}),[t])}function Yr(){let t=m3();return vt(q({},t),{setUseNewPaymentMethod:d3(),setErrorMessage:p3(),setBillingAddress:f3(),setTaxId:h3()})}function lE(t){return t2__default.default({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:n})=>n===Se.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:n})=>`${n.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:n})=>`Billed ${n.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:n})=>`Your account will be granted credits worth ${n} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:n,currency:r})=>{let i="";n.type===jb.Percentage?i=`${n.value}% off`:i=`${Nn({amount:n.value,currency:r})}`;let o="";switch(n.durationType){case hh.Once:{o=" once";break}case hh.Repeating:{o=`${n.type===jb.Fixed?" per month":""} for ${n.durationInMonths} months`;break}case hh.Forever:default:o="";}return `${i}${o}`},taxTitle:({taxDetails:n})=>`Tax (${n==null?void 0:n.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:n})=>`Your changes will take effect at the end of your current billing cycle on ${_1__default.default(n).format("MMMM D, YYYY")}.`,checkoutSuccessText:"Changes applied",payAsYouGoTooltipText:"Billed according to actual usage"},checkoutButton:{nextText:"Next",noChangesText:"No changes",updateText:"Update subscription",downgradeToFreeText:"Cancel subscription",upgradeText:"Subscribe"},downgradeToFree:{alertText:()=>"We\u2019re sorry to see you cancel your paid subscription \u{1F62D}",freePlanHeader:()=>"New plan",freePlanName:({plan:n})=>`${n.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:n})=>`${n.displayName}`,paidPlanPriceText:({billingPeriod:n})=>`Paid plan${n?`, billed ${n.toLowerCase()}`:""}`},nextBillingCaption:()=>""},t)}var gf={primary:"rgb(50, 126, 238)",textColor:"rgb(0, 30, 108)",backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(235, 237, 243)",summaryBackgroundColor:"rgb(109, 121, 144)"};function uE(t,e,n){let{palette:r}=t||{};return {primary:(e==null?void 0:e.primary)||(r==null?void 0:r.primary)||gf.primary,textColor:(e==null?void 0:e.textColor)||(r==null?void 0:r.text.primary)||gf.textColor,backgroundColor:(e==null?void 0:e.backgroundColor)||(r==null?void 0:r.backgroundPaper)||gf.backgroundColor,borderColor:(e==null?void 0:e.borderColor)||(r==null?void 0:r.outlinedBorder)||gf.borderColor,summaryBackgroundColor:(e==null?void 0:e.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||gf.summaryBackgroundColor,paymentInputBackgroundColor:e==null?void 0:e.paymentInputBackgroundColor,paymentInputBorderColor:e==null?void 0:e.paymentInputBorderColor,paymentInputBorderRadius:e==null?void 0:e.paymentInputBorderRadius}}var p0=h0__default.default.createContext(null);p0.displayName="CheckoutContext";var Ve=()=>{let t=h0.useContext(p0);if(!t)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return t},_3=({children:t,initialState:e})=>{let[n,r]=h0.useState(e);h0.useEffect(()=>{r(e);},[e]);let i=h0.useCallback(l=>r(p=>immer.produce(p,f=>l(f))),[r]),[o,s]=h0.useMemo(()=>[n,i],[i,n]);return jsxRuntime.jsx(p0.Provider,{value:[o,s],children:t})};function pE({children:t,textOverrides:e,theme:n,preferredBillingPeriod:r,billableFeatures:i,resourceId:o,planId:s,billingCountryCode:l,billingInformation:p,onMockCheckoutState:f,skipCheckoutSteps:b,onBeforeStepChange:S}){var N;let{checkout:P,isLoading:I,showWatermark:T}=p_({resourceId:o,planId:s,billingCountryCode:l,onMockCheckoutState:f}),F=P!=null&&P.configuration?Px(P.configuration):{typography:rf(null,wh)},k=_l(F),R=h0.useMemo(()=>{var dt,Y;let j=uE(k,n,P==null?void 0:P.configuration),H=lE(e),Q=rE({preferredBillingPeriod:r,plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:i!=null?i:[]}),it=l_({plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingPeriod:Q.billingPeriod}),ct=cE({customer:P==null?void 0:P.customer,taxPercentage:(dt=p==null?void 0:p.taxDetails)==null?void 0:dt.taxPercentage}),U=aE({isLoading:I,skipCheckoutSteps:b!=null?b:[],plan:P==null?void 0:P.plan,availableAddons:it.availableAddons,availableCharges:Q.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:i!=null?i:[]});return {checkout:P,checkoutLocalization:H,stiggTheme:k,theme:j,progressBar:U,planStep:Q,addonsStep:it,paymentStep:ct,resourceId:(Y=P==null?void 0:P.resource)==null?void 0:Y.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:I},showWatermark:T,checkoutSuccess:false,onBeforeStepChange:S}},[r,l,P,I,b,(N=p==null?void 0:p.taxDetails)==null?void 0:N.taxPercentage,S]);return jsxRuntime.jsx(Xn,{componentTheme:F,children:jsxRuntime.jsx(_3,{initialState:R,children:t})},P==null?void 0:P.plan.id)}var fE="920px",hE=W.div`
5465
5465
  margin: auto;
5466
5466
  min-height: 760px;
5467
5467
  max-width: ${fE};
@@ -5119,7 +5119,7 @@ ${e.o5f}`,e.zBW=r.default`
5119
5119
  display: flex;
5120
5120
  flex-direction: column;
5121
5121
  align-items: center;
5122
- `,yx=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:l,onPlanSelected:p,paywallLocale:f,locale:b,shouldHidePlan:S,selectDefaultTierIndex:P,currentSubscriptionOverride:I,hideCompatibleAddons:T,showWatermark:F})=>{let k=fx(t),R=t.some(Y=>!!Y.description),N=yv(t,Se.Monthly),j=yv(t,Se.Annually),H=gx(t,i,S),Q=useCallback((Y,ot,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:ot,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),it=!!n&&n.plan.pricingType===On.Custom,ct=useMemo(()=>H.some(Y=>{var lt;let ot=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(lt=Y.paywallCalculatedPricePoints)==null?void 0:lt.find(mt=>mt.billingPeriod===i);return ot.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,H]),U=useMemo(()=>H.some(Y=>!!Eh(Y,i,f,b,N).unit),[i,N,b,f,H]),V=useMemo(()=>!it&&H.some(Y=>{let ot=_h({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:I});return Object.values(ot).length>0}),[i,n,I,it,H]),dt=H.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsx(_F,{className:"stigg-paywall-container",children:jsxs(EF,{className:"stigg-paywall-layout",children:[jsx(lx,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:k}),jsx(PF,{className:"stigg-paywall-plans-layout",children:H.map(Y=>jsx(sx,{withUnitPriceRow:U,withTiersRow:V,withTrialLeftRow:dt,shouldShowDescriptionSection:R,hasMonthlyPrice:N,hasAnnuallyPrice:j,plan:Y,withStartingAtRow:ct,currentSubscription:n,currentSubscriptionOverride:I,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:l,onPlanSelected:(ot,pt)=>Q(Y,ot,pt),paywallLocale:f,locale:b,customer:e,isCustomerInCustomPlan:it,selectDefaultTierIndex:P,hideCompatibleAddons:T},Y.id))}),jsx(go,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:F})]})})};var vv=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},sc=new vv;function bx(t,e,n){let r=t.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),i=countBy(r),o=uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let l=e.find(p=>p.status===Pi.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(i[Se.Monthly]||0)>(i[Se.Annually]||0)?Se.Monthly:Se.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function Cx(t){return _1.utc(t).diff(_1.utc(),"days",false)+1}var wh={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 cc(t,e="px"){if(t)return `${t}${e}`}function Ah(t){if(!t)return "normal";switch(t){case Hb.Normal:return "normal";case Hb.Bold:return "bold";default:return "normal"}}function rf(t,e){var r,i,o,s,l,p,f,b;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:cc((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:Ah((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:cc((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:Ah((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:cc((l=t==null?void 0:t.h3)==null?void 0:l.fontSize)||n.h3.fontSize,fontWeight:Ah((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:cc((f=t==null?void 0:t.body)==null?void 0:f.fontSize)||n.body.fontSize,fontWeight:Ah((b=t==null?void 0:t.body)==null?void 0:b.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Cv(t){if(t)switch(t){case mh.Left:return "left";case mh.Center:return "center";case mh.Right:return "right";default:return}}function Sx(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:rf(r),customCss:n||void 0}}function xx(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:rf(i),layout:{ctaAlignment:Cv(n==null?void 0:n.alignment),headerAlignment:Cv(n==null?void 0:n.alignment),descriptionAlignment:Cv(n==null?void 0:n.alignment),planMaxWidth:cc(n==null?void 0:n.planWidth),planMinWidth:cc(n==null?void 0:n.planWidth),planMargin:cc(n==null?void 0:n.planMargin),planPadding:cc(n==null?void 0:n.planPadding)}}}function Px(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:rf(n,wh),customCss:r||void 0}}function DF(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===Pi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?Cx(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===Pi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function Ex(t,e,n){var H,Q;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:l,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:f,currentPlan:b,isCustomerOnTrial:S,trialDaysLeft:P}=DF(l),I=n==null?void 0:n({currentSubscription:f}),T=(f==null?void 0:f.scheduledUpdates)||[],F=(H=f==null?void 0:f.price)==null?void 0:H.billingPeriod,k=T.find(({subscriptionScheduleType:it})=>it===Hi.Downgrade),R=T.find(({subscriptionScheduleType:it})=>it===Hi.BillingPeriod),N=i_(r,it=>it.order).map(it=>{var dt;let ct=(dt=s==null?void 0:s.eligibleForTrial)==null?void 0:dt.find(Y=>Y.productId===it.product.id),U=I!=null&&I.planId?(I==null?void 0:I.planId)===it.id:it.id===(b==null?void 0:b.id),V=Y=>{var mt;let ot=k==null?void 0:k.scheduleVariables,pt=R==null?void 0:R.scheduleVariables,lt=it.pricePoints.some(bt=>bt.billingPeriod===Y);return k?((mt=k.targetPackage)==null?void 0:mt.refId)===it.id&&(!lt||ot.billingPeriod===Y):R&&U?pt.billingPeriod===Y:false};return vt(q({},it),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===it.id),isTriable:!Ph(it.defaultTrialConfig)&&(!ct||ct.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:F,isUpcomingPlan:false,trialDaysLeft:P,isNextPlan:V,paywallCurrency:i,scheduledUpdate:k||R})});if(r&&b){let it=b&&((Q=r==null?void 0:r.find(ct=>ct.id===(b==null?void 0:b.id)))==null?void 0:Q.order);Ph(it)||(N=N.map(ct=>vt(q({},ct),{isLowerThanCurrentPlan:it>ct.order})),e&&(N=N.filter(ct=>ct.order>=it)));}let j=o?xx(o):void 0;return {currentPlan:b,currentSubscription:f,currentSubscriptionOverride:I,isCustomerOnTrial:S,plans:N,paywallConfiguration:j}}var Ix="7.16.0";var wx="@stigg/react-sdk";var of=h0.createContext(null);of.displayName="StiggContext";var NF="en-US",MF=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:l,locale:p,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,entitlementsFallback:P,stiggClient:I,children:T,offline:F,clientName:k=wx,clientVersion:R=Ix})=>{let N=useRef(t),j={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:P,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,clientName:k,clientVersion:R,offline:F},[H,Q]=useState(()=>({stigg:I!=null?I:Wb.initialize(vt(q({},j),{lazyLoad:true})),locale:p||NF,isInitialized:false,theme:l,refreshData:()=>ie(null,null,function*(){Q(it=>vt(q({},it),{customerPortalUpdatedAt:new Date})),yield H.stigg.refresh();})}));return useEffect(()=>{let it=true,ct=Y=>{it&&Q(Y);},U=()=>ct(Y=>vt(q({},Y),{updatedAt:new Date})),V=Y=>ct(ot=>(ot.stigg&&ot.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),vt(q({},ot),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ie(null,null,function*(){let Y=H.stigg;t!==N.current&&(sc.log("Updating stigg client",{apiKey:t}),N.current=t,Y=Wb.initialize(q({},j)),ct(ot=>vt(q({},ot),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),V(Y);}),()=>{it=false,H.stigg.removeListener("entitlementsUpdated",U),H.stigg.clearCustomer();}},[t]),useEffect(()=>{let it=H.stigg;i?it.setCustomerId(i,o,s):it.clearCustomer();},[i,o,s]),useEffect(()=>{Q(it=>vt(q({},it),{theme:l}));},[l]),jsx(of.Provider,{value:H,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:T})})};function ce(t){let{optional:e}=t||{},n=useContext(of);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function Dx({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:l}=ce(),[p,f]=useState(Se.Annually),[b,S]=useState([]),[P,I]=useState(null),[T,F]=useState(true);useEffect(()=>{ie(null,null,function*(){try{F(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:j,defaultBillingPeriod:H}=bx(N.plans,N.activeSubscriptions,i);I(N),S(j),f(H);}catch(N){sc.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{F(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let k=Ex(P,n,o);return q({customer:(P==null?void 0:P.customer)||null,isLoading:T,selectedBillingPeriod:p,setSelectedBillingPeriod:f,availableBillingPeriods:b,locale:l,configuration:k.paywallConfiguration,showWatermark:s.getShowWatermark()},k)}function kx(t){return t2({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===Se.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===Se.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var GF=t=>jsx("svg",vt(q({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"})})),Rx=GF;var $F=W.div`
5122
+ `,yx=({plans:t,customer:e,currentSubscription:n,highlightedPlanId:r,selectedBillingPeriod:i,onBillingPeriodChanged:o,availableBillingPeriods:s,isCustomerOnTrial:l,onPlanSelected:p,paywallLocale:f,locale:b,shouldHidePlan:S,selectDefaultTierIndex:P,currentSubscriptionOverride:I,hideCompatibleAddons:T,showWatermark:F})=>{let k=fx(t),R=t.some(Y=>!!Y.description),N=yv(t,Se.Monthly),j=yv(t,Se.Annually),H=gx(t,i,S),Q=useCallback((Y,ot,pt)=>p({plan:Y,customer:e,subscription:n,intentionType:ot,selectedBillingPeriod:i,billableFeatures:pt}),[e,i,n,p]),it=!!n&&n.plan.pricingType===On.Custom,ct=useMemo(()=>H.some(Y=>{var lt;let ot=Y.pricePoints.filter(mt=>mt.billingPeriod===i),pt=(lt=Y.paywallCalculatedPricePoints)==null?void 0:lt.find(mt=>mt.billingPeriod===i);return ot.length>1&&!!(pt!=null&&pt.additionalChargesMayApply)}),[i,H]),U=useMemo(()=>H.some(Y=>!!Eh(Y,i,f,b,N).unit),[i,N,b,f,H]),V=useMemo(()=>!it&&H.some(Y=>{let ot=_h({plan:Y,billingPeriod:i,currentSubscription:n,currentSubscriptionOverride:I});return Object.values(ot).length>0}),[i,n,I,it,H]),dt=H.some(Y=>Y.isCurrentCustomerPlan&&Y.trialDaysLeft);return jsx(_F,{className:"stigg-paywall-container",children:jsxs(EF,{className:"stigg-paywall-layout",children:[jsx(lx,{onBillingPeriodChanged:o,selectedBillingPeriod:i,availableBillingPeriods:s,discountRate:k}),jsx(PF,{className:"stigg-paywall-plans-layout",children:H.map(Y=>jsx(sx,{withUnitPriceRow:U,withTiersRow:V,withTrialLeftRow:dt,shouldShowDescriptionSection:R,hasMonthlyPrice:N,hasAnnuallyPrice:j,plan:Y,withStartingAtRow:ct,currentSubscription:n,currentSubscriptionOverride:I,billingPeriod:i,isHighlighted:Y.id===r,isCustomerOnTrial:l,onPlanSelected:(ot,pt)=>Q(Y,ot,pt),paywallLocale:f,locale:b,customer:e,isCustomerInCustomPlan:it,selectDefaultTierIndex:P,hideCompatibleAddons:T},Y.id))}),jsx(go,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:F})]})})};var vv=class{error(e,n,...r){console.error(e,n||{},r);}log(e,n){console.log(e,n||{});}debug(e,n){console.debug(e,n||{});}},sc=new vv;function bx(t,e,n){let r=t.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),i=countBy(r),o=uniq(r),s;if(n&&o.includes(n))s=n;else if(e){let l=e.find(p=>p.status===Pi.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(i[Se.Monthly]||0)>(i[Se.Annually]||0)?Se.Monthly:Se.Annually),{defaultBillingPeriod:s,availableBillingPeriods:o}}function Cx(t){return _1.utc(t).diff(_1.utc(),"days",false)+1}var wh={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 cc(t,e="px"){if(t)return `${t}${e}`}function Ah(t){if(!t)return "normal";switch(t){case Hb.Normal:return "normal";case Hb.Bold:return "bold";default:return "normal"}}function rf(t,e){var r,i,o,s,l,p,f,b;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:cc((r=t==null?void 0:t.h1)==null?void 0:r.fontSize)||n.h1.fontSize,fontWeight:Ah((i=t==null?void 0:t.h1)==null?void 0:i.fontWeight)||n.h1.fontWeight,semanticElement:n.h1.semanticElement},h2:{fontSize:cc((o=t==null?void 0:t.h2)==null?void 0:o.fontSize)||n.h2.fontSize,fontWeight:Ah((s=t==null?void 0:t.h2)==null?void 0:s.fontWeight)||n.h2.fontWeight,semanticElement:n.h2.semanticElement},h3:{fontSize:cc((l=t==null?void 0:t.h3)==null?void 0:l.fontSize)||n.h3.fontSize,fontWeight:Ah((p=t==null?void 0:t.h3)==null?void 0:p.fontWeight)||n.h3.fontWeight,semanticElement:n.h3.semanticElement},body:{fontSize:cc((f=t==null?void 0:t.body)==null?void 0:f.fontSize)||n.body.fontSize,fontWeight:Ah((b=t==null?void 0:t.body)==null?void 0:b.fontWeight)||n.body.fontWeight,semanticElement:n.body.semanticElement}}}function Cv(t){if(t)switch(t){case mh.Left:return "left";case mh.Center:return "center";case mh.Right:return "right";default:return}}function Sx(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:rf(r),customCss:n||void 0}}function xx(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:rf(i),layout:{ctaAlignment:Cv(n==null?void 0:n.alignment),headerAlignment:Cv(n==null?void 0:n.alignment),descriptionAlignment:Cv(n==null?void 0:n.alignment),planMaxWidth:cc(n==null?void 0:n.planWidth),planMinWidth:cc(n==null?void 0:n.planWidth),planMargin:cc(n==null?void 0:n.planMargin),planPadding:cc(n==null?void 0:n.planPadding)}}}function Px(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:rf(n,wh),customCss:r||void 0}}function DF(t){let e=true,n=(t==null?void 0:t.find(o=>o.status===Pi.InTrial))||null,r=n==null?void 0:n.plan,i=n!=null&&n.trialEndDate?Cx(n.trialEndDate):void 0;return r||(e=false,n=(t==null?void 0:t.find(o=>o.status===Pi.Active))||null,r=n==null?void 0:n.plan),{currentSubscription:n,currentPlan:r,isCustomerOnTrial:e,trialDaysLeft:i}}function Ex(t,e,n){var H,Q;let{plans:r,currency:i,configuration:o,customer:s,activeSubscriptions:l,paywallCalculatedPricePoints:p}=t||{},{currentSubscription:f,currentPlan:b,isCustomerOnTrial:S,trialDaysLeft:P}=DF(l),I=n==null?void 0:n({currentSubscription:f}),T=(f==null?void 0:f.scheduledUpdates)||[],F=(H=f==null?void 0:f.price)==null?void 0:H.billingPeriod,k=T.find(({subscriptionScheduleType:it})=>it===Hi.Downgrade),R=T.find(({subscriptionScheduleType:it})=>it===Hi.BillingPeriod),N=i_(r,it=>it.order).map(it=>{var dt;let ct=(dt=s==null?void 0:s.eligibleForTrial)==null?void 0:dt.find(Y=>Y.productId===it.product.id),U=I!=null&&I.planId?(I==null?void 0:I.planId)===it.id:it.id===(b==null?void 0:b.id),V=Y=>{var mt;let ot=k==null?void 0:k.scheduleVariables,pt=R==null?void 0:R.scheduleVariables,lt=it.pricePoints.some(bt=>bt.billingPeriod===Y);return k?((mt=k.targetPackage)==null?void 0:mt.refId)===it.id&&(!lt||ot.billingPeriod===Y):R&&U?pt.billingPeriod===Y:false};return vt(q({},it),{paywallCalculatedPricePoints:p==null?void 0:p.filter(Y=>Y.planId===it.id),isTriable:!Ph(it.defaultTrialConfig)&&(!ct||ct.eligible),isCurrentCustomerPlan:U,currentCustomerPlanBillingPeriod:F,isUpcomingPlan:false,trialDaysLeft:P,isNextPlan:V,paywallCurrency:i,scheduledUpdate:k||R})});if(r&&b){let it=b&&((Q=r==null?void 0:r.find(ct=>ct.id===(b==null?void 0:b.id)))==null?void 0:Q.order);Ph(it)||(N=N.map(ct=>vt(q({},ct),{isLowerThanCurrentPlan:it>ct.order})),e&&(N=N.filter(ct=>ct.order>=it)));}let j=o?xx(o):void 0;return {currentPlan:b,currentSubscription:f,currentSubscriptionOverride:I,isCustomerOnTrial:S,plans:N,paywallConfiguration:j}}var Ix="7.16.1";var wx="@stigg/react-sdk";var of=h0.createContext(null);of.displayName="StiggContext";var NF="en-US",MF=({apiKey:t,baseUri:e,baseEdgeUri:n,enableEdge:r,customerId:i,customerToken:o,resourceId:s,theme:l,locale:p,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,entitlementsFallback:P,stiggClient:I,children:T,offline:F,clientName:k=wx,clientVersion:R=Ix})=>{let N=useRef(t),j={apiKey:t,customerId:i,customerToken:o,resourceId:s,baseUri:e,baseEdgeUri:n,enableEdge:r,entitlementsFallback:P,cacheTtlMs:f,useEntitlementPolling:b,entitlementPollingInterval:S,clientName:k,clientVersion:R,offline:F},[H,Q]=useState(()=>({stigg:I!=null?I:Wb.initialize(vt(q({},j),{lazyLoad:true})),locale:p||NF,isInitialized:false,theme:l,refreshData:()=>ie(null,null,function*(){Q(it=>vt(q({},it),{customerPortalUpdatedAt:new Date})),yield H.stigg.refresh();})}));return useEffect(()=>{let it=true,ct=Y=>{it&&Q(Y);},U=()=>ct(Y=>vt(q({},Y),{updatedAt:new Date})),V=Y=>ct(ot=>(ot.stigg&&ot.stigg.removeListener("entitlementsUpdated",U),Y.addListener("entitlementsUpdated",U),vt(q({},ot),{stigg:Y,isInitialized:true,updatedAt:new Date})));return ie(null,null,function*(){let Y=H.stigg;t!==N.current&&(sc.log("Updating stigg client",{apiKey:t}),N.current=t,Y=Wb.initialize(q({},j)),ct(ot=>vt(q({},ot),{isInitialized:false,updatedAt:new Date}))),yield Y.waitForInitialization(),V(Y);}),()=>{it=false,H.stigg.removeListener("entitlementsUpdated",U),H.stigg.clearCustomer();}},[t]),useEffect(()=>{let it=H.stigg;i?it.setCustomerId(i,o,s):it.clearCustomer();},[i,o,s]),useEffect(()=>{Q(it=>vt(q({},it),{theme:l}));},[l]),jsx(of.Provider,{value:H,children:jsx(SkeletonTheme,{baseColor:"#F5F6F9",highlightColor:"#e5e6ea",children:T})})};function ce(t){let{optional:e}=t||{},n=useContext(of);if(!n&&!e)throw new Error("Could not find Stigg context; You need to wrap your app in an <StiggProvider> component.");return n}function Dx({productId:t,resourceId:e,showOnlyEligiblePlans:n,billingCountryCode:r,preferredBillingPeriod:i,currentSubscriptionOverrideFn:o}){let{stigg:s,locale:l}=ce(),[p,f]=useState(Se.Annually),[b,S]=useState([]),[P,I]=useState(null),[T,F]=useState(true);useEffect(()=>{ie(null,null,function*(){try{F(!0),yield s.waitForInitialization();let N=yield s.getPaywall({productId:t,resourceId:e,billingCountryCode:r}),{availableBillingPeriods:j,defaultBillingPeriod:H}=bx(N.plans,N.activeSubscriptions,i);I(N),S(j),f(H);}catch(N){sc.error(`Failed to load paywall ${N==null?void 0:N.message}`,N);}finally{F(false);}});},[s,t,s.isCustomerLoaded,r,e,i]);let k=Ex(P,n,o);return q({customer:(P==null?void 0:P.customer)||null,isLoading:T,selectedBillingPeriod:p,setSelectedBillingPeriod:f,availableBillingPeriods:b,locale:l,configuration:k.paywallConfiguration,showWatermark:s.getShowWatermark()},k)}function kx(t){return t2({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===Se.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:n=>n===Se.Monthly?"/ month":"/ year",free:n=>({price:`${n==null?void 0:n.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},t)}var GF=t=>jsx("svg",vt(q({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"})})),Rx=GF;var $F=W.div`
5123
5123
  display: flex;
5124
5124
  flex-direction: column;
5125
5125
  align-items: center;
@@ -5461,7 +5461,7 @@ ${e.o5f}`,e.zBW=r.default`
5461
5461
  ${({theme:t,$highlight:e})=>e&&`background-color: ${t.stigg.palette.backgroundSection}`};
5462
5462
  `;function zP({entitlement:t,subscriptionPrice:e,onManageSubscription:n,onBuyMore:r,hasCustomSubscription:i,canUpgradeSubscription:o}){var p,f,b;let{theme:s}=ur(),l=!t.hasUnlimitedUsage&&t.currentUsage>t.usageLimit;return t.feature?jsxs(jP,{$highlight:!!e,$borderColor:s.borderColor,children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsx(dc,{variant:"body1",children:t.feature&&VP(t.feature)}),e&&jsx(cs,{title:jsx(J,{variant:"body1",children:e.billingModel===hn.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsx(zn,{icon:"DollarCoin",svgStrokeColor:s.iconsColor})})]}),jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[jsxs(dc,{variant:"body1",color:l?"error":"primary","data-testid":`usage-data-${(p=t.feature)==null?void 0:p.refId}`,children:[(f=t.currentUsage)==null?void 0:f.toLocaleString(),!t.hasUnlimitedUsage&&` / ${(b=t.usageLimit)==null?void 0:b.toLocaleString()} (${sd(t.currentUsage||0,t.usageLimit)}%)`]}),jsx(Vh,{entitlement:t,feature:t.feature,onBuyMore:r,canBuyMore:!!e,onManageSubscription:n,canUpgradeSubscription:o,hasCustomSubscription:i})]}),jsx(Gh,{entitlement:t}),!t.hasUnlimitedUsage&&!HP(t.usageLimit)&&!HP(t.currentUsage)&&t.resetPeriod&&t.usagePeriodEnd?jsx(J,{color:"secondary",children:TP(t)}):null,t.hasUnlimitedUsage&&jsx(J,{color:"secondary",children:"In current billing period"})]}):null}var qP=W.div`
5463
5463
  margin-top: 32px;
5464
- `;function YP(){let t=Ei("md");return jsx(Ea,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:range(6).map(e=>jsx(Ea,{item:true,xs:t?4:12,children:jsx(lc,{width:280,height:120})},e))})}var ZP=6;function Xh({onManageSubscription:t,onBuyMore:e,filterEntitlements:n}){var dt,Y;let[r,i]=useState(false),o=Ei("md"),{customerPortal:s,isLoading:l,textOverrides:p,theme:f}=ur(),b=l||!s,{entitlements:S,subscriptions:P}=s||{},I=S==null?void 0:S.filter(ot=>{var pt,lt;return ((pt=ot.feature)==null?void 0:pt.meterType)===zb.Fluctuating||((lt=ot.feature)==null?void 0:lt.meterType)===zb.Incremental}),T=P==null?void 0:P.find(({status:ot})=>ot===Pi.Active),F=(T==null?void 0:T.pricingType)===On.Custom,k=!!(s!=null&&s.canUpgradeSubscription),R=keyBy((dt=T==null?void 0:T.prices)!=null?dt:[],"feature.refId"),N=keyBy(I!=null?I:[],"feature.refId"),j=compact(((Y=T==null?void 0:T.prices)!=null?Y:[]).map(ot=>ot.feature&&N[ot.feature.refId]||void 0)),H=compact((I!=null?I:[]).filter(ot=>!R[ot.feature.refId])),Q=[...j,...H].filter(ot=>ot.usageLimit!==0),it=n?n(Q):Q,ct=o?it.length>2?4:6:12,U=r?it:it.slice(0,ZP),V=()=>i(ot=>!ot);return !b&&!(I!=null&&I.length)?null:jsxs(Ta,{className:"stigg-subscription-usage-layout",$backgroundColor:f.backgroundColor,$borderColor:f.borderColor,children:[jsx(Pa,{children:jsx(_a,{title:p.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:b})}),b?jsx(YP,{}):jsxs(Fragment,{children:[jsx(Ea,{container:true,spacing:4,children:U.map(ot=>jsx(Ea,{className:`stigg-entitlement-usage-${ot.feature.refId}`,item:true,xs:ct,children:jsx(zP,{subscriptionPrice:R[ot.feature.refId],entitlement:ot,onManageSubscription:t,onBuyMore:e,hasCustomSubscription:F,canUpgradeSubscription:k},ot.feature.refId)},ot.feature.refId))}),it.length>ZP&&jsx(qP,{children:jsx(uc,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:r?jsx(Minus,{}):jsx(Plus,{}),onClick:V,children:r?"Show less":"Show more"})})]})]})}function e_({onManageSubscription:t,onBuyMore:e,onCancelScheduledUpdates:n,onContactSupport:r,paywallComponent:i,hiddenSections:o,filterEntitlements:s}){let{customerPortal:l,textOverrides:p,theme:f,isLoading:b,showWatermark:S}=ur(),P=useRef(null),I=({intentionType:R})=>{var N,j;t?t({intentionType:R,customerSubscriptions:(N=l==null?void 0:l.subscriptions)!=null?N:[]}):(j=P==null?void 0:P.current)==null||j.scrollIntoView({behavior:"smooth"});},T=!(o!=null&&o.some(R=>R==="usage")),F=!(o!=null&&o.some(R=>R==="paymentDetails"||R==="billingInformation")),k=!(o!=null&&o.some(R=>R==="invoices"||R==="billingInformation"));return jsxs(GP,{className:"stigg-customer-portal-layout",children:[jsx(OP,{showWatermark:S}),jsxs($P,{className:"stigg-customer-portal-sections",children:[jsx(Hh,{onCancelScheduledUpdates:n,onBuyMore:e,onManageSubscription:I,onContactSupport:r,hiddenSections:o,cancelScheduledUpdatesButtonTitle:p.cancelScheduledUpdatesButtonTitle}),T&&jsx(Xh,{onManageSubscription:I,onBuyMore:e,filterEntitlements:s}),jsx(Bv,{ref:P,paywallComponent:i,theme:f,title:p.paywallSectionTitle,isLoading:!l||b}),F&&jsx(Kh,{}),k&&jsx(Zh,{})]})]})}function r_(o){var s=o,{textOverrides:t,theme:e,resourceId:n,productId:r}=s,i=Rn(s,["textOverrides","theme","resourceId","productId"]);return jsx(kh,{textOverrides:t,theme:e,resourceId:n,productId:r,children:jsx(e_,q({},i))})}function Zh(){let{customerPortal:t,isLoading:e,textOverrides:n,theme:r}=ur(),i=!t||e,o=i?jsx(qh,{}):t!=null&&t.billingPortalUrl?jsx(zh,{url:t.billingPortalUrl,text:n.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !i&&!(t!=null&&t.billingPortalUrl)?null:jsx(Ta,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Pa,{className:"stigg-invoices-section-header",children:[jsx(_a,{isLoading:i,className:"stigg-invoices-section-title",title:n.invoicesTitle}),o]})})}var o_=t=>i_(t,"displayName"),$v=t=>i_(t,"addon.displayName");function AO(t,e){return t.pricePoints.some(n=>n.billingPeriod===e)}function a_({addon:t,currency:e,billingCountryCode:n}){return vt(q({},t),{pricePoints:t.pricePoints.filter(r=>r.currency===e&&(n?r.billingCountryCode===n:true))})}function s_({addons:t,billingCountryCode:e,currency:n}){var r;return ((r=t==null?void 0:t.filter(i=>{var o;return !((o=i.hiddenFromWidgets)!=null&&o.includes(Ju.Checkout))}))==null?void 0:r.map(i=>a_({addon:i,currency:n,billingCountryCode:e})))||[]}function c_({addons:t,billingPeriod:e,billingCountryCode:n,currency:r}){var i;return ((i=t==null?void 0:t.filter(o=>AO(o.addon,e)))==null?void 0:i.map(o=>vt(q({},o),{addon:a_({addon:o.addon,currency:r,billingCountryCode:n})})))||[]}function l_({activeSubscription:t,plan:e,billingCountryCode:n}){var l,p;let r=[],i=((p=(l=e==null?void 0:e.pricePoints)==null?void 0:l[0])==null?void 0:p.currency)||Zu.Usd,o=o_(s_({addons:e==null?void 0:e.compatibleAddons,billingCountryCode:n,currency:i})),s=c_({addons:t==null?void 0:t.addons,billingCountryCode:n,currency:i});return s!=null&&s.length&&(o!=null&&o.length)&&(r=$v(s.filter(f=>o.some(b=>b.id===f.addon.id)))),{addons:r,initialAddons:DO(r),availableAddons:o}}function FO(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.addonsStep.addons.find(o=>o.addon.id===e.id);i?i.quantity=n:(r.addonsStep.addons.push({addon:e,quantity:n}),r.addonsStep.addons=$v(r.addonsStep.addons));})}function RO(){let[,t]=Ve();return e=>t(n=>{kO(n.addonsStep.addons,r=>r.addon.id===e);})}function OO(){let[{addonsStep:t}]=Ve();return t}function u_(){let t=OO();return vt(q({},t),{setAddon:FO(),removeAddon:RO()})}function NO(){let[{checkout:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}]=Ve();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}}function MO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.readOnly=e;})}function LO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.isValid=e;})}function BO(){let[,t]=Ve();return e=>t(n=>{n.checkoutSuccess=e;})}function je(){let{checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}=NO();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r,setWidgetReadOnly:MO(),setIsValid:LO(),setCheckoutSuccess:BO()}}function p_({planId:t,resourceId:e,billingCountryCode:n,onMockCheckoutState:r}){let{stigg:i}=ce(),[o,s]=useState(true),[l,p]=useState();return useEffect(()=>{let f=()=>ie(null,null,function*(){try{let b=yield i.getCheckoutState({planId:t,resourceId:e,billingCountryCode:n});p(b);}catch(b){sc.error(`Failed to load checkout ${b==null?void 0:b.message}`,b);}finally{s(false);}});if(r){s(false),p(r({planId:t,resourceId:e,billingCountryCode:n}));return}i.isCustomerLoaded&&(s(true),f());},[i,i.isCustomerLoaded,e,t,n,r]),{checkout:l,isLoading:o,showWatermark:i.getShowWatermark()}}var dd=$1(o0());var hg=(t,e)=>t.minUnitQuantity&&e<t.minUnitQuantity?t.minUnitQuantity:t.maxUnitQuantity&&e>t.maxUnitQuantity?t.maxUnitQuantity:e;var a0=$1(o0()),s0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Monthly)),c0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Annually)),Z_=t=>s0(t)&&c0(t);var eE=(t,e,n)=>t===dd.BillingPeriod.Monthly&&e||t===dd.BillingPeriod.Annually&&n?t:null,nE=({pricingModel:t})=>t===hn.PerUnit;function qL(t,e,n){var o;if(!e)return [];let r=J_(t,"featureId"),i=J_(tE((o=n==null?void 0:n.prices)==null?void 0:o.map(s=>{let{feature:l}=s;return !l||!nE(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return tE(e==null?void 0:e.map(s=>{var b,S,P;let l=(b=s.feature)==null?void 0:b.featureId;if(!l||!nE(s))return null;let p,f=((S=r[l])==null?void 0:S.quantity)||((P=i[l])==null?void 0:P.quantity);return p=hg(s,f||1),s.isTieredPrice&&!Xp(s.tiers)&&(p=sv(s.tiers,p).upTo),{featureId:l,quantity:p}}))}function YL({plan:t,activeSubscription:e,preferredBillingPeriod:n}){var s,l;let r=s0(t),i=c0(t);if(n){let p=eE(n,r,i);if(p)return p}if(((s=e==null?void 0:e.plan)==null?void 0:s.id)===(t==null?void 0:t.id))return ((l=e==null?void 0:e.price)==null?void 0:l.billingPeriod)||dd.BillingPeriod.Monthly;if(e!=null&&e.prices&&(e==null?void 0:e.prices.length)>0){let p=eE(e==null?void 0:e.prices[0].billingPeriod,r,i);if(p)return p}return i?dd.BillingPeriod.Annually:dd.BillingPeriod.Monthly}function rE({preferredBillingPeriod:t,plan:e,activeSubscription:n,billingCountryCode:r,preconfiguredBillableFeatures:i}){let o=YL({plan:e,activeSubscription:n,preferredBillingPeriod:t}),s=e==null?void 0:e.pricePoints.filter(p=>p.billingPeriod===o),l=qL(i,s,n);return {billingPeriod:o,billableFeatures:l,billingCountryCode:r}}function KL(){let[{planStep:t}]=Ve();return t}function QL(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.planStep.billableFeatures.find(o=>o.featureId===e);i?i.quantity=n:r.planStep.billableFeatures.push({featureId:e,quantity:n});})}function XL(){let[,t]=Ve();return e=>t(n=>{n.planStep.billingPeriod=e,n.addonsStep.addons=n.addonsStep.addons.filter(r=>r.addon.pricePoints.some(i=>i.billingPeriod===e));})}function yo(){let t=KL();return vt(q({},t),{setBillingPeriod:XL(),setBillableFeature:QL()})}var oE=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],iE={activeStep:0,completedSteps:[],steps:oE,isDisabled:false},JL=(t,e,n,r)=>{if(Z_(t)&&!r)return false;let i=e.map(s=>s.featureId),o=n.map(s=>s.featureId);return !(i.length!==o.length||!i.every(s=>o.includes(s)))};function aE({isLoading:t,skipCheckoutSteps:e,plan:n,availableAddons:r,availableCharges:i,preferredBillingPeriod:o,preconfiguredBillableFeatures:s}){if(t||!n)return iE;let l=[];return e.includes("PLAN")&&JL(n,i,s,o)&&l.push("PLAN"),((r==null?void 0:r.length)===0||e.includes("ADDONS"))&&l.push("ADDONS"),vt(q({},iE),{steps:oE.filter(p=>!l.includes(p.key))})}function t3(){let[{progressBar:t}]=Ve();return t}function e3(){let[t,e]=Ve();return n=>ie(null,null,function*(){let{progressBar:r,planStep:i,addonsStep:o,paymentStep:s,onBeforeStepChange:l}=t;if(n!==r.activeStep&&l){let p=r.steps[r.activeStep],f=r.steps[n];if(p&&f){let b={planStep:i,addonsStep:o,paymentStep:s};if(!(yield l({from:p.key,to:f.key,state:b})))return}}e(({progressBar:p})=>{p.activeStep=n;});})}function n3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.completedSteps.push(e);})}function r3(t){return t.completedSteps.length>=t.steps.length-1}function i3(){let[t,e]=Ve();return ()=>ie(null,null,function*(){let{progressBar:n,planStep:r,addonsStep:i,paymentStep:o,onBeforeStepChange:s}=t;if(n.isDisabled)return;let l=n.steps[n.activeStep],p=n.steps[n.activeStep+1];if(p&&s){let f={planStep:r,addonsStep:i,paymentStep:o};if(!(yield s({from:l.key,to:p.key,state:f})))return}e(({progressBar:f})=>{f.completedSteps.includes(f.activeStep)||f.completedSteps.push(f.activeStep),f.activeStep<f.steps.length-1&&(f.activeStep+=1);});})}function o3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.isDisabled=!!e;})}function wa(){let t=t3();return {currentStep:t.steps[t.activeStep],progressBarState:t,isLastStep:t.activeStep===t.steps.length-1,isCheckoutComplete:r3(t),setActiveStep:e3(),markStepAsCompleted:n3(),goNext:i3(),setIsDisabled:o3()}}function pd(){let[{planStep:t,addonsStep:e,promotionCode:n,paymentStep:r}]=Ve();return vt(q({},t),{addons:e.addons,promotionCode:n,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function gg({billingAddress:t,taxPercentage:e,taxIds:n}){if(!t&&!e&&!(n!=null&&n.length))return {};let r=n!=null&&n.length?n==null?void 0:n.filter(i=>i.value&&i.type):void 0;return {billingInformation:vt(q(q({},t?{billingAddress:t}:{}),e?{taxPercentage:e}:{}),{taxIds:r})}}var l3=I=>ie(null,[I],function*({stigg:t,customerId:e,planId:n,resourceId:r,promotionCode:i,addons:o,billableFeatures:s,billingCountryCode:l,billingPeriod:p,billingAddress:f,taxPercentage:b,taxIds:S,onMockCheckoutPreview:P}){var R;let T=o.map(({addon:N,quantity:j})=>({addonId:N.id,quantity:j})),F=null,k=null;try{if(e&&n){let N=q({customerId:e,planId:n,resourceId:r,billingCountryCode:l,addons:T,billingPeriod:p,promotionCode:i,billableFeatures:fR(s)?void 0:s},gg({billingAddress:f,taxPercentage:b,taxIds:S}));F=P?P(N):yield t.previewSubscription(N);}}catch(N){let[,j]=((R=N==null?void 0:N.message)==null?void 0:R.split("Error:"))||[];k=j==null?void 0:j.trim();}return {subscriptionPreview:F,errorMessage:k}}),u0=({onMockCheckoutPreview:t}={})=>{let{stigg:e}=ce(),n=pd(),[{resourceId:r}]=Ve(),{checkoutState:i,widgetState:o}=je(),{plan:s,customer:l}=i||{};return {previewSubscriptionAction:useCallback((...b)=>ie(null,[...b],function*({promotionCode:f}={}){return o.isValid?l3({stigg:e,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:n.addons,billableFeatures:n.billableFeatures,billingCountryCode:n.billingCountryCode,billingPeriod:n.billingPeriod,billingAddress:n.billingAddress,taxPercentage:n.taxPercentage,promotionCode:f!=null?f:n.promotionCode,taxIds:n.taxId?[n.taxId]:void 0,onMockCheckoutPreview:t}):{subscriptionPreview:null,errorMessage:null}}),[e,l==null?void 0:l.id,s==null?void 0:s.id,r,n.addons,n.billableFeatures,n.billingCountryCode,n.billingPeriod,n.billingAddress,n.taxPercentage,n.taxId,n.promotionCode,o.isValid,t])}},u3=500,sE=({onMockCheckoutPreview:t}={})=>{let[e,n]=useState(null),[r,i]=useState(null),[o,s]=useState(false),{previewSubscriptionAction:l}=u0({onMockCheckoutPreview:t});return useEffect(()=>{let p=()=>ie(null,null,function*(){let{subscriptionPreview:b,errorMessage:S}=yield l();b&&(n(b),i(null)),S&&(i(S),n(null)),s(false);});s(true);let f=setTimeout(()=>{s(true),p();},u3);return ()=>{clearTimeout(f);}},[l]),{subscriptionPreview:e,isFetchingSubscriptionPreview:o,errorMessage:r}};function cE({customer:t,taxPercentage:e,taxId:n}){return {useNewPaymentMethod:!(t!=null&&t.paymentMethodDetails),taxPercentage:e,taxId:n}}function d3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.useNewPaymentMethod=e;}),[t])}function p3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.errorMessage=e;}),[t])}function f3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.billingAddress=e;}),[t])}function m3(){let[{paymentStep:t}]=Ve();return t}function h3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.taxId=e;}),[t])}function Yr(){let t=m3();return vt(q({},t),{setUseNewPaymentMethod:d3(),setErrorMessage:p3(),setBillingAddress:f3(),setTaxId:h3()})}function lE(t){return t2({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:n})=>n===Se.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:n})=>`${n.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:n})=>`Billed ${n.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:n})=>`Your account will be granted credits worth ${n} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:n,currency:r})=>{let i="";n.type===jb.Percentage?i=`${n.value}% off`:i=`${Nn({amount:n.value,currency:r})}`;let o="";switch(n.durationType){case hh.Once:{o=" once";break}case hh.Repeating:{o=`${n.type===jb.Fixed?" per month":""} for ${n.durationInMonths} months`;break}case hh.Forever:default:o="";}return `${i}${o}`},taxTitle:({taxDetails:n})=>`Tax (${n==null?void 0:n.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:n})=>`Your changes will take effect at the end of your current billing cycle on ${_1(n).format("MMMM D, YYYY")}.`,checkoutSuccessText:"Changes applied",payAsYouGoTooltipText:"Billed according to actual usage"},checkoutButton:{nextText:"Next",noChangesText:"No changes",updateText:"Update subscription",downgradeToFreeText:"Cancel subscription",upgradeText:"Subscribe"},downgradeToFree:{alertText:()=>"We\u2019re sorry to see you cancel your paid subscription \u{1F62D}",freePlanHeader:()=>"New plan",freePlanName:({plan:n})=>`${n.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:n})=>`${n.displayName}`,paidPlanPriceText:({billingPeriod:n})=>`Paid plan${n?`, billed ${n.toLowerCase()}`:""}`},nextBillingCaption:()=>""},t)}var gf={primary:"rgb(50, 126, 238)",textColor:"rgb(0, 30, 108)",backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(235, 237, 243)",summaryBackgroundColor:"rgb(109, 121, 144)"};function uE(t,e,n){let{palette:r}=t||{};return {primary:(e==null?void 0:e.primary)||(r==null?void 0:r.primary)||gf.primary,textColor:(e==null?void 0:e.textColor)||(r==null?void 0:r.text.primary)||gf.textColor,backgroundColor:(e==null?void 0:e.backgroundColor)||(r==null?void 0:r.backgroundPaper)||gf.backgroundColor,borderColor:(e==null?void 0:e.borderColor)||(r==null?void 0:r.outlinedBorder)||gf.borderColor,summaryBackgroundColor:(e==null?void 0:e.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||gf.summaryBackgroundColor,paymentInputBackgroundColor:e==null?void 0:e.paymentInputBackgroundColor,paymentInputBorderColor:e==null?void 0:e.paymentInputBorderColor,paymentInputBorderRadius:e==null?void 0:e.paymentInputBorderRadius}}var p0=h0.createContext(null);p0.displayName="CheckoutContext";var Ve=()=>{let t=useContext(p0);if(!t)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return t},_3=({children:t,initialState:e})=>{let[n,r]=useState(e);useEffect(()=>{r(e);},[e]);let i=useCallback(l=>r(p=>produce(p,f=>l(f))),[r]),[o,s]=useMemo(()=>[n,i],[i,n]);return jsx(p0.Provider,{value:[o,s],children:t})};function pE({children:t,textOverrides:e,theme:n,preferredBillingPeriod:r,billableFeatures:i,resourceId:o,planId:s,billingCountryCode:l,billingInformation:p,onMockCheckoutState:f,skipCheckoutSteps:b,onBeforeStepChange:S}){var N;let{checkout:P,isLoading:I,showWatermark:T}=p_({resourceId:o,planId:s,billingCountryCode:l,onMockCheckoutState:f}),F=P!=null&&P.configuration?Px(P.configuration):{typography:rf(null,wh)},k=_l(F),R=useMemo(()=>{var dt,Y;let j=uE(k,n,P==null?void 0:P.configuration),H=lE(e),Q=rE({preferredBillingPeriod:r,plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:i!=null?i:[]}),it=l_({plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription}),ct=cE({customer:P==null?void 0:P.customer,taxPercentage:(dt=p==null?void 0:p.taxDetails)==null?void 0:dt.taxPercentage}),U=aE({isLoading:I,skipCheckoutSteps:b!=null?b:[],plan:P==null?void 0:P.plan,availableAddons:it.availableAddons,availableCharges:Q.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:i!=null?i:[]});return {checkout:P,checkoutLocalization:H,stiggTheme:k,theme:j,progressBar:U,planStep:Q,addonsStep:it,paymentStep:ct,resourceId:(Y=P==null?void 0:P.resource)==null?void 0:Y.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:I},showWatermark:T,checkoutSuccess:false,onBeforeStepChange:S}},[r,l,P,I,b,(N=p==null?void 0:p.taxDetails)==null?void 0:N.taxPercentage,S]);return jsx(Xn,{componentTheme:F,children:jsx(_3,{initialState:R,children:t})},P==null?void 0:P.plan.id)}var fE="920px",hE=W.div`
5464
+ `;function YP(){let t=Ei("md");return jsx(Ea,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:range(6).map(e=>jsx(Ea,{item:true,xs:t?4:12,children:jsx(lc,{width:280,height:120})},e))})}var ZP=6;function Xh({onManageSubscription:t,onBuyMore:e,filterEntitlements:n}){var dt,Y;let[r,i]=useState(false),o=Ei("md"),{customerPortal:s,isLoading:l,textOverrides:p,theme:f}=ur(),b=l||!s,{entitlements:S,subscriptions:P}=s||{},I=S==null?void 0:S.filter(ot=>{var pt,lt;return ((pt=ot.feature)==null?void 0:pt.meterType)===zb.Fluctuating||((lt=ot.feature)==null?void 0:lt.meterType)===zb.Incremental}),T=P==null?void 0:P.find(({status:ot})=>ot===Pi.Active),F=(T==null?void 0:T.pricingType)===On.Custom,k=!!(s!=null&&s.canUpgradeSubscription),R=keyBy((dt=T==null?void 0:T.prices)!=null?dt:[],"feature.refId"),N=keyBy(I!=null?I:[],"feature.refId"),j=compact(((Y=T==null?void 0:T.prices)!=null?Y:[]).map(ot=>ot.feature&&N[ot.feature.refId]||void 0)),H=compact((I!=null?I:[]).filter(ot=>!R[ot.feature.refId])),Q=[...j,...H].filter(ot=>ot.usageLimit!==0),it=n?n(Q):Q,ct=o?it.length>2?4:6:12,U=r?it:it.slice(0,ZP),V=()=>i(ot=>!ot);return !b&&!(I!=null&&I.length)?null:jsxs(Ta,{className:"stigg-subscription-usage-layout",$backgroundColor:f.backgroundColor,$borderColor:f.borderColor,children:[jsx(Pa,{children:jsx(_a,{title:p.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:b})}),b?jsx(YP,{}):jsxs(Fragment,{children:[jsx(Ea,{container:true,spacing:4,children:U.map(ot=>jsx(Ea,{className:`stigg-entitlement-usage-${ot.feature.refId}`,item:true,xs:ct,children:jsx(zP,{subscriptionPrice:R[ot.feature.refId],entitlement:ot,onManageSubscription:t,onBuyMore:e,hasCustomSubscription:F,canUpgradeSubscription:k},ot.feature.refId)},ot.feature.refId))}),it.length>ZP&&jsx(qP,{children:jsx(uc,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:r?jsx(Minus,{}):jsx(Plus,{}),onClick:V,children:r?"Show less":"Show more"})})]})]})}function e_({onManageSubscription:t,onBuyMore:e,onCancelScheduledUpdates:n,onContactSupport:r,paywallComponent:i,hiddenSections:o,filterEntitlements:s}){let{customerPortal:l,textOverrides:p,theme:f,isLoading:b,showWatermark:S}=ur(),P=useRef(null),I=({intentionType:R})=>{var N,j;t?t({intentionType:R,customerSubscriptions:(N=l==null?void 0:l.subscriptions)!=null?N:[]}):(j=P==null?void 0:P.current)==null||j.scrollIntoView({behavior:"smooth"});},T=!(o!=null&&o.some(R=>R==="usage")),F=!(o!=null&&o.some(R=>R==="paymentDetails"||R==="billingInformation")),k=!(o!=null&&o.some(R=>R==="invoices"||R==="billingInformation"));return jsxs(GP,{className:"stigg-customer-portal-layout",children:[jsx(OP,{showWatermark:S}),jsxs($P,{className:"stigg-customer-portal-sections",children:[jsx(Hh,{onCancelScheduledUpdates:n,onBuyMore:e,onManageSubscription:I,onContactSupport:r,hiddenSections:o,cancelScheduledUpdatesButtonTitle:p.cancelScheduledUpdatesButtonTitle}),T&&jsx(Xh,{onManageSubscription:I,onBuyMore:e,filterEntitlements:s}),jsx(Bv,{ref:P,paywallComponent:i,theme:f,title:p.paywallSectionTitle,isLoading:!l||b}),F&&jsx(Kh,{}),k&&jsx(Zh,{})]})]})}function r_(o){var s=o,{textOverrides:t,theme:e,resourceId:n,productId:r}=s,i=Rn(s,["textOverrides","theme","resourceId","productId"]);return jsx(kh,{textOverrides:t,theme:e,resourceId:n,productId:r,children:jsx(e_,q({},i))})}function Zh(){let{customerPortal:t,isLoading:e,textOverrides:n,theme:r}=ur(),i=!t||e,o=i?jsx(qh,{}):t!=null&&t.billingPortalUrl?jsx(zh,{url:t.billingPortalUrl,text:n.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !i&&!(t!=null&&t.billingPortalUrl)?null:jsx(Ta,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Pa,{className:"stigg-invoices-section-header",children:[jsx(_a,{isLoading:i,className:"stigg-invoices-section-title",title:n.invoicesTitle}),o]})})}var o_=t=>i_(t,"displayName"),$v=t=>i_(t,"addon.displayName");function AO(t,e){return t.pricePoints.some(n=>n.billingPeriod===e)}function a_({addon:t,currency:e,billingCountryCode:n}){return vt(q({},t),{pricePoints:t.pricePoints.filter(r=>r.currency===e&&(n?r.billingCountryCode===n:true))})}function s_({addons:t,billingCountryCode:e,currency:n}){var r;return ((r=t==null?void 0:t.filter(i=>{var o;return !((o=i.hiddenFromWidgets)!=null&&o.includes(Ju.Checkout))}))==null?void 0:r.map(i=>a_({addon:i,currency:n,billingCountryCode:e})))||[]}function c_({addons:t,billingPeriod:e,billingCountryCode:n,currency:r}){var i;return ((i=t==null?void 0:t.filter(o=>AO(o.addon,e)))==null?void 0:i.map(o=>vt(q({},o),{addon:a_({addon:o.addon,currency:r,billingCountryCode:n})})))||[]}function l_({activeSubscription:t,plan:e,billingCountryCode:n,billingPeriod:r}){var p,f;let i=[],o=((f=(p=e==null?void 0:e.pricePoints)==null?void 0:p[0])==null?void 0:f.currency)||Zu.Usd,s=o_(s_({addons:e==null?void 0:e.compatibleAddons,billingCountryCode:n,currency:o})),l=c_({addons:t==null?void 0:t.addons,billingPeriod:r,billingCountryCode:n,currency:o});return l!=null&&l.length&&(s!=null&&s.length)&&(i=$v(l.filter(b=>s.some(S=>S.id===b.addon.id)))),{addons:i,initialAddons:DO(i),availableAddons:s}}function FO(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.addonsStep.addons.find(o=>o.addon.id===e.id);i?i.quantity=n:(r.addonsStep.addons.push({addon:e,quantity:n}),r.addonsStep.addons=$v(r.addonsStep.addons));})}function RO(){let[,t]=Ve();return e=>t(n=>{kO(n.addonsStep.addons,r=>r.addon.id===e);})}function OO(){let[{addonsStep:t}]=Ve();return t}function u_(){let t=OO();return vt(q({},t),{setAddon:FO(),removeAddon:RO()})}function NO(){let[{checkout:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}]=Ve();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}}function MO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.readOnly=e;})}function LO(){let[,t]=Ve();return e=>t(n=>{n.widgetState.isValid=e;})}function BO(){let[,t]=Ve();return e=>t(n=>{n.checkoutSuccess=e;})}function je(){let{checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r}=NO();return {checkoutState:t,widgetState:e,checkoutLocalization:n,checkoutSuccess:r,setWidgetReadOnly:MO(),setIsValid:LO(),setCheckoutSuccess:BO()}}function p_({planId:t,resourceId:e,billingCountryCode:n,onMockCheckoutState:r}){let{stigg:i}=ce(),[o,s]=useState(true),[l,p]=useState();return useEffect(()=>{let f=()=>ie(null,null,function*(){try{let b=yield i.getCheckoutState({planId:t,resourceId:e,billingCountryCode:n});p(b);}catch(b){sc.error(`Failed to load checkout ${b==null?void 0:b.message}`,b);}finally{s(false);}});if(r){s(false),p(r({planId:t,resourceId:e,billingCountryCode:n}));return}i.isCustomerLoaded&&(s(true),f());},[i,i.isCustomerLoaded,e,t,n,r]),{checkout:l,isLoading:o,showWatermark:i.getShowWatermark()}}var dd=$1(o0());var hg=(t,e)=>t.minUnitQuantity&&e<t.minUnitQuantity?t.minUnitQuantity:t.maxUnitQuantity&&e>t.maxUnitQuantity?t.maxUnitQuantity:e;var a0=$1(o0()),s0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Monthly)),c0=t=>!!(t!=null&&t.pricePoints.some(e=>e.billingPeriod===a0.BillingPeriod.Annually)),Z_=t=>s0(t)&&c0(t);var eE=(t,e,n)=>t===dd.BillingPeriod.Monthly&&e||t===dd.BillingPeriod.Annually&&n?t:null,nE=({pricingModel:t})=>t===hn.PerUnit;function qL(t,e,n){var o;if(!e)return [];let r=J_(t,"featureId"),i=J_(tE((o=n==null?void 0:n.prices)==null?void 0:o.map(s=>{let{feature:l}=s;return !l||!nE(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return tE(e==null?void 0:e.map(s=>{var b,S,P;let l=(b=s.feature)==null?void 0:b.featureId;if(!l||!nE(s))return null;let p,f=((S=r[l])==null?void 0:S.quantity)||((P=i[l])==null?void 0:P.quantity);return p=hg(s,f||1),s.isTieredPrice&&!Xp(s.tiers)&&(p=sv(s.tiers,p).upTo),{featureId:l,quantity:p}}))}function YL({plan:t,activeSubscription:e,preferredBillingPeriod:n}){var s,l;let r=s0(t),i=c0(t);if(n){let p=eE(n,r,i);if(p)return p}if(((s=e==null?void 0:e.plan)==null?void 0:s.id)===(t==null?void 0:t.id))return ((l=e==null?void 0:e.price)==null?void 0:l.billingPeriod)||dd.BillingPeriod.Monthly;if(e!=null&&e.prices&&(e==null?void 0:e.prices.length)>0){let p=eE(e==null?void 0:e.prices[0].billingPeriod,r,i);if(p)return p}return i?dd.BillingPeriod.Annually:dd.BillingPeriod.Monthly}function rE({preferredBillingPeriod:t,plan:e,activeSubscription:n,billingCountryCode:r,preconfiguredBillableFeatures:i}){let o=YL({plan:e,activeSubscription:n,preferredBillingPeriod:t}),s=e==null?void 0:e.pricePoints.filter(p=>p.billingPeriod===o),l=qL(i,s,n);return {billingPeriod:o,billableFeatures:l,billingCountryCode:r}}function KL(){let[{planStep:t}]=Ve();return t}function QL(){let[,t]=Ve();return (e,n)=>t(r=>{let i=r.planStep.billableFeatures.find(o=>o.featureId===e);i?i.quantity=n:r.planStep.billableFeatures.push({featureId:e,quantity:n});})}function XL(){let[,t]=Ve();return e=>t(n=>{n.planStep.billingPeriod=e,n.addonsStep.addons=n.addonsStep.addons.filter(r=>r.addon.pricePoints.some(i=>i.billingPeriod===e));})}function yo(){let t=KL();return vt(q({},t),{setBillingPeriod:XL(),setBillableFeature:QL()})}var oE=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],iE={activeStep:0,completedSteps:[],steps:oE,isDisabled:false},JL=(t,e,n,r)=>{if(Z_(t)&&!r)return false;let i=e.map(s=>s.featureId),o=n.map(s=>s.featureId);return !(i.length!==o.length||!i.every(s=>o.includes(s)))};function aE({isLoading:t,skipCheckoutSteps:e,plan:n,availableAddons:r,availableCharges:i,preferredBillingPeriod:o,preconfiguredBillableFeatures:s}){if(t||!n)return iE;let l=[];return e.includes("PLAN")&&JL(n,i,s,o)&&l.push("PLAN"),((r==null?void 0:r.length)===0||e.includes("ADDONS"))&&l.push("ADDONS"),vt(q({},iE),{steps:oE.filter(p=>!l.includes(p.key))})}function t3(){let[{progressBar:t}]=Ve();return t}function e3(){let[t,e]=Ve();return n=>ie(null,null,function*(){let{progressBar:r,planStep:i,addonsStep:o,paymentStep:s,onBeforeStepChange:l}=t;if(n!==r.activeStep&&l){let p=r.steps[r.activeStep],f=r.steps[n];if(p&&f){let b={planStep:i,addonsStep:o,paymentStep:s};if(!(yield l({from:p.key,to:f.key,state:b})))return}}e(({progressBar:p})=>{p.activeStep=n;});})}function n3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.completedSteps.push(e);})}function r3(t){return t.completedSteps.length>=t.steps.length-1}function i3(){let[t,e]=Ve();return ()=>ie(null,null,function*(){let{progressBar:n,planStep:r,addonsStep:i,paymentStep:o,onBeforeStepChange:s}=t;if(n.isDisabled)return;let l=n.steps[n.activeStep],p=n.steps[n.activeStep+1];if(p&&s){let f={planStep:r,addonsStep:i,paymentStep:o};if(!(yield s({from:l.key,to:p.key,state:f})))return}e(({progressBar:f})=>{f.completedSteps.includes(f.activeStep)||f.completedSteps.push(f.activeStep),f.activeStep<f.steps.length-1&&(f.activeStep+=1);});})}function o3(){let[,t]=Ve();return e=>t(({progressBar:n})=>{n.isDisabled=!!e;})}function wa(){let t=t3();return {currentStep:t.steps[t.activeStep],progressBarState:t,isLastStep:t.activeStep===t.steps.length-1,isCheckoutComplete:r3(t),setActiveStep:e3(),markStepAsCompleted:n3(),goNext:i3(),setIsDisabled:o3()}}function pd(){let[{planStep:t,addonsStep:e,promotionCode:n,paymentStep:r}]=Ve();return vt(q({},t),{addons:e.addons,promotionCode:n,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function gg({billingAddress:t,taxPercentage:e,taxIds:n}){if(!t&&!e&&!(n!=null&&n.length))return {};let r=n!=null&&n.length?n==null?void 0:n.filter(i=>i.value&&i.type):void 0;return {billingInformation:vt(q(q({},t?{billingAddress:t}:{}),e?{taxPercentage:e}:{}),{taxIds:r})}}var l3=I=>ie(null,[I],function*({stigg:t,customerId:e,planId:n,resourceId:r,promotionCode:i,addons:o,billableFeatures:s,billingCountryCode:l,billingPeriod:p,billingAddress:f,taxPercentage:b,taxIds:S,onMockCheckoutPreview:P}){var R;let T=o.map(({addon:N,quantity:j})=>({addonId:N.id,quantity:j})),F=null,k=null;try{if(e&&n){let N=q({customerId:e,planId:n,resourceId:r,billingCountryCode:l,addons:T,billingPeriod:p,promotionCode:i,billableFeatures:fR(s)?void 0:s},gg({billingAddress:f,taxPercentage:b,taxIds:S}));F=P?P(N):yield t.previewSubscription(N);}}catch(N){let[,j]=((R=N==null?void 0:N.message)==null?void 0:R.split("Error:"))||[];k=j==null?void 0:j.trim();}return {subscriptionPreview:F,errorMessage:k}}),u0=({onMockCheckoutPreview:t}={})=>{let{stigg:e}=ce(),n=pd(),[{resourceId:r}]=Ve(),{checkoutState:i,widgetState:o}=je(),{plan:s,customer:l}=i||{};return {previewSubscriptionAction:useCallback((...b)=>ie(null,[...b],function*({promotionCode:f}={}){return o.isValid?l3({stigg:e,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:n.addons,billableFeatures:n.billableFeatures,billingCountryCode:n.billingCountryCode,billingPeriod:n.billingPeriod,billingAddress:n.billingAddress,taxPercentage:n.taxPercentage,promotionCode:f!=null?f:n.promotionCode,taxIds:n.taxId?[n.taxId]:void 0,onMockCheckoutPreview:t}):{subscriptionPreview:null,errorMessage:null}}),[e,l==null?void 0:l.id,s==null?void 0:s.id,r,n.addons,n.billableFeatures,n.billingCountryCode,n.billingPeriod,n.billingAddress,n.taxPercentage,n.taxId,n.promotionCode,o.isValid,t])}},u3=500,sE=({onMockCheckoutPreview:t}={})=>{let[e,n]=useState(null),[r,i]=useState(null),[o,s]=useState(false),{previewSubscriptionAction:l}=u0({onMockCheckoutPreview:t});return useEffect(()=>{let p=()=>ie(null,null,function*(){let{subscriptionPreview:b,errorMessage:S}=yield l();b&&(n(b),i(null)),S&&(i(S),n(null)),s(false);});s(true);let f=setTimeout(()=>{s(true),p();},u3);return ()=>{clearTimeout(f);}},[l]),{subscriptionPreview:e,isFetchingSubscriptionPreview:o,errorMessage:r}};function cE({customer:t,taxPercentage:e,taxId:n}){return {useNewPaymentMethod:!(t!=null&&t.paymentMethodDetails),taxPercentage:e,taxId:n}}function d3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.useNewPaymentMethod=e;}),[t])}function p3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.errorMessage=e;}),[t])}function f3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.billingAddress=e;}),[t])}function m3(){let[{paymentStep:t}]=Ve();return t}function h3(){let[,t]=Ve();return useCallback(e=>t(n=>{n.paymentStep.taxId=e;}),[t])}function Yr(){let t=m3();return vt(q({},t),{setUseNewPaymentMethod:d3(),setErrorMessage:p3(),setBillingAddress:f3(),setTaxId:h3()})}function lE(t){return t2({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:n})=>n===Se.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:n})=>`${n.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:n})=>`Billed ${n.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:n})=>`Your account will be granted credits worth ${n} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:n,currency:r})=>{let i="";n.type===jb.Percentage?i=`${n.value}% off`:i=`${Nn({amount:n.value,currency:r})}`;let o="";switch(n.durationType){case hh.Once:{o=" once";break}case hh.Repeating:{o=`${n.type===jb.Fixed?" per month":""} for ${n.durationInMonths} months`;break}case hh.Forever:default:o="";}return `${i}${o}`},taxTitle:({taxDetails:n})=>`Tax (${n==null?void 0:n.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:n})=>`Your changes will take effect at the end of your current billing cycle on ${_1(n).format("MMMM D, YYYY")}.`,checkoutSuccessText:"Changes applied",payAsYouGoTooltipText:"Billed according to actual usage"},checkoutButton:{nextText:"Next",noChangesText:"No changes",updateText:"Update subscription",downgradeToFreeText:"Cancel subscription",upgradeText:"Subscribe"},downgradeToFree:{alertText:()=>"We\u2019re sorry to see you cancel your paid subscription \u{1F62D}",freePlanHeader:()=>"New plan",freePlanName:({plan:n})=>`${n.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:n})=>`${n.displayName}`,paidPlanPriceText:({billingPeriod:n})=>`Paid plan${n?`, billed ${n.toLowerCase()}`:""}`},nextBillingCaption:()=>""},t)}var gf={primary:"rgb(50, 126, 238)",textColor:"rgb(0, 30, 108)",backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(235, 237, 243)",summaryBackgroundColor:"rgb(109, 121, 144)"};function uE(t,e,n){let{palette:r}=t||{};return {primary:(e==null?void 0:e.primary)||(r==null?void 0:r.primary)||gf.primary,textColor:(e==null?void 0:e.textColor)||(r==null?void 0:r.text.primary)||gf.textColor,backgroundColor:(e==null?void 0:e.backgroundColor)||(r==null?void 0:r.backgroundPaper)||gf.backgroundColor,borderColor:(e==null?void 0:e.borderColor)||(r==null?void 0:r.outlinedBorder)||gf.borderColor,summaryBackgroundColor:(e==null?void 0:e.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||gf.summaryBackgroundColor,paymentInputBackgroundColor:e==null?void 0:e.paymentInputBackgroundColor,paymentInputBorderColor:e==null?void 0:e.paymentInputBorderColor,paymentInputBorderRadius:e==null?void 0:e.paymentInputBorderRadius}}var p0=h0.createContext(null);p0.displayName="CheckoutContext";var Ve=()=>{let t=useContext(p0);if(!t)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return t},_3=({children:t,initialState:e})=>{let[n,r]=useState(e);useEffect(()=>{r(e);},[e]);let i=useCallback(l=>r(p=>produce(p,f=>l(f))),[r]),[o,s]=useMemo(()=>[n,i],[i,n]);return jsx(p0.Provider,{value:[o,s],children:t})};function pE({children:t,textOverrides:e,theme:n,preferredBillingPeriod:r,billableFeatures:i,resourceId:o,planId:s,billingCountryCode:l,billingInformation:p,onMockCheckoutState:f,skipCheckoutSteps:b,onBeforeStepChange:S}){var N;let{checkout:P,isLoading:I,showWatermark:T}=p_({resourceId:o,planId:s,billingCountryCode:l,onMockCheckoutState:f}),F=P!=null&&P.configuration?Px(P.configuration):{typography:rf(null,wh)},k=_l(F),R=useMemo(()=>{var dt,Y;let j=uE(k,n,P==null?void 0:P.configuration),H=lE(e),Q=rE({preferredBillingPeriod:r,plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:i!=null?i:[]}),it=l_({plan:P==null?void 0:P.plan,activeSubscription:P==null?void 0:P.activeSubscription,billingPeriod:Q.billingPeriod}),ct=cE({customer:P==null?void 0:P.customer,taxPercentage:(dt=p==null?void 0:p.taxDetails)==null?void 0:dt.taxPercentage}),U=aE({isLoading:I,skipCheckoutSteps:b!=null?b:[],plan:P==null?void 0:P.plan,availableAddons:it.availableAddons,availableCharges:Q.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:i!=null?i:[]});return {checkout:P,checkoutLocalization:H,stiggTheme:k,theme:j,progressBar:U,planStep:Q,addonsStep:it,paymentStep:ct,resourceId:(Y=P==null?void 0:P.resource)==null?void 0:Y.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:I},showWatermark:T,checkoutSuccess:false,onBeforeStepChange:S}},[r,l,P,I,b,(N=p==null?void 0:p.taxDetails)==null?void 0:N.taxPercentage,S]);return jsx(Xn,{componentTheme:F,children:jsx(_3,{initialState:R,children:t})},P==null?void 0:P.plan.id)}var fE="920px",hE=W.div`
5465
5465
  margin: auto;
5466
5466
  min-height: 760px;
5467
5467
  max-width: ${fE};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "7.16.0",
2
+ "version": "7.16.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/stigg-sdk.cjs.js",
5
5
  "types": "dist/index.d.ts",