@stigg/react-sdk 7.26.1 → 7.26.3
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.
- package/dist/{CreditUsageChart-Z2VEQGTE.cjs.js → CreditUsageChart-HLN3ODN4.cjs.js} +19 -19
- package/dist/{CreditUsageChart-O5KLTDTO.esm.js → CreditUsageChart-Q5ETE3Y3.esm.js} +4 -4
- package/dist/{chunk-EKWCT5WF.esm.js → chunk-WK32INFB.esm.js} +1 -1
- package/dist/{chunk-MY4ZIUAV.cjs.js → chunk-WSFXGBVX.cjs.js} +1 -1
- package/dist/stigg-sdk.cjs.js +174 -174
- package/dist/stigg-sdk.esm.js +107 -107
- package/package.json +2 -1
package/dist/stigg-sdk.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'./chunk-
|
|
1
|
+
import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'./chunk-WK32INFB.esm.js';export{s as StiggContext,t as StiggProvider,C as useActiveSubscriptions,x as useBooleanEntitlement,K as useCreditUsage,E as useCustomerPortal,A as useEnumEntitlement,z as useMeteredEntitlement,y as useNumericEntitlement,D as usePaywall,u as useStiggContext}from'./chunk-WK32INFB.esm.js';import {BillingModel,PaymentCollection,SubscriptionStatus,PricingType,BillingPeriod,SubscriptionScheduleType,ThresholdType,DiscountType,DiscountDurationType,Currency,BillingVendorIdentifier,CreditGrantType,WidgetType,FontWeight,MeterType,EntitlementResetPeriod,TiersMode,Alignment}from'@stigg/js-client-sdk';export*from'@stigg/js-client-sdk';import ii,{forwardRef,lazy,useContext,useMemo,useState,useEffect,useCallback,Suspense,useRef,createElement}from'react';import xu from'classnames';import Me from'@mui/material/Grid/index.js';import ic from'lodash/compact.js';import {NumericFormat,numericFormatter}from'react-number-format';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Na from'lodash/isFunction.js';import Rm from'react-spinners/ClipLoader.js';import {css,useTheme}from'@emotion/react';import ho from'dayjs';import Bm from'dayjs/plugin/utc.js';import Am from'dayjs/plugin/relativeTime.js';import Im from'dayjs/plugin/advancedFormat.js';import Po from'lodash/isNil.js';import Nm from'lodash/sum.js';import Zm from'currency-symbol-map';import jm from'@mui/material/InputAdornment/index.js';import Ym,{buttonClasses}from'@mui/material/Button/index.js';import qm from'@mui/material/TextField/index.js';import Cl from'@mui/material/Divider/index.js';import eu from'@mui/material/OutlinedInput/index.js';import tu from'@mui/material/Select/index.js';import ou from'@mui/material/MenuItem/index.js';import ru from'lodash/map.js';import ke from'@mui/material/Box/index.js';import Wu from'react-switch';import ng from'lodash/countBy.js';import ig from'lodash/uniq.js';import Yl from'lodash/sortBy.js';import dg from'lodash/merge.js';import Qe from'react-loading-skeleton';import wg from'lodash/flatMap.js';import Rs from'@mui/material/Tab/index.js';import Bg from'lodash/isEmpty.js';import Lg from'@mui/material/Tabs/index.js';import Ug from'@mui/material/useMediaQuery/index.js';import {ExternalLink,ChevronRight,Info,Minus,Plus,ArrowDown}from'react-feather';import xf from'@mui/material/Link/index.js';import uf,{tooltipClasses}from'@mui/material/Tooltip/index.js';import wl from'lodash/keyBy.js';import bi from'color';import kf,{linearProgressClasses}from'@mui/material/LinearProgress/index.js';import Hf from'lodash/padStart.js';import Ml from'lodash/isUndefined.js';import {BillingModel as BillingModel$1,BillingPeriod as BillingPeriod$1}from'@stigg/api-client-js/src/generated/sdk.js';import Vn from'lodash/lowerCase.js';import ty from'lodash/range.js';import {produce}from'immer';import dy from'lodash/cloneDeep.js';import py from'lodash/remove.js';import {Elements,useStripe,useElements,AddressElement,PaymentElement}from'@stripe/react-stripe-js';import sh from'@mui/material/StepIcon/index.js';import fP from'lodash/partition.js';import xh from'@mui/material/CircularProgress/index.js';import xP from'@mui/material/Paper/index.js';import PP from'@mui/material/Alert/index.js';import wh from'@mui/material/Checkbox/index.js';import Bh from'@mui/material/FormControlLabel/index.js';import Ah from'lodash/isString.js';import fx from'@mui/material/Autocomplete/index.js';import yx from'@mui/material/Collapse/index.js';import {AL,AD,AO,AR,AM,AW,AU,AT,AZ,BS as BS$1,BH,BD,BB,BY,BE,BJ,BO,BA,BR,BG,BF,KH,CM,CA,CV,CL,CN,CO,CD,CR,HR,CY,CZ,DK,DO,EC,EG,SV,EE,ET,EU,FI,FR,GE,DE,GR,GN,HK,HU,IS as IS$1,IN,ID,IE,IL,IT,JP,KZ,KE,KG,LA,LV,LI,LT,LU,MY,MT,MR,MX,MD,ME,MA,NP,NL,NZ,NG,MK,NO,OM,PE,PH,PL,PT,RO,RU,SA,SN,RS as RS$1,SG,SK,SI,ZA,KR,ES,SR,SE,CH,TW,TJ,TZ,TH,TR,UG,UA,AE,GB,US as US$1,UY,UZ,VE,VN,ZM,ZW}from'country-flag-icons/react/3x2';import ed from'lodash/startCase.js';import td from'lodash/upperCase.js';import Mx from'react-lottie';import dP from'@mui/material/IconButton/index.js';import {styled}from'@mui/material/styles/index.js';import WP from'@mui/material/Radio/index.js';import jP from'@mui/material/Chip/index.js';import NS from'lodash/capitalize.js';import {TableContainer,Table,Divider,TableCell,TableRow,TablePagination,TableBody,TableHead}from'@mui/material';import dS from'@mui/material/TableRow/index.js';function go(e,t,o){let r=o?` ${o}`:"";return (!e||e===1)&&t?`Up to ${t}${r}`:e&&e>1&&t?`${e}-${t}${r}`:e&&e>1?`Minimum ${e}${r}`:""}function ie(e,t="en-US"){if(e==null)return;let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:0,fixedDecimalScale:true};return numericFormatter(String(Math.round(e)),o)}function jr(e,t="en-US"){let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:2,fixedDecimalScale:true};return numericFormatter(String(e),o)}function Dt(e,t=1){if(e<1e6)return ie(e)||"0";let o=[{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e6,suffix:"M"}];for(let{value:r,suffix:n}of o)if(e>=r){let s=(e/r).toFixed(t);return s.includes(".")&&(s=s.replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")),`${s}${n}`}return ie(e)||"0"}var dm=e(f)`
|
|
2
2
|
margin: 0;
|
|
3
3
|
`,pm=e.div`
|
|
4
4
|
display: flex;
|
|
@@ -12,11 +12,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
12
12
|
width: 24px;
|
|
13
13
|
height: 24px;
|
|
14
14
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
15
|
-
`;function fo({displayName:e,className:t}){return jsxs(pm,{className:`stigg-entitlement-row-container ${t}`,children:[jsx(mm,{children:jsx(um,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsx(dm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function fm(e){if(!e)return "";switch(e){case EntitlementResetPeriod.Day:return "per day";case EntitlementResetPeriod.Hour:return "per hour";case EntitlementResetPeriod.Week:return "per week";case EntitlementResetPeriod.Month:return "per month";case EntitlementResetPeriod.Year:return "per year";default:return ""}}function ym({hasUnlimitedUsage:e,feature:t,resetPeriod:o,usageLimit:r,minUnitQuantity:n,maxUnitQuantity:i,isCustom:s,enumValues:l}){let a=n||i,c=`${o&&r?`${fm(o)}`:""}`;if(l){let u=l.length===1?t==null?void 0:t.featureUnits:t==null?void 0:t.featureUnitsPlural;return `${l.length} ${u}`}if(e)return `Unlimited ${t==null?void 0:t.featureUnitsPlural}`;if(s)return `Custom ${t==null?void 0:t.featureUnitsPlural}`;if(r){let u=r===1?t==null?void 0:t.featureUnits:t==null?void 0:t.featureUnitsPlural;return `${ie(r)} ${u} ${c}`}return a?go(n,i,t==null?void 0:t.featureUnitsPlural):t==null?void 0:t.displayName}function tn(e){let i=e,{displayNameOverride:t,feature:o}=i,r=c(i,["displayNameOverride","feature"]),n=t||ym(a({feature:o},r))||"";return jsx(fo,{displayName:n,className:`stigg-entitlement-${o==null?void 0:o.refId}`})}function Cm(e){var s,l;let{amount:t,customCurrency:o,displayNameOverride:r}=e,n=t!=null?t:0;if(r)return r;let i=n===1?(s=o.units)==null?void 0:s.singular:(l=o.units)==null?void 0:l.plural;return `${ie(n)} ${i||o.displayName}`}function
|
|
15
|
+
`;function fo({displayName:e,className:t}){return jsxs(pm,{className:`stigg-entitlement-row-container ${t}`,children:[jsx(mm,{children:jsx(um,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsx(dm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function fm(e){if(!e)return "";switch(e){case EntitlementResetPeriod.Day:return "per day";case EntitlementResetPeriod.Hour:return "per hour";case EntitlementResetPeriod.Week:return "per week";case EntitlementResetPeriod.Month:return "per month";case EntitlementResetPeriod.Year:return "per year";default:return ""}}function ym({hasUnlimitedUsage:e,feature:t,resetPeriod:o,usageLimit:r,minUnitQuantity:n,maxUnitQuantity:i,isCustom:s,enumValues:l}){let a=n||i,c=`${o&&r?`${fm(o)}`:""}`;if(l){let u=l.length===1?t==null?void 0:t.featureUnits:t==null?void 0:t.featureUnitsPlural;return `${l.length} ${u}`}if(e)return `Unlimited ${t==null?void 0:t.featureUnitsPlural}`;if(s)return `Custom ${t==null?void 0:t.featureUnitsPlural}`;if(r){let u=r===1?t==null?void 0:t.featureUnits:t==null?void 0:t.featureUnitsPlural;return `${ie(r)} ${u} ${c}`}return a?go(n,i,t==null?void 0:t.featureUnitsPlural):t==null?void 0:t.displayName}function tn(e){let i=e,{displayNameOverride:t,feature:o}=i,r=c(i,["displayNameOverride","feature"]),n=t||ym(a({feature:o},r))||"";return jsx(fo,{displayName:n,className:`stigg-entitlement-${o==null?void 0:o.refId}`})}function Cm(e){var s,l;let{amount:t,customCurrency:o,displayNameOverride:r}=e,n=t!=null?t:0;if(r)return r;let i=n===1?(s=o.units)==null?void 0:s.singular:(l=o.units)==null?void 0:l.plural;return `${ie(n)} ${i||o.displayName}`}function Ta({entitlement:e}){let t=Cm(e);return jsx(fo,{displayName:t,className:`stigg-credit-entitlement-${e.id}`})}function Sm(e){return e.__typename==="PackageCreditEntitlement"}var Tm=e.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
gap: 16px;
|
|
19
|
-
`;function km(e,t,o){if(t.entitlementsTitle)return t.entitlementsTitle(e);let r=o?"Includes:":"";return e.basePlan&&(r=`Everything in ${e.basePlan.displayName}${o?", plus:":""}`),r}function
|
|
19
|
+
`;function km(e,t,o){if(t.entitlementsTitle)return t.entitlementsTitle(e);let r=o?"Includes:":"";return e.basePlan&&(r=`Everything in ${e.basePlan.displayName}${o?", plus:":""}`),r}function wa({plan:e,billingPeriod:t,paywallLocale:o}){var l;let n=(((l=e.pricePoints)==null?void 0:l.filter(a=>a.billingPeriod===t))||[]).filter(a=>(a==null?void 0:a.minUnitQuantity)&&(a==null?void 0:a.minUnitQuantity)>1||(a==null?void 0:a.maxUnitQuantity)).map(a=>{var c;return jsx(tn,{feature:a!=null&&a.feature?{refId:a.feature.featureId,featureUnits:a.feature.units,featureUnitsPlural:a.feature.unitsPlural,unitQuantity:a.feature.unitQuantity,displayName:a.feature.displayName}:null,minUnitQuantity:a==null?void 0:a.minUnitQuantity,maxUnitQuantity:a==null?void 0:a.maxUnitQuantity},`priceUnitEntitlement-${(c=a==null?void 0:a.feature)==null?void 0:c.displayName}`)}),i=ic(e.packageEntitlements).filter(a=>a.isGranted).filter(a=>{var c;return !((c=a.hiddenFromWidgets)!=null&&c.includes(WidgetType.Paywall))}),s=n.length>0||i.length>0;return jsxs(Tm,{className:"stigg-plan-entitlements-container",children:[jsx(f,{className:"stigg-plan-entitlements-title",color:"secondary",variant:"h6",bold:true,children:km(e,o,s)}),n,i.map(a=>Sm(a)?jsx(Ta,{entitlement:a},ka(a)):jsx(tn,{displayNameOverride:a.displayNameOverride,feature:a.feature,resetPeriod:a.resetPeriod,hasUnlimitedUsage:a.hasUnlimitedUsage,usageLimit:a.usageLimit,enumValues:a.enumValues,isCustom:a.isCustom},ka(a)))]})}function ka(e){return `${e.__typename}:${e.id}`}var on=(a=>(a.START_TRIAL="START_TRIAL",a.UPGRADE_TRIAL_TO_PAID="UPGRADE_TRIAL_TO_PAID",a.REQUEST_CUSTOM_PLAN_ACCESS="REQUEST_CUSTOM_PLAN_ACCESS",a.CHANGE_BILLING_PERIOD="CHANGE_BILLING_PERIOD",a.CHANGE_UNIT_QUANTITY="CHANGE_UNIT_QUANTITY",a.UPGRADE_PLAN="UPGRADE_PLAN",a.DOWNGRADE_PLAN="DOWNGRADE_PLAN",a.CANCEL_SCHEDULED_UPDATES="CANCEL_SCHEDULED_UPDATES",a))(on||{});ho.extend(Bm);ho.extend(Am);ho.extend(Im);var Q=ho;var nn=e=>Q.utc(e).format("MMMM Do, YYYY");function Co(e){return String(e.scheduledExecutionTime)}function Em(e){return e!=null&&e.end?String(e.end):void 0}function xo({scheduledUpdate:e,subscriptionPrices:t,billingPeriodRange:o,options:r={}}){var s,l;if(!e)return {};let{withDate:n,postfix:i=""}=r;switch(e.subscriptionScheduleType){case SubscriptionScheduleType.Downgrade:{let a=n,c=Em(o);return Po(a)&&c&&(a=!Q(Co(e)).isSame(Q(c),"day")),{line1:jsxs(Fragment,{children:["Your subscription will be downgraded to the ",jsxs("b",{children:[(s=e.targetPackage)==null?void 0:s.displayName," plan"]})," ",a?jsxs(Fragment,{children:["on ",nn(Co(e))]}):i,"."]}),line2:"Until then you still have access to your current plan."}}case SubscriptionScheduleType.BillingPeriod:{let a=e.scheduleVariables;return {line1:jsxs(Fragment,{children:["Your billing cycle will change to ",jsx("b",{children:(l=a.billingPeriod)==null?void 0:l.toLocaleLowerCase()})," ",n?jsxs(Fragment,{children:["on ",nn(Co(e))]}):i,"."]})}}case SubscriptionScheduleType.UnitAmount:{let a=e.scheduleVariables,u=ic(t==null?void 0:t.map(({feature:C})=>C)).find(({id:C})=>C===a.featureId),{featureUnits:f,featureUnitsPlural:p}=u||{},h=a.newUnitAmount===1?f:p,g=jsxs(Fragment,{children:["Your subscription will be updated to ",jsx("b",{children:a.newUnitAmount})," ",h," ",n?jsxs(Fragment,{children:["on ",nn(Co(e))]}):i,"."]}),y=`Until then you still have access to your current ${f} count.`;return {line1:g,line2:y}}default:return {}}}function Fa(e){return e.feature&&(e.feature.unitQuantity!==1?e.feature.unitsPlural:e.feature.units)||""}function ln(e,t){let o=[...e];o.sort((r,n)=>r.upTo?n.upTo?r.upTo-n.upTo:-1:1);for(let r of o)if(r.upTo&&t<=r.upTo)return r;return o[o.length-1]}function Ia(e,t,o){return t===BillingPeriod.Annually&&o?e/12:e}function sn(e,t,o,r){let n=0;if(e.unitPrice){let i=Ia(e.unitPrice.amount,o,r);n+=i*t;}return e.flatPrice&&(n+=Ia(e.flatPrice.amount,o,r)),n}function cn(e,t,o,r){let n=t,i=0,s=0,l=[];for(;n>0&&s<e.length;){let c=e[s],{upTo:u}=c;if(Po(u))l.push({unitQuantity:n,amount:sn(c,n,o,r)}),n=0;else {let f=u-i,p=Math.min(n,f);l.push({unitQuantity:p,amount:sn(c,p,o,r)}),n-=p,i=u;}s+=1;}let a=Nm(l.map(({amount:c})=>c));return {breakdown:l,total:a}}function ht(e,t,o,r){if(!e.tiers)return 0;switch(e.tiersMode){case TiersMode.Volume:{let n=ln(e.tiers,t);return sn(n,t,o,r)}case TiersMode.Graduated:return cn(e.tiers,t,o,r).total;default:return 0}}function Gt(e){return e==null?void 0:e.some(({unitPrice:t,upTo:o})=>t&&!Po(o))}function va(e){return e==null?void 0:e.every(({unitPrice:t,upTo:o})=>!t||Po(o))}function Ea(e,t){return (e==null?void 0:e[0].upTo)&&t<=e[0].upTo}function bo({plan:e,billingPeriod:t,currentSubscription:o,currentSubscriptionOverride:r,selectDefaultTierIndex:n}){let i=e.pricePoints.filter(s=>s.billingPeriod===t&&s.isTieredPrice);if(i.length===1){let[s]=i,{featureId:l}=s.feature,a=n?n({plan:e}):0,c=s.tiers[a],u=Gt(s.tiers)?1:c.upTo||1;if(o&&o.plan.id===e.id){let p=o.prices.find(h=>{var g;return h.pricingModel===BillingModel.PerUnit&&h.tiersMode&&((g=h.feature)==null?void 0:g.featureId)===l});p&&(u=p.feature.unitQuantity||1);}if((r==null?void 0:r.planId)===e.id){let p=r.billableFeatures.find(h=>h.featureId===l);p&&(u=p.quantity);}let f={};return f[l]=u,f}return {}}function La({perUnitQuantityByFeature:e,plan:t,currentSubscription:o,currentSubscriptionOverride:r}){var u,f;if(!o)return 0;let n=o.prices.find(p=>p.pricingModel===BillingModel.PerUnit&&p.tiersMode),i=t.id===(r==null?void 0:r.planId);if(i&&(n=(u=t.pricePoints.find(p=>p.pricingModel===BillingModel.PerUnit&&p.tiersMode))!=null?u:n),!n)return 0;let{featureId:s,unitQuantity:l}=n.feature,a=l;if(i){let p=(f=r==null?void 0:r.billableFeatures)==null?void 0:f.find(h=>h.featureId===s);p&&(a=p.quantity);}if(Po(a))return 0;let c=e[s];return c<a?-1:c>a?1:0}var Dm=e(Rm)`
|
|
20
20
|
margin-left: 10px;
|
|
21
21
|
`,$m=e.button`
|
|
22
22
|
cursor: ${({$disabled:e})=>e?"default":"pointer"};
|
|
@@ -60,7 +60,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
60
60
|
margin-top: 4px;
|
|
61
61
|
align-self: ${({theme:e})=>j(e.stigg.layout.ctaAlignment)};
|
|
62
62
|
width: 100%;
|
|
63
|
-
`;function
|
|
63
|
+
`;function Ma({isNextPlan:e,customer:t,plan:o,billingPeriod:r,isCustomerOnTrial:n,onPlanSelected:i,paywallLocale:s,withTrialLeftRow:l,currentSubscription:a,currentSubscriptionOverride:c,perUnitQuantityByFeature:u}){let f=useTheme(),[p,h]=useState(false),{currentPlan:g,custom:y,downgrade:C,startTrial:b,upgrade:x,startNew:S,switchToBillingPeriod:T,cancelScheduledUpdate:F}=s.planCTAButton,w=Na(C)?C(o):C,I=Na(x)?x(o):x,k={title:t?o.isLowerThanCurrentPlan?w:I:S,disabled:false,intentionType:o.isLowerThanCurrentPlan?"DOWNGRADE_PLAN":n?"UPGRADE_TRIAL_TO_PAID":"UPGRADE_PLAN"},L=o.pricingType===PricingType.Custom,{line1:E}=xo({scheduledUpdate:o.scheduledUpdate,options:{withDate:true}});if(o.isTriable&&!o.isCurrentCustomerPlan&&!n)k.title=b(o),k.intentionType="START_TRIAL";else if(o.isCurrentCustomerPlan&&!n)if(r===o.currentCustomerPlanBillingPeriod||o.pricingType&&[PricingType.Free,PricingType.Custom].includes(o.pricingType))switch(La({perUnitQuantityByFeature:u,plan:o,currentSubscription:a,currentSubscriptionOverride:c})){case -1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=w;break;case 1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=I;break;default:k.title=g,k.disabled=true;break}else k.title=T(r),k.intentionType="CHANGE_BILLING_PERIOD";else L&&(k.title=typeof y=="function"?y({plan:o,selectedBillingPeriod:r}):y,k.intentionType="REQUEST_CUSTOM_PLAN_ACCESS");e&&o.scheduledUpdate&&(k.disabled=false,k.title=F,k.intentionType="CANCEL_SCHEDULED_UPDATES");let A=p||k.disabled;return jsx(Fragment,{children:jsx(Om,{className:"stigg-paywall-plan-button-layout",children:e&&E?jsxs(zm,{color:"secondary",variant:"body1",className:"stigg-paywall-schedule-update-text",children:[E," ",jsx(Vm,{color:"secondary",onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:k.title})]}):jsxs(Fragment,{children:[jsxs($m,{className:"stigg-paywall-plan-button","data-testid":`paywall-card-cta-${o.displayName}`,disabled:A,$disabled:A,onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:[jsx(Gm,{className:"stigg-paywall-plan-button-text",variant:"h6",color:"primary.main",children:k.title}),p&&jsx(Dm,{color:f.stigg.palette.text.disabled,loading:true,size:16})]}),l?jsx(Hm,{className:"stigg-trial-days-left-text",variant:"h6",color:"secondary",children:o.isCurrentCustomerPlan&&o.trialDaysLeft&&jsxs(Fragment,{children:[jsxs("b",{children:[o.trialDaysLeft," days"]})," left on your free trial"]})}):jsx("div",{style:{height:"20px"}})]})})})}var H=({amount:e,currency:t=Currency.Usd,locale:o,maximumFractionDigits:r=5,minimumFractionDigits:n=0,removeTrailingZero:i})=>{let s=t.toString(),l=Zm(s),a$1=new Intl.NumberFormat(o,a({maximumFractionDigits:r,minimumFractionDigits:n,style:"currency",currency:s,trailingZeroDisplay:i?"stripIfInteger":"auto"},l?{currencyDisplay:"code"}:{})).format(e||0);return l&&(a$1=a$1.replace(s,l)),a$1=a$1.replace(/\s/g,""),a$1};function Ua({planPrices:e,paywallCalculatedPrice:t,selectedBillingPeriod:o,locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:i,perUnitQuantityByFeature:s}){var C,b,x;let{amount:l,currency:a}=t||e[0],c=l||0,u=e.length===1,f=o===BillingPeriod.Annually&&n?c/12:c,p,h,g=i.price.pricePeriod(n?BillingPeriod.Monthly:BillingPeriod.Annually),y=g;for(let S of e)if(S.isTieredPrice&&S.tiers){let T=(s==null?void 0:s[S.feature.featureId])||1;p=S.tiers,h=Fa(S),f+=ht(S,T,o,n);}if(u){let S=e[0],T=S.blockSize&&S.blockSize>1?`for ${k(S.blockSize)} ${((C=S.feature)==null?void 0:C.unitsPlural)||((b=S.feature)==null?void 0:b.units)||""}`:`per ${((x=S.feature)==null?void 0:x.units)||""}`;S.pricingModel===BillingModel.PerUnit&&!S.isTieredPrice?y=`${T} ${g}`:S.pricingModel===BillingModel.UsageBased&&(y=`${T}`);}return {price:H({amount:f,currency:a,locale:r,minimumFractionDigits:2,removeTrailingZero:true}),unit:y,tiers:p,tierUnits:h}}function So(e,t,o,r,n,i){var s;switch(e.pricingType){case PricingType.Free:return typeof o.price.free=="function"?o.price.free(e.paywallCurrency):o.price.free;case PricingType.Custom:return {price:typeof o.price.custom=="function"?o.price.custom({plan:e,selectedBillingPeriod:t}):o.price.custom};case PricingType.Paid:{let l=e.pricePoints.filter(u=>u.billingPeriod===t),a$1=(s=e.paywallCalculatedPricePoints)==null?void 0:s.find(u=>u.billingPeriod===t);if(!(l!=null&&l.length)&&!a$1)return {price:o.price.priceNotSet};let c={planPrices:l,paywallCalculatedPrice:a$1,selectedBillingPeriod:t,perUnitQuantityByFeature:i||{}};return o.price.paid?o.price.paid(b(a({},c),{plan:e})):Ua(b(a({},c),{locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:o}))}default:return {price:""}}}var Qm=e(Ym,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
64
64
|
border-radius: 10px;
|
|
65
65
|
text-transform: none;
|
|
66
66
|
font-weight: 300;
|
|
@@ -71,10 +71,10 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
71
71
|
&:hover {
|
|
72
72
|
background-color: ${({theme:e,$success:t,$error:o})=>t?e.stigg.palette.successDark:o?e.stigg.palette.errorDark:""};
|
|
73
73
|
}
|
|
74
|
-
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(Qm,a({variant:e},t))};var ce=e(qm)(({theme:e})=>({"& .MuiOutlinedInput-root":{height:"42px",borderRadius:e.stigg.border.radius,fieldset:{borderColor:e.stigg.palette.outlinedBorder},"&:not(.Mui-focused):hover fieldset":{borderColor:e.stigg.palette.outlinedRestingBorder}},"& .MuiInputBase-input":a({padding:"8px 12px",borderRadius:e.stigg.border.radius,fontFamily:e.stigg.typography.fontFamily,color:e.stigg.palette.text.primary},e.stigg.typography.body),"& .Mui-error":{fontFamily:e.stigg.typography.fontFamily},"& .MuiFormHelperText-root":{whiteSpace:"nowrap"}}));var
|
|
74
|
+
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(Qm,a({variant:e},t))};var ce=e(qm)(({theme:e})=>({"& .MuiOutlinedInput-root":{height:"42px",borderRadius:e.stigg.border.radius,fieldset:{borderColor:e.stigg.palette.outlinedBorder},"&:not(.Mui-focused):hover fieldset":{borderColor:e.stigg.palette.outlinedRestingBorder}},"& .MuiInputBase-input":a({padding:"8px 12px",borderRadius:e.stigg.border.radius,fontFamily:e.stigg.typography.fontFamily,color:e.stigg.palette.text.primary},e.stigg.typography.body),"& .Mui-error":{fontFamily:e.stigg.typography.fontFamily},"& .MuiFormHelperText-root":{whiteSpace:"nowrap"}}));var _a=e(Me)`
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: column;
|
|
77
|
-
`;function
|
|
77
|
+
`;function Da(){return jsxs(_a,{container:true,children:[jsxs(l,{item:true,$gap:48,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsx(Cl,{className:"stigg-checkout-plan-header-divider",sx:{marginY:2}}),jsxs(_a,{item:true,children:[jsx(o,{width:120,height:20}),jsxs(m,{$gap:16,marginTop:3,children:[jsx(o,{height:20}),jsx(o,{height:20})]}),jsxs(l,{$gap:130,marginTop:3,children:[jsx(n,{flex:1,children:jsx(o,{height:20})}),jsx(n,{flex:3,children:jsx(o,{height:20})})]})]})]})}var Ct=e=>e.target.blur();function $a({width:e,tierUnits:t,value:o,handleChange:r,errorMessage:n}){return jsx(ce,{type:"number",onWheel:Ct,fullWidth:true,error:!!n,sx:{minHeight:"46px",width:e},InputProps:{endAdornment:jsx(jm,{position:"end",children:jsx(f,{variant:"body1",color:"primary",children:t})})},value:o,onChange:i=>{var l,a;let s=(l=i==null?void 0:i.target)!=null&&l.value?Number((a=i==null?void 0:i.target)==null?void 0:a.value):null;s&&r(s);}})}var nu=e(tu)`
|
|
78
78
|
border-radius: 10px;
|
|
79
79
|
min-height: 42px;
|
|
80
80
|
min-width: 120px;
|
|
@@ -90,9 +90,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
90
90
|
&.Mui-focused .MuiOutlinedInput-notchedOutline {
|
|
91
91
|
border-color: ${({theme:e})=>e.stigg.palette.primary} !important;
|
|
92
92
|
}
|
|
93
|
-
`;function
|
|
93
|
+
`;function Ga({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsx(nu,{value:e.toString(),fullWidth:true,error:!!i,onChange:s=>{var a,c;let l=(a=s==null?void 0:s.target)!=null&&a.value?Number((c=s==null?void 0:s.target)==null?void 0:c.value):null;l&&n(l);},id:t,input:jsx(iu,{}),MenuProps:{MenuListProps:{disablePadding:true},PaperProps:{sx:{marginTop:"4px",borderRadius:"10px"}}},children:ru(r,s=>{var l;return jsx(ou,{className:"stigg-price-tier-menu-item-text",value:(l=s.upTo)==null?void 0:l.toString(),children:jsxs(f,{variant:"body1",color:"primary",style:{lineHeight:"unset"},children:[ie(s.upTo)," ",o]})},s.upTo)})}):null}var lu=e(f)`
|
|
94
94
|
min-height: 46px;
|
|
95
|
-
`;function To(e){let{tiers:t,errorMessage:o}=e;return jsx(Fragment,{children:jsxs(ke,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsx(lu,{as:"div",className:"stigg-price-tier-select",children:Gt(t)?jsx(
|
|
95
|
+
`;function To(e){let{tiers:t,errorMessage:o}=e;return jsx(Fragment,{children:jsxs(ke,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsx(lu,{as:"div",className:"stigg-price-tier-select",children:Gt(t)?jsx($a,a({},e)):jsx(Ga,a({},e))}),jsx(f,{style:{margin:"4px"},variant:"caption",color:"error",children:o})]})})}var Va="\u200E",pu=e(f)`
|
|
96
96
|
word-break: break-word;
|
|
97
97
|
width: 100%;
|
|
98
98
|
`,mu=e(f)`
|
|
@@ -100,7 +100,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
100
100
|
`,uu=e(f)`
|
|
101
101
|
white-space: normal;
|
|
102
102
|
min-height: 39px;
|
|
103
|
-
`;function gu({plan:e,billingPeriod:t,hasMonthlyPrice:o,hasAnnuallyPrice:r,paywallLocale:n}){var l,a;let i=e.pricePoints.find(c=>c.billingPeriod===t),s=
|
|
103
|
+
`;function gu({plan:e,billingPeriod:t,hasMonthlyPrice:o,hasAnnuallyPrice:r,paywallLocale:n}){var l,a;let i=e.pricePoints.find(c=>c.billingPeriod===t),s=Va;return i&&o&&r&&(s=((a=(l=n.price).billingPeriod)==null?void 0:a.call(l,t))||`, billed ${t.toLowerCase()}`),jsx(f,{as:"span",className:"stigg-price-billing-period-text",variant:"h6",color:"secondary",children:s})}var Ha=({showStartingAt:e,withUnitPriceRow:t,withStartingAtRow:o,withTiersRow:r,plan:n,billingPeriod:i,paywallLocale:s,locale:l,hasMonthlyPrice:a$1,hasAnnuallyPrice:c,perUnitQuantityByFeature:u,setPerUnitQuantityByFeature:f$1})=>{var T;let{price:p,unit:h,tiers:g,tierUnits:y}=So(n,i,s,l,a$1,u),C=n.pricePoints.find(F=>F.billingPeriod===i&&F.isTieredPrice),b$1=C?C.feature.featureId:void 0,x=(T=u[b$1||""])!=null?T:1,S=F=>{b$1&&f$1(w=>b(a({},w),{[b$1]:F}));};return jsx(pu,{as:"div",className:"stigg-price-text",children:jsxs(Fragment,{children:[o&&jsx(f,{style:{minHeight:"20px"},className:"stigg-starting-at-text",variant:"body1",color:"secondary",children:e?s.price.startingAtCaption:Va}),jsx(uu,{className:"stigg-price-point",variant:"h1",children:p}),t&&jsxs(f,{as:"div",className:"stigg-price-unit-and-billing-period-text",style:{minHeight:"48px"},children:[jsx(mu,{className:"stigg-price-unit-text",as:"span",variant:"h6",color:"secondary",children:h}),jsx(gu,{plan:n,billingPeriod:i,hasAnnuallyPrice:c,hasMonthlyPrice:a$1,paywallLocale:s})]}),r?jsx(To,{componentId:`${n.id}_${b$1}_tier`,tiers:g,tierUnits:y,tiersMode:C==null?void 0:C.tiersMode,handleChange:S,value:x}):null]})})};var Pu=e(Ym)`
|
|
104
104
|
padding: 0px;
|
|
105
105
|
text-transform: none;
|
|
106
106
|
margin-left: 0px;
|
|
@@ -197,7 +197,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
197
197
|
path {
|
|
198
198
|
fill: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
199
199
|
}
|
|
200
|
-
`;function Ou({text:e="Next",iconsColor:t}){return jsx(Vu,{children:jsxs(Me,{display:"flex",alignItems:"center",gap:1,children:[jsx(Hu,{$iconsColor:t}),jsx(f,{color:"primary",variant:"body1",children:e})]})})}function
|
|
200
|
+
`;function Ou({text:e="Next",iconsColor:t}){return jsx(Vu,{children:jsxs(Me,{display:"flex",alignItems:"center",gap:1,children:[jsx(Hu,{$iconsColor:t}),jsx(f,{color:"primary",variant:"body1",children:e})]})})}function Wa({withUnitPriceRow:e,withTiersRow:t,withTrialLeftRow:o,customer:r,plan:n,billingPeriod:i,isHighlighted:s,currentSubscription:l,currentSubscriptionOverride:a,shouldShowDescriptionSection:c,hasMonthlyPrice:u,hasAnnuallyPrice:f,isCustomerOnTrial:p,onPlanSelected:h,paywallLocale:g,locale:y,withStartingAtRow:C,isCustomerInCustomPlan:b,selectDefaultTierIndex:x,hideCompatibleAddons:S}){var $,_,z;let T=n.isNextPlan&&n.isNextPlan(i),F=n.pricePoints.filter(q=>q.billingPeriod===i),w=($=n.paywallCalculatedPricePoints)==null?void 0:$.find(q=>q.billingPeriod===i),I=F.length>1&&!!(w!=null&&w.additionalChargesMayApply),k=!b||n.pricingType===PricingType.Custom,L=null;T?L=jsx(Ou,{text:"Next plan"}):s&&g.highlightChip&&(L=jsx($u,{className:"stigg-highlight-badge",children:jsx(Gu,{className:"stigg-highlight-badge-text",color:"white",bold:true,children:g.highlightChip})}));let[E,A]=useState(bo({plan:n,billingPeriod:i,currentSubscription:l,currentSubscriptionOverride:a,selectDefaultTierIndex:x})),Z=q=>{let Ge=Object.keys(E).map(pt=>({featureId:pt,quantity:E[pt]}));return h(q,Ge)};return jsxs(Mu,{className:xu(`stigg-${n.id}`,"stigg-plan-offering-container",{"stigg-current-plan":n.isCurrentCustomerPlan}),$isHighlighted:s,$isCurrentPlan:n.isCurrentCustomerPlan,children:[L,jsxs(zu,{className:"stigg-header-wrapper",children:[jsx(Uu,{className:"stigg-plan-header",variant:"h3",children:n.displayName}),c&&jsx(Du,{className:"stigg-plan-description",variant:"h6",color:"secondary",children:n.description}),jsx(Ha,{showStartingAt:I,withUnitPriceRow:e,withStartingAtRow:C,withTiersRow:t,plan:n,billingPeriod:i,paywallLocale:g,locale:y,hasAnnuallyPrice:f,hasMonthlyPrice:u,setPerUnitQuantityByFeature:A,perUnitQuantityByFeature:E}),k?jsx(Ma,{isNextPlan:T,customer:r,plan:n,currentSubscription:l,currentSubscriptionOverride:a,billingPeriod:i,isCustomerOnTrial:p,onPlanSelected:Z,paywallLocale:g,withTrialLeftRow:o,perUnitQuantityByFeature:E}):jsx("div",{style:{height:Nu}}),jsx(_u,{className:"stigg-plan-header-divider"})]}),jsx(wa,{plan:n,billingPeriod:i,paywallLocale:g}),jsx(Ru,{$planHasEntitlements:((z=(_=n.packageEntitlements)==null?void 0:_.length)!=null?z:0)>0,className:"stigg-addons-container",children:!S&&n.compatibleAddons&&n.compatibleAddons.length>0&&jsx(hn,{addons:n.compatibleAddons,paywallLocale:g})})]})}var Zu=e.div`
|
|
201
201
|
height: 40px;
|
|
202
202
|
padding: 0 20px;
|
|
203
203
|
margin-bottom: ${({theme:e})=>e.stigg.layout.switchBottomSpacing};
|
|
@@ -207,7 +207,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
207
207
|
display: flex;
|
|
208
208
|
align-items: center;
|
|
209
209
|
justify-content: center;
|
|
210
|
-
`,
|
|
210
|
+
`,Za=e(f)`
|
|
211
211
|
margin: 0 8px;
|
|
212
212
|
`,Yu=e(Wu)`
|
|
213
213
|
& .react-switch-bg {
|
|
@@ -220,7 +220,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
220
220
|
background: ${({theme:e})=>e.stigg.palette.switchHandle} !important;
|
|
221
221
|
top: 0.5px !important;
|
|
222
222
|
}
|
|
223
|
-
`;function Qu({discount:e,disabled:t}){return jsxs(f,{variant:"h6",color:t?"disabled":"primary",className:"stigg-discount-rate-text",children:[e,"% off"]})}function
|
|
223
|
+
`;function Qu({discount:e,disabled:t}){return jsxs(f,{variant:"h6",color:t?"disabled":"primary",className:"stigg-discount-rate-text",children:[e,"% off"]})}function Ya({discountRate:e,selectedBillingPeriod:t,onBillingPeriodChanged:o,availableBillingPeriods:r}){if(r.length<=1)return null;let n=t===BillingPeriod.Monthly;return jsxs(Zu,{className:"stigg-period-picker-container",children:[jsx(Za,{variant:"h6",className:"stigg-monthly-period-text",color:n?"primary":"disabled",children:"Monthly"}),jsx(Yu,{className:"stigg-period-switch",uncheckedIcon:false,checkedIcon:false,height:16,width:33,onChange:i=>o(i?BillingPeriod.Annually:BillingPeriod.Monthly),checked:!n,borderRadius:10,handleDiameter:19}),jsx(Za,{variant:"h6",className:"stigg-annual-period-text",color:n?"disabled":"primary",children:"Annual"}),e!==0&&jsx(Qu,{discount:e,disabled:n})]})}function Ku(e,t){if(!Po(e)&&!Po(t)){let o=t/12;return Math.round((e-o)/e*100)}return null}function Ja(e,t){var r;let o;if(o=(r=e.paywallCalculatedPricePoints)==null?void 0:r.find(n=>n.billingPeriod===t),o||(o=e.pricePoints.find(n=>n.billingPeriod===t)),!(o!=null&&o.amount)){let n=e.pricePoints.find(i=>i.isTieredPrice&&i.billingPeriod===t);if(n)return ht(n,1)}return o==null?void 0:o.amount}function Xa(e){return e.reduce((t,o)=>{let r=Ja(o,BillingPeriod.Monthly),n=Ja(o,BillingPeriod.Annually),i=Ku(r,n);return i&&(t=Math.max(t,i)),t},0)}function Pn(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function bn(e,t){return e.some(o=>Pn(o,t))}function ja(e,t,o){return e.filter(r=>r.pricingType!==PricingType.Paid||Pn(r,t)).filter(r=>!o||!o({plan:r}))}var ju=e.div`
|
|
224
224
|
color: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
225
225
|
display: flex;
|
|
226
226
|
align-items: stretch;
|
|
@@ -240,11 +240,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
240
240
|
display: flex;
|
|
241
241
|
flex-direction: column;
|
|
242
242
|
align-items: center;
|
|
243
|
-
`,
|
|
243
|
+
`,ts=({plans:e,customer:t,currentSubscription:o,highlightedPlanId:r,selectedBillingPeriod:n,onBillingPeriodChanged:i,availableBillingPeriods:s,isCustomerOnTrial:l,onPlanSelected:a,paywallLocale:c,locale:u,shouldHidePlan:f,selectDefaultTierIndex:p,currentSubscriptionOverride:h,hideCompatibleAddons:g,showWatermark:y})=>{let C=Xa(e),b=e.some(A=>!!A.description),x=bn(e,BillingPeriod.Monthly),S=bn(e,BillingPeriod.Annually),T=ja(e,n,f),F=useCallback((A,Z,$)=>a({plan:A,customer:t,subscription:o,intentionType:Z,selectedBillingPeriod:n,billableFeatures:$}),[t,n,o,a]),w=!!o&&o.plan.pricingType===PricingType.Custom,I=useMemo(()=>T.some(A=>{var _;let Z=A.pricePoints.filter(z=>z.billingPeriod===n),$=(_=A.paywallCalculatedPricePoints)==null?void 0:_.find(z=>z.billingPeriod===n);return Z.length>1&&!!($!=null&&$.additionalChargesMayApply)}),[n,T]),k=useMemo(()=>T.some(A=>!!So(A,n,c,u,x).unit),[n,x,u,c,T]),L=useMemo(()=>!w&&T.some(A=>{let Z=bo({plan:A,billingPeriod:n,currentSubscription:o,currentSubscriptionOverride:h});return Object.values(Z).length>0}),[n,o,h,w,T]),E=T.some(A=>A.isCurrentCustomerPlan&&A.trialDaysLeft);return jsx(eg,{className:"stigg-paywall-container",children:jsxs(tg,{className:"stigg-paywall-layout",children:[jsx(Ya,{onBillingPeriodChanged:i,selectedBillingPeriod:n,availableBillingPeriods:s,discountRate:C}),jsx(ju,{className:"stigg-paywall-plans-layout",children:T.map(A=>jsx(Wa,{withUnitPriceRow:k,withTiersRow:L,withTrialLeftRow:E,shouldShowDescriptionSection:b,hasMonthlyPrice:x,hasAnnuallyPrice:S,plan:A,withStartingAtRow:I,currentSubscription:o,currentSubscriptionOverride:h,billingPeriod:n,isHighlighted:A.id===r,isCustomerOnTrial:l,onPlanSelected:(Z,$)=>F(A,Z,$),paywallLocale:c,locale:u,customer:t,isCustomerInCustomPlan:w,selectDefaultTierIndex:p,hideCompatibleAddons:g},A.id))}),jsx(q,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:y})]})})};function os(e,t,o){let r=e.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),n=ng(r),i=ig(r),s;if(o&&i.includes(o))s=o;else if(t){let l=t.find(a=>a.status===SubscriptionStatus.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(n[BillingPeriod.Monthly]||0)>(n[BillingPeriod.Annually]||0)?BillingPeriod.Monthly:BillingPeriod.Annually),{defaultBillingPeriod:s,availableBillingPeriods:i}}function rs(e){return Q.utc(e).diff(Q.utc(),"days",false)+1}var Bo={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 Ye(e,t="px"){if(e)return `${e}${t}`}function Ao(e){if(!e)return "normal";switch(e){case FontWeight.Normal:return "normal";case FontWeight.Bold:return "bold";default:return "normal"}}function Wt(e,t){var r,n,i,s,l,a,c,u;let o=t||{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:(e==null?void 0:e.fontFamily)||void 0,h1:{fontSize:Ye((r=e==null?void 0:e.h1)==null?void 0:r.fontSize)||o.h1.fontSize,fontWeight:Ao((n=e==null?void 0:e.h1)==null?void 0:n.fontWeight)||o.h1.fontWeight,semanticElement:o.h1.semanticElement},h2:{fontSize:Ye((i=e==null?void 0:e.h2)==null?void 0:i.fontSize)||o.h2.fontSize,fontWeight:Ao((s=e==null?void 0:e.h2)==null?void 0:s.fontWeight)||o.h2.fontWeight,semanticElement:o.h2.semanticElement},h3:{fontSize:Ye((l=e==null?void 0:e.h3)==null?void 0:l.fontSize)||o.h3.fontSize,fontWeight:Ao((a=e==null?void 0:e.h3)==null?void 0:a.fontWeight)||o.h3.fontWeight,semanticElement:o.h3.semanticElement},body:{fontSize:Ye((c=e==null?void 0:e.body)==null?void 0:c.fontSize)||o.body.fontSize,fontWeight:Ao((u=e==null?void 0:e.body)==null?void 0:u.fontWeight)||o.body.fontWeight,semanticElement:o.body.semanticElement}}}function kn(e){if(e)switch(e){case Alignment.Left:return "left";case Alignment.Center:return "center";case Alignment.Right:return "right";default:return}}function is(e){let{palette:t,customCss:o,typography:r}=e;return {palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.paywallBackgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,backgroundHighlight:(t==null?void 0:t.currentPlanBackground)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0}},typography:Wt(r),customCss:o||void 0}}function as(e){let{palette:t,layout:o,customCss:r,typography:n}=e;return {customCss:r||void 0,palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.backgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,backgroundHighlight:(t==null?void 0:t.currentPlanBackground)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0}},typography:Wt(n),layout:{ctaAlignment:kn(o==null?void 0:o.alignment),headerAlignment:kn(o==null?void 0:o.alignment),descriptionAlignment:kn(o==null?void 0:o.alignment),planMaxWidth:Ye(o==null?void 0:o.planWidth),planMinWidth:Ye(o==null?void 0:o.planWidth),planMargin:Ye(o==null?void 0:o.planMargin),planPadding:Ye(o==null?void 0:o.planPadding)}}}function ss(e){let{palette:t,typography:o,customCss:r}=e;return {palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.backgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0},backgroundHighlight:(t==null?void 0:t.summaryBackgroundColor)||void 0},typography:Wt(o,Bo),customCss:r||void 0}}function sg(e){let t=true,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.InTrial))||null,r=o==null?void 0:o.plan,n=o!=null&&o.trialEndDate?rs(o.trialEndDate):void 0;return r||(t=false,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.Active))||null,r=o==null?void 0:o.plan),{currentSubscription:o,currentPlan:r,isCustomerOnTrial:t,trialDaysLeft:n}}function ps(e,t,o){var T,F;let{plans:r,currency:n,configuration:i,customer:s,activeSubscriptions:l,paywallCalculatedPricePoints:a$1}=e||{},{currentSubscription:c,currentPlan:u,isCustomerOnTrial:f,trialDaysLeft:p}=sg(l),h=o==null?void 0:o({currentSubscription:c}),g=(c==null?void 0:c.scheduledUpdates)||[],y=(T=c==null?void 0:c.price)==null?void 0:T.billingPeriod,C=g.find(({subscriptionScheduleType:w})=>w===SubscriptionScheduleType.Downgrade),b$1=g.find(({subscriptionScheduleType:w})=>w===SubscriptionScheduleType.BillingPeriod),x=Yl(r,w=>w.order).map(w=>{var E;let I=(E=s==null?void 0:s.eligibleForTrial)==null?void 0:E.find(A=>A.productId===w.product.id),k=h!=null&&h.planId?(h==null?void 0:h.planId)===w.id:w.id===(u==null?void 0:u.id),L=A=>{var z;let Z=C==null?void 0:C.scheduleVariables,$=b$1==null?void 0:b$1.scheduleVariables,_=w.pricePoints.some(q=>q.billingPeriod===A);return C?((z=C.targetPackage)==null?void 0:z.refId)===w.id&&(!_||Z.billingPeriod===A):b$1&&k?$.billingPeriod===A:false};return b(a({},w),{paywallCalculatedPricePoints:a$1==null?void 0:a$1.filter(A=>A.planId===w.id),isTriable:!Po(w.defaultTrialConfig)&&(!I||I.eligible),isCurrentCustomerPlan:k,currentCustomerPlanBillingPeriod:y,isUpcomingPlan:false,trialDaysLeft:p,isNextPlan:L,paywallCurrency:n,scheduledUpdate:C||b$1})});if(r&&u){let w=u&&((F=r==null?void 0:r.find(I=>I.id===(u==null?void 0:u.id)))==null?void 0:F.order);Po(w)||(x=x.map(I=>b(a({},I),{isLowerThanCurrentPlan:w>I.order})),t&&(x=x.filter(I=>I.order>=w)));}let S=i?as(i):void 0;return {currentPlan:u,currentSubscription:c,currentSubscriptionOverride:h,isCustomerOnTrial:f,plans:x,paywallConfiguration:S}}function ms({productId:e,resourceId:t,showOnlyEligiblePlans:o,billingCountryCode:r$1,preferredBillingPeriod:n,currentSubscriptionOverrideFn:i}){let{stigg:s,locale:l}=u(),[a$1,c]=useState(BillingPeriod.Annually),[u$1,f]=useState([]),[p,h]=useState(null),[g,y]=useState(true);useEffect(()=>{d(null,null,function*(){try{y(!0),yield s.waitForInitialization();let x=yield s.getPaywall({productId:e,resourceId:t,billingCountryCode:r$1}),{availableBillingPeriods:S,defaultBillingPeriod:T}=os(x.plans,x.activeSubscriptions,n);h(x),f(S),c(T);}catch(x){r.error(`Failed to load paywall ${x==null?void 0:x.message}`,x);}finally{y(false);}});},[s,e,s.isCustomerLoaded,r$1,t,n]);let C=ps(p,o,i);return a({customer:(p==null?void 0:p.customer)||null,isLoading:g,selectedBillingPeriod:a$1,setSelectedBillingPeriod:c,availableBillingPeriods:u$1,locale:l,configuration:C.paywallConfiguration,showWatermark:s.getShowWatermark()},C)}function gs(e){return dg({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:o=>{var r;return `Start ${(r=o.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:o=>o===BillingPeriod.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:o=>o===BillingPeriod.Monthly?"/ month":"/ year",free:o=>({price:`${o==null?void 0:o.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},e)}var pg=e=>jsx("svg",b(a({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{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"})})),ys=pg;var mg=e.div`
|
|
244
244
|
display: flex;
|
|
245
245
|
flex-direction: column;
|
|
246
246
|
align-items: center;
|
|
247
|
-
`,wn=e(
|
|
247
|
+
`,wn=e(ys)`
|
|
248
248
|
margin-right: 16px;
|
|
249
249
|
`,ug=e.div`
|
|
250
250
|
display: flex;
|
|
@@ -276,7 +276,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
276
276
|
border-radius: 10px;
|
|
277
277
|
background-color: white;
|
|
278
278
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
279
|
-
`;function hg(){return jsxs(ug,{children:[jsx(Qe,{width:120,borderRadius:4}),jsx(Qe,{circle:true,width:40,height:40}),jsx(Qe,{style:{marginBottom:33},width:120,borderRadius:4}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsx(fg,{children:jsx(Qe,{height:50,borderRadius:4})})]})}function
|
|
279
|
+
`;function hg(){return jsxs(ug,{children:[jsx(Qe,{width:120,borderRadius:4}),jsx(Qe,{circle:true,width:40,height:40}),jsx(Qe,{style:{marginBottom:33},width:120,borderRadius:4}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(Bn,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsx(fg,{children:jsx(Qe,{height:50,borderRadius:4})})]})}function hs({skeletonPlanCount:e=3}){return jsxs(mg,{className:"stigg-skeleton-loader-container",children:[jsx(yg,{className:"stigg-skeleton-loader-billing-period",children:jsx(Qe,{borderRadius:4})}),jsx(gg,{className:"stigg-skeleton-loader-plans-container",children:Array.from({length:e}).map((t,o)=>jsx(hg,{},o))})]})}var ee=ii.createContext(null);ee.displayName="CustomerPortalContext";var W=()=>{let e=useContext(ee);if(!e)throw new Error("Could not find Customer portal context; You need to wrap your customer portal components in an <CustomerPortalProvider> component.");return e};function fe(e){return !!useContext(e)}var xs=({productId:e,resourceId:t,highlightedPlanId:o,showOnlyEligiblePlans:r,textOverrides:n,onPlanSelected:i,preferredBillingPeriod:s,onBillingPeriodChange:l,billingCountryCode:a,shouldHidePlan:c,selectDefaultTierIndex:u,currentSubscriptionOverride:f,hideCompatibleAddons:p,skeletonPlanCount:h=3})=>{let g=fe(ee),y=false;if(g){let{isLoading:z,resourceId:q}=W();y=z,t=q;}let{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:S,isCustomerOnTrial:T,isLoading:F,selectedBillingPeriod:w$1,setSelectedBillingPeriod:I,availableBillingPeriods:k,locale:L,configuration:E,showWatermark:A}=ms({productId:e,resourceId:t,showOnlyEligiblePlans:r,billingCountryCode:a,preferredBillingPeriod:s,currentSubscriptionOverrideFn:f}),Z=gs(n),_=!C||F||y?jsx(hs,{skeletonPlanCount:h}):jsx(ts,{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:S,selectedBillingPeriod:w$1,onBillingPeriodChanged:z=>{I(z),l&&l(z);},availableBillingPeriods:k,highlightedPlanId:o,isCustomerOnTrial:T,onPlanSelected:i,paywallLocale:Z,locale:L,shouldHidePlan:c,selectDefaultTierIndex:u,hideCompatibleAddons:p,showWatermark:A});return g?_:jsx(w,{componentTheme:E,children:_})};function bs({resourceId:e,productId:t}){let{stigg:o,customerPortalUpdatedAt:r$1}=u(),[n,i]=useState(false),[s,l]=useState();return useEffect(()=>{d(null,null,function*(){if(o.isCustomerLoaded)try{i(!0);let c=yield o.getCustomerPortal({resourceId:e,productId:t});l(c);}catch(c){r.error(`Failed to load customer portal ${c==null?void 0:c.message}`,c);}finally{i(false);}});},[o,o.isCustomerLoaded,r$1,e,t]),{customerPortal:s,showWatermark:o.getShowWatermark(),isLoading:n}}function Ss(e){return dg({manageSubscription:"Manage",usageTabTitle:"Usage",addonsTabTitle:"Add-ons",promotionsTabTitle:"Promotions",promotionsSubtitle:"You were granted access to additional functionality at no additional cost.",contactSupportTitle:"Have questions about your subscription?",contactSupportLink:"Contact support",editBilling:"Edit billing details",invoicesTitle:"Invoices",viewInvoiceHistory:"View invoice history",editPaymentDetails:"Edit",paywallSectionTitle:"Plans",cancelScheduledUpdatesButtonTitle:"Cancel"},e)}function Ts(e,t,o){var n,i,s,l;return {sectionTitleColor:(t==null?void 0:t.sectionTitleColor)||e.palette.text.secondary,planNameColor:(t==null?void 0:t.planNameColor)||e.palette.text.primary,backgroundColor:(t==null?void 0:t.backgroundColor)||((n=o==null?void 0:o.palette)==null?void 0:n.backgroundColor)||"white",borderColor:(t==null?void 0:t.borderColor)||((i=o==null?void 0:o.palette)==null?void 0:i.borderColor)||"rgba(0, 30, 108, 0.15)",listItemBackgroundColor:(t==null?void 0:t.backgroundColor)||((s=o==null?void 0:o.palette)==null?void 0:s.backgroundColor)||"white",tabMaxHeight:(t==null?void 0:t.tabMaxHeight)||"380px",iconsColor:(t==null?void 0:t.iconsColor)||((l=o==null?void 0:o.palette)==null?void 0:l.iconsColor)||void 0,iconsBackgroundColor:t==null?void 0:t.iconsBackgroundColor}}function Fo({children:e,textOverrides:t,theme:o,resourceId:r,productId:n}){let{customerPortalUpdatedAt:i}=u(),{customerPortal:s,isLoading:l,showWatermark:a}=bs({resourceId:r,productId:n}),c=s!=null&&s.configuration?is(s.configuration):void 0,u$1=v(c),f=Ts(u$1,o,s==null?void 0:s.configuration),p=Ss(t);return jsx(w,{componentTheme:c,children:jsx(ee.Provider,{value:{customerPortal:s,isLoading:l,showWatermark:a,textOverrides:p,theme:f,resourceId:r},children:e},i==null?void 0:i.toString())})}var Ke=e(Ym)`
|
|
280
280
|
border-radius: 10px;
|
|
281
281
|
padding: 8px 16px;
|
|
282
282
|
text-transform: none;
|
|
@@ -285,7 +285,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
285
285
|
&:hover {
|
|
286
286
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedRestingBorder};
|
|
287
287
|
}
|
|
288
|
-
`;var Sg=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})),
|
|
288
|
+
`;var Sg=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})),Bs=Sg;var Le=e.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
align-items: center;
|
|
291
291
|
justify-content: space-between;
|
|
@@ -295,11 +295,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
295
295
|
margin-bottom: 32px;
|
|
296
296
|
}
|
|
297
297
|
`};
|
|
298
|
-
`;function Ne({title:e,className:t,isLoading:o}){let{theme:r}=W();return o?jsx(Qe,{width:120}):jsx(f,{className:t,overrideColor:r.sectionTitleColor,variant:"h3",bold:true,children:e})}var kg=e(
|
|
298
|
+
`;function Ne({title:e,className:t,isLoading:o}){let{theme:r}=W();return o?jsx(Qe,{width:120}):jsx(f,{className:t,overrideColor:r.sectionTitleColor,variant:"h3",bold:true,children:e})}var kg=e(Bs)`
|
|
299
299
|
path {
|
|
300
300
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
301
301
|
}
|
|
302
|
-
`;function
|
|
302
|
+
`;function vs({onManageSubscription:e,hideManageButton:t,textOverrides:o}){return jsxs(Le,{className:"stigg-customer-portal-overview-header",$disableMargin:true,children:[jsx(Ne,{title:"Subscription",className:"stigg-overview-title"}),!t&&jsxs(Ke,{className:"stigg-manage-subscription-button",variant:"outlined",onClick:()=>e({intentionType:"MANAGE_SUBSCRIPTION"}),children:[jsx(kg,{className:"stigg-manage-subscription-button-image"}),jsx(f,{className:"stigg-manage-subscription-button-text",color:"primary.main",style:{marginLeft:"8px"},variant:"body1",children:o==null?void 0:o.manageSubscription})]})]})}function vo(){let{customerPortal:e}=W(),t=wg(e==null?void 0:e.subscriptions,o=>o.addons);return Bg(t)?null:jsx("div",{className:"stigg-addons-list-layout",children:t.map((o,r)=>jsxs(f,{as:"span",className:"stigg-addon-list-item-text",variant:"body1",children:[o.quantity>1&&`${o.quantity} X `,o.displayName,r===t.length-1?"":", "]},o.addonId))})}function Fg(e){return String(e.endDate)}var Es=e.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
justify-content: space-between;
|
|
305
305
|
align-items: center;
|
|
@@ -310,15 +310,15 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
310
310
|
& > *:first-of-type {
|
|
311
311
|
max-width: 60%;
|
|
312
312
|
}
|
|
313
|
-
`;function vg(e){var n;let{displayName:t,usageLimit:o,hasUnlimitedUsage:r}=e;return r?`Unlimited ${t}`:o?`${t} x ${(n=e.usageLimit)==null?void 0:n.toLocaleString()}`:t}function Lo(){let{customerPortal:e,textOverrides:t,theme:o}=W(),r=e==null?void 0:e.promotionalEntitlements;return jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsx(f,{color:"secondary",children:t.promotionsSubtitle}),jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxs(
|
|
313
|
+
`;function vg(e){var n;let{displayName:t,usageLimit:o,hasUnlimitedUsage:r}=e;return r?`Unlimited ${t}`:o?`${t} x ${(n=e.usageLimit)==null?void 0:n.toLocaleString()}`:t}function Lo(){let{customerPortal:e,textOverrides:t,theme:o}=W(),r=e==null?void 0:e.promotionalEntitlements;return jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsx(f,{color:"secondary",children:t.promotionsSubtitle}),jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxs(Es,{$borderColor:o.borderColor,children:[jsx(f,{variant:"body1",bold:true,children:"Feature"}),jsx(f,{variant:"body1",bold:true,children:"Expiration date"})]}),r==null?void 0:r.map((n,i)=>jsxs(Es,{$borderColor:o.borderColor,children:[jsx(f,{variant:"body1",children:vg(n)}),jsx(f,{variant:"body1",color:"disabled",children:n.endDate?Q.utc(Fg(n)).format("MMM Do, YYYY"):"None"})]},`${n.displayName}-${i}`))]})]})}var Ls=e(Lg)`
|
|
314
314
|
.MuiTabs-indicator {
|
|
315
315
|
background-color: #001e6c;
|
|
316
316
|
}
|
|
317
|
-
`,
|
|
317
|
+
`,Ns=e.div`
|
|
318
318
|
width: 100%;
|
|
319
319
|
flex: 1;
|
|
320
320
|
margin-top: 16px;
|
|
321
|
-
`,
|
|
321
|
+
`,Ms=e(ke,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
322
322
|
margin-top: 16px;
|
|
323
323
|
max-height: ${({$maxHeight:e})=>e};
|
|
324
324
|
overflow-y: auto;
|
|
@@ -331,7 +331,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
331
331
|
margin-bottom: 16px;
|
|
332
332
|
row-gap: 16px;
|
|
333
333
|
background-color: ${({$backgroundColor:e})=>e};
|
|
334
|
-
`;function
|
|
334
|
+
`;function Us(e){let s=e,{children:t,value:o,index:r,maxHeight:n}=s,i=c(s,["children","value","index","maxHeight"]);return jsx("div",b(a({role:"tabpanel",hidden:o!==r},i),{children:o===r&&jsx(Ms,{$maxHeight:n,children:t})}))}function _s({isSelected:e,label:t,icon:o}){let r=e?"primary":"secondary";return jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[jsx(i,{icon:o,svgStrokeColor:r}),jsx(f,{variant:"h6",bold:e,color:r,children:t})]})}function Ds({customerPortal:e,hiddenSections:t,textOverrides:o,theme:r}){let n=wg(e.subscriptions,p=>p.addons),i=p=>t==null?void 0:t.some(h=>h===p),s=n.length>0&&!i("addons"),l=e.promotionalEntitlements.length>0&&!i("promotionalEntitlements"),[a,c]=useState(s?1:2),u=(p,h)=>{c(h);};return s||l?jsxs(Ns,{children:[jsx(ke,{sx:{borderBottom:1,borderColor:"divider"},children:jsxs(Ls,{value:a,onChange:u,children:[s?jsx(Rs,{sx:{textTransform:"none"},value:1,label:jsx(_s,{isSelected:a===1,label:o.addonsTabTitle,icon:"Addons"})}):null,l?jsx(Rs,{sx:{textTransform:"none"},value:2,label:jsx(_s,{isSelected:a===2,label:o.promotionsTabTitle,icon:"Promotions"})}):null]})}),jsx(Us,{value:a,index:1,maxHeight:r.tabMaxHeight,children:jsx(vo,{})}),jsx(Us,{value:a,index:2,maxHeight:r.tabMaxHeight,children:jsx(Lo,{})})]}):null}var $s={xs:320,sm:640,md:768,lg:1024,xl:1280,xxl:1536},vn=e=>`(min-width: ${$s[e]}px)`,oe=Object.keys($s).reduce((e,t)=>b(a({},e),{[t]:`@media ${vn(t)}`}),{});function de(e){return Ug(vn(e))}var _g=e.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
justify-content: space-between;
|
|
337
337
|
flex-wrap: wrap;
|
|
@@ -339,7 +339,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
339
339
|
display: flex;
|
|
340
340
|
flex-direction: column;
|
|
341
341
|
gap: 32px;
|
|
342
|
-
`;function
|
|
342
|
+
`;function zs(){let e=de("md");return jsxs(_g,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxs(Dg,{children:[jsx(Qe,{width:120}),jsx(Qe,{width:120})]}),jsx(Qe,{width:e?295:260,height:193})]})}function Gg({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxs(Me,{container:true,alignItems:"center",children:[jsx(Me,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Me,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Downgrade to the ",jsx("b",{children:t==null?void 0:t.displayName})," plan"]})})]})}function zg({scheduleUpdate:e}){let{scheduleVariables:t}=e,{billingPeriod:o}=t,r=o===BillingPeriod.Monthly?"annually":"monthly",n=o===BillingPeriod.Monthly?"monthly":"annually";return jsxs(Me,{container:true,alignItems:"center",children:[jsx(Me,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Me,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Change from an ",r," to a ",jsx("b",{children:n})," billing cycle"]})})]})}function Vg({subscription:e,scheduleUpdate:t}){let{scheduleVariables:o}=t,{newUnitAmount:r,featureId:n}=o,s=ic(e.prices.map(({feature:u})=>u)).find(u=>u.id===n);if(!s)return null;let{featureUnits:l,featureUnitsPlural:a}=s;return jsxs(Me,{container:true,alignItems:"flex-start",flexWrap:"nowrap",children:[jsx(Me,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Me,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Reduce the ",jsx("b",{children:l})," quantity to ",r," ",r===1?l:a]})})]})}function Hs({scheduleUpdate:e,subscription:t}){switch(e.subscriptionScheduleType){case SubscriptionScheduleType.Downgrade:return jsx(Gg,{scheduleUpdate:e});case SubscriptionScheduleType.BillingPeriod:return jsx(zg,{scheduleUpdate:e});case SubscriptionScheduleType.UnitAmount:return jsx(Vg,{scheduleUpdate:e,subscription:t});default:return null}}var Yg=e(ke)`
|
|
343
343
|
border-bottom: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
344
344
|
border-top-left-radius: 10px;
|
|
345
345
|
border-top-right-radius: 10px;
|
|
@@ -352,7 +352,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
352
352
|
path {
|
|
353
353
|
fill: ${({theme:e})=>e.stigg.palette.primary};
|
|
354
354
|
}
|
|
355
|
-
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxs(Fragment,{children:[jsx(Me,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Me,{children:jsx(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:"The following updates will take effect in the next billing cycle:"})})}),jsx(Me,{children:(t||[]).map(o=>jsx(
|
|
355
|
+
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxs(Fragment,{children:[jsx(Me,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Me,{children:jsx(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:"The following updates will take effect in the next billing cycle:"})})}),jsx(Me,{children:(t||[]).map(o=>jsx(Hs,{scheduleUpdate:o,subscription:e},o.subscriptionScheduleType))})]})}function Jg({subscription:e}){let{scheduledUpdates:t}=e,[o]=t||[],{line1:r,line2:n}=xo({scheduledUpdate:o,subscriptionPrices:e.prices,billingPeriodRange:e.billingPeriodRange,options:{postfix:"at the end of the current billing period"}});return jsxs(Fragment,{children:[jsx(Me,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Me,{children:jsx(f,{className:"stigg-scheduled-updates-title",variant:"body1",color:"primary",children:r})})}),n&&jsx(Me,{children:jsx(f,{className:"stigg-scheduled-updates-subtitle",variant:"body1",color:"secondary",children:n})})]})}function Os({subscription:e,onCancelScheduledUpdates:t,theme:o,cancelScheduledUpdatesButtonTitle:r}){let n=useTheme(),[i$1,s]=useState(false),{scheduledUpdates:l}=e;if(!l||l.length===0)return null;let a=l.length===1;return jsx(Yg,{$borderColor:o.borderColor,className:"stigg-scheduled-updates-alert-container",children:jsxs(Me,{container:true,alignItems:a?"center":"flex-start",gap:2,children:[jsx(Me,{item:true,display:"flex",children:jsx(i,{icon:"ScheduleBox",svgPathColor:o.iconsColor,svgRectColor:o.iconsBackgroundColor})}),jsx(Me,{item:true,flex:1,children:a?jsx(Jg,{subscription:e}):jsx(qg,{subscription:e})}),!!t&&jsx(Me,{item:true,children:jsxs(Ke,{variant:"outlined",onClick:()=>{s(true),Promise.resolve(t(e)).finally(()=>s(false));},children:[i$1?jsx(Qg,{loading:true,size:16,color:n.stigg.palette.text.disabled}):jsx(Kg,{style:{display:"flex",marginRight:4},className:"stigg-scheduled-updates-cancel-update-button-icon"}),jsx(f,{variant:"body1",color:"primary.main",className:"stigg-scheduled-updates-cancel-update-button",children:r})]})})]})})}var Re=e.div`
|
|
356
356
|
width: 100%;
|
|
357
357
|
display: flex;
|
|
358
358
|
flex-direction: column;
|
|
@@ -370,7 +370,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
370
370
|
${oe.lg} {
|
|
371
371
|
padding: 64px;
|
|
372
372
|
}
|
|
373
|
-
`;function
|
|
373
|
+
`;function Ys({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",children:"Next estimated bill"}),jsx(f,{variant:"h1",children:H({amount:o,currency:r,maximumFractionDigits:2})}),jsxs(f,{as:"div",variant:"body1",color:"secondary",children:["Billed ",e===BillingPeriod.Monthly?"monthly":"annually"," on"," ",jsx(f,{variant:"body1",as:"span",color:"primary",children:Q.utc(t).format("MMM Do, YYYY")})]}),jsx(f,{variant:"body1",color:"secondary",children:"* Additional tax rates may apply"})]})}function Ro({description:e}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",color:"secondary",children:"No upcoming bill"}),jsx(f,{variant:"body1",color:"secondary",children:e})]})}var rf=e.div`
|
|
374
374
|
display: flex;
|
|
375
375
|
flex-direction: column;
|
|
376
376
|
align-items: left;
|
|
@@ -383,7 +383,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
383
383
|
background: none;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
`;function
|
|
386
|
+
`;function Ks({onContactSupport:e,label:t,linkLabel:o}){let r=jsx(f,{color:e?"primary.main":"secondary",children:o});return jsxs(rf,{className:"stigg-contact-support-layout",children:[jsx(f,{className:"stigg-contact-support-label",color:"secondary",children:t}),e?jsx(nf,{className:"stigg-contact-support-button",style:{textTransform:"none"},variant:"text",onClick:e,children:r}):r]})}var df=e.div`
|
|
387
387
|
max-height: 278px;
|
|
388
388
|
display: flex;
|
|
389
389
|
flex-direction: column;
|
|
@@ -392,7 +392,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
392
392
|
border: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
393
393
|
padding: 32px;
|
|
394
394
|
gap: 16px;
|
|
395
|
-
`;function
|
|
395
|
+
`;function qs({subscription:e,theme:t,textOverrides:o,onContactSupport:r}){var a,c,u,f,p,h,g;let{pricingType:n}=e,i,s=(c=(a=e.prices)==null?void 0:a.every(y=>y.billingModel!==BillingModel.UsageBased))!=null?c:true,l=(u=e.scheduledUpdates)==null?void 0:u.find(({subscriptionScheduleType:y,targetPackage:C})=>y===SubscriptionScheduleType.Downgrade&&(C==null?void 0:C.pricingType)===PricingType.Free);if(n===PricingType.Free)i=jsx(Ro,{description:"You're on a free plan, so you don\u2019t have any upcoming charges"});else if(n===PricingType.Paid)if(l&&s)i=jsx(Ro,{description:"Your plan will be downgraded to a free plan, so you don\u2019t have any upcoming charges"});else if(e.status===SubscriptionStatus.InTrial)i=jsx(Ro,{description:`You\u2019re on a free trial of the ${e.planName} plan, so you don\u2019t have any upcoming charges`});else {let y=(p=(f=e.prices)==null?void 0:f[0])==null?void 0:p.billingPeriod,C=(h=e.billingPeriodRange)==null?void 0:h.end,b=(g=e.totalPrice)==null?void 0:g.total;y&&C&&b&&(i=jsx(Ys,{billingPeriod:y,rangeEnd:C,amount:b.amount,currency:b.currency}));}else n===PricingType.Custom&&(i=jsx(Ks,{onContactSupport:r,label:o.contactSupportTitle,linkLabel:o.contactSupportLink}));return jsx(df,{className:"stigg-subscription-total-price-layout",$borderColor:t.borderColor,children:i})}var pf=e=>jsxs("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[jsx("path",{d:"M12.9469 13.5999H11.9344L11.935 10.7756C11.935 10.6288 11.87 10.4819 11.7557 10.3838L8.62061 7.91816L11.755 5.4532C11.8694 5.35507 11.9344 5.22444 11.9344 5.06132L11.935 2.40004H12.9475C13.225 2.40004 13.4375 2.18755 13.4375 1.91004C13.4375 1.63254 13.225 1.42004 12.9475 1.42004L3.05311 1.42067C2.77561 1.42067 2.56311 1.63316 2.56311 1.91067C2.56311 2.18817 2.77561 2.40067 3.05311 2.40067H4.06561L4.06498 5.06131C4.06498 5.20818 4.12998 5.35505 4.24436 5.45318L7.36244 7.91814L4.245 10.3837C4.13062 10.4819 4.06562 10.6125 4.06562 10.7756V13.5999H3.05313C2.77562 13.5999 2.56313 13.8124 2.56313 14.0899C2.56313 14.3674 2.77562 14.5799 3.05313 14.5799H12.9469C13.2244 14.5799 13.4369 14.3674 13.4369 14.0899C13.4369 13.8124 13.2244 13.5999 12.9469 13.5999ZM5.04498 2.39995H10.9551V4.81627L8.00002 7.16747L5.04498 4.81627V2.39995ZM5.04498 11.0206L8.00002 8.66939L10.9551 11.0044V13.5838H5.04498V11.0206Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.05303 1.25404L12.9474 1.25342C13.317 1.25342 13.6041 1.54053 13.6041 1.91008C13.6041 2.27964 13.317 2.56675 12.9474 2.56675H12.1016L12.101 5.06136V5.06136C12.101 5.2747 12.0135 5.45101 11.8635 5.57973L11.8581 5.58436L8.89014 7.9182L11.8642 10.2572C12.0164 10.3878 12.1016 10.5814 12.1016 10.7757L12.101 13.4333H12.9468C13.3164 13.4333 13.6035 13.7204 13.6035 14.09C13.6035 14.4595 13.3164 14.7466 12.9468 14.7466H3.05304C2.68349 14.7466 2.39638 14.4595 2.39638 14.09C2.39638 13.7204 2.68349 13.4333 3.05304 13.4333H3.89887V10.7757C3.89887 10.5623 3.98635 10.386 4.13639 10.2573L4.14144 10.253L7.09365 7.91821L4.13566 5.57982C3.98346 5.44923 3.89823 5.25562 3.89823 5.06135L3.89882 2.56738H3.05303C2.68348 2.56738 2.39636 2.28026 2.39636 1.91071C2.39636 1.54116 2.68348 1.25405 3.05303 1.25404V1.25404ZM12.9474 1.58675L3.05304 1.58738C2.86758 1.58738 2.7297 1.72525 2.7297 1.91071C2.7297 2.09617 2.86757 2.23404 3.05303 2.23404H4.23223L4.23157 5.06135V5.06135C4.23158 5.15983 4.27538 5.25908 4.35053 5.32476L7.63107 7.91815L4.35113 10.5123C4.2739 10.5795 4.23221 10.6639 4.23221 10.7757V13.7666H3.05304C2.86759 13.7666 2.72971 13.9045 2.72971 14.09C2.72971 14.2754 2.86759 14.4133 3.05304 14.4133H12.9468C13.1323 14.4133 13.2701 14.2754 13.2701 14.09C13.2701 13.9045 13.1323 13.7667 12.9468 13.7667H11.7676L11.7683 10.7757V10.7757C11.7683 10.6772 11.7245 10.5781 11.6495 10.5124L8.35092 7.91819L11.6489 5.32461C11.726 5.25743 11.7676 5.17306 11.7676 5.06136L11.7683 2.23342H12.9474C13.1329 2.23342 13.2708 2.09554 13.2708 1.91008C13.2708 1.72463 13.1329 1.58676 12.9474 1.58675V1.58675ZM4.87823 2.23332H11.1216V4.89669L7.99994 7.3805L4.87823 4.89669V2.23332ZM5.21157 2.56666V4.73593L7.99994 6.95452L10.7883 4.73593V2.56666H5.21157ZM7.99958 8.45673L11.1216 10.9237V13.7505H4.87823V10.9403L7.99958 8.45673ZM8.0003 8.88213L5.21157 11.101V13.4172H10.7883V11.0852L8.0003 8.88213Z",fill:"white"})]})),Xs=pf;var Ve=e(n=>{var i=n,{children:e,className:t,placement:o="top"}=i,r=c(i,["children","className","placement"]);return jsx(uf,b(a({arrow:true,placement:o},r),{classes:{popper:t,tooltip:"stigg-tooltip",arrow:"stigg-tooltip-arrow"},children:jsx("div",{children:e})}))})(({theme:e,$padding:t=8,$maxWidth:o=300})=>({[`& .${tooltipClasses.tooltip}`]:{backgroundColor:e.stigg.palette.white,maxWidth:o,boxShadow:e.stigg.shadows.popover,padding:t,borderRadius:e.stigg.border.radius,color:e.stigg.palette.text.primary},[`& .${tooltipClasses.arrow}`]:{color:e.stigg.palette.white}}));var hf=e(f)`
|
|
396
396
|
display: ${({$display:e})=>e};
|
|
397
397
|
-webkit-line-clamp: ${({$maxLines:e})=>e};
|
|
398
398
|
-webkit-box-orient: vertical;
|
|
@@ -406,7 +406,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
406
406
|
${({$bold:e})=>e&&css`
|
|
407
407
|
font-weight: bold;
|
|
408
408
|
`}
|
|
409
|
-
`;function
|
|
409
|
+
`;function ol(e){return e&&(e.clientHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)}var Ae=({leaveDelay:e,children:t,variant:o,color:r,maxLines:n=1,wordBreak:i,bold:s,tooltipPlacement:l="top",className:a,display:c="-webkit-box",style:u,"data-testid":f$1})=>{let[p,h]=useState(false),g=useRef(null),y=jsx(hf,{ref:g,variant:o,color:r,$maxLines:n,$wordBreak:i,$bold:s,className:a,$display:c,style:u,"data-testid":f$1,children:t});useEffect(()=>{if(g!=null&&g.current){let b=ol(g.current);h(b);}},[g]);let C=(g==null?void 0:g.current)&&ol(g.current);return jsx("span",{children:p||C?jsx(Ve,{placement:l,leaveDelay:e,title:jsx(f,{variant:"body1",children:t}),children:y}):y})};var Pf=e.div`
|
|
410
410
|
width: 100%;
|
|
411
411
|
display: flex;
|
|
412
412
|
align-items: center;
|
|
@@ -419,28 +419,28 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
419
419
|
text-decoration-color: white;
|
|
420
420
|
color: white;
|
|
421
421
|
cursor: pointer;
|
|
422
|
-
`;function
|
|
422
|
+
`;function nl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==SubscriptionStatus.InTrial?null:jsxs(Pf,{className:"stigg-subscription-trial-badge",children:[jsx(Xs,{className:"stigg-subscription-trial-badge-image"}),jsx("div",{style:{flex:1,marginRight:4},children:jsxs(Ae,{variant:"body1",className:"stigg-subscription-trial-badge-text",color:"white",children:[`${e.trialRemainingDays} days remaining in trial`,t&&` of the ${e.planName} plan`]})}),jsx(bf,{className:"stigg-subscription-trial-upgrade-button",onClick:()=>o({intentionType:"UPGRADE_TRIAL_PLAN"}),children:jsx(f,{color:"white",children:"Upgrade plan"})})]})}function al({mainSubscription:e,trialSubscription:t,onManageSubscription:o,theme:r}){return jsxs("div",{className:"stigg-subscription-view-layout",children:[jsxs(f,{className:"stigg-subscription-plan-name",variant:"h1",overrideColor:r.planNameColor,style:{marginTop:8},children:[e.planName," plan"]}),jsx(nl,{subscription:t,includePlanName:(t==null?void 0:t.planName)!==e.planName,onManageSubscription:o})]})}var Un=70;function qe(e,t){return t===0?0:Math.min(Math.floor(e/t*100),100)}function sl(e){let t;return e<Un?t="standard":e<100?t="warning":t="error",t}function Tf(e){return String(e.usagePeriodEnd)}function ll(e){if(!e.resetPeriod||!e.usagePeriodEnd)return null;let t=Tf(e),o=r=>Q.utc(t).diff(Q.utc(),r);switch(e.resetPeriod){case EntitlementResetPeriod.Month:return `Resets monthly - in ${o("days")} days`;case EntitlementResetPeriod.Week:return `Resets weekly - in ${o("days")} days`;case EntitlementResetPeriod.Day:return `Resets daily - in ${o("hours")} hours`;case EntitlementResetPeriod.Hour:return `Resets hourly - in ${o("minutes")} minutes`;default:return null}}var Bf=e(kf,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
423
423
|
height: 4px;
|
|
424
424
|
background-color: ${({theme:e})=>bi(e.stigg.palette.primary).alpha(.4).string()};
|
|
425
425
|
|
|
426
426
|
span {
|
|
427
427
|
background-color: ${({$progressStatus:e,theme:t})=>{switch(e){case "standard":return t.stigg.palette.primary;case "warning":return t.stigg.palette.warning;case "error":return t.stigg.palette.error;default:return t.stigg.palette.primary}}};
|
|
428
428
|
}
|
|
429
|
-
`;function Go({currentUsage:e,usageLimit:t,classNamePrefix:o="stigg-usage-progress-bar"}){let r=qe(e,t),n=
|
|
429
|
+
`;function Go({currentUsage:e,usageLimit:t,classNamePrefix:o="stigg-usage-progress-bar"}){let r=qe(e,t),n=sl(r);return jsx(Bf,{$progressStatus:n,className:`${o} ${o}-${n}`,variant:"determinate",value:r})}var vf=e(Cl)`
|
|
430
430
|
border-style: dotted;
|
|
431
431
|
border-bottom-width: 2px;
|
|
432
432
|
border-color: ${({theme:e})=>bi(e.stigg.palette.outlinedRestingBorder).alpha(.4).string()};
|
|
433
|
-
`;function zo({entitlement:e}){return e.hasUnlimitedUsage?jsx(vf,{}):jsx(Go,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var
|
|
433
|
+
`;function zo({entitlement:e}){return e.hasUnlimitedUsage?jsx(vf,{}):jsx(Go,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var dl=e(Ym)`
|
|
434
434
|
text-transform: none;
|
|
435
435
|
padding: 0;
|
|
436
436
|
white-space: nowrap;
|
|
437
|
-
`;function Ho({featureEntitlement:e,feature:t,onManageSubscription:o,onBuyMore:r,canBuyMore:n,canUpgradeSubscription:i,hasCustomSubscription:s}){return s||e.hasUnlimitedUsage||qe(e.currentUsage||0,e.usageLimit)<Un?null:n?r?jsx(
|
|
437
|
+
`;function Ho({featureEntitlement:e,feature:t,onManageSubscription:o,onBuyMore:r,canBuyMore:n,canUpgradeSubscription:i,hasCustomSubscription:s}){return s||e.hasUnlimitedUsage||qe(e.currentUsage||0,e.usageLimit)<Un?null:n?r?jsx(dl,{variant:"text",onClick:()=>r(t,e),children:jsx(f,{color:"primary.main",children:"Buy more"})}):null:i&&o?jsx(dl,{variant:"text",onClick:()=>o({intentionType:"UPGRADE_PLAN"}),children:jsx(f,{color:"primary.main",children:"Upgrade"})}):null}function pl({amount:e,currency:t,blockSize:o,featureEntitlement:r,feature:n,hideChargePrice:i,onBuyMore:s,onManageSubscription:l,canUpgradeSubscription:a,hasCustomSubscription:c}){var u,f$1,p;return jsxs("div",{className:`stigg-charge-list-item stigg-charge-list-item-${r.feature.refId}`,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[jsxs("div",{style:{display:"flex",gap:12},children:[jsx(Ae,{variant:"body1",color:"primary",children:n.displayName}),!i&&jsxs(Ae,{variant:"body1",color:"secondary",children:[H({amount:e,currency:t})," per ",o?`${o} `:"",o?n.featureUnitsPlural:n.featureUnits]})]}),jsxs("div",{style:{display:"flex",gap:12},children:[jsx(Ho,{featureEntitlement:r,feature:n,canBuyMore:true,onBuyMore:s,onManageSubscription:l,canUpgradeSubscription:a,hasCustomSubscription:c}),jsx(f,{variant:"body1",color:"primary",style:{whiteSpace:"nowrap"},children:r.hasUnlimitedUsage?(u=r.currentUsage)==null?void 0:u.toLocaleString():`${(f$1=r.currentUsage)==null?void 0:f$1.toLocaleString()} of ${(p=r.usageLimit)==null?void 0:p.toLocaleString()}`})]})]}),jsx(zo,{entitlement:r})]})}function ul({subscription:e,entitlements:t,onBuyMore:o,onManageSubscription:r,hasCustomSubscription:n,canUpgradeSubscription:i}){let s=wl(t,"feature.refId"),l=e.prices.filter(({feature:a,price:c})=>!!a&&s[a.refId]&&!!c);return l.length?jsx("div",{className:"stigg-charge-list",style:{display:"flex",flexDirection:"column",gap:16,marginTop:32},children:l.map(({feature:a,price:c,blockSize:u,billingModel:f})=>{if(!a||!c)return null;let p=s[a.refId];return !p||!p.feature?null:jsx(pl,{featureEntitlement:p,feature:p.feature,amount:c.amount,blockSize:u,currency:c.currency,hideChargePrice:f===BillingModel.PerUnit,onBuyMore:o,onManageSubscription:r,canUpgradeSubscription:i,hasCustomSubscription:n},a.refId)})}):null}function bt(e){return e.__typename==="FeatureEntitlement"}function Wo(e){return e.__typename==="CreditEntitlement"}function Zo({onManageSubscription:e,onBuyMore:t,onCancelScheduledUpdates:o,onContactSupport:r,hiddenSections:n,cancelScheduledUpdatesButtonTitle:i}){let{customerPortal:s,isLoading:l,textOverrides:a,theme:c}=W(),u=l||!s,{subscriptions:f,entitlementsV2:p,canUpgradeSubscription:h}=s||{},g=useMemo(()=>p?p.filter(bt):[],[p]),y=f==null?void 0:f.find(({status:S})=>S===SubscriptionStatus.Active),C=f==null?void 0:f.find(({status:S})=>S===SubscriptionStatus.InTrial),b=(y==null?void 0:y.pricingType)===PricingType.Custom,x=y||C;return jsxs(Re,{className:"stigg-customer-portal-subscriptions-overview",$backgroundColor:c.backgroundColor,$borderColor:c.borderColor,children:[!u&&y&&y.scheduledUpdates&&jsx(Os,{theme:c,subscription:y,onCancelScheduledUpdates:o,cancelScheduledUpdatesButtonTitle:i}),u||!x?jsx(zs,{}):jsxs("div",{className:"stigg-overview-layout",style:{display:"flex",alignItems:"flex-start",gap:64,flexWrap:"wrap"},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[jsx(vs,{onManageSubscription:e,hideManageButton:b,textOverrides:a}),jsx(al,{mainSubscription:x,trialSubscription:C,theme:c,onManageSubscription:e}),y&&g.length>0&&jsx(ul,{subscription:y,entitlements:g,onBuyMore:t,onManageSubscription:e,canUpgradeSubscription:!!h,hasCustomSubscription:b}),jsx(Ds,{customerPortal:s,hiddenSections:n,textOverrides:a,theme:c})]}),jsx("div",{style:{display:"flex",flexDirection:"column",width:319,gap:24},children:jsx(qs,{subscription:x,theme:c,onContactSupport:r,textOverrides:a})})]})]})}var Uf=e.div`
|
|
438
438
|
display: flex;
|
|
439
439
|
width: 100%;
|
|
440
440
|
align-items: flex-end;
|
|
441
441
|
justify-content: flex-end;
|
|
442
442
|
margin-bottom: 24px;
|
|
443
|
-
`;function
|
|
443
|
+
`;function yl({showWatermark:e}){return jsx(Uf,{className:"stigg-customer-portal-header-layout",children:jsx(q,{source:"customer_portal",showWatermark:e})})}var Df=e(f)`
|
|
444
444
|
text-transform: none;
|
|
445
445
|
`,$f=e(ExternalLink)`
|
|
446
446
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
@@ -456,7 +456,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
456
456
|
gap: 16px;
|
|
457
457
|
align-self: stretch;
|
|
458
458
|
flex-wrap: wrap;
|
|
459
|
-
`;function Gn({title:e,rows:t}){return jsxs(Qo,{children:[jsx(f,{variant:"h6",color:"secondary",bold:true,children:e}),t.map(({classNamePrefix:o,label:r,value:n,labelTypographyProps:i,valueTypographyProps:s})=>jsxs(Gf,{children:[jsx(f,b(a({className:`${o}-label`,variant:"body1",color:"secondary",style:{width:80}},i),{children:r})),jsx(f,b(a({className:`${o}-text`,variant:"body1",color:"secondary"},s),{children:n}))]},r))]})}function Ko(){return jsx(Qe,{width:220,height:42})}var
|
|
459
|
+
`;function Gn({title:e,rows:t}){return jsxs(Qo,{children:[jsx(f,{variant:"h6",color:"secondary",bold:true,children:e}),t.map(({classNamePrefix:o,label:r,value:n,labelTypographyProps:i,valueTypographyProps:s})=>jsxs(Gf,{children:[jsx(f,b(a({className:`${o}-label`,variant:"body1",color:"secondary",style:{width:80}},i),{children:r})),jsx(f,b(a({className:`${o}-text`,variant:"body1",color:"secondary"},s),{children:n}))]},r))]})}function Ko(){return jsx(Qe,{width:220,height:42})}var xl="-";function Jo(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=de("md"),{billingInformation:i}=e||{},s=!i||t,l=[];if(s?l.push(jsxs(Qo,{children:[jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12})]},"information-loading-data-top"),jsx(Cl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-loading-data-divider"),jsxs(Qo,{children:[jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12})]},"information-loading-data-bottom")):(l.push(jsx(Gn,{title:"Billed to",rows:[{classNamePrefix:"stigg-customer-name",label:"Name",value:(i==null?void 0:i.name)||xl,valueTypographyProps:i!=null&&i.name?{}:{color:"disabled"}},{classNamePrefix:"stigg-customer-email",label:"Email",value:(i==null?void 0:i.email)||xl,valueTypographyProps:i!=null&&i.email?{}:{color:"disabled"}}]},"information-billing-data-billed-to")),i!=null&&i.defaultPaymentMethodId&&i.defaultPaymentMethodLast4Digits&&i.defaultPaymentExpirationMonth&&i.defaultPaymentExpirationYear&&(l.unshift(jsx(Cl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-billing-data-divider")),l.unshift(jsx(Gn,{title:"Payment method",rows:[{classNamePrefix:"stigg-credit-card",label:"Card",value:`Ending in ${i.defaultPaymentMethodLast4Digits}`},{classNamePrefix:"stigg-credit-card-expiration",label:"Expires",value:`${Hf(i.defaultPaymentExpirationMonth.toString(),2,"0")}/${i.defaultPaymentExpirationYear}`}]},"information-billing-data-payment-method")))),!s&&!(i!=null&&i.name)&&!(i!=null&&i.email)&&!(i!=null&&i.defaultPaymentMethodId))return null;let a=s?jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsx(Yo,{url:e.billingPortalUrl,text:o.editPaymentDetails,className:"stigg-edit-payment-details-button"}):null;return jsxs(Re,{className:"stigg-payment-details-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:[jsxs(Le,{className:"stigg-payment-details-section-header",children:[jsx(Ne,{isLoading:s,className:"stigg-payment-details-section-title",title:"Payment details"}),a]}),jsx("div",{style:{display:"flex",alignItems:"stretch",gap:n?64:32,flexWrap:"wrap"},children:l})]})}var Pl=e(Re)`
|
|
460
460
|
position: relative;
|
|
461
461
|
|
|
462
462
|
.stigg-paywall-layout {
|
|
@@ -481,7 +481,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
481
481
|
.${p} {
|
|
482
482
|
display: none;
|
|
483
483
|
}
|
|
484
|
-
`;var zn=forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxs(
|
|
484
|
+
`;var zn=forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxs(Pl,{className:"stigg-customer-portal-paywall-section",ref:n,$backgroundColor:t.backgroundColor,$borderColor:t.borderColor,children:[jsx(Le,{className:"stigg-customer-portal-paywall-header",children:jsx(Ne,{isLoading:r,className:"stigg-customer-portal-paywall-section-title",title:o})}),e]}):null);zn.displayName="CustomerPortalPaywall";var Sl=e.div`
|
|
485
485
|
width: 100%;
|
|
486
486
|
display: flex;
|
|
487
487
|
flex-direction: column;
|
|
@@ -490,13 +490,13 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
490
490
|
& * {
|
|
491
491
|
box-sizing: border-box;
|
|
492
492
|
}
|
|
493
|
-
`,
|
|
493
|
+
`,Tl=e.div`
|
|
494
494
|
width: 100%;
|
|
495
495
|
display: flex;
|
|
496
496
|
flex-direction: column;
|
|
497
497
|
align-items: center;
|
|
498
498
|
row-gap: 24px;
|
|
499
|
-
`;var
|
|
499
|
+
`;var Bl=6;function Il({featureEntitlements:e,creditEntitlements:t,showAll:o}){let r=e.length+t.length,n=o?r:Math.min(r,Bl),i=e.slice(0,n),s=n-i.length,l=t.slice(0,Math.max(0,s)),a=r>Bl;return {entitlementsToShow:i,creditsToShow:l,totalItemsCount:r,showMoreVisible:a}}function Yf(e){var t,o;return ((t=e.feature)==null?void 0:t.meterType)===MeterType.Fluctuating||((o=e.feature)==null?void 0:o.meterType)===MeterType.Incremental}function Fl(e,t){return t?e>2?4:6:12}function Al(e){let t=[],o=[];for(let r of e)bt(r)?t.push(r):Wo(r)&&o.push(r);return {feature:t,credit:o}}function vl({packageEntitlements:e,activeSubscription:t,filterEntitlements:o,filterPackageEntitlements:r}){var x,S;let{feature:n,credit:i}=Al(e!=null?e:[]),s=n.filter(Yf),l=wl((x=t==null?void 0:t.prices)!=null?x:[],"feature.refId"),a=wl(s,"feature.refId"),c=((S=t==null?void 0:t.prices)!=null?S:[]).map(T=>T.feature?a[T.feature.refId]:void 0).filter(T=>!!T),u=s.filter(T=>T.feature&&!l[T.feature.refId]),f=[...c,...u].filter(T=>T.usageLimit!==0),p=i.filter(T=>{var F;return ((F=T.usageLimit)!=null?F:0)>0}),h=[...f,...p],g=r?r({entitlements:h}).entitlements:[...o?o(f):f,...p],{feature:y,credit:C}=Al(g),b=(t==null?void 0:t.pricingType)===PricingType.Custom;return {subscriptionPriceByFeature:l,filteredFeatureEntitlements:y,filteredCreditEntitlements:C,hasCustomSubscription:b}}function El({filterEntitlements:e,filterPackageEntitlements:t}){let[o,r]=useState(false),n=de("md"),{customerPortal:i,isLoading:s}=W(),l=useMemo(()=>{var I;let F=i==null?void 0:i.entitlementsV2,w=(I=i==null?void 0:i.subscriptions)==null?void 0:I.find(k=>k.status===SubscriptionStatus.Active);return vl({packageEntitlements:F,activeSubscription:w,filterEntitlements:e,filterPackageEntitlements:t})},[i==null?void 0:i.entitlementsV2,i==null?void 0:i.subscriptions,e,t]),{subscriptionPriceByFeature:a,filteredFeatureEntitlements:c,filteredCreditEntitlements:u,hasCustomSubscription:f}=l,p=s||!i,h=!!(i!=null&&i.canUpgradeSubscription),{entitlementsToShow:g,creditsToShow:y,totalItemsCount:C,showMoreVisible:b}=Il({featureEntitlements:c,creditEntitlements:u,showAll:o}),x=Fl(C,n),S=()=>r(F=>!F),T=!p&&c.length===0&&u.length===0;return {isLoadingData:p,entitlementsToShow:g,creditsToShow:y,subscriptionPriceByFeature:a,totalItemsCount:C,gridSizeXs:x,hasCustomSubscription:f,canUpgradeSubscription:h,showAll:o,toggleShowAll:S,hasNoItems:T,showMoreVisible:b}}function Tt(e,t,o){if(!t&&!o)return e;let r=Vn(e);return r===Vn(t||"")||r===Vn(o||"")?e:`${e} (${o})`}function Ll(e){return Tt(e.displayName,e.featureUnits,e.featureUnitsPlural)}function Nl(e){var t,o,r;return Tt((t=e.currency)==null?void 0:t.displayName,(o=e.currency)==null?void 0:o.unitSingular,(r=e.currency)==null?void 0:r.unitPlural)}var Xo=e.div`
|
|
500
500
|
display: flex;
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
padding: 24px;
|
|
@@ -506,12 +506,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
506
506
|
height: 100%;
|
|
507
507
|
|
|
508
508
|
${({theme:e,$highlight:t})=>t&&`background-color: ${e.stigg.palette.backgroundSection}`};
|
|
509
|
-
`;function
|
|
509
|
+
`;function Rl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i$1}){var a,c,u;let{theme:s}=W(),l=!e.hasUnlimitedUsage&&e.currentUsage>e.usageLimit;return e.feature?jsxs(Xo,{$highlight:!!t,$borderColor:s.borderColor,children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsx(Ae,{variant:"body1",children:e.feature&&Ll(e.feature)}),t&&jsx(Ve,{title:jsx(f,{variant:"body1",children:t.billingModel===BillingModel$1.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsx(i,{icon:"DollarCoin",svgStrokeColor:s.iconsColor})})]}),jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[jsxs(Ae,{variant:"body1",color:l?"error":"primary","data-testid":`usage-data-${(a=e.feature)==null?void 0:a.refId}`,children:[(c=e.currentUsage)==null?void 0:c.toLocaleString(),!e.hasUnlimitedUsage&&` / ${(u=e.usageLimit)==null?void 0:u.toLocaleString()} (${qe(e.currentUsage||0,e.usageLimit)}%)`]}),jsx(Ho,{featureEntitlement:e,feature:e.feature,onBuyMore:r,canBuyMore:!!t,onManageSubscription:o,canUpgradeSubscription:i$1,hasCustomSubscription:n})]}),jsx(zo,{entitlement:e}),!e.hasUnlimitedUsage&&!Ml(e.usageLimit)&&!Ml(e.currentUsage)&&e.resetPeriod&&e.usagePeriodEnd?jsx(f,{color:"secondary",children:ll(e)}):null,e.hasUnlimitedUsage&&jsx(f,{color:"secondary",children:"In current billing period"})]}):null}function Hn({currentUsage:e,usageLimit:t}){return jsx(Go,{currentUsage:e,usageLimit:t,classNamePrefix:"stigg-credit-usage-progress-bar"})}function On(e){return Q(e).format("MMM D, YYYY h:mmA")}function Wn(e){return Q(e).format("MMM D, YYYY")}function jf(e){return Q(e).fromNow()}function er(e){let{usagePeriodEnd:t,formatter:o}=e;return !t||t.getTime()<=Date.now()?null:`Resets ${o?o(t):jf(t)}.`}function tr({creditEntitlement:e}){let{theme:t}=W(),{currency:o,currentUsage:r,usageLimit:n}=e,i=(r!=null?r:0)>(n!=null?n:0),s=qe(r!=null?r:0,n!=null?n:0),l=Nl(e),a=er({usagePeriodEnd:e.usagePeriodEnd?new Date(e.usagePeriodEnd):void 0});return jsxs(Xo,{$highlight:false,$borderColor:t.borderColor,className:"stigg-credit-usage-container",children:[jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:jsx(Ae,{variant:"body1",className:"stigg-credit-usage-title",children:l})}),jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:jsxs(Ae,{variant:"body1",color:i?"error":"primary",className:"stigg-credit-usage-value","data-testid":`credit-usage-data-${o.currencyId}`,children:[(r!=null?r:0).toLocaleString()," / ",(n!=null?n:0).toLocaleString()," (",s,"%)"]})}),jsx(Hn,{currentUsage:r!=null?r:0,usageLimit:n!=null?n:0}),a&&jsx(f,{color:"secondary",children:a})]})}function _l({featureEntitlements:e,creditEntitlements:t,subscriptionPriceByFeature:o,gridSizeXs:r,onManageSubscription:n,onBuyMore:i,hasCustomSubscription:s,canUpgradeSubscription:l}){return jsxs(Me,{container:true,spacing:4,children:[e.filter(a=>!!a.feature).map(a=>{let c=a.feature;return jsx(Me,{className:`stigg-entitlement-usage-${c.refId}`,item:true,xs:r,children:jsx(Rl,{entitlement:a,subscriptionPrice:o[c.refId],onManageSubscription:n,onBuyMore:i,hasCustomSubscription:s,canUpgradeSubscription:l})},c.refId)}),t.map(a=>jsx(Me,{className:`stigg-credit-usage-${a.currency.currencyId}`,item:true,xs:r,children:jsx(tr,{creditEntitlement:a})},a.currency.currencyId))]})}var $l=e.div`
|
|
510
510
|
margin-top: 32px;
|
|
511
|
-
`;function zl(){let e=de("md");return jsx(Me,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty(6).map(t=>jsx(Me,{item:true,xs:e?4:12,children:jsx(Qe,{width:280,height:120})},t))})}function Vl({showAll:e,onToggle:t}){return jsx(Gl,{children:jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsx(Minus,{}):jsx(Plus,{}),onClick:t,children:e?"Show less":"Show more"})})}function nr({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}){let{textOverrides:n,theme:i}=W(),{isLoadingData:s,entitlementsToShow:l,creditsToShow:a,subscriptionPriceByFeature:c,gridSizeXs:u,hasCustomSubscription:f,canUpgradeSubscription:p,showAll:h,toggleShowAll:g,hasNoItems:y,showMoreVisible:C}=Ll({filterEntitlements:o,filterPackageEntitlements:r});return y?null:jsxs(Re,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsx(Le,{children:jsx(Ne,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:s})}),s?jsx(zl,{}):jsxs(Fragment,{children:[jsx(Dl,{featureEntitlements:l,creditEntitlements:a,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:p}),C&&jsx(Vl,{showAll:h,onToggle:g})]})]})}function Wl({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r,onCancelScheduledUpdates:n,onContactSupport:i,paywallComponent:s,hiddenSections:l}){let{customerPortal:a,textOverrides:c,theme:u,isLoading:f,showWatermark:p}=W(),h=useRef(null),g=({intentionType:x})=>{var S,T;e?e({intentionType:x,customerSubscriptions:(S=a==null?void 0:a.subscriptions)!=null?S:[]}):(T=h==null?void 0:h.current)==null||T.scrollIntoView({behavior:"smooth"});},y=!(l!=null&&l.some(x=>x==="usage")),C=!(l!=null&&l.some(x=>x==="paymentDetails"||x==="billingInformation")),b=!(l!=null&&l.some(x=>x==="invoices"||x==="billingInformation"));return jsxs(Tl,{className:"stigg-customer-portal-layout",children:[jsx(hl,{showWatermark:p}),jsxs(kl,{className:"stigg-customer-portal-sections",children:[jsx(Zo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),y&&jsx(nr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsx(zn,{ref:h,paywallComponent:s,theme:u,title:c.paywallSectionTitle,isLoading:!a||f}),C&&jsx(Jo,{}),b&&jsx(ir,{})]})]})}function Yl(i){var s=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=s,n=c(s,["textOverrides","theme","resourceId","productId"]);return jsx(Fo,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsx(Wl,a({},n))})}function ir(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsx(Yo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsx(Re,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Le,{className:"stigg-invoices-section-header",children:[jsx(Ne,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Kl=e=>Ql(e,"displayName"),Qn=e=>Ql(e,"addon.displayName");function at(e){var r,n;let t=(r=e.pricePoints)==null?void 0:r.some(i=>i.amount&&i.amount>0);return !!((n=e.hiddenFromWidgets)!=null&&n.includes(WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function ql({addon:e,currency:t,billingCountryCode:o}){return b(a({},e),{pricePoints:e.pricePoints.filter(r=>r.currency===t&&(o?r.billingCountryCode===o:true))})}function Jl({addons:e,billingCountryCode:t,currency:o}){return (e==null?void 0:e.map(r=>ql({addon:r,currency:o,billingCountryCode:t})))||[]}function Xl({addons:e,billingPeriod:t,billingCountryCode:o,currency:r}){var n;return ((n=e==null?void 0:e.filter(i=>cy(i.addon,t)))==null?void 0:n.map(i=>b(a({},i),{addon:ql({addon:i.addon,currency:r,billingCountryCode:o})})))||[]}function jl({activeSubscription:e,plan:t,billingCountryCode:o,billingPeriod:r}){var c,u;let n=[],i=((u=(c=t==null?void 0:t.pricePoints)==null?void 0:c[0])==null?void 0:u.currency)||Currency.Usd,s=Jl({addons:t==null?void 0:t.compatibleAddons,billingCountryCode:o,currency:i}),l=Kl(s.filter(f=>!at(f))),a=Xl({addons:e==null?void 0:e.addons,billingPeriod:r,billingCountryCode:o,currency:i});return a!=null&&a.length&&(s!=null&&s.length)&&(n=Qn(a.filter(f=>s.some(p=>p.id===f.addon.id)))),{addons:n,initialAddons:dy(n),availableAddons:l}}function uy(){let[,e]=R();return (t,o)=>e(r=>{if(at(t))return;let n=r.addonsStep.addons.find(i=>i.addon.id===t.id);if(n){if(at(n.addon))return;n.quantity=o;}else r.addonsStep.addons.push({addon:t,quantity:o}),r.addonsStep.addons=Qn(r.addonsStep.addons);})}function gy(){let[,e]=R();return t=>e(o=>{let r=o.addonsStep.addons.find(n=>n.addon.id===t);r&&at(r.addon)||py(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function ec(){let e=fy();return b(a({},e),{setAddon:uy(),removeAddon:gy()})}function yy(){let[{checkout:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}]=R();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}}function hy(){let[,e]=R();return t=>e(o=>{o.widgetState.readOnly=t;})}function Cy(){let[,e]=R();return t=>e(o=>{o.widgetState.isValid=t;})}function xy(){let[,e]=R();return t=>e(o=>{o.checkoutSuccess=t;})}function U(){let{checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}=yy();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r,setWidgetReadOnly:hy(),setIsValid:Cy(),setCheckoutSuccess:xy()}}function oc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r$1}){let{stigg:n}=u(),[i,s]=useState(true),[l,a]=useState();return useEffect(()=>{let c=()=>d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});a(u);}catch(u){r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{s(false);}});if(r$1){s(false),a(r$1({planId:e,resourceId:t,billingCountryCode:o}));return}n.isCustomerLoaded&&(s(true),c());},[n,n.isCustomerLoaded,t,e,o,r$1]),{checkout:l,isLoading:i,showWatermark:n.getShowWatermark()}}var sr=(e,t)=>e.minUnitQuantity&&t<e.minUnitQuantity?e.minUnitQuantity:e.maxUnitQuantity&&t>e.maxUnitQuantity?e.maxUnitQuantity:t;var Kn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Annually)),nc=e=>Kn(e)&&qn(e);var sc=(e,t,o)=>e===BillingPeriod$1.Monthly&&t||e===BillingPeriod$1.Annually&&o?e:null,lc=({pricingModel:e})=>e===BillingModel.PerUnit;function Sy(e,t,o){var i;if(!t)return [];let r=Bl(e,"featureId"),n=Bl(ac((i=o==null?void 0:o.prices)==null?void 0:i.map(s=>{let{feature:l}=s;return !l||!lc(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return ac(t==null?void 0:t.map(s=>{var u,f,p;let l=(u=s.feature)==null?void 0:u.featureId;if(!l||!lc(s))return null;let a,c=((f=r[l])==null?void 0:f.quantity)||((p=n[l])==null?void 0:p.quantity);return a=sr(s,c||1),s.isTieredPrice&&!Gt(s.tiers)&&(a=ln(s.tiers,a).upTo),{featureId:l,quantity:a}}))}function Ty({plan:e,activeSubscription:t,preferredBillingPeriod:o}){var s,l;let r=Kn(e),n=qn(e);if(o){let a=sc(o,r,n);if(a)return a}if(((s=t==null?void 0:t.plan)==null?void 0:s.id)===(e==null?void 0:e.id))return ((l=t==null?void 0:t.price)==null?void 0:l.billingPeriod)||BillingPeriod$1.Monthly;if(t!=null&&t.prices&&(t==null?void 0:t.prices.length)>0){let a=sc(t==null?void 0:t.prices[0].billingPeriod,r,n);if(a)return a}return n?BillingPeriod$1.Annually:BillingPeriod$1.Monthly}function cc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=Ty({plan:t,activeSubscription:o,preferredBillingPeriod:e}),s=t==null?void 0:t.pricePoints.filter(a=>a.billingPeriod===i),l=Sy(n,s,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function ky(){let[{planStep:e}]=R();return e}function wy(){let[,e]=R();return (t,o)=>e(r=>{let n=r.planStep.billableFeatures.find(i=>i.featureId===t);n?n.quantity=o:r.planStep.billableFeatures.push({featureId:t,quantity:o});})}function By(){let[,e]=R();return t=>e(o=>{o.planStep.billingPeriod=t,o.addonsStep.addons=o.addonsStep.addons.filter(r=>r.addon.pricePoints.some(n=>n.billingPeriod===t));})}function Pe(){let e=ky();return b(a({},e),{setBillingPeriod:By(),setBillableFeature:wy()})}var pc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],dc={activeStep:0,completedSteps:[],steps:pc,isDisabled:false},Iy=(e,t,o,r)=>{if(nc(e)&&!r)return false;let n=t.map(s=>s.featureId),i=o.map(s=>s.featureId);return !(n.length!==i.length||!n.every(s=>i.includes(s)))};function mc({isLoading:e,skipCheckoutSteps:t,plan:o,availableAddons:r,availableCharges:n,preferredBillingPeriod:i,preconfiguredBillableFeatures:s}){if(e||!o)return dc;let l=[];return t.includes("PLAN")&&Iy(o,n,s,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),b(a({},dc),{steps:pc.filter(a=>!l.includes(a.key))})}function Fy(){let[{progressBar:e}]=R();return e}function vy(){let[e,t]=R();return o=>d(null,null,function*(){let{progressBar:r,planStep:n,addonsStep:i,paymentStep:s,onBeforeStepChange:l}=e;if(o!==r.activeStep&&l){let a=r.steps[r.activeStep],c=r.steps[o];if(a&&c){let u={planStep:n,addonsStep:i,paymentStep:s};if(!(yield l({from:a.key,to:c.key,state:u})))return}}t(({progressBar:a})=>{a.activeStep=o;});})}function Ey(){let[,e]=R();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function Ly(e){return e.completedSteps.length>=e.steps.length-1}function Ny(){let[e,t]=R();return ()=>d(null,null,function*(){let{progressBar:o,planStep:r,addonsStep:n,paymentStep:i,onBeforeStepChange:s}=e;if(o.isDisabled)return;let l=o.steps[o.activeStep],a=o.steps[o.activeStep+1];if(a&&s){let c={planStep:r,addonsStep:n,paymentStep:i};if(!(yield s({from:l.key,to:a.key,state:c})))return}t(({progressBar:c})=>{c.completedSteps.includes(c.activeStep)||c.completedSteps.push(c.activeStep),c.activeStep<c.steps.length-1&&(c.activeStep+=1);});})}function My(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Ue(){let e=Fy();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:Ly(e),setActiveStep:vy(),markStepAsCompleted:Ey(),goNext:Ny(),setIsDisabled:My()}}function wt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return b(a({},e),{addons:t.addons,promotionCode:o,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function lr({billingAddress:e,taxPercentage:t,taxIds:o}){if(!e&&!t&&!(o!=null&&o.length))return {};let r=o!=null&&o.length?o==null?void 0:o.filter(n=>n.value&&n.type):void 0;return {billingInformation:b(a(a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Dy=h=>d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:s,billingCountryCode:l,billingPeriod:a$1,billingAddress:c,taxPercentage:u,taxIds:f,onMockCheckoutPreview:p}){var b;let g=i.map(({addon:x,quantity:S})=>({addonId:x.id,quantity:S})),y=null,C=null;try{if(t&&o){let x=a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:a$1,promotionCode:n,billableFeatures:Bg(s)?void 0:s},lr({billingAddress:c,taxPercentage:u,taxIds:f}));y=p?p(x):yield e.previewSubscription(x);}}catch(x){let[,S]=((b=x==null?void 0:x.message)==null?void 0:b.split("Error:"))||[];C=S==null?void 0:S.trim();}return {subscriptionPreview:y,errorMessage:C}}),Xn=({onMockCheckoutPreview:e}={})=>{let{stigg:t}=u(),o=wt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:s,customer:l}=n||{};return {previewSubscriptionAction:useCallback((...u)=>d(null,[...u],function*({promotionCode:c}={}){return i.isValid?Dy({stigg:t,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:o.addons,billableFeatures:o.billableFeatures,billingCountryCode:o.billingCountryCode,billingPeriod:o.billingPeriod,billingAddress:o.billingAddress,taxPercentage:o.taxPercentage,promotionCode:c!=null?c:o.promotionCode,taxIds:o.taxId?[o.taxId]:void 0,onMockCheckoutPreview:e}):{subscriptionPreview:null,errorMessage:null}}),[t,l==null?void 0:l.id,s==null?void 0:s.id,r,o.addons,o.billableFeatures,o.billingCountryCode,o.billingPeriod,o.billingAddress,o.taxPercentage,o.taxId,o.promotionCode,i.isValid,e])}},$y=500,uc=({onMockCheckoutPreview:e}={})=>{let[t,o]=useState(null),[r,n]=useState(null),[i,s]=useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return useEffect(()=>{let a=()=>d(null,null,function*(){let{subscriptionPreview:u,errorMessage:f}=yield l();u&&(o(u),n(null)),f&&(n(f),o(null)),s(false);});s(true);let c=setTimeout(()=>{s(true),a();},$y);return ()=>{clearTimeout(c);}},[l]),{subscriptionPreview:t,isFetchingSubscriptionPreview:i,errorMessage:r}};function gc({customer:e,taxPercentage:t,taxId:o}){return {useNewPaymentMethod:!(e!=null&&e.paymentMethodDetails),taxPercentage:t,taxId:o}}function Gy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function zy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function Vy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function Hy(){let[{paymentStep:e}]=R();return e}function Oy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=Hy();return b(a({},e),{setUseNewPaymentMethod:Gy(),setErrorMessage:zy(),setBillingAddress:Vy(),setTaxId:Oy()})}function yc(e){return dg({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===BillingPeriod.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:o})=>`${o.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:o})=>`Billed ${o.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:o})=>`Your account will be granted credits worth ${o} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:o,currency:r})=>{let n="";o.type===DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case DiscountDurationType.Once:{i=" once";break}case DiscountDurationType.Repeating:{i=`${o.type===DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case DiscountDurationType.Forever:default:i="";}return `${n}${i}`},taxTitle:({taxDetails:o})=>`Tax (${o==null?void 0:o.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:o})=>`Your changes will take effect at the end of your current billing cycle on ${Q(o).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:o})=>`${o.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:o})=>`${o.displayName}`,paidPlanPriceText:({billingPeriod:o})=>`Paid plan${o?`, billed ${o.toLowerCase()}`:""}`},nextBillingCaption:()=>""},e)}var Xt={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 hc(e,t,o){let{palette:r}=e||{};return {primary:(t==null?void 0:t.primary)||(r==null?void 0:r.primary)||Xt.primary,textColor:(t==null?void 0:t.textColor)||(r==null?void 0:r.text.primary)||Xt.textColor,backgroundColor:(t==null?void 0:t.backgroundColor)||(r==null?void 0:r.backgroundPaper)||Xt.backgroundColor,borderColor:(t==null?void 0:t.borderColor)||(r==null?void 0:r.outlinedBorder)||Xt.borderColor,summaryBackgroundColor:(t==null?void 0:t.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||Xt.summaryBackgroundColor,paymentInputBackgroundColor:t==null?void 0:t.paymentInputBackgroundColor,paymentInputBorderColor:t==null?void 0:t.paymentInputBorderColor,paymentInputBorderRadius:t==null?void 0:t.paymentInputBorderRadius}}var ti=ii.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=useContext(ti);if(!e)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return e},jy=({children:e,initialState:t})=>{let[o,r]=useState(t);useEffect(()=>{r(t);},[t]);let n=useCallback(l=>r(a=>produce(a,c=>l(c))),[r]),[i,s]=useMemo(()=>[o,n],[n,o]);return jsx(ti.Provider,{value:[i,s],children:e})};function xc({children:e,textOverrides:t,theme:o,preferredBillingPeriod:r,billableFeatures:n,resourceId:i,planId:s,billingCountryCode:l,billingInformation:a,onMockCheckoutState:c,skipCheckoutSteps:u,onBeforeStepChange:f}){var x;let{checkout:p,isLoading:h,showWatermark:g}=oc({resourceId:i,planId:s,billingCountryCode:l,onMockCheckoutState:c}),y=p!=null&&p.configuration?ls(p.configuration):{typography:Wt(null,Bo)},C=v(y),b=useMemo(()=>{var E,A;let S=hc(C,o,p==null?void 0:p.configuration),T=yc(t),F=cc({preferredBillingPeriod:r,plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:n!=null?n:[]}),w=jl({plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingPeriod:F.billingPeriod}),I=gc({customer:p==null?void 0:p.customer,taxPercentage:(E=a==null?void 0:a.taxDetails)==null?void 0:E.taxPercentage}),k=mc({isLoading:h,skipCheckoutSteps:u!=null?u:[],plan:p==null?void 0:p.plan,availableAddons:w.availableAddons,availableCharges:F.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:p,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:F,addonsStep:w,paymentStep:I,resourceId:(A=p==null?void 0:p.resource)==null?void 0:A.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:h},showWatermark:g,checkoutSuccess:false,onBeforeStepChange:f}},[r,l,p,h,u,(x=a==null?void 0:a.taxDetails)==null?void 0:x.taxPercentage,f]);return jsx(w,{componentTheme:y,children:jsx(jy,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var Pc="920px",Sc=e.div`
|
|
511
|
+
`;function Gl(){let e=de("md");return jsx(Me,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty(6).map(t=>jsx(Me,{item:true,xs:e?4:12,children:jsx(Qe,{width:280,height:120})},t))})}function zl({showAll:e,onToggle:t}){return jsx($l,{children:jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsx(Minus,{}):jsx(Plus,{}),onClick:t,children:e?"Show less":"Show more"})})}function nr({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}){let{textOverrides:n,theme:i}=W(),{isLoadingData:s,entitlementsToShow:l,creditsToShow:a,subscriptionPriceByFeature:c,gridSizeXs:u,hasCustomSubscription:f,canUpgradeSubscription:p,showAll:h,toggleShowAll:g,hasNoItems:y,showMoreVisible:C}=El({filterEntitlements:o,filterPackageEntitlements:r});return y?null:jsxs(Re,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsx(Le,{children:jsx(Ne,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:s})}),s?jsx(Gl,{}):jsxs(Fragment,{children:[jsx(_l,{featureEntitlements:l,creditEntitlements:a,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:p}),C&&jsx(zl,{showAll:h,onToggle:g})]})]})}function Ol({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r,onCancelScheduledUpdates:n,onContactSupport:i,paywallComponent:s,hiddenSections:l}){let{customerPortal:a,textOverrides:c,theme:u,isLoading:f,showWatermark:p}=W(),h=useRef(null),g=({intentionType:x})=>{var S,T;e?e({intentionType:x,customerSubscriptions:(S=a==null?void 0:a.subscriptions)!=null?S:[]}):(T=h==null?void 0:h.current)==null||T.scrollIntoView({behavior:"smooth"});},y=!(l!=null&&l.some(x=>x==="usage")),C=!(l!=null&&l.some(x=>x==="paymentDetails"||x==="billingInformation")),b=!(l!=null&&l.some(x=>x==="invoices"||x==="billingInformation"));return jsxs(Sl,{className:"stigg-customer-portal-layout",children:[jsx(yl,{showWatermark:p}),jsxs(Tl,{className:"stigg-customer-portal-sections",children:[jsx(Zo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),y&&jsx(nr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsx(zn,{ref:h,paywallComponent:s,theme:u,title:c.paywallSectionTitle,isLoading:!a||f}),C&&jsx(Jo,{}),b&&jsx(ir,{})]})]})}function Zl(i){var s=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=s,n=c(s,["textOverrides","theme","resourceId","productId"]);return jsx(Fo,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsx(Ol,a({},n))})}function ir(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsx(Yo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsx(Re,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Le,{className:"stigg-invoices-section-header",children:[jsx(Ne,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Ql=e=>Yl(e,"displayName"),Qn=e=>Yl(e,"addon.displayName");function at(e){var r,n;let t=(r=e.pricePoints)==null?void 0:r.some(i=>i.amount&&i.amount>0);return !!((n=e.hiddenFromWidgets)!=null&&n.includes(WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function Kl({addon:e,currency:t,billingCountryCode:o}){return b(a({},e),{pricePoints:e.pricePoints.filter(r=>r.currency===t&&(o?r.billingCountryCode===o:true))})}function ql({addons:e,billingCountryCode:t,currency:o}){return (e==null?void 0:e.map(r=>Kl({addon:r,currency:o,billingCountryCode:t})))||[]}function Jl({addons:e,billingPeriod:t,billingCountryCode:o,currency:r}){var n;return ((n=e==null?void 0:e.filter(i=>cy(i.addon,t)))==null?void 0:n.map(i=>b(a({},i),{addon:Kl({addon:i.addon,currency:r,billingCountryCode:o})})))||[]}function Xl({activeSubscription:e,plan:t,billingCountryCode:o,billingPeriod:r}){var c,u;let n=[],i=((u=(c=t==null?void 0:t.pricePoints)==null?void 0:c[0])==null?void 0:u.currency)||Currency.Usd,s=ql({addons:t==null?void 0:t.compatibleAddons,billingCountryCode:o,currency:i}),l=Ql(s.filter(f=>!at(f))),a=Jl({addons:e==null?void 0:e.addons,billingPeriod:r,billingCountryCode:o,currency:i});return a!=null&&a.length&&(s!=null&&s.length)&&(n=Qn(a.filter(f=>s.some(p=>p.id===f.addon.id)))),{addons:n,initialAddons:dy(n),availableAddons:l}}function uy(){let[,e]=R();return (t,o)=>e(r=>{if(at(t))return;let n=r.addonsStep.addons.find(i=>i.addon.id===t.id);if(n){if(at(n.addon))return;n.quantity=o;}else r.addonsStep.addons.push({addon:t,quantity:o}),r.addonsStep.addons=Qn(r.addonsStep.addons);})}function gy(){let[,e]=R();return t=>e(o=>{let r=o.addonsStep.addons.find(n=>n.addon.id===t);r&&at(r.addon)||py(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function jl(){let e=fy();return b(a({},e),{setAddon:uy(),removeAddon:gy()})}function yy(){let[{checkout:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}]=R();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}}function hy(){let[,e]=R();return t=>e(o=>{o.widgetState.readOnly=t;})}function Cy(){let[,e]=R();return t=>e(o=>{o.widgetState.isValid=t;})}function xy(){let[,e]=R();return t=>e(o=>{o.checkoutSuccess=t;})}function U(){let{checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}=yy();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r,setWidgetReadOnly:hy(),setIsValid:Cy(),setCheckoutSuccess:xy()}}function tc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r$1}){let{stigg:n}=u(),[i,s]=useState(true),[l,a]=useState();return useEffect(()=>{let c=()=>d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});a(u);}catch(u){r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{s(false);}});if(r$1){s(false),a(r$1({planId:e,resourceId:t,billingCountryCode:o}));return}n.isCustomerLoaded&&(s(true),c());},[n,n.isCustomerLoaded,t,e,o,r$1]),{checkout:l,isLoading:i,showWatermark:n.getShowWatermark()}}var sr=(e,t)=>e.minUnitQuantity&&t<e.minUnitQuantity?e.minUnitQuantity:e.maxUnitQuantity&&t>e.maxUnitQuantity?e.maxUnitQuantity:t;var Kn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Annually)),rc=e=>Kn(e)&&qn(e);var ac=(e,t,o)=>e===BillingPeriod$1.Monthly&&t||e===BillingPeriod$1.Annually&&o?e:null,sc=({pricingModel:e})=>e===BillingModel.PerUnit;function Sy(e,t,o){var i;if(!t)return [];let r=wl(e,"featureId"),n=wl(ic((i=o==null?void 0:o.prices)==null?void 0:i.map(s=>{let{feature:l}=s;return !l||!sc(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return ic(t==null?void 0:t.map(s=>{var u,f,p;let l=(u=s.feature)==null?void 0:u.featureId;if(!l||!sc(s))return null;let a,c=((f=r[l])==null?void 0:f.quantity)||((p=n[l])==null?void 0:p.quantity);return a=sr(s,c||1),s.isTieredPrice&&!Gt(s.tiers)&&(a=ln(s.tiers,a).upTo),{featureId:l,quantity:a}}))}function Ty({plan:e,activeSubscription:t,preferredBillingPeriod:o}){var s,l;let r=Kn(e),n=qn(e);if(o){let a=ac(o,r,n);if(a)return a}if(((s=t==null?void 0:t.plan)==null?void 0:s.id)===(e==null?void 0:e.id))return ((l=t==null?void 0:t.price)==null?void 0:l.billingPeriod)||BillingPeriod$1.Monthly;if(t!=null&&t.prices&&(t==null?void 0:t.prices.length)>0){let a=ac(t==null?void 0:t.prices[0].billingPeriod,r,n);if(a)return a}return n?BillingPeriod$1.Annually:BillingPeriod$1.Monthly}function lc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=Ty({plan:t,activeSubscription:o,preferredBillingPeriod:e}),s=t==null?void 0:t.pricePoints.filter(a=>a.billingPeriod===i),l=Sy(n,s,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function ky(){let[{planStep:e}]=R();return e}function wy(){let[,e]=R();return (t,o)=>e(r=>{let n=r.planStep.billableFeatures.find(i=>i.featureId===t);n?n.quantity=o:r.planStep.billableFeatures.push({featureId:t,quantity:o});})}function By(){let[,e]=R();return t=>e(o=>{o.planStep.billingPeriod=t,o.addonsStep.addons=o.addonsStep.addons.filter(r=>r.addon.pricePoints.some(n=>n.billingPeriod===t));})}function Pe(){let e=ky();return b(a({},e),{setBillingPeriod:By(),setBillableFeature:wy()})}var dc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],cc={activeStep:0,completedSteps:[],steps:dc,isDisabled:false},Iy=(e,t,o,r)=>{if(rc(e)&&!r)return false;let n=t.map(s=>s.featureId),i=o.map(s=>s.featureId);return !(n.length!==i.length||!n.every(s=>i.includes(s)))};function pc({isLoading:e,skipCheckoutSteps:t,plan:o,availableAddons:r,availableCharges:n,preferredBillingPeriod:i,preconfiguredBillableFeatures:s}){if(e||!o)return cc;let l=[];return t.includes("PLAN")&&Iy(o,n,s,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),b(a({},cc),{steps:dc.filter(a=>!l.includes(a.key))})}function Fy(){let[{progressBar:e}]=R();return e}function vy(){let[e,t]=R();return o=>d(null,null,function*(){let{progressBar:r,planStep:n,addonsStep:i,paymentStep:s,onBeforeStepChange:l}=e;if(o!==r.activeStep&&l){let a=r.steps[r.activeStep],c=r.steps[o];if(a&&c){let u={planStep:n,addonsStep:i,paymentStep:s};if(!(yield l({from:a.key,to:c.key,state:u})))return}}t(({progressBar:a})=>{a.activeStep=o;});})}function Ey(){let[,e]=R();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function Ly(e){return e.completedSteps.length>=e.steps.length-1}function Ny(){let[e,t]=R();return ()=>d(null,null,function*(){let{progressBar:o,planStep:r,addonsStep:n,paymentStep:i,onBeforeStepChange:s}=e;if(o.isDisabled)return;let l=o.steps[o.activeStep],a=o.steps[o.activeStep+1];if(a&&s){let c={planStep:r,addonsStep:n,paymentStep:i};if(!(yield s({from:l.key,to:a.key,state:c})))return}t(({progressBar:c})=>{c.completedSteps.includes(c.activeStep)||c.completedSteps.push(c.activeStep),c.activeStep<c.steps.length-1&&(c.activeStep+=1);});})}function My(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Ue(){let e=Fy();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:Ly(e),setActiveStep:vy(),markStepAsCompleted:Ey(),goNext:Ny(),setIsDisabled:My()}}function wt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return b(a({},e),{addons:t.addons,promotionCode:o,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function lr({billingAddress:e,taxPercentage:t,taxIds:o}){if(!e&&!t&&!(o!=null&&o.length))return {};let r=o!=null&&o.length?o==null?void 0:o.filter(n=>n.value&&n.type):void 0;return {billingInformation:b(a(a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Dy=h=>d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:s,billingCountryCode:l,billingPeriod:a$1,billingAddress:c,taxPercentage:u,taxIds:f,onMockCheckoutPreview:p}){var b;let g=i.map(({addon:x,quantity:S})=>({addonId:x.id,quantity:S})),y=null,C=null;try{if(t&&o){let x=a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:a$1,promotionCode:n,billableFeatures:Bg(s)?void 0:s},lr({billingAddress:c,taxPercentage:u,taxIds:f}));y=p?p(x):yield e.previewSubscription(x);}}catch(x){let[,S]=((b=x==null?void 0:x.message)==null?void 0:b.split("Error:"))||[];C=S==null?void 0:S.trim();}return {subscriptionPreview:y,errorMessage:C}}),Xn=({onMockCheckoutPreview:e}={})=>{let{stigg:t}=u(),o=wt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:s,customer:l}=n||{};return {previewSubscriptionAction:useCallback((...u)=>d(null,[...u],function*({promotionCode:c}={}){return i.isValid?Dy({stigg:t,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:o.addons,billableFeatures:o.billableFeatures,billingCountryCode:o.billingCountryCode,billingPeriod:o.billingPeriod,billingAddress:o.billingAddress,taxPercentage:o.taxPercentage,promotionCode:c!=null?c:o.promotionCode,taxIds:o.taxId?[o.taxId]:void 0,onMockCheckoutPreview:e}):{subscriptionPreview:null,errorMessage:null}}),[t,l==null?void 0:l.id,s==null?void 0:s.id,r,o.addons,o.billableFeatures,o.billingCountryCode,o.billingPeriod,o.billingAddress,o.taxPercentage,o.taxId,o.promotionCode,i.isValid,e])}},$y=500,mc=({onMockCheckoutPreview:e}={})=>{let[t,o]=useState(null),[r,n]=useState(null),[i,s]=useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return useEffect(()=>{let a=()=>d(null,null,function*(){let{subscriptionPreview:u,errorMessage:f}=yield l();u&&(o(u),n(null)),f&&(n(f),o(null)),s(false);});s(true);let c=setTimeout(()=>{s(true),a();},$y);return ()=>{clearTimeout(c);}},[l]),{subscriptionPreview:t,isFetchingSubscriptionPreview:i,errorMessage:r}};function uc({customer:e,taxPercentage:t,taxId:o}){return {useNewPaymentMethod:!(e!=null&&e.paymentMethodDetails),taxPercentage:t,taxId:o}}function Gy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function zy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function Vy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function Hy(){let[{paymentStep:e}]=R();return e}function Oy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=Hy();return b(a({},e),{setUseNewPaymentMethod:Gy(),setErrorMessage:zy(),setBillingAddress:Vy(),setTaxId:Oy()})}function fc(e){return dg({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===BillingPeriod.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:o})=>`${o.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:o})=>`Billed ${o.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:o})=>`Your account will be granted credits worth ${o} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:o,currency:r})=>{let n="";o.type===DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case DiscountDurationType.Once:{i=" once";break}case DiscountDurationType.Repeating:{i=`${o.type===DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case DiscountDurationType.Forever:default:i="";}return `${n}${i}`},taxTitle:({taxDetails:o})=>`Tax (${o==null?void 0:o.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:o})=>`Your changes will take effect at the end of your current billing cycle on ${Q(o).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:o})=>`${o.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:o})=>`${o.displayName}`,paidPlanPriceText:({billingPeriod:o})=>`Paid plan${o?`, billed ${o.toLowerCase()}`:""}`},nextBillingCaption:()=>""},e)}var Xt={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 yc(e,t,o){let{palette:r}=e||{};return {primary:(t==null?void 0:t.primary)||(r==null?void 0:r.primary)||Xt.primary,textColor:(t==null?void 0:t.textColor)||(r==null?void 0:r.text.primary)||Xt.textColor,backgroundColor:(t==null?void 0:t.backgroundColor)||(r==null?void 0:r.backgroundPaper)||Xt.backgroundColor,borderColor:(t==null?void 0:t.borderColor)||(r==null?void 0:r.outlinedBorder)||Xt.borderColor,summaryBackgroundColor:(t==null?void 0:t.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||Xt.summaryBackgroundColor,paymentInputBackgroundColor:t==null?void 0:t.paymentInputBackgroundColor,paymentInputBorderColor:t==null?void 0:t.paymentInputBorderColor,paymentInputBorderRadius:t==null?void 0:t.paymentInputBorderRadius}}var ti=ii.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=useContext(ti);if(!e)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return e},jy=({children:e,initialState:t})=>{let[o,r]=useState(t);useEffect(()=>{r(t);},[t]);let n=useCallback(l=>r(a=>produce(a,c=>l(c))),[r]),[i,s]=useMemo(()=>[o,n],[n,o]);return jsx(ti.Provider,{value:[i,s],children:e})};function Cc({children:e,textOverrides:t,theme:o,preferredBillingPeriod:r,billableFeatures:n,resourceId:i,planId:s,billingCountryCode:l,billingInformation:a,onMockCheckoutState:c,skipCheckoutSteps:u,onBeforeStepChange:f}){var x;let{checkout:p,isLoading:h,showWatermark:g}=tc({resourceId:i,planId:s,billingCountryCode:l,onMockCheckoutState:c}),y=p!=null&&p.configuration?ss(p.configuration):{typography:Wt(null,Bo)},C=v(y),b=useMemo(()=>{var E,A;let S=yc(C,o,p==null?void 0:p.configuration),T=fc(t),F=lc({preferredBillingPeriod:r,plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:n!=null?n:[]}),w=Xl({plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingPeriod:F.billingPeriod}),I=uc({customer:p==null?void 0:p.customer,taxPercentage:(E=a==null?void 0:a.taxDetails)==null?void 0:E.taxPercentage}),k=pc({isLoading:h,skipCheckoutSteps:u!=null?u:[],plan:p==null?void 0:p.plan,availableAddons:w.availableAddons,availableCharges:F.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:p,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:F,addonsStep:w,paymentStep:I,resourceId:(A=p==null?void 0:p.resource)==null?void 0:A.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:h},showWatermark:g,checkoutSuccess:false,onBeforeStepChange:f}},[r,l,p,h,u,(x=a==null?void 0:a.taxDetails)==null?void 0:x.taxPercentage,f]);return jsx(w,{componentTheme:y,children:jsx(jy,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var xc="920px",bc=e.div`
|
|
512
512
|
margin: auto;
|
|
513
513
|
min-height: 760px;
|
|
514
|
-
max-width: ${
|
|
514
|
+
max-width: ${xc};
|
|
515
515
|
display: flex;
|
|
516
516
|
position: relative;
|
|
517
517
|
flex-direction: column;
|
|
@@ -528,9 +528,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
528
528
|
${oe.md} {
|
|
529
529
|
padding: 32px;
|
|
530
530
|
border-radius: 10px;
|
|
531
|
-
width: ${
|
|
531
|
+
width: ${xc};
|
|
532
532
|
}
|
|
533
|
-
`,
|
|
533
|
+
`,Sc=e(ke)`
|
|
534
534
|
display: flex;
|
|
535
535
|
align-items: flex-start;
|
|
536
536
|
gap: 32px;
|
|
@@ -541,7 +541,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
541
541
|
${oe.md} {
|
|
542
542
|
flex-direction: row;
|
|
543
543
|
}
|
|
544
|
-
`,
|
|
544
|
+
`,Tc=e(ke)`
|
|
545
545
|
display: flex;
|
|
546
546
|
flex-direction: column;
|
|
547
547
|
gap: 0;
|
|
@@ -551,18 +551,18 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
551
551
|
${oe.md} {
|
|
552
552
|
width: auto;
|
|
553
553
|
}
|
|
554
|
-
`;var
|
|
554
|
+
`;var wc=e(kf,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({[`&.${linearProgressClasses.root}`]:{borderRadius:e.stigg.border.radius,backgroundColor:e.stigg.palette.outlinedBorder},[`& .${linearProgressClasses.bar}`]:{backgroundColor:t?e.stigg.palette.primaryLight:e.stigg.palette.primary}})),Bc=e(Ym)({[`&.${buttonClasses.root}`]:{textTransform:"none",lineHeight:"inherit",justifyContent:"flex-start",padding:"8px 4px"}}),Ac=e(i,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t,$shouldFill:o})=>({circle:{stroke:t?e.stigg.palette.primaryLight:e.stigg.palette.primary,fill:o?t?e.stigg.palette.primaryLight:e.stigg.palette.primary:void 0}}));var Fc=()=>{let{progressBarState:e,setActiveStep:t,currentStep:o$1}=Ue(),{widgetState:r}=U(),n=de("md"),i=useRef(),{readOnly:s,isLoadingCheckoutData:l}=r,{activeStep:a,completedSteps:c,steps:u}=e||{},f$1=(a+1)*100/u.length,[p,h]=ii.useState(o$1);return useEffect(()=>{n||i.current&&o$1!==p&&i.current.scrollIntoView({behavior:"smooth"}),h(o$1);},[o$1,n,p,h]),e.steps.length===1?null:jsxs(ke,{className:"stigg-checkout-progress-container",sx:{width:"100%",mb:3},ref:i,children:[jsx(wc,{variant:"determinate",value:f$1,$disabled:s}),jsx(Me,{container:true,display:"flex",children:u.map(({key:g,label:y},C)=>{let b=c.includes(C),x=s||C>a&&!b&&!c.includes(C-1)||a!==C&&e.isDisabled;return jsx(Me,{item:true,display:"flex",flexDirection:"row",flex:n?1:"auto",justifyContent:"flex-start",children:l?jsx(o,{width:120,height:20,style:{marginTop:8}}):jsx(Bc,{onClick:()=>t(C),fullWidth:true,disabled:x,children:jsxs(Me,{item:true,display:"flex",flexDirection:"row",alignItems:"center",gap:1,children:[jsx(sh,{icon:jsx(Ac,{icon:b?x?"OutlinedCheckedCircleDisabled":"OutlinedCheckedCircle":"OutlinedCircle",$disabled:x,$shouldFill:b})}),jsx(f,{variant:"h6",color:x?"primary.main.light":"primary.main",children:y})]})})},g)})})]})};var dh=[BillingModel.FlatFee,BillingModel.PerUnit,BillingModel.UsageBased],ph=e=>Yl(e,[t=>dh.indexOf(t.pricingModel),t=>{var o;return (o=t.feature)==null?void 0:o.displayName}]),dr=e=>useMemo(()=>ph(e),[e]);function mh(){let[{promotionCode:e}]=R();return e}function uh(){let[,e]=R();return t=>e(o=>{o.promotionCode=t;})}function Bt(){return {promotionCode:mh(),setPromotionCode:uh()}}var gh=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxs("g",{id:"plus",children:[jsx("path",{id:"Shape",d:"M10 4.16666V15.8333",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{id:"Shape_2",d:"M4.16699 10H15.8337",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})})),pr=gh;var yh=e(pr,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
555
555
|
margin-right: 8px;
|
|
556
556
|
path {
|
|
557
557
|
stroke: ${({theme:e,$disabled:t})=>t?e.stigg.palette.text.disabled:e.stigg.palette.primary};
|
|
558
558
|
}
|
|
559
|
-
`,
|
|
559
|
+
`,Ec=({onAddClick:e,checkoutLocalization:t,disabled:o})=>jsxs(te,{disabled:o,fullWidth:true,className:"stigg-checkout-summary-add-coupon-code-button",sx:{textTransform:"none",justifyContent:"flex-start",color:o?"text.disabled":"primary.main"},variant:"text",size:"medium",onClick:e,children:[jsx(yh,{$disabled:o,className:"stigg-checkout-summary-add-coupon-code-button-icon"}),jsx(f,{className:"stigg-checkout-change-plan-button-text",color:o?"disabled":"primary.main",style:{lineHeight:"24px"},variant:"h3",children:t.summary.addCouponCodeText})]});var bh=e(te)`
|
|
560
560
|
padding: 4px 10px;
|
|
561
561
|
min-width: unset;
|
|
562
562
|
border-radius: ${({theme:e})=>e.stigg.border.radius};
|
|
563
563
|
display: flex;
|
|
564
564
|
align-items: center;
|
|
565
|
-
`,
|
|
565
|
+
`,Lc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=Bt(),[n,i$1]=useState(false),[s,l]=ii.useState(""),[a,c]=ii.useState(false),[u,f$1]=ii.useState(""),{previewSubscriptionAction:p}=Xn({onMockCheckoutPreview:o}),h=()=>d(null,null,function*(){var C;c(true),f$1("");let{subscriptionPreview:g,errorMessage:y}=yield p({promotionCode:s});!y&&((C=g==null?void 0:g.immediateInvoice)!=null&&C.discountDetails)?(r(s.toUpperCase()),i$1(false)):y&&f$1(y),c(false);});return n?jsxs(Me,{children:[jsx(f,{variant:"body1",color:u?"error":e?"disabled":"primary.main",children:t.summary.couponCodeTitle}),jsx(ce,{disabled:e,autoFocus:true,variant:"outlined",fullWidth:true,error:!!u,value:s,onChange:g=>{l(g.target.value);},inputProps:{maxLength:20},onKeyDown:g=>{g.key==="Enter"&&(h(),g.preventDefault());},InputProps:{endAdornment:jsx(bh,{variant:"contained",disabled:e,onClick:()=>{h();},children:a?jsx(xh,{size:18,sx:{color:"white"}}):jsx(i,{style:{display:"flex"},icon:"ArrowForward"})})}}),!!u&&jsx(f,{variant:"body1",color:"error",children:u})]}):jsx(Ec,{disabled:e,onAddClick:()=>i$1(true),checkoutLocalization:t})};var Th=e(Me)`
|
|
566
566
|
width: auto;
|
|
567
567
|
display: inline-flex;
|
|
568
568
|
align-items: center;
|
|
@@ -571,7 +571,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
571
571
|
padding: 6px 8px;
|
|
572
572
|
border-radius: ${({theme:e})=>e.stigg.border.radius};
|
|
573
573
|
border: 1px solid ${({theme:e})=>e.stigg.palette.primary};
|
|
574
|
-
`,
|
|
574
|
+
`,Nc=e(i,{shouldForwardProp:e=>e!=="style"})`
|
|
575
575
|
display: flex;
|
|
576
576
|
|
|
577
577
|
g {
|
|
@@ -581,9 +581,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
581
581
|
path {
|
|
582
582
|
fill: ${({theme:e,$shouldFill:t})=>t?e.stigg.palette.primary:void 0};
|
|
583
583
|
}
|
|
584
|
-
`,
|
|
584
|
+
`,Rc=({promotionCode:e,onClearPromotionCode:t})=>jsxs(Th,{container:true,children:[jsxs(Me,{item:true,display:"flex",gap:1,alignItems:"center",children:[jsx(Nc,{icon:"Coupon"}),jsx(f,{variant:"body1",color:"primary.main",lineHeight:"auto",children:e})]}),jsx(Me,{item:true,children:jsx(te,{variant:"text",sx:{minWidth:"unset",padding:0},onClick:t,children:jsx(Nc,{icon:"Close",$shouldFill:true})})})]});var kh=e.div`
|
|
585
585
|
margin: 16px 0;
|
|
586
|
-
`,_c=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Bt();return jsx(kh,{children:r?jsx(Uc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsx(Nc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var Dc=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:s})=>jsx(Bh,{onClick:r,value:n,control:jsx(wh,{checked:t,onChange:o,disabled:i,"data-testid":s}),label:Ah(e)?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var pi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:BS$1,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:IS$1,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:RS,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:US,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:ZW,example:"1234567890"}],ux="United States",gx=" # ",mr="us_ein",ur=(e,t)=>`${e}${gx}${t}`,mi=new Map(pi.map(e=>[ur(e.taxIdType,e.country),e])),It=e=>mi.get(e),gr=ur(mr,ux);var ui=e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var xx=e(fx)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),fr=e(f)({});fr.defaultProps={variant:"body1",color:"secondary"};function rd(){let[e,t]=useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,s]=useState(gr),[l,a$1]=useState(false),c=useCallback((g,y,C)=>{n({type:y,value:C}),s(g);},[n,s]);useEffect(()=>{a$1(false);},[o==null?void 0:o.country]),useEffect(()=>{if(!(o!=null&&o.country)||l||!e)return;let g=pi.find(y=>y.countryCode===o.country);g&&c(ur(g.taxIdType,g.country),g.taxIdType,"");},[o,e,l,c]);let u=g=>{if(!g)return;let y=It(g);if(y){if(a$1(true),r!=null&&r.value){c(g,y.taxIdType,r.value);return}s(g),r!=null&&r.type&&n(void 0);}},f$1=useMemo(()=>Array.from(mi.keys()),[]),p=useMemo(()=>f$1.find(g=>g===i)||null,[f$1,i]),h=useMemo(()=>{let g=It(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return useEffect(()=>(e||(a$1(false),c(gr,mr,"")),()=>{c(gr,mr,"");}),[e,c]),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(Me,{flexDirection:"row",container:true,gap:2,children:jsx(Dc,{checked:e,onChange:()=>t(g=>!g),label:jsx(fr,{children:"I'm purchasing as a business"})})}),jsx(yx,{in:e,children:jsxs(Me,{container:true,spacing:0,sx:{width:"100%"},children:[jsxs(Me,{item:true,xs:6,children:[jsx(fr,{children:"Tax ID Type"}),jsx(xx,{fullWidth:true,options:f$1,value:p,onChange:(g,y)=>u(y),renderInput:g=>jsx(ui,b(a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=It(y);if(!C)return null;let{taxIdType:b$1,country:x,FlagComponent:S}=C;return createElement(ou,b(a({},g),{key:y}),jsxs(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),td(x)," - ",od(b$1)]}))},getOptionLabel:g=>{let y=It(g);return y?`${td(y.country)} - ${od(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxs(Me,{item:true,xs:6,paddingLeft:"12px",children:[jsx(fr,{children:"Tax ID"}),jsx(ui,{id:"tax-id-value",placeholder:h,type:"text",fullWidth:true,value:(r==null?void 0:r.value)||"",onChange:g=>{let y=It(i);y&&c(i,y.taxIdType,g.target.value);}})]})]})})]})}function nd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o}){var g;let{checkoutState:r,checkoutLocalization:n,widgetState:i,setWidgetReadOnly:s}=U(),{setBillingAddress:l}=re(),{customer:a$1,configuration:c$1}=r||{},{readOnly:u}=i,f$1=!!(t!=null?t:(g=c$1==null?void 0:c$1.content)!=null&&g.collectPhoneNumber),p=useMemo(()=>o&&!(a$1!=null&&a$1.billingId)&&!(a$1!=null&&a$1.paymentMethodDetails),[o,a$1==null?void 0:a$1.billingId,a$1==null?void 0:a$1.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=c(S,["postal_code"]),x=a({postalCode:C},b);s(true),l(x),e?d(null,null,function*(){yield e({billingAddress:x}),s(false);}):s(false);};return jsxs(Me,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsx(AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f$1?"always":"auto"},defaultValues:a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name})}})]}),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsx(PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:a(a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name}),(a$1==null?void 0:a$1.email)&&{email:a$1.email})}}})]}),p&&jsx(rd,{})]})}function id(){let[e,t]=useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return useEffect(()=>{if(r){let{billingIdentifier:i,credentials:s}=r;if(i!==BillingVendorIdentifier.Stripe)return;let{accountId:l,publicKey:a}=s;if(!l||!a){console.error("Stripe account ID or public key is missing");return}import('@stripe/stripe-js').then(({loadStripe:c})=>{t(c(a,{stripeAccount:l}));});}},[r]),{stripePromise:e,setupIntentClientSecret:n}}function yr(){let e=wt(),[{resourceId:t}]=R(),{checkoutState:o}=U(),{plan:r}=o||{},n=e.addons.map(({addon:i,quantity:s})=>({addonId:i.id,quantity:s}));if(r!=null&&r.id)return a({resourceId:t,planId:r.id,billingPeriod:e.billingPeriod,billableFeatures:e.billableFeatures,addons:n,promotionCode:e.promotionCode,billingCountryCode:e.billingCountryCode},lr({taxIds:e.taxId?[e.taxId]:void 0}))}var Ax=[PaymentCollection.Failed,PaymentCollection.Processing];function Ix(t){return d(this,arguments,function*({elements:e}){if(!e){let r="Stripe elements not initialized";return console.error(r),{success:false,errorMessage:r}}let{error:o}=yield e.submit();return o?(console.log(o.message),{success:false,errorMessage:o.message||""}):{success:true}})}function Pi(o){return d(this,arguments,function*({applySubscriptionResults:e,stripe:t}){var s,l;let r=e==null?void 0:e.subscription,n=(s=r==null?void 0:r.latestInvoice)==null?void 0:s.paymentSecret,i=r==null?void 0:r.paymentCollection;if(t&&n&&i===PaymentCollection.ActionRequired){let{error:a}=yield t.handleNextAction({clientSecret:n});if(a)return {errorMessage:a.message||""}}else if(i&&Ax.includes(i))return {errorMessage:((l=r==null?void 0:r.latestInvoice)==null?void 0:l.errorMessage)||"An error occurred - try again later"};return {subscription:r}})}function Fx(r){return d(this,arguments,function*({stripe:e,elements:t,clientSecret:o}){let n,i,{error:s}=yield e.confirmSetup({elements:t,confirmParams:{return_url:window.location.href},redirect:"if_required"});if(s)s.type==="card_error"||s.type==="validation_error"?s.type==="card_error"&&(i=s.message||""):i="An unexpected error occurred.";else try{let{setupIntent:l}=yield e.retrieveSetupIntent(o);l!=null&&l.payment_method&&(n=l.payment_method);}catch(l){i="An unexpected error occurred.",console.error(l);}return {newPaymentMethodId:n,setupErrorMessage:i}})}function ad(r){return d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield Ix({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:s}=yield Fx({stripe:e,elements:t,clientSecret:o});return s||!i?{success:false,errorMessage:s}:{success:true,paymentMethodId:i}})}var sd={v:"5.12.1",fr:30,ip:0,op:201,w:700,h:700,nm:"Check",ddd:0,assets:[],layers:[{ddd:0,ind:1,ty:4,nm:"Shape Layer 8",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:315,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:2,ty:4,nm:"Shape Layer 7",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:270,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:3,ty:4,nm:"Shape Layer 6",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:225,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:4,ty:4,nm:"Shape Layer 5",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:180,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:5,ty:4,nm:"Shape Layer 4",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:135,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:6,ty:4,nm:"Shape Layer 3",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:90,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:7,ty:4,nm:"Shape Layer 2",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:45,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:8,ty:4,nm:"Shape Layer 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:9,ty:4,nm:"Check v",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:-1.9,ix:10},p:{a:0,k:[352,360,0],ix:2,l:2},a:{a:0,k:[-120.265,116.765,0],ix:1,l:2},s:{a:0,k:[278,278,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0],[0,0]],o:[[0,0],[0,0],[0,0]],v:[[-161,123],[-137,148],[-79.531,85.531]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:5.5,ix:5},lc:2,lj:2,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[0],y:[1]},o:{x:[.333],y:[0]},t:135,s:[0]},{t:148,s:[100]}],ix:1},e:{a:0,k:0,ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:135,op:201,st:-35,ct:1,bm:0},{ddd:0,ind:11,ty:4,nm:"Circle Stroke",sr:1,ks:{o:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0]},{t:7,s:[100]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[4,-6,0],ix:1,l:2},s:{a:0,k:[132,132,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[306,306],ix:2},p:{a:0,k:[0,0],ix:3},nm:"Ellipse Path 1",mn:"ADBE Vector Shape - Ellipse",hd:false},{ty:"st",c:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:30,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:61,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:87,s:[1,1,1,1]},{t:136,s:[1,1,1,1]}],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:8,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[4,-6],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Ellipse 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[50]},{t:122,s:[100]}],ix:1},e:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[45]},{t:122,s:[0]}],ix:2},o:{a:1,k:[{i:{x:[.474],y:[1]},o:{x:[.43],y:[0]},t:0,s:[-170.4]},{t:111,s:[-1250.4]}],ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:0,op:201,st:0,ct:1,bm:0},{ddd:0,ind:13,ty:1,nm:"Dark Gray Solid 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[350,350,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,sw:700,sh:700,sc:"#2d2d2d",ip:0,op:201,st:0,bm:0}],markers:[],props:{}};var Ux=lazy(()=>import('react-lottie')),hr=5e3,_x=e(ke)`
|
|
586
|
+
`,Uc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Bt();return jsx(kh,{children:r?jsx(Rc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsx(Lc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var _c=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:s})=>jsx(Bh,{onClick:r,value:n,control:jsx(wh,{checked:t,onChange:o,disabled:i,"data-testid":s}),label:Ah(e)?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var pi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:BS$1,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:IS$1,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:RS$1,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:US$1,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:ZW,example:"1234567890"}],ux="United States",gx=" # ",mr="us_ein",ur=(e,t)=>`${e}${gx}${t}`,mi=new Map(pi.map(e=>[ur(e.taxIdType,e.country),e])),It=e=>mi.get(e),gr=ur(mr,ux);var ui=e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var xx=e(fx)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),fr=e(f)({});fr.defaultProps={variant:"body1",color:"secondary"};function od(){let[e,t]=useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,s]=useState(gr),[l,a$1]=useState(false),c=useCallback((g,y,C)=>{n({type:y,value:C}),s(g);},[n,s]);useEffect(()=>{a$1(false);},[o==null?void 0:o.country]),useEffect(()=>{if(!(o!=null&&o.country)||l||!e)return;let g=pi.find(y=>y.countryCode===o.country);g&&c(ur(g.taxIdType,g.country),g.taxIdType,"");},[o,e,l,c]);let u=g=>{if(!g)return;let y=It(g);if(y){if(a$1(true),r!=null&&r.value){c(g,y.taxIdType,r.value);return}s(g),r!=null&&r.type&&n(void 0);}},f$1=useMemo(()=>Array.from(mi.keys()),[]),p=useMemo(()=>f$1.find(g=>g===i)||null,[f$1,i]),h=useMemo(()=>{let g=It(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return useEffect(()=>(e||(a$1(false),c(gr,mr,"")),()=>{c(gr,mr,"");}),[e,c]),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(Me,{flexDirection:"row",container:true,gap:2,children:jsx(_c,{checked:e,onChange:()=>t(g=>!g),label:jsx(fr,{children:"I'm purchasing as a business"})})}),jsx(yx,{in:e,children:jsxs(Me,{container:true,spacing:0,sx:{width:"100%"},children:[jsxs(Me,{item:true,xs:6,children:[jsx(fr,{children:"Tax ID Type"}),jsx(xx,{fullWidth:true,options:f$1,value:p,onChange:(g,y)=>u(y),renderInput:g=>jsx(ui,b(a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=It(y);if(!C)return null;let{taxIdType:b$1,country:x,FlagComponent:S}=C;return createElement(ou,b(a({},g),{key:y}),jsxs(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),ed(x)," - ",td(b$1)]}))},getOptionLabel:g=>{let y=It(g);return y?`${ed(y.country)} - ${td(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxs(Me,{item:true,xs:6,paddingLeft:"12px",children:[jsx(fr,{children:"Tax ID"}),jsx(ui,{id:"tax-id-value",placeholder:h,type:"text",fullWidth:true,value:(r==null?void 0:r.value)||"",onChange:g=>{let y=It(i);y&&c(i,y.taxIdType,g.target.value);}})]})]})})]})}function rd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o}){var g;let{checkoutState:r,checkoutLocalization:n,widgetState:i,setWidgetReadOnly:s}=U(),{setBillingAddress:l}=re(),{customer:a$1,configuration:c$1}=r||{},{readOnly:u}=i,f$1=!!(t!=null?t:(g=c$1==null?void 0:c$1.content)!=null&&g.collectPhoneNumber),p=useMemo(()=>o&&!(a$1!=null&&a$1.billingId)&&!(a$1!=null&&a$1.paymentMethodDetails),[o,a$1==null?void 0:a$1.billingId,a$1==null?void 0:a$1.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=c(S,["postal_code"]),x=a({postalCode:C},b);s(true),l(x),e?d(null,null,function*(){yield e({billingAddress:x}),s(false);}):s(false);};return jsxs(Me,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsx(AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f$1?"always":"auto"},defaultValues:a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name})}})]}),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsx(PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:a(a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name}),(a$1==null?void 0:a$1.email)&&{email:a$1.email})}}})]}),p&&jsx(od,{})]})}function nd(){let[e,t]=useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return useEffect(()=>{if(r){let{billingIdentifier:i,credentials:s}=r;if(i!==BillingVendorIdentifier.Stripe)return;let{accountId:l,publicKey:a}=s;if(!l||!a){console.error("Stripe account ID or public key is missing");return}import('@stripe/stripe-js').then(({loadStripe:c})=>{t(c(a,{stripeAccount:l}));});}},[r]),{stripePromise:e,setupIntentClientSecret:n}}function yr(){let e=wt(),[{resourceId:t}]=R(),{checkoutState:o}=U(),{plan:r}=o||{},n=e.addons.map(({addon:i,quantity:s})=>({addonId:i.id,quantity:s}));if(r!=null&&r.id)return a({resourceId:t,planId:r.id,billingPeriod:e.billingPeriod,billableFeatures:e.billableFeatures,addons:n,promotionCode:e.promotionCode,billingCountryCode:e.billingCountryCode},lr({taxIds:e.taxId?[e.taxId]:void 0}))}var Ax=[PaymentCollection.Failed,PaymentCollection.Processing];function Ix(t){return d(this,arguments,function*({elements:e}){if(!e){let r="Stripe elements not initialized";return console.error(r),{success:false,errorMessage:r}}let{error:o}=yield e.submit();return o?(console.log(o.message),{success:false,errorMessage:o.message||""}):{success:true}})}function Pi(o){return d(this,arguments,function*({applySubscriptionResults:e,stripe:t}){var s,l;let r=e==null?void 0:e.subscription,n=(s=r==null?void 0:r.latestInvoice)==null?void 0:s.paymentSecret,i=r==null?void 0:r.paymentCollection;if(t&&n&&i===PaymentCollection.ActionRequired){let{error:a}=yield t.handleNextAction({clientSecret:n});if(a)return {errorMessage:a.message||""}}else if(i&&Ax.includes(i))return {errorMessage:((l=r==null?void 0:r.latestInvoice)==null?void 0:l.errorMessage)||"An error occurred - try again later"};return {subscription:r}})}function Fx(r){return d(this,arguments,function*({stripe:e,elements:t,clientSecret:o}){let n,i,{error:s}=yield e.confirmSetup({elements:t,confirmParams:{return_url:window.location.href},redirect:"if_required"});if(s)s.type==="card_error"||s.type==="validation_error"?s.type==="card_error"&&(i=s.message||""):i="An unexpected error occurred.";else try{let{setupIntent:l}=yield e.retrieveSetupIntent(o);l!=null&&l.payment_method&&(n=l.payment_method);}catch(l){i="An unexpected error occurred.",console.error(l);}return {newPaymentMethodId:n,setupErrorMessage:i}})}function id(r){return d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield Ix({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:s}=yield Fx({stripe:e,elements:t,clientSecret:o});return s||!i?{success:false,errorMessage:s}:{success:true,paymentMethodId:i}})}var ad={v:"5.12.1",fr:30,ip:0,op:201,w:700,h:700,nm:"Check",ddd:0,assets:[],layers:[{ddd:0,ind:1,ty:4,nm:"Shape Layer 8",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:315,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:2,ty:4,nm:"Shape Layer 7",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:270,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:3,ty:4,nm:"Shape Layer 6",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:225,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:4,ty:4,nm:"Shape Layer 5",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:180,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:5,ty:4,nm:"Shape Layer 4",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:135,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:6,ty:4,nm:"Shape Layer 3",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:90,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:7,ty:4,nm:"Shape Layer 2",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:45,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:8,ty:4,nm:"Shape Layer 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:9,ty:4,nm:"Check v",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:-1.9,ix:10},p:{a:0,k:[352,360,0],ix:2,l:2},a:{a:0,k:[-120.265,116.765,0],ix:1,l:2},s:{a:0,k:[278,278,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0],[0,0]],o:[[0,0],[0,0],[0,0]],v:[[-161,123],[-137,148],[-79.531,85.531]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:5.5,ix:5},lc:2,lj:2,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[0],y:[1]},o:{x:[.333],y:[0]},t:135,s:[0]},{t:148,s:[100]}],ix:1},e:{a:0,k:0,ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:135,op:201,st:-35,ct:1,bm:0},{ddd:0,ind:11,ty:4,nm:"Circle Stroke",sr:1,ks:{o:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0]},{t:7,s:[100]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[4,-6,0],ix:1,l:2},s:{a:0,k:[132,132,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[306,306],ix:2},p:{a:0,k:[0,0],ix:3},nm:"Ellipse Path 1",mn:"ADBE Vector Shape - Ellipse",hd:false},{ty:"st",c:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:30,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:61,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:87,s:[1,1,1,1]},{t:136,s:[1,1,1,1]}],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:8,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[4,-6],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Ellipse 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[50]},{t:122,s:[100]}],ix:1},e:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[45]},{t:122,s:[0]}],ix:2},o:{a:1,k:[{i:{x:[.474],y:[1]},o:{x:[.43],y:[0]},t:0,s:[-170.4]},{t:111,s:[-1250.4]}],ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:0,op:201,st:0,ct:1,bm:0},{ddd:0,ind:13,ty:1,nm:"Dark Gray Solid 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[350,350,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,sw:700,sh:700,sc:"#2d2d2d",ip:0,op:201,st:0,bm:0}],markers:[],props:{}};var hr=5e3,Rx=e(ke)`
|
|
587
587
|
@keyframes blurFade {
|
|
588
588
|
0% {
|
|
589
589
|
background-color: ${({theme:e})=>bi(e.stigg.palette.backgroundPaper).alpha(0).toString()};
|
|
@@ -614,7 +614,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
614
614
|
& path {
|
|
615
615
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
616
616
|
}
|
|
617
|
-
`,
|
|
617
|
+
`,Ux=e(f)`
|
|
618
618
|
@keyframes fadeIn {
|
|
619
619
|
0% {
|
|
620
620
|
opacity: 0;
|
|
@@ -629,7 +629,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
629
629
|
|
|
630
630
|
align-self: center;
|
|
631
631
|
animation: fadeIn 5s ease-in forwards;
|
|
632
|
-
`;function ld({checkoutLocalization:e}){let t=useRef();return useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxs(
|
|
632
|
+
`;function ld({checkoutLocalization:e}){let t=useRef();return useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxs(Rx,{className:"stigg-checkout-success-container",ref:t,children:[jsx(Mx,{options:{animationData:ad,loop:false,autoplay:true},width:350,height:"auto",style:{display:"flex",justifyContent:"center"}}),jsx(Ux,{variant:"h1",color:"primary.main",children:e.summary.checkoutSuccessText})]})}var Gx=e=>new Promise(t=>setTimeout(t,e));function cd({isMocked:e=false,onCheckout:t,onCheckoutCompleted:o,onSuccess:r,disableSuccessAnimation:n}){let{stigg:i}=u(),{useNewPaymentMethod:s}=re(),l=yr(),{checkoutState:a$1,widgetState:c,setWidgetReadOnly:u$1}=U(),{setupSecret:f,customer:p}=a$1||{},h=useStripe(),g=useElements();return {handleSubmit:C=>d(null,null,function*(){if(C.preventDefault(),!l)return {success:false,errorMessage:"Unexpected error, please contact support."};let b$1=true,x,S=false,T;if(u$1(true),!e&&s){let k=yield id({elements:g,stripe:h,setupIntentClientSecret:f});k.success?T=k.paymentMethodId:(x=k.errorMessage,b$1=false);}let F=b(a({},l),{paymentMethodId:T}),w=k=>d(null,null,function*(){S=true;try{let L=yield i.applySubscription(k),E=yield Pi({applySubscriptionResults:L,stripe:h});return {success:!E.errorMessage,errorMessage:E.errorMessage,results:L}}catch(L){return console.error(L),x=L==null?void 0:L.message,{success:false,errorMessage:x}}}),I;if(b$1)if(t){let k=yield t({customerId:p.id,checkoutParams:F,checkoutAction:w});if(k.errorMessage&&(x=k.errorMessage),!S&&k.results&&k.success){let L=yield Pi({applySubscriptionResults:k.results,stripe:h});L.errorMessage&&(x=L.errorMessage,b$1=false);}b$1=b$1&&k.success&&!x,I=k.results;}else {let k=yield w(F);!k.success&&k.errorMessage&&(x=k.errorMessage),b$1=k.success&&!x,I=k.results;}return u$1(false),b$1&&r&&(r(),n||(yield Gx(hr))),yield o({success:b$1,error:x}),{results:I,success:!x,errorMessage:x}}),isLoading:!!(c!=null&&c.readOnly)}}function dd(){return !!window.Zuora}function pd(){let e=document.createElement("script");e.type="text/javascript",e.src="https://js.zuora.com/payment/v3/zuora.js",e.async=true,e.onerror=()=>{throw new Error("Failed to load Zuora library")},document.head.appendChild(e);}function md(e,t,o,r){return {locale:r||"en",region:(r==null?void 0:r.toUpperCase())||"US",currency:o,amount:"1",createPaymentSession:e,onComplete:t}}function Ft(){let{stigg:e}=u(),{setErrorMessage:t}=re(),{billingCountryCode:o}=Pe(),[r,n]=useState(false),{checkoutState:i}=U(),{billingIntegration:s}=i||{},l=useCallback(()=>d(null,null,function*(){if(!(i!=null&&i.customer.id)||!(i!=null&&i.plan.id))throw new Error("Customer and plan are required");let{token:u}=yield e.createPaymentSession({planId:i.plan.id,billingCountryCode:o});return u}),[i,e,o]),a=useCallback(()=>{try{dd()||pd(),n(!0);}catch(u){t("Failed to initialize Zuora");}},[n,t]);return useEffect(()=>{if(s){let{billingIdentifier:u}=s;u===BillingVendorIdentifier.Zuora&&a();}},[s,a]),{isZuoraIntegration:(s==null?void 0:s.billingIdentifier)===BillingVendorIdentifier.Zuora,isInitialized:r,createPaymentSession:l}}var Ox=e=>new Promise(t=>setTimeout(t,e));function Cr({onCheckout:e,onCheckoutCompleted:t,onSuccess:o,disableSuccessAnimation:r}){let{stigg:n}=u(),i=yr(),{checkoutState:s,setWidgetReadOnly:l,setCheckoutSuccess:a$1}=U(),{setErrorMessage:c}=re();return {handleZuoraSubmit:useCallback(f=>d(null,null,function*(){l(true);let p=true,h,g=i;if(!g)p=false,h="Unexpected error, please contact support.";else {let y=b(a({},g),{paymentMethodId:f}),C=b=>d(null,null,function*(){try{return {success:!0,results:yield n.applySubscription(b)}}catch(x){return console.error(x),{success:false,errorMessage:(x==null?void 0:x.message)||"Failed to apply subscription"}}});try{if(e){let b=yield e({customerId:s.customer.id,checkoutParams:y,checkoutAction:C});b.errorMessage&&(h=b.errorMessage),p=p&&b.success&&!h;}else {let b=yield C(y);!b.success&&b.errorMessage&&(h=b.errorMessage),p=b.success&&!h;}}catch(b){p=false,h=b.message||"Failed to process checkout";}}return p?(a$1(true),o&&(o(),r||(yield Ox(hr)))):c(h),l(false),yield t({success:p,error:h}),{success:p,errorMessage:h}}),[n,i,s,e,t,o,r,l,a$1,c])}}var Ie=({isLoading:e,width:t=50,height:o$1=16,children:r})=>e?jsx(o,{width:t,height:o$1}):jsx(Fragment,{children:r});var Yx=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{var s,l,a,c;let{immediateInvoice:r}=e||{};if(!((l=(s=r==null?void 0:r.proration)==null?void 0:s.netAmount)!=null&&l.amount)||((c=(a=r==null?void 0:r.proration)==null?void 0:a.netAmount)==null?void 0:c.amount)>=0)return null;let n=r.proration.netAmount.amount*-1,i=H({amount:n,currency:r.proration.netAmount.currency,minimumFractionDigits:2});return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-remaining-credits",children:jsx(Ie,{isLoading:t,width:"100%",children:o.summary.creditsForUnusedTimeText({credits:i})})})},Qx=({subscriptionPreview:e,activeSubscription:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>{if(!(e!=null&&e.hasScheduledUpdates)||!(t!=null&&t.currentBillingPeriodEnd))return null;let{currentBillingPeriodEnd:n}=t,i=typeof r.summary.changesWillApplyAtEndOfBillingPeriod=="function"?r.summary.changesWillApplyAtEndOfBillingPeriod({billingPeriodEnd:n}):r.summary.changesWillApplyAtEndOfBillingPeriod;return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-scheduled-updates",children:jsx(Ie,{isLoading:o,width:"100%",children:i})})},Kx=({subscriptionPreview:e,activeSubscription:t,plan:o,isFetchingSubscriptionPreview:r,billingPeriod:n,checkoutLocalization:i})=>{let{promotionCode:s}=Bt();if(!e)return null;let l=i.nextBillingCaption({plan:o,subscriptionPreview:e,billingPeriod:n,activeSubscription:t,promotionCode:s});return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-next-billing",children:jsx(Ie,{isLoading:r,width:"100%",children:l})})};function yd(e){return jsxs(ke,{className:"stigg-checkout-summary-captions",children:[jsx(Yx,a({},e)),jsx(Qx,a({},e)),e.plan&&jsx(Kx,a({},e))]})}function Si({quantity:e,totalAmount:t,pricingModel:o,billingPeriod:r,currency:n,blockSize:i,priceAmount:s,availableBillingPeriods:l}){let a=l==null?void 0:l.has(BillingPeriod.Monthly),c=o===BillingModel.PerUnit,u=i||1,f=r===BillingPeriod.Annually&&a,p=e&&(c||e>1)?`${k(e)} ${u>1?"for":"x"} `:"",h=f?" x 12 months":"",g=(s||t/e)/(f?12:1),y=H({amount:g,currency:n,minimumFractionDigits:2}),C=H({amount:t,currency:n,minimumFractionDigits:2});return `${p}${y}${h} ${h||p?` = ${C}`:""}`}function Cd(e){let{totalAmount:t,quantity:o,tiersMode:r,tiers:n,currency:i}=e;if(va(n)||r===TiersMode.Graduated&&!Ea(n,o)){let s=H({amount:t,currency:i,minimumFractionDigits:2});return `${k(o)} for ${s}`}return Si(e)}function eP(e,t){let{unitPrice:o,upTo:r}=e[t];if(!o)return "";if(t===0)return `First ${r}`;let i=(e[t-1].upTo||0)+1;return Po(r)?`${k(i)} and above`:`Next ${k(i)} to ${k(r)}`}function xd({price:e,unitQuantity:t}){let o=e.tiers||[],{checkoutState:r}=U(),n=r==null?void 0:r.plan,{breakdown:i}=cn(o,t);return i.length===1?null:jsx(Fragment,{children:i.map(({unitQuantity:s,amount:l},a)=>jsx(De,{children:jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:eP(o,a)}),jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:Si({quantity:s,totalAmount:l,currency:e.currency,pricingModel:e.pricingModel,billingPeriod:e.billingPeriod,tiers:e.tiers,tiersMode:e.tiersMode,blockSize:e.blockSize,priceAmount:e.amount,availableBillingPeriods:new Set(n==null?void 0:n.pricePoints.map(c=>c.billingPeriod))})})]})},a))})}var Pd=e(ChevronRight)`
|
|
633
633
|
height: ${({$size:e=24})=>`${e}px`};
|
|
634
634
|
width: ${({$size:e=24})=>`${e}px`};
|
|
635
635
|
transition: all 0.2s ease-in;
|
|
@@ -638,7 +638,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
638
638
|
& + & {
|
|
639
639
|
margin-top: 16px;
|
|
640
640
|
}
|
|
641
|
-
`,
|
|
641
|
+
`,mP=e.div`
|
|
642
642
|
margin-top: 16px;
|
|
643
643
|
margin-left: 16px;
|
|
644
644
|
`,Fe=e.div`
|
|
@@ -651,25 +651,25 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
651
651
|
align-items: center;
|
|
652
652
|
justify-content: space-between;
|
|
653
653
|
}
|
|
654
|
-
`,
|
|
654
|
+
`,uP=({checkoutLocalization:e})=>{let t=jsx(f,{variant:"body1",children:e.summary.payAsYouGoTooltipText});return jsx(Ve,{placement:"left",title:t,children:jsx(i,{icon:"PayAsYouGoCharge",style:{display:"flex"}})})},br=({checkoutLocalization:e,label:t,quantity:o,price:r})=>{let{checkoutState:n}=U(),i=n==null?void 0:n.plan,s=de("lg"),[l,a]=useState(false),c=()=>a(y=>!y),u=r.pricingModel===BillingModel.UsageBased,f$1=r.isTieredPrice?ht(r,o):(r.amount||0)*Math.ceil(o/(r.blockSize||1)),p;r.tiersMode===TiersMode.Graduated&&!!r.tiers&&!Bg(r.tiers)&&!Po(r.tiers[0].upTo)&&o>r.tiers[0].upTo&&(p=jsx(xd,{price:r,unitQuantity:o}));let g=jsx(f,{variant:"body1",color:"secondary",children:t});return p&&(g=jsx(xf,{onClick:c,underline:"none",style:{cursor:"pointer"},children:g})),jsxs(De,{className:"stigg-checkout-summary-base-charges-container",children:[jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsxs(Me,{item:true,display:"flex",gap:.5,style:{whiteSpace:s?"nowrap":"break-spaces"},children:[g,p&&jsx(dP,{onClick:c,sx:{padding:0},children:jsx(Pd,{$isOpen:l,$size:16})})]}),jsxs(Me,{item:true,display:"flex",gap:1,alignItems:"center",children:[u&&jsx(uP,{checkoutLocalization:e}),jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:s?"nowrap":"break-spaces"},children:[Cd({totalAmount:f$1,quantity:o,currency:r.currency,pricingModel:r.pricingModel,billingPeriod:r.billingPeriod,tiers:r.tiers,tiersMode:r.tiersMode,blockSize:r.blockSize,priceAmount:r.amount,availableBillingPeriods:new Set(i==null?void 0:i.pricePoints.map(y=>y.billingPeriod))}),u&&" / unit"]})]})]}),p&&jsx(yx,{in:l,children:jsx(mP,{children:p})})]})},bd=({label:e})=>jsx(De,{children:jsxs(Fe,{style:{alignItems:"flex-end"},children:[jsx(Me,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:e})}),jsx(Me,{item:true,display:"flex",gap:1,alignItems:"center",children:jsx(f,{variant:"body1",color:"secondary",style:{wordBreak:"break-word"},children:"Free"})})]})}),Sd=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o$1})=>{let{immediateInvoice:r,recurringInvoice:n}=e,{discount:i,discountDetails:s}=n||{};return !i||!s?null:jsx(De,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:o$1.summary.discountText({discountDetails:s,currency:r.total.currency})}),jsx(f,{variant:"body1",color:"secondary",children:t?jsx(o,{width:50,height:16}):H({amount:i.amount,currency:i.currency,minimumFractionDigits:2})})]})})},Td=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{let{immediateInvoice:r}=e||{},{credits:n}=r||{};return !n||!n.used||n.used.amount<=0?null:jsx(De,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:o.summary.appliedCreditsTitle}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:t,children:H({amount:-1*n.used.amount,currency:n.used.currency,minimumFractionDigits:2})})})]})})},kd=({tax:e,taxDetails:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>!t||!e||(e==null?void 0:e.amount)<=0?null:jsx(De,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:r.summary.taxTitle({taxDetails:t})}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:o,children:H({amount:e==null?void 0:e.amount,currency:e==null?void 0:e.currency,minimumFractionDigits:2})})})]})});var wi=e(ke)`
|
|
655
655
|
width: 100%;
|
|
656
656
|
max-width: 470px;
|
|
657
657
|
flex: 1.5;
|
|
658
|
-
`,Sr=e(
|
|
658
|
+
`,Sr=e(xP)`
|
|
659
659
|
background: ${({theme:e})=>e.stigg.palette.backgroundHighlight};
|
|
660
660
|
padding: 16px;
|
|
661
661
|
|
|
662
662
|
${oe.md} {
|
|
663
663
|
border-radius: 10px;
|
|
664
664
|
}
|
|
665
|
-
`;Sr.defaultProps={elevation:0};var
|
|
665
|
+
`;Sr.defaultProps={elevation:0};var bP=e(f)`
|
|
666
666
|
margin-bottom: 16px;
|
|
667
667
|
font-weight: 500;
|
|
668
|
-
`,vt=e(
|
|
668
|
+
`,vt=e(Cl)`
|
|
669
669
|
margin: 16px 0;
|
|
670
670
|
`,Bd=e(f)`
|
|
671
671
|
margin-bottom: 8px;
|
|
672
|
-
`;function
|
|
672
|
+
`;function SP({isLastStep:e,checkoutHasChanges:t,isFreeDowngrade:o,checkoutLocalization:r,isPlanUpdate:n}){return e?t?n?r.checkoutButton.updateText:o?r.checkoutButton.downgradeToFreeText:r.checkoutButton.upgradeText:r.checkoutButton.noChangesText:r.checkoutButton.nextText}var Ad=({onCheckout:e,onCheckoutCompleted:t,disablePromotionCode:o,disableSuccessAnimation:r,isFreeDowngrade:n,onMockCheckoutPreview:i$1,showWatermark:s})=>{var ia,aa,sa,la;let[l,a$1]=useState(false),{setErrorMessage:c,useNewPaymentMethod:u}=re(),f$1=Ue(),p=wt(),{checkoutState:h,checkoutLocalization:g,checkoutSuccess:y,widgetState:C}=U(),{plan:b$1,activeSubscription:x}=h||{},S=dr(((ia=b$1==null?void 0:b$1.pricePoints)==null?void 0:ia.filter(D=>D.billingPeriod===p.billingPeriod))||[]),[T,F]=fP(S,D=>D.pricingModel===BillingModel.FlatFee),w=T[0],I=n||f$1.isCheckoutComplete&&f$1.isLastStep,{isZuoraIntegration:k}=Ft(),L=l||y,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,errorMessage:Z}=mc({onMockCheckoutPreview:i$1}),{handleSubmit:$,isLoading:_}=cd({isMocked:!!i$1,disableSuccessAnimation:r,onCheckout:e,onCheckoutCompleted:t,onSuccess:()=>{a$1(true),f$1.markStepAsCompleted(f$1.progressBarState.activeStep);}}),{handleZuoraSubmit:z}=Cr({onCheckout:e,onCheckoutCompleted:t,disableSuccessAnimation:r,onSuccess:()=>{f$1.markStepAsCompleted(f$1.progressBarState.activeStep);}}),q$1=D=>d(null,null,function*(){if(L)return;let we;k&&!u?we=yield z():we=yield $(D);let{errorMessage:ge}=we||{};ge?(c(ge),a$1(false)):c(void 0);}),Ge=k&&!u?C.readOnly:_,pt=D=>d(null,null,function*(){Ge||(I?yield q$1(D):f$1.goNext());}),{immediateInvoice:V,recurringInvoice:xe}=E||{},Xi=!!E&&(!!(V!=null&&V.proration)||!!E.hasScheduledUpdates),ji=!o&&!n&&!k,ea=!!(xe!=null&&xe.discountDetails)&&!n,Yr=ji||ea,ta=F.some(D=>D.pricingModel===BillingModel.UsageBased),Qr=ta&&!w&&F.every(D=>D.pricingModel===BillingModel.UsageBased),oa=typeof g.summary.baseChargeText=="function"?g.summary.baseChargeText({billingPeriod:p.billingPeriod}):g.summary.baseChargeText,ra=useMemo(()=>{var D,we;return (we=(D=p.addons)==null?void 0:D.filter(ge=>!at(ge.addon)))!=null?we:[]},[p.addons]),na=useMemo(()=>ra.filter(D=>{var ge;return !!((ge=D.addon.pricePoints)==null?void 0:ge.find(mt=>mt.billingPeriod===p.billingPeriod))}).map(D=>{let we=D.addon.pricePoints.find(mt=>mt.billingPeriod===p.billingPeriod),ge=D.quantity&&D.quantity>0?D.quantity:1;return jsx(br,{checkoutLocalization:g,label:D.addon.displayName,quantity:ge,price:we},D.addon.id)}),[ra,p.billingPeriod,g]);return jsxs(wi,{className:"stigg-checkout-summary-container",children:[jsxs(Sr,{children:[jsx(bP,{variant:"h3",children:g.summary.title}),jsxs(Me,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.planName({plan:b$1})}),jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),w&&jsx(br,{checkoutLocalization:g,label:oa,quantity:1,price:w}),!w&&n?jsx(bd,{label:oa}):null,jsx(Me,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:F.map((D,we)=>{var mt,ca,da,pa,ma;let ge=(mt=p.billableFeatures)==null?void 0:mt.find(nm=>{var ua;return nm.featureId===((ua=D.feature)==null?void 0:ua.featureId)});return jsx(br,{checkoutLocalization:g,label:Tt(((da=D.feature)==null?void 0:da.displayName)||"",(pa=D.feature)==null?void 0:pa.units,(ma=D.feature)==null?void 0:ma.unitsPlural),quantity:(ge==null?void 0:ge.quantity)||1,price:D},((ca=D.feature)==null?void 0:ca.featureId)||`usage-charge-${we}`)})}),na.length>0&&jsxs(Fragment,{children:[jsxs(Me,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.addonsSectionTitle}),jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),na]}),!Yr&&jsx(vt,{className:"stigg-checkout-summary-divider"}),Yr&&jsxs(Me,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.discountsSectionTitle}),jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),ji&&jsx(Uc,{disabled:Ge||A,checkoutLocalization:g,onMockCheckoutPreview:i$1}),ea&&E&&jsx(Sd,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),Yr&&jsx(vt,{className:"stigg-checkout-summary-divider"}),jsx(kd,{tax:xe==null?void 0:xe.tax,taxDetails:xe==null?void 0:xe.taxDetails,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),n?null:jsxs(Fragment,{children:[jsx(Fe,{style:{marginTop:16},children:jsxs(Me,{display:"flex",flexDirection:"column",container:true,children:[jsxs(Me,{item:true,display:"flex",justifyContent:"space-between",children:[jsx(f,{variant:"h6",children:g.summary.totalText}),jsx(f,{variant:"h6",children:jsxs(Ie,{isLoading:A,children:[Qr?g.summary.onlyPayAsYouGoText:null,!Qr&&ta?g.summary.startsAtText:null,Qr?null:H(b(a({amount:0},xe==null?void 0:xe.total),{minimumFractionDigits:2}))]})})]}),jsx(Me,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:g.summary.totalBillingPeriodText({billingPeriod:p.billingPeriod})})})]})}),jsx(vt,{className:"stigg-checkout-summary-divider"})]}),(aa=V==null?void 0:V.proration)!=null&&aa.hasProrations&&(V!=null&&V.subTotal)&&(V==null?void 0:V.subTotal.amount)>0?jsx(De,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:g.summary.proratedTotalDueText}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:A,children:H({amount:Number(((sa=V==null?void 0:V.subTotal)==null?void 0:sa.amount)||0)+Number(((la=V==null?void 0:V.tax)==null?void 0:la.amount)||0),currency:V==null?void 0:V.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsx(Td,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),jsx(De,{children:jsxs(Fe,{children:[jsx(Bd,{variant:"h6",children:g.summary.totalDueText}),jsx(Bd,{variant:"h6",children:jsx(Ie,{isLoading:A,children:H(b(a({amount:0},V==null?void 0:V.total),{minimumFractionDigits:2}))})})]})}),jsx(yd,{plan:b$1,activeSubscription:x,subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g,billingPeriod:p.billingPeriod}),(!I||!k||k&&!u)&&jsxs(Fragment,{children:[jsx(te,{$success:L,$error:I&&n,disabled:Ge||A||f$1.progressBarState.isDisabled||I&&!Xi||!!Z,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:D=>{pt(D);},fullWidth:true,children:jsx(f,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:L?jsx(i,{icon:"Check",style:{display:"contents"}}):Ge||A?jsx(xh,{size:20,sx:{color:"white"}}):SP({isLastStep:I,checkoutHasChanges:Xi,isFreeDowngrade:n,checkoutLocalization:g,isPlanUpdate:!!x&&(x==null?void 0:x.plan.id)===(b$1==null?void 0:b$1.id)})})}),Z&&jsx(PP,{severity:"error",sx:{alignItems:"center",marginTop:"12px"},children:jsx(f,{overrideColor:"inherit",children:Z})})]})]}),jsx(q,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&L&&jsx(ld,{checkoutLocalization:g})]})};var Id=({showWatermark:e})=>jsxs(wi,{children:[jsxs(Sr,{children:[jsxs(l,{$flexDirection:"column",$gap:24,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsxs(l,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsx(o,{height:20}),jsx(o,{height:20}),jsx(o,{height:20})]}),jsx(n,{flex:1,marginTop:5,children:jsx(o,{height:34})})]}),jsx(q,{source:"checkout",showWatermark:e,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var vd=e(Me)`
|
|
673
673
|
width: 100%;
|
|
674
674
|
gap: 8px;
|
|
675
675
|
`,Ed=e(Me)`
|
|
@@ -692,25 +692,25 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
692
692
|
width: 41px;
|
|
693
693
|
height: 41px;
|
|
694
694
|
padding: 0;
|
|
695
|
-
`;var
|
|
695
|
+
`;var kP=styled(Me)`
|
|
696
696
|
display: flex;
|
|
697
697
|
flex-direction: row;
|
|
698
698
|
align-items: center;
|
|
699
699
|
width: 100%;
|
|
700
700
|
justify-content: flex-end;
|
|
701
|
-
`;function Rd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i$1,handleQuantityChange:s,handleUndo:l,handleRemoveAddon:a}){var p;let c=de("lg"),u=!!t,f$1=e.maxQuantity!==1;return jsxs(
|
|
701
|
+
`;function Rd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i$1,handleQuantityChange:s,handleUndo:l,handleRemoveAddon:a}){var p;let c=de("lg"),u=!!t,f$1=e.maxQuantity!==1;return jsxs(kP,{item:true,sx:{gap:"16px"},container:!c,children:[o&&jsx(te,{variant:"text",size:"small",sx:{padding:"8px",minWidth:"unset"},onClick:l,children:jsx(f,{color:"primary.main",variant:"body1",children:"Undo"})}),u&&jsxs(Me,{sx:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[f$1&&jsx(ce,{id:`${e.id}-input`,type:"number",onWheel:Ct,sx:c?{marginX:2,width:"100%"}:{flex:1},value:(p=t==null?void 0:t.quantity)!=null?p:"",error:!!r,helperText:r,FormHelperTextProps:{sx:{margin:"4px"}},onChange:h=>{var g,y;return s((g=h==null?void 0:h.target)!=null&&g.value?Number((y=h==null?void 0:h.target)==null?void 0:y.value):null)},onFocus:h=>h.target.select()}),jsx(Ld,{color:"error",onClick:a,children:jsx(i,{icon:"Trash",style:{display:"flex",padding:"8px"}})})]}),!u&&jsx(te,{sx:{paddingX:"22px",paddingY:"8px"},onClick:()=>s(1),disabled:!n,children:jsx(f,{color:n?"primary.main":"disabled",variant:"body1",children:i$1.addAddonText})})]})}var AP=e(Me)`
|
|
702
702
|
display: flex;
|
|
703
703
|
flex-direction: column;
|
|
704
704
|
justify-content: center;
|
|
705
705
|
width: 100%;
|
|
706
706
|
height: 42px;
|
|
707
|
-
`;function Ud({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxs(
|
|
707
|
+
`;function Ud({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxs(AP,{item:true,children:[jsx(f,{variant:"h6",lineHeight:"24px",children:e.displayName}),r?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:`${H({amount:r.amount,currency:r.currency,minimumFractionDigits:2})}/${t===BillingPeriod.Annually?"year":"month"}`}):jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:o.addonBillingPeriodNotAvailableText({planBillingPeriod:t})})]})}function vP({addon:e,billingPeriod:t,addonState:o,initialAddonState:r,setAddon:n,removeAddon:i,checkoutLocalization:s,onAddonsValidationChange:l,onAddonChange:a}){let[c,u]=useState(void 0),f=!!o&&!!r&&o.quantity!==r.quantity||!!r&&!o,p=e.pricePoints.some(C=>C.billingPeriod===t),h=C=>d(null,null,function*(){if(!C||C<=0){l({addonId:e.id,isValid:false}),u("Minimum 1"),n(e,C!=null?C:null);return}let b=yield a==null?void 0:a({addon:e,quantity:C});u(b==null?void 0:b.errorMessage),l({addonId:e.id,isValid:!(b!=null&&b.disableNextStep)}),n(e,C);}),g=()=>d(null,null,function*(){yield a==null?void 0:a({addon:e,quantity:0}),i(e.id),l({addonId:e.id,isValid:true});});return jsxs(Ed,{children:[jsx(Ud,{addon:e,billingPeriod:t,checkoutLocalization:s}),jsx(Rd,{addon:e,addonState:o,hasChanges:f,handleUndo:()=>d(null,null,function*(){if(r){let C=yield a==null?void 0:a({addon:e,quantity:r.quantity});l({addonId:e.id,isValid:!(C!=null&&C.disableNextStep)}),n(e,r.quantity);}else yield g();l({addonId:e.id,isValid:true});}),errorMessage:c,handleQuantityChange:h,isPriceForBillingPeriodAvailable:p,checkoutLocalization:s,handleRemoveAddon:g})]})}function Dd({onAddonChange:e}){let{checkoutLocalization:t,setIsValid:o}=U(),{billingPeriod:r}=Pe(),{setIsDisabled:n}=Ue(),{initialAddons:i,addons:s,availableAddons:l,setAddon:a$1,removeAddon:c}=jl(),[u,f]=useState((l==null?void 0:l.reduce((p,h)=>(p[h.id]=true,p),{}))||{});return useEffect(()=>{let p=Object.values(u).some(h=>!h);n(p),o(!p);},[u,n,o]),jsx(vd,{container:true,children:l==null?void 0:l.map(p=>{let h=s.find(y=>y.addon.id===p.id),g=i==null?void 0:i.find(y=>y.addon.id===p.id);return jsx(vP,{addon:p,billingPeriod:r,addonState:h,initialAddonState:g,setAddon:a$1,removeAddon:c,checkoutLocalization:t,onAddonsValidationChange:({addonId:y,isValid:C})=>f(b(a({},u),{[y]:C})),onAddonChange:e},p.id)})})}var Ii=e(Me,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
708
708
|
padding: 8px;
|
|
709
709
|
border-radius: 10px;
|
|
710
710
|
border: 1px solid ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
711
711
|
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
712
712
|
opacity: ${({$disabled:e})=>e?.6:1};
|
|
713
|
-
`,$d=e(
|
|
713
|
+
`,$d=e(Ii)`
|
|
714
714
|
flex-direction: column;
|
|
715
715
|
align-items: unset;
|
|
716
716
|
${({$hideBorders:e})=>e&&css`
|
|
@@ -725,13 +725,13 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
725
725
|
`,zd=e(Me)`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
|
-
`;var
|
|
728
|
+
`;var $P=e(ke)`
|
|
729
729
|
position: relative;
|
|
730
730
|
max-width: 500px;
|
|
731
|
-
`,
|
|
731
|
+
`,GP=e(ke)`
|
|
732
732
|
opacity: ${({$showLoading:e})=>e?.6:1};
|
|
733
733
|
pointer-events: ${({$showLoading:e})=>e?"none":"auto"};
|
|
734
|
-
`,
|
|
734
|
+
`,zP=e(ke)`
|
|
735
735
|
position: absolute;
|
|
736
736
|
top: 40px;
|
|
737
737
|
left: 0;
|
|
@@ -743,16 +743,16 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
743
743
|
justify-content: center;
|
|
744
744
|
border-radius: 4px;
|
|
745
745
|
z-index: 10;
|
|
746
|
-
`,
|
|
746
|
+
`,VP=e(ke)`
|
|
747
747
|
display: flex;
|
|
748
748
|
flex-direction: column;
|
|
749
749
|
align-items: center;
|
|
750
750
|
gap: 12px;
|
|
751
|
-
`;function Vd({onCheckout:e,onCheckoutCompleted:t}){var C,b,x;let{isZuoraIntegration:o,isInitialized:r,createPaymentSession:n}=Ft(),{setErrorMessage:i}=re(),{billingCountryCode:s}=Pe(),{checkoutState:l,widgetState:a}=U(),{handleZuoraSubmit:c}=Cr({onCheckout:e,onCheckoutCompleted:t}),u=useRef(false),[f,p]=ii.useState(false),h=((x=(b=(C=l==null?void 0:l.plan)==null?void 0:C.pricePoints)==null?void 0:b[0])==null?void 0:x.currency)||Currency.Usd,{publishableKey:g}=l==null?void 0:l.billingIntegration.billingCredentials,y=useCallback(S=>d(null,null,function*(){var T;if(!S.success||!S.paymentMethodId){let F=((T=S.error)==null?void 0:T.message)||"Payment failed";i(F),yield t({success:false,error:F});return}yield c(S.paymentMethodId);}),[c,i,t]);return useEffect(()=>(d(null,null,function*(){if(!(!r||u.current)){p(true),i(void 0);try{u.current=!0;let T=window.Zuora(g),F=md(n,y,h,s);(yield T.createPaymentForm(F)).mount("#zuora_payment");}catch(T){u.current=false,i("Failed to render Zuora payment form");}finally{p(false);}}}),()=>{u.current=false;}),[r]),o?jsxs(
|
|
751
|
+
`;function Vd({onCheckout:e,onCheckoutCompleted:t}){var C,b,x;let{isZuoraIntegration:o,isInitialized:r,createPaymentSession:n}=Ft(),{setErrorMessage:i}=re(),{billingCountryCode:s}=Pe(),{checkoutState:l,widgetState:a}=U(),{handleZuoraSubmit:c}=Cr({onCheckout:e,onCheckoutCompleted:t}),u=useRef(false),[f,p]=ii.useState(false),h=((x=(b=(C=l==null?void 0:l.plan)==null?void 0:C.pricePoints)==null?void 0:b[0])==null?void 0:x.currency)||Currency.Usd,{publishableKey:g}=l==null?void 0:l.billingIntegration.billingCredentials,y=useCallback(S=>d(null,null,function*(){var T;if(!S.success||!S.paymentMethodId){let F=((T=S.error)==null?void 0:T.message)||"Payment failed";i(F),yield t({success:false,error:F});return}yield c(S.paymentMethodId);}),[c,i,t]);return useEffect(()=>(d(null,null,function*(){if(!(!r||u.current)){p(true),i(void 0);try{u.current=!0;let T=window.Zuora(g),F=md(n,y,h,s);(yield T.createPaymentForm(F)).mount("#zuora_payment");}catch(T){u.current=false,i("Failed to render Zuora payment form");}finally{p(false);}}}),()=>{u.current=false;}),[r]),o?jsxs($P,{children:[jsx(GP,{id:"zuora_payment",$showLoading:a.readOnly||f}),(a.readOnly||f)&&jsx(zP,{children:jsx(VP,{children:jsx(xh,{size:28})})})]}):null}function Od({checked:e,text:t,subtitle:o,readOnly:r}){return jsxs(Gd,{children:[jsx(WP,{checked:e,disabled:r}),jsxs(zd,{container:true,children:[jsx(Me,{item:true,children:t}),o&&jsx(Me,{item:true,children:o})]})]})}function Wd({checked:e,paymentMethodDetails:t,readOnly:o,onSelect:r}){if(!t)return null;let{last4Digits:n,expirationMonth:i,expirationYear:s}=t;return jsx(Ii,{item:true,onClick:r,$disabled:o,children:jsx(Od,{checked:e,readOnly:o,text:jsx(f,{variant:"h6",children:`Card ending in ${n}`}),subtitle:!!i&&!!s&&jsx(f,{variant:"body1",children:`Expires ${i.toString().padStart(2,"0")}/${s}`})})})}function Zd({hasExistingPaymentMethod:e,checked:t,onSelect:o,readOnly:r,checkoutLocalization:n,onBillingAddressChange:i,collectPhoneNumber:s,collectTaxId:l,onCheckout:a,onCheckoutCompleted:c}){let{isZuoraIntegration:u}=Ft();return jsxs($d,{item:true,$hideBorders:!e,onClick:o,$disabled:r,children:[e&&jsx(Od,{checked:t,readOnly:r,text:jsx(f,{variant:"h6",children:n.newPaymentMethodText})}),jsx(yx,{in:t,children:u?jsx(Vd,{onCheckout:a,onCheckoutCompleted:c}):jsx(rd,{onBillingAddressChange:i,collectPhoneNumber:s,collectTaxId:l})})]})}var QP=e(Me)`
|
|
752
752
|
display: flex;
|
|
753
753
|
flex-direction: column;
|
|
754
754
|
gap: 24px;
|
|
755
|
-
`;function Yd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n}){let{checkoutState:i,checkoutLocalization:s,widgetState:l}=U(),{customer:a}=i||{},{errorMessage:c,useNewPaymentMethod:u,setUseNewPaymentMethod:f$1}=re(),{readOnly:p}=l,h=g=>{p||f$1(g);};return jsxs(
|
|
755
|
+
`;function Yd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n}){let{checkoutState:i,checkoutLocalization:s,widgetState:l}=U(),{customer:a}=i||{},{errorMessage:c,useNewPaymentMethod:u,setUseNewPaymentMethod:f$1}=re(),{readOnly:p}=l,h=g=>{p||f$1(g);};return jsxs(QP,{container:true,children:[!!c&&jsx(PP,{severity:"error",sx:{alignItems:"center"},children:jsx(f,{overrideColor:"inherit",children:c})}),jsx(Wd,{readOnly:p,checked:!u,paymentMethodDetails:a==null?void 0:a.paymentMethodDetails,onSelect:()=>h(false)}),jsx(Zd,{hasExistingPaymentMethod:!!(a!=null&&a.paymentMethodDetails),readOnly:p,checked:u,checkoutLocalization:s,onSelect:()=>h(true),onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n})]})}var Ir=({onClick:e,checkoutLocalization:t,size:o})=>jsx(Ym,{className:"stigg-checkout-change-plan-button",sx:{textTransform:"none"},variant:"text",size:o,onClick:e,children:jsx(f,{className:"stigg-checkout-change-plan-button-text",color:"primary.main",variant:"h3",style:{lineHeight:"24px"},children:t.changePlan})});function qd({allowChangePlan:e=false,onChangePlan:t}){let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{};return jsxs(Fragment,{children:[jsxs(ke,{sx:{marginBottom:"16px"},children:[jsx(f,{variant:"body1",color:"disabled",style:{opacity:.6,marginBottom:"8px"},children:"Selected plan"}),jsxs(ke,{sx:{display:"flex",justifyContent:"space-between"},children:[jsx(f,{variant:"h1",children:n==null?void 0:n.displayName}),e&&t&&jsx(Ir,{onClick:()=>{t({currentPlan:n});},checkoutLocalization:r,size:"medium"})]})]}),jsx(Cl,{className:"stigg-checkout-plan-header-divider"})]})}function Ei(e){switch(e){case BillingPeriod.Annually:return "Annual";case BillingPeriod.Monthly:return "Monthly";default:return ""}}var jd=e(ke)`
|
|
756
756
|
margin: 16px 0;
|
|
757
757
|
`,ep=e.button`
|
|
758
758
|
cursor: ${({$disabled:e,$isOnlyBillingPeriod:t})=>e||t?"default":"pointer"};
|
|
@@ -782,11 +782,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
782
782
|
display: flex;
|
|
783
783
|
align-items: baseline;
|
|
784
784
|
gap: 8px;
|
|
785
|
-
`;e(
|
|
785
|
+
`;e(jP)`
|
|
786
786
|
& .MuiChip-label {
|
|
787
787
|
font-size: 12px;
|
|
788
788
|
}
|
|
789
|
-
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=Pe(),n=o===e;return jsxs(ep,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsx(
|
|
789
|
+
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=Pe(),n=o===e;return jsxs(ep,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsx(WP,{checked:n,onChange:()=>r(e),value:e,disabled:t,inputProps:{"aria-label":Ei(e)},sx:{padding:0,marginRight:"8px"}}),jsx(ke,{children:jsx(f,{variant:"h3",color:"primary",children:Ei(e)})})]})};function rp({plan:e,checkoutLocalization:t}){let[o,r]=fP(e==null?void 0:e.pricePoints,i=>i.billingPeriod===BillingPeriod.Monthly),n=!!(o!=null&&o.length)&&!!(r!=null&&r.length);return n?jsxs(jd,{children:[jsx(f,{variant:"h6",color:"primary",children:t.billingPeriodsTitle}),jsxs(tp,{children:[!!(o!=null&&o.length)&&jsx(op,{billingPeriod:BillingPeriod.Monthly,isOnlyBillingPeriod:!n},BillingPeriod.Monthly),!!(r!=null&&r.length)&&jsx(op,{billingPeriod:BillingPeriod.Annually,isOnlyBillingPeriod:!n},BillingPeriod.Annually)]})]}):null}var sb=e.div`
|
|
790
790
|
display: flex;
|
|
791
791
|
min-height: 60px;
|
|
792
792
|
margin-top: 16px;
|
|
@@ -797,34 +797,34 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
797
797
|
align-items: flex-start;
|
|
798
798
|
justify-content: space-between;
|
|
799
799
|
}
|
|
800
|
-
`,
|
|
800
|
+
`,lb=e(ke)`
|
|
801
801
|
display: flex;
|
|
802
802
|
flex-direction: column;
|
|
803
803
|
justify-content: center;
|
|
804
804
|
width: 100%;
|
|
805
805
|
height: 42px;
|
|
806
|
-
`,
|
|
806
|
+
`,cb=e(f)`
|
|
807
807
|
display: flex;
|
|
808
808
|
align-items: center;
|
|
809
809
|
justify-content: flex-end;
|
|
810
810
|
width: 100%;
|
|
811
811
|
min-height: 42px;
|
|
812
|
-
`,
|
|
812
|
+
`,db=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function pb({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var g,y,C,b,x,S;let[i,s]=useState(void 0),l=(g=e.feature)==null?void 0:g.featureId,a=!l,c=e.pricingModel===BillingModel.UsageBased,u=a?"Base charge":Tt(((y=e.feature)==null?void 0:y.displayName)||"",(C=e.feature)==null?void 0:C.units,(b=e.feature)==null?void 0:b.unitsPlural),f$1=!!(e!=null&&e.minUnitQuantity||e!=null&&e.maxUnitQuantity),p=T=>d(null,null,function*(){var E,A;if(a||!l)return;let{minUnitQuantity:F,maxUnitQuantity:w}=e,I=(E=T==null?void 0:T.target)!=null&&E.value?Number((A=T==null?void 0:T.target)==null?void 0:A.value):null;if(!I||I<=0||F&&I<F||w&&I>w){r({featureId:l,isValid:false}),s(db(e,I!=null?I:void 0)),t(l,I!=null?I:null);return}let k=sr(e,I),L=yield n==null?void 0:n({feature:e.feature,quantity:k});s(L==null?void 0:L.errorMessage),r({featureId:l,isValid:!(L!=null&&L.disableNextStep)}),t(l,k);}),h;if(a||c)h=`${H({amount:e.amount,currency:e.currency,locale:"en-us",minimumFractionDigits:2})}`,c&&(h+=" / unit");else if(e.isTieredPrice&&e.tiersMode&&l){let T=(o==null?void 0:o.quantity)||1;h=jsx(To,{componentId:`${l}-tiers`,tiers:e.tiers,tiersMode:e.tiersMode,value:T,errorMessage:i,handleChange:F=>d(null,null,function*(){let w=yield n==null?void 0:n({feature:e.feature,quantity:F});s(w==null?void 0:w.errorMessage),r({featureId:l,isValid:!(w!=null&&w.disableNextStep)}),t(l,F);}),width:"100%"});}else h=jsx(ce,{sx:{width:"100%"},id:`${l}-input`,type:"number",onWheel:Ct,error:!!i,helperText:i,FormHelperTextProps:{sx:{margin:"4px"}},value:(x=o==null?void 0:o.quantity)!=null?x:"",onChange:p});return jsxs(sb,{children:[jsxs(lb,{children:[jsx(f,{variant:"h6",color:"primary",lineHeight:"24px",children:u}),f$1&&jsx(f,{variant:"body1",color:"secondary",lineHeight:"20px",children:go(e.minUnitQuantity,e.maxUnitQuantity,(S=e.feature)==null?void 0:S.unitsPlural)})]}),jsx(cb,{variant:"h6",color:"primary",children:h})]})}function ap({plan:e,billingPeriod:t,onBillableFeatureChange:o}){var u;let{billableFeatures:r,setBillableFeature:n}=Pe(),{setIsDisabled:i}=Ue(),{setIsValid:s}=U(),l=dr(((u=e==null?void 0:e.pricePoints)==null?void 0:u.filter(f=>f.billingPeriod===t))||[]),[a$1,c]=useState(l==null?void 0:l.reduce((f,p)=>{var h;return f[((h=p.feature)==null?void 0:h.featureId)||"base-charge"]=true,f},{}));return useEffect(()=>{let f=Object.values(a$1).some(p=>!p);i(f),s(!f);},[a$1,i,s]),jsx(Fragment,{children:l==null?void 0:l.map(f=>{var h;let p=r.find(g=>{var y;return g.featureId===((y=f.feature)==null?void 0:y.featureId)});return jsx(pb,{charge:f,setBillableFeature:n,billableFeature:p,onValidationChange:({featureId:g,isValid:y})=>c(C=>b(a({},C),{[g]:y})),onBillableFeatureChange:o},((h=f.feature)==null?void 0:h.featureId)||"base-charge")})})}var sp=e(ke)`
|
|
813
813
|
width: 100%;
|
|
814
|
-
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=Pe();return jsxs(Fragment,{children:[jsx(qd,{allowChangePlan:true,onChangePlan:e}),jsxs(sp,{children:[jsx(rp,{plan:n,checkoutLocalization:r}),jsx(ap,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var
|
|
814
|
+
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=Pe();return jsxs(Fragment,{children:[jsx(qd,{allowChangePlan:true,onChangePlan:e}),jsxs(sp,{children:[jsx(rp,{plan:n,checkoutLocalization:r}),jsx(ap,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var fb=e=>jsx("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxs("g",{id:"arrow-right",children:[jsx("path",{id:"Shape",d:"M2.66699 8H13.3337",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{id:"Shape_2",d:"M9.33301 4L13.333 8L9.33301 12",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})})),dp=fb;var pp=e(dp)`
|
|
815
815
|
path {
|
|
816
816
|
stroke: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
817
817
|
}
|
|
818
|
-
`;var
|
|
818
|
+
`;var Cb=e(ke)`
|
|
819
819
|
display: flex;
|
|
820
|
-
`,
|
|
820
|
+
`,xb=e(PP)`
|
|
821
821
|
margin-bottom: 16px;
|
|
822
|
-
`,
|
|
822
|
+
`,Pb=e(ke)`
|
|
823
823
|
padding: 16px;
|
|
824
824
|
border-radius: 10px;
|
|
825
825
|
width: 100%;
|
|
826
826
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
827
|
-
`,mp=({headerText:e,planName:t,priceText:o})=>jsxs(
|
|
827
|
+
`,mp=({headerText:e,planName:t,priceText:o})=>jsxs(Pb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsx(f,{className:"stigg-checkout-downgrade-to-free-text-header",style:{opacity:.8},variant:"caption",color:"disabled",children:e}),jsx(f,{className:"stigg-checkout-downgrade-to-free-plan-name",bold:true,variant:"h3",color:"primary",children:t}),jsx(f,{className:"stigg-checkout-downgrade-to-free-price-text",color:"secondary",children:o})]}),gp=({checkoutLocalization:e,activeSubscription:t,freePlan:o,allowChangePlan:r=false,onChangePlan:n})=>{let i;r&&n&&(i=jsx(Ir,{onClick:()=>{n({currentPlan:o});},checkoutLocalization:e,size:"small"}));let s=t.prices.length>0?t.prices[0].billingPeriod:void 0;return jsxs(Fragment,{children:[jsx(xb,{action:i,className:"stigg-checkout-downgrade-to-free-alert",severity:"info",children:jsx(f,{as:"span",color:"secondary",children:e.downgradeToFree.alertText({plan:t.plan})})}),jsxs(Cb,{className:"stigg-checkout-downgrade-to-free-plans-container",children:[jsx(mp,{headerText:e.downgradeToFree.paidPlanHeader({plan:t.plan}),planName:e.downgradeToFree.paidPlanName({plan:t.plan}),priceText:e.downgradeToFree.paidPlanPriceText({plan:t.plan,billingPeriod:s})}),jsx(pp,{className:"stigg-checkout-downgrade-to-free-arrow",style:{margin:"auto 16px",minWidth:"16px"}}),jsx(mp,{headerText:e.downgradeToFree.freePlanHeader({plan:o}),planName:e.downgradeToFree.freePlanName({plan:o}),priceText:e.downgradeToFree.freePlanPriceText({plan:o})})]})]})};var kb=(e,{onBillingAddressChange:t,onChangePlan:o,onBillableFeatureChange:r,onAddonChange:n,collectPhoneNumber:i,collectTaxId:s,onCheckout:l,onCheckoutCompleted:a})=>{switch(e.key){case "PLAN":return {content:jsx(cp,{onChangePlan:o,onBillableFeatureChange:r})};case "ADDONS":return {content:jsx(Dd,{onAddonChange:n})};case "PAYMENT":return {content:jsx(Yd,{onBillingAddressChange:t,collectPhoneNumber:i,collectTaxId:s,onCheckout:l,onCheckoutCompleted:a})};default:return {content:null}}};function Cp({onCheckout:e,onCheckoutCompleted:t,onChangePlan:o,onBillingAddressChange:r,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:s,collectTaxId:l,disablePromotionCode:a$1,disableSuccessAnimation:c,onMockCheckoutPreview:u}){let{stripePromise:f,setupIntentClientSecret:p}=nd(),[{stiggTheme:h,widgetState:g,theme:y,showWatermark:C}]=R(),{currentStep:b$1}=Ue(),{isLoadingCheckoutData:x}=g,{checkoutState:S,checkoutLocalization:T}=U(),{plan:F,activeSubscription:w}=S||{},I=!!F&&F.pricingType===PricingType.Free&&!!w&&w.pricingType!==PricingType.Free,{content:k}=kb(b$1,{onBillingAddressChange:r,onChangePlan:o,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:s,collectTaxId:l,onCheckout:e,onCheckoutCompleted:t}),L=jsx(Fragment,{children:I?jsx(gp,{freePlan:F,activeSubscription:w,allowChangePlan:true,checkoutLocalization:T,onChangePlan:o}):jsx(Fragment,{children:k})}),E=useMemo(()=>p?{clientSecret:p}:{mode:"setup",currency:"usd"},[p]);return jsx(Elements,{stripe:f,options:b(a({},E),{appearance:{theme:"stripe",variables:{colorText:h.palette.text.primary,colorPrimaryText:h.palette.text.primary,colorTextPlaceholder:h.palette.text.disabled,fontFamily:h.typography.fontFamily,colorBackground:y==null?void 0:y.paymentInputBackgroundColor,borderRadius:y==null?void 0:y.paymentInputBorderRadius},rules:y!=null&&y.paymentInputBorderColor?{".Input":{borderColor:y==null?void 0:y.paymentInputBorderColor}}:void 0}}),children:jsxs(bc,{className:"stigg-checkout-layout",children:[!I&&jsx(Fc,{}),jsxs(Sc,{children:[jsx(Tc,{children:x?jsx(Da,{}):L}),x?jsx(Id,{showWatermark:C}):jsx(Ad,{disablePromotionCode:a$1,disableSuccessAnimation:c,onCheckout:e,onCheckoutCompleted:t,isFreeDowngrade:I,onMockCheckoutPreview:u,showWatermark:C})]})]})},p)}var Pp=p=>{var h=p,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:s,billingInformation:l,onMockCheckoutState:a$1,skipCheckoutSteps:c$1,onBeforeStepChange:u}=h,f=c(h,["textOverrides","theme","resourceId","planId","preferredBillingPeriod","billingCountryCode","billableFeatures","billingInformation","onMockCheckoutState","skipCheckoutSteps","onBeforeStepChange"]);return jsx(Cc,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:s,billingInformation:l,onMockCheckoutState:a$1,skipCheckoutSteps:c$1,onBeforeStepChange:u,children:jsx(Cp,a({},f))})};function Ab(e){return useMemo(()=>{let t=new URLSearchParams(window.location.search);return t.get(e)},[e,window.location.search])}var Ui=(r=>(r.IN_PROGRESS="IN_PROGRESS",r.SUCCEEDED="SUCCEEDED",r.FAILED="FAILED",r))(Ui||{}),Sp=({onProvisionStart:e,onProvisionSucceeded:t,onProvisionFailed:o}={})=>{let{stigg:r}=u(),[n,i]=useState("IN_PROGRESS"),[s,l]=useState(false),a=Ab("checkoutCompleted");return useEffect(()=>{d(null,null,function*(){if(!(!a||a.toLowerCase()==="false"||s)){l(true),e&&e();try{let u=yield r.waitForCheckoutCompleted();i("SUCCEEDED"),t&&t(u);}catch(u){console.error("Failed to wait for checkout to complete",u),i("FAILED"),o&&o(u);}finally{l(false);}}});},[r,a]),{isAwaitingCheckout:s,provisionStatus:n}};function Ib(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=x(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function Eb(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=y(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function Mb(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=z(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function _b(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=A(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function et(e){let t=u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=useCallback(()=>d(null,null,function*(){if(!o||!o.isCustomerLoaded)return null;try{let a={currencyId:e.currencyId},[c,u]=yield Promise.allSettled([o.getCreditBalance(a),o.getCreditEntitlement({currencyId:e.currencyId})]);if(c.status==="rejected")throw c.reason;let f=c.value,p=u.status==="fulfilled"?u.value:null;if(f.balances&&f.balances.length>0){let{currentBalance:h,totalConsumed:g,totalGranted:y,currency:{currencyId:C,displayName:b,units:x,symbol:S}}=f.balances[0];return {currentBalance:h,totalConsumed:g,totalGranted:y,currencyId:C,displayName:b,units:x,symbol:S,usagePeriodEnd:p!=null&&p.usagePeriodEnd?new Date(p.usagePeriodEnd):void 0}}return {currencyId:e.currencyId,currentBalance:0,totalConsumed:0,totalGranted:0,usagePeriodEnd:p!=null&&p.usagePeriodEnd?new Date(p.usagePeriodEnd):void 0}}catch(a){throw console.error(a),a}}),[o,e.currencyId,r]),{data:i,error:s,isLoading:l}=B({func:n});return useMemo(()=>({balance:i,isLoading:l,error:s}),[i,s,l])}var Lt=e.div`
|
|
828
828
|
display: flex;
|
|
829
829
|
align-items: center;
|
|
830
830
|
justify-content: space-between;
|
|
@@ -855,27 +855,27 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
855
855
|
outline: 2px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.primary}};
|
|
856
856
|
outline-offset: 2px;
|
|
857
857
|
}
|
|
858
|
-
`;var tt=(e,t)=>e?k(e,{maximumFractionDigits:t!=null?t:void 0}):0,vr=(e,t=true,o=false)=>{let{currentBalance:r,displayName:n,units:i,symbol:s}=e,l=o&&s,a=i?r===1?i.singular:i.plural:null,c=a!=null?a:n;return [l,t?c:""].filter(Boolean).join(" ")},Er=(e,t)=>t===0?0:Math.min(e/t*100,100);function Lr({usagePeriodEnd:e,formatResetPeriod:t,className:o}){let r=er({usagePeriodEnd:e,formatter:t});return r?jsx(f,{variant:"caption",color:"secondary",className:o,children:r}):null}var
|
|
858
|
+
`;var tt=(e,t)=>e?k(e,{maximumFractionDigits:t!=null?t:void 0}):0,vr=(e,t=true,o=false)=>{let{currentBalance:r,displayName:n,units:i,symbol:s}=e,l=o&&s,a=i?r===1?i.singular:i.plural:null,c=a!=null?a:n;return [l,t?c:""].filter(Boolean).join(" ")},Er=(e,t)=>t===0?0:Math.min(e/t*100,100);function Lr({usagePeriodEnd:e,formatResetPeriod:t,className:o}){let r=er({usagePeriodEnd:e,formatter:t});return r?jsx(f,{variant:"caption",color:"secondary",className:o,children:r}):null}var Ob=e.div`
|
|
859
859
|
display: flex;
|
|
860
860
|
flex-direction: column;
|
|
861
861
|
gap: 4px;
|
|
862
|
-
`,
|
|
862
|
+
`,Wb=e.div`
|
|
863
863
|
display: flex;
|
|
864
864
|
flex-direction: row;
|
|
865
865
|
gap: 4px;
|
|
866
866
|
align-items: baseline;
|
|
867
|
-
`;function kp({balance:e,isLoading:t,error:o,decimalPlaces:r=null,showUnits:n=true,showSymbol:i=false}){if(o)return jsx(f,{variant:"body1",color:"error",className:"stigg-credit-balance-value-error",children:o.message||"Failed to load balance"});if(t)return jsx(Qe,{width:120,height:24,className:"stigg-credit-balance-value-loading"});if(e){let s=vr(e,n,i);return jsxs(
|
|
867
|
+
`;function kp({balance:e,isLoading:t,error:o,decimalPlaces:r=null,showUnits:n=true,showSymbol:i=false}){if(o)return jsx(f,{variant:"body1",color:"error",className:"stigg-credit-balance-value-error",children:o.message||"Failed to load balance"});if(t)return jsx(Qe,{width:120,height:24,className:"stigg-credit-balance-value-loading"});if(e){let s=vr(e,n,i);return jsxs(Ob,{children:[jsxs(Wb,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-balance-value-amount",children:tt(e.currentBalance,r)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-balance-value-suffix",children:s})]}),jsx(Lr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-balance-reset-period"})]})}return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-balance-value-no-balance",children:"No balance data available"})}var Nr=e(pr)`
|
|
868
868
|
width: 16px;
|
|
869
869
|
height: 16px;
|
|
870
870
|
path {
|
|
871
871
|
stroke: ${({theme:e})=>{var t,o,r;return (r=(o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.text)==null?void 0:r.primary}};
|
|
872
872
|
}
|
|
873
|
-
`;var
|
|
873
|
+
`;var Zb=e.div`
|
|
874
874
|
display: flex;
|
|
875
875
|
flex-direction: column;
|
|
876
876
|
gap: 8px;
|
|
877
877
|
width: 100%;
|
|
878
|
-
`,
|
|
878
|
+
`,Yb=e.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
gap: 8px;
|
|
@@ -883,40 +883,40 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
883
883
|
border-radius: 8px;
|
|
884
884
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
885
885
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e==null?void 0:e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
886
|
-
`;function wp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=u({optional:true}),a$1=l==null?void 0:l.theme,{balance:c,isLoading:u$1,error:f$1}=et({currencyId:e}),{title:p,addCredits:h}=a(a({},F),t),g=jsx(
|
|
886
|
+
`;function wp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=u({optional:true}),a$1=l==null?void 0:l.theme,{balance:c,isLoading:u$1,error:f$1}=et({currencyId:e}),{title:p,addCredits:h}=a(a({},F),t),g=jsx(Zb,{className:"stigg-credit-balance-container",children:jsxs(Yb,{className:"stigg-credit-balance-card",children:[jsxs(Lt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-balance-title",children:p}),i&&c&&!f$1&&jsxs(Nt,{type:"button",onClick:()=>i(c),className:"stigg-credit-balance-add-credits-button",children:[jsx(Nr,{className:"stigg-credit-balance-add-credits-icon"}),h]})]}),jsx(kp,{balance:c,isLoading:u$1,error:f$1,decimalPlaces:o,showUnits:r,showSymbol:n})]})});return s?g:jsx(w,{componentTheme:a$1,children:g})}var qb=lazy(()=>import('./CreditUsageChart-Q5ETE3Y3.esm.js').then(e=>({default:e.CreditUsageChart})));function Ap(e){return jsx(Suspense,{fallback:null,children:jsx(qb,a({},e))})}var Jb=(e,t,o)=>o==="primary"?t.palette.primary:e>=100?t.palette.progress.high:e>=75?t.palette.progress.medium:t.palette.progress.low,Xb=e.div`
|
|
887
887
|
width: 100%;
|
|
888
888
|
height: 8px;
|
|
889
889
|
background-color: ${({theme:e})=>e.stigg.palette.progress.background};
|
|
890
890
|
border-radius: 4px;
|
|
891
891
|
overflow: hidden;
|
|
892
|
-
`,
|
|
892
|
+
`,jb=e.div`
|
|
893
893
|
height: 100%;
|
|
894
894
|
width: ${({percentage:e})=>Math.max(0,Math.min(100,e))}%;
|
|
895
|
-
background-color: ${({theme:e,percentage:t,variant:o})=>
|
|
895
|
+
background-color: ${({theme:e,percentage:t,variant:o})=>Jb(t,e.stigg,o)};
|
|
896
896
|
border-radius: 4px;
|
|
897
897
|
transition: width 0.3s ease-in-out;
|
|
898
|
-
`;function Mr({percentage:e,className:t,variant:o="utilization"}){return jsx(
|
|
898
|
+
`;function Mr({percentage:e,className:t,variant:o="utilization"}){return jsx(Xb,{className:t,children:jsx(jb,{percentage:e,variant:o})})}var tS=e.div`
|
|
899
899
|
display: flex;
|
|
900
900
|
flex-direction: row;
|
|
901
901
|
justify-content: space-between;
|
|
902
902
|
align-items: baseline;
|
|
903
903
|
width: 100%;
|
|
904
|
-
`,
|
|
904
|
+
`,oS=e.div`
|
|
905
905
|
display: flex;
|
|
906
906
|
flex-direction: row;
|
|
907
907
|
gap: 4px;
|
|
908
908
|
align-items: baseline;
|
|
909
|
-
`,
|
|
909
|
+
`,rS=e.div`
|
|
910
910
|
display: flex;
|
|
911
911
|
flex-direction: row;
|
|
912
912
|
gap: 4px;
|
|
913
913
|
align-items: baseline;
|
|
914
|
-
`,
|
|
914
|
+
`,nS=({totalConsumed:e,totalGranted:t})=>{let o=Er(e!=null?e:0,t!=null?t:0);return jsx(Mr,{percentage:o,className:"stigg-credit-utilization-progress"})};function Fp({balance:e,isLoading:t,error:o,decimalPlaces:r=null,showUnits:n=true,showSymbol:i=false,remainingLabel:s=G.remaining}){if(o)return jsx(f,{variant:"body1",color:"error",className:"stigg-credit-utilization-value-error",children:o.message||"Failed to load balance"});if(t)return jsx(Qe,{width:280,height:24,className:"stigg-credit-utilization-value-loading"});if(e){let{currentBalance:l,totalConsumed:a,totalGranted:c}=e,u=vr(e,n,i);return jsxs(Fragment,{children:[jsxs(tS,{children:[jsxs(oS,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-utilization-usage",children:tt(a,r)}),jsx(f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-separator",children:"/"}),jsx(f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-total",children:tt(c,r)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-suffix",children:u})]}),jsxs(rS,{children:[jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-remaining-label",children:s}),jsx(f,{variant:"caption",color:"primary",bold:true,className:"stigg-credit-utilization-remaining-value",children:tt(l,r)})]})]}),jsx(nS,{totalConsumed:e.totalConsumed,totalGranted:e.totalGranted}),jsx(Lr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-utilization-reset-period"})]})}return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-utilization-value-no-balance",children:"No balance data available"})}var aS=e.div`
|
|
915
915
|
display: flex;
|
|
916
916
|
flex-direction: column;
|
|
917
917
|
gap: 8px;
|
|
918
918
|
width: 100%;
|
|
919
|
-
`,
|
|
919
|
+
`,sS=e.div`
|
|
920
920
|
display: flex;
|
|
921
921
|
flex-direction: column;
|
|
922
922
|
gap: 16px;
|
|
@@ -925,7 +925,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
925
925
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
926
926
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e==null?void 0:e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
927
927
|
min-height: 90px;
|
|
928
|
-
`;function vp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=u({optional:true}),a$1=l==null?void 0:l.theme,{balance:c,isLoading:u$1,error:f$1}=et({currencyId:e}),{title:p,remaining:h,addCredits:g}=a(a({},G),t),y=jsx(
|
|
928
|
+
`;function vp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=u({optional:true}),a$1=l==null?void 0:l.theme,{balance:c,isLoading:u$1,error:f$1}=et({currencyId:e}),{title:p,remaining:h,addCredits:g}=a(a({},G),t),y=jsx(aS,{className:"stigg-credit-utilization-container",children:jsxs(sS,{className:"stigg-credit-utilization-card",children:[jsxs(Lt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-utilization-title",children:p}),i&&c&&!f$1&&jsxs(Nt,{type:"button",onClick:()=>i(c),className:"stigg-credit-utilization-add-credits-button",children:[jsx(Nr,{className:"stigg-credit-utilization-add-credits-icon"}),g]})]}),jsx(Fp,{balance:c,isLoading:u$1,error:f$1,decimalPlaces:o,showUnits:r,showSymbol:n,remainingLabel:h})]})});return s?y:jsx(w,{componentTheme:a$1,children:y})}function Ur(e){let t=u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=useCallback(()=>d(null,null,function*(){if(!o||!o.isCustomerLoaded)return null;try{return o.getCreditGrants({currencyId:e.currencyId,paging:e.paging})}catch(a){throw console.error("Error fetching credit grants:",a),a}}),[o,e.currencyId,e.paging,r]),{data:i,error:s,isLoading:l}=B({func:n});return useMemo(()=>({creditGrants:(i==null?void 0:i.data)||[],paging:i==null?void 0:i.pageInfo,totalCount:i==null?void 0:i.totalCount,isLoading:l,error:s}),[i,s,l])}function $i({skeletonRows:e,visibleHeadCells:t,hideLastRowBorder:o}){return jsx(Fragment,{children:Array.from({length:e}).map((r,n)=>jsx(dS,{children:t.map(i=>jsx(Rt,{$alignment:i.alignment,$width:i.width,$maxWidth:i.maxWidth,$minWidth:i.minWidth,$isLastRow:n===e-1,$hideLastRowBorder:o,children:jsx(Qe,{width:i.width?parseInt(i.width.replace("px",""))-40:100,height:20})},String(i.id)))},n))})}function Gi({data:e,visibleHeadCells:t,onRowClick:o,hideLastRowBorder:r}){return jsx(Fragment,{children:e.map((n,i)=>jsx(zi,{$clickable:!!o,onClick:()=>o&&o(n),children:t.map(s=>jsx(Rt,{$alignment:s.alignment,$width:s.width,$maxWidth:s.maxWidth,$minWidth:s.minWidth,$isLastRow:i===e.length-1,$hideLastRowBorder:r,onClick:s.disableClick?l=>l.stopPropagation():void 0,children:jsx(Vi,{$alignment:s.alignment,children:s.render(n)})},String(s.id)))},i))})}function $r({errorMessage:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"error",className:t,children:e||"An error occurred"}):jsx(Fragment,{children:e})}function Gr({message:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"secondary",className:t,children:e||"No data available"}):jsx(Fragment,{children:e})}var TS=e(TableContainer)`
|
|
929
929
|
border-radius: 8px;
|
|
930
930
|
border: 1px solid ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
931
931
|
background-color: ${({theme:e})=>e.stigg.palette.backgroundPaper};
|
|
@@ -938,11 +938,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
938
938
|
align-items: center;
|
|
939
939
|
justify-content: center;
|
|
940
940
|
`}
|
|
941
|
-
`,
|
|
941
|
+
`,kS=e(Table)`
|
|
942
942
|
min-width: 600px;
|
|
943
943
|
table-layout: auto;
|
|
944
944
|
width: 100%;
|
|
945
|
-
`,
|
|
945
|
+
`,wS=e(Divider)`
|
|
946
946
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
947
947
|
`,Rt=e(TableCell)`
|
|
948
948
|
padding: 8px 12px;
|
|
@@ -957,38 +957,38 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
957
957
|
${({$minWidth:e})=>e&&`min-width: ${e};`}
|
|
958
958
|
|
|
959
959
|
${({$isLastRow:e,$hideLastRowBorder:t})=>e&&t&&"border-bottom: none;"}
|
|
960
|
-
`,
|
|
960
|
+
`,BS=e(Rt)`
|
|
961
961
|
background-color: transparent;
|
|
962
|
-
`,
|
|
962
|
+
`,zi=e(TableRow)`
|
|
963
963
|
${({$clickable:e,theme:t})=>e&&`
|
|
964
964
|
cursor: pointer;
|
|
965
965
|
&:hover {
|
|
966
966
|
background-color: ${t.stigg.palette.backgroundHighlight};
|
|
967
967
|
}
|
|
968
968
|
`}
|
|
969
|
-
`,
|
|
969
|
+
`,Vi=e.div`
|
|
970
970
|
display: flex;
|
|
971
971
|
align-items: center;
|
|
972
972
|
justify-content: ${({$alignment:e})=>{switch(e){case "center":return "center";case "right":return "flex-end";default:return "flex-start"}}};
|
|
973
973
|
width: 100%;
|
|
974
|
-
`,
|
|
974
|
+
`,AS=e(TablePagination)`
|
|
975
975
|
color: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
976
|
-
`;function
|
|
976
|
+
`;function IS({visibleHeadCells:e}){return jsx(TableHead,{children:jsx(TableRow,{children:e.map(t=>jsx(BS,{$alignment:t.alignment,$width:t.width,$maxWidth:t.maxWidth,$minWidth:t.minWidth,children:jsx(f,{variant:"caption",children:t.label})},String(t.id)))})})}function zr({data:e,headCells:t,isLoading:o=false,error:r=null,emptyMessage:n,errorMessage:i,onRowClick:s,className:l,skeletonRows:a=3,hideLastRowBorder:c=true,pageSize:u,pageNum:f,totalCount:p,onPageChange:h}){let g=t.filter(C=>C.visible!==false),y=!!r||!o&&e.length===0;return jsx(TS,{className:l,$hasMinHeight:y,children:r?jsx($r,{errorMessage:i,className:`${l}-error`}):!o&&e.length===0?jsx(Gr,{message:n,className:`${l}-empty`}):jsxs(Fragment,{children:[jsxs(kS,{children:[jsx(IS,{visibleHeadCells:g}),jsx(TableBody,{children:o?jsx($i,{skeletonRows:a,visibleHeadCells:g,hideLastRowBorder:c}):jsx(Gi,{data:e,visibleHeadCells:g,onRowClick:s,hideLastRowBorder:c})})]}),!!(e!=null&&e.length)&&h&&jsxs(Fragment,{children:[jsx(wS,{}),jsx(AS,{component:"div",rowsPerPage:u!=null?u:e.length,rowsPerPageOptions:[u!=null?u:e.length],count:p!=null?p:e.length,page:f!=null?f:1,onPageChange:h,labelDisplayedRows:({from:C,to:b,count:x})=>`${ie(C)}-${ie(b)} of ${x!==-1?ie(x):`more than ${ie(b)}`}`})]})]})})}var vS=e(jP)`
|
|
977
977
|
font-size: 0.75rem;
|
|
978
978
|
height: 24px;
|
|
979
979
|
border-radius: 4px;
|
|
980
980
|
border: none;
|
|
981
981
|
background-color: ${({theme:e,$variant:t})=>{var o,r,n,i;return (i=(n=(r=(o=e==null?void 0:e.stigg)==null?void 0:o.palette)==null?void 0:r.statusChips)==null?void 0:n[t])==null?void 0:i.background}};
|
|
982
982
|
color: ${({theme:e,$variant:t})=>{var o,r,n,i;return (i=(n=(r=(o=e==null?void 0:e.stigg)==null?void 0:o.palette)==null?void 0:r.statusChips)==null?void 0:n[t])==null?void 0:i.text}};
|
|
983
|
-
`;function ao(i){var s=i,{variant:e,label:t,className:o,size:r="small"}=s,n=c(s,["variant","label","className","size"]);return jsx(
|
|
983
|
+
`;function ao(i){var s=i,{variant:e,label:t,className:o,size:r="small"}=s,n=c(s,["variant","label","className","size"]);return jsx(vS,a({label:t,size:r,$variant:e,className:o},n))}function Rp(e){let t=Q(),o=Q(e.effectiveAt),r=e.expireAt?Q(e.expireAt):null;return o.isAfter(t)?"SCHEDULED":r&&r.isBefore(t)?"EXPIRED":"AVAILABLE"}function Up(e,t){return `${tt(e.consumedAmount,t)} / ${e.amount}`}var Wi=e=>{switch(e){case "AVAILABLE":return "success";case "SCHEDULED":return "warning";case "EXPIRED":return "error";default:return "neutral"}},_p=e=>{if(e.automaticRechargeConfigurationId)return "Automatic recharge";switch(e.grantType){case CreditGrantType.Promotional:return "Promotional";case CreditGrantType.Paid:return "Top-up";case CreditGrantType.Recurring:return "Recurring";default:return "Unknown"}};function Dp({creditGrants:e,isLoading:t,error:o,localization:r,decimalPlaces:n,pageSize:i,pageNum:s,totalCount:l,onPageChange:a$1}){let c=e.map(f=>b(a({},f),{status:Rp(f)})),u=[{id:"effectiveAt",label:r.receivedAt,width:"205px",render:({effectiveAt:f$1})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-effective-date",children:On(f$1)})},{id:"grantType",label:r.grantType,width:"205px",render:f$1=>jsx(f,{variant:"body1",className:"stigg-credit-grants-grant-type",children:_p(f$1)})},{id:"status",label:r.status,width:"205px",render:({status:f})=>{let p=NS(f),h=Wi(f);return jsx(ao,{label:p,variant:h,className:"stigg-credit-grants-status-chip"})}},{id:"amount",label:r.balance,width:"205px",render:f$1=>jsx(f,{variant:"body1",className:"stigg-credit-grants-balance",children:Up(f$1,n)})},{id:"expireAt",label:r.expiryDate,width:"205px",render:({expireAt:f$1})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-expiry-date",children:f$1?Wn(f$1):"-"})}];return jsx(zr,{data:c,headCells:u,isLoading:t,error:o,emptyMessage:r.emptyState,loadingMessage:r.loadingState,errorMessage:r.errorState,className:"stigg-credit-grants-table",skeletonRows:(c==null?void 0:c.length)||3,pageNum:s,pageSize:i,totalCount:l,onPageChange:a$1})}var Gp=(e,t,o)=>{let[r,n]=useState(0),[i,s]=useState(0);return {pageNumber:i,lastVisitedPage:r,pageChangeFunc:(a,c)=>{let u=c>i?{after:e==null?void 0:e.endCursor,first:o}:{before:e==null?void 0:e.startCursor,last:o};t(u),n(i),s(c);}}};var RS=10,US=e.div`
|
|
984
984
|
display: flex;
|
|
985
985
|
flex-direction: column;
|
|
986
986
|
gap: 8px;
|
|
987
|
-
|
|
987
|
+
`,_S=e.div`
|
|
988
988
|
display: flex;
|
|
989
989
|
flex-direction: column;
|
|
990
990
|
gap: 16px;
|
|
991
|
-
`;function zp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=
|
|
991
|
+
`;function zp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=RS}){let n=u({optional:true}),i=n==null?void 0:n.stigg,s=n==null?void 0:n.theme,l=a(a({},H$1),t),[a$1,c]=useState({first:r}),{creditGrants:u$1,isLoading:f,error:p,paging:h,totalCount:g}=Ur({currencyId:e,pageSize:r,paging:a$1}),{pageNumber:y,pageChangeFunc:C}=Gp(h,c,r);return jsx(w,{componentTheme:s,children:jsxs(US,{className:"stigg-credit-grants-container",children:[jsx(_S,{className:"stigg-credit-grants-card",children:jsx(Dp,{creditGrants:u$1,isLoading:f,error:p,localization:l,decimalPlaces:o,pageSize:r,pageNum:y,totalCount:g,onPageChange:C})}),jsx(q,{source:"grant_list",align:"end",smallScreenAlign:"end",style:{marginTop:0},showWatermark:i==null?void 0:i.getShowWatermark()})]})})}var Vp=e.div`
|
|
992
992
|
display: flex;
|
|
993
993
|
flex-direction: column;
|
|
994
994
|
gap: 16px;
|
|
@@ -1001,7 +1001,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1001
1001
|
display: flex;
|
|
1002
1002
|
align-items: center;
|
|
1003
1003
|
gap: 4px;
|
|
1004
|
-
`;var
|
|
1004
|
+
`;var Zi=e.div`
|
|
1005
1005
|
display: flex;
|
|
1006
1006
|
flex-direction: column;
|
|
1007
1007
|
gap: 4px;
|
|
@@ -1022,12 +1022,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1022
1022
|
display: flex;
|
|
1023
1023
|
align-items: center;
|
|
1024
1024
|
justify-content: flex-start;
|
|
1025
|
-
`;function Qp(e,t){return e?Object.entries(t).reduce((o,[r,n])=>{let i=new RegExp(`{{\\s*${r}\\s*}}`,"g"),l=String(n!=null?n:"").replace(/\$/g,"$$$$");return o.replace(i,l)},e):""}function Kp({customerId:e,currencyId:t,currencyUnit:o="Credits",billingCurrency:r="$",onManageClick:n,className:i,localization:s}){let{thresholdValue:l,targetBalance:a$1,currentMonthlySpend:c,maxSpendLimit:u,spendPercentage:f$1,showActiveState:p,isLoading:h,error:g}=Wp({customerId:e,currencyId:t}),y=a(a({},J),s&&Object.fromEntries(Object.entries(s).filter(([x,S])=>S!==void 0))),C=Qp(y.descriptionTemplate,{target:Dt(a$1),unit:o,threshold:Dt(l)}),b=Qp(y.spendTemplate,{currency:r,current:Dt(c),limit:Dt(u)});return g?jsx(Zp,{className:`stigg-auto-recharge-status stigg-auto-recharge-status-error ${i||""}`,children:jsx(f,{variant:"body1",color:"error",children:g.message||"Failed to load auto-recharge status"})}):jsxs(Zp,{className:`stigg-auto-recharge-status ${i||""}`,children:[jsxs(Lt,{children:[jsxs(Hp,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-auto-recharge-title",children:y.title}),!h&&p&&jsx(ao,{variant:"success",label:y.activeLabel,className:"stigg-auto-recharge-status-chip",size:"small"})]}),h?jsx(Qe,{width:70,height:38,borderRadius:10}):jsx(Nt,{type:"button",onClick:n,className:"stigg-auto-recharge-manage-button","aria-label":`${y.manageButton} auto-recharge settings`,children:y.manageButton})]}),h?jsxs(
|
|
1025
|
+
`;function Qp(e,t){return e?Object.entries(t).reduce((o,[r,n])=>{let i=new RegExp(`{{\\s*${r}\\s*}}`,"g"),l=String(n!=null?n:"").replace(/\$/g,"$$$$");return o.replace(i,l)},e):""}function Kp({customerId:e,currencyId:t,currencyUnit:o="Credits",billingCurrency:r="$",onManageClick:n,className:i,localization:s}){let{thresholdValue:l,targetBalance:a$1,currentMonthlySpend:c,maxSpendLimit:u,spendPercentage:f$1,showActiveState:p,isLoading:h,error:g}=Wp({customerId:e,currencyId:t}),y=a(a({},J),s&&Object.fromEntries(Object.entries(s).filter(([x,S])=>S!==void 0))),C=Qp(y.descriptionTemplate,{target:Dt(a$1),unit:o,threshold:Dt(l)}),b=Qp(y.spendTemplate,{currency:r,current:Dt(c),limit:Dt(u)});return g?jsx(Zp,{className:`stigg-auto-recharge-status stigg-auto-recharge-status-error ${i||""}`,children:jsx(f,{variant:"body1",color:"error",children:g.message||"Failed to load auto-recharge status"})}):jsxs(Zp,{className:`stigg-auto-recharge-status ${i||""}`,children:[jsxs(Lt,{children:[jsxs(Hp,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-auto-recharge-title",children:y.title}),!h&&p&&jsx(ao,{variant:"success",label:y.activeLabel,className:"stigg-auto-recharge-status-chip",size:"small"})]}),h?jsx(Qe,{width:70,height:38,borderRadius:10}):jsx(Nt,{type:"button",onClick:n,className:"stigg-auto-recharge-manage-button","aria-label":`${y.manageButton} auto-recharge settings`,children:y.manageButton})]}),h?jsxs(Zi,{children:[jsx(Qe,{width:"100%",height:20}),jsx(Qe,{width:"100%",height:8,borderRadius:0}),jsx(Yp,{children:jsx(Qe,{width:200,height:16})})]}):p?jsxs(Zi,{children:[jsx(f,{variant:"body1",color:"primary",className:"stigg-auto-recharge-description",children:C}),jsx(Mr,{percentage:f$1,variant:"primary",className:"stigg-auto-recharge-progress"}),jsx(Yp,{children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-spend",children:u>0?b:y.unlimitedSpendLimit})})]}):jsx(Op,{className:"stigg-auto-recharge-empty",children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-empty-text",children:y.emptyStateMessage})})]})}var zS=e.div`
|
|
1026
1026
|
display: flex;
|
|
1027
1027
|
flex-direction: column;
|
|
1028
1028
|
gap: 8px;
|
|
1029
1029
|
width: 100%;
|
|
1030
|
-
`;function qp(e){let t=fe(ee),o=u({optional:true}),r=o==null?void 0:o.theme,n=jsx(
|
|
1030
|
+
`;function qp(e){let t=fe(ee),o=u({optional:true}),r=o==null?void 0:o.theme,n=jsx(zS,{className:"stigg-auto-recharge-status-container",children:jsx(Kp,a({},e))});return t?n:jsx(w,{componentTheme:r,children:n})}function Jp(e){return dg({},{title:"Auto recharge settings",enableLabel:"Recharge credits automatically when balance is low",enableDescription:"Allow auto-recharge",thresholdFieldPrefix:"When",thresholdFieldSuffix:"balance goes below",thresholdTooltip:"The credit balance threshold that triggers an automatic recharge",thresholdFieldPlaceholder:"Enter threshold amount",thresholdFieldHint:"Current threshold: {{value}}",thresholdRequired:"Threshold amount is required",thresholdMin:"Threshold must be at least 0",thresholdMax:"Threshold must be less than {{max}}",targetFieldPrefix:"Then",targetFieldSuffix:"recharge balance up to",targetBalanceTooltip:"The target credit balance to reach after a recharge",targetFieldPlaceholder:"Enter target balance",targetFieldHint:"Current target: {{value}}",targetRequired:"Target balance is required",targetMin:"Target must be greater than threshold",targetMax:"Target cannot exceed {{max}}",spendLimitFieldPrefix:"Limit",spendLimitFieldSuffix:"total spend",spendLimitFieldPlaceholder:"0.00",spendLimitHelpText:"Limit recharging to spending cap when enabled",spendLimitPeriod:"month",spendLimitPositive:"Spend limit must be greater than 0",spendLimitMin:"Spend limit must be at least {{min}}",spendLimitMax:"Spend limit cannot exceed {{max}}",immediateRechargeWarning:"Recharge will run immediately after saving. Current balance is below threshold {{threshold}} {{currencyUnit}}.",spendLimitTooLowWarning:"Auto-recharge may not run. Current monthly spend (${{currentSpend}} USD) is approaching or exceeds the spend limit (${{spendLimit}} USD).",cancelButton:"Cancel",saveButton:"Save settings",editButton:"Edit",loadingState:"Loading automatic recharge settings...",errorState:"Failed to load automatic recharge settings",emptyState:"No automatic recharge configuration found"},e)}function ot(e,t={},o){var s,l,a,c;let r={};if(!e.enabled)return r;let n=parseFloat(e.thresholdAmount);!e.thresholdAmount||e.thresholdAmount.trim()===""?r.thresholdAmount=o.thresholdRequired||"Threshold amount is required":isNaN(n)?r.thresholdAmount="Threshold must be a valid number":n<0?r.thresholdAmount=o.thresholdMin||"Threshold must be at least 0":t.poolSize!==void 0&&n>=t.poolSize&&(r.thresholdAmount=((s=o.thresholdMax)==null?void 0:s.replace("{{max}}",String(t.poolSize)))||`Threshold must be less than ${t.poolSize}`);let i=parseFloat(e.targetBalance);if(!e.targetBalance||e.targetBalance.trim()===""?r.targetBalance=o.targetRequired||"Target balance is required":isNaN(i)?r.targetBalance="Target balance must be a valid number":!isNaN(n)&&i<=n?r.targetBalance=o.targetMin||"Target balance must be greater than threshold":t.poolSize!==void 0&&i>t.poolSize&&(r.targetBalance=((l=o.targetMax)==null?void 0:l.replace("{{max}}",String(t.poolSize)))||`Target balance cannot exceed ${t.poolSize}`),e.maxSpendLimit&&e.maxSpendLimit.trim()!==""){let u=parseFloat(e.maxSpendLimit);isNaN(u)?r.maxSpendLimit="Spend limit must be a valid number":u<=0?r.maxSpendLimit=o.spendLimitPositive||"Spend limit must be greater than 0":t.minSpendLimit!==void 0&&u<t.minSpendLimit?r.maxSpendLimit=((a=o.spendLimitMin)==null?void 0:a.replace("{{min}}",String(t.minSpendLimit)))||`Spend limit must be at least ${t.minSpendLimit}`:t.maxSpendLimit!==void 0&&u>t.maxSpendLimit&&(r.maxSpendLimit=((c=o.spendLimitMax)==null?void 0:c.replace("{{max}}",String(t.maxSpendLimit)))||`Spend limit cannot exceed ${t.maxSpendLimit}`);}return r}function Wr({initialData:e,poolSize:t,localization:o}){var C,b$1,x,S,T,F,w,I,k,L,E,A,Z,$;let[r,n]=useState({enabled:(C=e==null?void 0:e.enabled)!=null?C:false,thresholdAmount:(x=(b$1=e==null?void 0:e.thresholdAmount)==null?void 0:b$1.toString())!=null?x:"",targetBalance:(T=(S=e==null?void 0:e.targetBalance)==null?void 0:S.toString())!=null?T:"",maxSpendLimit:(w=(F=e==null?void 0:e.maxSpendLimit)==null?void 0:F.toString())!=null?w:""}),[i,s]=useState({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),l=ot({enabled:(I=e==null?void 0:e.enabled)!=null?I:false,thresholdAmount:(L=(k=e==null?void 0:e.thresholdAmount)==null?void 0:k.toString())!=null?L:"",targetBalance:(A=(E=e==null?void 0:e.targetBalance)==null?void 0:E.toString())!=null?A:"",maxSpendLimit:($=(Z=e==null?void 0:e.maxSpendLimit)==null?void 0:Z.toString())!=null?$:""},{poolSize:t},o),[a$1,c]=useState(l);return {formData:r,errors:a$1,touched:i,handleEnabledChange:_=>{let z=_.target.checked;if(n(q=>b(a({},q),{enabled:z})),!z)c({}),s({});else {let q=ot(b(a({},r),{enabled:true}),{poolSize:t},o);c(q),s({thresholdAmount:true,targetBalance:true,maxSpendLimit:true});}},handleFieldChange:_=>z=>{let q=z.target.value,Ge=b(a({},r),{[_]:q});n(Ge),s(V=>b(a({},V),{[_]:true}));let pt=ot(Ge,{poolSize:t},o);c(pt);},handleFieldBlur:_=>()=>{s(q=>b(a({},q),{[_]:true}));let z=ot(r,{poolSize:t},o);c(z);},getFieldError:_=>i[_]?a$1[_]:void 0,validate:()=>{let _=ot(r,{poolSize:t},o);return c(_),r.enabled&&s({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),Object.keys(_).length===0},getFormValues:()=>{var _,z,q;return {enabled:r.enabled,thresholdAmount:(_=r.thresholdAmount)!=null&&_.trim()?parseFloat(r.thresholdAmount.trim()):void 0,targetBalance:(z=r.targetBalance)!=null&&z.trim()?parseFloat(r.targetBalance.trim()):void 0,maxSpendLimit:(q=r.maxSpendLimit)!=null&&q.trim()?parseFloat(r.maxSpendLimit.trim()):void 0}}}}var lo=e.div`
|
|
1031
1031
|
display: flex;
|
|
1032
1032
|
flex-direction: column;
|
|
1033
1033
|
gap: 16px;
|
|
@@ -1042,12 +1042,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1042
1042
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
1043
1043
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
1044
1044
|
box-shadow: 1px 6px 14px 0px rgba(26, 26, 26, 0.1);
|
|
1045
|
-
`,
|
|
1045
|
+
`,Ki=e(Info)`
|
|
1046
1046
|
width: 12px;
|
|
1047
1047
|
height: 12px;
|
|
1048
1048
|
color: ${({theme:e})=>{var t,o,r;return (r=(o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.text)==null?void 0:r.secondary}};
|
|
1049
1049
|
cursor: help;
|
|
1050
|
-
`,
|
|
1050
|
+
`,qi=e(PP)`
|
|
1051
1051
|
font-family: custom-font, 'DM Sans', sans-serif;
|
|
1052
1052
|
align-items: center;
|
|
1053
|
-
`;function Zr({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:s,readOnly:l=false,localization:a$1,onSave:c,onCancel:u$1}){var E,A,Z;let f$1=fe(ee),p=u({optional:true}),h=p==null?void 0:p.theme,g=useMemo(()=>Jp(a$1),[a$1]),{formData:y,errors:C,handleEnabledChange:b,handleFieldChange:x,handleFieldBlur:S,getFieldError:T,validate:F,getFormValues:w$1}=Wr({initialData:o,poolSize:n,localization:g}),I=useMemo(()=>y.enabled?Object.keys(C).length>0:false,[C,y.enabled]),k=useCallback(()=>{if(F()&&c){let $=w$1();c(a({customerId:e,currencyId:t},$));}},[F,c,w$1,e,t]),L=jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxs(co,{className:"stigg-automatic-recharge-form-card",children:[jsxs(ke,{display:"flex",flexDirection:"column",gap:.5,children:[jsx(f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:g.title}),jsx(f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:g.enableLabel})]}),jsx(ke,{display:"flex",flexDirection:"column",gap:1,children:jsx(Bh,{control:jsx(wh,{checked:y.enabled,onChange:b,disabled:l}),label:jsx(f,{variant:"body1",color:"primary",children:g.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxs(ke,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:g.thresholdFieldPrefix})," ",g.thresholdFieldSuffix]}),jsx(Ve,{title:g.thresholdTooltip,children:jsx(
|
|
1053
|
+
`;function Zr({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:s,readOnly:l=false,localization:a$1,onSave:c,onCancel:u$1}){var E,A,Z;let f$1=fe(ee),p=u({optional:true}),h=p==null?void 0:p.theme,g=useMemo(()=>Jp(a$1),[a$1]),{formData:y,errors:C,handleEnabledChange:b,handleFieldChange:x,handleFieldBlur:S,getFieldError:T,validate:F,getFormValues:w$1}=Wr({initialData:o,poolSize:n,localization:g}),I=useMemo(()=>y.enabled?Object.keys(C).length>0:false,[C,y.enabled]),k=useCallback(()=>{if(F()&&c){let $=w$1();c(a({customerId:e,currencyId:t},$));}},[F,c,w$1,e,t]),L=jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxs(co,{className:"stigg-automatic-recharge-form-card",children:[jsxs(ke,{display:"flex",flexDirection:"column",gap:.5,children:[jsx(f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:g.title}),jsx(f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:g.enableLabel})]}),jsx(ke,{display:"flex",flexDirection:"column",gap:1,children:jsx(Bh,{control:jsx(wh,{checked:y.enabled,onChange:b,disabled:l}),label:jsx(f,{variant:"body1",color:"primary",children:g.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxs(ke,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:g.thresholdFieldPrefix})," ",g.thresholdFieldSuffix]}),jsx(Ve,{title:g.thresholdTooltip,children:jsx(Ki,{})})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.thresholdAmount,onValueChange:$=>{let _={target:{value:$.value}};x("thresholdAmount")(_);},onBlur:S("thresholdAmount"),placeholder:g.thresholdFieldPlaceholder,error:!!T("thresholdAmount"),helperText:(E=T("thresholdAmount"))!=null?E:"",disabled:l||!y.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-threshold-input"})]}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-target-field",children:[jsxs(ke,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:g.targetFieldPrefix})," ",g.targetFieldSuffix]}),jsx(Ve,{title:g.targetBalanceTooltip,children:jsx(Ki,{})})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.targetBalance,onValueChange:$=>{let _={target:{value:$.value}};x("targetBalance")(_);},onBlur:S("targetBalance"),placeholder:g.targetFieldPlaceholder,error:!!T("targetBalance"),helperText:(A=T("targetBalance"))!=null?A:"",disabled:l||!y.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-target-input"})]}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-spend-limit-field",children:[jsxs(ke,{display:"flex",flexDirection:"column",gap:.5,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:g.spendLimitFieldPrefix})," ",g.spendLimitFieldSuffix]}),jsx(f,{variant:"caption",color:"secondary",style:{fontSize:"12px"},children:g.spendLimitHelpText})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.maxSpendLimit,onValueChange:$=>{let _={target:{value:$.value}};x("maxSpendLimit")(_);},onBlur:S("maxSpendLimit"),placeholder:g.spendLimitFieldPlaceholder,error:!!T("maxSpendLimit"),helperText:(Z=T("maxSpendLimit"))!=null?Z:"",disabled:l||!y.enabled,InputProps:{startAdornment:jsx(f,{variant:"body1",color:"secondary",children:"$"}),endAdornment:jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:["/ ",g.spendLimitPeriod]})},className:"stigg-automatic-recharge-form-spend-limit-input"})]}),!l&&y.enabled&&y.thresholdAmount&&jsxs(Fragment,{children:[i!==void 0&&i<=parseFloat(y.thresholdAmount)&&jsx(qi,{severity:"warning",className:"stigg-automatic-recharge-form-warning",children:g.immediateRechargeWarning.replace("{{threshold}}",ie(parseFloat(y.thresholdAmount))||"0").replace("{{currencyUnit}}",r||"")}),y.maxSpendLimit&&y.maxSpendLimit.trim()!==""&&parseFloat(y.maxSpendLimit)>0&&s!==void 0&&s+0>=parseFloat(y.maxSpendLimit)&&jsx(qi,{severity:"warning",className:"stigg-automatic-recharge-form-spend-limit-warning",children:g.spendLimitTooLowWarning.replace("{{currentSpend}}",jr(s)).replace("{{spendLimit}}",jr(parseFloat(y.maxSpendLimit)))})]}),!l&&jsxs(ke,{display:"flex",justifyContent:"flex-end",gap:1,pt:2,className:"stigg-automatic-recharge-form-actions",children:[u$1&&jsx(te,{variant:"outlined",onClick:u$1,className:"stigg-automatic-recharge-form-cancel-button",children:g.cancelButton}),c&&jsx(te,{variant:"contained",onClick:k,disabled:I,className:"stigg-automatic-recharge-form-save-button",children:g.saveButton})]})]})});return f$1?L:jsx(w,{componentTheme:h,children:L})}function em(){let e=u(),t=e==null?void 0:e.stigg,[o,r]=useState(false),[n,i]=useState(null);return {updateConfig:useCallback(l=>d(null,null,function*(){var a,c,u;if(!t||!t.isCustomerLoaded){let f=new Error("Stigg SDK not initialized or customer not loaded");throw i(f),f}r(true),i(null);try{let f={customerId:l.customerId,currencyId:l.currencyId,isEnabled:l.enabled,thresholdValue:(a=l.thresholdAmount)!=null?a:0,thresholdType:ThresholdType.CreditAmount,targetBalance:(c=l.targetBalance)!=null?c:0,maxSpendLimit:(u=l.maxSpendLimit)!=null?u:null},p=yield t.saveAutomaticRechargeConfiguration(f);return yield t.refresh(),r(!1),p}catch(f){let p=f instanceof Error?f:new Error("Failed to save automatic recharge configuration");throw console.error("Error saving automatic recharge configuration:",p),i(p),r(false),p}}),[t]),isLoading:o,error:n}}function rm({customerId:e,currencyId:t,currencyUnit:o,poolSize:r,readOnly:n=false,localization:i,onSave:s,onCancel:l}){var k,L;let a=fe(ee),c=u({optional:true}),u$1=c==null?void 0:c.theme,{config:f$1,isLoading:p,error:h}=Hr({customerId:e,currencyId:t}),{balance:g,isLoading:y,error:C}=et({currencyId:t}),{updateConfig:b,isLoading:x,error:S}=em(),T=useCallback(E=>d(null,null,function*(){try{yield b(E),s&&s(E);}catch(A){console.error("Failed to save automatic recharge configuration:",A);}}),[b,s]),F=f$1?{id:"",enabled:f$1.isEnabled,thresholdAmount:f$1.thresholdValue,targetBalance:f$1.targetBalance,maxSpendLimit:(k=f$1.maxSpendLimit)!=null?k:void 0,currencyId:f$1.currencyId,customerId:f$1.customerId}:void 0;if(p||y){let E=jsxs("div",{children:[jsx(Qe,{width:300,height:24,style:{marginBottom:"16px"}}),jsx(Qe,{width:400,height:200})]});return a?E:jsx(w,{componentTheme:u$1,children:E})}if(h){let E=jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:h.message||"Failed to load automatic recharge configuration"})})});return a?E:jsx(w,{componentTheme:u$1,children:E})}if(C){let E=jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:C.message||"Failed to load credit balance"})})});return a?E:jsx(w,{componentTheme:u$1,children:E})}let w$1=o||((L=g==null?void 0:g.units)==null?void 0:L.plural)||(g==null?void 0:g.displayName)||"Credits",I=jsxs(Fragment,{children:[S&&jsx(f,{variant:"body1",color:"error",style:{marginBottom:"16px"},children:S.message||"Failed to save automatic recharge configuration"}),jsx(Zr,{customerId:e,currencyId:t,initialData:F,currencyUnit:w$1,poolSize:r,currentBalance:g==null?void 0:g.currentBalance,currentMonthlySpend:f$1==null?void 0:f$1.currentMonthlySpend,readOnly:n||x,localization:i,onSave:T,onCancel:l})]});return a?I:jsx(w,{componentTheme:u$1,children:I})}export{vo as AddonsList,qp as AutoRechargeStatus,rm as AutomaticRechargeConfig,Zr as AutomaticRechargeConfigForm,Ib as BooleanEntitlementGuard,Pp as Checkout,wp as CreditBalance,zp as CreditGrants,Ap as CreditUsageChart,vp as CreditUtilization,Zl as CustomerPortal,Fo as CustomerPortalProvider,nr as CustomerUsageData,Gr as EmptyState,_b as EnumEntitlementGuard,$r as ErrorState,zr as GenericTable,ir as InvoicesSection,Mb as MeteredEntitlementGuard,Eb as NumericEntitlementGuard,Jo as PaymentDetailsSection,xs as Paywall,Lo as Promotions,Ui as ProvisionStatus,ao as StatusChip,on as SubscribeIntentionType,Zo as SubscriptionsOverview,Wn as formatDateOnly,On as formatDateTime,Wo as isCreditEntitlement,bt as isFeatureEntitlement,Wi as mapCreditGrantStatusToVariant,Wr as useAutomaticRechargeForm,et as useCreditBalance,Ur as useCreditGrants,Sp as useWaitForCheckoutCompleted,ot as validateAutomaticRechargeForm};
|