@stigg/react-sdk 7.26.4 → 7.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{CreditUsageChart-ROKP3NFB.cjs.js → CreditUsageChart-P3BWIUOZ.cjs.js} +19 -19
- package/dist/{CreditUsageChart-M7VIRMFP.esm.js → CreditUsageChart-TQR4YFYZ.esm.js} +1 -1
- package/dist/{chunk-WCA6D7PO.esm.js → chunk-4YPINBLC.esm.js} +1 -1
- package/dist/{chunk-SP6WPFZZ.cjs.js → chunk-5K62MKBQ.cjs.js} +1 -1
- package/dist/stigg-sdk.cjs.js +170 -170
- package/dist/stigg-sdk.esm.js +2 -2
- package/package.json +2 -2
package/dist/stigg-sdk.cjs.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var chunk5K62MKBQ_cjs_js=require('./chunk-5K62MKBQ.cjs.js'),jsClientSdk=require('@stigg/js-client-sdk'),ii=require('react'),Pu=require('classnames'),Me=require('@mui/material/Grid'),ic=require('lodash/compact'),reactNumberFormat=require('react-number-format'),jsxRuntime=require('react/jsx-runtime'),Na=require('lodash/isFunction'),Rm=require('react-spinners/ClipLoader'),react=require('@emotion/react'),ho=require('dayjs'),Bm=require('dayjs/plugin/utc'),Am=require('dayjs/plugin/relativeTime'),Im=require('dayjs/plugin/advancedFormat'),xo=require('lodash/isNil'),Nm=require('lodash/sum'),Zm=require('currency-symbol-map'),jm=require('@mui/material/InputAdornment'),Ym=require('@mui/material/Button'),qm=require('@mui/material/TextField'),Cl=require('@mui/material/Divider'),eu=require('@mui/material/OutlinedInput'),tu=require('@mui/material/Select'),ou=require('@mui/material/MenuItem'),ru=require('lodash/map'),ke=require('@mui/material/Box'),Wu=require('react-switch'),ng=require('lodash/countBy'),ig=require('lodash/uniq'),Yl=require('lodash/sortBy'),dg=require('lodash/merge'),Qe=require('react-loading-skeleton'),wg=require('lodash/flatMap'),Rs=require('@mui/material/Tab'),Bg=require('lodash/isEmpty'),Lg=require('@mui/material/Tabs'),Ug=require('@mui/material/useMediaQuery'),reactFeather=require('react-feather'),Pf=require('@mui/material/Link'),uf=require('@mui/material/Tooltip'),wl=require('lodash/keyBy'),bi=require('color'),kf=require('@mui/material/LinearProgress'),Hf=require('lodash/padStart'),Ml=require('lodash/isUndefined'),sdk=require('@stigg/api-client-js/src/generated/sdk'),Vn=require('lodash/lowerCase'),ty=require('lodash/range'),immer=require('immer'),dy=require('lodash/cloneDeep'),py=require('lodash/remove'),reactStripeJs=require('@stripe/react-stripe-js'),ch=require('@mui/material/StepIcon'),hx=require('lodash/partition'),bh=require('@mui/material/CircularProgress'),bx=require('@mui/material/Paper'),Sx=require('@mui/material/Alert'),Ah=require('@mui/material/Checkbox'),Ih=require('@mui/material/FormControlLabel'),Fh=require('lodash/isString'),hP=require('@mui/material/Autocomplete'),CP=require('@mui/material/Collapse'),_3x2=require('country-flag-icons/react/3x2'),ed=require('lodash/startCase'),td=require('lodash/upperCase'),UP=require('react-lottie'),mx=require('@mui/material/IconButton'),styles=require('@mui/material/styles'),Yx=require('@mui/material/Radio'),tb=require('@mui/material/Chip'),RS=require('lodash/capitalize'),material=require('@mui/material'),mS=require('@mui/material/TableRow');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ii__default=/*#__PURE__*/_interopDefault(ii);var Pu__default=/*#__PURE__*/_interopDefault(Pu);var Me__default=/*#__PURE__*/_interopDefault(Me);var ic__default=/*#__PURE__*/_interopDefault(ic);var Na__default=/*#__PURE__*/_interopDefault(Na);var Rm__default=/*#__PURE__*/_interopDefault(Rm);var ho__default=/*#__PURE__*/_interopDefault(ho);var Bm__default=/*#__PURE__*/_interopDefault(Bm);var Am__default=/*#__PURE__*/_interopDefault(Am);var Im__default=/*#__PURE__*/_interopDefault(Im);var xo__default=/*#__PURE__*/_interopDefault(xo);var Nm__default=/*#__PURE__*/_interopDefault(Nm);var Zm__default=/*#__PURE__*/_interopDefault(Zm);var jm__default=/*#__PURE__*/_interopDefault(jm);var Ym__default=/*#__PURE__*/_interopDefault(Ym);var qm__default=/*#__PURE__*/_interopDefault(qm);var Cl__default=/*#__PURE__*/_interopDefault(Cl);var eu__default=/*#__PURE__*/_interopDefault(eu);var tu__default=/*#__PURE__*/_interopDefault(tu);var ou__default=/*#__PURE__*/_interopDefault(ou);var ru__default=/*#__PURE__*/_interopDefault(ru);var ke__default=/*#__PURE__*/_interopDefault(ke);var Wu__default=/*#__PURE__*/_interopDefault(Wu);var ng__default=/*#__PURE__*/_interopDefault(ng);var ig__default=/*#__PURE__*/_interopDefault(ig);var Yl__default=/*#__PURE__*/_interopDefault(Yl);var dg__default=/*#__PURE__*/_interopDefault(dg);var Qe__default=/*#__PURE__*/_interopDefault(Qe);var wg__default=/*#__PURE__*/_interopDefault(wg);var Rs__default=/*#__PURE__*/_interopDefault(Rs);var Bg__default=/*#__PURE__*/_interopDefault(Bg);var Lg__default=/*#__PURE__*/_interopDefault(Lg);var Ug__default=/*#__PURE__*/_interopDefault(Ug);var Pf__default=/*#__PURE__*/_interopDefault(Pf);var uf__default=/*#__PURE__*/_interopDefault(uf);var wl__default=/*#__PURE__*/_interopDefault(wl);var bi__default=/*#__PURE__*/_interopDefault(bi);var kf__default=/*#__PURE__*/_interopDefault(kf);var Hf__default=/*#__PURE__*/_interopDefault(Hf);var Ml__default=/*#__PURE__*/_interopDefault(Ml);var Vn__default=/*#__PURE__*/_interopDefault(Vn);var ty__default=/*#__PURE__*/_interopDefault(ty);var dy__default=/*#__PURE__*/_interopDefault(dy);var py__default=/*#__PURE__*/_interopDefault(py);var ch__default=/*#__PURE__*/_interopDefault(ch);var hx__default=/*#__PURE__*/_interopDefault(hx);var bh__default=/*#__PURE__*/_interopDefault(bh);var bx__default=/*#__PURE__*/_interopDefault(bx);var Sx__default=/*#__PURE__*/_interopDefault(Sx);var Ah__default=/*#__PURE__*/_interopDefault(Ah);var Ih__default=/*#__PURE__*/_interopDefault(Ih);var Fh__default=/*#__PURE__*/_interopDefault(Fh);var hP__default=/*#__PURE__*/_interopDefault(hP);var CP__default=/*#__PURE__*/_interopDefault(CP);var ed__default=/*#__PURE__*/_interopDefault(ed);var td__default=/*#__PURE__*/_interopDefault(td);var UP__default=/*#__PURE__*/_interopDefault(UP);var mx__default=/*#__PURE__*/_interopDefault(mx);var Yx__default=/*#__PURE__*/_interopDefault(Yx);var tb__default=/*#__PURE__*/_interopDefault(tb);var RS__default=/*#__PURE__*/_interopDefault(RS);var mS__default=/*#__PURE__*/_interopDefault(mS);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 reactNumberFormat.numericFormatter(String(Math.round(e)),o)}function jr(e,t="en-US"){let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:2,fixedDecimalScale:true};return reactNumberFormat.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=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
2
2
|
margin: 0;
|
|
3
|
-
`,pm=
|
|
3
|
+
`,pm=chunk5K62MKBQ_cjs_js.e.div`
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
6
6
|
gap: 16px;
|
|
7
|
-
`,mm=
|
|
7
|
+
`,mm=chunk5K62MKBQ_cjs_js.e.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
flex-shrink: 0;
|
|
11
|
-
`,um=
|
|
11
|
+
`,um=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.i)`
|
|
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 jsxRuntime.jsxs(pm,{className:`stigg-entitlement-row-container ${t}`,children:[jsxRuntime.jsx(mm,{children:jsxRuntime.jsx(um,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsxRuntime.jsx(dm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function fm(e){if(!e)return "";switch(e){case jsClientSdk.EntitlementResetPeriod.Day:return "per day";case jsClientSdk.EntitlementResetPeriod.Hour:return "per hour";case jsClientSdk.EntitlementResetPeriod.Week:return "per week";case jsClientSdk.EntitlementResetPeriod.Month:return "per month";case jsClientSdk.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=
|
|
15
|
+
`;function fo({displayName:e,className:t}){return jsxRuntime.jsxs(pm,{className:`stigg-entitlement-row-container ${t}`,children:[jsxRuntime.jsx(mm,{children:jsxRuntime.jsx(um,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsxRuntime.jsx(dm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function fm(e){if(!e)return "";switch(e){case jsClientSdk.EntitlementResetPeriod.Day:return "per day";case jsClientSdk.EntitlementResetPeriod.Hour:return "per hour";case jsClientSdk.EntitlementResetPeriod.Week:return "per week";case jsClientSdk.EntitlementResetPeriod.Month:return "per month";case jsClientSdk.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=chunk5K62MKBQ_cjs_js.c(i,["displayNameOverride","feature"]),n=t||ym(chunk5K62MKBQ_cjs_js.a({feature:o},r))||"";return jsxRuntime.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 jsxRuntime.jsx(fo,{displayName:t,className:`stigg-credit-entitlement-${e.id}`})}function Sm(e){return e.__typename==="PackageCreditEntitlement"}var Tm=chunk5K62MKBQ_cjs_js.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 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 jsxRuntime.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__default.default(e.packageEntitlements).filter(a=>a.isGranted).filter(a=>{var c;return !((c=a.hiddenFromWidgets)!=null&&c.includes(jsClientSdk.WidgetType.Paywall))}),s=n.length>0||i.length>0;return jsxRuntime.jsxs(Tm,{className:"stigg-plan-entitlements-container",children:[jsxRuntime.jsx(
|
|
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 jsxRuntime.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__default.default(e.packageEntitlements).filter(a=>a.isGranted).filter(a=>{var c;return !((c=a.hiddenFromWidgets)!=null&&c.includes(jsClientSdk.WidgetType.Paywall))}),s=n.length>0||i.length>0;return jsxRuntime.jsxs(Tm,{className:"stigg-plan-entitlements-container",children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-plan-entitlements-title",color:"secondary",variant:"h6",bold:true,children:km(e,o,s)}),n,i.map(a=>Sm(a)?jsxRuntime.jsx(Ta,{entitlement:a},ka(a)):jsxRuntime.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__default.default.extend(Bm__default.default);ho__default.default.extend(Am__default.default);ho__default.default.extend(Im__default.default);var Q=ho__default.default;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 Po({scheduledUpdate:e,subscriptionPrices:t,billingPeriodRange:o,options:r={}}){var s,l;if(!e)return {};let{withDate:n,postfix:i=""}=r;switch(e.subscriptionScheduleType){case jsClientSdk.SubscriptionScheduleType.Downgrade:{let a=n,c=Em(o);return xo__default.default(a)&&c&&(a=!Q(Co(e)).isSame(Q(c),"day")),{line1:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Your subscription will be downgraded to the ",jsxRuntime.jsxs("b",{children:[(s=e.targetPackage)==null?void 0:s.displayName," plan"]})," ",a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["on ",nn(Co(e))]}):i,"."]}),line2:"Until then you still have access to your current plan."}}case jsClientSdk.SubscriptionScheduleType.BillingPeriod:{let a=e.scheduleVariables;return {line1:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Your billing cycle will change to ",jsxRuntime.jsx("b",{children:(l=a.billingPeriod)==null?void 0:l.toLocaleLowerCase()})," ",n?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["on ",nn(Co(e))]}):i,"."]})}}case jsClientSdk.SubscriptionScheduleType.UnitAmount:{let a=e.scheduleVariables,u=ic__default.default(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=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Your subscription will be updated to ",jsxRuntime.jsx("b",{children:a.newUnitAmount})," ",h," ",n?jsxRuntime.jsxs(jsxRuntime.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===jsClientSdk.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(xo__default.default(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__default.default(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 jsClientSdk.TiersMode.Volume:{let n=ln(e.tiers,t);return sn(n,t,o,r)}case jsClientSdk.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&&!xo__default.default(o))}function va(e){return e==null?void 0:e.every(({unitPrice:t,upTo:o})=>!t||xo__default.default(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===jsClientSdk.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===jsClientSdk.BillingModel.PerUnit&&p.tiersMode),i=t.id===(r==null?void 0:r.planId);if(i&&(n=(u=t.pricePoints.find(p=>p.pricingModel===jsClientSdk.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(xo__default.default(a))return 0;let c=e[s];return c<a?-1:c>a?1:0}var Dm=chunk5K62MKBQ_cjs_js.e(Rm__default.default)`
|
|
20
20
|
margin-left: 10px;
|
|
21
|
-
`,$m=
|
|
21
|
+
`,$m=chunk5K62MKBQ_cjs_js.e.button`
|
|
22
22
|
cursor: ${({$disabled:e})=>e?"default":"pointer"};
|
|
23
23
|
padding: 8px 12px;
|
|
24
24
|
background-color: ${({theme:e})=>e.stigg.palette.backgroundButton};
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
&:hover {
|
|
38
38
|
background-color: ${({theme:e,$disabled:t})=>t?e.stigg.palette.backgroundButton:e.stigg.palette.outlinedHoverBackground};
|
|
39
39
|
}
|
|
40
|
-
`,Gm=
|
|
40
|
+
`,Gm=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
41
41
|
margin: 0;
|
|
42
42
|
font-size: 15px;
|
|
43
|
-
`,zm=
|
|
43
|
+
`,zm=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
44
44
|
min-height: 87px;
|
|
45
|
-
`,Vm=
|
|
45
|
+
`,Vm=chunk5K62MKBQ_cjs_js.e.button`
|
|
46
46
|
background: none;
|
|
47
47
|
border: none;
|
|
48
48
|
padding: 0;
|
|
@@ -50,17 +50,17 @@
|
|
|
50
50
|
|
|
51
51
|
text-decoration: underline;
|
|
52
52
|
cursor: pointer;
|
|
53
|
-
`,Hm=
|
|
53
|
+
`,Hm=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
54
54
|
margin-top: 8px;
|
|
55
55
|
margin-bottom: 17px;
|
|
56
56
|
min-height: 20px;
|
|
57
|
-
`,Om=
|
|
57
|
+
`,Om=chunk5K62MKBQ_cjs_js.e.div`
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: column;
|
|
60
60
|
margin-top: 4px;
|
|
61
|
-
align-self: ${({theme:e})=>
|
|
61
|
+
align-self: ${({theme:e})=>chunk5K62MKBQ_cjs_js.j(e.stigg.layout.ctaAlignment)};
|
|
62
62
|
width: 100%;
|
|
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=react.useTheme(),[p,h]=ii.useState(false),{currentPlan:g,custom:y,downgrade:C,startTrial:b,upgrade:x,startNew:S,switchToBillingPeriod:T,cancelScheduledUpdate:F}=s.planCTAButton,B=Na__default.default(C)?C(o):C,I=Na__default.default(x)?x(o):x,k={title:t?o.isLowerThanCurrentPlan?B:I:S,disabled:false,intentionType:o.isLowerThanCurrentPlan?"DOWNGRADE_PLAN":n?"UPGRADE_TRIAL_TO_PAID":"UPGRADE_PLAN"},L=o.pricingType===jsClientSdk.PricingType.Custom,{line1:E}=Po({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&&[jsClientSdk.PricingType.Free,jsClientSdk.PricingType.Custom].includes(o.pricingType))switch(La({perUnitQuantityByFeature:u,plan:o,currentSubscription:a,currentSubscriptionOverride:c})){case -1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=B;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 jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Om,{className:"stigg-paywall-plan-button-layout",children:e&&E?jsxRuntime.jsxs(zm,{color:"secondary",variant:"body1",className:"stigg-paywall-schedule-update-text",children:[E," ",jsxRuntime.jsx(Vm,{color:"secondary",onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:k.title})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.jsx(Gm,{className:"stigg-paywall-plan-button-text",variant:"h6",color:"primary.main",children:k.title}),p&&jsxRuntime.jsx(Dm,{color:f.stigg.palette.text.disabled,loading:true,size:16})]}),l?jsxRuntime.jsx(Hm,{className:"stigg-trial-days-left-text",variant:"h6",color:"secondary",children:o.isCurrentCustomerPlan&&o.trialDaysLeft&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[o.trialDaysLeft," days"]})," left on your free trial"]})}):jsxRuntime.jsx("div",{style:{height:"20px"}})]})})})}var H=({amount:e,currency:t=jsClientSdk.Currency.Usd,locale:o,maximumFractionDigits:r=5,minimumFractionDigits:n=0,removeTrailingZero:i})=>{let s=t.toString(),l=Zm__default.default(s),a=new Intl.NumberFormat(o,
|
|
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=react.useTheme(),[p,h]=ii.useState(false),{currentPlan:g,custom:y,downgrade:C,startTrial:b,upgrade:x,startNew:S,switchToBillingPeriod:T,cancelScheduledUpdate:F}=s.planCTAButton,B=Na__default.default(C)?C(o):C,I=Na__default.default(x)?x(o):x,k={title:t?o.isLowerThanCurrentPlan?B:I:S,disabled:false,intentionType:o.isLowerThanCurrentPlan?"DOWNGRADE_PLAN":n?"UPGRADE_TRIAL_TO_PAID":"UPGRADE_PLAN"},L=o.pricingType===jsClientSdk.PricingType.Custom,{line1:E}=Po({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&&[jsClientSdk.PricingType.Free,jsClientSdk.PricingType.Custom].includes(o.pricingType))switch(La({perUnitQuantityByFeature:u,plan:o,currentSubscription:a,currentSubscriptionOverride:c})){case -1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=B;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 jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(Om,{className:"stigg-paywall-plan-button-layout",children:e&&E?jsxRuntime.jsxs(zm,{color:"secondary",variant:"body1",className:"stigg-paywall-schedule-update-text",children:[E," ",jsxRuntime.jsx(Vm,{color:"secondary",onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:k.title})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.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:[jsxRuntime.jsx(Gm,{className:"stigg-paywall-plan-button-text",variant:"h6",color:"primary.main",children:k.title}),p&&jsxRuntime.jsx(Dm,{color:f.stigg.palette.text.disabled,loading:true,size:16})]}),l?jsxRuntime.jsx(Hm,{className:"stigg-trial-days-left-text",variant:"h6",color:"secondary",children:o.isCurrentCustomerPlan&&o.trialDaysLeft&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("b",{children:[o.trialDaysLeft," days"]})," left on your free trial"]})}):jsxRuntime.jsx("div",{style:{height:"20px"}})]})})})}var H=({amount:e,currency:t=jsClientSdk.Currency.Usd,locale:o,maximumFractionDigits:r=5,minimumFractionDigits:n=0,removeTrailingZero:i})=>{let s=t.toString(),l=Zm__default.default(s),a=new Intl.NumberFormat(o,chunk5K62MKBQ_cjs_js.a({maximumFractionDigits:r,minimumFractionDigits:n,style:"currency",currency:s,trailingZeroDisplay:i?"stripIfInteger":"auto"},l?{currencyDisplay:"code"}:{})).format(e||0);return l&&(a=a.replace(s,l)),a=a.replace(/\s/g,""),a};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===jsClientSdk.BillingPeriod.Annually&&n?c/12:c,p,h,g=i.price.pricePeriod(n?jsClientSdk.BillingPeriod.Monthly:jsClientSdk.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 ${chunk5K62MKBQ_cjs_js.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===jsClientSdk.BillingModel.PerUnit&&!S.isTieredPrice?y=`${T} ${g}`:S.pricingModel===jsClientSdk.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 jsClientSdk.PricingType.Free:return typeof o.price.free=="function"?o.price.free(e.paywallCurrency):o.price.free;case jsClientSdk.PricingType.Custom:return {price:typeof o.price.custom=="function"?o.price.custom({plan:e,selectedBillingPeriod:t}):o.price.custom};case jsClientSdk.PricingType.Paid:{let l=e.pricePoints.filter(u=>u.billingPeriod===t),a=(s=e.paywallCalculatedPricePoints)==null?void 0:s.find(u=>u.billingPeriod===t);if(!(l!=null&&l.length)&&!a)return {price:o.price.priceNotSet};let c={planPrices:l,paywallCalculatedPrice:a,selectedBillingPeriod:t,perUnitQuantityByFeature:i||{}};return o.price.paid?o.price.paid(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},c),{plan:e})):Ua(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},c),{locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:o}))}default:return {price:""}}}var Qm=chunk5K62MKBQ_cjs_js.e(Ym__default.default,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
64
64
|
border-radius: 10px;
|
|
65
65
|
text-transform: none;
|
|
66
66
|
font-weight: 300;
|
|
@@ -71,10 +71,10 @@
|
|
|
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=
|
|
74
|
+
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=chunk5K62MKBQ_cjs_js.c(r,["variant"]);return jsxRuntime.jsx(Qm,chunk5K62MKBQ_cjs_js.a({variant:e},t))};var ce=chunk5K62MKBQ_cjs_js.e(qm__default.default)(({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":chunk5K62MKBQ_cjs_js.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=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: column;
|
|
77
|
-
`;function Da(){return jsxRuntime.jsxs(_a,{container:true,children:[jsxRuntime.jsxs(
|
|
77
|
+
`;function Da(){return jsxRuntime.jsxs(_a,{container:true,children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.l,{item:true,$gap:48,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20})]}),jsxRuntime.jsx(Cl__default.default,{className:"stigg-checkout-plan-header-divider",sx:{marginY:2}}),jsxRuntime.jsxs(_a,{item:true,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.m,{$gap:16,marginTop:3,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20})]}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.l,{$gap:130,marginTop:3,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.n,{flex:1,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20})}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.n,{flex:3,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20})})]})]})]})}var Ct=e=>e.target.blur();function $a({width:e,tierUnits:t,value:o,handleChange:r,errorMessage:n}){return jsxRuntime.jsx(ce,{type:"number",onWheel:Ct,fullWidth:true,error:!!n,sx:{minHeight:"46px",width:e},InputProps:{endAdornment:jsxRuntime.jsx(jm__default.default,{position:"end",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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=chunk5K62MKBQ_cjs_js.e(tu__default.default)`
|
|
78
78
|
border-radius: 10px;
|
|
79
79
|
min-height: 42px;
|
|
80
80
|
min-width: 120px;
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
&:hover .MuiOutlinedInput-notchedOutline {
|
|
83
83
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
84
84
|
}
|
|
85
|
-
`,iu=
|
|
85
|
+
`,iu=chunk5K62MKBQ_cjs_js.e(eu__default.default)`
|
|
86
86
|
& .MuiInputBase-input {
|
|
87
87
|
padding: 10px 12px;
|
|
88
88
|
}
|
|
@@ -90,34 +90,34 @@
|
|
|
90
90
|
&.Mui-focused .MuiOutlinedInput-notchedOutline {
|
|
91
91
|
border-color: ${({theme:e})=>e.stigg.palette.primary} !important;
|
|
92
92
|
}
|
|
93
|
-
`;function Ga({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsxRuntime.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:jsxRuntime.jsx(iu,{}),MenuProps:{MenuListProps:{disablePadding:true},PaperProps:{sx:{marginTop:"4px",borderRadius:"10px"}}},children:ru__default.default(r,s=>{var l;return jsxRuntime.jsx(ou__default.default,{className:"stigg-price-tier-menu-item-text",value:(l=s.upTo)==null?void 0:l.toString(),children:jsxRuntime.jsxs(
|
|
93
|
+
`;function Ga({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsxRuntime.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:jsxRuntime.jsx(iu,{}),MenuProps:{MenuListProps:{disablePadding:true},PaperProps:{sx:{marginTop:"4px",borderRadius:"10px"}}},children:ru__default.default(r,s=>{var l;return jsxRuntime.jsx(ou__default.default,{className:"stigg-price-tier-menu-item-text",value:(l=s.upTo)==null?void 0:l.toString(),children:jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",style:{lineHeight:"unset"},children:[ie(s.upTo)," ",o]})},s.upTo)})}):null}var lu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
94
94
|
min-height: 46px;
|
|
95
|
-
`;function To(e){let{tiers:t,errorMessage:o}=e;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsxRuntime.jsx(lu,{as:"div",className:"stigg-price-tier-select",children:Gt(t)?jsxRuntime.jsx($a,
|
|
95
|
+
`;function To(e){let{tiers:t,errorMessage:o}=e;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsxRuntime.jsx(lu,{as:"div",className:"stigg-price-tier-select",children:Gt(t)?jsxRuntime.jsx($a,chunk5K62MKBQ_cjs_js.a({},e)):jsxRuntime.jsx(Ga,chunk5K62MKBQ_cjs_js.a({},e))}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{style:{margin:"4px"},variant:"caption",color:"error",children:o})]})})}var Va="\u200E",pu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
96
96
|
word-break: break-word;
|
|
97
97
|
width: 100%;
|
|
98
|
-
`,mu=
|
|
98
|
+
`,mu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
99
99
|
white-space: nowrap;
|
|
100
|
-
`,uu=
|
|
100
|
+
`,uu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.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=Va;return i&&o&&r&&(s=((a=(l=n.price).billingPeriod)==null?void 0:a.call(l,t))||`, billed ${t.toLowerCase()}`),jsxRuntime.jsx(
|
|
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()}`),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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,hasAnnuallyPrice:c,perUnitQuantityByFeature:u,setPerUnitQuantityByFeature:f})=>{var T;let{price:p,unit:h,tiers:g,tierUnits:y}=So(n,i,s,l,a,u),C=n.pricePoints.find(F=>F.billingPeriod===i&&F.isTieredPrice),b=C?C.feature.featureId:void 0,x=(T=u[b||""])!=null?T:1,S=F=>{b&&f(B=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},B),{[b]:F}));};return jsxRuntime.jsx(pu,{as:"div",className:"stigg-price-text",children:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[o&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{style:{minHeight:"20px"},className:"stigg-starting-at-text",variant:"body1",color:"secondary",children:e?s.price.startingAtCaption:Va}),jsxRuntime.jsx(uu,{className:"stigg-price-point",variant:"h1",children:p}),t&&jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{as:"div",className:"stigg-price-unit-and-billing-period-text",style:{minHeight:"48px"},children:[jsxRuntime.jsx(mu,{className:"stigg-price-unit-text",as:"span",variant:"h6",color:"secondary",children:h}),jsxRuntime.jsx(gu,{plan:n,billingPeriod:i,hasAnnuallyPrice:c,hasMonthlyPrice:a,paywallLocale:s})]}),r?jsxRuntime.jsx(To,{componentId:`${n.id}_${b}_tier`,tiers:g,tierUnits:y,tiersMode:C==null?void 0:C.tiersMode,handleChange:S,value:x}):null]})})};var xu=chunk5K62MKBQ_cjs_js.e(Ym__default.default)`
|
|
104
104
|
padding: 0px;
|
|
105
105
|
text-transform: none;
|
|
106
106
|
margin-left: 0px;
|
|
107
|
-
`,bu=
|
|
107
|
+
`,bu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
108
108
|
font-size: 14px;
|
|
109
109
|
font-weight: 500;
|
|
110
|
-
`,Su=
|
|
110
|
+
`,Su=chunk5K62MKBQ_cjs_js.e.div`
|
|
111
111
|
width: 100%;
|
|
112
112
|
gap: 10px;
|
|
113
|
-
`,Tu=
|
|
113
|
+
`,Tu=chunk5K62MKBQ_cjs_js.e.div`
|
|
114
114
|
margin-top: 10px;
|
|
115
115
|
overflow: hidden;
|
|
116
116
|
display: flex;
|
|
117
117
|
flex-direction: column;
|
|
118
118
|
gap: 4px;
|
|
119
119
|
width: 100%;
|
|
120
|
-
`,ku=
|
|
120
|
+
`,ku=chunk5K62MKBQ_cjs_js.e.div`
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-direction: row;
|
|
123
123
|
flex-wrap: nowrap;
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
padding: 8px 0px;
|
|
127
127
|
max-height: 44px;
|
|
128
128
|
gap: 16px;
|
|
129
|
-
`,wu=
|
|
129
|
+
`,wu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
130
130
|
overflow: hidden;
|
|
131
131
|
font-feature-settings: 'liga' off, 'clig' off;
|
|
132
132
|
text-overflow: ellipsis;
|
|
@@ -135,17 +135,17 @@
|
|
|
135
135
|
white-space: nowrap;
|
|
136
136
|
min-width: 0;
|
|
137
137
|
flex-shrink: 1;
|
|
138
|
-
`,Bu=
|
|
138
|
+
`,Bu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.i)`
|
|
139
139
|
width: 24px;
|
|
140
140
|
height: 24px;
|
|
141
141
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
142
|
-
`,Au=
|
|
142
|
+
`,Au=chunk5K62MKBQ_cjs_js.e.div`
|
|
143
143
|
flex: 1;
|
|
144
144
|
min-width: 0;
|
|
145
|
-
`,Iu=
|
|
145
|
+
`,Iu=chunk5K62MKBQ_cjs_js.e.div`
|
|
146
146
|
margin-top: 16px;
|
|
147
147
|
display: flex;
|
|
148
|
-
`,yn=4;function hn({addons:e,paywallLocale:t}){let[o,r]=ii.useState(false);if(!e||e.length===0)return null;let n=e.filter(l=>{var a;return !((a=l.hiddenFromWidgets)!=null&&a.includes(jsClientSdk.WidgetType.Paywall))}),i=()=>{r(!o);},s=o?n:n.slice(0,yn);return s.length===0?null:jsxRuntime.jsxs(Su,{className:"stigg-compatible-addons-container",children:[jsxRuntime.jsx(
|
|
148
|
+
`,yn=4;function hn({addons:e,paywallLocale:t}){let[o,r]=ii.useState(false);if(!e||e.length===0)return null;let n=e.filter(l=>{var a;return !((a=l.hiddenFromWidgets)!=null&&a.includes(jsClientSdk.WidgetType.Paywall))}),i=()=>{r(!o);},s=o?n:n.slice(0,yn);return s.length===0?null:jsxRuntime.jsxs(Su,{className:"stigg-compatible-addons-container",children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-compatible-addons-header",color:"secondary",variant:"body1",bold:true,children:t.addonsTitle}),jsxRuntime.jsx(Tu,{className:"stigg-compatible-addons-list",children:s.map(l=>jsxRuntime.jsxs(ku,{className:Pu__default.default(`stigg-compatible-addon--${l.id}`,"stigg-compatible-addon-item"),children:[jsxRuntime.jsx(Bu,{icon:"Add",className:"stigg-compatible-addon-icon"}),jsxRuntime.jsx(Au,{className:"stigg-compatible-addon-content",children:jsxRuntime.jsx(wu,{variant:"body1",color:"primary",className:"stigg-compatible-addon-name",children:l.displayName})})]},l.id))}),n.length>yn&&jsxRuntime.jsx(Iu,{children:jsxRuntime.jsx(xu,{variant:"text",onClick:i,children:jsxRuntime.jsx(bu,{color:"primary.main",children:o?"Show less":`Show ${n.length-yn} more`})})})]})}var Nu="66px",Mu=chunk5K62MKBQ_cjs_js.e.div`
|
|
149
149
|
position: relative;
|
|
150
150
|
background-color: ${({theme:e,$isCurrentPlan:t})=>t?e.stigg.palette.backgroundHighlight:e.stigg.palette.backgroundPaper};
|
|
151
151
|
border: ${({theme:e,$isHighlighted:t})=>t?`3px solid ${e.stigg.palette.primary}`:`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
@@ -158,38 +158,38 @@
|
|
|
158
158
|
align-items: flex-start;
|
|
159
159
|
justify-content: flex-start;
|
|
160
160
|
position: relative;
|
|
161
|
-
`,Ru=
|
|
161
|
+
`,Ru=chunk5K62MKBQ_cjs_js.e.div`
|
|
162
162
|
margin-top: ${({$planHasEntitlements:e})=>e?"32px":"0px"};
|
|
163
|
-
`,Uu=
|
|
163
|
+
`,Uu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
164
164
|
padding-bottom: 8px;
|
|
165
|
-
`,_u=
|
|
165
|
+
`,_u=chunk5K62MKBQ_cjs_js.e.div`
|
|
166
166
|
height: 2px;
|
|
167
167
|
width: 100%;
|
|
168
168
|
background-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
169
169
|
margin-bottom: 40px;
|
|
170
|
-
`,Du=
|
|
170
|
+
`,Du=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
171
171
|
text-align: ${({theme:e})=>e.stigg.layout.descriptionAlignment};
|
|
172
172
|
min-height: ${({theme:e})=>e.stigg.layout.descriptionMinHeight};
|
|
173
|
-
`,$u=
|
|
173
|
+
`,$u=chunk5K62MKBQ_cjs_js.e.div`
|
|
174
174
|
background-color: ${({theme:e})=>e.stigg.palette.primary};
|
|
175
175
|
border-radius: 40px;
|
|
176
176
|
position: absolute;
|
|
177
177
|
top: -12px;
|
|
178
|
-
`,Gu=
|
|
178
|
+
`,Gu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
179
179
|
margin: 0;
|
|
180
180
|
padding: 2px 8px;
|
|
181
|
-
`,zu=
|
|
181
|
+
`,zu=chunk5K62MKBQ_cjs_js.e.div`
|
|
182
182
|
width: 100%;
|
|
183
183
|
display: flex;
|
|
184
184
|
flex-direction: column;
|
|
185
|
-
align-items: ${({theme:e})=>
|
|
186
|
-
`,Vu=
|
|
185
|
+
align-items: ${({theme:e})=>chunk5K62MKBQ_cjs_js.j(e.stigg.layout.headerAlignment)};
|
|
186
|
+
`,Vu=chunk5K62MKBQ_cjs_js.e.div`
|
|
187
187
|
position: absolute;
|
|
188
188
|
top: 0;
|
|
189
189
|
background-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
190
190
|
border-radius: 0px 0px 10px 10px;
|
|
191
191
|
padding: 3px 12px;
|
|
192
|
-
`,Hu=
|
|
192
|
+
`,Hu=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.g)`
|
|
193
193
|
display: flex;
|
|
194
194
|
height: 100%;
|
|
195
195
|
margin-right: 4px;
|
|
@@ -197,7 +197,7 @@
|
|
|
197
197
|
path {
|
|
198
198
|
fill: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
199
199
|
}
|
|
200
|
-
`;function Ou({text:e="Next",iconsColor:t}){return jsxRuntime.jsx(Vu,{children:jsxRuntime.jsxs(Me__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsx(Hu,{$iconsColor:t}),jsxRuntime.jsx(
|
|
200
|
+
`;function Ou({text:e="Next",iconsColor:t}){return jsxRuntime.jsx(Vu,{children:jsxRuntime.jsxs(Me__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsx(Hu,{$iconsColor:t}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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),B=($=n.paywallCalculatedPricePoints)==null?void 0:$.find(q=>q.billingPeriod===i),I=F.length>1&&!!(B!=null&&B.additionalChargesMayApply),k=!b||n.pricingType===jsClientSdk.PricingType.Custom,L=null;T?L=jsxRuntime.jsx(Ou,{text:"Next plan"}):s&&g.highlightChip&&(L=jsxRuntime.jsx($u,{className:"stigg-highlight-badge",children:jsxRuntime.jsx(Gu,{className:"stigg-highlight-badge-text",color:"white",bold:true,children:g.highlightChip})}));let[E,A]=ii.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 jsxRuntime.jsxs(Mu,{className:Pu__default.default(`stigg-${n.id}`,"stigg-plan-offering-container",{"stigg-current-plan":n.isCurrentCustomerPlan}),$isHighlighted:s,$isCurrentPlan:n.isCurrentCustomerPlan,children:[L,jsxRuntime.jsxs(zu,{className:"stigg-header-wrapper",children:[jsxRuntime.jsx(Uu,{className:"stigg-plan-header",variant:"h3",children:n.displayName}),c&&jsxRuntime.jsx(Du,{className:"stigg-plan-description",variant:"h6",color:"secondary",children:n.description}),jsxRuntime.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?jsxRuntime.jsx(Ma,{isNextPlan:T,customer:r,plan:n,currentSubscription:l,currentSubscriptionOverride:a,billingPeriod:i,isCustomerOnTrial:p,onPlanSelected:Z,paywallLocale:g,withTrialLeftRow:o,perUnitQuantityByFeature:E}):jsxRuntime.jsx("div",{style:{height:Nu}}),jsxRuntime.jsx(_u,{className:"stigg-plan-header-divider"})]}),jsxRuntime.jsx(wa,{plan:n,billingPeriod:i,paywallLocale:g}),jsxRuntime.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&&jsxRuntime.jsx(hn,{addons:n.compatibleAddons,paywallLocale:g})})]})}var Zu=chunk5K62MKBQ_cjs_js.e.div`
|
|
201
201
|
height: 40px;
|
|
202
202
|
padding: 0 20px;
|
|
203
203
|
margin-bottom: ${({theme:e})=>e.stigg.layout.switchBottomSpacing};
|
|
@@ -207,9 +207,9 @@
|
|
|
207
207
|
display: flex;
|
|
208
208
|
align-items: center;
|
|
209
209
|
justify-content: center;
|
|
210
|
-
`,Za=
|
|
210
|
+
`,Za=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
211
211
|
margin: 0 8px;
|
|
212
|
-
`,Yu=
|
|
212
|
+
`,Yu=chunk5K62MKBQ_cjs_js.e(Wu__default.default)`
|
|
213
213
|
& .react-switch-bg {
|
|
214
214
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.switchBorder}`};
|
|
215
215
|
background: ${({theme:e})=>e.stigg.palette.switchFill} !important;
|
|
@@ -220,7 +220,7 @@
|
|
|
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 jsxRuntime.jsxs(
|
|
223
|
+
`;function Qu({discount:e,disabled:t}){return jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.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===jsClientSdk.BillingPeriod.Monthly;return jsxRuntime.jsxs(Zu,{className:"stigg-period-picker-container",children:[jsxRuntime.jsx(Za,{variant:"h6",className:"stigg-monthly-period-text",color:n?"primary":"disabled",children:"Monthly"}),jsxRuntime.jsx(Yu,{className:"stigg-period-switch",uncheckedIcon:false,checkedIcon:false,height:16,width:33,onChange:i=>o(i?jsClientSdk.BillingPeriod.Annually:jsClientSdk.BillingPeriod.Monthly),checked:!n,borderRadius:10,handleDiameter:19}),jsxRuntime.jsx(Za,{variant:"h6",className:"stigg-annual-period-text",color:n?"disabled":"primary",children:"Annual"}),e!==0&&jsxRuntime.jsx(Qu,{discount:e,disabled:n})]})}function Ku(e,t){if(!xo__default.default(e)&&!xo__default.default(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,jsClientSdk.BillingPeriod.Monthly),n=Ja(o,jsClientSdk.BillingPeriod.Annually),i=Ku(r,n);return i&&(t=Math.max(t,i)),t},0)}function xn(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function bn(e,t){return e.some(o=>xn(o,t))}function ja(e,t,o){return e.filter(r=>r.pricingType!==jsClientSdk.PricingType.Paid||xn(r,t)).filter(r=>!o||!o({plan:r}))}var ju=chunk5K62MKBQ_cjs_js.e.div`
|
|
224
224
|
color: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
225
225
|
display: flex;
|
|
226
226
|
align-items: stretch;
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
flex-wrap: wrap;
|
|
229
229
|
padding: 10px 0;
|
|
230
230
|
gap: ${({theme:e})=>e.stigg.layout.planMargin};
|
|
231
|
-
`,eg=
|
|
231
|
+
`,eg=chunk5K62MKBQ_cjs_js.e.div`
|
|
232
232
|
display: flex;
|
|
233
233
|
flex-direction: column;
|
|
234
234
|
align-items: center;
|
|
@@ -236,17 +236,17 @@
|
|
|
236
236
|
& * {
|
|
237
237
|
box-sizing: border-box;
|
|
238
238
|
}
|
|
239
|
-
`,tg=
|
|
239
|
+
`,tg=chunk5K62MKBQ_cjs_js.e.div`
|
|
240
240
|
display: flex;
|
|
241
241
|
flex-direction: column;
|
|
242
242
|
align-items: center;
|
|
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,jsClientSdk.BillingPeriod.Monthly),S=bn(e,jsClientSdk.BillingPeriod.Annually),T=ja(e,n,f),F=ii.useCallback((A,Z,$)=>a({plan:A,customer:t,subscription:o,intentionType:Z,selectedBillingPeriod:n,billableFeatures:$}),[t,n,o,a]),B=!!o&&o.plan.pricingType===jsClientSdk.PricingType.Custom,I=ii.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=ii.useMemo(()=>T.some(A=>!!So(A,n,c,u,x).unit),[n,x,u,c,T]),L=ii.useMemo(()=>!B&&T.some(A=>{let Z=bo({plan:A,billingPeriod:n,currentSubscription:o,currentSubscriptionOverride:h});return Object.values(Z).length>0}),[n,o,h,B,T]),E=T.some(A=>A.isCurrentCustomerPlan&&A.trialDaysLeft);return jsxRuntime.jsx(eg,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(tg,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(Ya,{onBillingPeriodChanged:i,selectedBillingPeriod:n,availableBillingPeriods:s,discountRate:C}),jsxRuntime.jsx(ju,{className:"stigg-paywall-plans-layout",children:T.map(A=>jsxRuntime.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:B,selectDefaultTierIndex:p,hideCompatibleAddons:g},A.id))}),jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.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__default.default(r),i=ig__default.default(r),s;if(o&&i.includes(o))s=o;else if(t){let l=t.find(a=>a.status===jsClientSdk.SubscriptionStatus.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(n[jsClientSdk.BillingPeriod.Monthly]||0)>(n[jsClientSdk.BillingPeriod.Annually]||0)?jsClientSdk.BillingPeriod.Monthly:jsClientSdk.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 jsClientSdk.FontWeight.Normal:return "normal";case jsClientSdk.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 jsClientSdk.Alignment.Left:return "left";case jsClientSdk.Alignment.Center:return "center";case jsClientSdk.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===jsClientSdk.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===jsClientSdk.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}=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:B})=>B===jsClientSdk.SubscriptionScheduleType.Downgrade),b=g.find(({subscriptionScheduleType:B})=>B===jsClientSdk.SubscriptionScheduleType.BillingPeriod),x=Yl__default.default(r,B=>B.order).map(B=>{var E;let I=(E=s==null?void 0:s.eligibleForTrial)==null?void 0:E.find(A=>A.productId===B.product.id),k=h!=null&&h.planId?(h==null?void 0:h.planId)===B.id:B.id===(u==null?void 0:u.id),L=A=>{var z;let Z=C==null?void 0:C.scheduleVariables,$=b==null?void 0:b.scheduleVariables,_=B.pricePoints.some(q=>q.billingPeriod===A);return C?((z=C.targetPackage)==null?void 0:z.refId)===B.id&&(!_||Z.billingPeriod===A):b&&k?$.billingPeriod===A:false};return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},B),{paywallCalculatedPricePoints:a==null?void 0:a.filter(A=>A.planId===B.id),isTriable:!xo__default.default(B.defaultTrialConfig)&&(!I||I.eligible),isCurrentCustomerPlan:k,currentCustomerPlanBillingPeriod:y,isUpcomingPlan:false,trialDaysLeft:p,isNextPlan:L,paywallCurrency:n,scheduledUpdate:C||b})});if(r&&u){let B=u&&((F=r==null?void 0:r.find(I=>I.id===(u==null?void 0:u.id)))==null?void 0:F.order);xo__default.default(B)||(x=x.map(I=>chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},I),{isLowerThanCurrentPlan:B>I.order})),t&&(x=x.filter(I=>I.order>=B)));}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,preferredBillingPeriod:n,currentSubscriptionOverrideFn:i}){let{stigg:s,locale:l}=chunkSP6WPFZZ_cjs_js.u(),[a,c]=ii.useState(jsClientSdk.BillingPeriod.Annually),[u,f]=ii.useState([]),[p,h]=ii.useState(null),[g,y]=ii.useState(true);ii.useEffect(()=>{chunkSP6WPFZZ_cjs_js.d(null,null,function*(){try{y(!0),yield s.waitForInitialization();let x=yield s.getPaywall({productId:e,resourceId:t,billingCountryCode:r}),{availableBillingPeriods:S,defaultBillingPeriod:T}=os(x.plans,x.activeSubscriptions,n);h(x),f(S),c(T);}catch(x){chunkSP6WPFZZ_cjs_js.r.error(`Failed to load paywall ${x==null?void 0:x.message}`,x);}finally{y(false);}});},[s,e,s.isCustomerLoaded,r,t,n]);let C=ps(p,o,i);return chunkSP6WPFZZ_cjs_js.a({customer:(p==null?void 0:p.customer)||null,isLoading:g,selectedBillingPeriod:a,setSelectedBillingPeriod:c,availableBillingPeriods:u,locale:l,configuration:C.paywallConfiguration,showWatermark:s.getShowWatermark()},C)}function gs(e){return dg__default.default({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===jsClientSdk.BillingPeriod.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:o=>o===jsClientSdk.BillingPeriod.Monthly?"/ month":"/ year",free:o=>({price:`${o==null?void 0:o.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},e)}var pg=e=>jsxRuntime.jsx("svg",chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxRuntime.jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),ys=pg;var mg=chunkSP6WPFZZ_cjs_js.e.div`
|
|
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,jsClientSdk.BillingPeriod.Monthly),S=bn(e,jsClientSdk.BillingPeriod.Annually),T=ja(e,n,f),F=ii.useCallback((A,Z,$)=>a({plan:A,customer:t,subscription:o,intentionType:Z,selectedBillingPeriod:n,billableFeatures:$}),[t,n,o,a]),B=!!o&&o.plan.pricingType===jsClientSdk.PricingType.Custom,I=ii.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=ii.useMemo(()=>T.some(A=>!!So(A,n,c,u,x).unit),[n,x,u,c,T]),L=ii.useMemo(()=>!B&&T.some(A=>{let Z=bo({plan:A,billingPeriod:n,currentSubscription:o,currentSubscriptionOverride:h});return Object.values(Z).length>0}),[n,o,h,B,T]),E=T.some(A=>A.isCurrentCustomerPlan&&A.trialDaysLeft);return jsxRuntime.jsx(eg,{className:"stigg-paywall-container",children:jsxRuntime.jsxs(tg,{className:"stigg-paywall-layout",children:[jsxRuntime.jsx(Ya,{onBillingPeriodChanged:i,selectedBillingPeriod:n,availableBillingPeriods:s,discountRate:C}),jsxRuntime.jsx(ju,{className:"stigg-paywall-plans-layout",children:T.map(A=>jsxRuntime.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:B,selectDefaultTierIndex:p,hideCompatibleAddons:g},A.id))}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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__default.default(r),i=ig__default.default(r),s;if(o&&i.includes(o))s=o;else if(t){let l=t.find(a=>a.status===jsClientSdk.SubscriptionStatus.Active);l&&l.prices.length>0&&(s=l==null?void 0:l.prices[0].billingPeriod);}return s||(s=(n[jsClientSdk.BillingPeriod.Monthly]||0)>(n[jsClientSdk.BillingPeriod.Annually]||0)?jsClientSdk.BillingPeriod.Monthly:jsClientSdk.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 jsClientSdk.FontWeight.Normal:return "normal";case jsClientSdk.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 jsClientSdk.Alignment.Left:return "left";case jsClientSdk.Alignment.Center:return "center";case jsClientSdk.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===jsClientSdk.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===jsClientSdk.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}=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:B})=>B===jsClientSdk.SubscriptionScheduleType.Downgrade),b=g.find(({subscriptionScheduleType:B})=>B===jsClientSdk.SubscriptionScheduleType.BillingPeriod),x=Yl__default.default(r,B=>B.order).map(B=>{var E;let I=(E=s==null?void 0:s.eligibleForTrial)==null?void 0:E.find(A=>A.productId===B.product.id),k=h!=null&&h.planId?(h==null?void 0:h.planId)===B.id:B.id===(u==null?void 0:u.id),L=A=>{var z;let Z=C==null?void 0:C.scheduleVariables,$=b==null?void 0:b.scheduleVariables,_=B.pricePoints.some(q=>q.billingPeriod===A);return C?((z=C.targetPackage)==null?void 0:z.refId)===B.id&&(!_||Z.billingPeriod===A):b&&k?$.billingPeriod===A:false};return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},B),{paywallCalculatedPricePoints:a==null?void 0:a.filter(A=>A.planId===B.id),isTriable:!xo__default.default(B.defaultTrialConfig)&&(!I||I.eligible),isCurrentCustomerPlan:k,currentCustomerPlanBillingPeriod:y,isUpcomingPlan:false,trialDaysLeft:p,isNextPlan:L,paywallCurrency:n,scheduledUpdate:C||b})});if(r&&u){let B=u&&((F=r==null?void 0:r.find(I=>I.id===(u==null?void 0:u.id)))==null?void 0:F.order);xo__default.default(B)||(x=x.map(I=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},I),{isLowerThanCurrentPlan:B>I.order})),t&&(x=x.filter(I=>I.order>=B)));}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,preferredBillingPeriod:n,currentSubscriptionOverrideFn:i}){let{stigg:s,locale:l}=chunk5K62MKBQ_cjs_js.u(),[a,c]=ii.useState(jsClientSdk.BillingPeriod.Annually),[u,f]=ii.useState([]),[p,h]=ii.useState(null),[g,y]=ii.useState(true);ii.useEffect(()=>{chunk5K62MKBQ_cjs_js.d(null,null,function*(){try{y(!0),yield s.waitForInitialization();let x=yield s.getPaywall({productId:e,resourceId:t,billingCountryCode:r}),{availableBillingPeriods:S,defaultBillingPeriod:T}=os(x.plans,x.activeSubscriptions,n);h(x),f(S),c(T);}catch(x){chunk5K62MKBQ_cjs_js.r.error(`Failed to load paywall ${x==null?void 0:x.message}`,x);}finally{y(false);}});},[s,e,s.isCustomerLoaded,r,t,n]);let C=ps(p,o,i);return chunk5K62MKBQ_cjs_js.a({customer:(p==null?void 0:p.customer)||null,isLoading:g,selectedBillingPeriod:a,setSelectedBillingPeriod:c,availableBillingPeriods:u,locale:l,configuration:C.paywallConfiguration,showWatermark:s.getShowWatermark()},C)}function gs(e){return dg__default.default({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===jsClientSdk.BillingPeriod.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:o=>o===jsClientSdk.BillingPeriod.Monthly?"/ month":"/ year",free:o=>({price:`${o==null?void 0:o.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},e)}var pg=e=>jsxRuntime.jsx("svg",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxRuntime.jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),ys=pg;var mg=chunk5K62MKBQ_cjs_js.e.div`
|
|
244
244
|
display: flex;
|
|
245
245
|
flex-direction: column;
|
|
246
246
|
align-items: center;
|
|
247
|
-
`,wn=
|
|
247
|
+
`,wn=chunk5K62MKBQ_cjs_js.e(ys)`
|
|
248
248
|
margin-right: 16px;
|
|
249
|
-
`,ug=
|
|
249
|
+
`,ug=chunk5K62MKBQ_cjs_js.e.div`
|
|
250
250
|
display: flex;
|
|
251
251
|
flex-direction: column;
|
|
252
252
|
align-items: flex-start;
|
|
@@ -258,25 +258,25 @@
|
|
|
258
258
|
max-width: ${({theme:e})=>e.stigg.layout.planMaxWidth};
|
|
259
259
|
min-height: 450px;
|
|
260
260
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
261
|
-
`,gg=
|
|
261
|
+
`,gg=chunk5K62MKBQ_cjs_js.e.div`
|
|
262
262
|
display: flex;
|
|
263
263
|
gap: ${({theme:e})=>e.stigg.layout.planMargin};
|
|
264
264
|
flex-wrap: wrap;
|
|
265
265
|
justify-content: center;
|
|
266
|
-
`,Bn=
|
|
266
|
+
`,Bn=chunk5K62MKBQ_cjs_js.e.div`
|
|
267
267
|
display: flex;
|
|
268
268
|
align-items: center;
|
|
269
269
|
margin-bottom: 12px;
|
|
270
|
-
`,fg=
|
|
270
|
+
`,fg=chunk5K62MKBQ_cjs_js.e.div`
|
|
271
271
|
margin-top: auto;
|
|
272
|
-
`,yg=
|
|
272
|
+
`,yg=chunk5K62MKBQ_cjs_js.e.div`
|
|
273
273
|
width: 150px;
|
|
274
274
|
margin-bottom: ${({theme:e})=>e.stigg.layout.switchBottomSpacing};
|
|
275
275
|
padding: 12px 12px;
|
|
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 jsxRuntime.jsxs(ug,{children:[jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4}),jsxRuntime.jsx(Qe__default.default,{circle:true,width:40,height:40}),jsxRuntime.jsx(Qe__default.default,{style:{marginBottom:33},width:120,borderRadius:4}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsx(fg,{children:jsxRuntime.jsx(Qe__default.default,{height:50,borderRadius:4})})]})}function hs({skeletonPlanCount:e=3}){return jsxRuntime.jsxs(mg,{className:"stigg-skeleton-loader-container",children:[jsxRuntime.jsx(yg,{className:"stigg-skeleton-loader-billing-period",children:jsxRuntime.jsx(Qe__default.default,{borderRadius:4})}),jsxRuntime.jsx(gg,{className:"stigg-skeleton-loader-plans-container",children:Array.from({length:e}).map((t,o)=>jsxRuntime.jsx(hg,{},o))})]})}var ee=ii__default.default.createContext(null);ee.displayName="CustomerPortalContext";var W=()=>{let e=ii.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 !!ii.useContext(e)}var Ps=({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:B,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?jsxRuntime.jsx(hs,{skeletonPlanCount:h}):jsxRuntime.jsx(ts,{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:S,selectedBillingPeriod:B,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?_:jsxRuntime.jsx(
|
|
279
|
+
`;function hg(){return jsxRuntime.jsxs(ug,{children:[jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4}),jsxRuntime.jsx(Qe__default.default,{circle:true,width:40,height:40}),jsxRuntime.jsx(Qe__default.default,{style:{marginBottom:33},width:120,borderRadius:4}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsxs(Bn,{children:[jsxRuntime.jsx(wn,{}),jsxRuntime.jsx(Qe__default.default,{width:120,borderRadius:4})]}),jsxRuntime.jsx(fg,{children:jsxRuntime.jsx(Qe__default.default,{height:50,borderRadius:4})})]})}function hs({skeletonPlanCount:e=3}){return jsxRuntime.jsxs(mg,{className:"stigg-skeleton-loader-container",children:[jsxRuntime.jsx(yg,{className:"stigg-skeleton-loader-billing-period",children:jsxRuntime.jsx(Qe__default.default,{borderRadius:4})}),jsxRuntime.jsx(gg,{className:"stigg-skeleton-loader-plans-container",children:Array.from({length:e}).map((t,o)=>jsxRuntime.jsx(hg,{},o))})]})}var ee=ii__default.default.createContext(null);ee.displayName="CustomerPortalContext";var W=()=>{let e=ii.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 !!ii.useContext(e)}var Ps=({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:B,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?jsxRuntime.jsx(hs,{skeletonPlanCount:h}):jsxRuntime.jsx(ts,{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:S,selectedBillingPeriod:B,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?_:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:E,children:_})};function bs({resourceId:e,productId:t}){let{stigg:o,customerPortalUpdatedAt:r}=chunk5K62MKBQ_cjs_js.u(),[n,i]=ii.useState(false),[s,l]=ii.useState();return ii.useEffect(()=>{chunk5K62MKBQ_cjs_js.d(null,null,function*(){if(o.isCustomerLoaded)try{i(!0);let c=yield o.getCustomerPortal({resourceId:e,productId:t});l(c);}catch(c){chunk5K62MKBQ_cjs_js.r.error(`Failed to load customer portal ${c==null?void 0:c.message}`,c);}finally{i(false);}});},[o,o.isCustomerLoaded,r,e,t]),{customerPortal:s,showWatermark:o.getShowWatermark(),isLoading:n}}function Ss(e){return dg__default.default({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}=chunk5K62MKBQ_cjs_js.u(),{customerPortal:s,isLoading:l,showWatermark:a}=bs({resourceId:r,productId:n}),c=s!=null&&s.configuration?is(s.configuration):void 0,u=chunk5K62MKBQ_cjs_js.v(c),f=Ts(u,o,s==null?void 0:s.configuration),p=Ss(t);return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:c,children:jsxRuntime.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=chunk5K62MKBQ_cjs_js.e(Ym__default.default)`
|
|
280
280
|
border-radius: 10px;
|
|
281
281
|
padding: 8px 16px;
|
|
282
282
|
text-transform: none;
|
|
@@ -285,7 +285,7 @@
|
|
|
285
285
|
&:hover {
|
|
286
286
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedRestingBorder};
|
|
287
287
|
}
|
|
288
|
-
`;var Sg=e=>jsxRuntime.jsx("svg",
|
|
288
|
+
`;var Sg=e=>jsxRuntime.jsx("svg",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxRuntime.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=chunk5K62MKBQ_cjs_js.e.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
align-items: center;
|
|
291
291
|
justify-content: space-between;
|
|
@@ -295,11 +295,11 @@
|
|
|
295
295
|
margin-bottom: 32px;
|
|
296
296
|
}
|
|
297
297
|
`};
|
|
298
|
-
`;function Ne({title:e,className:t,isLoading:o}){let{theme:r}=W();return o?jsxRuntime.jsx(Qe__default.default,{width:120}):jsxRuntime.jsx(
|
|
298
|
+
`;function Ne({title:e,className:t,isLoading:o}){let{theme:r}=W();return o?jsxRuntime.jsx(Qe__default.default,{width:120}):jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:t,overrideColor:r.sectionTitleColor,variant:"h3",bold:true,children:e})}var kg=chunk5K62MKBQ_cjs_js.e(Bs)`
|
|
299
299
|
path {
|
|
300
300
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
301
301
|
}
|
|
302
|
-
`;function vs({onManageSubscription:e,hideManageButton:t,textOverrides:o}){return jsxRuntime.jsxs(Le,{className:"stigg-customer-portal-overview-header",$disableMargin:true,children:[jsxRuntime.jsx(Ne,{title:"Subscription",className:"stigg-overview-title"}),!t&&jsxRuntime.jsxs(Ke,{className:"stigg-manage-subscription-button",variant:"outlined",onClick:()=>e({intentionType:"MANAGE_SUBSCRIPTION"}),children:[jsxRuntime.jsx(kg,{className:"stigg-manage-subscription-button-image"}),jsxRuntime.jsx(
|
|
302
|
+
`;function vs({onManageSubscription:e,hideManageButton:t,textOverrides:o}){return jsxRuntime.jsxs(Le,{className:"stigg-customer-portal-overview-header",$disableMargin:true,children:[jsxRuntime.jsx(Ne,{title:"Subscription",className:"stigg-overview-title"}),!t&&jsxRuntime.jsxs(Ke,{className:"stigg-manage-subscription-button",variant:"outlined",onClick:()=>e({intentionType:"MANAGE_SUBSCRIPTION"}),children:[jsxRuntime.jsx(kg,{className:"stigg-manage-subscription-button-image"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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__default.default(e==null?void 0:e.subscriptions,o=>o.addons);return Bg__default.default(t)?null:jsxRuntime.jsx("div",{className:"stigg-addons-list-layout",children:t.map((o,r)=>jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.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=chunk5K62MKBQ_cjs_js.e.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
justify-content: space-between;
|
|
305
305
|
align-items: center;
|
|
@@ -310,19 +310,19 @@
|
|
|
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 jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx(
|
|
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 jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"secondary",children:t.promotionsSubtitle}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsxs(Es,{$borderColor:o.borderColor,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",bold:true,children:"Feature"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",bold:true,children:"Expiration date"})]}),r==null?void 0:r.map((n,i)=>jsxRuntime.jsxs(Es,{$borderColor:o.borderColor,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",children:vg(n)}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"disabled",children:n.endDate?Q.utc(Fg(n)).format("MMM Do, YYYY"):"None"})]},`${n.displayName}-${i}`))]})]})}var Ls=chunk5K62MKBQ_cjs_js.e(Lg__default.default)`
|
|
314
314
|
.MuiTabs-indicator {
|
|
315
315
|
background-color: #001e6c;
|
|
316
316
|
}
|
|
317
|
-
`,Ns=
|
|
317
|
+
`,Ns=chunk5K62MKBQ_cjs_js.e.div`
|
|
318
318
|
width: 100%;
|
|
319
319
|
flex: 1;
|
|
320
320
|
margin-top: 16px;
|
|
321
|
-
`,Ms=
|
|
321
|
+
`,Ms=chunk5K62MKBQ_cjs_js.e(ke__default.default,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
322
322
|
margin-top: 16px;
|
|
323
323
|
max-height: ${({$maxHeight:e})=>e};
|
|
324
324
|
overflow-y: auto;
|
|
325
|
-
`;
|
|
325
|
+
`;chunk5K62MKBQ_cjs_js.e.div`
|
|
326
326
|
display: flex;
|
|
327
327
|
flex-direction: column;
|
|
328
328
|
padding: 24px;
|
|
@@ -331,28 +331,28 @@
|
|
|
331
331
|
margin-bottom: 16px;
|
|
332
332
|
row-gap: 16px;
|
|
333
333
|
background-color: ${({$backgroundColor:e})=>e};
|
|
334
|
-
`;function Us(e){let s=e,{children:t,value:o,index:r,maxHeight:n}=s,i=
|
|
334
|
+
`;function Us(e){let s=e,{children:t,value:o,index:r,maxHeight:n}=s,i=chunk5K62MKBQ_cjs_js.c(s,["children","value","index","maxHeight"]);return jsxRuntime.jsx("div",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({role:"tabpanel",hidden:o!==r},i),{children:o===r&&jsxRuntime.jsx(Ms,{$maxHeight:n,children:t})}))}function _s({isSelected:e,label:t,icon:o}){let r=e?"primary":"secondary";return jsxRuntime.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{icon:o,svgStrokeColor:r}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",bold:e,color:r,children:t})]})}function Ds({customerPortal:e,hiddenSections:t,textOverrides:o,theme:r}){let n=wg__default.default(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]=ii.useState(s?1:2),u=(p,h)=>{c(h);};return s||l?jsxRuntime.jsxs(Ns,{children:[jsxRuntime.jsx(ke__default.default,{sx:{borderBottom:1,borderColor:"divider"},children:jsxRuntime.jsxs(Ls,{value:a,onChange:u,children:[s?jsxRuntime.jsx(Rs__default.default,{sx:{textTransform:"none"},value:1,label:jsxRuntime.jsx(_s,{isSelected:a===1,label:o.addonsTabTitle,icon:"Addons"})}):null,l?jsxRuntime.jsx(Rs__default.default,{sx:{textTransform:"none"},value:2,label:jsxRuntime.jsx(_s,{isSelected:a===2,label:o.promotionsTabTitle,icon:"Promotions"})}):null]})}),jsxRuntime.jsx(Us,{value:a,index:1,maxHeight:r.tabMaxHeight,children:jsxRuntime.jsx(vo,{})}),jsxRuntime.jsx(Us,{value:a,index:2,maxHeight:r.tabMaxHeight,children:jsxRuntime.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)=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},e),{[t]:`@media ${vn(t)}`}),{});function de(e){return Ug__default.default(vn(e))}var _g=chunk5K62MKBQ_cjs_js.e.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
justify-content: space-between;
|
|
337
337
|
flex-wrap: wrap;
|
|
338
|
-
`,Dg=
|
|
338
|
+
`,Dg=chunk5K62MKBQ_cjs_js.e.div`
|
|
339
339
|
display: flex;
|
|
340
340
|
flex-direction: column;
|
|
341
341
|
gap: 32px;
|
|
342
|
-
`;function zs(){let e=de("md");return jsxRuntime.jsxs(_g,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxRuntime.jsxs(Dg,{children:[jsxRuntime.jsx(Qe__default.default,{width:120}),jsxRuntime.jsx(Qe__default.default,{width:120})]}),jsxRuntime.jsx(Qe__default.default,{width:e?295:260,height:193})]})}function Gg({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxRuntime.jsxs(Me__default.default,{container:true,alignItems:"center",children:[jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(reactFeather.ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsxs(
|
|
342
|
+
`;function zs(){let e=de("md");return jsxRuntime.jsxs(_g,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxRuntime.jsxs(Dg,{children:[jsxRuntime.jsx(Qe__default.default,{width:120}),jsxRuntime.jsx(Qe__default.default,{width:120})]}),jsxRuntime.jsx(Qe__default.default,{width:e?295:260,height:193})]})}function Gg({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxRuntime.jsxs(Me__default.default,{container:true,alignItems:"center",children:[jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(reactFeather.ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Downgrade to the ",jsxRuntime.jsx("b",{children:t==null?void 0:t.displayName})," plan"]})})]})}function zg({scheduleUpdate:e}){let{scheduleVariables:t}=e,{billingPeriod:o}=t,r=o===jsClientSdk.BillingPeriod.Monthly?"annually":"monthly",n=o===jsClientSdk.BillingPeriod.Monthly?"monthly":"annually";return jsxRuntime.jsxs(Me__default.default,{container:true,alignItems:"center",children:[jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(reactFeather.ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Change from an ",r," to a ",jsxRuntime.jsx("b",{children:n})," billing cycle"]})})]})}function Vg({subscription:e,scheduleUpdate:t}){let{scheduleVariables:o}=t,{newUnitAmount:r,featureId:n}=o,s=ic__default.default(e.prices.map(({feature:u})=>u)).find(u=>u.id===n);if(!s)return null;let{featureUnits:l,featureUnitsPlural:a}=s;return jsxRuntime.jsxs(Me__default.default,{container:true,alignItems:"flex-start",flexWrap:"nowrap",children:[jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(reactFeather.ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Reduce the ",jsxRuntime.jsx("b",{children:l})," quantity to ",r," ",r===1?l:a]})})]})}function Hs({scheduleUpdate:e,subscription:t}){switch(e.subscriptionScheduleType){case jsClientSdk.SubscriptionScheduleType.Downgrade:return jsxRuntime.jsx(Gg,{scheduleUpdate:e});case jsClientSdk.SubscriptionScheduleType.BillingPeriod:return jsxRuntime.jsx(zg,{scheduleUpdate:e});case jsClientSdk.SubscriptionScheduleType.UnitAmount:return jsxRuntime.jsx(Vg,{scheduleUpdate:e,subscription:t});default:return null}}var Yg=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
343
343
|
border-bottom: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
344
344
|
border-top-left-radius: 10px;
|
|
345
345
|
border-top-right-radius: 10px;
|
|
346
346
|
margin: -64px -64px 64px -64px;
|
|
347
347
|
padding: 24px 32px;
|
|
348
|
-
`,Qg=
|
|
348
|
+
`,Qg=chunk5K62MKBQ_cjs_js.e(Rm__default.default)`
|
|
349
349
|
margin-left: 4px;
|
|
350
|
-
`,Kg=
|
|
350
|
+
`,Kg=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.h)`
|
|
351
351
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
352
352
|
path {
|
|
353
353
|
fill: ${({theme:e})=>e.stigg.palette.primary};
|
|
354
354
|
}
|
|
355
|
-
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Me__default.default,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(
|
|
355
|
+
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Me__default.default,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-description",variant:"body1",children:"The following updates will take effect in the next billing cycle:"})})}),jsxRuntime.jsx(Me__default.default,{children:(t||[]).map(o=>jsxRuntime.jsx(Hs,{scheduleUpdate:o,subscription:e},o.subscriptionScheduleType))})]})}function Jg({subscription:e}){let{scheduledUpdates:t}=e,[o]=t||[],{line1:r,line2:n}=Po({scheduledUpdate:o,subscriptionPrices:e.prices,billingPeriodRange:e.billingPeriodRange,options:{postfix:"at the end of the current billing period"}});return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Me__default.default,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-title",variant:"body1",color:"primary",children:r})})}),n&&jsxRuntime.jsx(Me__default.default,{children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-scheduled-updates-subtitle",variant:"body1",color:"secondary",children:n})})]})}function Os({subscription:e,onCancelScheduledUpdates:t,theme:o,cancelScheduledUpdatesButtonTitle:r}){let n=react.useTheme(),[i,s]=ii.useState(false),{scheduledUpdates:l}=e;if(!l||l.length===0)return null;let a=l.length===1;return jsxRuntime.jsx(Yg,{$borderColor:o.borderColor,className:"stigg-scheduled-updates-alert-container",children:jsxRuntime.jsxs(Me__default.default,{container:true,alignItems:a?"center":"flex-start",gap:2,children:[jsxRuntime.jsx(Me__default.default,{item:true,display:"flex",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{icon:"ScheduleBox",svgPathColor:o.iconsColor,svgRectColor:o.iconsBackgroundColor})}),jsxRuntime.jsx(Me__default.default,{item:true,flex:1,children:a?jsxRuntime.jsx(Jg,{subscription:e}):jsxRuntime.jsx(qg,{subscription:e})}),!!t&&jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsxs(Ke,{variant:"outlined",onClick:()=>{s(true),Promise.resolve(t(e)).finally(()=>s(false));},children:[i?jsxRuntime.jsx(Qg,{loading:true,size:16,color:n.stigg.palette.text.disabled}):jsxRuntime.jsx(Kg,{style:{display:"flex",marginRight:4},className:"stigg-scheduled-updates-cancel-update-button-icon"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary.main",className:"stigg-scheduled-updates-cancel-update-button",children:r})]})})]})})}var Re=chunk5K62MKBQ_cjs_js.e.div`
|
|
356
356
|
width: 100%;
|
|
357
357
|
display: flex;
|
|
358
358
|
flex-direction: column;
|
|
@@ -370,12 +370,12 @@
|
|
|
370
370
|
${oe.lg} {
|
|
371
371
|
padding: 64px;
|
|
372
372
|
}
|
|
373
|
-
`;function Ys({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(
|
|
373
|
+
`;function Ys({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:"Next estimated bill"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h1",children:H({amount:o,currency:r,maximumFractionDigits:2})}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{as:"div",variant:"body1",color:"secondary",children:["Billed ",e===jsClientSdk.BillingPeriod.Monthly?"monthly":"annually"," on"," ",jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",as:"span",color:"primary",children:Q.utc(t).format("MMM Do, YYYY")})]}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:"* Additional tax rates may apply"})]})}function Ro({description:e}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"secondary",children:"No upcoming bill"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:e})]})}var rf=chunk5K62MKBQ_cjs_js.e.div`
|
|
374
374
|
display: flex;
|
|
375
375
|
flex-direction: column;
|
|
376
376
|
align-items: left;
|
|
377
377
|
gap: 8px;
|
|
378
|
-
`,nf=
|
|
378
|
+
`,nf=chunk5K62MKBQ_cjs_js.e(Ym__default.default)`
|
|
379
379
|
width: fit-content;
|
|
380
380
|
&.MuiButton-root {
|
|
381
381
|
padding: 0;
|
|
@@ -383,7 +383,7 @@
|
|
|
383
383
|
background: none;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
`;function Ks({onContactSupport:e,label:t,linkLabel:o}){let r=jsxRuntime.jsx(
|
|
386
|
+
`;function Ks({onContactSupport:e,label:t,linkLabel:o}){let r=jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:e?"primary.main":"secondary",children:o});return jsxRuntime.jsxs(rf,{className:"stigg-contact-support-layout",children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-contact-support-label",color:"secondary",children:t}),e?jsxRuntime.jsx(nf,{className:"stigg-contact-support-button",style:{textTransform:"none"},variant:"text",onClick:e,children:r}):r]})}var df=chunk5K62MKBQ_cjs_js.e.div`
|
|
387
387
|
max-height: 278px;
|
|
388
388
|
display: flex;
|
|
389
389
|
flex-direction: column;
|
|
@@ -392,7 +392,7 @@
|
|
|
392
392
|
border: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
393
393
|
padding: 32px;
|
|
394
394
|
gap: 16px;
|
|
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!==jsClientSdk.BillingModel.UsageBased))!=null?c:true,l=(u=e.scheduledUpdates)==null?void 0:u.find(({subscriptionScheduleType:y,targetPackage:C})=>y===jsClientSdk.SubscriptionScheduleType.Downgrade&&(C==null?void 0:C.pricingType)===jsClientSdk.PricingType.Free);if(n===jsClientSdk.PricingType.Free)i=jsxRuntime.jsx(Ro,{description:"You're on a free plan, so you don\u2019t have any upcoming charges"});else if(n===jsClientSdk.PricingType.Paid)if(l&&s)i=jsxRuntime.jsx(Ro,{description:"Your plan will be downgraded to a free plan, so you don\u2019t have any upcoming charges"});else if(e.status===jsClientSdk.SubscriptionStatus.InTrial)i=jsxRuntime.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=jsxRuntime.jsx(Ys,{billingPeriod:y,rangeEnd:C,amount:b.amount,currency:b.currency}));}else n===jsClientSdk.PricingType.Custom&&(i=jsxRuntime.jsx(Ks,{onContactSupport:r,label:o.contactSupportTitle,linkLabel:o.contactSupportLink}));return jsxRuntime.jsx(df,{className:"stigg-subscription-total-price-layout",$borderColor:t.borderColor,children:i})}var pf=e=>jsxRuntime.jsxs("svg",
|
|
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!==jsClientSdk.BillingModel.UsageBased))!=null?c:true,l=(u=e.scheduledUpdates)==null?void 0:u.find(({subscriptionScheduleType:y,targetPackage:C})=>y===jsClientSdk.SubscriptionScheduleType.Downgrade&&(C==null?void 0:C.pricingType)===jsClientSdk.PricingType.Free);if(n===jsClientSdk.PricingType.Free)i=jsxRuntime.jsx(Ro,{description:"You're on a free plan, so you don\u2019t have any upcoming charges"});else if(n===jsClientSdk.PricingType.Paid)if(l&&s)i=jsxRuntime.jsx(Ro,{description:"Your plan will be downgraded to a free plan, so you don\u2019t have any upcoming charges"});else if(e.status===jsClientSdk.SubscriptionStatus.InTrial)i=jsxRuntime.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=jsxRuntime.jsx(Ys,{billingPeriod:y,rangeEnd:C,amount:b.amount,currency:b.currency}));}else n===jsClientSdk.PricingType.Custom&&(i=jsxRuntime.jsx(Ks,{onContactSupport:r,label:o.contactSupportTitle,linkLabel:o.contactSupportLink}));return jsxRuntime.jsx(df,{className:"stigg-subscription-total-price-layout",$borderColor:t.borderColor,children:i})}var pf=e=>jsxRuntime.jsxs("svg",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[jsxRuntime.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"}),jsxRuntime.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=chunk5K62MKBQ_cjs_js.e(n=>{var i=n,{children:e,className:t,placement:o="top"}=i,r=chunk5K62MKBQ_cjs_js.c(i,["children","className","placement"]);return jsxRuntime.jsx(uf__default.default,chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({arrow:true,placement:o},r),{classes:{popper:t,tooltip:"stigg-tooltip",arrow:"stigg-tooltip-arrow"},children:jsxRuntime.jsx("div",{children:e})}))})(({theme:e,$padding:t=8,$maxWidth:o=300})=>({[`& .${uf.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},[`& .${uf.tooltipClasses.arrow}`]:{color:e.stigg.palette.white}}));var hf=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.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 @@
|
|
|
406
406
|
${({$bold:e})=>e&&react.css`
|
|
407
407
|
font-weight: bold;
|
|
408
408
|
`}
|
|
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})=>{let[p,h]=ii.useState(false),g=ii.useRef(null),y=jsxRuntime.jsx(hf,{ref:g,variant:o,color:r,$maxLines:n,$wordBreak:i,$bold:s,className:a,$display:c,style:u,"data-testid":f,children:t});ii.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 jsxRuntime.jsx("span",{children:p||C?jsxRuntime.jsx(Ve,{placement:l,leaveDelay:e,title:jsxRuntime.jsx(
|
|
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})=>{let[p,h]=ii.useState(false),g=ii.useRef(null),y=jsxRuntime.jsx(hf,{ref:g,variant:o,color:r,$maxLines:n,$wordBreak:i,$bold:s,className:a,$display:c,style:u,"data-testid":f,children:t});ii.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 jsxRuntime.jsx("span",{children:p||C?jsxRuntime.jsx(Ve,{placement:l,leaveDelay:e,title:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",children:t}),children:y}):y})};var xf=chunk5K62MKBQ_cjs_js.e.div`
|
|
410
410
|
width: 100%;
|
|
411
411
|
display: flex;
|
|
412
412
|
align-items: center;
|
|
@@ -415,48 +415,48 @@
|
|
|
415
415
|
border-radius: 10px;
|
|
416
416
|
padding: 8px 16px;
|
|
417
417
|
margin-top: 16px;
|
|
418
|
-
`,bf=
|
|
418
|
+
`,bf=chunk5K62MKBQ_cjs_js.e(Pf__default.default)`
|
|
419
419
|
text-decoration-color: white;
|
|
420
420
|
color: white;
|
|
421
421
|
cursor: pointer;
|
|
422
|
-
`;function nl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==jsClientSdk.SubscriptionStatus.InTrial?null:jsxRuntime.jsxs(xf,{className:"stigg-subscription-trial-badge",children:[jsxRuntime.jsx(Xs,{className:"stigg-subscription-trial-badge-image"}),jsxRuntime.jsx("div",{style:{flex:1,marginRight:4},children:jsxRuntime.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`]})}),jsxRuntime.jsx(bf,{className:"stigg-subscription-trial-upgrade-button",onClick:()=>o({intentionType:"UPGRADE_TRIAL_PLAN"}),children:jsxRuntime.jsx(
|
|
422
|
+
`;function nl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==jsClientSdk.SubscriptionStatus.InTrial?null:jsxRuntime.jsxs(xf,{className:"stigg-subscription-trial-badge",children:[jsxRuntime.jsx(Xs,{className:"stigg-subscription-trial-badge-image"}),jsxRuntime.jsx("div",{style:{flex:1,marginRight:4},children:jsxRuntime.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`]})}),jsxRuntime.jsx(bf,{className:"stigg-subscription-trial-upgrade-button",onClick:()=>o({intentionType:"UPGRADE_TRIAL_PLAN"}),children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"white",children:"Upgrade plan"})})]})}function al({mainSubscription:e,trialSubscription:t,onManageSubscription:o,theme:r}){return jsxRuntime.jsxs("div",{className:"stigg-subscription-view-layout",children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{className:"stigg-subscription-plan-name",variant:"h1",overrideColor:r.planNameColor,style:{marginTop:8},children:[e.planName," plan"]}),jsxRuntime.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 jsClientSdk.EntitlementResetPeriod.Month:return `Resets monthly - in ${o("days")} days`;case jsClientSdk.EntitlementResetPeriod.Week:return `Resets weekly - in ${o("days")} days`;case jsClientSdk.EntitlementResetPeriod.Day:return `Resets daily - in ${o("hours")} hours`;case jsClientSdk.EntitlementResetPeriod.Hour:return `Resets hourly - in ${o("minutes")} minutes`;default:return null}}var Bf=chunk5K62MKBQ_cjs_js.e(kf__default.default,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
423
423
|
height: 4px;
|
|
424
424
|
background-color: ${({theme:e})=>bi__default.default(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=sl(r);return jsxRuntime.jsx(Bf,{$progressStatus:n,className:`${o} ${o}-${n}`,variant:"determinate",value:r})}var vf=
|
|
429
|
+
`;function Go({currentUsage:e,usageLimit:t,classNamePrefix:o="stigg-usage-progress-bar"}){let r=qe(e,t),n=sl(r);return jsxRuntime.jsx(Bf,{$progressStatus:n,className:`${o} ${o}-${n}`,variant:"determinate",value:r})}var vf=chunk5K62MKBQ_cjs_js.e(Cl__default.default)`
|
|
430
430
|
border-style: dotted;
|
|
431
431
|
border-bottom-width: 2px;
|
|
432
432
|
border-color: ${({theme:e})=>bi__default.default(e.stigg.palette.outlinedRestingBorder).alpha(.4).string()};
|
|
433
|
-
`;function zo({entitlement:e}){return e.hasUnlimitedUsage?jsxRuntime.jsx(vf,{}):jsxRuntime.jsx(Go,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var dl=
|
|
433
|
+
`;function zo({entitlement:e}){return e.hasUnlimitedUsage?jsxRuntime.jsx(vf,{}):jsxRuntime.jsx(Go,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var dl=chunk5K62MKBQ_cjs_js.e(Ym__default.default)`
|
|
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?jsxRuntime.jsx(dl,{variant:"text",onClick:()=>r(t,e),children:jsxRuntime.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?jsxRuntime.jsx(dl,{variant:"text",onClick:()=>r(t,e),children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"primary.main",children:"Buy more"})}):null:i&&o?jsxRuntime.jsx(dl,{variant:"text",onClick:()=>o({intentionType:"UPGRADE_PLAN"}),children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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,p;return jsxRuntime.jsxs("div",{className:`stigg-charge-list-item stigg-charge-list-item-${r.feature.refId}`,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx(Ae,{variant:"body1",color:"primary",children:n.displayName}),!i&&jsxRuntime.jsxs(Ae,{variant:"body1",color:"secondary",children:[H({amount:e,currency:t})," per ",o?`${o} `:"",o?n.featureUnitsPlural:n.featureUnits]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx(Ho,{featureEntitlement:r,feature:n,canBuyMore:true,onBuyMore:s,onManageSubscription:l,canUpgradeSubscription:a,hasCustomSubscription:c}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",style:{whiteSpace:"nowrap"},children:r.hasUnlimitedUsage?(u=r.currentUsage)==null?void 0:u.toLocaleString():`${(f=r.currentUsage)==null?void 0:f.toLocaleString()} of ${(p=r.usageLimit)==null?void 0:p.toLocaleString()}`})]})]}),jsxRuntime.jsx(zo,{entitlement:r})]})}function ul({subscription:e,entitlements:t,onBuyMore:o,onManageSubscription:r,hasCustomSubscription:n,canUpgradeSubscription:i}){let s=wl__default.default(t,"feature.refId"),l=e.prices.filter(({feature:a,price:c})=>!!a&&s[a.refId]&&!!c);return l.length?jsxRuntime.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:jsxRuntime.jsx(pl,{featureEntitlement:p,feature:p.feature,amount:c.amount,blockSize:u,currency:c.currency,hideChargePrice:f===jsClientSdk.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=ii.useMemo(()=>p?p.filter(bt):[],[p]),y=f==null?void 0:f.find(({status:S})=>S===jsClientSdk.SubscriptionStatus.Active),C=f==null?void 0:f.find(({status:S})=>S===jsClientSdk.SubscriptionStatus.InTrial),b=(y==null?void 0:y.pricingType)===jsClientSdk.PricingType.Custom,x=y||C;return jsxRuntime.jsxs(Re,{className:"stigg-customer-portal-subscriptions-overview",$backgroundColor:c.backgroundColor,$borderColor:c.borderColor,children:[!u&&y&&y.scheduledUpdates&&jsxRuntime.jsx(Os,{theme:c,subscription:y,onCancelScheduledUpdates:o,cancelScheduledUpdatesButtonTitle:i}),u||!x?jsxRuntime.jsx(zs,{}):jsxRuntime.jsxs("div",{className:"stigg-overview-layout",style:{display:"flex",alignItems:"flex-start",gap:64,flexWrap:"wrap"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[jsxRuntime.jsx(vs,{onManageSubscription:e,hideManageButton:b,textOverrides:a}),jsxRuntime.jsx(al,{mainSubscription:x,trialSubscription:C,theme:c,onManageSubscription:e}),y&&g.length>0&&jsxRuntime.jsx(ul,{subscription:y,entitlements:g,onBuyMore:t,onManageSubscription:e,canUpgradeSubscription:!!h,hasCustomSubscription:b}),jsxRuntime.jsx(Ds,{customerPortal:s,hiddenSections:n,textOverrides:a,theme:c})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",width:319,gap:24},children:jsxRuntime.jsx(qs,{subscription:x,theme:c,onContactSupport:r,textOverrides:a})})]})]})}var Uf=chunk5K62MKBQ_cjs_js.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 yl({showWatermark:e}){return jsxRuntime.jsx(Uf,{className:"stigg-customer-portal-header-layout",children:jsxRuntime.jsx(
|
|
443
|
+
`;function yl({showWatermark:e}){return jsxRuntime.jsx(Uf,{className:"stigg-customer-portal-header-layout",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.q,{source:"customer_portal",showWatermark:e})})}var Df=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
444
444
|
text-transform: none;
|
|
445
|
-
`,$f=
|
|
445
|
+
`,$f=chunk5K62MKBQ_cjs_js.e(reactFeather.ExternalLink)`
|
|
446
446
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
447
|
-
`;function Yo({text:e,url:t,className:o}){return jsxRuntime.jsx(Ke,{className:o,variant:"outlined",startIcon:jsxRuntime.jsx($f,{size:20,strokeWidth:2.5}),onClick:()=>{window.open(t,"_blank");},children:jsxRuntime.jsx(Df,{color:"primary.main",children:e})})}var Qo=
|
|
447
|
+
`;function Yo({text:e,url:t,className:o}){return jsxRuntime.jsx(Ke,{className:o,variant:"outlined",startIcon:jsxRuntime.jsx($f,{size:20,strokeWidth:2.5}),onClick:()=>{window.open(t,"_blank");},children:jsxRuntime.jsx(Df,{color:"primary.main",children:e})})}var Qo=chunk5K62MKBQ_cjs_js.e.div`
|
|
448
448
|
display: flex;
|
|
449
449
|
flex-direction: column;
|
|
450
450
|
align-items: flex-start;
|
|
451
451
|
gap: 16px;
|
|
452
452
|
flex: 1 0 0;
|
|
453
|
-
`,Gf=
|
|
453
|
+
`,Gf=chunk5K62MKBQ_cjs_js.e.div`
|
|
454
454
|
display: flex;
|
|
455
455
|
align-items: flex-start;
|
|
456
456
|
gap: 16px;
|
|
457
457
|
align-self: stretch;
|
|
458
458
|
flex-wrap: wrap;
|
|
459
|
-
`;function Gn({title:e,rows:t}){return jsxRuntime.jsxs(Qo,{children:[jsxRuntime.jsx(
|
|
459
|
+
`;function Gn({title:e,rows:t}){return jsxRuntime.jsxs(Qo,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"secondary",bold:true,children:e}),t.map(({classNamePrefix:o,label:r,value:n,labelTypographyProps:i,valueTypographyProps:s})=>jsxRuntime.jsxs(Gf,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({className:`${o}-label`,variant:"body1",color:"secondary",style:{width:80}},i),{children:r})),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({className:`${o}-text`,variant:"body1",color:"secondary"},s),{children:n}))]},r))]})}function Ko(){return jsxRuntime.jsx(Qe__default.default,{width:220,height:42})}var Pl="-";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(jsxRuntime.jsxs(Qo,{children:[jsxRuntime.jsx(Qe__default.default,{width:220,height:12}),jsxRuntime.jsx(Qe__default.default,{width:220,height:12}),jsxRuntime.jsx(Qe__default.default,{width:220,height:12})]},"information-loading-data-top"),jsxRuntime.jsx(Cl__default.default,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-loading-data-divider"),jsxRuntime.jsxs(Qo,{children:[jsxRuntime.jsx(Qe__default.default,{width:220,height:12}),jsxRuntime.jsx(Qe__default.default,{width:220,height:12}),jsxRuntime.jsx(Qe__default.default,{width:220,height:12})]},"information-loading-data-bottom")):(l.push(jsxRuntime.jsx(Gn,{title:"Billed to",rows:[{classNamePrefix:"stigg-customer-name",label:"Name",value:(i==null?void 0:i.name)||Pl,valueTypographyProps:i!=null&&i.name?{}:{color:"disabled"}},{classNamePrefix:"stigg-customer-email",label:"Email",value:(i==null?void 0:i.email)||Pl,valueTypographyProps:i!=null&&i.email?{}:{color:"disabled"}}]},"information-billing-data-billed-to")),i!=null&&i.defaultPaymentMethodId&&i.defaultPaymentMethodLast4Digits&&i.defaultPaymentExpirationMonth&&i.defaultPaymentExpirationYear&&(l.unshift(jsxRuntime.jsx(Cl__default.default,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-billing-data-divider")),l.unshift(jsxRuntime.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__default.default(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?jsxRuntime.jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsxRuntime.jsx(Yo,{url:e.billingPortalUrl,text:o.editPaymentDetails,className:"stigg-edit-payment-details-button"}):null;return jsxRuntime.jsxs(Re,{className:"stigg-payment-details-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:[jsxRuntime.jsxs(Le,{className:"stigg-payment-details-section-header",children:[jsxRuntime.jsx(Ne,{isLoading:s,className:"stigg-payment-details-section-title",title:"Payment details"}),a]}),jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"stretch",gap:n?64:32,flexWrap:"wrap"},children:l})]})}var xl=chunk5K62MKBQ_cjs_js.e(Re)`
|
|
460
460
|
position: relative;
|
|
461
461
|
|
|
462
462
|
.stigg-paywall-layout {
|
|
@@ -478,10 +478,10 @@
|
|
|
478
478
|
margin-right: auto;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
.${
|
|
481
|
+
.${chunk5K62MKBQ_cjs_js.p} {
|
|
482
482
|
display: none;
|
|
483
483
|
}
|
|
484
|
-
`;var zn=ii.forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxRuntime.jsxs(xl,{className:"stigg-customer-portal-paywall-section",ref:n,$backgroundColor:t.backgroundColor,$borderColor:t.borderColor,children:[jsxRuntime.jsx(Le,{className:"stigg-customer-portal-paywall-header",children:jsxRuntime.jsx(Ne,{isLoading:r,className:"stigg-customer-portal-paywall-section-title",title:o})}),e]}):null);zn.displayName="CustomerPortalPaywall";var Sl=
|
|
484
|
+
`;var zn=ii.forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxRuntime.jsxs(xl,{className:"stigg-customer-portal-paywall-section",ref:n,$backgroundColor:t.backgroundColor,$borderColor:t.borderColor,children:[jsxRuntime.jsx(Le,{className:"stigg-customer-portal-paywall-header",children:jsxRuntime.jsx(Ne,{isLoading:r,className:"stigg-customer-portal-paywall-section-title",title:o})}),e]}):null);zn.displayName="CustomerPortalPaywall";var Sl=chunk5K62MKBQ_cjs_js.e.div`
|
|
485
485
|
width: 100%;
|
|
486
486
|
display: flex;
|
|
487
487
|
flex-direction: column;
|
|
@@ -490,13 +490,13 @@
|
|
|
490
490
|
& * {
|
|
491
491
|
box-sizing: border-box;
|
|
492
492
|
}
|
|
493
|
-
`,Tl=
|
|
493
|
+
`,Tl=chunk5K62MKBQ_cjs_js.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 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)===jsClientSdk.MeterType.Fluctuating||((o=e.feature)==null?void 0:o.meterType)===jsClientSdk.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__default.default((x=t==null?void 0:t.prices)!=null?x:[],"feature.refId"),a=wl__default.default(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)===jsClientSdk.PricingType.Custom;return {subscriptionPriceByFeature:l,filteredFeatureEntitlements:y,filteredCreditEntitlements:C,hasCustomSubscription:b}}function El({filterEntitlements:e,filterPackageEntitlements:t}){let[o,r]=ii.useState(false),n=de("md"),{customerPortal:i,isLoading:s}=W(),l=ii.useMemo(()=>{var I;let F=i==null?void 0:i.entitlementsV2,B=(I=i==null?void 0:i.subscriptions)==null?void 0:I.find(k=>k.status===jsClientSdk.SubscriptionStatus.Active);return vl({packageEntitlements:F,activeSubscription:B,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__default.default(e);return r===Vn__default.default(t||"")||r===Vn__default.default(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=
|
|
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)===jsClientSdk.MeterType.Fluctuating||((o=e.feature)==null?void 0:o.meterType)===jsClientSdk.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__default.default((x=t==null?void 0:t.prices)!=null?x:[],"feature.refId"),a=wl__default.default(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)===jsClientSdk.PricingType.Custom;return {subscriptionPriceByFeature:l,filteredFeatureEntitlements:y,filteredCreditEntitlements:C,hasCustomSubscription:b}}function El({filterEntitlements:e,filterPackageEntitlements:t}){let[o,r]=ii.useState(false),n=de("md"),{customerPortal:i,isLoading:s}=W(),l=ii.useMemo(()=>{var I;let F=i==null?void 0:i.entitlementsV2,B=(I=i==null?void 0:i.subscriptions)==null?void 0:I.find(k=>k.status===jsClientSdk.SubscriptionStatus.Active);return vl({packageEntitlements:F,activeSubscription:B,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__default.default(e);return r===Vn__default.default(t||"")||r===Vn__default.default(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=chunk5K62MKBQ_cjs_js.e.div`
|
|
500
500
|
display: flex;
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
padding: 24px;
|
|
@@ -506,9 +506,9 @@
|
|
|
506
506
|
height: 100%;
|
|
507
507
|
|
|
508
508
|
${({theme:e,$highlight:t})=>t&&`background-color: ${e.stigg.palette.backgroundSection}`};
|
|
509
|
-
`;function Rl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i}){var a,c,u;let{theme:s}=W(),l=!e.hasUnlimitedUsage&&e.currentUsage>e.usageLimit;return e.feature?jsxRuntime.jsxs(Xo,{$highlight:!!t,$borderColor:s.borderColor,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsxRuntime.jsx(Ae,{variant:"body1",children:e.feature&&Ll(e.feature)}),t&&jsxRuntime.jsx(Ve,{title:jsxRuntime.jsx(
|
|
509
|
+
`;function Rl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i}){var a,c,u;let{theme:s}=W(),l=!e.hasUnlimitedUsage&&e.currentUsage>e.usageLimit;return e.feature?jsxRuntime.jsxs(Xo,{$highlight:!!t,$borderColor:s.borderColor,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsxRuntime.jsx(Ae,{variant:"body1",children:e.feature&&Ll(e.feature)}),t&&jsxRuntime.jsx(Ve,{title:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",children:t.billingModel===sdk.BillingModel.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{icon:"DollarCoin",svgStrokeColor:s.iconsColor})})]}),jsxRuntime.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[jsxRuntime.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)}%)`]}),jsxRuntime.jsx(Ho,{featureEntitlement:e,feature:e.feature,onBuyMore:r,canBuyMore:!!t,onManageSubscription:o,canUpgradeSubscription:i,hasCustomSubscription:n})]}),jsxRuntime.jsx(zo,{entitlement:e}),!e.hasUnlimitedUsage&&!Ml__default.default(e.usageLimit)&&!Ml__default.default(e.currentUsage)&&e.resetPeriod&&e.usagePeriodEnd?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"secondary",children:ll(e)}):null,e.hasUnlimitedUsage&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"secondary",children:"In current billing period"})]}):null}function Hn({currentUsage:e,usageLimit:t}){return jsxRuntime.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 jsxRuntime.jsxs(Xo,{$highlight:false,$borderColor:t.borderColor,className:"stigg-credit-usage-container",children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:jsxRuntime.jsx(Ae,{variant:"body1",className:"stigg-credit-usage-title",children:l})}),jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:jsxRuntime.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,"%)"]})}),jsxRuntime.jsx(Hn,{currentUsage:r!=null?r:0,usageLimit:n!=null?n:0}),a&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"secondary",children:a})]})}function _l({featureEntitlements:e,creditEntitlements:t,subscriptionPriceByFeature:o,gridSizeXs:r,onManageSubscription:n,onBuyMore:i,hasCustomSubscription:s,canUpgradeSubscription:l}){return jsxRuntime.jsxs(Me__default.default,{container:true,spacing:4,children:[e.filter(a=>!!a.feature).map(a=>{let c=a.feature;return jsxRuntime.jsx(Me__default.default,{className:`stigg-entitlement-usage-${c.refId}`,item:true,xs:r,children:jsxRuntime.jsx(Rl,{entitlement:a,subscriptionPrice:o[c.refId],onManageSubscription:n,onBuyMore:i,hasCustomSubscription:s,canUpgradeSubscription:l})},c.refId)}),t.map(a=>jsxRuntime.jsx(Me__default.default,{className:`stigg-credit-usage-${a.currency.currencyId}`,item:true,xs:r,children:jsxRuntime.jsx(tr,{creditEntitlement:a})},a.currency.currencyId))]})}var $l=chunk5K62MKBQ_cjs_js.e.div`
|
|
510
510
|
margin-top: 32px;
|
|
511
|
-
`;function Gl(){let e=de("md");return jsxRuntime.jsx(Me__default.default,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty__default.default(6).map(t=>jsxRuntime.jsx(Me__default.default,{item:true,xs:e?4:12,children:jsxRuntime.jsx(Qe__default.default,{width:280,height:120})},t))})}function zl({showAll:e,onToggle:t}){return jsxRuntime.jsx($l,{children:jsxRuntime.jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsxRuntime.jsx(reactFeather.Minus,{}):jsxRuntime.jsx(reactFeather.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:jsxRuntime.jsxs(Re,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsxRuntime.jsx(Le,{children:jsxRuntime.jsx(Ne,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:s})}),s?jsxRuntime.jsx(Gl,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_l,{featureEntitlements:l,creditEntitlements:a,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:p}),C&&jsxRuntime.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=ii.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 jsxRuntime.jsxs(Sl,{className:"stigg-customer-portal-layout",children:[jsxRuntime.jsx(yl,{showWatermark:p}),jsxRuntime.jsxs(Tl,{className:"stigg-customer-portal-sections",children:[jsxRuntime.jsx(Zo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),y&&jsxRuntime.jsx(nr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsxRuntime.jsx(zn,{ref:h,paywallComponent:s,theme:u,title:c.paywallSectionTitle,isLoading:!a||f}),C&&jsxRuntime.jsx(Jo,{}),b&&jsxRuntime.jsx(ir,{})]})]})}function Zl(i){var s=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=s,n=chunkSP6WPFZZ_cjs_js.c(s,["textOverrides","theme","resourceId","productId"]);return jsxRuntime.jsx(Fo,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsxRuntime.jsx(Ol,chunkSP6WPFZZ_cjs_js.a({},n))})}function ir(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsxRuntime.jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsxRuntime.jsx(Yo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsxRuntime.jsx(Re,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxRuntime.jsxs(Le,{className:"stigg-invoices-section-header",children:[jsxRuntime.jsx(Ne,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Ql=e=>Yl__default.default(e,"displayName"),Qn=e=>Yl__default.default(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(jsClientSdk.WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function Kl({addon:e,currency:t,billingCountryCode:o}){return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.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=>chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.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)||jsClientSdk.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__default.default(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__default.default(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function jl(){let e=fy();return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.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 Py(){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:Py()}}function Sy(e){var t;return (t=e==null?void 0:e.plan)!=null&&t.pricePoints?chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},e),{plan:chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},e.plan),{pricePoints:e.plan.pricePoints.filter(o=>o.pricingModel!==jsClientSdk.BillingModel.CreditBased)})}):e}function tc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r}){let{stigg:n}=chunkSP6WPFZZ_cjs_js.u(),[i,s]=ii.useState(true),[l,a]=ii.useState();return ii.useEffect(()=>{let c=()=>chunkSP6WPFZZ_cjs_js.d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});a(Sy(u));}catch(u){chunkSP6WPFZZ_cjs_js.r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{s(false);}});if(r){s(false);let u=r({planId:e,resourceId:t,billingCountryCode:o});a(u);return}n.isCustomerLoaded&&(s(true),c());},[n,n.isCustomerLoaded,t,e,o,r]),{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===sdk.BillingPeriod.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===sdk.BillingPeriod.Annually)),rc=e=>Kn(e)&&qn(e);var ac=(e,t,o)=>e===sdk.BillingPeriod.Monthly&&t||e===sdk.BillingPeriod.Annually&&o?e:null,sc=({pricingModel:e})=>e===jsClientSdk.BillingModel.PerUnit;function ky(e,t,o){var i;if(!t)return [];let r=wl__default.default(e,"featureId"),n=wl__default.default(ic__default.default((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__default.default(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 wy({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)||sdk.BillingPeriod.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?sdk.BillingPeriod.Annually:sdk.BillingPeriod.Monthly}function lc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=wy({plan:t,activeSubscription:o,preferredBillingPeriod:e}),s=t==null?void 0:t.pricePoints.filter(a=>a.billingPeriod===i),l=ky(n,s,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function By(){let[{planStep:e}]=R();return e}function Ay(){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 Iy(){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 xe(){let e=By();return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},e),{setBillingPeriod:Iy(),setBillableFeature:Ay()})}var dc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],cc={activeStep:0,completedSteps:[],steps:dc,isDisabled:false},vy=(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")&&vy(o,n,s,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},cc),{steps:dc.filter(a=>!l.includes(a.key))})}function Ey(){let[{progressBar:e}]=R();return e}function Ly(){let[e,t]=R();return o=>chunkSP6WPFZZ_cjs_js.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 Ny(){let[,e]=R();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function My(e){return e.completedSteps.length>=e.steps.length-1}function Ry(){let[e,t]=R();return ()=>chunkSP6WPFZZ_cjs_js.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 Uy(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Ue(){let e=Ey();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:My(e),setActiveStep:Ly(),markStepAsCompleted:Ny(),goNext:Ry(),setIsDisabled:Uy()}}function wt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.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:chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a(chunkSP6WPFZZ_cjs_js.a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Gy=h=>chunkSP6WPFZZ_cjs_js.d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:s,billingCountryCode:l,billingPeriod:a,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=chunkSP6WPFZZ_cjs_js.a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:a,promotionCode:n,billableFeatures:Bg__default.default(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}=chunkSP6WPFZZ_cjs_js.u(),o=wt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:s,customer:l}=n||{};return {previewSubscriptionAction:ii.useCallback((...u)=>chunkSP6WPFZZ_cjs_js.d(null,[...u],function*({promotionCode:c}={}){return i.isValid?Gy({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])}},zy=500,mc=({onMockCheckoutPreview:e}={})=>{let[t,o]=ii.useState(null),[r,n]=ii.useState(null),[i,s]=ii.useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return ii.useEffect(()=>{let a=()=>chunkSP6WPFZZ_cjs_js.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();},zy);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 Vy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function Hy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function Oy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function Wy(){let[{paymentStep:e}]=R();return e}function Zy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=Wy();return chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},e),{setUseNewPaymentMethod:Vy(),setErrorMessage:Hy(),setBillingAddress:Oy(),setTaxId:Zy()})}function fc(e){return dg__default.default({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===jsClientSdk.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===jsClientSdk.DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case jsClientSdk.DiscountDurationType.Once:{i=" once";break}case jsClientSdk.DiscountDurationType.Repeating:{i=`${o.type===jsClientSdk.DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case jsClientSdk.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__default.default.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=ii.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},th=({children:e,initialState:t})=>{let[o,r]=ii.useState(t);ii.useEffect(()=>{r(t);},[t]);let n=ii.useCallback(l=>r(a=>immer.produce(a,c=>l(c))),[r]),[i,s]=ii.useMemo(()=>[o,n],[n,o]);return jsxRuntime.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=chunkSP6WPFZZ_cjs_js.v(y),b=ii.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:[]}),B=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:B.availableAddons,availableCharges:F.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:p,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:F,addonsStep:B,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 jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:y,children:jsxRuntime.jsx(th,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var Pc="920px",bc=chunkSP6WPFZZ_cjs_js.e.div`
|
|
511
|
+
`;function Gl(){let e=de("md");return jsxRuntime.jsx(Me__default.default,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty__default.default(6).map(t=>jsxRuntime.jsx(Me__default.default,{item:true,xs:e?4:12,children:jsxRuntime.jsx(Qe__default.default,{width:280,height:120})},t))})}function zl({showAll:e,onToggle:t}){return jsxRuntime.jsx($l,{children:jsxRuntime.jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsxRuntime.jsx(reactFeather.Minus,{}):jsxRuntime.jsx(reactFeather.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:jsxRuntime.jsxs(Re,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsxRuntime.jsx(Le,{children:jsxRuntime.jsx(Ne,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:s})}),s?jsxRuntime.jsx(Gl,{}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(_l,{featureEntitlements:l,creditEntitlements:a,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:p}),C&&jsxRuntime.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=ii.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 jsxRuntime.jsxs(Sl,{className:"stigg-customer-portal-layout",children:[jsxRuntime.jsx(yl,{showWatermark:p}),jsxRuntime.jsxs(Tl,{className:"stigg-customer-portal-sections",children:[jsxRuntime.jsx(Zo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),y&&jsxRuntime.jsx(nr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsxRuntime.jsx(zn,{ref:h,paywallComponent:s,theme:u,title:c.paywallSectionTitle,isLoading:!a||f}),C&&jsxRuntime.jsx(Jo,{}),b&&jsxRuntime.jsx(ir,{})]})]})}function Zl(i){var s=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=s,n=chunk5K62MKBQ_cjs_js.c(s,["textOverrides","theme","resourceId","productId"]);return jsxRuntime.jsx(Fo,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsxRuntime.jsx(Ol,chunk5K62MKBQ_cjs_js.a({},n))})}function ir(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsxRuntime.jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsxRuntime.jsx(Yo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsxRuntime.jsx(Re,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxRuntime.jsxs(Le,{className:"stigg-invoices-section-header",children:[jsxRuntime.jsx(Ne,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Ql=e=>Yl__default.default(e,"displayName"),Qn=e=>Yl__default.default(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(jsClientSdk.WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function Kl({addon:e,currency:t,billingCountryCode:o}){return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.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=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.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)||jsClientSdk.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__default.default(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__default.default(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function jl(){let e=fy();return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.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 Py(){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:Py()}}function Sy(e){var t;return (t=e==null?void 0:e.plan)!=null&&t.pricePoints?chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},e),{plan:chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},e.plan),{pricePoints:e.plan.pricePoints.filter(o=>o.pricingModel!==jsClientSdk.BillingModel.CreditBased)})}):e}function tc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r}){let{stigg:n}=chunk5K62MKBQ_cjs_js.u(),[i,s]=ii.useState(true),[l,a]=ii.useState();return ii.useEffect(()=>{let c=()=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});a(Sy(u));}catch(u){chunk5K62MKBQ_cjs_js.r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{s(false);}});if(r){s(false);let u=r({planId:e,resourceId:t,billingCountryCode:o});a(u);return}n.isCustomerLoaded&&(s(true),c());},[n,n.isCustomerLoaded,t,e,o,r]),{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===sdk.BillingPeriod.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===sdk.BillingPeriod.Annually)),rc=e=>Kn(e)&&qn(e);var ac=(e,t,o)=>e===sdk.BillingPeriod.Monthly&&t||e===sdk.BillingPeriod.Annually&&o?e:null,sc=({pricingModel:e})=>e===jsClientSdk.BillingModel.PerUnit;function ky(e,t,o){var i;if(!t)return [];let r=wl__default.default(e,"featureId"),n=wl__default.default(ic__default.default((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__default.default(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 wy({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)||sdk.BillingPeriod.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?sdk.BillingPeriod.Annually:sdk.BillingPeriod.Monthly}function lc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=wy({plan:t,activeSubscription:o,preferredBillingPeriod:e}),s=t==null?void 0:t.pricePoints.filter(a=>a.billingPeriod===i),l=ky(n,s,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function By(){let[{planStep:e}]=R();return e}function Ay(){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 Iy(){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 xe(){let e=By();return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},e),{setBillingPeriod:Iy(),setBillableFeature:Ay()})}var dc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],cc={activeStep:0,completedSteps:[],steps:dc,isDisabled:false},vy=(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")&&vy(o,n,s,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},cc),{steps:dc.filter(a=>!l.includes(a.key))})}function Ey(){let[{progressBar:e}]=R();return e}function Ly(){let[e,t]=R();return o=>chunk5K62MKBQ_cjs_js.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 Ny(){let[,e]=R();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function My(e){return e.completedSteps.length>=e.steps.length-1}function Ry(){let[e,t]=R();return ()=>chunk5K62MKBQ_cjs_js.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 Uy(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Ue(){let e=Ey();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:My(e),setActiveStep:Ly(),markStepAsCompleted:Ny(),goNext:Ry(),setIsDisabled:Uy()}}function wt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.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:chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Gy=h=>chunk5K62MKBQ_cjs_js.d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:s,billingCountryCode:l,billingPeriod:a,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=chunk5K62MKBQ_cjs_js.a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:a,promotionCode:n,billableFeatures:Bg__default.default(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}=chunk5K62MKBQ_cjs_js.u(),o=wt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:s,customer:l}=n||{};return {previewSubscriptionAction:ii.useCallback((...u)=>chunk5K62MKBQ_cjs_js.d(null,[...u],function*({promotionCode:c}={}){return i.isValid?Gy({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])}},zy=500,mc=({onMockCheckoutPreview:e}={})=>{let[t,o]=ii.useState(null),[r,n]=ii.useState(null),[i,s]=ii.useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return ii.useEffect(()=>{let a=()=>chunk5K62MKBQ_cjs_js.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();},zy);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 Vy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function Hy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function Oy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function Wy(){let[{paymentStep:e}]=R();return e}function Zy(){let[,e]=R();return ii.useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=Wy();return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},e),{setUseNewPaymentMethod:Vy(),setErrorMessage:Hy(),setBillingAddress:Oy(),setTaxId:Zy()})}function fc(e){return dg__default.default({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===jsClientSdk.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===jsClientSdk.DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case jsClientSdk.DiscountDurationType.Once:{i=" once";break}case jsClientSdk.DiscountDurationType.Repeating:{i=`${o.type===jsClientSdk.DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case jsClientSdk.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__default.default.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=ii.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},th=({children:e,initialState:t})=>{let[o,r]=ii.useState(t);ii.useEffect(()=>{r(t);},[t]);let n=ii.useCallback(l=>r(a=>immer.produce(a,c=>l(c))),[r]),[i,s]=ii.useMemo(()=>[o,n],[n,o]);return jsxRuntime.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=chunk5K62MKBQ_cjs_js.v(y),b=ii.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:[]}),B=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:B.availableAddons,availableCharges:F.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:p,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:F,addonsStep:B,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 jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:y,children:jsxRuntime.jsx(th,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var Pc="920px",bc=chunk5K62MKBQ_cjs_js.e.div`
|
|
512
512
|
margin: auto;
|
|
513
513
|
min-height: 760px;
|
|
514
514
|
max-width: ${Pc};
|
|
@@ -530,7 +530,7 @@
|
|
|
530
530
|
border-radius: 10px;
|
|
531
531
|
width: ${Pc};
|
|
532
532
|
}
|
|
533
|
-
`,Sc=
|
|
533
|
+
`,Sc=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
534
534
|
display: flex;
|
|
535
535
|
align-items: flex-start;
|
|
536
536
|
gap: 32px;
|
|
@@ -541,7 +541,7 @@
|
|
|
541
541
|
${oe.md} {
|
|
542
542
|
flex-direction: row;
|
|
543
543
|
}
|
|
544
|
-
`,Tc=
|
|
544
|
+
`,Tc=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
545
545
|
display: flex;
|
|
546
546
|
flex-direction: column;
|
|
547
547
|
gap: 0;
|
|
@@ -551,18 +551,18 @@
|
|
|
551
551
|
${oe.md} {
|
|
552
552
|
width: auto;
|
|
553
553
|
}
|
|
554
|
-
`;var wc=
|
|
554
|
+
`;var wc=chunk5K62MKBQ_cjs_js.e(kf__default.default,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({[`&.${kf.linearProgressClasses.root}`]:{borderRadius:e.stigg.border.radius,backgroundColor:e.stigg.palette.outlinedBorder},[`& .${kf.linearProgressClasses.bar}`]:{backgroundColor:t?e.stigg.palette.primaryLight:e.stigg.palette.primary}})),Bc=chunk5K62MKBQ_cjs_js.e(Ym__default.default)({[`&.${Ym.buttonClasses.root}`]:{textTransform:"none",lineHeight:"inherit",justifyContent:"flex-start",padding:"8px 4px"}}),Ac=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.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}=Ue(),{widgetState:r}=U(),n=de("md"),i=ii.useRef(),{readOnly:s,isLoadingCheckoutData:l}=r,{activeStep:a,completedSteps:c,steps:u}=e||{},f=(a+1)*100/u.length,[p,h]=ii__default.default.useState(o);return ii.useEffect(()=>{n||i.current&&o!==p&&i.current.scrollIntoView({behavior:"smooth"}),h(o);},[o,n,p,h]),e.steps.length===1?null:jsxRuntime.jsxs(ke__default.default,{className:"stigg-checkout-progress-container",sx:{width:"100%",mb:3},ref:i,children:[jsxRuntime.jsx(wc,{variant:"determinate",value:f,$disabled:s}),jsxRuntime.jsx(Me__default.default,{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 jsxRuntime.jsx(Me__default.default,{item:true,display:"flex",flexDirection:"row",flex:n?1:"auto",justifyContent:"flex-start",children:l?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20,style:{marginTop:8}}):jsxRuntime.jsx(Bc,{onClick:()=>t(C),fullWidth:true,disabled:x,children:jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",flexDirection:"row",alignItems:"center",gap:1,children:[jsxRuntime.jsx(ch__default.default,{icon:jsxRuntime.jsx(Ac,{icon:b?x?"OutlinedCheckedCircleDisabled":"OutlinedCheckedCircle":"OutlinedCircle",$disabled:x,$shouldFill:b})}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:x?"primary.main.light":"primary.main",children:y})]})})},g)})})]})};var mh=[jsClientSdk.BillingModel.FlatFee,jsClientSdk.BillingModel.PerUnit,jsClientSdk.BillingModel.UsageBased],uh=e=>Yl__default.default(e,[t=>mh.indexOf(t.pricingModel),t=>{var o;return (o=t.feature)==null?void 0:o.displayName}]),dr=e=>ii.useMemo(()=>uh(e),[e]);function gh(){let[{promotionCode:e}]=R();return e}function fh(){let[,e]=R();return t=>e(o=>{o.promotionCode=t;})}function Bt(){return {promotionCode:gh(),setPromotionCode:fh()}}var yh=e=>jsxRuntime.jsx("svg",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxRuntime.jsxs("g",{id:"plus",children:[jsxRuntime.jsx("path",{id:"Shape",d:"M10 4.16666V15.8333",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{id:"Shape_2",d:"M4.16699 10H15.8337",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})})),pr=yh;var Ch=chunk5K62MKBQ_cjs_js.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
|
-
`,Ec=({onAddClick:e,checkoutLocalization:t,disabled:o})=>jsxRuntime.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:[jsxRuntime.jsx(Ch,{$disabled:o,className:"stigg-checkout-summary-add-coupon-code-button-icon"}),jsxRuntime.jsx(
|
|
559
|
+
`,Ec=({onAddClick:e,checkoutLocalization:t,disabled:o})=>jsxRuntime.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:[jsxRuntime.jsx(Ch,{$disabled:o,className:"stigg-checkout-summary-add-coupon-code-button-icon"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-checkout-change-plan-button-text",color:o?"disabled":"primary.main",style:{lineHeight:"24px"},variant:"h3",children:t.summary.addCouponCodeText})]});var Th=chunk5K62MKBQ_cjs_js.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
|
-
`,Lc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=Bt(),[n,i]=ii.useState(false),[s,l]=ii__default.default.useState(""),[a,c]=ii__default.default.useState(false),[u,f]=ii__default.default.useState(""),{previewSubscriptionAction:p}=Xn({onMockCheckoutPreview:o}),h=()=>
|
|
565
|
+
`,Lc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=Bt(),[n,i]=ii.useState(false),[s,l]=ii__default.default.useState(""),[a,c]=ii__default.default.useState(false),[u,f]=ii__default.default.useState(""),{previewSubscriptionAction:p}=Xn({onMockCheckoutPreview:o}),h=()=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){var C;c(true),f("");let{subscriptionPreview:g,errorMessage:y}=yield p({promotionCode:s});!y&&((C=g==null?void 0:g.immediateInvoice)!=null&&C.discountDetails)?(r(s.toUpperCase()),i(false)):y&&f(y),c(false);});return n?jsxRuntime.jsxs(Me__default.default,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:u?"error":e?"disabled":"primary.main",children:t.summary.couponCodeTitle}),jsxRuntime.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:jsxRuntime.jsx(Th,{variant:"contained",disabled:e,onClick:()=>{h();},children:a?jsxRuntime.jsx(bh__default.default,{size:18,sx:{color:"white"}}):jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{style:{display:"flex"},icon:"ArrowForward"})})}}),!!u&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",children:u})]}):jsxRuntime.jsx(Ec,{disabled:e,onAddClick:()=>i(true),checkoutLocalization:t})};var wh=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
566
566
|
width: auto;
|
|
567
567
|
display: inline-flex;
|
|
568
568
|
align-items: center;
|
|
@@ -571,7 +571,7 @@
|
|
|
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
|
-
`,Nc=
|
|
574
|
+
`,Nc=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.i,{shouldForwardProp:e=>e!=="style"})`
|
|
575
575
|
display: flex;
|
|
576
576
|
|
|
577
577
|
g {
|
|
@@ -581,9 +581,9 @@
|
|
|
581
581
|
path {
|
|
582
582
|
fill: ${({theme:e,$shouldFill:t})=>t?e.stigg.palette.primary:void 0};
|
|
583
583
|
}
|
|
584
|
-
`,Rc=({promotionCode:e,onClearPromotionCode:t})=>jsxRuntime.jsxs(wh,{container:true,children:[jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",gap:1,alignItems:"center",children:[jsxRuntime.jsx(Nc,{icon:"Coupon"}),jsxRuntime.jsx(
|
|
584
|
+
`,Rc=({promotionCode:e,onClearPromotionCode:t})=>jsxRuntime.jsxs(wh,{container:true,children:[jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",gap:1,alignItems:"center",children:[jsxRuntime.jsx(Nc,{icon:"Coupon"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary.main",lineHeight:"auto",children:e})]}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsx(te,{variant:"text",sx:{minWidth:"unset",padding:0},onClick:t,children:jsxRuntime.jsx(Nc,{icon:"Close",$shouldFill:true})})})]});var Bh=chunk5K62MKBQ_cjs_js.e.div`
|
|
585
585
|
margin: 16px 0;
|
|
586
|
-
`,Uc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Bt();return jsxRuntime.jsx(Bh,{children:r?jsxRuntime.jsx(Rc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsxRuntime.jsx(Lc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var _c=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:s})=>jsxRuntime.jsx(Ih__default.default,{onClick:r,value:n,control:jsxRuntime.jsx(Ah__default.default,{checked:t,onChange:o,disabled:i,"data-testid":s}),label:Fh__default.default(e)?jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var pi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:_3x2.AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:_3x2.AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:_3x2.AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:_3x2.AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:_3x2.AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:_3x2.AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:_3x2.AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:_3x2.AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:_3x2.AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:_3x2.AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:_3x2.BS,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:_3x2.BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:_3x2.BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:_3x2.BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:_3x2.BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:_3x2.BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:_3x2.BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:_3x2.BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:_3x2.BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:_3x2.BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:_3x2.BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:_3x2.BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:_3x2.BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:_3x2.BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:_3x2.KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:_3x2.CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:_3x2.CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:_3x2.CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:_3x2.CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:_3x2.CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:_3x2.CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:_3x2.CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:_3x2.CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:_3x2.CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:_3x2.CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:_3x2.CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:_3x2.CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:_3x2.CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:_3x2.HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:_3x2.HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:_3x2.CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:_3x2.CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:_3x2.DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:_3x2.DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:_3x2.EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:_3x2.EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:_3x2.SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:_3x2.EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:_3x2.ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:_3x2.EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:_3x2.FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:_3x2.FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:_3x2.GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:_3x2.DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:_3x2.DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:_3x2.GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:_3x2.GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:_3x2.HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:_3x2.HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:_3x2.HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:_3x2.IS,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:_3x2.IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:_3x2.ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:_3x2.IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:_3x2.IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:_3x2.IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:_3x2.JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:_3x2.JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:_3x2.JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:_3x2.KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:_3x2.KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:_3x2.KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:_3x2.LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:_3x2.LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:_3x2.LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:_3x2.LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:_3x2.LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:_3x2.LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:_3x2.MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:_3x2.MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:_3x2.MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:_3x2.MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:_3x2.MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:_3x2.MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:_3x2.MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:_3x2.ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:_3x2.MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:_3x2.NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:_3x2.NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:_3x2.NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:_3x2.NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:_3x2.MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:_3x2.NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:_3x2.NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:_3x2.OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:_3x2.PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:_3x2.PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:_3x2.PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:_3x2.PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:_3x2.RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:_3x2.RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:_3x2.RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:_3x2.RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:_3x2.SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:_3x2.SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:_3x2.RS,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:_3x2.SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:_3x2.SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:_3x2.SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:_3x2.SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:_3x2.SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:_3x2.ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:_3x2.KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:_3x2.ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:_3x2.ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:_3x2.SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:_3x2.SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:_3x2.CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:_3x2.CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:_3x2.TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:_3x2.TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:_3x2.TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:_3x2.TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:_3x2.TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:_3x2.UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:_3x2.UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:_3x2.AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:_3x2.GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:_3x2.GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:_3x2.US,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:_3x2.UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:_3x2.UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:_3x2.UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:_3x2.VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:_3x2.VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:_3x2.ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:_3x2.ZW,example:"1234567890"}],fP="United States",yP=" # ",mr="us_ein",ur=(e,t)=>`${e}${yP}${t}`,mi=new Map(pi.map(e=>[ur(e.taxIdType,e.country),e])),It=e=>mi.get(e),gr=ur(mr,fP);var ui=chunkSP6WPFZZ_cjs_js.e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var bP=chunkSP6WPFZZ_cjs_js.e(hP__default.default)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),fr=chunkSP6WPFZZ_cjs_js.e(chunkSP6WPFZZ_cjs_js.f)({});fr.defaultProps={variant:"body1",color:"secondary"};function od(){let[e,t]=ii.useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,s]=ii.useState(gr),[l,a]=ii.useState(false),c=ii.useCallback((g,y,C)=>{n({type:y,value:C}),s(g);},[n,s]);ii.useEffect(()=>{a(false);},[o==null?void 0:o.country]),ii.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(true),r!=null&&r.value){c(g,y.taxIdType,r.value);return}s(g),r!=null&&r.type&&n(void 0);}},f=ii.useMemo(()=>Array.from(mi.keys()),[]),p=ii.useMemo(()=>f.find(g=>g===i)||null,[f,i]),h=ii.useMemo(()=>{let g=It(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return ii.useEffect(()=>(e||(a(false),c(gr,mr,"")),()=>{c(gr,mr,"");}),[e,c]),jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(Me__default.default,{flexDirection:"row",container:true,gap:2,children:jsxRuntime.jsx(_c,{checked:e,onChange:()=>t(g=>!g),label:jsxRuntime.jsx(fr,{children:"I'm purchasing as a business"})})}),jsxRuntime.jsx(CP__default.default,{in:e,children:jsxRuntime.jsxs(Me__default.default,{container:true,spacing:0,sx:{width:"100%"},children:[jsxRuntime.jsxs(Me__default.default,{item:true,xs:6,children:[jsxRuntime.jsx(fr,{children:"Tax ID Type"}),jsxRuntime.jsx(bP,{fullWidth:true,options:f,value:p,onChange:(g,y)=>u(y),renderInput:g=>jsxRuntime.jsx(ui,chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=It(y);if(!C)return null;let{taxIdType:b,country:x,FlagComponent:S}=C;return ii.createElement(ou__default.default,chunkSP6WPFZZ_cjs_js.b(chunkSP6WPFZZ_cjs_js.a({},g),{key:y}),jsxRuntime.jsxs(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsxRuntime.jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),ed__default.default(x)," - ",td__default.default(b)]}))},getOptionLabel:g=>{let y=It(g);return y?`${ed__default.default(y.country)} - ${td__default.default(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxRuntime.jsxs(Me__default.default,{item:true,xs:6,paddingLeft:"12px",children:[jsxRuntime.jsx(fr,{children:"Tax ID"}),jsxRuntime.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,configuration:c}=r||{},{readOnly:u}=i,f=!!(t!=null?t:(g=c==null?void 0:c.content)!=null&&g.collectPhoneNumber),p=ii.useMemo(()=>o&&!(a!=null&&a.billingId)&&!(a!=null&&a.paymentMethodDetails),[o,a==null?void 0:a.billingId,a==null?void 0:a.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=chunkSP6WPFZZ_cjs_js.c(S,["postal_code"]),x=chunkSP6WPFZZ_cjs_js.a({postalCode:C},b);s(true),l(x),e?chunkSP6WPFZZ_cjs_js.d(null,null,function*(){yield e({billingAddress:x}),s(false);}):s(false);};return jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsxRuntime.jsx(reactStripeJs.AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f?"always":"auto"},defaultValues:chunkSP6WPFZZ_cjs_js.a({},(a==null?void 0:a.name)&&{name:a.name})}})]}),jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsxRuntime.jsx(reactStripeJs.PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:chunkSP6WPFZZ_cjs_js.a(chunkSP6WPFZZ_cjs_js.a({},(a==null?void 0:a.name)&&{name:a.name}),(a==null?void 0:a.email)&&{email:a.email})}}})]}),p&&jsxRuntime.jsx(od,{})]})}function nd(){let[e,t]=ii.useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return ii.useEffect(()=>{if(r){let{billingIdentifier:i,credentials:s}=r;if(i!==jsClientSdk.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 chunkSP6WPFZZ_cjs_js.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 FP=[jsClientSdk.PaymentCollection.Failed,jsClientSdk.PaymentCollection.Processing];function vP(t){return chunkSP6WPFZZ_cjs_js.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 xi(o){return chunkSP6WPFZZ_cjs_js.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===jsClientSdk.PaymentCollection.ActionRequired){let{error:a}=yield t.handleNextAction({clientSecret:n});if(a)return {errorMessage:a.message||""}}else if(i&&FP.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 EP(r){return chunkSP6WPFZZ_cjs_js.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 chunkSP6WPFZZ_cjs_js.d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield vP({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:s}=yield EP({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,_P=chunkSP6WPFZZ_cjs_js.e(ke__default.default)`
|
|
586
|
+
`,Uc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Bt();return jsxRuntime.jsx(Bh,{children:r?jsxRuntime.jsx(Rc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsxRuntime.jsx(Lc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var _c=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:s})=>jsxRuntime.jsx(Ih__default.default,{onClick:r,value:n,control:jsxRuntime.jsx(Ah__default.default,{checked:t,onChange:o,disabled:i,"data-testid":s}),label:Fh__default.default(e)?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var pi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:_3x2.AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:_3x2.AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:_3x2.AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:_3x2.AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:_3x2.AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:_3x2.AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:_3x2.AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:_3x2.AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:_3x2.AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:_3x2.AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:_3x2.BS,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:_3x2.BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:_3x2.BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:_3x2.BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:_3x2.BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:_3x2.BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:_3x2.BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:_3x2.BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:_3x2.BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:_3x2.BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:_3x2.BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:_3x2.BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:_3x2.BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:_3x2.BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:_3x2.KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:_3x2.CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:_3x2.CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:_3x2.CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:_3x2.CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:_3x2.CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:_3x2.CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:_3x2.CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:_3x2.CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:_3x2.CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:_3x2.CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:_3x2.CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:_3x2.CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:_3x2.CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:_3x2.HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:_3x2.HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:_3x2.CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:_3x2.CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:_3x2.DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:_3x2.DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:_3x2.EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:_3x2.EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:_3x2.SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:_3x2.EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:_3x2.ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:_3x2.EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:_3x2.FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:_3x2.FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:_3x2.GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:_3x2.DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:_3x2.DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:_3x2.GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:_3x2.GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:_3x2.HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:_3x2.HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:_3x2.HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:_3x2.IS,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:_3x2.IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:_3x2.ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:_3x2.IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:_3x2.IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:_3x2.IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:_3x2.JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:_3x2.JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:_3x2.JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:_3x2.KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:_3x2.KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:_3x2.KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:_3x2.LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:_3x2.LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:_3x2.LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:_3x2.LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:_3x2.LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:_3x2.LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:_3x2.MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:_3x2.MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:_3x2.MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:_3x2.MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:_3x2.MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:_3x2.MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:_3x2.MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:_3x2.ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:_3x2.MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:_3x2.NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:_3x2.NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:_3x2.NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:_3x2.NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:_3x2.MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:_3x2.NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:_3x2.NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:_3x2.OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:_3x2.PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:_3x2.PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:_3x2.PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:_3x2.PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:_3x2.RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:_3x2.RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:_3x2.RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:_3x2.RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:_3x2.SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:_3x2.SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:_3x2.RS,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:_3x2.SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:_3x2.SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:_3x2.SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:_3x2.SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:_3x2.SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:_3x2.ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:_3x2.KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:_3x2.ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:_3x2.ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:_3x2.SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:_3x2.SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:_3x2.CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:_3x2.CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:_3x2.TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:_3x2.TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:_3x2.TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:_3x2.TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:_3x2.TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:_3x2.UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:_3x2.UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:_3x2.AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:_3x2.GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:_3x2.GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:_3x2.US,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:_3x2.UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:_3x2.UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:_3x2.UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:_3x2.VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:_3x2.VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:_3x2.ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:_3x2.ZW,example:"1234567890"}],fP="United States",yP=" # ",mr="us_ein",ur=(e,t)=>`${e}${yP}${t}`,mi=new Map(pi.map(e=>[ur(e.taxIdType,e.country),e])),It=e=>mi.get(e),gr=ur(mr,fP);var ui=chunk5K62MKBQ_cjs_js.e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var bP=chunk5K62MKBQ_cjs_js.e(hP__default.default)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),fr=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)({});fr.defaultProps={variant:"body1",color:"secondary"};function od(){let[e,t]=ii.useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,s]=ii.useState(gr),[l,a]=ii.useState(false),c=ii.useCallback((g,y,C)=>{n({type:y,value:C}),s(g);},[n,s]);ii.useEffect(()=>{a(false);},[o==null?void 0:o.country]),ii.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(true),r!=null&&r.value){c(g,y.taxIdType,r.value);return}s(g),r!=null&&r.type&&n(void 0);}},f=ii.useMemo(()=>Array.from(mi.keys()),[]),p=ii.useMemo(()=>f.find(g=>g===i)||null,[f,i]),h=ii.useMemo(()=>{let g=It(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return ii.useEffect(()=>(e||(a(false),c(gr,mr,"")),()=>{c(gr,mr,"");}),[e,c]),jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(Me__default.default,{flexDirection:"row",container:true,gap:2,children:jsxRuntime.jsx(_c,{checked:e,onChange:()=>t(g=>!g),label:jsxRuntime.jsx(fr,{children:"I'm purchasing as a business"})})}),jsxRuntime.jsx(CP__default.default,{in:e,children:jsxRuntime.jsxs(Me__default.default,{container:true,spacing:0,sx:{width:"100%"},children:[jsxRuntime.jsxs(Me__default.default,{item:true,xs:6,children:[jsxRuntime.jsx(fr,{children:"Tax ID Type"}),jsxRuntime.jsx(bP,{fullWidth:true,options:f,value:p,onChange:(g,y)=>u(y),renderInput:g=>jsxRuntime.jsx(ui,chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=It(y);if(!C)return null;let{taxIdType:b,country:x,FlagComponent:S}=C;return ii.createElement(ou__default.default,chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},g),{key:y}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsxRuntime.jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),ed__default.default(x)," - ",td__default.default(b)]}))},getOptionLabel:g=>{let y=It(g);return y?`${ed__default.default(y.country)} - ${td__default.default(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxRuntime.jsxs(Me__default.default,{item:true,xs:6,paddingLeft:"12px",children:[jsxRuntime.jsx(fr,{children:"Tax ID"}),jsxRuntime.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,configuration:c}=r||{},{readOnly:u}=i,f=!!(t!=null?t:(g=c==null?void 0:c.content)!=null&&g.collectPhoneNumber),p=ii.useMemo(()=>o&&!(a!=null&&a.billingId)&&!(a!=null&&a.paymentMethodDetails),[o,a==null?void 0:a.billingId,a==null?void 0:a.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=chunk5K62MKBQ_cjs_js.c(S,["postal_code"]),x=chunk5K62MKBQ_cjs_js.a({postalCode:C},b);s(true),l(x),e?chunk5K62MKBQ_cjs_js.d(null,null,function*(){yield e({billingAddress:x}),s(false);}):s(false);};return jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsxRuntime.jsx(reactStripeJs.AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f?"always":"auto"},defaultValues:chunk5K62MKBQ_cjs_js.a({},(a==null?void 0:a.name)&&{name:a.name})}})]}),jsxRuntime.jsxs(Me__default.default,{flexDirection:"column",container:true,gap:2,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsxRuntime.jsx(reactStripeJs.PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},(a==null?void 0:a.name)&&{name:a.name}),(a==null?void 0:a.email)&&{email:a.email})}}})]}),p&&jsxRuntime.jsx(od,{})]})}function nd(){let[e,t]=ii.useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return ii.useEffect(()=>{if(r){let{billingIdentifier:i,credentials:s}=r;if(i!==jsClientSdk.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 chunk5K62MKBQ_cjs_js.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 FP=[jsClientSdk.PaymentCollection.Failed,jsClientSdk.PaymentCollection.Processing];function vP(t){return chunk5K62MKBQ_cjs_js.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 xi(o){return chunk5K62MKBQ_cjs_js.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===jsClientSdk.PaymentCollection.ActionRequired){let{error:a}=yield t.handleNextAction({clientSecret:n});if(a)return {errorMessage:a.message||""}}else if(i&&FP.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 EP(r){return chunk5K62MKBQ_cjs_js.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 chunk5K62MKBQ_cjs_js.d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield vP({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:s}=yield EP({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,_P=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
587
587
|
@keyframes blurFade {
|
|
588
588
|
0% {
|
|
589
589
|
background-color: ${({theme:e})=>bi__default.default(e.stigg.palette.backgroundPaper).alpha(0).toString()};
|
|
@@ -614,7 +614,7 @@
|
|
|
614
614
|
& path {
|
|
615
615
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
616
616
|
}
|
|
617
|
-
`,DP=
|
|
617
|
+
`,DP=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
618
618
|
@keyframes fadeIn {
|
|
619
619
|
0% {
|
|
620
620
|
opacity: 0;
|
|
@@ -629,19 +629,19 @@
|
|
|
629
629
|
|
|
630
630
|
align-self: center;
|
|
631
631
|
animation: fadeIn 5s ease-in forwards;
|
|
632
|
-
`;function ld({checkoutLocalization:e}){let t=ii.useRef();return ii.useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxRuntime.jsxs(_P,{className:"stigg-checkout-success-container",ref:t,children:[jsxRuntime.jsx(UP__default.default,{options:{animationData:ad,loop:false,autoplay:true},width:350,height:"auto",style:{display:"flex",justifyContent:"center"}}),jsxRuntime.jsx(DP,{variant:"h1",color:"primary.main",children:e.summary.checkoutSuccessText})]})}var VP=e=>new Promise(t=>setTimeout(t,e));function cd({isMocked:e=false,onCheckout:t,onCheckoutCompleted:o,onSuccess:r,disableSuccessAnimation:n}){let{stigg:i}=
|
|
632
|
+
`;function ld({checkoutLocalization:e}){let t=ii.useRef();return ii.useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxRuntime.jsxs(_P,{className:"stigg-checkout-success-container",ref:t,children:[jsxRuntime.jsx(UP__default.default,{options:{animationData:ad,loop:false,autoplay:true},width:350,height:"auto",style:{display:"flex",justifyContent:"center"}}),jsxRuntime.jsx(DP,{variant:"h1",color:"primary.main",children:e.summary.checkoutSuccessText})]})}var VP=e=>new Promise(t=>setTimeout(t,e));function cd({isMocked:e=false,onCheckout:t,onCheckoutCompleted:o,onSuccess:r,disableSuccessAnimation:n}){let{stigg:i}=chunk5K62MKBQ_cjs_js.u(),{useNewPaymentMethod:s}=re(),l=yr(),{checkoutState:a,widgetState:c,setWidgetReadOnly:u}=U(),{setupSecret:f,customer:p}=a||{},h=reactStripeJs.useStripe(),g=reactStripeJs.useElements();return {handleSubmit:C=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){if(C.preventDefault(),!l)return {success:false,errorMessage:"Unexpected error, please contact support."};let b=true,x,S=false,T;if(u(true),!e&&s){let k=yield id({elements:g,stripe:h,setupIntentClientSecret:f});k.success?T=k.paymentMethodId:(x=k.errorMessage,b=false);}let F=chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},l),{paymentMethodId:T}),B=k=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){S=true;try{let L=yield i.applySubscription(k),E=yield xi({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)if(t){let k=yield t({customerId:p.id,checkoutParams:F,checkoutAction:B});if(k.errorMessage&&(x=k.errorMessage),!S&&k.results&&k.success){let L=yield xi({applySubscriptionResults:k.results,stripe:h});L.errorMessage&&(x=L.errorMessage,b=false);}b=b&&k.success&&!x,I=k.results;}else {let k=yield B(F);!k.success&&k.errorMessage&&(x=k.errorMessage),b=k.success&&!x,I=k.results;}return u(false),b&&r&&(r(),n||(yield VP(hr))),yield o({success:b,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}=chunk5K62MKBQ_cjs_js.u(),{setErrorMessage:t}=re(),{billingCountryCode:o}=xe(),[r,n]=ii.useState(false),{checkoutState:i}=U(),{billingIntegration:s}=i||{},l=ii.useCallback(()=>chunk5K62MKBQ_cjs_js.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=ii.useCallback(()=>{try{dd()||pd(),n(!0);}catch(u){t("Failed to initialize Zuora");}},[n,t]);return ii.useEffect(()=>{if(s){let{billingIdentifier:u}=s;u===jsClientSdk.BillingVendorIdentifier.Zuora&&a();}},[s,a]),{isZuoraIntegration:(s==null?void 0:s.billingIdentifier)===jsClientSdk.BillingVendorIdentifier.Zuora,isInitialized:r,createPaymentSession:l}}var ZP=e=>new Promise(t=>setTimeout(t,e));function Cr({onCheckout:e,onCheckoutCompleted:t,onSuccess:o,disableSuccessAnimation:r}){let{stigg:n}=chunk5K62MKBQ_cjs_js.u(),i=yr(),{checkoutState:s,setWidgetReadOnly:l,setCheckoutSuccess:a}=U(),{setErrorMessage:c}=re();return {handleZuoraSubmit:ii.useCallback(f=>chunk5K62MKBQ_cjs_js.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=chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},g),{paymentMethodId:f}),C=b=>chunk5K62MKBQ_cjs_js.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(true),o&&(o(),r||(yield ZP(hr)))):c(h),l(false),yield t({success:p,error:h}),{success:p,errorMessage:h}}),[n,i,s,e,t,o,r,l,a,c])}}var Ie=({isLoading:e,width:t=50,height:o=16,children:r})=>e?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:t,height:o}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:r});var KP=({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 jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-remaining-credits",children:jsxRuntime.jsx(Ie,{isLoading:t,width:"100%",children:o.summary.creditsForUnusedTimeText({credits:i})})})},qP=({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 jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-scheduled-updates",children:jsxRuntime.jsx(Ie,{isLoading:o,width:"100%",children:i})})},JP=({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 jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-next-billing",children:jsxRuntime.jsx(Ie,{isLoading:r,width:"100%",children:l})})};function yd(e){return jsxRuntime.jsxs(ke__default.default,{className:"stigg-checkout-summary-captions",children:[jsxRuntime.jsx(KP,chunk5K62MKBQ_cjs_js.a({},e)),jsxRuntime.jsx(qP,chunk5K62MKBQ_cjs_js.a({},e)),e.plan&&jsxRuntime.jsx(JP,chunk5K62MKBQ_cjs_js.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(jsClientSdk.BillingPeriod.Monthly),c=o===jsClientSdk.BillingModel.PerUnit,u=i||1,f=r===jsClientSdk.BillingPeriod.Annually&&a,p=e&&(c||e>1)?`${chunk5K62MKBQ_cjs_js.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===jsClientSdk.TiersMode.Graduated&&!Ea(n,o)){let s=H({amount:t,currency:i,minimumFractionDigits:2});return `${chunk5K62MKBQ_cjs_js.k(o)} for ${s}`}return Si(e)}function ox(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 xo__default.default(r)?`${chunk5K62MKBQ_cjs_js.k(i)} and above`:`Next ${chunk5K62MKBQ_cjs_js.k(i)} to ${chunk5K62MKBQ_cjs_js.k(r)}`}function Pd({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:jsxRuntime.jsx(jsxRuntime.Fragment,{children:i.map(({unitQuantity:s,amount:l},a)=>jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:ox(o,a)}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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 xd=chunk5K62MKBQ_cjs_js.e(reactFeather.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;
|
|
636
636
|
${({$isOpen:e})=>e&&"transform: rotate(90deg)"}
|
|
637
|
-
`;var De=
|
|
637
|
+
`;var De=chunk5K62MKBQ_cjs_js.e.div`
|
|
638
638
|
& + & {
|
|
639
639
|
margin-top: 16px;
|
|
640
640
|
}
|
|
641
|
-
`,gx=
|
|
641
|
+
`,gx=chunk5K62MKBQ_cjs_js.e.div`
|
|
642
642
|
margin-top: 16px;
|
|
643
643
|
margin-left: 16px;
|
|
644
|
-
`,Fe=
|
|
644
|
+
`,Fe=chunk5K62MKBQ_cjs_js.e.div`
|
|
645
645
|
display: flex;
|
|
646
646
|
flex-direction: column;
|
|
647
647
|
gap: 16px;
|
|
@@ -651,28 +651,28 @@
|
|
|
651
651
|
align-items: center;
|
|
652
652
|
justify-content: space-between;
|
|
653
653
|
}
|
|
654
|
-
`,fx=({checkoutLocalization:e})=>{let t=jsxRuntime.jsx(
|
|
654
|
+
`,fx=({checkoutLocalization:e})=>{let t=jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",children:e.summary.payAsYouGoTooltipText});return jsxRuntime.jsx(Ve,{placement:"left",title:t,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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]=ii.useState(false),c=()=>a(y=>!y),u=r.pricingModel===jsClientSdk.BillingModel.UsageBased,f=r.isTieredPrice?ht(r,o):(r.amount||0)*Math.ceil(o/(r.blockSize||1)),p;r.tiersMode===jsClientSdk.TiersMode.Graduated&&!!r.tiers&&!Bg__default.default(r.tiers)&&!xo__default.default(r.tiers[0].upTo)&&o>r.tiers[0].upTo&&(p=jsxRuntime.jsx(Pd,{price:r,unitQuantity:o}));let g=jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:t});return p&&(g=jsxRuntime.jsx(Pf__default.default,{onClick:c,underline:"none",style:{cursor:"pointer"},children:g})),jsxRuntime.jsxs(De,{className:"stigg-checkout-summary-base-charges-container",children:[jsxRuntime.jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",gap:.5,style:{whiteSpace:s?"nowrap":"break-spaces"},children:[g,p&&jsxRuntime.jsx(mx__default.default,{onClick:c,sx:{padding:0},children:jsxRuntime.jsx(xd,{$isOpen:l,$size:16})})]}),jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",gap:1,alignItems:"center",children:[u&&jsxRuntime.jsx(fx,{checkoutLocalization:e}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:s?"nowrap":"break-spaces"},children:[Cd({totalAmount:f,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&&jsxRuntime.jsx(CP__default.default,{in:l,children:jsxRuntime.jsx(gx,{children:p})})]})},bd=({label:e})=>jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{style:{alignItems:"flex-end"},children:[jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:e})}),jsxRuntime.jsx(Me__default.default,{item:true,display:"flex",gap:1,alignItems:"center",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",style:{wordBreak:"break-word"},children:"Free"})})]})}),Sd=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{let{immediateInvoice:r,recurringInvoice:n}=e,{discount:i,discountDetails:s}=n||{};return !i||!s?null:jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:o.summary.discountText({discountDetails:s,currency:r.total.currency})}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:t?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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:jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:o.summary.appliedCreditsTitle}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:jsxRuntime.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:jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:r.summary.taxTitle({taxDetails:t})}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:jsxRuntime.jsx(Ie,{isLoading:o,children:H({amount:e==null?void 0:e.amount,currency:e==null?void 0:e.currency,minimumFractionDigits:2})})})]})});var wi=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
655
655
|
width: 100%;
|
|
656
656
|
max-width: 470px;
|
|
657
657
|
flex: 1.5;
|
|
658
|
-
`,Sr=
|
|
658
|
+
`,Sr=chunk5K62MKBQ_cjs_js.e(bx__default.default)`
|
|
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 Tx=
|
|
665
|
+
`;Sr.defaultProps={elevation:0};var Tx=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
666
666
|
margin-bottom: 16px;
|
|
667
667
|
font-weight: 500;
|
|
668
|
-
`,vt=
|
|
668
|
+
`,vt=chunk5K62MKBQ_cjs_js.e(Cl__default.default)`
|
|
669
669
|
margin: 16px 0;
|
|
670
|
-
`,Bd=
|
|
670
|
+
`,Bd=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.f)`
|
|
671
671
|
margin-bottom: 8px;
|
|
672
|
-
`;function kx({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,showWatermark:s})=>{var ia,aa,sa,la;let[l,a]=ii.useState(false),{setErrorMessage:c,useNewPaymentMethod:u}=re(),f=Ue(),p=wt(),{checkoutState:h,checkoutLocalization:g,checkoutSuccess:y,widgetState:C}=U(),{plan:b,activeSubscription:x}=h||{},S=dr(((ia=b==null?void 0:b.pricePoints)==null?void 0:ia.filter(D=>D.billingPeriod===p.billingPeriod))||[]),[T,F]=hx__default.default(S,D=>D.pricingModel===jsClientSdk.BillingModel.FlatFee),B=T[0],I=n||f.isCheckoutComplete&&f.isLastStep,{isZuoraIntegration:k}=Ft(),L=l||y,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,errorMessage:Z}=mc({onMockCheckoutPreview:i}),{handleSubmit:$,isLoading:_}=cd({isMocked:!!i,disableSuccessAnimation:r,onCheckout:e,onCheckoutCompleted:t,onSuccess:()=>{a(true),f.markStepAsCompleted(f.progressBarState.activeStep);}}),{handleZuoraSubmit:z}=Cr({onCheckout:e,onCheckoutCompleted:t,disableSuccessAnimation:r,onSuccess:()=>{f.markStepAsCompleted(f.progressBarState.activeStep);}}),q=D=>
|
|
672
|
+
`;function kx({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,showWatermark:s})=>{var ia,aa,sa,la;let[l,a]=ii.useState(false),{setErrorMessage:c,useNewPaymentMethod:u}=re(),f=Ue(),p=wt(),{checkoutState:h,checkoutLocalization:g,checkoutSuccess:y,widgetState:C}=U(),{plan:b,activeSubscription:x}=h||{},S=dr(((ia=b==null?void 0:b.pricePoints)==null?void 0:ia.filter(D=>D.billingPeriod===p.billingPeriod))||[]),[T,F]=hx__default.default(S,D=>D.pricingModel===jsClientSdk.BillingModel.FlatFee),B=T[0],I=n||f.isCheckoutComplete&&f.isLastStep,{isZuoraIntegration:k}=Ft(),L=l||y,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,errorMessage:Z}=mc({onMockCheckoutPreview:i}),{handleSubmit:$,isLoading:_}=cd({isMocked:!!i,disableSuccessAnimation:r,onCheckout:e,onCheckoutCompleted:t,onSuccess:()=>{a(true),f.markStepAsCompleted(f.progressBarState.activeStep);}}),{handleZuoraSubmit:z}=Cr({onCheckout:e,onCheckoutCompleted:t,disableSuccessAnimation:r,onSuccess:()=>{f.markStepAsCompleted(f.progressBarState.activeStep);}}),q=D=>chunk5K62MKBQ_cjs_js.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(false)):c(void 0);}),Ge=k&&!u?C.readOnly:_,pt=D=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){Ge||(I?yield q(D):f.goNext());}),{immediateInvoice:V,recurringInvoice:Pe}=E||{},Xi=!!E&&(!!(V!=null&&V.proration)||!!E.hasScheduledUpdates),ji=!o&&!n&&!k,ea=!!(Pe!=null&&Pe.discountDetails)&&!n,Yr=ji||ea,ta=F.some(D=>D.pricingModel===jsClientSdk.BillingModel.UsageBased),Qr=ta&&!B&&F.every(D=>D.pricingModel===jsClientSdk.BillingModel.UsageBased),oa=typeof g.summary.baseChargeText=="function"?g.summary.baseChargeText({billingPeriod:p.billingPeriod}):g.summary.baseChargeText,ra=ii.useMemo(()=>{var D,we;return (we=(D=p.addons)==null?void 0:D.filter(ge=>!at(ge.addon)))!=null?we:[]},[p.addons]),na=ii.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 jsxRuntime.jsx(br,{checkoutLocalization:g,label:D.addon.displayName,quantity:ge,price:we},D.addon.id)}),[ra,p.billingPeriod,g]);return jsxRuntime.jsxs(wi,{className:"stigg-checkout-summary-container",children:[jsxRuntime.jsxs(Sr,{children:[jsxRuntime.jsx(Tx,{variant:"h3",children:g.summary.title}),jsxRuntime.jsxs(Me__default.default,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.planName({plan:b})}),jsxRuntime.jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),B&&jsxRuntime.jsx(br,{checkoutLocalization:g,label:oa,quantity:1,price:B}),!B&&n?jsxRuntime.jsx(bd,{label:oa}):null,jsxRuntime.jsx(Me__default.default,{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 jsxRuntime.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&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(Me__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.addonsSectionTitle}),jsxRuntime.jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),na]}),!Yr&&jsxRuntime.jsx(vt,{className:"stigg-checkout-summary-divider"}),Yr&&jsxRuntime.jsxs(Me__default.default,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.discountsSectionTitle}),jsxRuntime.jsx(vt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),ji&&jsxRuntime.jsx(Uc,{disabled:Ge||A,checkoutLocalization:g,onMockCheckoutPreview:i}),ea&&E&&jsxRuntime.jsx(Sd,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),Yr&&jsxRuntime.jsx(vt,{className:"stigg-checkout-summary-divider"}),jsxRuntime.jsx(kd,{tax:Pe==null?void 0:Pe.tax,taxDetails:Pe==null?void 0:Pe.taxDetails,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),n?null:jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Fe,{style:{marginTop:16},children:jsxRuntime.jsxs(Me__default.default,{display:"flex",flexDirection:"column",container:true,children:[jsxRuntime.jsxs(Me__default.default,{item:true,display:"flex",justifyContent:"space-between",children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:g.summary.totalText}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:jsxRuntime.jsxs(Ie,{isLoading:A,children:[Qr?g.summary.onlyPayAsYouGoText:null,!Qr&&ta?g.summary.startsAtText:null,Qr?null:H(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({amount:0},Pe==null?void 0:Pe.total),{minimumFractionDigits:2}))]})})]}),jsxRuntime.jsx(Me__default.default,{item:true,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:g.summary.totalBillingPeriodText({billingPeriod:p.billingPeriod})})})]})}),jsxRuntime.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?jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:g.summary.proratedTotalDueText}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:jsxRuntime.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,jsxRuntime.jsx(Td,{subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g}),jsxRuntime.jsx(De,{children:jsxRuntime.jsxs(Fe,{children:[jsxRuntime.jsx(Bd,{variant:"h6",children:g.summary.totalDueText}),jsxRuntime.jsx(Bd,{variant:"h6",children:jsxRuntime.jsx(Ie,{isLoading:A,children:H(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({amount:0},V==null?void 0:V.total),{minimumFractionDigits:2}))})})]})}),jsxRuntime.jsx(yd,{plan:b,activeSubscription:x,subscriptionPreview:E,isFetchingSubscriptionPreview:A,checkoutLocalization:g,billingPeriod:p.billingPeriod}),(!I||!k||k&&!u)&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(te,{$success:L,$error:I&&n,disabled:Ge||A||f.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:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:L?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{icon:"Check",style:{display:"contents"}}):Ge||A?jsxRuntime.jsx(bh__default.default,{size:20,sx:{color:"white"}}):kx({isLastStep:I,checkoutHasChanges:Xi,isFreeDowngrade:n,checkoutLocalization:g,isPlanUpdate:!!x&&(x==null?void 0:x.plan.id)===(b==null?void 0:b.id)})})}),Z&&jsxRuntime.jsx(Sx__default.default,{severity:"error",sx:{alignItems:"center",marginTop:"12px"},children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{overrideColor:"inherit",children:Z})})]})]}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.q,{source:"checkout",showWatermark:s,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&L&&jsxRuntime.jsx(ld,{checkoutLocalization:g})]})};var Id=({showWatermark:e})=>jsxRuntime.jsxs(wi,{children:[jsxRuntime.jsxs(Sr,{children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.l,{$flexDirection:"column",$gap:24,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{width:120,height:20})]}),jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.l,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:20})]}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.n,{flex:1,marginTop:5,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.o,{height:34})})]}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.q,{source:"checkout",showWatermark:e,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var vd=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
673
673
|
width: 100%;
|
|
674
674
|
gap: 8px;
|
|
675
|
-
`,Ed=
|
|
675
|
+
`,Ed=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
676
676
|
display: flex;
|
|
677
677
|
flex-direction: column;
|
|
678
678
|
gap: 16px;
|
|
@@ -687,7 +687,7 @@
|
|
|
687
687
|
padding-top: 16px;
|
|
688
688
|
padding-bottom: 16px;
|
|
689
689
|
}
|
|
690
|
-
`,Ld=
|
|
690
|
+
`,Ld=chunk5K62MKBQ_cjs_js.e(te)`
|
|
691
691
|
min-width: unset;
|
|
692
692
|
width: 41px;
|
|
693
693
|
height: 41px;
|
|
@@ -698,40 +698,40 @@
|
|
|
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,handleQuantityChange:s,handleUndo:l,handleRemoveAddon:a}){var p;let c=de("lg"),u=!!t,f=e.maxQuantity!==1;return jsxRuntime.jsxs(Bx,{item:true,sx:{gap:"16px"},container:!c,children:[o&&jsxRuntime.jsx(te,{variant:"text",size:"small",sx:{padding:"8px",minWidth:"unset"},onClick:l,children:jsxRuntime.jsx(
|
|
701
|
+
`;function Rd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i,handleQuantityChange:s,handleUndo:l,handleRemoveAddon:a}){var p;let c=de("lg"),u=!!t,f=e.maxQuantity!==1;return jsxRuntime.jsxs(Bx,{item:true,sx:{gap:"16px"},container:!c,children:[o&&jsxRuntime.jsx(te,{variant:"text",size:"small",sx:{padding:"8px",minWidth:"unset"},onClick:l,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:"primary.main",variant:"body1",children:"Undo"})}),u&&jsxRuntime.jsxs(Me__default.default,{sx:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[f&&jsxRuntime.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()}),jsxRuntime.jsx(Ld,{color:"error",onClick:a,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.i,{icon:"Trash",style:{display:"flex",padding:"8px"}})})]}),!u&&jsxRuntime.jsx(te,{sx:{paddingX:"22px",paddingY:"8px"},onClick:()=>s(1),disabled:!n,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{color:n?"primary.main":"disabled",variant:"body1",children:i.addAddonText})})]})}var Fx=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
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 jsxRuntime.jsxs(Fx,{item:true,children:[jsxRuntime.jsx(
|
|
707
|
+
`;function Ud({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxRuntime.jsxs(Fx,{item:true,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",lineHeight:"24px",children:e.displayName}),r?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:`${H({amount:r.amount,currency:r.currency,minimumFractionDigits:2})}/${t===jsClientSdk.BillingPeriod.Annually?"year":"month"}`}):jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",lineHeight:"20px",color:"secondary",children:o.addonBillingPeriodNotAvailableText({planBillingPeriod:t})})]})}function Lx({addon:e,billingPeriod:t,addonState:o,initialAddonState:r,setAddon:n,removeAddon:i,checkoutLocalization:s,onAddonsValidationChange:l,onAddonChange:a}){let[c,u]=ii.useState(void 0),f=!!o&&!!r&&o.quantity!==r.quantity||!!r&&!o,p=e.pricePoints.some(C=>C.billingPeriod===t),h=C=>chunk5K62MKBQ_cjs_js.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=()=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){yield a==null?void 0:a({addon:e,quantity:0}),i(e.id),l({addonId:e.id,isValid:true});});return jsxRuntime.jsxs(Ed,{children:[jsxRuntime.jsx(Ud,{addon:e,billingPeriod:t,checkoutLocalization:s}),jsxRuntime.jsx(Rd,{addon:e,addonState:o,hasChanges:f,handleUndo:()=>chunk5K62MKBQ_cjs_js.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}=xe(),{setIsDisabled:n}=Ue(),{initialAddons:i,addons:s,availableAddons:l,setAddon:a,removeAddon:c}=jl(),[u,f]=ii.useState((l==null?void 0:l.reduce((p,h)=>(p[h.id]=true,p),{}))||{});return ii.useEffect(()=>{let p=Object.values(u).some(h=>!h);n(p),o(!p);},[u,n,o]),jsxRuntime.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 jsxRuntime.jsx(Lx,{addon:p,billingPeriod:r,addonState:h,initialAddonState:g,setAddon:a,removeAddon:c,checkoutLocalization:t,onAddonsValidationChange:({addonId:y,isValid:C})=>f(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},u),{[y]:C})),onAddonChange:e},p.id)})})}var Ii=chunk5K62MKBQ_cjs_js.e(Me__default.default,{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=
|
|
713
|
+
`,$d=chunk5K62MKBQ_cjs_js.e(Ii)`
|
|
714
714
|
flex-direction: column;
|
|
715
715
|
align-items: unset;
|
|
716
716
|
${({$hideBorders:e})=>e&&react.css`
|
|
717
717
|
border: none;
|
|
718
718
|
padding: 0;
|
|
719
719
|
`}
|
|
720
|
-
`,Gd=
|
|
720
|
+
`,Gd=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
721
721
|
display: flex;
|
|
722
722
|
align-items: center;
|
|
723
723
|
flex: 1;
|
|
724
724
|
gap: 12px;
|
|
725
|
-
`,zd=
|
|
725
|
+
`,zd=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
|
-
`;var zx=
|
|
728
|
+
`;var zx=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
729
729
|
position: relative;
|
|
730
730
|
max-width: 500px;
|
|
731
|
-
`,Vx=
|
|
731
|
+
`,Vx=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
732
732
|
opacity: ${({$showLoading:e})=>e?.6:1};
|
|
733
733
|
pointer-events: ${({$showLoading:e})=>e?"none":"auto"};
|
|
734
|
-
`,Hx=
|
|
734
|
+
`,Hx=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
735
735
|
position: absolute;
|
|
736
736
|
top: 40px;
|
|
737
737
|
left: 0;
|
|
@@ -743,18 +743,18 @@
|
|
|
743
743
|
justify-content: center;
|
|
744
744
|
border-radius: 4px;
|
|
745
745
|
z-index: 10;
|
|
746
|
-
`,Ox=
|
|
746
|
+
`,Ox=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
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}=xe(),{checkoutState:l,widgetState:a}=U(),{handleZuoraSubmit:c}=Cr({onCheckout:e,onCheckoutCompleted:t}),u=ii.useRef(false),[f,p]=ii__default.default.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)||jsClientSdk.Currency.Usd,{publishableKey:g}=l==null?void 0:l.billingIntegration.billingCredentials,y=ii.useCallback(S=>
|
|
751
|
+
`;function Vd({onCheckout:e,onCheckoutCompleted:t}){var C,b,x;let{isZuoraIntegration:o,isInitialized:r,createPaymentSession:n}=Ft(),{setErrorMessage:i}=re(),{billingCountryCode:s}=xe(),{checkoutState:l,widgetState:a}=U(),{handleZuoraSubmit:c}=Cr({onCheckout:e,onCheckoutCompleted:t}),u=ii.useRef(false),[f,p]=ii__default.default.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)||jsClientSdk.Currency.Usd,{publishableKey:g}=l==null?void 0:l.billingIntegration.billingCredentials,y=ii.useCallback(S=>chunk5K62MKBQ_cjs_js.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 ii.useEffect(()=>(chunk5K62MKBQ_cjs_js.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?jsxRuntime.jsxs(zx,{children:[jsxRuntime.jsx(Vx,{id:"zuora_payment",$showLoading:a.readOnly||f}),(a.readOnly||f)&&jsxRuntime.jsx(Hx,{children:jsxRuntime.jsx(Ox,{children:jsxRuntime.jsx(bh__default.default,{size:28})})})]}):null}function Od({checked:e,text:t,subtitle:o,readOnly:r}){return jsxRuntime.jsxs(Gd,{children:[jsxRuntime.jsx(Yx__default.default,{checked:e,disabled:r}),jsxRuntime.jsxs(zd,{container:true,children:[jsxRuntime.jsx(Me__default.default,{item:true,children:t}),o&&jsxRuntime.jsx(Me__default.default,{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 jsxRuntime.jsx(Ii,{item:true,onClick:r,$disabled:o,children:jsxRuntime.jsx(Od,{checked:e,readOnly:o,text:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:`Card ending in ${n}`}),subtitle:!!i&&!!s&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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 jsxRuntime.jsxs($d,{item:true,$hideBorders:!e,onClick:o,$disabled:r,children:[e&&jsxRuntime.jsx(Od,{checked:t,readOnly:r,text:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",children:n.newPaymentMethodText})}),jsxRuntime.jsx(CP__default.default,{in:t,children:u?jsxRuntime.jsx(Vd,{onCheckout:a,onCheckoutCompleted:c}):jsxRuntime.jsx(rd,{onBillingAddressChange:i,collectPhoneNumber:s,collectTaxId:l})})]})}var qx=chunk5K62MKBQ_cjs_js.e(Me__default.default)`
|
|
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}=re(),{readOnly:p}=l,h=g=>{p||f(g);};return jsxRuntime.jsxs(qx,{container:true,children:[!!c&&jsxRuntime.jsx(Sx__default.default,{severity:"error",sx:{alignItems:"center"},children:jsxRuntime.jsx(
|
|
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}=re(),{readOnly:p}=l,h=g=>{p||f(g);};return jsxRuntime.jsxs(qx,{container:true,children:[!!c&&jsxRuntime.jsx(Sx__default.default,{severity:"error",sx:{alignItems:"center"},children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{overrideColor:"inherit",children:c})}),jsxRuntime.jsx(Wd,{readOnly:p,checked:!u,paymentMethodDetails:a==null?void 0:a.paymentMethodDetails,onSelect:()=>h(false)}),jsxRuntime.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})=>jsxRuntime.jsx(Ym__default.default,{className:"stigg-checkout-change-plan-button",sx:{textTransform:"none"},variant:"text",size:o,onClick:e,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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 jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ke__default.default,{sx:{marginBottom:"16px"},children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"disabled",style:{opacity:.6,marginBottom:"8px"},children:"Selected plan"}),jsxRuntime.jsxs(ke__default.default,{sx:{display:"flex",justifyContent:"space-between"},children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h1",children:n==null?void 0:n.displayName}),e&&t&&jsxRuntime.jsx(Ir,{onClick:()=>{t({currentPlan:n});},checkoutLocalization:r,size:"medium"})]})]}),jsxRuntime.jsx(Cl__default.default,{className:"stigg-checkout-plan-header-divider"})]})}function Ei(e){switch(e){case jsClientSdk.BillingPeriod.Annually:return "Annual";case jsClientSdk.BillingPeriod.Monthly:return "Monthly";default:return ""}}var jd=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
756
756
|
margin: 16px 0;
|
|
757
|
-
`,ep=
|
|
757
|
+
`,ep=chunk5K62MKBQ_cjs_js.e.button`
|
|
758
758
|
cursor: ${({$disabled:e,$isOnlyBillingPeriod:t})=>e||t?"default":"pointer"};
|
|
759
759
|
flex: 1;
|
|
760
760
|
display: flex;
|
|
@@ -774,19 +774,19 @@
|
|
|
774
774
|
background: none;
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
`,tp=
|
|
777
|
+
`,tp=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
778
778
|
display: flex;
|
|
779
779
|
gap: 16px;
|
|
780
780
|
margin-top: 16px;
|
|
781
|
-
`;
|
|
781
|
+
`;chunk5K62MKBQ_cjs_js.e.div`
|
|
782
782
|
display: flex;
|
|
783
783
|
align-items: baseline;
|
|
784
784
|
gap: 8px;
|
|
785
|
-
`;
|
|
785
|
+
`;chunk5K62MKBQ_cjs_js.e(tb__default.default)`
|
|
786
786
|
& .MuiChip-label {
|
|
787
787
|
font-size: 12px;
|
|
788
788
|
}
|
|
789
|
-
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=xe(),n=o===e;return jsxRuntime.jsxs(ep,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsxRuntime.jsx(Yx__default.default,{checked:n,onChange:()=>r(e),value:e,disabled:t,inputProps:{"aria-label":Ei(e)},sx:{padding:0,marginRight:"8px"}}),jsxRuntime.jsx(ke__default.default,{children:jsxRuntime.jsx(
|
|
789
|
+
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=xe(),n=o===e;return jsxRuntime.jsxs(ep,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsxRuntime.jsx(Yx__default.default,{checked:n,onChange:()=>r(e),value:e,disabled:t,inputProps:{"aria-label":Ei(e)},sx:{padding:0,marginRight:"8px"}}),jsxRuntime.jsx(ke__default.default,{children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",children:Ei(e)})})]})};function rp({plan:e,checkoutLocalization:t}){let[o,r]=hx__default.default(e==null?void 0:e.pricePoints,i=>i.billingPeriod===jsClientSdk.BillingPeriod.Monthly),n=!!(o!=null&&o.length)&&!!(r!=null&&r.length);return n?jsxRuntime.jsxs(jd,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",children:t.billingPeriodsTitle}),jsxRuntime.jsxs(tp,{children:[!!(o!=null&&o.length)&&jsxRuntime.jsx(op,{billingPeriod:jsClientSdk.BillingPeriod.Monthly,isOnlyBillingPeriod:!n},jsClientSdk.BillingPeriod.Monthly),!!(r!=null&&r.length)&&jsxRuntime.jsx(op,{billingPeriod:jsClientSdk.BillingPeriod.Annually,isOnlyBillingPeriod:!n},jsClientSdk.BillingPeriod.Annually)]})]}):null}var cb=chunk5K62MKBQ_cjs_js.e.div`
|
|
790
790
|
display: flex;
|
|
791
791
|
min-height: 60px;
|
|
792
792
|
margin-top: 16px;
|
|
@@ -797,39 +797,39 @@
|
|
|
797
797
|
align-items: flex-start;
|
|
798
798
|
justify-content: space-between;
|
|
799
799
|
}
|
|
800
|
-
`,db=
|
|
800
|
+
`,db=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
801
801
|
display: flex;
|
|
802
802
|
flex-direction: column;
|
|
803
803
|
justify-content: center;
|
|
804
804
|
width: 100%;
|
|
805
805
|
height: 42px;
|
|
806
|
-
`,pb=
|
|
806
|
+
`,pb=chunk5K62MKBQ_cjs_js.e(chunk5K62MKBQ_cjs_js.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
|
-
`,mb=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function ub({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var g,y,C,b,x,S;let[i,s]=ii.useState(void 0),l=(g=e.feature)==null?void 0:g.featureId,a=!l,c=e.pricingModel===jsClientSdk.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=!!(e!=null&&e.minUnitQuantity||e!=null&&e.maxUnitQuantity),p=T=>
|
|
812
|
+
`,mb=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function ub({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var g,y,C,b,x,S;let[i,s]=ii.useState(void 0),l=(g=e.feature)==null?void 0:g.featureId,a=!l,c=e.pricingModel===jsClientSdk.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=!!(e!=null&&e.minUnitQuantity||e!=null&&e.maxUnitQuantity),p=T=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){var E,A;if(a||!l)return;let{minUnitQuantity:F,maxUnitQuantity:B}=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||B&&I>B){r({featureId:l,isValid:false}),s(mb(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=jsxRuntime.jsx(To,{componentId:`${l}-tiers`,tiers:e.tiers,tiersMode:e.tiersMode,value:T,errorMessage:i,handleChange:F=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){let B=yield n==null?void 0:n({feature:e.feature,quantity:F});s(B==null?void 0:B.errorMessage),r({featureId:l,isValid:!(B!=null&&B.disableNextStep)}),t(l,F);}),width:"100%"});}else h=jsxRuntime.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 jsxRuntime.jsxs(cb,{children:[jsxRuntime.jsxs(db,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",lineHeight:"24px",children:u}),f&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",lineHeight:"20px",children:go(e.minUnitQuantity,e.maxUnitQuantity,(S=e.feature)==null?void 0:S.unitsPlural)})]}),jsxRuntime.jsx(pb,{variant:"h6",color:"primary",children:h})]})}function ap({plan:e,billingPeriod:t,onBillableFeatureChange:o}){var u;let{billableFeatures:r,setBillableFeature:n}=xe(),{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,c]=ii.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 ii.useEffect(()=>{let f=Object.values(a).some(p=>!p);i(f),s(!f);},[a,i,s]),jsxRuntime.jsx(jsxRuntime.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 jsxRuntime.jsx(ub,{charge:f,setBillableFeature:n,billableFeature:p,onValidationChange:({featureId:g,isValid:y})=>c(C=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},C),{[g]:y})),onBillableFeatureChange:o},((h=f.feature)==null?void 0:h.featureId)||"base-charge")})})}var sp=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
813
813
|
width: 100%;
|
|
814
|
-
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=xe();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qd,{allowChangePlan:true,onChangePlan:e}),jsxRuntime.jsxs(sp,{children:[jsxRuntime.jsx(rp,{plan:n,checkoutLocalization:r}),jsxRuntime.jsx(ap,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var hb=e=>jsxRuntime.jsx("svg",
|
|
814
|
+
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=xe();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(qd,{allowChangePlan:true,onChangePlan:e}),jsxRuntime.jsxs(sp,{children:[jsxRuntime.jsx(rp,{plan:n,checkoutLocalization:r}),jsxRuntime.jsx(ap,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var hb=e=>jsxRuntime.jsx("svg",chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxRuntime.jsxs("g",{id:"arrow-right",children:[jsxRuntime.jsx("path",{id:"Shape",d:"M2.66699 8H13.3337",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntime.jsx("path",{id:"Shape_2",d:"M9.33301 4L13.333 8L9.33301 12",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})})),dp=hb;var pp=chunk5K62MKBQ_cjs_js.e(dp)`
|
|
815
815
|
path {
|
|
816
816
|
stroke: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
817
817
|
}
|
|
818
|
-
`;var xb=
|
|
818
|
+
`;var xb=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
819
819
|
display: flex;
|
|
820
|
-
`,bb=
|
|
820
|
+
`,bb=chunk5K62MKBQ_cjs_js.e(Sx__default.default)`
|
|
821
821
|
margin-bottom: 16px;
|
|
822
|
-
`,Sb=
|
|
822
|
+
`,Sb=chunk5K62MKBQ_cjs_js.e(ke__default.default)`
|
|
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})=>jsxRuntime.jsxs(Sb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsxRuntime.jsx(
|
|
827
|
+
`,mp=({headerText:e,planName:t,priceText:o})=>jsxRuntime.jsxs(Sb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-checkout-downgrade-to-free-text-header",style:{opacity:.8},variant:"caption",color:"disabled",children:e}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{className:"stigg-checkout-downgrade-to-free-plan-name",bold:true,variant:"h3",color:"primary",children:t}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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=jsxRuntime.jsx(Ir,{onClick:()=>{n({currentPlan:o});},checkoutLocalization:e,size:"small"}));let s=t.prices.length>0?t.prices[0].billingPeriod:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(bb,{action:i,className:"stigg-checkout-downgrade-to-free-alert",severity:"info",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{as:"span",color:"secondary",children:e.downgradeToFree.alertText({plan:t.plan})})}),jsxRuntime.jsxs(xb,{className:"stigg-checkout-downgrade-to-free-plans-container",children:[jsxRuntime.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})}),jsxRuntime.jsx(pp,{className:"stigg-checkout-downgrade-to-free-arrow",style:{margin:"auto 16px",minWidth:"16px"}}),jsxRuntime.jsx(mp,{headerText:e.downgradeToFree.freePlanHeader({plan:o}),planName:e.downgradeToFree.freePlanName({plan:o}),priceText:e.downgradeToFree.freePlanPriceText({plan:o})})]})]})};var Bb=(e,{onBillingAddressChange:t,onChangePlan:o,onBillableFeatureChange:r,onAddonChange:n,collectPhoneNumber:i,collectTaxId:s,onCheckout:l,onCheckoutCompleted:a})=>{switch(e.key){case "PLAN":return {content:jsxRuntime.jsx(cp,{onChangePlan:o,onBillableFeatureChange:r})};case "ADDONS":return {content:jsxRuntime.jsx(Dd,{onAddonChange:n})};case "PAYMENT":return {content:jsxRuntime.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,disableSuccessAnimation:c,onMockCheckoutPreview:u}){let{stripePromise:f,setupIntentClientSecret:p}=nd(),[{stiggTheme:h,widgetState:g,theme:y,showWatermark:C}]=R(),{currentStep:b}=Ue(),{isLoadingCheckoutData:x}=g,{checkoutState:S,checkoutLocalization:T}=U(),{plan:F,activeSubscription:B}=S||{},I=!!F&&F.pricingType===jsClientSdk.PricingType.Free&&!!B&&B.pricingType!==jsClientSdk.PricingType.Free,{content:k}=Bb(b,{onBillingAddressChange:r,onChangePlan:o,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:s,collectTaxId:l,onCheckout:e,onCheckoutCompleted:t}),L=jsxRuntime.jsx(jsxRuntime.Fragment,{children:I?jsxRuntime.jsx(gp,{freePlan:F,activeSubscription:B,allowChangePlan:true,checkoutLocalization:T,onChangePlan:o}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:k})}),E=ii.useMemo(()=>p?{clientSecret:p}:{mode:"setup",currency:"usd"},[p]);return jsxRuntime.jsx(reactStripeJs.Elements,{stripe:f,options:chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.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:jsxRuntime.jsxs(bc,{className:"stigg-checkout-layout",children:[!I&&jsxRuntime.jsx(Fc,{}),jsxRuntime.jsxs(Sc,{children:[jsxRuntime.jsx(Tc,{children:x?jsxRuntime.jsx(Da,{}):L}),x?jsxRuntime.jsx(Id,{showWatermark:C}):jsxRuntime.jsx(Ad,{disablePromotionCode:a,disableSuccessAnimation:c,onCheckout:e,onCheckoutCompleted:t,isFreeDowngrade:I,onMockCheckoutPreview:u,showWatermark:C})]})]})},p)}var xp=p=>{var h=p,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:s,billingInformation:l,onMockCheckoutState:a,skipCheckoutSteps:c,onBeforeStepChange:u}=h,f=chunk5K62MKBQ_cjs_js.c(h,["textOverrides","theme","resourceId","planId","preferredBillingPeriod","billingCountryCode","billableFeatures","billingInformation","onMockCheckoutState","skipCheckoutSteps","onBeforeStepChange"]);return jsxRuntime.jsx(Cc,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:s,billingInformation:l,onMockCheckoutState:a,skipCheckoutSteps:c,onBeforeStepChange:u,children:jsxRuntime.jsx(Cp,chunk5K62MKBQ_cjs_js.a({},f))})};function Fb(e){return ii.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}=chunk5K62MKBQ_cjs_js.u(),[n,i]=ii.useState("IN_PROGRESS"),[s,l]=ii.useState(false),a=Fb("checkoutCompleted");return ii.useEffect(()=>{chunk5K62MKBQ_cjs_js.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 vb(r){var n=r,{noAccessComponent:e,children:t}=n,o=chunk5K62MKBQ_cjs_js.c(n,["noAccessComponent","children"]);let{hasAccess:i}=chunk5K62MKBQ_cjs_js.x(o);return i?t:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e!=null?e:null})}function Nb(r){var n=r,{noAccessComponent:e,children:t}=n,o=chunk5K62MKBQ_cjs_js.c(n,["noAccessComponent","children"]);let{hasAccess:i}=chunk5K62MKBQ_cjs_js.y(o);return i?t:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e!=null?e:null})}function Ub(r){var n=r,{noAccessComponent:e,children:t}=n,o=chunk5K62MKBQ_cjs_js.c(n,["noAccessComponent","children"]);let{hasAccess:i}=chunk5K62MKBQ_cjs_js.z(o);return i?t:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e!=null?e:null})}function $b(r){var n=r,{noAccessComponent:e,children:t}=n,o=chunk5K62MKBQ_cjs_js.c(n,["noAccessComponent","children"]);let{hasAccess:i}=chunk5K62MKBQ_cjs_js.A(o);return i?t:jsxRuntime.jsx(jsxRuntime.Fragment,{children:e!=null?e:null})}function et(e){let t=chunk5K62MKBQ_cjs_js.u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=ii.useCallback(()=>chunk5K62MKBQ_cjs_js.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}=chunk5K62MKBQ_cjs_js.B({func:n});return ii.useMemo(()=>({balance:i,isLoading:l,error:s}),[i,s,l])}var Lt=chunk5K62MKBQ_cjs_js.e.div`
|
|
828
828
|
display: flex;
|
|
829
829
|
align-items: center;
|
|
830
830
|
justify-content: space-between;
|
|
831
831
|
width: 100%;
|
|
832
|
-
`;var Nt=
|
|
832
|
+
`;var Nt=chunk5K62MKBQ_cjs_js.e.button`
|
|
833
833
|
display: flex;
|
|
834
834
|
align-items: center;
|
|
835
835
|
gap: 4px;
|
|
@@ -855,27 +855,27 @@
|
|
|
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?
|
|
858
|
+
`;var tt=(e,t)=>e?chunk5K62MKBQ_cjs_js.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?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"secondary",className:o,children:r}):null}var Zb=chunk5K62MKBQ_cjs_js.e.div`
|
|
859
859
|
display: flex;
|
|
860
860
|
flex-direction: column;
|
|
861
861
|
gap: 4px;
|
|
862
|
-
`,Yb=
|
|
862
|
+
`,Yb=chunk5K62MKBQ_cjs_js.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 jsxRuntime.jsx(
|
|
867
|
+
`;function kp({balance:e,isLoading:t,error:o,decimalPlaces:r=null,showUnits:n=true,showSymbol:i=false}){if(o)return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",className:"stigg-credit-balance-value-error",children:o.message||"Failed to load balance"});if(t)return jsxRuntime.jsx(Qe__default.default,{width:120,height:24,className:"stigg-credit-balance-value-loading"});if(e){let s=vr(e,n,i);return jsxRuntime.jsxs(Zb,{children:[jsxRuntime.jsxs(Yb,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-balance-value-amount",children:tt(e.currentBalance,r)}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"secondary",className:"stigg-credit-balance-value-suffix",children:s})]}),jsxRuntime.jsx(Lr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-balance-reset-period"})]})}return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"disabled",className:"stigg-credit-balance-value-no-balance",children:"No balance data available"})}var Nr=chunk5K62MKBQ_cjs_js.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 Qb=
|
|
873
|
+
`;var Qb=chunk5K62MKBQ_cjs_js.e.div`
|
|
874
874
|
display: flex;
|
|
875
875
|
flex-direction: column;
|
|
876
876
|
gap: 8px;
|
|
877
877
|
width: 100%;
|
|
878
|
-
`,Kb=
|
|
878
|
+
`,Kb=chunk5K62MKBQ_cjs_js.e.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
gap: 8px;
|
|
@@ -883,40 +883,40 @@
|
|
|
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=
|
|
886
|
+
`;function wp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=chunk5K62MKBQ_cjs_js.u({optional:true}),a=l==null?void 0:l.theme,{balance:c,isLoading:u,error:f}=et({currencyId:e}),{title:p,addCredits:h}=chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},chunk5K62MKBQ_cjs_js.F),t),g=jsxRuntime.jsx(Qb,{className:"stigg-credit-balance-container",children:jsxRuntime.jsxs(Kb,{className:"stigg-credit-balance-card",children:[jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",className:"stigg-credit-balance-title",children:p}),i&&c&&!f&&jsxRuntime.jsxs(Nt,{type:"button",onClick:()=>i(c),className:"stigg-credit-balance-add-credits-button",children:[jsxRuntime.jsx(Nr,{className:"stigg-credit-balance-add-credits-icon"}),h]})]}),jsxRuntime.jsx(kp,{balance:c,isLoading:u,error:f,decimalPlaces:o,showUnits:r,showSymbol:n})]})});return s?g:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:a,children:g})}var Xb=ii.lazy(()=>import('./CreditUsageChart-P3BWIUOZ.cjs.js').then(e=>({default:e.CreditUsageChart})));function Ap(e){return jsxRuntime.jsx(ii.Suspense,{fallback:null,children:jsxRuntime.jsx(Xb,chunk5K62MKBQ_cjs_js.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,eS=chunk5K62MKBQ_cjs_js.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
|
-
`,tS=
|
|
892
|
+
`,tS=chunk5K62MKBQ_cjs_js.e.div`
|
|
893
893
|
height: 100%;
|
|
894
894
|
width: ${({percentage:e})=>Math.max(0,Math.min(100,e))}%;
|
|
895
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 jsxRuntime.jsx(eS,{className:t,children:jsxRuntime.jsx(tS,{percentage:e,variant:o})})}var rS=
|
|
898
|
+
`;function Mr({percentage:e,className:t,variant:o="utilization"}){return jsxRuntime.jsx(eS,{className:t,children:jsxRuntime.jsx(tS,{percentage:e,variant:o})})}var rS=chunk5K62MKBQ_cjs_js.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
|
-
`,nS=
|
|
904
|
+
`,nS=chunk5K62MKBQ_cjs_js.e.div`
|
|
905
905
|
display: flex;
|
|
906
906
|
flex-direction: row;
|
|
907
907
|
gap: 4px;
|
|
908
908
|
align-items: baseline;
|
|
909
|
-
`,iS=
|
|
909
|
+
`,iS=chunk5K62MKBQ_cjs_js.e.div`
|
|
910
910
|
display: flex;
|
|
911
911
|
flex-direction: row;
|
|
912
912
|
gap: 4px;
|
|
913
913
|
align-items: baseline;
|
|
914
|
-
`,aS=({totalConsumed:e,totalGranted:t})=>{let o=Er(e!=null?e:0,t!=null?t:0);return jsxRuntime.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=
|
|
914
|
+
`,aS=({totalConsumed:e,totalGranted:t})=>{let o=Er(e!=null?e:0,t!=null?t:0);return jsxRuntime.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=chunk5K62MKBQ_cjs_js.G.remaining}){if(o)return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",className:"stigg-credit-utilization-value-error",children:o.message||"Failed to load balance"});if(t)return jsxRuntime.jsx(Qe__default.default,{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 jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(rS,{children:[jsxRuntime.jsxs(nS,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-utilization-usage",children:tt(a,r)}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-separator",children:"/"}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-total",children:tt(c,r)}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-suffix",children:u})]}),jsxRuntime.jsxs(iS,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-remaining-label",children:s}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"primary",bold:true,className:"stigg-credit-utilization-remaining-value",children:tt(l,r)})]})]}),jsxRuntime.jsx(aS,{totalConsumed:e.totalConsumed,totalGranted:e.totalGranted}),jsxRuntime.jsx(Lr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-utilization-reset-period"})]})}return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"disabled",className:"stigg-credit-utilization-value-no-balance",children:"No balance data available"})}var lS=chunk5K62MKBQ_cjs_js.e.div`
|
|
915
915
|
display: flex;
|
|
916
916
|
flex-direction: column;
|
|
917
917
|
gap: 8px;
|
|
918
918
|
width: 100%;
|
|
919
|
-
`,cS=
|
|
919
|
+
`,cS=chunk5K62MKBQ_cjs_js.e.div`
|
|
920
920
|
display: flex;
|
|
921
921
|
flex-direction: column;
|
|
922
922
|
gap: 16px;
|
|
@@ -925,7 +925,7 @@
|
|
|
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=
|
|
928
|
+
`;function vp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,showSymbol:n=false,onAddCredits:i}){let s=fe(ee),l=chunk5K62MKBQ_cjs_js.u({optional:true}),a=l==null?void 0:l.theme,{balance:c,isLoading:u,error:f}=et({currencyId:e}),{title:p,remaining:h,addCredits:g}=chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},chunk5K62MKBQ_cjs_js.G),t),y=jsxRuntime.jsx(lS,{className:"stigg-credit-utilization-container",children:jsxRuntime.jsxs(cS,{className:"stigg-credit-utilization-card",children:[jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",className:"stigg-credit-utilization-title",children:p}),i&&c&&!f&&jsxRuntime.jsxs(Nt,{type:"button",onClick:()=>i(c),className:"stigg-credit-utilization-add-credits-button",children:[jsxRuntime.jsx(Nr,{className:"stigg-credit-utilization-add-credits-icon"}),g]})]}),jsxRuntime.jsx(Fp,{balance:c,isLoading:u,error:f,decimalPlaces:o,showUnits:r,showSymbol:n,remainingLabel:h})]})});return s?y:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:a,children:y})}function Ur(e){let t=chunk5K62MKBQ_cjs_js.u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=ii.useCallback(()=>chunk5K62MKBQ_cjs_js.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}=chunk5K62MKBQ_cjs_js.B({func:n});return ii.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 jsxRuntime.jsx(jsxRuntime.Fragment,{children:Array.from({length:e}).map((r,n)=>jsxRuntime.jsx(mS__default.default,{children:t.map(i=>jsxRuntime.jsx(Rt,{$alignment:i.alignment,$width:i.width,$maxWidth:i.maxWidth,$minWidth:i.minWidth,$isLastRow:n===e-1,$hideLastRowBorder:o,children:jsxRuntime.jsx(Qe__default.default,{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 jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.map((n,i)=>jsxRuntime.jsx(zi,{$clickable:!!o,onClick:()=>o&&o(n),children:t.map(s=>jsxRuntime.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:jsxRuntime.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"?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",className:t,children:e||"An error occurred"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}function Gr({message:e,className:t}){return e===void 0||typeof e=="string"?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",className:t,children:e||"No data available"}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:e})}var wS=chunk5K62MKBQ_cjs_js.e(material.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,13 +938,13 @@
|
|
|
938
938
|
align-items: center;
|
|
939
939
|
justify-content: center;
|
|
940
940
|
`}
|
|
941
|
-
`,BS=
|
|
941
|
+
`,BS=chunk5K62MKBQ_cjs_js.e(material.Table)`
|
|
942
942
|
min-width: 600px;
|
|
943
943
|
table-layout: auto;
|
|
944
944
|
width: 100%;
|
|
945
|
-
`,AS=
|
|
945
|
+
`,AS=chunk5K62MKBQ_cjs_js.e(material.Divider)`
|
|
946
946
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
947
|
-
`,Rt=
|
|
947
|
+
`,Rt=chunk5K62MKBQ_cjs_js.e(material.TableCell)`
|
|
948
948
|
padding: 8px 12px;
|
|
949
949
|
border-bottom: 1px solid ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
950
950
|
text-align: ${({$alignment:e})=>e||"left"};
|
|
@@ -957,38 +957,38 @@
|
|
|
957
957
|
${({$minWidth:e})=>e&&`min-width: ${e};`}
|
|
958
958
|
|
|
959
959
|
${({$isLastRow:e,$hideLastRowBorder:t})=>e&&t&&"border-bottom: none;"}
|
|
960
|
-
`,IS=
|
|
960
|
+
`,IS=chunk5K62MKBQ_cjs_js.e(Rt)`
|
|
961
961
|
background-color: transparent;
|
|
962
|
-
`,zi=
|
|
962
|
+
`,zi=chunk5K62MKBQ_cjs_js.e(material.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
|
-
`,Vi=
|
|
969
|
+
`,Vi=chunk5K62MKBQ_cjs_js.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
|
-
`,FS=
|
|
974
|
+
`,FS=chunk5K62MKBQ_cjs_js.e(material.TablePagination)`
|
|
975
975
|
color: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
976
|
-
`;function vS({visibleHeadCells:e}){return jsxRuntime.jsx(material.TableHead,{children:jsxRuntime.jsx(material.TableRow,{children:e.map(t=>jsxRuntime.jsx(IS,{$alignment:t.alignment,$width:t.width,$maxWidth:t.maxWidth,$minWidth:t.minWidth,children:jsxRuntime.jsx(
|
|
976
|
+
`;function vS({visibleHeadCells:e}){return jsxRuntime.jsx(material.TableHead,{children:jsxRuntime.jsx(material.TableRow,{children:e.map(t=>jsxRuntime.jsx(IS,{$alignment:t.alignment,$width:t.width,$maxWidth:t.maxWidth,$minWidth:t.minWidth,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.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 jsxRuntime.jsx(wS,{className:l,$hasMinHeight:y,children:r?jsxRuntime.jsx($r,{errorMessage:i,className:`${l}-error`}):!o&&e.length===0?jsxRuntime.jsx(Gr,{message:n,className:`${l}-empty`}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(BS,{children:[jsxRuntime.jsx(vS,{visibleHeadCells:g}),jsxRuntime.jsx(material.TableBody,{children:o?jsxRuntime.jsx($i,{skeletonRows:a,visibleHeadCells:g,hideLastRowBorder:c}):jsxRuntime.jsx(Gi,{data:e,visibleHeadCells:g,onRowClick:s,hideLastRowBorder:c})})]}),!!(e!=null&&e.length)&&h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(AS,{}),jsxRuntime.jsx(FS,{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 LS=chunk5K62MKBQ_cjs_js.e(tb__default.default)`
|
|
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=
|
|
983
|
+
`;function ao(i){var s=i,{variant:e,label:t,className:o,size:r="small"}=s,n=chunk5K62MKBQ_cjs_js.c(s,["variant","label","className","size"]);return jsxRuntime.jsx(LS,chunk5K62MKBQ_cjs_js.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 jsClientSdk.CreditGrantType.Promotional:return "Promotional";case jsClientSdk.CreditGrantType.Paid:return "Top-up";case jsClientSdk.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}){let c=e.map(f=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},f),{status:Rp(f)})),u=[{id:"effectiveAt",label:r.receivedAt,width:"205px",render:({effectiveAt:f})=>jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",className:"stigg-credit-grants-effective-date",children:On(f)})},{id:"grantType",label:r.grantType,width:"205px",render:f=>jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",className:"stigg-credit-grants-grant-type",children:_p(f)})},{id:"status",label:r.status,width:"205px",render:({status:f})=>{let p=RS__default.default(f),h=Wi(f);return jsxRuntime.jsx(ao,{label:p,variant:h,className:"stigg-credit-grants-status-chip"})}},{id:"amount",label:r.balance,width:"205px",render:f=>jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",className:"stigg-credit-grants-balance",children:Up(f,n)})},{id:"expireAt",label:r.expiryDate,width:"205px",render:({expireAt:f})=>jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",className:"stigg-credit-grants-expiry-date",children:f?Wn(f):"-"})}];return jsxRuntime.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})}var Gp=(e,t,o)=>{let[r,n]=ii.useState(0),[i,s]=ii.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 _S=10,DS=chunk5K62MKBQ_cjs_js.e.div`
|
|
984
984
|
display: flex;
|
|
985
985
|
flex-direction: column;
|
|
986
986
|
gap: 8px;
|
|
987
|
-
`,$S=
|
|
987
|
+
`,$S=chunk5K62MKBQ_cjs_js.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=_S}){let n=
|
|
991
|
+
`;function zp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=_S}){let n=chunk5K62MKBQ_cjs_js.u({optional:true}),i=n==null?void 0:n.stigg,s=n==null?void 0:n.theme,l=chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},chunk5K62MKBQ_cjs_js.H),t),[a,c]=ii.useState({first:r}),{creditGrants:u,isLoading:f,error:p,paging:h,totalCount:g}=Ur({currencyId:e,pageSize:r,paging:a}),{pageNumber:y,pageChangeFunc:C}=Gp(h,c,r);return jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:s,children:jsxRuntime.jsxs(DS,{className:"stigg-credit-grants-container",children:[jsxRuntime.jsx($S,{className:"stigg-credit-grants-card",children:jsxRuntime.jsx(Dp,{creditGrants:u,isLoading:f,error:p,localization:l,decimalPlaces:o,pageSize:r,pageNum:y,totalCount:g,onPageChange:C})}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.q,{source:"grant_list",align:"end",smallScreenAlign:"end",style:{marginTop:0},showWatermark:i==null?void 0:i.getShowWatermark()})]})})}var Vp=chunk5K62MKBQ_cjs_js.e.div`
|
|
992
992
|
display: flex;
|
|
993
993
|
flex-direction: column;
|
|
994
994
|
gap: 16px;
|
|
@@ -997,16 +997,16 @@
|
|
|
997
997
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
998
998
|
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}};
|
|
999
999
|
min-height: 90px;
|
|
1000
|
-
`;var Hp=
|
|
1000
|
+
`;var Hp=chunk5K62MKBQ_cjs_js.e.div`
|
|
1001
1001
|
display: flex;
|
|
1002
1002
|
align-items: center;
|
|
1003
1003
|
gap: 4px;
|
|
1004
|
-
`;var Zi=
|
|
1004
|
+
`;var Zi=chunk5K62MKBQ_cjs_js.e.div`
|
|
1005
1005
|
display: flex;
|
|
1006
1006
|
flex-direction: column;
|
|
1007
1007
|
gap: 4px;
|
|
1008
1008
|
width: 100%;
|
|
1009
|
-
`;var Op=
|
|
1009
|
+
`;var Op=chunk5K62MKBQ_cjs_js.e.div`
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
1012
1012
|
justify-content: center;
|
|
@@ -1014,26 +1014,26 @@
|
|
|
1014
1014
|
min-height: 60px;
|
|
1015
1015
|
border: 1px dashed ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
1016
1016
|
border-radius: 8px;
|
|
1017
|
-
`;function Hr(e){let t=
|
|
1017
|
+
`;function Hr(e){let t=chunk5K62MKBQ_cjs_js.u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=ii.useCallback(()=>chunk5K62MKBQ_cjs_js.d(null,null,function*(){if(!o)throw new Error("Stigg SDK is not initialized. Please check your API configuration.");if(!o.isCustomerLoaded)return null;try{let a={customerId:e.customerId,currencyId:e.currencyId};return yield o.getAutomaticRechargeConfiguration(a)}catch(a){throw console.error("Error fetching automatic recharge configuration:",a),a}}),[o,e.customerId,e.currencyId,r]),{data:i,error:s,isLoading:l}=chunk5K62MKBQ_cjs_js.B({func:n});return {config:i,isLoading:l,error:s}}function Wp({customerId:e,currencyId:t}){let{config:o,isLoading:r,error:n}=Hr({customerId:e,currencyId:t}),i=ii.useMemo(()=>{if(!o)return {isConfigured:false,isEnabled:false,thresholdValue:0,targetBalance:0,currentMonthlySpend:0,maxSpendLimit:0,spendPercentage:0,showActiveState:false};let s=o.maxSpendLimit&&o.maxSpendLimit>0?Er(o.currentMonthlySpend||0,o.maxSpendLimit):0,l=true,a=l&&o.isEnabled;return {isConfigured:l,isEnabled:o.isEnabled,thresholdValue:o.thresholdValue||0,targetBalance:o.targetBalance||0,currentMonthlySpend:o.currentMonthlySpend||0,maxSpendLimit:o.maxSpendLimit||0,spendPercentage:s,showActiveState:a}},[o]);return chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},i),{isLoading:r,error:n})}var Zp=chunk5K62MKBQ_cjs_js.e(Vp)`
|
|
1018
1018
|
width: 406px;
|
|
1019
1019
|
box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.05);
|
|
1020
1020
|
box-sizing: border-box;
|
|
1021
|
-
`,Yp=
|
|
1021
|
+
`,Yp=chunk5K62MKBQ_cjs_js.e.div`
|
|
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,currentMonthlySpend:c,maxSpendLimit:u,spendPercentage:f,showActiveState:p,isLoading:h,error:g}=Wp({customerId:e,currencyId:t}),y=
|
|
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,currentMonthlySpend:c,maxSpendLimit:u,spendPercentage:f,showActiveState:p,isLoading:h,error:g}=Wp({customerId:e,currencyId:t}),y=chunk5K62MKBQ_cjs_js.a(chunk5K62MKBQ_cjs_js.a({},chunk5K62MKBQ_cjs_js.J),s&&Object.fromEntries(Object.entries(s).filter(([x,S])=>S!==void 0))),C=Qp(y.descriptionTemplate,{target:Dt(a),unit:o,threshold:Dt(l)}),b=Qp(y.spendTemplate,{currency:r,current:Dt(c),limit:Dt(u)});return g?jsxRuntime.jsx(Zp,{className:`stigg-auto-recharge-status stigg-auto-recharge-status-error ${i||""}`,children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",children:g.message||"Failed to load auto-recharge status"})}):jsxRuntime.jsxs(Zp,{className:`stigg-auto-recharge-status ${i||""}`,children:[jsxRuntime.jsxs(Lt,{children:[jsxRuntime.jsxs(Hp,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h6",color:"primary",className:"stigg-auto-recharge-title",children:y.title}),!h&&p&&jsxRuntime.jsx(ao,{variant:"success",label:y.activeLabel,className:"stigg-auto-recharge-status-chip",size:"small"})]}),h?jsxRuntime.jsx(Qe__default.default,{width:70,height:38,borderRadius:10}):jsxRuntime.jsx(Nt,{type:"button",onClick:n,className:"stigg-auto-recharge-manage-button","aria-label":`${y.manageButton} auto-recharge settings`,children:y.manageButton})]}),h?jsxRuntime.jsxs(Zi,{children:[jsxRuntime.jsx(Qe__default.default,{width:"100%",height:20}),jsxRuntime.jsx(Qe__default.default,{width:"100%",height:8,borderRadius:0}),jsxRuntime.jsx(Yp,{children:jsxRuntime.jsx(Qe__default.default,{width:200,height:16})})]}):p?jsxRuntime.jsxs(Zi,{children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",className:"stigg-auto-recharge-description",children:C}),jsxRuntime.jsx(Mr,{percentage:f,variant:"primary",className:"stigg-auto-recharge-progress"}),jsxRuntime.jsx(Yp,{children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-spend",children:u>0?b:y.unlimitedSpendLimit})})]}):jsxRuntime.jsx(Op,{className:"stigg-auto-recharge-empty",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-empty-text",children:y.emptyStateMessage})})]})}var HS=chunk5K62MKBQ_cjs_js.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=
|
|
1030
|
+
`;function qp(e){let t=fe(ee),o=chunk5K62MKBQ_cjs_js.u({optional:true}),r=o==null?void 0:o.theme,n=jsxRuntime.jsx(HS,{className:"stigg-auto-recharge-status-container",children:jsxRuntime.jsx(Kp,chunk5K62MKBQ_cjs_js.a({},e))});return t?n:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:r,children:n})}function Jp(e){return dg__default.default({},{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,x,S,T,F,B,I,k,L,E,A,Z,$;let[r,n]=ii.useState({enabled:(C=e==null?void 0:e.enabled)!=null?C:false,thresholdAmount:(x=(b=e==null?void 0:e.thresholdAmount)==null?void 0:b.toString())!=null?x:"",targetBalance:(T=(S=e==null?void 0:e.targetBalance)==null?void 0:S.toString())!=null?T:"",maxSpendLimit:(B=(F=e==null?void 0:e.maxSpendLimit)==null?void 0:F.toString())!=null?B:""}),[i,s]=ii.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,c]=ii.useState(l);return {formData:r,errors:a,touched:i,handleEnabledChange:_=>{let z=_.target.checked;if(n(q=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},q),{enabled:z})),!z)c({}),s({});else {let q=ot(chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},r),{enabled:true}),{poolSize:t},o);c(q),s({thresholdAmount:true,targetBalance:true,maxSpendLimit:true});}},handleFieldChange:_=>z=>{let q=z.target.value,Ge=chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},r),{[_]:q});n(Ge),s(V=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},V),{[_]:true}));let pt=ot(Ge,{poolSize:t},o);c(pt);},handleFieldBlur:_=>()=>{s(q=>chunk5K62MKBQ_cjs_js.b(chunk5K62MKBQ_cjs_js.a({},q),{[_]:true}));let z=ot(r,{poolSize:t},o);c(z);},getFieldError:_=>i[_]?a[_]: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=chunk5K62MKBQ_cjs_js.e.div`
|
|
1031
1031
|
display: flex;
|
|
1032
1032
|
flex-direction: column;
|
|
1033
1033
|
gap: 16px;
|
|
1034
1034
|
width: 100%;
|
|
1035
1035
|
max-width: 506px;
|
|
1036
|
-
`,co=
|
|
1036
|
+
`,co=chunk5K62MKBQ_cjs_js.e.div`
|
|
1037
1037
|
display: flex;
|
|
1038
1038
|
flex-direction: column;
|
|
1039
1039
|
gap: 8px;
|
|
@@ -1042,12 +1042,12 @@
|
|
|
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
|
-
`,Ki=
|
|
1045
|
+
`,Ki=chunk5K62MKBQ_cjs_js.e(reactFeather.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
|
-
`,qi=
|
|
1050
|
+
`,qi=chunk5K62MKBQ_cjs_js.e(Sx__default.default)`
|
|
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,onSave:c,onCancel:u}){var E,A,Z;let f=fe(ee),p=chunkSP6WPFZZ_cjs_js.u({optional:true}),h=p==null?void 0:p.theme,g=ii.useMemo(()=>Jp(a),[a]),{formData:y,errors:C,handleEnabledChange:b,handleFieldChange:x,handleFieldBlur:S,getFieldError:T,validate:F,getFormValues:B}=Wr({initialData:o,poolSize:n,localization:g}),I=ii.useMemo(()=>y.enabled?Object.keys(C).length>0:false,[C,y.enabled]),k=ii.useCallback(()=>{if(F()&&c){let $=B();c(chunkSP6WPFZZ_cjs_js.a({customerId:e,currencyId:t},$));}},[F,c,B,e,t]),L=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsxs(co,{className:"stigg-automatic-recharge-form-card",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:.5,children:[jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:g.title}),jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:g.enableLabel})]}),jsxRuntime.jsx(ke__default.default,{display:"flex",flexDirection:"column",gap:1,children:jsxRuntime.jsx(Ih__default.default,{control:jsxRuntime.jsx(Ah__default.default,{checked:y.enabled,onChange:b,disabled:l}),label:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"primary",children:g.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsxs(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.thresholdFieldPrefix})," ",g.thresholdFieldSuffix]}),jsxRuntime.jsx(Ve,{title:g.thresholdTooltip,children:jsxRuntime.jsx(Ki,{})})]}),jsxRuntime.jsx(reactNumberFormat.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?jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-threshold-input"})]}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-target-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsxs(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.targetFieldPrefix})," ",g.targetFieldSuffix]}),jsxRuntime.jsx(Ve,{title:g.targetBalanceTooltip,children:jsxRuntime.jsx(Ki,{})})]}),jsxRuntime.jsx(reactNumberFormat.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?jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-target-input"})]}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-spend-limit-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:.5,children:[jsxRuntime.jsxs(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.spendLimitFieldPrefix})," ",g.spendLimitFieldSuffix]}),jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"caption",color:"secondary",style:{fontSize:"12px"},children:g.spendLimitHelpText})]}),jsxRuntime.jsx(reactNumberFormat.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:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"secondary",children:"$"}),endAdornment:jsxRuntime.jsxs(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:["/ ",g.spendLimitPeriod]})},className:"stigg-automatic-recharge-form-spend-limit-input"})]}),!l&&y.enabled&&y.thresholdAmount&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i!==void 0&&i<=parseFloat(y.thresholdAmount)&&jsxRuntime.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)&&jsxRuntime.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&&jsxRuntime.jsxs(ke__default.default,{display:"flex",justifyContent:"flex-end",gap:1,pt:2,className:"stigg-automatic-recharge-form-actions",children:[u&&jsxRuntime.jsx(te,{variant:"outlined",onClick:u,className:"stigg-automatic-recharge-form-cancel-button",children:g.cancelButton}),c&&jsxRuntime.jsx(te,{variant:"contained",onClick:k,disabled:I,className:"stigg-automatic-recharge-form-save-button",children:g.saveButton})]})]})});return f?L:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:h,children:L})}function em(){let e=chunkSP6WPFZZ_cjs_js.u(),t=e==null?void 0:e.stigg,[o,r]=ii.useState(false),[n,i]=ii.useState(null);return {updateConfig:ii.useCallback(l=>chunkSP6WPFZZ_cjs_js.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:jsClientSdk.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=chunkSP6WPFZZ_cjs_js.u({optional:true}),u=c==null?void 0:c.theme,{config:f,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=ii.useCallback(E=>chunkSP6WPFZZ_cjs_js.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?{id:"",enabled:f.isEnabled,thresholdAmount:f.thresholdValue,targetBalance:f.targetBalance,maxSpendLimit:(k=f.maxSpendLimit)!=null?k:void 0,currencyId:f.currencyId,customerId:f.customerId}:void 0;if(p||y){let E=jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Qe__default.default,{width:300,height:24,style:{marginBottom:"16px"}}),jsxRuntime.jsx(Qe__default.default,{width:400,height:200})]});return a?E:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:u,children:E})}if(h){let E=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"error",children:h.message||"Failed to load automatic recharge configuration"})})});return a?E:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:u,children:E})}if(C){let E=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"error",children:C.message||"Failed to load credit balance"})})});return a?E:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:u,children:E})}let B=o||((L=g==null?void 0:g.units)==null?void 0:L.plural)||(g==null?void 0:g.displayName)||"Credits",I=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.f,{variant:"body1",color:"error",style:{marginBottom:"16px"},children:S.message||"Failed to save automatic recharge configuration"}),jsxRuntime.jsx(Zr,{customerId:e,currencyId:t,initialData:F,currencyUnit:B,poolSize:r,currentBalance:g==null?void 0:g.currentBalance,currentMonthlySpend:f==null?void 0:f.currentMonthlySpend,readOnly:n||x,localization:i,onSave:T,onCancel:l})]});return a?I:jsxRuntime.jsx(chunkSP6WPFZZ_cjs_js.w,{componentTheme:u,children:I})}Object.defineProperty(exports,"StiggContext",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.s}});Object.defineProperty(exports,"StiggProvider",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.t}});Object.defineProperty(exports,"useActiveSubscriptions",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.C}});Object.defineProperty(exports,"useBooleanEntitlement",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.x}});Object.defineProperty(exports,"useCreditUsage",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.K}});Object.defineProperty(exports,"useCustomerPortal",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.E}});Object.defineProperty(exports,"useEnumEntitlement",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.A}});Object.defineProperty(exports,"useMeteredEntitlement",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.z}});Object.defineProperty(exports,"useNumericEntitlement",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.y}});Object.defineProperty(exports,"usePaywall",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.D}});Object.defineProperty(exports,"useStiggContext",{enumerable:true,get:function(){return chunkSP6WPFZZ_cjs_js.u}});exports.AddonsList=vo;exports.AutoRechargeStatus=qp;exports.AutomaticRechargeConfig=rm;exports.AutomaticRechargeConfigForm=Zr;exports.BooleanEntitlementGuard=vb;exports.Checkout=xp;exports.CreditBalance=wp;exports.CreditGrants=zp;exports.CreditUsageChart=Ap;exports.CreditUtilization=vp;exports.CustomerPortal=Zl;exports.CustomerPortalProvider=Fo;exports.CustomerUsageData=nr;exports.EmptyState=Gr;exports.EnumEntitlementGuard=$b;exports.ErrorState=$r;exports.GenericTable=zr;exports.InvoicesSection=ir;exports.MeteredEntitlementGuard=Ub;exports.NumericEntitlementGuard=Nb;exports.PaymentDetailsSection=Jo;exports.Paywall=Ps;exports.Promotions=Lo;exports.ProvisionStatus=Ui;exports.StatusChip=ao;exports.SubscribeIntentionType=on;exports.SubscriptionsOverview=Zo;exports.formatDateOnly=Wn;exports.formatDateTime=On;exports.isCreditEntitlement=Wo;exports.isFeatureEntitlement=bt;exports.mapCreditGrantStatusToVariant=Wi;exports.useAutomaticRechargeForm=Wr;exports.useCreditBalance=et;exports.useCreditGrants=Ur;exports.useWaitForCheckoutCompleted=Sp;exports.validateAutomaticRechargeForm=ot;Object.keys(jsClientSdk).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return jsClientSdk[k]}})});
|
|
1053
|
+
`;function Zr({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:s,readOnly:l=false,localization:a,onSave:c,onCancel:u}){var E,A,Z;let f=fe(ee),p=chunk5K62MKBQ_cjs_js.u({optional:true}),h=p==null?void 0:p.theme,g=ii.useMemo(()=>Jp(a),[a]),{formData:y,errors:C,handleEnabledChange:b,handleFieldChange:x,handleFieldBlur:S,getFieldError:T,validate:F,getFormValues:B}=Wr({initialData:o,poolSize:n,localization:g}),I=ii.useMemo(()=>y.enabled?Object.keys(C).length>0:false,[C,y.enabled]),k=ii.useCallback(()=>{if(F()&&c){let $=B();c(chunk5K62MKBQ_cjs_js.a({customerId:e,currencyId:t},$));}},[F,c,B,e,t]),L=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsxs(co,{className:"stigg-automatic-recharge-form-card",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:.5,children:[jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:g.title}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:g.enableLabel})]}),jsxRuntime.jsx(ke__default.default,{display:"flex",flexDirection:"column",gap:1,children:jsxRuntime.jsx(Ih__default.default,{control:jsxRuntime.jsx(Ah__default.default,{checked:y.enabled,onChange:b,disabled:l}),label:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",children:g.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.thresholdFieldPrefix})," ",g.thresholdFieldSuffix]}),jsxRuntime.jsx(Ve,{title:g.thresholdTooltip,children:jsxRuntime.jsx(Ki,{})})]}),jsxRuntime.jsx(reactNumberFormat.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?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-threshold-input"})]}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-target-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",alignItems:"center",gap:1,children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.targetFieldPrefix})," ",g.targetFieldSuffix]}),jsxRuntime.jsx(Ve,{title:g.targetBalanceTooltip,children:jsxRuntime.jsx(Ki,{})})]}),jsxRuntime.jsx(reactNumberFormat.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?jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-target-input"})]}),jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-spend-limit-field",children:[jsxRuntime.jsxs(ke__default.default,{display:"flex",flexDirection:"column",gap:.5,children:[jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"primary",children:[jsxRuntime.jsx(ke__default.default,{component:"span",fontWeight:"bold",children:g.spendLimitFieldPrefix})," ",g.spendLimitFieldSuffix]}),jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"caption",color:"secondary",style:{fontSize:"12px"},children:g.spendLimitHelpText})]}),jsxRuntime.jsx(reactNumberFormat.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:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",children:"$"}),endAdornment:jsxRuntime.jsxs(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:["/ ",g.spendLimitPeriod]})},className:"stigg-automatic-recharge-form-spend-limit-input"})]}),!l&&y.enabled&&y.thresholdAmount&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[i!==void 0&&i<=parseFloat(y.thresholdAmount)&&jsxRuntime.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)&&jsxRuntime.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&&jsxRuntime.jsxs(ke__default.default,{display:"flex",justifyContent:"flex-end",gap:1,pt:2,className:"stigg-automatic-recharge-form-actions",children:[u&&jsxRuntime.jsx(te,{variant:"outlined",onClick:u,className:"stigg-automatic-recharge-form-cancel-button",children:g.cancelButton}),c&&jsxRuntime.jsx(te,{variant:"contained",onClick:k,disabled:I,className:"stigg-automatic-recharge-form-save-button",children:g.saveButton})]})]})});return f?L:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:h,children:L})}function em(){let e=chunk5K62MKBQ_cjs_js.u(),t=e==null?void 0:e.stigg,[o,r]=ii.useState(false),[n,i]=ii.useState(null);return {updateConfig:ii.useCallback(l=>chunk5K62MKBQ_cjs_js.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:jsClientSdk.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=chunk5K62MKBQ_cjs_js.u({optional:true}),u=c==null?void 0:c.theme,{config:f,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=ii.useCallback(E=>chunk5K62MKBQ_cjs_js.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?{id:"",enabled:f.isEnabled,thresholdAmount:f.thresholdValue,targetBalance:f.targetBalance,maxSpendLimit:(k=f.maxSpendLimit)!=null?k:void 0,currencyId:f.currencyId,customerId:f.customerId}:void 0;if(p||y){let E=jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx(Qe__default.default,{width:300,height:24,style:{marginBottom:"16px"}}),jsxRuntime.jsx(Qe__default.default,{width:400,height:200})]});return a?E:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:u,children:E})}if(h){let E=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",children:h.message||"Failed to load automatic recharge configuration"})})});return a?E:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:u,children:E})}if(C){let E=jsxRuntime.jsx(lo,{className:"stigg-automatic-recharge-form-container",children:jsxRuntime.jsx(co,{className:"stigg-automatic-recharge-form-card",children:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",children:C.message||"Failed to load credit balance"})})});return a?E:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:u,children:E})}let B=o||((L=g==null?void 0:g.units)==null?void 0:L.plural)||(g==null?void 0:g.displayName)||"Credits",I=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[S&&jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.f,{variant:"body1",color:"error",style:{marginBottom:"16px"},children:S.message||"Failed to save automatic recharge configuration"}),jsxRuntime.jsx(Zr,{customerId:e,currencyId:t,initialData:F,currencyUnit:B,poolSize:r,currentBalance:g==null?void 0:g.currentBalance,currentMonthlySpend:f==null?void 0:f.currentMonthlySpend,readOnly:n||x,localization:i,onSave:T,onCancel:l})]});return a?I:jsxRuntime.jsx(chunk5K62MKBQ_cjs_js.w,{componentTheme:u,children:I})}Object.defineProperty(exports,"StiggContext",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.s}});Object.defineProperty(exports,"StiggProvider",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.t}});Object.defineProperty(exports,"useActiveSubscriptions",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.C}});Object.defineProperty(exports,"useBooleanEntitlement",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.x}});Object.defineProperty(exports,"useCreditUsage",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.K}});Object.defineProperty(exports,"useCustomerPortal",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.E}});Object.defineProperty(exports,"useEnumEntitlement",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.A}});Object.defineProperty(exports,"useMeteredEntitlement",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.z}});Object.defineProperty(exports,"useNumericEntitlement",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.y}});Object.defineProperty(exports,"usePaywall",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.D}});Object.defineProperty(exports,"useStiggContext",{enumerable:true,get:function(){return chunk5K62MKBQ_cjs_js.u}});exports.AddonsList=vo;exports.AutoRechargeStatus=qp;exports.AutomaticRechargeConfig=rm;exports.AutomaticRechargeConfigForm=Zr;exports.BooleanEntitlementGuard=vb;exports.Checkout=xp;exports.CreditBalance=wp;exports.CreditGrants=zp;exports.CreditUsageChart=Ap;exports.CreditUtilization=vp;exports.CustomerPortal=Zl;exports.CustomerPortalProvider=Fo;exports.CustomerUsageData=nr;exports.EmptyState=Gr;exports.EnumEntitlementGuard=$b;exports.ErrorState=$r;exports.GenericTable=zr;exports.InvoicesSection=ir;exports.MeteredEntitlementGuard=Ub;exports.NumericEntitlementGuard=Nb;exports.PaymentDetailsSection=Jo;exports.Paywall=Ps;exports.Promotions=Lo;exports.ProvisionStatus=Ui;exports.StatusChip=ao;exports.SubscribeIntentionType=on;exports.SubscriptionsOverview=Zo;exports.formatDateOnly=Wn;exports.formatDateTime=On;exports.isCreditEntitlement=Wo;exports.isFeatureEntitlement=bt;exports.mapCreditGrantStatusToVariant=Wi;exports.useAutomaticRechargeForm=Wr;exports.useCreditBalance=et;exports.useCreditGrants=Ur;exports.useWaitForCheckoutCompleted=Sp;exports.validateAutomaticRechargeForm=ot;Object.keys(jsClientSdk).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return jsClientSdk[k]}})});
|