@stigg/react-sdk 8.1.0 → 8.2.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-WJZI2Q44.esm.js → CreditUsageChart-NM74VKGO.esm.js} +1 -1
- package/dist/{CreditUsageChart-S55GF7BO.cjs.js → CreditUsageChart-ZDCO3DT5.cjs.js} +19 -19
- package/dist/{chunk-3NBXYYSD.cjs.js → chunk-3GTG2TOT.cjs.js} +1 -1
- package/dist/{chunk-UL6DNWT4.esm.js → chunk-URUVS54M.esm.js} +1 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/stigg-sdk.cjs.js +180 -180
- package/dist/stigg-sdk.esm.js +175 -175
- package/package.json +2 -2
package/dist/stigg-sdk.esm.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,
|
|
1
|
+
import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,G,A,H as H$1,C,I,q,r,k,K,o,l,m,n}from'./chunk-URUVS54M.esm.js';export{s as StiggContext,t as StiggProvider,D as useActiveSubscriptions,x as useBooleanEntitlement,A as useCreditEntitlement,L as useCreditUsage,F as useCustomerPortal,B as useEnumEntitlement,z as useMeteredEntitlement,y as useNumericEntitlement,E as usePaywall,u as useStiggContext}from'./chunk-URUVS54M.esm.js';import {BillingModel,PaymentCollection,SubscriptionStatus,PricingType,BillingPeriod,SubscriptionScheduleType,ThresholdType,DiscountType,DiscountDurationType,Currency,BillingVendorIdentifier,CreditGrantType,WidgetType,BillingCadence,FontWeight,MeterType,EntitlementResetPeriod,TiersMode,Alignment,CreditCadence}from'@stigg/js-client-sdk';export*from'@stigg/js-client-sdk';import gi,{forwardRef,lazy,useContext,useMemo,useState,useEffect,Suspense,useCallback,useRef,createElement}from'react';import Du from'classnames';import Re from'@mui/material/Grid/index.js';import yc from'lodash/compact.js';import {NumericFormat,numericFormatter}from'react-number-format';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Oa from'lodash/isFunction.js';import Xm from'react-spinners/ClipLoader.js';import {css,useTheme}from'@emotion/react';import Bo from'dayjs';import Om from'dayjs/plugin/utc.js';import Hm from'dayjs/plugin/relativeTime.js';import Wm from'dayjs/plugin/advancedFormat.js';import Fo from'lodash/isNil.js';import qm from'lodash/sum.js';import cu from'currency-symbol-map';import Cu from'@mui/material/InputAdornment/index.js';import mu,{buttonClasses}from'@mui/material/Button/index.js';import fu from'@mui/material/TextField/index.js';import Fl from'@mui/material/Divider/index.js';import Pu from'@mui/material/OutlinedInput/index.js';import xu from'@mui/material/Select/index.js';import bu from'@mui/material/MenuItem/index.js';import Su from'lodash/map.js';import ke from'@mui/material/Box/index.js';import dg from'react-switch';import Tg from'lodash/countBy.js';import kg from'lodash/uniq.js';import nc from'lodash/sortBy.js';import Fg from'lodash/merge.js';import Je from'react-loading-skeleton';import Hg from'lodash/flatMap.js';import Zs from'@mui/material/Tab/index.js';import Wg from'lodash/isEmpty.js';import Jg from'@mui/material/Tabs/index.js';import tf from'@mui/material/useMediaQuery/index.js';import {ExternalLink,ChevronRight,Info,Minus,Plus,ArrowDown}from'react-feather';import Df from'@mui/material/Link/index.js';import Lf,{tooltipClasses}from'@mui/material/Tooltip/index.js';import Ul from'lodash/keyBy.js';import Ei from'color';import Of,{linearProgressClasses}from'@mui/material/LinearProgress/index.js';import ly from'lodash/padStart.js';import Wl from'lodash/isUndefined.js';import {BillingModel as BillingModel$1,BillingPeriod as BillingPeriod$1}from'@stigg/api-client-js/src/generated/sdk.js';import Jn from'lodash/lowerCase.js';import xy from'lodash/range.js';import {produce}from'immer';import Fy from'lodash/cloneDeep.js';import Ey from'lodash/remove.js';import {Elements,useStripe,useElements,AddressElement,PaymentElement}from'@stripe/react-stripe-js';import Ih from'@mui/material/StepIcon/index.js';import Ux from'lodash/partition.js';import Gh from'@mui/material/CircularProgress/index.js';import Gx from'@mui/material/Paper/index.js';import zx from'@mui/material/Alert/index.js';import Zh from'@mui/material/Checkbox/index.js';import Yh from'@mui/material/FormControlLabel/index.js';import Qh from'lodash/isString.js';import UP from'@mui/material/Autocomplete/index.js';import _P from'@mui/material/Collapse/index.js';import {AL,AD,AO,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BJ,BO,BA,BR,BG,BF,KH,CM,CA,CV,CL,CN,CO,CD,CR,HR,CY,CZ,DK,DO,EC,EG,SV,EE,ET,EU,FI,FR,GE,DE,GR,GN,HK,HU,IS,IN,ID,IE,IL,IT,JP,KZ,KE,KG,LA,LV,LI,LT,LU,MY,MT,MR,MX,MD,ME,MA,NP,NL,NZ,NG,MK,NO,OM,PE,PH,PL,PT,RO,RU,SA,SN,RS,SG,SK,SI,ZA,KR,ES,SR,SE,CH,TW,TJ,TZ,TH,TR,UG,UA,AE,GB,US,UY,UZ,VE,VN,ZM,ZW}from'country-flag-icons/react/3x2';import pd from'lodash/startCase.js';import md from'lodash/upperCase.js';import tx from'react-lottie';import vx from'@mui/material/IconButton/index.js';import {styled}from'@mui/material/styles/index.js';import mb from'@mui/material/Radio/index.js';import xb from'@mui/material/Chip/index.js';import qS from'lodash/capitalize.js';import {TableContainer,Table,Divider,TableCell,TableRow,TablePagination,TableBody,TableHead}from'@mui/material';import AS from'@mui/material/TableRow/index.js';function So(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 se(e,t="en-US"){if(e==null)return;let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:0,fixedDecimalScale:true};return numericFormatter(String(Math.round(e)),o)}function cn(e,t="en-US"){let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:2,fixedDecimalScale:true};return numericFormatter(String(e),o)}function Gt(e,t=1){if(e<1e6)return se(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 a=(e/r).toFixed(t);return a.includes(".")&&(a=a.replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")),`${a}${n}`}return se(e)||"0"}var bm=e(f)`
|
|
2
2
|
margin: 0;
|
|
3
|
-
`,
|
|
3
|
+
`,Sm=e.div`
|
|
4
4
|
display: flex;
|
|
5
5
|
align-items: center;
|
|
6
6
|
gap: 16px;
|
|
7
|
-
`,
|
|
7
|
+
`,Tm=e.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
flex-shrink: 0;
|
|
11
|
-
`,
|
|
11
|
+
`,km=e(i)`
|
|
12
12
|
width: 24px;
|
|
13
13
|
height: 24px;
|
|
14
14
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
15
|
-
`;function
|
|
15
|
+
`;function To({displayName:e,className:t}){return jsxs(Sm,{className:`stigg-entitlement-row-container ${t}`,children:[jsx(Tm,{children:jsx(km,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsx(bm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function Bm(e){if(!e)return "";switch(e){case EntitlementResetPeriod.Day:return "per day";case EntitlementResetPeriod.Hour:return "per hour";case EntitlementResetPeriod.Week:return "per week";case EntitlementResetPeriod.Month:return "per month";case EntitlementResetPeriod.Year:return "per year";default:return ""}}function Am({hasUnlimitedUsage:e,feature:t,resetPeriod:o,usageLimit:r,minUnitQuantity:n,maxUnitQuantity:i,isCustom:a,enumValues:l}){let s=n||i,c=`${o&&r?`${Bm(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(a)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 `${se(r)} ${u} ${c}`}return s?So(n,i,t==null?void 0:t.featureUnitsPlural):t==null?void 0:t.displayName}function pn(e){let i=e,{displayNameOverride:t,feature:o}=i,r=c(i,["displayNameOverride","feature"]),n=t||Am(a({feature:o},r))||"";return jsx(To,{displayName:n,className:`stigg-entitlement-${o==null?void 0:o.refId}`})}function Fm(e){switch(e){case BillingPeriod.Monthly:return "per month";case BillingPeriod.Annually:return "per year";default:return ""}}function Em(e){var s,c;let{amount:t,customCurrency:o,displayNameOverride:r,billingPeriod:n}=e,i=t!=null?t:0;if(r)return r;let a=i===1?(s=o.units)==null?void 0:s.singular:(c=o.units)==null?void 0:c.plural,l=Fm(n);return `${se(i)} ${a||o.displayName}${l?` ${l}`:""}`}function mn({entitlement:e}){let t=Em(e);return jsx(To,{displayName:t,className:`stigg-credit-entitlement-${e.id}`})}function Vt(e){return e.pricingModel===BillingModel.PerUnit&&!!e.topUpCustomCurrencyId}function Nm(e){return Vt(e)&&e.billingCadence===BillingCadence.OneOff}function Ot(e){return Vt(e)&&e.isTieredPrice}function ko(e,t){return e.pricePoints.find(o=>o.billingPeriod===t&&Ot(o))}function wo(e){var t,o;return ((o=(t=e.tiers)==null?void 0:t.length)!=null?o:0)>1}function Mm(e){return e.pricingModel===BillingModel.CreditBased}function Ct(e){return !Mm(e)&&!Nm(e)}function va(e){var t,o,r;return (t=e.customCurrency)!=null&&t.units?e.customCurrency.units.plural||e.customCurrency.units.singular||e.customCurrency.displayName:((o=e.feature)==null?void 0:o.unitsPlural)||((r=e.feature)==null?void 0:r.units)||""}function Dm(e){return e.__typename==="PackageCreditEntitlement"}function $m(e){switch(e){case CreditCadence.Month:return BillingPeriod.Monthly;case CreditCadence.Year:return BillingPeriod.Annually}}var Gm=e.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
gap: 16px;
|
|
19
|
-
`;function
|
|
19
|
+
`;function zm(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 Ra({plan:e,billingPeriod:t,paywallLocale:o,singleTierCreditCharge:r}){var c,u,y,p;let i=(((c=e.pricePoints)==null?void 0:c.filter(g=>g.billingPeriod===t))||[]).filter(g=>Ct(g)).filter(g=>(g==null?void 0:g.minUnitQuantity)&&(g==null?void 0:g.minUnitQuantity)>1||(g==null?void 0:g.maxUnitQuantity)).map(g=>{var f;return jsx(pn,{feature:g!=null&&g.feature?{refId:g.feature.featureId,featureUnits:g.feature.units,featureUnitsPlural:g.feature.unitsPlural,unitQuantity:g.feature.unitQuantity,displayName:g.feature.displayName}:null,minUnitQuantity:g==null?void 0:g.minUnitQuantity,maxUnitQuantity:g==null?void 0:g.maxUnitQuantity},`priceUnitEntitlement-${(f=g==null?void 0:g.feature)==null?void 0:f.displayName}`)}),a$1=yc(e.packageEntitlements).filter(g=>g.isGranted).filter(g=>{var f;return !((f=g.hiddenFromWidgets)!=null&&f.includes(WidgetType.Paywall))}),l=!!r,s=i.length>0||a$1.length>0||l;return jsxs(Gm,{className:"stigg-plan-entitlements-container",children:[jsx(f,{className:"stigg-plan-entitlements-title",color:"secondary",variant:"h6",bold:true,children:zm(e,o,s)}),i,r&&jsx(mn,{entitlement:{id:r.topUpCustomCurrencyId,amount:(p=(y=(u=r.tiers)==null?void 0:u[0])==null?void 0:y.upTo)!=null?p:0,customCurrency:r.customCurrency,billingPeriod:r.billingCadence===BillingCadence.Recurring?t:void 0}},`credit-charge-${r.topUpCustomCurrencyId}`),a$1.map(g=>Dm(g)?jsx(mn,{entitlement:b(a({},g),{billingPeriod:$m(g.cadence)})},Ma(g)):jsx(pn,{displayNameOverride:g.displayNameOverride,feature:g.feature,resetPeriod:g.resetPeriod,hasUnlimitedUsage:g.hasUnlimitedUsage,usageLimit:g.usageLimit,enumValues:g.enumValues,isCustom:g.isCustom},Ma(g)))]})}function Ma(e){return `${e.__typename}:${e.id}`}var un=(s=>(s.START_TRIAL="START_TRIAL",s.UPGRADE_TRIAL_TO_PAID="UPGRADE_TRIAL_TO_PAID",s.REQUEST_CUSTOM_PLAN_ACCESS="REQUEST_CUSTOM_PLAN_ACCESS",s.CHANGE_BILLING_PERIOD="CHANGE_BILLING_PERIOD",s.CHANGE_UNIT_QUANTITY="CHANGE_UNIT_QUANTITY",s.UPGRADE_PLAN="UPGRADE_PLAN",s.DOWNGRADE_PLAN="DOWNGRADE_PLAN",s.CANCEL_SCHEDULED_UPDATES="CANCEL_SCHEDULED_UPDATES",s))(un||{});Bo.extend(Om);Bo.extend(Hm);Bo.extend(Wm);var Z=Bo;var fn=e=>Z.utc(e).format("MMMM Do, YYYY");function Ao(e){return String(e.scheduledExecutionTime)}function Qm(e){return e!=null&&e.end?String(e.end):void 0}function Io({scheduledUpdate:e,subscriptionPrices:t,billingPeriodRange:o,options:r={}}){var a,l;if(!e)return {};let{withDate:n,postfix:i=""}=r;switch(e.subscriptionScheduleType){case SubscriptionScheduleType.Downgrade:{let s=n,c=Qm(o);return Fo(s)&&c&&(s=!Z(Ao(e)).isSame(Z(c),"day")),{line1:jsxs(Fragment,{children:["Your subscription will be downgraded to the ",jsxs("b",{children:[(a=e.targetPackage)==null?void 0:a.displayName," plan"]})," ",s?jsxs(Fragment,{children:["on ",fn(Ao(e))]}):i,"."]}),line2:"Until then you still have access to your current plan."}}case SubscriptionScheduleType.BillingPeriod:{let s=e.scheduleVariables;return {line1:jsxs(Fragment,{children:["Your billing cycle will change to ",jsx("b",{children:(l=s.billingPeriod)==null?void 0:l.toLocaleLowerCase()})," ",n?jsxs(Fragment,{children:["on ",fn(Ao(e))]}):i,"."]})}}case SubscriptionScheduleType.UnitAmount:{let s=e.scheduleVariables,u=yc(t==null?void 0:t.map(({feature:C})=>C)).find(({id:C})=>C===s.featureId),{featureUnits:y,featureUnitsPlural:p}=u||{},g=s.newUnitAmount===1?y:p,f=jsxs(Fragment,{children:["Your subscription will be updated to ",jsx("b",{children:s.newUnitAmount})," ",g," ",n?jsxs(Fragment,{children:["on ",fn(Ao(e))]}):i,"."]}),h=`Until then you still have access to your current ${y} count.`;return {line1:f,line2:h}}default:return {}}}function $a(e){return e.feature&&(e.feature.unitQuantity!==1?e.feature.unitsPlural:e.feature.units)||""}function Cn(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 Da(e,t,o){return t===BillingPeriod.Annually&&o?e/12:e}function hn(e,t,o,r){let n=0;if(e.unitPrice){let i=Da(e.unitPrice.amount,o,r);n+=i*t;}return e.flatPrice&&(n+=Da(e.flatPrice.amount,o,r)),n}function Pn(e,t,o,r){let n=t,i=0,a=0,l=[];for(;n>0&&a<e.length;){let c=e[a],{upTo:u}=c;if(Fo(u))l.push({unitQuantity:n,amount:hn(c,n,o,r)}),n=0;else {let y=u-i,p=Math.min(n,y);l.push({unitQuantity:p,amount:hn(c,p,o,r)}),n-=p,i=u;}a+=1;}let s=qm(l.map(({amount:c})=>c));return {breakdown:l,total:s}}function xt(e,t,o,r){if(!e.tiers)return 0;switch(e.tiersMode){case TiersMode.Volume:{let n=Cn(e.tiers,t);return hn(n,t,o,r)}case TiersMode.Graduated:return Pn(e.tiers,t,o,r).total;default:return 0}}function Wt(e){return e==null?void 0:e.some(({unitPrice:t,upTo:o})=>t&&!Fo(o))}function Ga(e){return e==null?void 0:e.every(({unitPrice:t,upTo:o})=>!t||Fo(o))}function za(e,t){return (e==null?void 0:e[0].upTo)&&t<=e[0].upTo}function Eo({plan:e,billingPeriod:t,currentSubscription:o,currentSubscriptionOverride:r,selectDefaultTierIndex:n}){let i=e.pricePoints.filter(a=>a.billingPeriod===t&&a.isTieredPrice&&!Ot(a));if(i.length===1){let[a]=i,{featureId:l}=a.feature,s=n?n({plan:e}):0,c=a.tiers[s],u=Wt(a.tiers)?1:c.upTo||1;if(o&&o.plan.id===e.id){let p=o.prices.find(g=>{var f;return g.pricingModel===BillingModel.PerUnit&&g.tiersMode&&((f=g.feature)==null?void 0:f.featureId)===l});p&&(u=p.feature.unitQuantity||1);}if((r==null?void 0:r.planId)===e.id){let p=r.billableFeatures.find(g=>g.featureId===l);p&&(u=p.quantity);}let y={};return y[l]=u,y}return {}}function Va({perUnitQuantityByFeature:e,plan:t,currentSubscription:o,currentSubscriptionOverride:r}){var u,y;if(!o)return 0;let n=o.prices.find(p=>p.pricingModel===BillingModel.PerUnit&&p.tiersMode),i=t.id===(r==null?void 0:r.planId);if(i&&(n=(u=t.pricePoints.find(p=>p.pricingModel===BillingModel.PerUnit&&p.tiersMode))!=null?u:n),!n)return 0;let{featureId:a,unitQuantity:l}=n.feature,s=l;if(i){let p=(y=r==null?void 0:r.billableFeatures)==null?void 0:y.find(g=>g.featureId===a);p&&(s=p.quantity);}if(Fo(s))return 0;let c=e[a];return c<s?-1:c>s?1:0}var tu=e(Xm)`
|
|
20
20
|
margin-left: 10px;
|
|
21
|
-
|
|
21
|
+
`,ou=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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
37
37
|
&:hover {
|
|
38
38
|
background-color: ${({theme:e,$disabled:t})=>t?e.stigg.palette.backgroundButton:e.stigg.palette.outlinedHoverBackground};
|
|
39
39
|
}
|
|
40
|
-
`,
|
|
40
|
+
`,ru=e(f)`
|
|
41
41
|
margin: 0;
|
|
42
42
|
font-size: 15px;
|
|
43
|
-
`,
|
|
43
|
+
`,nu=e(f)`
|
|
44
44
|
min-height: 87px;
|
|
45
|
-
`,
|
|
45
|
+
`,iu=e.button`
|
|
46
46
|
background: none;
|
|
47
47
|
border: none;
|
|
48
48
|
padding: 0;
|
|
@@ -50,17 +50,17 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
50
50
|
|
|
51
51
|
text-decoration: underline;
|
|
52
52
|
cursor: pointer;
|
|
53
|
-
`,
|
|
53
|
+
`,au=e(f)`
|
|
54
54
|
margin-top: 8px;
|
|
55
55
|
margin-bottom: 17px;
|
|
56
56
|
min-height: 20px;
|
|
57
|
-
`,
|
|
57
|
+
`,su=e.div`
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: column;
|
|
60
60
|
margin-top: 4px;
|
|
61
61
|
align-self: ${({theme:e})=>j(e.stigg.layout.ctaAlignment)};
|
|
62
62
|
width: 100%;
|
|
63
|
-
`;function
|
|
63
|
+
`;function Ha({isNextPlan:e,customer:t,plan:o,billingPeriod:r,isCustomerOnTrial:n,onPlanSelected:i,paywallLocale:a,withTrialLeftRow:l,currentSubscription:s,currentSubscriptionOverride:c,perUnitQuantityByFeature:u}){let y=useTheme(),[p,g]=useState(false),{currentPlan:f,custom:h,downgrade:C,startTrial:b,upgrade:x,startNew:A,switchToBillingPeriod:S,cancelScheduledUpdate:F}=a.planCTAButton,B=Oa(C)?C(o):C,k=Oa(x)?x(o):x,T={title:t?o.isLowerThanCurrentPlan?B:k:A,disabled:false,intentionType:o.isLowerThanCurrentPlan?"DOWNGRADE_PLAN":n?"UPGRADE_TRIAL_TO_PAID":"UPGRADE_PLAN"},I=o.pricingType===PricingType.Custom,{line1:E}=Io({scheduledUpdate:o.scheduledUpdate,options:{withDate:true}});if(o.isTriable&&!o.isCurrentCustomerPlan&&!n)T.title=b(o),T.intentionType="START_TRIAL";else if(o.isCurrentCustomerPlan&&!n)if(r===o.currentCustomerPlanBillingPeriod||o.pricingType&&[PricingType.Free,PricingType.Custom].includes(o.pricingType))switch(Va({perUnitQuantityByFeature:u,plan:o,currentSubscription:s,currentSubscriptionOverride:c})){case -1:T.intentionType="CHANGE_UNIT_QUANTITY",T.title=B;break;case 1:T.intentionType="CHANGE_UNIT_QUANTITY",T.title=k;break;default:T.title=f,T.disabled=true;break}else T.title=S(r),T.intentionType="CHANGE_BILLING_PERIOD";else I&&(T.title=typeof h=="function"?h({plan:o,selectedBillingPeriod:r}):h,T.intentionType="REQUEST_CUSTOM_PLAN_ACCESS");e&&o.scheduledUpdate&&(T.disabled=false,T.title=F,T.intentionType="CANCEL_SCHEDULED_UPDATES");let L=p||T.disabled;return jsx(Fragment,{children:jsx(su,{className:"stigg-paywall-plan-button-layout",children:e&&E?jsxs(nu,{color:"secondary",variant:"body1",className:"stigg-paywall-schedule-update-text",children:[E," ",jsx(iu,{color:"secondary",onClick:()=>{g(true),Promise.resolve(i(T.intentionType)).finally(()=>g(false));},children:T.title})]}):jsxs(Fragment,{children:[jsxs(ou,{className:"stigg-paywall-plan-button","data-testid":`paywall-card-cta-${o.displayName}`,disabled:L,$disabled:L,onClick:()=>{g(true),Promise.resolve(i(T.intentionType)).finally(()=>g(false));},children:[jsx(ru,{className:"stigg-paywall-plan-button-text",variant:"h6",color:"primary.main",children:T.title}),p&&jsx(tu,{color:y.stigg.palette.text.disabled,loading:true,size:16})]}),l?jsx(au,{className:"stigg-trial-days-left-text",variant:"h6",color:"secondary",children:o.isCurrentCustomerPlan&&o.trialDaysLeft&&jsxs(Fragment,{children:[jsxs("b",{children:[o.trialDaysLeft," days"]})," left on your free trial"]})}):jsx("div",{style:{height:"20px"}})]})})})}var H=({amount:e,currency:t=Currency.Usd,locale:o,maximumFractionDigits:r=5,minimumFractionDigits:n=0,removeTrailingZero:i})=>{let a$1=t.toString(),l=cu(a$1),s=new Intl.NumberFormat(o,a({maximumFractionDigits:r,minimumFractionDigits:n,style:"currency",currency:a$1,trailingZeroDisplay:i?"stripIfInteger":"auto"},l?{currencyDisplay:"code"}:{})).format(e||0);return l&&(s=s.replace(a$1,l)),s=s.replace(/\s/g,""),s};function du(e,t){var o,r;return e.blockSize&&e.blockSize>1?`for ${k(e.blockSize)} ${(r=(o=t.plural)!=null?o:t.units)!=null?r:""}`:`per ${t.units||""}`}function pu(e,t,o){return Vt(e)?o||1:(t==null?void 0:t[e.feature.featureId])||1}function Za({planPrices:e,paywallCalculatedPrice:t,selectedBillingPeriod:o,locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:i,perUnitQuantityByFeature:a,creditChargeQuantity:l}){var A,S,F,B,k,T;let s=e.filter(I=>Ct(I)),c=t||s[0];if(!c)return {price:"",unit:"",tiers:void 0,tierUnits:void 0};let{amount:u,currency:y}=c,p=u||0,g=s.length===1,f=o===BillingPeriod.Annually&&n?p/12:p,h,C,b=i.price.pricePeriod(n?BillingPeriod.Monthly:BillingPeriod.Annually),x=b;for(let I of s)if(I.isTieredPrice&&I.tiers){let E=pu(I,a,l);h=I.tiers,C=$a(I),f+=xt(I,E,o,n);}if(g&&s[0]){let I=s[0],E=Vt(I)?{units:(S=(A=I.customCurrency)==null?void 0:A.units)==null?void 0:S.singular,plural:(B=(F=I.customCurrency)==null?void 0:F.units)==null?void 0:B.plural}:{units:(k=I.feature)==null?void 0:k.units,plural:(T=I.feature)==null?void 0:T.unitsPlural},L=du(I,E);I.pricingModel===BillingModel.PerUnit&&!I.isTieredPrice?x=`${L} ${b}`:I.pricingModel===BillingModel.UsageBased&&(x=L);}return {price:H({amount:f,currency:y,locale:r,minimumFractionDigits:2,removeTrailingZero:true}),unit:x,tiers:h,tierUnits:C}}function vo(e,t,o,r,n,i,a$1){var l;switch(e.pricingType){case PricingType.Free:return typeof o.price.free=="function"?o.price.free(e.paywallCurrency):o.price.free;case PricingType.Custom:return {price:typeof o.price.custom=="function"?o.price.custom({plan:e,selectedBillingPeriod:t}):o.price.custom};case PricingType.Paid:{let s=e.pricePoints.filter(y=>y.billingPeriod===t),c=(l=e.paywallCalculatedPricePoints)==null?void 0:l.find(y=>y.billingPeriod===t);if(!(s!=null&&s.length)&&!c)return {price:o.price.priceNotSet};let u={planPrices:s,paywallCalculatedPrice:c,selectedBillingPeriod:t,perUnitQuantityByFeature:i||{},creditChargeQuantity:a$1};return o.price.paid?o.price.paid(b(a({},u),{plan:e})):Za(b(a({},u),{locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:o}))}default:return {price:""}}}var uu=e(mu,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
64
64
|
border-radius: 10px;
|
|
65
65
|
text-transform: none;
|
|
66
66
|
font-weight: 300;
|
|
@@ -71,10 +71,10 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
71
71
|
&:hover {
|
|
72
72
|
background-color: ${({theme:e,$success:t,$error:o})=>t?e.stigg.palette.successDark:o?e.stigg.palette.errorDark:""};
|
|
73
73
|
}
|
|
74
|
-
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(
|
|
74
|
+
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(uu,a({variant:e},t))};var pe=e(fu)(({theme:e})=>({"& .MuiOutlinedInput-root":{height:"42px",borderRadius:e.stigg.border.radius,fieldset:{borderColor:e.stigg.palette.outlinedBorder},"&:not(.Mui-focused):hover fieldset":{borderColor:e.stigg.palette.outlinedRestingBorder}},"& .MuiInputBase-input":a({padding:"8px 12px",borderRadius:e.stigg.border.radius,fontFamily:e.stigg.typography.fontFamily,color:e.stigg.palette.text.primary},e.stigg.typography.body),"& .Mui-error":{fontFamily:e.stigg.typography.fontFamily},"& .MuiFormHelperText-root":{whiteSpace:"nowrap"}}));var Ya=e(Re)`
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: column;
|
|
77
|
-
`;function
|
|
77
|
+
`;function Qa(){return jsxs(Ya,{container:true,children:[jsxs(l,{item:true,$gap:48,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsx(Fl,{className:"stigg-checkout-plan-header-divider",sx:{marginY:2}}),jsxs(Ya,{item:true,children:[jsx(o,{width:120,height:20}),jsxs(m,{$gap:16,marginTop:3,children:[jsx(o,{height:20}),jsx(o,{height:20})]}),jsxs(l,{$gap:130,marginTop:3,children:[jsx(n,{flex:1,children:jsx(o,{height:20})}),jsx(n,{flex:3,children:jsx(o,{height:20})})]})]})]})}var bt=e=>e.target.blur();function Ka({width:e,tierUnits:t,value:o,handleChange:r,errorMessage:n}){return jsx(pe,{type:"number",onWheel:bt,fullWidth:true,error:!!n,sx:{minHeight:"46px",width:e},InputProps:{endAdornment:jsx(Cu,{position:"end",children:jsx(f,{variant:"body1",color:"primary",children:t})})},value:o,onChange:i=>{var l,s;let a=(l=i==null?void 0:i.target)!=null&&l.value?Number((s=i==null?void 0:i.target)==null?void 0:s.value):null;a&&r(a);}})}var Tu=e(xu)`
|
|
78
78
|
border-radius: 10px;
|
|
79
79
|
min-height: 42px;
|
|
80
80
|
min-width: 120px;
|
|
@@ -82,7 +82,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
82
82
|
&:hover .MuiOutlinedInput-notchedOutline {
|
|
83
83
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
84
84
|
}
|
|
85
|
-
`,
|
|
85
|
+
`,ku=e(Pu)`
|
|
86
86
|
& .MuiInputBase-input {
|
|
87
87
|
padding: 10px 12px;
|
|
88
88
|
}
|
|
@@ -90,34 +90,34 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
90
90
|
&.Mui-focused .MuiOutlinedInput-notchedOutline {
|
|
91
91
|
border-color: ${({theme:e})=>e.stigg.palette.primary} !important;
|
|
92
92
|
}
|
|
93
|
-
`;function
|
|
93
|
+
`;function qa({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsx(Tu,{value:e.toString(),fullWidth:true,error:!!i,onChange:a=>{var s,c;let l=(s=a==null?void 0:a.target)!=null&&s.value?Number((c=a==null?void 0:a.target)==null?void 0:c.value):null;l&&n(l);},id:t,input:jsx(ku,{}),MenuProps:{MenuListProps:{disablePadding:true},PaperProps:{sx:{marginTop:"4px",borderRadius:"10px"}}},children:Su(r,a=>{var l;return jsx(bu,{className:"stigg-price-tier-menu-item-text",value:(l=a.upTo)==null?void 0:l.toString(),children:jsxs(f,{variant:"body1",color:"primary",style:{lineHeight:"unset"},children:[se(a.upTo)," ",o]})},a.upTo)})}):null}var Au=e(f)`
|
|
94
94
|
min-height: 46px;
|
|
95
|
-
`;function
|
|
95
|
+
`;function Kt(e){let{tiers:t,errorMessage:o}=e;return jsx(Fragment,{children:jsxs(ke,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsx(Au,{as:"div",className:"stigg-price-tier-select",children:Wt(t)?jsx(Ka,a({},e)):jsx(qa,a({},e))}),jsx(f,{style:{margin:"4px"},variant:"caption",color:"error",children:o})]})})}var Xa="\u200E",Eu=e(f)`
|
|
96
96
|
word-break: break-word;
|
|
97
97
|
width: 100%;
|
|
98
|
-
`,
|
|
98
|
+
`,vu=e(f)`
|
|
99
99
|
white-space: nowrap;
|
|
100
|
-
`,
|
|
100
|
+
`,Lu=e(f)`
|
|
101
101
|
white-space: normal;
|
|
102
102
|
min-height: 39px;
|
|
103
|
-
`;function
|
|
103
|
+
`;function Nu({plan:e,billingPeriod:t,hasMonthlyPrice:o,hasAnnuallyPrice:r,paywallLocale:n}){var l,s;let i=e.pricePoints.find(c=>c.billingPeriod===t),a=Xa;return i&&o&&r&&(a=((s=(l=n.price).billingPeriod)==null?void 0:s.call(l,t))||`, billed ${t.toLowerCase()}`),jsx(f,{as:"span",className:"stigg-price-billing-period-text",variant:"h6",color:"secondary",children:a})}var ja=({showStartingAt:e,withUnitPriceRow:t,withStartingAtRow:o,withTiersRow:r,withCreditChargeRow:n,creditChargePrice:i,selectedCreditQuantity:a$1,setSelectedCreditQuantity:l,plan:s,billingPeriod:c,paywallLocale:u,locale:y,hasMonthlyPrice:p,hasAnnuallyPrice:g,perUnitQuantityByFeature:f$1,setPerUnitQuantityByFeature:h})=>{var T;let{price:C,unit:b$1,tiers:x,tierUnits:A}=vo(s,c,u,y,p,f$1,a$1),S=s.pricePoints.find(I=>I.billingPeriod===c&&I.isTieredPrice&&!Ot(I)),F=S?S.feature.featureId:void 0,B=(T=f$1[F||""])!=null?T:1,k=I=>{F&&h(E=>b(a({},E),{[F]:I}));};return jsx(Eu,{as:"div",className:"stigg-price-text",children:jsxs(Fragment,{children:[o&&jsx(f,{style:{minHeight:"20px"},className:"stigg-starting-at-text",variant:"body1",color:"secondary",children:e?u.price.startingAtCaption:Xa}),jsx(Lu,{className:"stigg-price-point",variant:"h1",children:C}),t&&jsxs(f,{as:"div",className:"stigg-price-unit-and-billing-period-text",style:{minHeight:"48px"},children:[jsx(vu,{className:"stigg-price-unit-text",as:"span",variant:"h6",color:"secondary",children:b$1}),jsx(Nu,{plan:s,billingPeriod:c,hasAnnuallyPrice:g,hasMonthlyPrice:p,paywallLocale:u})]}),r?jsx(Kt,{componentId:`${s.id}_${F}_tier`,tiers:x,tierUnits:A,tiersMode:S==null?void 0:S.tiersMode,handleChange:k,value:B}):null,n?i?jsx(Kt,{componentId:`${s.id}_${i.topUpCustomCurrencyId}_credit_tier`,tiers:i.tiers,tierUnits:va(i),tiersMode:i.tiersMode,handleChange:l,value:a$1}):jsx("div",{style:{minHeight:"46px",opacity:0}}):null]})})};var $u=e(mu)`
|
|
104
104
|
padding: 0px;
|
|
105
105
|
text-transform: none;
|
|
106
106
|
margin-left: 0px;
|
|
107
|
-
`,
|
|
107
|
+
`,Gu=e(f)`
|
|
108
108
|
font-size: 14px;
|
|
109
109
|
font-weight: 500;
|
|
110
|
-
`,
|
|
110
|
+
`,zu=e.div`
|
|
111
111
|
width: 100%;
|
|
112
112
|
gap: 10px;
|
|
113
|
-
`,
|
|
113
|
+
`,Vu=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
|
-
`,
|
|
120
|
+
`,Ou=e.div`
|
|
121
121
|
display: flex;
|
|
122
122
|
flex-direction: row;
|
|
123
123
|
flex-wrap: nowrap;
|
|
@@ -126,7 +126,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
126
126
|
padding: 8px 0px;
|
|
127
127
|
max-height: 44px;
|
|
128
128
|
gap: 16px;
|
|
129
|
-
`,
|
|
129
|
+
`,Hu=e(f)`
|
|
130
130
|
overflow: hidden;
|
|
131
131
|
font-feature-settings: 'liga' off, 'clig' off;
|
|
132
132
|
text-overflow: ellipsis;
|
|
@@ -135,17 +135,17 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
135
135
|
white-space: nowrap;
|
|
136
136
|
min-width: 0;
|
|
137
137
|
flex-shrink: 1;
|
|
138
|
-
`,
|
|
138
|
+
`,Wu=e(i)`
|
|
139
139
|
width: 24px;
|
|
140
140
|
height: 24px;
|
|
141
141
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
142
|
-
`,
|
|
142
|
+
`,Zu=e.div`
|
|
143
143
|
flex: 1;
|
|
144
144
|
min-width: 0;
|
|
145
|
-
`,
|
|
145
|
+
`,Yu=e.div`
|
|
146
146
|
margin-top: 16px;
|
|
147
147
|
display: flex;
|
|
148
|
-
`,
|
|
148
|
+
`,Bn=4;function An({addons:e,paywallLocale:t}){let[o,r]=useState(false);if(!e||e.length===0)return null;let n=e.filter(l=>{var s;return !((s=l.hiddenFromWidgets)!=null&&s.includes(WidgetType.Paywall))}),i=()=>{r(!o);},a=o?n:n.slice(0,Bn);return a.length===0?null:jsxs(zu,{className:"stigg-compatible-addons-container",children:[jsx(f,{className:"stigg-compatible-addons-header",color:"secondary",variant:"body1",bold:true,children:t.addonsTitle}),jsx(Vu,{className:"stigg-compatible-addons-list",children:a.map(l=>jsxs(Ou,{className:Du(`stigg-compatible-addon--${l.id}`,"stigg-compatible-addon-item"),children:[jsx(Wu,{icon:"Add",className:"stigg-compatible-addon-icon"}),jsx(Zu,{className:"stigg-compatible-addon-content",children:jsx(Hu,{variant:"body1",color:"primary",className:"stigg-compatible-addon-name",children:l.displayName})})]},l.id))}),n.length>Bn&&jsx(Yu,{children:jsx($u,{variant:"text",onClick:i,children:jsx(Gu,{color:"primary.main",children:o?"Show less":`Show ${n.length-Bn} more`})})})]})}var Xu="66px",ju=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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
158
158
|
align-items: flex-start;
|
|
159
159
|
justify-content: flex-start;
|
|
160
160
|
position: relative;
|
|
161
|
-
`,
|
|
161
|
+
`,eg=e.div`
|
|
162
162
|
margin-top: ${({$planHasEntitlements:e})=>e?"32px":"0px"};
|
|
163
|
-
`,
|
|
163
|
+
`,tg=e(f)`
|
|
164
164
|
padding-bottom: 8px;
|
|
165
|
-
`,
|
|
165
|
+
`,og=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
|
-
`,
|
|
170
|
+
`,rg=e(f)`
|
|
171
171
|
text-align: ${({theme:e})=>e.stigg.layout.descriptionAlignment};
|
|
172
172
|
min-height: ${({theme:e})=>e.stigg.layout.descriptionMinHeight};
|
|
173
|
-
|
|
173
|
+
`,ng=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
|
-
`,
|
|
178
|
+
`,ig=e(f)`
|
|
179
179
|
margin: 0;
|
|
180
180
|
padding: 2px 8px;
|
|
181
|
-
`,
|
|
181
|
+
`,ag=e.div`
|
|
182
182
|
width: 100%;
|
|
183
183
|
display: flex;
|
|
184
184
|
flex-direction: column;
|
|
185
185
|
align-items: ${({theme:e})=>j(e.stigg.layout.headerAlignment)};
|
|
186
|
-
`,
|
|
186
|
+
`,sg=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
|
-
`,
|
|
192
|
+
`,lg=e(g)`
|
|
193
193
|
display: flex;
|
|
194
194
|
height: 100%;
|
|
195
195
|
margin-right: 4px;
|
|
@@ -197,7 +197,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
197
197
|
path {
|
|
198
198
|
fill: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
199
199
|
}
|
|
200
|
-
`;function
|
|
200
|
+
`;function cg({text:e="Next",iconsColor:t}){return jsx(sg,{children:jsxs(Re,{display:"flex",alignItems:"center",gap:1,children:[jsx(lg,{$iconsColor:t}),jsx(f,{color:"primary",variant:"body1",children:e})]})})}function os({withUnitPriceRow:e,withTiersRow:t,withTrialLeftRow:o,withCreditChargeRow:r,customer:n,plan:i,billingPeriod:a,isHighlighted:l,currentSubscription:s,currentSubscriptionOverride:c,shouldShowDescriptionSection:u,hasMonthlyPrice:y,hasAnnuallyPrice:p,isCustomerOnTrial:g,onPlanSelected:f,paywallLocale:h,locale:C,withStartingAtRow:b,isCustomerInCustomPlan:x,selectDefaultTierIndex:A,hideCompatibleAddons:S}){var ut,V,ie;let F=i.isNextPlan&&i.isNextPlan(a),B=i.pricePoints.filter(ae=>ae.billingPeriod===a&&Ct(ae)),k=(ut=i.paywallCalculatedPricePoints)==null?void 0:ut.find(ae=>ae.billingPeriod===a),T=B.length>1&&!!(k!=null&&k.additionalChargesMayApply),I=!x||i.pricingType===PricingType.Custom,E=ko(i,a),L=E?wo(E):false,M=null;F?M=jsx(cg,{text:"Next plan"}):l&&h.highlightChip&&(M=jsx(ng,{className:"stigg-highlight-badge",children:jsx(ig,{className:"stigg-highlight-badge-text",color:"white",bold:true,children:h.highlightChip})}));let[$,R]=useState(Eo({plan:i,billingPeriod:a,currentSubscription:s,currentSubscriptionOverride:c,selectDefaultTierIndex:A})),[z,K]=useState(()=>{var ae,Ee;return ((Ee=(ae=E==null?void 0:E.tiers)==null?void 0:ae[0])==null?void 0:Ee.upTo)||1});useEffect(()=>{var ae,Ee;K(((Ee=(ae=E==null?void 0:E.tiers)==null?void 0:ae[0])==null?void 0:Ee.upTo)||1);},[a,E==null?void 0:E.tiers]);let Ve=ae=>{let Ee=Object.keys($).map(gt=>({featureId:gt,quantity:$[gt]})),ho=E!=null&&E.topUpCustomCurrencyId?[{topUpCustomCurrencyId:E.topUpCustomCurrencyId,quantity:z}]:void 0;return f(ae,Ee,ho)};return jsxs(ju,{className:Du(`stigg-${i.id}`,"stigg-plan-offering-container",{"stigg-current-plan":i.isCurrentCustomerPlan}),$isHighlighted:l,$isCurrentPlan:i.isCurrentCustomerPlan,children:[M,jsxs(ag,{className:"stigg-header-wrapper",children:[jsx(tg,{className:"stigg-plan-header",variant:"h3",children:i.displayName}),u&&jsx(rg,{className:"stigg-plan-description",variant:"h6",color:"secondary",children:i.description}),jsx(ja,{showStartingAt:T,withUnitPriceRow:e,withStartingAtRow:b,withTiersRow:t,withCreditChargeRow:r,creditChargePrice:L?E:void 0,selectedCreditQuantity:z,setSelectedCreditQuantity:K,plan:i,billingPeriod:a,paywallLocale:h,locale:C,hasAnnuallyPrice:p,hasMonthlyPrice:y,setPerUnitQuantityByFeature:R,perUnitQuantityByFeature:$}),I?jsx(Ha,{isNextPlan:F,customer:n,plan:i,currentSubscription:s,currentSubscriptionOverride:c,billingPeriod:a,isCustomerOnTrial:g,onPlanSelected:Ve,paywallLocale:h,withTrialLeftRow:o,perUnitQuantityByFeature:$}):jsx("div",{style:{height:Xu}}),jsx(og,{className:"stigg-plan-header-divider"})]}),jsx(Ra,{plan:i,billingPeriod:a,paywallLocale:h,singleTierCreditCharge:L?void 0:E}),jsx(eg,{$planHasEntitlements:((ie=(V=i.packageEntitlements)==null?void 0:V.length)!=null?ie:0)>0,className:"stigg-addons-container",children:!S&&i.compatibleAddons&&i.compatibleAddons.length>0&&jsx(An,{addons:i.compatibleAddons,paywallLocale:h})})]})}var pg=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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
207
207
|
display: flex;
|
|
208
208
|
align-items: center;
|
|
209
209
|
justify-content: center;
|
|
210
|
-
`,
|
|
210
|
+
`,rs=e(f)`
|
|
211
211
|
margin: 0 8px;
|
|
212
|
-
`,
|
|
212
|
+
`,mg=e(dg)`
|
|
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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
220
220
|
background: ${({theme:e})=>e.stigg.palette.switchHandle} !important;
|
|
221
221
|
top: 0.5px !important;
|
|
222
222
|
}
|
|
223
|
-
`;function
|
|
223
|
+
`;function ug({discount:e,disabled:t}){return jsxs(f,{variant:"h6",color:t?"disabled":"primary",className:"stigg-discount-rate-text",children:[e,"% off"]})}function ns({discountRate:e,selectedBillingPeriod:t,onBillingPeriodChanged:o,availableBillingPeriods:r}){if(r.length<=1)return null;let n=t===BillingPeriod.Monthly;return jsxs(pg,{className:"stigg-period-picker-container",children:[jsx(rs,{variant:"h6",className:"stigg-monthly-period-text",color:n?"primary":"disabled",children:"Monthly"}),jsx(mg,{className:"stigg-period-switch",uncheckedIcon:false,checkedIcon:false,height:16,width:33,onChange:i=>o(i?BillingPeriod.Annually:BillingPeriod.Monthly),checked:!n,borderRadius:10,handleDiameter:19}),jsx(rs,{variant:"h6",className:"stigg-annual-period-text",color:n?"disabled":"primary",children:"Annual"}),e!==0&&jsx(ug,{discount:e,disabled:n})]})}function gg(e,t){if(!Fo(e)&&!Fo(t)){let o=t/12;return Math.round((e-o)/e*100)}return null}function ls(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 xt(n,1)}return o==null?void 0:o.amount}function cs(e){return e.reduce((t,o)=>{let r=ls(o,BillingPeriod.Monthly),n=ls(o,BillingPeriod.Annually),i=gg(r,n);return i&&(t=Math.max(t,i)),t},0)}function En(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function vn(e,t){return e.some(o=>En(o,t))}function ds(e,t,o){return e.filter(r=>r.pricingType!==PricingType.Paid||En(r,t)).filter(r=>!o||!o({plan:r}))}var Cg=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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
228
228
|
flex-wrap: wrap;
|
|
229
229
|
padding: 10px 0;
|
|
230
230
|
gap: ${({theme:e})=>e.stigg.layout.planMargin};
|
|
231
|
-
`,
|
|
231
|
+
`,Pg=e.div`
|
|
232
232
|
display: flex;
|
|
233
233
|
flex-direction: column;
|
|
234
234
|
align-items: center;
|
|
@@ -236,17 +236,17 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
236
236
|
& * {
|
|
237
237
|
box-sizing: border-box;
|
|
238
238
|
}
|
|
239
|
-
`,
|
|
239
|
+
`,xg=e.div`
|
|
240
240
|
display: flex;
|
|
241
241
|
flex-direction: column;
|
|
242
242
|
align-items: center;
|
|
243
|
-
`,
|
|
243
|
+
`,ms=({plans:e,customer:t,currentSubscription:o,highlightedPlanId:r,selectedBillingPeriod:n,onBillingPeriodChanged:i,availableBillingPeriods:a,isCustomerOnTrial:l,onPlanSelected:s,paywallLocale:c,locale:u,shouldHidePlan:y,selectDefaultTierIndex:p,currentSubscriptionOverride:g,hideCompatibleAddons:f,showWatermark:h})=>{let C=cs(e),b=e.some(M=>!!M.description),x=vn(e,BillingPeriod.Monthly),A=vn(e,BillingPeriod.Annually),S=ds(e,n,y),F=useCallback((M,$,R,z)=>s({plan:M,customer:t,subscription:o,intentionType:$,selectedBillingPeriod:n,billableFeatures:R,billableCredits:z}),[t,n,o,s]),B=!!o&&o.plan.pricingType===PricingType.Custom,k=useMemo(()=>S.some(M=>{var z;let $=M.pricePoints.filter(K=>K.billingPeriod===n),R=(z=M.paywallCalculatedPricePoints)==null?void 0:z.find(K=>K.billingPeriod===n);return $.length>1&&!!(R!=null&&R.additionalChargesMayApply)}),[n,S]),T=useMemo(()=>S.some(M=>!!vo(M,n,c,u,x).unit),[n,x,u,c,S]),I=useMemo(()=>!B&&S.some(M=>{let $=Eo({plan:M,billingPeriod:n,currentSubscription:o,currentSubscriptionOverride:g});return Object.values($).length>0}),[n,o,g,B,S]),E=S.some(M=>M.isCurrentCustomerPlan&&M.trialDaysLeft),L=useMemo(()=>S.some(M=>{let $=ko(M,n);return !!$&&wo($)}),[n,S]);return jsx(Pg,{className:"stigg-paywall-container",children:jsxs(xg,{className:"stigg-paywall-layout",children:[jsx(ns,{onBillingPeriodChanged:i,selectedBillingPeriod:n,availableBillingPeriods:a,discountRate:C}),jsx(Cg,{className:"stigg-paywall-plans-layout",children:S.map(M=>jsx(os,{withUnitPriceRow:T,withTiersRow:I,withTrialLeftRow:E,withCreditChargeRow:L,shouldShowDescriptionSection:b,hasMonthlyPrice:x,hasAnnuallyPrice:A,plan:M,withStartingAtRow:k,currentSubscription:o,currentSubscriptionOverride:g,billingPeriod:n,isHighlighted:M.id===r,isCustomerOnTrial:l,onPlanSelected:($,R,z)=>F(M,$,R,z),paywallLocale:c,locale:u,customer:t,isCustomerInCustomPlan:B,selectDefaultTierIndex:p,hideCompatibleAddons:f},M.id))}),jsx(q,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:h})]})})};function us(e,t,o){let r=e.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),n=Tg(r),i=kg(r),a;if(o&&i.includes(o))a=o;else if(t){let l=t.find(s=>s.status===SubscriptionStatus.Active);l&&l.prices.length>0&&(a=l==null?void 0:l.prices[0].billingPeriod);}return a||(a=(n[BillingPeriod.Monthly]||0)>(n[BillingPeriod.Annually]||0)?BillingPeriod.Monthly:BillingPeriod.Annually),{defaultBillingPeriod:a,availableBillingPeriods:i}}function gs(e){return Z.utc(e).diff(Z.utc(),"days",false)+1}var Ro={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 qe(e,t="px"){if(e)return `${e}${t}`}function Uo(e){if(!e)return "normal";switch(e){case FontWeight.Normal:return "normal";case FontWeight.Bold:return "bold";default:return "normal"}}function Jt(e,t){var r,n,i,a,l,s,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:qe((r=e==null?void 0:e.h1)==null?void 0:r.fontSize)||o.h1.fontSize,fontWeight:Uo((n=e==null?void 0:e.h1)==null?void 0:n.fontWeight)||o.h1.fontWeight,semanticElement:o.h1.semanticElement},h2:{fontSize:qe((i=e==null?void 0:e.h2)==null?void 0:i.fontSize)||o.h2.fontSize,fontWeight:Uo((a=e==null?void 0:e.h2)==null?void 0:a.fontWeight)||o.h2.fontWeight,semanticElement:o.h2.semanticElement},h3:{fontSize:qe((l=e==null?void 0:e.h3)==null?void 0:l.fontSize)||o.h3.fontSize,fontWeight:Uo((s=e==null?void 0:e.h3)==null?void 0:s.fontWeight)||o.h3.fontWeight,semanticElement:o.h3.semanticElement},body:{fontSize:qe((c=e==null?void 0:e.body)==null?void 0:c.fontSize)||o.body.fontSize,fontWeight:Uo((u=e==null?void 0:e.body)==null?void 0:u.fontWeight)||o.body.fontWeight,semanticElement:o.body.semanticElement}}}function Nn(e){if(e)switch(e){case Alignment.Left:return "left";case Alignment.Center:return "center";case Alignment.Right:return "right";default:return}}function ys(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:Jt(r),customCss:o||void 0}}function hs(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:Jt(n),layout:{ctaAlignment:Nn(o==null?void 0:o.alignment),headerAlignment:Nn(o==null?void 0:o.alignment),descriptionAlignment:Nn(o==null?void 0:o.alignment),planMaxWidth:qe(o==null?void 0:o.planWidth),planMinWidth:qe(o==null?void 0:o.planWidth),planMargin:qe(o==null?void 0:o.planMargin),planPadding:qe(o==null?void 0:o.planPadding)}}}function Cs(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:Jt(o,Ro),customCss:r||void 0}}function Bg(e){let t=true,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.InTrial))||null,r=o==null?void 0:o.plan,n=o!=null&&o.trialEndDate?gs(o.trialEndDate):void 0;return r||(t=false,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.Active))||null,r=o==null?void 0:o.plan),{currentSubscription:o,currentPlan:r,isCustomerOnTrial:t,trialDaysLeft:n}}function Ss(e,t,o){var S,F;let{plans:r,currency:n,configuration:i,customer:a$1,activeSubscriptions:l,paywallCalculatedPricePoints:s}=e||{},{currentSubscription:c,currentPlan:u,isCustomerOnTrial:y,trialDaysLeft:p}=Bg(l),g=o==null?void 0:o({currentSubscription:c}),f=(c==null?void 0:c.scheduledUpdates)||[],h=(S=c==null?void 0:c.price)==null?void 0:S.billingPeriod,C=f.find(({subscriptionScheduleType:B})=>B===SubscriptionScheduleType.Downgrade),b$1=f.find(({subscriptionScheduleType:B})=>B===SubscriptionScheduleType.BillingPeriod),x=nc(r,B=>B.order).map(B=>{var E;let k=(E=a$1==null?void 0:a$1.eligibleForTrial)==null?void 0:E.find(L=>L.productId===B.product.id),T=g!=null&&g.planId?(g==null?void 0:g.planId)===B.id:B.id===(u==null?void 0:u.id),I=L=>{var z;let M=C==null?void 0:C.scheduleVariables,$=b$1==null?void 0:b$1.scheduleVariables,R=B.pricePoints.some(K=>K.billingPeriod===L);return C?((z=C.targetPackage)==null?void 0:z.refId)===B.id&&(!R||M.billingPeriod===L):b$1&&T?$.billingPeriod===L:false};return b(a({},B),{paywallCalculatedPricePoints:s==null?void 0:s.filter(L=>L.planId===B.id),isTriable:!Fo(B.defaultTrialConfig)&&(!k||k.eligible),isCurrentCustomerPlan:T,currentCustomerPlanBillingPeriod:h,isUpcomingPlan:false,trialDaysLeft:p,isNextPlan:I,paywallCurrency:n,scheduledUpdate:C||b$1})});if(r&&u){let B=u&&((F=r==null?void 0:r.find(k=>k.id===(u==null?void 0:u.id)))==null?void 0:F.order);Fo(B)||(x=x.map(k=>b(a({},k),{isLowerThanCurrentPlan:B>k.order})),t&&(x=x.filter(k=>k.order>=B)));}let A=i?hs(i):void 0;return {currentPlan:u,currentSubscription:c,currentSubscriptionOverride:g,isCustomerOnTrial:y,plans:x,paywallConfiguration:A}}function Ts({productId:e,resourceId:t,showOnlyEligiblePlans:o,billingCountryCode:r$1,preferredBillingPeriod:n,currentSubscriptionOverrideFn:i}){let{stigg:a$1,locale:l}=u(),[s,c]=useState(BillingPeriod.Annually),[u$1,y]=useState([]),[p,g]=useState(null),[f,h]=useState(true);useEffect(()=>{d(null,null,function*(){try{h(!0),yield a$1.waitForInitialization();let x=yield a$1.getPaywall({productId:e,resourceId:t,billingCountryCode:r$1}),{availableBillingPeriods:A,defaultBillingPeriod:S}=us(x.plans,x.activeSubscriptions,n);g(x),y(A),c(S);}catch(x){r.error(`Failed to load paywall ${x==null?void 0:x.message}`,x);}finally{h(false);}});},[a$1,e,a$1.isCustomerLoaded,r$1,t,n]);let C=Ss(p,o,i);return a({customer:(p==null?void 0:p.customer)||null,isLoading:f,selectedBillingPeriod:s,setSelectedBillingPeriod:c,availableBillingPeriods:u$1,locale:l,configuration:C.paywallConfiguration,showWatermark:a$1.getShowWatermark()},C)}function ws(e){return Fg({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:o=>{var r;return `Start ${(r=o.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:o=>o===BillingPeriod.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:o=>o===BillingPeriod.Monthly?"/ month":"/ year",free:o=>({price:`${o==null?void 0:o.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},e)}var Eg=e=>jsx("svg",b(a({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),As=Eg;var vg=e.div`
|
|
244
244
|
display: flex;
|
|
245
245
|
flex-direction: column;
|
|
246
246
|
align-items: center;
|
|
247
|
-
`,
|
|
247
|
+
`,Mn=e(As)`
|
|
248
248
|
margin-right: 16px;
|
|
249
|
-
`,
|
|
249
|
+
`,Lg=e.div`
|
|
250
250
|
display: flex;
|
|
251
251
|
flex-direction: column;
|
|
252
252
|
align-items: flex-start;
|
|
@@ -258,25 +258,25 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
-
`,
|
|
261
|
+
`,Ng=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
|
-
`,
|
|
266
|
+
`,Rn=e.div`
|
|
267
267
|
display: flex;
|
|
268
268
|
align-items: center;
|
|
269
269
|
margin-bottom: 12px;
|
|
270
|
-
`,
|
|
270
|
+
`,Mg=e.div`
|
|
271
271
|
margin-top: auto;
|
|
272
|
-
`,
|
|
272
|
+
`,Rg=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
|
|
279
|
+
`;function Ug(){return jsxs(Lg,{children:[jsx(Je,{width:120,borderRadius:4}),jsx(Je,{circle:true,width:40,height:40}),jsx(Je,{style:{marginBottom:33},width:120,borderRadius:4}),jsxs(Rn,{children:[jsx(Mn,{}),jsx(Je,{width:120,borderRadius:4})]}),jsxs(Rn,{children:[jsx(Mn,{}),jsx(Je,{width:120,borderRadius:4})]}),jsxs(Rn,{children:[jsx(Mn,{}),jsx(Je,{width:120,borderRadius:4})]}),jsx(Mg,{children:jsx(Je,{height:50,borderRadius:4})})]})}function Is({skeletonPlanCount:e=3}){return jsxs(vg,{className:"stigg-skeleton-loader-container",children:[jsx(Rg,{className:"stigg-skeleton-loader-billing-period",children:jsx(Je,{borderRadius:4})}),jsx(Ng,{className:"stigg-skeleton-loader-plans-container",children:Array.from({length:e}).map((t,o)=>jsx(Ug,{},o))})]})}var ee=gi.createContext(null);ee.displayName="CustomerPortalContext";var Y=()=>{let e=useContext(ee);if(!e)throw new Error("Could not find Customer portal context; You need to wrap your customer portal components in an <CustomerPortalProvider> component.");return e};function he(e){return !!useContext(e)}var Es=({productId:e,resourceId:t,highlightedPlanId:o,showOnlyEligiblePlans:r,textOverrides:n,onPlanSelected:i,preferredBillingPeriod:a,onBillingPeriodChange:l,billingCountryCode:s,shouldHidePlan:c,selectDefaultTierIndex:u,currentSubscriptionOverride:y,hideCompatibleAddons:p,skeletonPlanCount:g=3})=>{let f=he(ee),h=false;if(f){let{isLoading:z,resourceId:K}=Y();h=z,t=K;}let{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:A,isCustomerOnTrial:S,isLoading:F,selectedBillingPeriod:B,setSelectedBillingPeriod:k,availableBillingPeriods:T,locale:I,configuration:E,showWatermark:L}=Ts({productId:e,resourceId:t,showOnlyEligiblePlans:r,billingCountryCode:s,preferredBillingPeriod:a,currentSubscriptionOverrideFn:y}),M=ws(n),R=!C||F||h?jsx(Is,{skeletonPlanCount:g}):jsx(ms,{plans:C,customer:b,currentSubscription:x,currentSubscriptionOverride:A,selectedBillingPeriod:B,onBillingPeriodChanged:z=>{k(z),l&&l(z);},availableBillingPeriods:T,highlightedPlanId:o,isCustomerOnTrial:S,onPlanSelected:i,paywallLocale:M,locale:I,shouldHidePlan:c,selectDefaultTierIndex:u,hideCompatibleAddons:p,showWatermark:L});return f?R:jsx(w,{componentTheme:E,children:R})};function Ls({resourceId:e,productId:t}){let{stigg:o,customerPortalUpdatedAt:r$1}=u(),[n,i]=useState(false),[a,l]=useState();return useEffect(()=>{d(null,null,function*(){if(o.isCustomerLoaded)try{i(!0);let c=yield o.getCustomerPortal({resourceId:e,productId:t});l(c);}catch(c){r.error(`Failed to load customer portal ${c==null?void 0:c.message}`,c);}finally{i(false);}});},[o,o.isCustomerLoaded,r$1,e,t]),{customerPortal:a,showWatermark:o.getShowWatermark(),isLoading:n}}function Ns(e){return Fg({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 Ms(e,t,o){var n,i,a,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)||((a=o==null?void 0:o.palette)==null?void 0:a.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 Do({children:e,textOverrides:t,theme:o,resourceId:r,productId:n}){let{customerPortalUpdatedAt:i}=u(),{customerPortal:a,isLoading:l,showWatermark:s}=Ls({resourceId:r,productId:n}),c=a!=null&&a.configuration?ys(a.configuration):void 0,u$1=v(c),y=Ms(u$1,o,a==null?void 0:a.configuration),p=Ns(t);return jsx(w,{componentTheme:c,children:jsx(ee.Provider,{value:{customerPortal:a,isLoading:l,showWatermark:s,textOverrides:p,theme:y,resourceId:r},children:e},i==null?void 0:i.toString())})}var Xe=e(mu)`
|
|
280
280
|
border-radius: 10px;
|
|
281
281
|
padding: 8px 16px;
|
|
282
282
|
text-transform: none;
|
|
@@ -285,7 +285,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
285
285
|
&:hover {
|
|
286
286
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedRestingBorder};
|
|
287
287
|
}
|
|
288
|
-
`;var
|
|
288
|
+
`;var zg=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})),_s=zg;var Ne=e.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
align-items: center;
|
|
291
291
|
justify-content: space-between;
|
|
@@ -295,11 +295,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
295
295
|
margin-bottom: 32px;
|
|
296
296
|
}
|
|
297
297
|
`};
|
|
298
|
-
`;function
|
|
298
|
+
`;function Me({title:e,className:t,isLoading:o}){let{theme:r}=Y();return o?jsx(Je,{width:120}):jsx(f,{className:t,overrideColor:r.sectionTitleColor,variant:"h3",bold:true,children:e})}var Og=e(_s)`
|
|
299
299
|
path {
|
|
300
300
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
301
301
|
}
|
|
302
|
-
`;function
|
|
302
|
+
`;function zs({onManageSubscription:e,hideManageButton:t,textOverrides:o}){return jsxs(Ne,{className:"stigg-customer-portal-overview-header",$disableMargin:true,children:[jsx(Me,{title:"Subscription",className:"stigg-overview-title"}),!t&&jsxs(Xe,{className:"stigg-manage-subscription-button",variant:"outlined",onClick:()=>e({intentionType:"MANAGE_SUBSCRIPTION"}),children:[jsx(Og,{className:"stigg-manage-subscription-button-image"}),jsx(f,{className:"stigg-manage-subscription-button-text",color:"primary.main",style:{marginLeft:"8px"},variant:"body1",children:o==null?void 0:o.manageSubscription})]})]})}function $o(){let{customerPortal:e}=Y(),t=Hg(e==null?void 0:e.subscriptions,o=>o.addons);return Wg(t)?null:jsx("div",{className:"stigg-addons-list-layout",children:t.map((o,r)=>jsxs(f,{as:"span",className:"stigg-addon-list-item-text",variant:"body1",children:[o.quantity>1&&`${o.quantity} X `,o.displayName,r===t.length-1?"":", "]},o.addonId))})}function Qg(e){return String(e.endDate)}var Vs=e.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
justify-content: space-between;
|
|
305
305
|
align-items: center;
|
|
@@ -310,15 +310,15 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
310
310
|
& > *:first-of-type {
|
|
311
311
|
max-width: 60%;
|
|
312
312
|
}
|
|
313
|
-
`;function
|
|
313
|
+
`;function Kg(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 zo(){let{customerPortal:e,textOverrides:t,theme:o}=Y(),r=e==null?void 0:e.promotionalEntitlements;return jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsx(f,{color:"secondary",children:t.promotionsSubtitle}),jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxs(Vs,{$borderColor:o.borderColor,children:[jsx(f,{variant:"body1",bold:true,children:"Feature"}),jsx(f,{variant:"body1",bold:true,children:"Expiration date"})]}),r==null?void 0:r.map((n,i)=>jsxs(Vs,{$borderColor:o.borderColor,children:[jsx(f,{variant:"body1",children:Kg(n)}),jsx(f,{variant:"body1",color:"disabled",children:n.endDate?Z.utc(Qg(n)).format("MMM Do, YYYY"):"None"})]},`${n.displayName}-${i}`))]})]})}var Os=e(Jg)`
|
|
314
314
|
.MuiTabs-indicator {
|
|
315
315
|
background-color: #001e6c;
|
|
316
316
|
}
|
|
317
|
-
`,
|
|
317
|
+
`,Hs=e.div`
|
|
318
318
|
width: 100%;
|
|
319
319
|
flex: 1;
|
|
320
320
|
margin-top: 16px;
|
|
321
|
-
`,
|
|
321
|
+
`,Ws=e(ke,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
322
322
|
margin-top: 16px;
|
|
323
323
|
max-height: ${({$maxHeight:e})=>e};
|
|
324
324
|
overflow-y: auto;
|
|
@@ -331,28 +331,28 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
331
331
|
margin-bottom: 16px;
|
|
332
332
|
row-gap: 16px;
|
|
333
333
|
background-color: ${({$backgroundColor:e})=>e};
|
|
334
|
-
`;function
|
|
334
|
+
`;function Ys(e){let a$1=e,{children:t,value:o,index:r,maxHeight:n}=a$1,i=c(a$1,["children","value","index","maxHeight"]);return jsx("div",b(a({role:"tabpanel",hidden:o!==r},i),{children:o===r&&jsx(Ws,{$maxHeight:n,children:t})}))}function Qs({isSelected:e,label:t,icon:o}){let r=e?"primary":"secondary";return jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[jsx(i,{icon:o,svgStrokeColor:r}),jsx(f,{variant:"h6",bold:e,color:r,children:t})]})}function Ks({customerPortal:e,hiddenSections:t,textOverrides:o,theme:r}){let n=Hg(e.subscriptions,p=>p.addons),i=p=>t==null?void 0:t.some(g=>g===p),a=n.length>0&&!i("addons"),l=e.promotionalEntitlements.length>0&&!i("promotionalEntitlements"),[s,c]=useState(a?1:2),u=(p,g)=>{c(g);};return a||l?jsxs(Hs,{children:[jsx(ke,{sx:{borderBottom:1,borderColor:"divider"},children:jsxs(Os,{value:s,onChange:u,children:[a?jsx(Zs,{sx:{textTransform:"none"},value:1,label:jsx(Qs,{isSelected:s===1,label:o.addonsTabTitle,icon:"Addons"})}):null,l?jsx(Zs,{sx:{textTransform:"none"},value:2,label:jsx(Qs,{isSelected:s===2,label:o.promotionsTabTitle,icon:"Promotions"})}):null]})}),jsx(Ys,{value:s,index:1,maxHeight:r.tabMaxHeight,children:jsx($o,{})}),jsx(Ys,{value:s,index:2,maxHeight:r.tabMaxHeight,children:jsx(zo,{})})]}):null}var qs={xs:320,sm:640,md:768,lg:1024,xl:1280,xxl:1536},$n=e=>`(min-width: ${qs[e]}px)`,oe=Object.keys(qs).reduce((e,t)=>b(a({},e),{[t]:`@media ${$n(t)}`}),{});function me(e){return tf($n(e))}var of=e.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
justify-content: space-between;
|
|
337
337
|
flex-wrap: wrap;
|
|
338
|
-
`,
|
|
338
|
+
`,rf=e.div`
|
|
339
339
|
display: flex;
|
|
340
340
|
flex-direction: column;
|
|
341
341
|
gap: 32px;
|
|
342
|
-
`;function
|
|
342
|
+
`;function Xs(){let e=me("md");return jsxs(of,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxs(rf,{children:[jsx(Je,{width:120}),jsx(Je,{width:120})]}),jsx(Je,{width:e?295:260,height:193})]})}function af({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxs(Re,{container:true,alignItems:"center",children:[jsx(Re,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Re,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Downgrade to the ",jsx("b",{children:t==null?void 0:t.displayName})," plan"]})})]})}function sf({scheduleUpdate:e}){let{scheduleVariables:t}=e,{billingPeriod:o}=t,r=o===BillingPeriod.Monthly?"annually":"monthly",n=o===BillingPeriod.Monthly?"monthly":"annually";return jsxs(Re,{container:true,alignItems:"center",children:[jsx(Re,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Re,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Change from an ",r," to a ",jsx("b",{children:n})," billing cycle"]})})]})}function lf({subscription:e,scheduleUpdate:t}){let{scheduleVariables:o}=t,{newUnitAmount:r,featureId:n}=o,a=yc(e.prices.map(({feature:u})=>u)).find(u=>u.id===n);if(!a)return null;let{featureUnits:l,featureUnitsPlural:s}=a;return jsxs(Re,{container:true,alignItems:"flex-start",flexWrap:"nowrap",children:[jsx(Re,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Re,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Reduce the ",jsx("b",{children:l})," quantity to ",r," ",r===1?l:s]})})]})}function el({scheduleUpdate:e,subscription:t}){switch(e.subscriptionScheduleType){case SubscriptionScheduleType.Downgrade:return jsx(af,{scheduleUpdate:e});case SubscriptionScheduleType.BillingPeriod:return jsx(sf,{scheduleUpdate:e});case SubscriptionScheduleType.UnitAmount:return jsx(lf,{scheduleUpdate:e,subscription:t});default:return null}}var uf=e(ke)`
|
|
343
343
|
border-bottom: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
344
344
|
border-top-left-radius: 10px;
|
|
345
345
|
border-top-right-radius: 10px;
|
|
346
346
|
margin: -64px -64px 64px -64px;
|
|
347
347
|
padding: 24px 32px;
|
|
348
|
-
`,
|
|
348
|
+
`,gf=e(Xm)`
|
|
349
349
|
margin-left: 4px;
|
|
350
|
-
`,
|
|
350
|
+
`,ff=e(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
|
|
355
|
+
`;function yf({subscription:e}){let{scheduledUpdates:t}=e;return jsxs(Fragment,{children:[jsx(Re,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Re,{children:jsx(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:"The following updates will take effect in the next billing cycle:"})})}),jsx(Re,{children:(t||[]).map(o=>jsx(el,{scheduleUpdate:o,subscription:e},o.subscriptionScheduleType))})]})}function hf({subscription:e}){let{scheduledUpdates:t}=e,[o]=t||[],{line1:r,line2:n}=Io({scheduledUpdate:o,subscriptionPrices:e.prices,billingPeriodRange:e.billingPeriodRange,options:{postfix:"at the end of the current billing period"}});return jsxs(Fragment,{children:[jsx(Re,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Re,{children:jsx(f,{className:"stigg-scheduled-updates-title",variant:"body1",color:"primary",children:r})})}),n&&jsx(Re,{children:jsx(f,{className:"stigg-scheduled-updates-subtitle",variant:"body1",color:"secondary",children:n})})]})}function tl({subscription:e,onCancelScheduledUpdates:t,theme:o,cancelScheduledUpdatesButtonTitle:r}){let n=useTheme(),[i$1,a]=useState(false),{scheduledUpdates:l}=e;if(!l||l.length===0)return null;let s=l.length===1;return jsx(uf,{$borderColor:o.borderColor,className:"stigg-scheduled-updates-alert-container",children:jsxs(Re,{container:true,alignItems:s?"center":"flex-start",gap:2,children:[jsx(Re,{item:true,display:"flex",children:jsx(i,{icon:"ScheduleBox",svgPathColor:o.iconsColor,svgRectColor:o.iconsBackgroundColor})}),jsx(Re,{item:true,flex:1,children:s?jsx(hf,{subscription:e}):jsx(yf,{subscription:e})}),!!t&&jsx(Re,{item:true,children:jsxs(Xe,{variant:"outlined",onClick:()=>{a(true),Promise.resolve(t(e)).finally(()=>a(false));},children:[i$1?jsx(gf,{loading:true,size:16,color:n.stigg.palette.text.disabled}):jsx(ff,{style:{display:"flex",marginRight:4},className:"stigg-scheduled-updates-cancel-update-button-icon"}),jsx(f,{variant:"body1",color:"primary.main",className:"stigg-scheduled-updates-cancel-update-button",children:r})]})})]})})}var Ue=e.div`
|
|
356
356
|
width: 100%;
|
|
357
357
|
display: flex;
|
|
358
358
|
flex-direction: column;
|
|
@@ -370,12 +370,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
370
370
|
${oe.lg} {
|
|
371
371
|
padding: 64px;
|
|
372
372
|
}
|
|
373
|
-
`;function
|
|
373
|
+
`;function nl({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",children:"Next estimated bill"}),jsx(f,{variant:"h1",children:H({amount:o,currency:r,maximumFractionDigits:2})}),jsxs(f,{as:"div",variant:"body1",color:"secondary",children:["Billed ",e===BillingPeriod.Monthly?"monthly":"annually"," on"," ",jsx(f,{variant:"body1",as:"span",color:"primary",children:Z.utc(t).format("MMM Do, YYYY")})]}),jsx(f,{variant:"body1",color:"secondary",children:"* Additional tax rates may apply"})]})}function Ho({description:e}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",color:"secondary",children:"No upcoming bill"}),jsx(f,{variant:"body1",color:"secondary",children:e})]})}var Tf=e.div`
|
|
374
374
|
display: flex;
|
|
375
375
|
flex-direction: column;
|
|
376
376
|
align-items: left;
|
|
377
377
|
gap: 8px;
|
|
378
|
-
`,
|
|
378
|
+
`,kf=e(mu)`
|
|
379
379
|
width: fit-content;
|
|
380
380
|
&.MuiButton-root {
|
|
381
381
|
padding: 0;
|
|
@@ -383,7 +383,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
383
383
|
background: none;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
`;function
|
|
386
|
+
`;function al({onContactSupport:e,label:t,linkLabel:o}){let r=jsx(f,{color:e?"primary.main":"secondary",children:o});return jsxs(Tf,{className:"stigg-contact-support-layout",children:[jsx(f,{className:"stigg-contact-support-label",color:"secondary",children:t}),e?jsx(kf,{className:"stigg-contact-support-button",style:{textTransform:"none"},variant:"text",onClick:e,children:r}):r]})}var Ff=e.div`
|
|
387
387
|
max-height: 278px;
|
|
388
388
|
display: flex;
|
|
389
389
|
flex-direction: column;
|
|
@@ -392,7 +392,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
392
392
|
border: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
393
393
|
padding: 32px;
|
|
394
394
|
gap: 16px;
|
|
395
|
-
`;function
|
|
395
|
+
`;function sl({subscription:e,theme:t,textOverrides:o,onContactSupport:r}){var s,c,u,y,p,g,f;let{pricingType:n}=e,i,a=(c=(s=e.prices)==null?void 0:s.every(h=>h.billingModel!==BillingModel.UsageBased))!=null?c:true,l=(u=e.scheduledUpdates)==null?void 0:u.find(({subscriptionScheduleType:h,targetPackage:C})=>h===SubscriptionScheduleType.Downgrade&&(C==null?void 0:C.pricingType)===PricingType.Free);if(n===PricingType.Free)i=jsx(Ho,{description:"You're on a free plan, so you don\u2019t have any upcoming charges"});else if(n===PricingType.Paid)if(l&&a)i=jsx(Ho,{description:"Your plan will be downgraded to a free plan, so you don\u2019t have any upcoming charges"});else if(e.status===SubscriptionStatus.InTrial)i=jsx(Ho,{description:`You\u2019re on a free trial of the ${e.planName} plan, so you don\u2019t have any upcoming charges`});else {let h=(p=(y=e.prices)==null?void 0:y[0])==null?void 0:p.billingPeriod,C=(g=e.billingPeriodRange)==null?void 0:g.end,b=(f=e.totalPrice)==null?void 0:f.total;h&&C&&b&&(i=jsx(nl,{billingPeriod:h,rangeEnd:C,amount:b.amount,currency:b.currency}));}else n===PricingType.Custom&&(i=jsx(al,{onContactSupport:r,label:o.contactSupportTitle,linkLabel:o.contactSupportLink}));return jsx(Ff,{className:"stigg-subscription-total-price-layout",$borderColor:t.borderColor,children:i})}var Ef=e=>jsxs("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[jsx("path",{d:"M12.9469 13.5999H11.9344L11.935 10.7756C11.935 10.6288 11.87 10.4819 11.7557 10.3838L8.62061 7.91816L11.755 5.4532C11.8694 5.35507 11.9344 5.22444 11.9344 5.06132L11.935 2.40004H12.9475C13.225 2.40004 13.4375 2.18755 13.4375 1.91004C13.4375 1.63254 13.225 1.42004 12.9475 1.42004L3.05311 1.42067C2.77561 1.42067 2.56311 1.63316 2.56311 1.91067C2.56311 2.18817 2.77561 2.40067 3.05311 2.40067H4.06561L4.06498 5.06131C4.06498 5.20818 4.12998 5.35505 4.24436 5.45318L7.36244 7.91814L4.245 10.3837C4.13062 10.4819 4.06562 10.6125 4.06562 10.7756V13.5999H3.05313C2.77562 13.5999 2.56313 13.8124 2.56313 14.0899C2.56313 14.3674 2.77562 14.5799 3.05313 14.5799H12.9469C13.2244 14.5799 13.4369 14.3674 13.4369 14.0899C13.4369 13.8124 13.2244 13.5999 12.9469 13.5999ZM5.04498 2.39995H10.9551V4.81627L8.00002 7.16747L5.04498 4.81627V2.39995ZM5.04498 11.0206L8.00002 8.66939L10.9551 11.0044V13.5838H5.04498V11.0206Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.05303 1.25404L12.9474 1.25342C13.317 1.25342 13.6041 1.54053 13.6041 1.91008C13.6041 2.27964 13.317 2.56675 12.9474 2.56675H12.1016L12.101 5.06136V5.06136C12.101 5.2747 12.0135 5.45101 11.8635 5.57973L11.8581 5.58436L8.89014 7.9182L11.8642 10.2572C12.0164 10.3878 12.1016 10.5814 12.1016 10.7757L12.101 13.4333H12.9468C13.3164 13.4333 13.6035 13.7204 13.6035 14.09C13.6035 14.4595 13.3164 14.7466 12.9468 14.7466H3.05304C2.68349 14.7466 2.39638 14.4595 2.39638 14.09C2.39638 13.7204 2.68349 13.4333 3.05304 13.4333H3.89887V10.7757C3.89887 10.5623 3.98635 10.386 4.13639 10.2573L4.14144 10.253L7.09365 7.91821L4.13566 5.57982C3.98346 5.44923 3.89823 5.25562 3.89823 5.06135L3.89882 2.56738H3.05303C2.68348 2.56738 2.39636 2.28026 2.39636 1.91071C2.39636 1.54116 2.68348 1.25405 3.05303 1.25404V1.25404ZM12.9474 1.58675L3.05304 1.58738C2.86758 1.58738 2.7297 1.72525 2.7297 1.91071C2.7297 2.09617 2.86757 2.23404 3.05303 2.23404H4.23223L4.23157 5.06135V5.06135C4.23158 5.15983 4.27538 5.25908 4.35053 5.32476L7.63107 7.91815L4.35113 10.5123C4.2739 10.5795 4.23221 10.6639 4.23221 10.7757V13.7666H3.05304C2.86759 13.7666 2.72971 13.9045 2.72971 14.09C2.72971 14.2754 2.86759 14.4133 3.05304 14.4133H12.9468C13.1323 14.4133 13.2701 14.2754 13.2701 14.09C13.2701 13.9045 13.1323 13.7667 12.9468 13.7667H11.7676L11.7683 10.7757V10.7757C11.7683 10.6772 11.7245 10.5781 11.6495 10.5124L8.35092 7.91819L11.6489 5.32461C11.726 5.25743 11.7676 5.17306 11.7676 5.06136L11.7683 2.23342H12.9474C13.1329 2.23342 13.2708 2.09554 13.2708 1.91008C13.2708 1.72463 13.1329 1.58676 12.9474 1.58675V1.58675ZM4.87823 2.23332H11.1216V4.89669L7.99994 7.3805L4.87823 4.89669V2.23332ZM5.21157 2.56666V4.73593L7.99994 6.95452L10.7883 4.73593V2.56666H5.21157ZM7.99958 8.45673L11.1216 10.9237V13.7505H4.87823V10.9403L7.99958 8.45673ZM8.0003 8.88213L5.21157 11.101V13.4172H10.7883V11.0852L8.0003 8.88213Z",fill:"white"})]})),cl=Ef;var We=e(n=>{var i=n,{children:e,className:t,placement:o="top"}=i,r=c(i,["children","className","placement"]);return jsx(Lf,b(a({arrow:true,placement:o},r),{classes:{popper:t,tooltip:"stigg-tooltip",arrow:"stigg-tooltip-arrow"},children:jsx("div",{children:e})}))})(({theme:e,$padding:t=8,$maxWidth:o=300})=>({[`& .${tooltipClasses.tooltip}`]:{backgroundColor:e.stigg.palette.white,maxWidth:o,boxShadow:e.stigg.shadows.popover,padding:t,borderRadius:e.stigg.border.radius,color:e.stigg.palette.text.primary},[`& .${tooltipClasses.arrow}`]:{color:e.stigg.palette.white}}));var Uf=e(f)`
|
|
396
396
|
display: ${({$display:e})=>e};
|
|
397
397
|
-webkit-line-clamp: ${({$maxLines:e})=>e};
|
|
398
398
|
-webkit-box-orient: vertical;
|
|
@@ -406,7 +406,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
406
406
|
${({$bold:e})=>e&&css`
|
|
407
407
|
font-weight: bold;
|
|
408
408
|
`}
|
|
409
|
-
`;function
|
|
409
|
+
`;function ul(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:a,tooltipPlacement:l="top",className:s,display:c="-webkit-box",style:u,"data-testid":y})=>{let[p,g]=useState(false),f$1=useRef(null),h=jsx(Uf,{ref:f$1,variant:o,color:r,$maxLines:n,$wordBreak:i,$bold:a,className:s,$display:c,style:u,"data-testid":y,children:t});useEffect(()=>{if(f$1!=null&&f$1.current){let b=ul(f$1.current);g(b);}},[f$1]);let C=(f$1==null?void 0:f$1.current)&&ul(f$1.current);return jsx("span",{children:p||C?jsx(We,{placement:l,leaveDelay:e,title:jsx(f,{variant:"body1",children:t}),children:h}):h})};var $f=e.div`
|
|
410
410
|
width: 100%;
|
|
411
411
|
display: flex;
|
|
412
412
|
align-items: center;
|
|
@@ -415,48 +415,48 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
415
415
|
border-radius: 10px;
|
|
416
416
|
padding: 8px 16px;
|
|
417
417
|
margin-top: 16px;
|
|
418
|
-
`,
|
|
418
|
+
`,Gf=e(Df)`
|
|
419
419
|
text-decoration-color: white;
|
|
420
420
|
color: white;
|
|
421
421
|
cursor: pointer;
|
|
422
|
-
`;function
|
|
422
|
+
`;function fl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==SubscriptionStatus.InTrial?null:jsxs($f,{className:"stigg-subscription-trial-badge",children:[jsx(cl,{className:"stigg-subscription-trial-badge-image"}),jsx("div",{style:{flex:1,marginRight:4},children:jsxs(Ae,{variant:"body1",className:"stigg-subscription-trial-badge-text",color:"white",children:[`${e.trialRemainingDays} days remaining in trial`,t&&` of the ${e.planName} plan`]})}),jsx(Gf,{className:"stigg-subscription-trial-upgrade-button",onClick:()=>o({intentionType:"UPGRADE_TRIAL_PLAN"}),children:jsx(f,{color:"white",children:"Upgrade plan"})})]})}function hl({mainSubscription:e,trialSubscription:t,onManageSubscription:o,theme:r}){return jsxs("div",{className:"stigg-subscription-view-layout",children:[jsxs(f,{className:"stigg-subscription-plan-name",variant:"h1",overrideColor:r.planNameColor,style:{marginTop:8},children:[e.planName," plan"]}),jsx(fl,{subscription:t,includePlanName:(t==null?void 0:t.planName)!==e.planName,onManageSubscription:o})]})}var Wn=70;function je(e,t){return t===0?0:Math.min(Math.floor(e/t*100),100)}function Cl(e){let t;return e<Wn?t="standard":e<100?t="warning":t="error",t}function Vf(e){return String(e.usagePeriodEnd)}function Pl(e){if(!e.resetPeriod||!e.usagePeriodEnd)return null;let t=Vf(e),o=r=>Z.utc(t).diff(Z.utc(),r);switch(e.resetPeriod){case EntitlementResetPeriod.Month:return `Resets monthly - in ${o("days")} days`;case EntitlementResetPeriod.Week:return `Resets weekly - in ${o("days")} days`;case EntitlementResetPeriod.Day:return `Resets daily - in ${o("hours")} hours`;case EntitlementResetPeriod.Hour:return `Resets hourly - in ${o("minutes")} minutes`;default:return null}}var Wf=e(Of,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
423
423
|
height: 4px;
|
|
424
|
-
background-color: ${({theme:e})=>
|
|
424
|
+
background-color: ${({theme:e})=>Ei(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
|
|
429
|
+
`;function Ko({currentUsage:e,usageLimit:t,classNamePrefix:o="stigg-usage-progress-bar"}){let r=je(e,t),n=Cl(r);return jsx(Wf,{$progressStatus:n,className:`${o} ${o}-${n}`,variant:"determinate",value:r})}var Kf=e(Fl)`
|
|
430
430
|
border-style: dotted;
|
|
431
431
|
border-bottom-width: 2px;
|
|
432
|
-
border-color: ${({theme:e})=>
|
|
433
|
-
`;function
|
|
432
|
+
border-color: ${({theme:e})=>Ei(e.stigg.palette.outlinedRestingBorder).alpha(.4).string()};
|
|
433
|
+
`;function qo({entitlement:e}){return e.hasUnlimitedUsage?jsx(Kf,{}):jsx(Ko,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var bl=e(mu)`
|
|
434
434
|
text-transform: none;
|
|
435
435
|
padding: 0;
|
|
436
436
|
white-space: nowrap;
|
|
437
|
-
`;function
|
|
437
|
+
`;function Xo({featureEntitlement:e,feature:t,onManageSubscription:o,onBuyMore:r,canBuyMore:n,canUpgradeSubscription:i,hasCustomSubscription:a}){return a||e.hasUnlimitedUsage||je(e.currentUsage||0,e.usageLimit)<Wn?null:n?r?jsx(bl,{variant:"text",onClick:()=>r(t,e),children:jsx(f,{color:"primary.main",children:"Buy more"})}):null:i&&o?jsx(bl,{variant:"text",onClick:()=>o({intentionType:"UPGRADE_PLAN"}),children:jsx(f,{color:"primary.main",children:"Upgrade"})}):null}function Sl({amount:e,currency:t,blockSize:o,featureEntitlement:r,feature:n,hideChargePrice:i,onBuyMore:a,onManageSubscription:l,canUpgradeSubscription:s,hasCustomSubscription:c}){var u,y,p;return jsxs("div",{className:`stigg-charge-list-item stigg-charge-list-item-${r.feature.refId}`,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[jsxs("div",{style:{display:"flex",gap:12},children:[jsx(Ae,{variant:"body1",color:"primary",children:n.displayName}),!i&&jsxs(Ae,{variant:"body1",color:"secondary",children:[H({amount:e,currency:t})," per ",o?`${o} `:"",o?n.featureUnitsPlural:n.featureUnits]})]}),jsxs("div",{style:{display:"flex",gap:12},children:[jsx(Xo,{featureEntitlement:r,feature:n,canBuyMore:true,onBuyMore:a,onManageSubscription:l,canUpgradeSubscription:s,hasCustomSubscription:c}),jsx(f,{variant:"body1",color:"primary",style:{whiteSpace:"nowrap"},children:r.hasUnlimitedUsage?(u=r.currentUsage)==null?void 0:u.toLocaleString():`${(y=r.currentUsage)==null?void 0:y.toLocaleString()} of ${(p=r.usageLimit)==null?void 0:p.toLocaleString()}`})]})]}),jsx(qo,{entitlement:r})]})}function kl({subscription:e,entitlements:t,onBuyMore:o,onManageSubscription:r,hasCustomSubscription:n,canUpgradeSubscription:i}){let a=Ul(t,"feature.refId"),l=e.prices.filter(({feature:s,price:c})=>!!s&&a[s.refId]&&!!c);return l.length?jsx("div",{className:"stigg-charge-list",style:{display:"flex",flexDirection:"column",gap:16,marginTop:32},children:l.map(({feature:s,price:c,blockSize:u,billingModel:y})=>{if(!s||!c)return null;let p=a[s.refId];return !p||!p.feature?null:jsx(Sl,{featureEntitlement:p,feature:p.feature,amount:c.amount,blockSize:u,currency:c.currency,hideChargePrice:y===BillingModel.PerUnit,onBuyMore:o,onManageSubscription:r,canUpgradeSubscription:i,hasCustomSubscription:n},s.refId)})}):null}function kt(e){return e.__typename==="FeatureEntitlement"}function er(e){return e.__typename==="CreditEntitlement"}function tr({onManageSubscription:e,onBuyMore:t,onCancelScheduledUpdates:o,onContactSupport:r,hiddenSections:n,cancelScheduledUpdatesButtonTitle:i}){let{customerPortal:a,isLoading:l,textOverrides:s,theme:c}=Y(),u=l||!a,{subscriptions:y,entitlementsV2:p,canUpgradeSubscription:g}=a||{},f=useMemo(()=>p?p.filter(kt):[],[p]),h=y==null?void 0:y.find(({status:A})=>A===SubscriptionStatus.Active),C=y==null?void 0:y.find(({status:A})=>A===SubscriptionStatus.InTrial),b=(h==null?void 0:h.pricingType)===PricingType.Custom,x=h||C;return jsxs(Ue,{className:"stigg-customer-portal-subscriptions-overview",$backgroundColor:c.backgroundColor,$borderColor:c.borderColor,children:[!u&&h&&h.scheduledUpdates&&jsx(tl,{theme:c,subscription:h,onCancelScheduledUpdates:o,cancelScheduledUpdatesButtonTitle:i}),u||!x?jsx(Xs,{}):jsxs("div",{className:"stigg-overview-layout",style:{display:"flex",alignItems:"flex-start",gap:64,flexWrap:"wrap"},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[jsx(zs,{onManageSubscription:e,hideManageButton:b,textOverrides:s}),jsx(hl,{mainSubscription:x,trialSubscription:C,theme:c,onManageSubscription:e}),h&&f.length>0&&jsx(kl,{subscription:h,entitlements:f,onBuyMore:t,onManageSubscription:e,canUpgradeSubscription:!!g,hasCustomSubscription:b}),jsx(Ks,{customerPortal:a,hiddenSections:n,textOverrides:s,theme:c})]}),jsx("div",{style:{display:"flex",flexDirection:"column",width:319,gap:24},children:jsx(sl,{subscription:x,theme:c,onContactSupport:r,textOverrides:s})})]})]})}var ty=e.div`
|
|
438
438
|
display: flex;
|
|
439
439
|
width: 100%;
|
|
440
440
|
align-items: flex-end;
|
|
441
441
|
justify-content: flex-end;
|
|
442
442
|
margin-bottom: 24px;
|
|
443
|
-
`;function
|
|
443
|
+
`;function Al({showWatermark:e}){return jsx(ty,{className:"stigg-customer-portal-header-layout",children:jsx(q,{source:"customer_portal",showWatermark:e})})}var ry=e(f)`
|
|
444
444
|
text-transform: none;
|
|
445
|
-
|
|
445
|
+
`,ny=e(ExternalLink)`
|
|
446
446
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
447
|
-
`;function
|
|
447
|
+
`;function or({text:e,url:t,className:o}){return jsx(Xe,{className:o,variant:"outlined",startIcon:jsx(ny,{size:20,strokeWidth:2.5}),onClick:()=>{window.open(t,"_blank");},children:jsx(ry,{color:"primary.main",children:e})})}var rr=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
|
-
`,
|
|
453
|
+
`,iy=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
|
|
459
|
+
`;function Kn({title:e,rows:t}){return jsxs(rr,{children:[jsx(f,{variant:"h6",color:"secondary",bold:true,children:e}),t.map(({classNamePrefix:o,label:r,value:n,labelTypographyProps:i,valueTypographyProps:a$1})=>jsxs(iy,{children:[jsx(f,b(a({className:`${o}-label`,variant:"body1",color:"secondary",style:{width:80}},i),{children:r})),jsx(f,b(a({className:`${o}-text`,variant:"body1",color:"secondary"},a$1),{children:n}))]},r))]})}function nr(){return jsx(Je,{width:220,height:42})}var El="-";function ar(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=Y(),n=me("md"),{billingInformation:i}=e||{},a=!i||t,l=[];if(a?l.push(jsxs(rr,{children:[jsx(Je,{width:220,height:12}),jsx(Je,{width:220,height:12}),jsx(Je,{width:220,height:12})]},"information-loading-data-top"),jsx(Fl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-loading-data-divider"),jsxs(rr,{children:[jsx(Je,{width:220,height:12}),jsx(Je,{width:220,height:12}),jsx(Je,{width:220,height:12})]},"information-loading-data-bottom")):(l.push(jsx(Kn,{title:"Billed to",rows:[{classNamePrefix:"stigg-customer-name",label:"Name",value:(i==null?void 0:i.name)||El,valueTypographyProps:i!=null&&i.name?{}:{color:"disabled"}},{classNamePrefix:"stigg-customer-email",label:"Email",value:(i==null?void 0:i.email)||El,valueTypographyProps:i!=null&&i.email?{}:{color:"disabled"}}]},"information-billing-data-billed-to")),i!=null&&i.defaultPaymentMethodId&&i.defaultPaymentMethodLast4Digits&&i.defaultPaymentExpirationMonth&&i.defaultPaymentExpirationYear&&(l.unshift(jsx(Fl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-billing-data-divider")),l.unshift(jsx(Kn,{title:"Payment method",rows:[{classNamePrefix:"stigg-credit-card",label:"Card",value:`Ending in ${i.defaultPaymentMethodLast4Digits}`},{classNamePrefix:"stigg-credit-card-expiration",label:"Expires",value:`${ly(i.defaultPaymentExpirationMonth.toString(),2,"0")}/${i.defaultPaymentExpirationYear}`}]},"information-billing-data-payment-method")))),!a&&!(i!=null&&i.name)&&!(i!=null&&i.email)&&!(i!=null&&i.defaultPaymentMethodId))return null;let s=a?jsx(nr,{}):e!=null&&e.billingPortalUrl?jsx(or,{url:e.billingPortalUrl,text:o.editPaymentDetails,className:"stigg-edit-payment-details-button"}):null;return jsxs(Ue,{className:"stigg-payment-details-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:[jsxs(Ne,{className:"stigg-payment-details-section-header",children:[jsx(Me,{isLoading:a,className:"stigg-payment-details-section-title",title:"Payment details"}),s]}),jsx("div",{style:{display:"flex",alignItems:"stretch",gap:n?64:32,flexWrap:"wrap"},children:l})]})}var vl=e(Ue)`
|
|
460
460
|
position: relative;
|
|
461
461
|
|
|
462
462
|
.stigg-paywall-layout {
|
|
@@ -481,7 +481,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
481
481
|
.${p} {
|
|
482
482
|
display: none;
|
|
483
483
|
}
|
|
484
|
-
`;var
|
|
484
|
+
`;var qn=forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxs(vl,{className:"stigg-customer-portal-paywall-section",ref:n,$backgroundColor:t.backgroundColor,$borderColor:t.borderColor,children:[jsx(Ne,{className:"stigg-customer-portal-paywall-header",children:jsx(Me,{isLoading:r,className:"stigg-customer-portal-paywall-section-title",title:o})}),e]}):null);qn.displayName="CustomerPortalPaywall";var Nl=e.div`
|
|
485
485
|
width: 100%;
|
|
486
486
|
display: flex;
|
|
487
487
|
flex-direction: column;
|
|
@@ -490,13 +490,13 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
490
490
|
& * {
|
|
491
491
|
box-sizing: border-box;
|
|
492
492
|
}
|
|
493
|
-
`,
|
|
493
|
+
`,Ml=e.div`
|
|
494
494
|
width: 100%;
|
|
495
495
|
display: flex;
|
|
496
496
|
flex-direction: column;
|
|
497
497
|
align-items: center;
|
|
498
498
|
row-gap: 24px;
|
|
499
|
-
`;var
|
|
499
|
+
`;var _l=6;function $l({featureEntitlements:e,creditEntitlements:t,showAll:o}){let r=e.length+t.length,n=o?r:Math.min(r,_l),i=e.slice(0,n),a=n-i.length,l=t.slice(0,Math.max(0,a)),s=r>_l;return {entitlementsToShow:i,creditsToShow:l,totalItemsCount:r,showMoreVisible:s}}function my(e){var t,o;return ((t=e.feature)==null?void 0:t.meterType)===MeterType.Fluctuating||((o=e.feature)==null?void 0:o.meterType)===MeterType.Incremental}function Gl(e,t){return t?e>2?4:6:12}function Dl(e){let t=[],o=[];for(let r of e)kt(r)?t.push(r):er(r)&&o.push(r);return {feature:t,credit:o}}function zl({packageEntitlements:e,activeSubscription:t,filterEntitlements:o,filterPackageEntitlements:r}){var x,A;let{feature:n,credit:i}=Dl(e!=null?e:[]),a=n.filter(my),l=Ul((x=t==null?void 0:t.prices)!=null?x:[],"feature.refId"),s=Ul(a,"feature.refId"),c=((A=t==null?void 0:t.prices)!=null?A:[]).map(S=>S.feature?s[S.feature.refId]:void 0).filter(S=>!!S),u=a.filter(S=>S.feature&&!l[S.feature.refId]),y=[...c,...u].filter(S=>S.usageLimit!==0),p=i.filter(S=>{var F;return ((F=S.usageLimit)!=null?F:0)>0}),g=[...y,...p],f=r?r({entitlements:g}).entitlements:[...o?o(y):y,...p],{feature:h,credit:C}=Dl(f),b=(t==null?void 0:t.pricingType)===PricingType.Custom;return {subscriptionPriceByFeature:l,filteredFeatureEntitlements:h,filteredCreditEntitlements:C,hasCustomSubscription:b}}function Vl({filterEntitlements:e,filterPackageEntitlements:t}){let[o,r]=useState(false),n=me("md"),{customerPortal:i,isLoading:a}=Y(),l=useMemo(()=>{var k;let F=i==null?void 0:i.entitlementsV2,B=(k=i==null?void 0:i.subscriptions)==null?void 0:k.find(T=>T.status===SubscriptionStatus.Active);return zl({packageEntitlements:F,activeSubscription:B,filterEntitlements:e,filterPackageEntitlements:t})},[i==null?void 0:i.entitlementsV2,i==null?void 0:i.subscriptions,e,t]),{subscriptionPriceByFeature:s,filteredFeatureEntitlements:c,filteredCreditEntitlements:u,hasCustomSubscription:y}=l,p=a||!i,g=!!(i!=null&&i.canUpgradeSubscription),{entitlementsToShow:f,creditsToShow:h,totalItemsCount:C,showMoreVisible:b}=$l({featureEntitlements:c,creditEntitlements:u,showAll:o}),x=Gl(C,n),A=()=>r(F=>!F),S=!p&&c.length===0&&u.length===0;return {isLoadingData:p,entitlementsToShow:f,creditsToShow:h,subscriptionPriceByFeature:s,totalItemsCount:C,gridSizeXs:x,hasCustomSubscription:y,canUpgradeSubscription:g,showAll:o,toggleShowAll:A,hasNoItems:S,showMoreVisible:b}}function Bt(e,t,o){if(!t&&!o)return e;let r=Jn(e);return r===Jn(t||"")||r===Jn(o||"")?e:`${e} (${o})`}function Ol(e){return Bt(e.displayName,e.featureUnits,e.featureUnitsPlural)}function Hl(e){var t,o,r;return Bt((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 sr=e.div`
|
|
500
500
|
display: flex;
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
padding: 24px;
|
|
@@ -506,12 +506,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
506
506
|
height: 100%;
|
|
507
507
|
|
|
508
508
|
${({theme:e,$highlight:t})=>t&&`background-color: ${e.stigg.palette.backgroundSection}`};
|
|
509
|
-
`;function
|
|
509
|
+
`;function Zl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i$1}){var s,c,u;let{theme:a}=Y(),l=!e.hasUnlimitedUsage&&e.currentUsage>e.usageLimit;return e.feature?jsxs(sr,{$highlight:!!t,$borderColor:a.borderColor,children:[jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:[jsx(Ae,{variant:"body1",children:e.feature&&Ol(e.feature)}),t&&jsx(We,{title:jsx(f,{variant:"body1",children:t.billingModel===BillingModel$1.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsx(i,{icon:"DollarCoin",svgStrokeColor:a.iconsColor})})]}),jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:[jsxs(Ae,{variant:"body1",color:l?"error":"primary","data-testid":`usage-data-${(s=e.feature)==null?void 0:s.refId}`,children:[(c=e.currentUsage)==null?void 0:c.toLocaleString(),!e.hasUnlimitedUsage&&` / ${(u=e.usageLimit)==null?void 0:u.toLocaleString()} (${je(e.currentUsage||0,e.usageLimit)}%)`]}),jsx(Xo,{featureEntitlement:e,feature:e.feature,onBuyMore:r,canBuyMore:!!t,onManageSubscription:o,canUpgradeSubscription:i$1,hasCustomSubscription:n})]}),jsx(qo,{entitlement:e}),!e.hasUnlimitedUsage&&!Wl(e.usageLimit)&&!Wl(e.currentUsage)&&e.resetPeriod&&e.usagePeriodEnd?jsx(f,{color:"secondary",children:Pl(e)}):null,e.hasUnlimitedUsage&&jsx(f,{color:"secondary",children:"In current billing period"})]}):null}function Xn({currentUsage:e,usageLimit:t}){return jsx(Ko,{currentUsage:e,usageLimit:t,classNamePrefix:"stigg-credit-usage-progress-bar"})}function jn(e){return Z(e).format("MMM D, YYYY h:mmA")}function ei(e){return Z(e).format("MMM D, YYYY")}function Cy(e){let t=i=>Math.ceil(Z.utc(e).diff(Z.utc(),i,true)),o=t("days");if(o>1)return `in ${o} days`;let r=t("hours");return r>1?`in ${r} hours`:`in ${t("minutes")} minutes`}function cr(e){let{usagePeriodEnd:t,formatter:o}=e;return !t||t.getTime()<=Date.now()?null:`Refreshes ${o?o(t):Cy(t)}`}function dr({creditEntitlement:e}){let{theme:t,textOverrides:o}=Y(),{currency:r,currentUsage:n,usageLimit:i}=e,a=(n!=null?n:0)>(i!=null?i:0),l=je(n!=null?n:0,i!=null?i:0),s=Hl(e),c=cr({usagePeriodEnd:e.usagePeriodEnd?new Date(e.usagePeriodEnd):void 0,formatter:o.formatResetPeriod});return jsxs(sr,{$highlight:false,$borderColor:t.borderColor,className:"stigg-credit-usage-container",children:[jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:jsx(Ae,{variant:"body1",className:"stigg-credit-usage-title",children:s})}),jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:jsxs(Ae,{variant:"body1",color:a?"error":"primary",className:"stigg-credit-usage-value","data-testid":`credit-usage-data-${r.currencyId}`,children:[(n!=null?n:0).toLocaleString()," / ",(i!=null?i:0).toLocaleString()," (",l,"%)"]})}),jsx(Xn,{currentUsage:n!=null?n:0,usageLimit:i!=null?i:0}),c&&jsx(f,{color:"secondary",children:c})]})}function Ql({featureEntitlements:e,creditEntitlements:t,subscriptionPriceByFeature:o,gridSizeXs:r,onManageSubscription:n,onBuyMore:i,hasCustomSubscription:a,canUpgradeSubscription:l}){return jsxs(Re,{container:true,spacing:4,children:[e.filter(s=>!!s.feature).map(s=>{let c=s.feature;return jsx(Re,{className:`stigg-entitlement-usage-${c.refId}`,item:true,xs:r,children:jsx(Zl,{entitlement:s,subscriptionPrice:o[c.refId],onManageSubscription:n,onBuyMore:i,hasCustomSubscription:a,canUpgradeSubscription:l})},c.refId)}),t.map(s=>jsx(Re,{className:`stigg-credit-usage-${s.currency.currencyId}`,item:true,xs:r,children:jsx(dr,{creditEntitlement:s})},s.currency.currencyId))]})}var ql=e.div`
|
|
510
510
|
margin-top: 32px;
|
|
511
|
-
`;function Gl(){let e=de("md");return jsx(Ne,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty(6).map(t=>jsx(Ne,{item:true,xs:e?4:12,children:jsx(Qe,{width:280,height:120})},t))})}function zl({showAll:e,onToggle:t}){return jsx($l,{children:jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsx(Minus,{}):jsx(Plus,{}),onClick:t,children:e?"Show less":"Show more"})})}function rr({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}){let{textOverrides:n,theme:i}=W(),{isLoadingData:a,entitlementsToShow:l,creditsToShow:s,subscriptionPriceByFeature:d,gridSizeXs:u,hasCustomSubscription:f,canUpgradeSubscription:m,showAll:h,toggleShowAll:g,hasNoItems:y,showMoreVisible:C}=vl({filterEntitlements:o,filterPackageEntitlements:r});return y?null:jsxs(Me,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsx(ve,{children:jsx(Le,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:a})}),a?jsx(Gl,{}):jsxs(Fragment,{children:[jsx(_l,{featureEntitlements:l,creditEntitlements:s,subscriptionPriceByFeature:d,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:m}),C&&jsx(zl,{showAll:h,onToggle:g})]})]})}function Ol({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r,onCancelScheduledUpdates:n,onContactSupport:i,paywallComponent:a,hiddenSections:l}){let{customerPortal:s,textOverrides:d,theme:u,isLoading:f,showWatermark:m}=W(),h=useRef(null),g=({intentionType:P})=>{var S,T;e?e({intentionType:P,customerSubscriptions:(S=s==null?void 0:s.subscriptions)!=null?S:[]}):(T=h==null?void 0:h.current)==null||T.scrollIntoView({behavior:"smooth"});},y=!(l!=null&&l.some(P=>P==="usage")),C=!(l!=null&&l.some(P=>P==="paymentDetails"||P==="billingInformation")),b=!(l!=null&&l.some(P=>P==="invoices"||P==="billingInformation"));return jsxs(Sl,{className:"stigg-customer-portal-layout",children:[jsx(yl,{showWatermark:m}),jsxs(Tl,{className:"stigg-customer-portal-sections",children:[jsx(Wo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:d.cancelScheduledUpdatesButtonTitle}),y&&jsx(rr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsx(zn,{ref:h,paywallComponent:a,theme:u,title:d.paywallSectionTitle,isLoading:!s||f}),C&&jsx(qo,{}),b&&jsx(nr,{})]})]})}function Zl(i){var a$1=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=a$1,n=c(a$1,["textOverrides","theme","resourceId","productId"]);return jsx(Io,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsx(Ol,a({},n))})}function nr(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsx(Qo,{}):e!=null&&e.billingPortalUrl?jsx(Zo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsx(Me,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(ve,{className:"stigg-invoices-section-header",children:[jsx(Le,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Ql=e=>Yl(e,"displayName"),Qn=e=>Yl(e,"addon.displayName");function at(e){var r,n;let t=(r=e.pricePoints)==null?void 0:r.some(i=>i.amount&&i.amount>0);return !!((n=e.hiddenFromWidgets)!=null&&n.includes(WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function Kl({addon:e,currency:t,billingCountryCode:o}){return b(a({},e),{pricePoints:e.pricePoints.filter(r=>r.currency===t&&(o?r.billingCountryCode===o:true))})}function ql({addons:e,billingCountryCode:t,currency:o}){return (e==null?void 0:e.map(r=>Kl({addon:r,currency:o,billingCountryCode:t})))||[]}function Jl({addons:e,billingPeriod:t,billingCountryCode:o,currency:r}){var n;return ((n=e==null?void 0:e.filter(i=>cy(i.addon,t)))==null?void 0:n.map(i=>b(a({},i),{addon:Kl({addon:i.addon,currency:r,billingCountryCode:o})})))||[]}function Xl({activeSubscription:e,plan:t,billingCountryCode:o,billingPeriod:r}){var d,u;let n=[],i=((u=(d=t==null?void 0:t.pricePoints)==null?void 0:d[0])==null?void 0:u.currency)||Currency.Usd,a=ql({addons:t==null?void 0:t.compatibleAddons,billingCountryCode:o,currency:i}),l=Ql(a.filter(f=>!at(f))),s=Jl({addons:e==null?void 0:e.addons,billingPeriod:r,billingCountryCode:o,currency:i});return s!=null&&s.length&&(a!=null&&a.length)&&(n=Qn(s.filter(f=>a.some(m=>m.id===f.addon.id)))),{addons:n,initialAddons:dy(n),availableAddons:l}}function uy(){let[,e]=R();return (t,o)=>e(r=>{if(at(t))return;let n=r.addonsStep.addons.find(i=>i.addon.id===t.id);if(n){if(at(n.addon))return;n.quantity=o;}else r.addonsStep.addons.push({addon:t,quantity:o}),r.addonsStep.addons=Qn(r.addonsStep.addons);})}function gy(){let[,e]=R();return t=>e(o=>{let r=o.addonsStep.addons.find(n=>n.addon.id===t);r&&at(r.addon)||py(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function jl(){let e=fy();return b(a({},e),{setAddon:uy(),removeAddon:gy()})}function yy(){let[{checkout:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}]=R();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}}function hy(){let[,e]=R();return t=>e(o=>{o.widgetState.readOnly=t;})}function Cy(){let[,e]=R();return t=>e(o=>{o.widgetState.isValid=t;})}function xy(){let[,e]=R();return t=>e(o=>{o.checkoutSuccess=t;})}function U(){let{checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}=yy();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r,setWidgetReadOnly:hy(),setIsValid:Cy(),setCheckoutSuccess:xy()}}function Sy(e){var t;return (t=e==null?void 0:e.plan)!=null&&t.pricePoints?b(a({},e),{plan:b(a({},e.plan),{pricePoints:e.plan.pricePoints.filter(o=>o.pricingModel!==BillingModel.CreditBased)})}):e}function tc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r$1}){let{stigg:n}=u(),[i,a]=useState(true),[l,s]=useState();return useEffect(()=>{let d$1=()=>d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});s(Sy(u));}catch(u){r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{a(false);}});if(r$1){a(false);let u=r$1({planId:e,resourceId:t,billingCountryCode:o});s(u);return}n.isCustomerLoaded&&(a(true),d$1());},[n,n.isCustomerLoaded,t,e,o,r$1]),{checkout:l,isLoading:i,showWatermark:n.getShowWatermark()}}var ar=(e,t)=>e.minUnitQuantity&&t<e.minUnitQuantity?e.minUnitQuantity:e.maxUnitQuantity&&t>e.maxUnitQuantity?e.maxUnitQuantity:t;var Kn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Annually)),rc=e=>Kn(e)&&qn(e);var ac=(e,t,o)=>e===BillingPeriod$1.Monthly&&t||e===BillingPeriod$1.Annually&&o?e:null,sc=({pricingModel:e})=>e===BillingModel.PerUnit;function ky(e,t,o){var i;if(!t)return [];let r=wl(e,"featureId"),n=wl(ic((i=o==null?void 0:o.prices)==null?void 0:i.map(a=>{let{feature:l}=a;return !l||!sc(a)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return ic(t==null?void 0:t.map(a=>{var u,f,m;let l=(u=a.feature)==null?void 0:u.featureId;if(!l||!sc(a))return null;let s,d=((f=r[l])==null?void 0:f.quantity)||((m=n[l])==null?void 0:m.quantity);return s=ar(a,d||1),a.isTieredPrice&&!Dt(a.tiers)&&(s=ln(a.tiers,s).upTo),{featureId:l,quantity:s}}))}function wy({plan:e,activeSubscription:t,preferredBillingPeriod:o}){var a,l;let r=Kn(e),n=qn(e);if(o){let s=ac(o,r,n);if(s)return s}if(((a=t==null?void 0:t.plan)==null?void 0:a.id)===(e==null?void 0:e.id))return ((l=t==null?void 0:t.price)==null?void 0:l.billingPeriod)||BillingPeriod$1.Monthly;if(t!=null&&t.prices&&(t==null?void 0:t.prices.length)>0){let s=ac(t==null?void 0:t.prices[0].billingPeriod,r,n);if(s)return s}return n?BillingPeriod$1.Annually:BillingPeriod$1.Monthly}function lc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=wy({plan:t,activeSubscription:o,preferredBillingPeriod:e}),a=t==null?void 0:t.pricePoints.filter(s=>s.billingPeriod===i),l=ky(n,a,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function Ay(){let[{planStep:e}]=R();return e}function By(){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 Pe(){let e=Ay();return b(a({},e),{setBillingPeriod:Iy(),setBillableFeature:By()})}var dc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],cc={activeStep:0,completedSteps:[],steps:dc,isDisabled:false},Ey=(e,t,o,r)=>{if(rc(e)&&!r)return false;let n=t.map(a=>a.featureId),i=o.map(a=>a.featureId);return !(n.length!==i.length||!n.every(a=>i.includes(a)))};function pc({isLoading:e,skipCheckoutSteps:t,plan:o,availableAddons:r,availableCharges:n,preferredBillingPeriod:i,preconfiguredBillableFeatures:a$1}){if(e||!o)return cc;let l=[];return t.includes("PLAN")&&Ey(o,n,a$1,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),b(a({},cc),{steps:dc.filter(s=>!l.includes(s.key))})}function vy(){let[{progressBar:e}]=R();return e}function Ly(){let[e,t]=R();return o=>d(null,null,function*(){let{progressBar:r,planStep:n,addonsStep:i,paymentStep:a,onBeforeStepChange:l}=e;if(o!==r.activeStep&&l){let s=r.steps[r.activeStep],d=r.steps[o];if(s&&d){let u={planStep:n,addonsStep:i,paymentStep:a};if(!(yield l({from:s.key,to:d.key,state:u})))return}}t(({progressBar:s})=>{s.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 ()=>d(null,null,function*(){let{progressBar:o,planStep:r,addonsStep:n,paymentStep:i,onBeforeStepChange:a}=e;if(o.isDisabled)return;let l=o.steps[o.activeStep],s=o.steps[o.activeStep+1];if(s&&a){let d={planStep:r,addonsStep:n,paymentStep:i};if(!(yield a({from:l.key,to:s.key,state:d})))return}t(({progressBar:d})=>{d.completedSteps.includes(d.activeStep)||d.completedSteps.push(d.activeStep),d.activeStep<d.steps.length-1&&(d.activeStep+=1);});})}function Uy(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Re(){let e=vy();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 kt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return b(a({},e),{addons:t.addons,promotionCode:o,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function sr({billingAddress:e,taxPercentage:t,taxIds:o}){if(!e&&!t&&!(o!=null&&o.length))return {};let r=o!=null&&o.length?o==null?void 0:o.filter(n=>n.value&&n.type):void 0;return {billingInformation:b(a(a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Gy=h=>d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:a$1,billingCountryCode:l,billingPeriod:s,billingAddress:d,taxPercentage:u,taxIds:f,onMockCheckoutPreview:m}){var b;let g=i.map(({addon:P,quantity:S})=>({addonId:P.id,quantity:S})),y=null,C=null;try{if(t&&o){let P=a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:s,promotionCode:n,billableFeatures:Ag(a$1)?void 0:a$1},sr({billingAddress:d,taxPercentage:u,taxIds:f}));y=m?m(P):yield e.previewSubscription(P);}}catch(P){let[,S]=((b=P==null?void 0:P.message)==null?void 0:b.split("Error:"))||[];C=S==null?void 0:S.trim();}return {subscriptionPreview:y,errorMessage:C}}),Xn=({onMockCheckoutPreview:e}={})=>{let{stigg:t}=u(),o=kt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:a,customer:l}=n||{};return {previewSubscriptionAction:useCallback((...u)=>d(null,[...u],function*({promotionCode:d}={}){return i.isValid?Gy({stigg:t,customerId:l==null?void 0:l.id,planId:a==null?void 0:a.id,resourceId:r,addons:o.addons,billableFeatures:o.billableFeatures,billingCountryCode:o.billingCountryCode,billingPeriod:o.billingPeriod,billingAddress:o.billingAddress,taxPercentage:o.taxPercentage,promotionCode:d!=null?d:o.promotionCode,taxIds:o.taxId?[o.taxId]:void 0,onMockCheckoutPreview:e}):{subscriptionPreview:null,errorMessage:null}}),[t,l==null?void 0:l.id,a==null?void 0:a.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]=useState(null),[r,n]=useState(null),[i,a]=useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return useEffect(()=>{let s=()=>d(null,null,function*(){let{subscriptionPreview:u,errorMessage:f}=yield l();u&&(o(u),n(null)),f&&(n(f),o(null)),a(false);});a(true);let d$1=setTimeout(()=>{a(true),s();},zy);return ()=>{clearTimeout(d$1);}},[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 useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function Hy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function Oy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function Wy(){let[{paymentStep:e}]=R();return e}function Zy(){let[,e]=R();return useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=Wy();return b(a({},e),{setUseNewPaymentMethod:Vy(),setErrorMessage:Hy(),setBillingAddress:Oy(),setTaxId:Zy()})}function fc(e){return dg({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===BillingPeriod.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:o})=>`${o.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:o})=>`Billed ${o.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:o})=>`Your account will be granted credits worth ${o} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:o,currency:r})=>{let n="";o.type===DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case DiscountDurationType.Once:{i=" once";break}case DiscountDurationType.Repeating:{i=`${o.type===DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case DiscountDurationType.Forever:default:i="";}return `${n}${i}`},taxTitle:({taxDetails:o})=>`Tax (${o==null?void 0:o.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:o})=>`Your changes will take effect at the end of your current billing cycle on ${Q(o).format("MMMM D, YYYY")}.`,checkoutSuccessText:"Changes applied",payAsYouGoTooltipText:"Billed according to actual usage"},checkoutButton:{nextText:"Next",noChangesText:"No changes",updateText:"Update subscription",downgradeToFreeText:"Cancel subscription",upgradeText:"Subscribe"},downgradeToFree:{alertText:()=>"We\u2019re sorry to see you cancel your paid subscription \u{1F62D}",freePlanHeader:()=>"New plan",freePlanName:({plan:o})=>`${o.displayName}`,freePlanPriceText:()=>"Free",paidPlanHeader:()=>"Current plan",paidPlanName:({plan:o})=>`${o.displayName}`,paidPlanPriceText:({billingPeriod:o})=>`Paid plan${o?`, billed ${o.toLowerCase()}`:""}`},nextBillingCaption:()=>""},e)}var qt={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)||qt.primary,textColor:(t==null?void 0:t.textColor)||(r==null?void 0:r.text.primary)||qt.textColor,backgroundColor:(t==null?void 0:t.backgroundColor)||(r==null?void 0:r.backgroundPaper)||qt.backgroundColor,borderColor:(t==null?void 0:t.borderColor)||(r==null?void 0:r.outlinedBorder)||qt.borderColor,summaryBackgroundColor:(t==null?void 0:t.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||qt.summaryBackgroundColor,paymentInputBackgroundColor:t==null?void 0:t.paymentInputBackgroundColor,paymentInputBorderColor:t==null?void 0:t.paymentInputBorderColor,paymentInputBorderRadius:t==null?void 0:t.paymentInputBorderRadius}}var ti=ii.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=useContext(ti);if(!e)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return e},th=({children:e,initialState:t})=>{let[o,r]=useState(t);useEffect(()=>{r(t);},[t]);let n=useCallback(l=>r(s=>produce(s,d=>l(d))),[r]),[i,a]=useMemo(()=>[o,n],[n,o]);return jsx(ti.Provider,{value:[i,a],children:e})};function Cc({children:e,textOverrides:t,theme:o,preferredBillingPeriod:r,billableFeatures:n,resourceId:i,planId:a,billingCountryCode:l,billingInformation:s,onMockCheckoutState:d,skipCheckoutSteps:u,onBeforeStepChange:f}){var P;let{checkout:m,isLoading:h,showWatermark:g}=tc({resourceId:i,planId:a,billingCountryCode:l,onMockCheckoutState:d}),y=m!=null&&m.configuration?ss(m.configuration):{typography:Ht(null,wo)},C=v(y),b=useMemo(()=>{var N,F;let S=yc(C,o,m==null?void 0:m.configuration),T=fc(t),I=lc({preferredBillingPeriod:r,plan:m==null?void 0:m.plan,activeSubscription:m==null?void 0:m.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:n!=null?n:[]}),A=Xl({plan:m==null?void 0:m.plan,activeSubscription:m==null?void 0:m.activeSubscription,billingPeriod:I.billingPeriod}),B=uc({customer:m==null?void 0:m.customer,taxPercentage:(N=s==null?void 0:s.taxDetails)==null?void 0:N.taxPercentage}),k=pc({isLoading:h,skipCheckoutSteps:u!=null?u:[],plan:m==null?void 0:m.plan,availableAddons:A.availableAddons,availableCharges:I.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:m,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:I,addonsStep:A,paymentStep:B,resourceId:(F=m==null?void 0:m.resource)==null?void 0:F.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:h},showWatermark:g,checkoutSuccess:false,onBeforeStepChange:f}},[r,l,m,h,u,(P=s==null?void 0:s.taxDetails)==null?void 0:P.taxPercentage,f]);return jsx(w,{componentTheme:y,children:jsx(th,{initialState:b,children:e})},m==null?void 0:m.plan.id)}var xc="920px",bc=e.div`
|
|
511
|
+
`;function Jl(){let e=me("md");return jsx(Re,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:xy(6).map(t=>jsx(Re,{item:true,xs:e?4:12,children:jsx(Je,{width:280,height:120})},t))})}function Xl({showAll:e,onToggle:t}){return jsx(ql,{children:jsx(Xe,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsx(Minus,{}):jsx(Plus,{}),onClick:t,children:e?"Show less":"Show more"})})}function ur({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}){let{textOverrides:n,theme:i}=Y(),{isLoadingData:a,entitlementsToShow:l,creditsToShow:s,subscriptionPriceByFeature:c,gridSizeXs:u,hasCustomSubscription:y,canUpgradeSubscription:p,showAll:g,toggleShowAll:f,hasNoItems:h,showMoreVisible:C}=Vl({filterEntitlements:o,filterPackageEntitlements:r});return h?null:jsxs(Ue,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsx(Ne,{children:jsx(Me,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:a})}),a?jsx(Jl,{}):jsxs(Fragment,{children:[jsx(Ql,{featureEntitlements:l,creditEntitlements:s,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:y,canUpgradeSubscription:p}),C&&jsx(Xl,{showAll:g,onToggle:f})]})]})}function tc({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r,onCancelScheduledUpdates:n,onContactSupport:i,paywallComponent:a,hiddenSections:l}){let{customerPortal:s,textOverrides:c,theme:u,isLoading:y,showWatermark:p}=Y(),g=useRef(null),f=({intentionType:x})=>{var A,S;e?e({intentionType:x,customerSubscriptions:(A=s==null?void 0:s.subscriptions)!=null?A:[]}):(S=g==null?void 0:g.current)==null||S.scrollIntoView({behavior:"smooth"});},h=!(l!=null&&l.some(x=>x==="usage")),C=!(l!=null&&l.some(x=>x==="paymentDetails"||x==="billingInformation")),b=!(l!=null&&l.some(x=>x==="invoices"||x==="billingInformation"));return jsxs(Nl,{className:"stigg-customer-portal-layout",children:[jsx(Al,{showWatermark:p}),jsxs(Ml,{className:"stigg-customer-portal-sections",children:[jsx(tr,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:f,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),h&&jsx(ur,{onManageSubscription:f,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsx(qn,{ref:g,paywallComponent:a,theme:u,title:c.paywallSectionTitle,isLoading:!s||y}),C&&jsx(ar,{}),b&&jsx(gr,{})]})]})}function rc(i){var a$1=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=a$1,n=c(a$1,["textOverrides","theme","resourceId","productId"]);return jsx(Do,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsx(tc,a({},n))})}function gr(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=Y(),n=!e||t,i=n?jsx(nr,{}):e!=null&&e.billingPortalUrl?jsx(or,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsx(Ue,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Ne,{className:"stigg-invoices-section-header",children:[jsx(Me,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var ic=e=>nc(e,"displayName"),ri=e=>nc(e,"addon.displayName");function lt(e){var r,n;let t=(r=e.pricePoints)==null?void 0:r.some(i=>i.amount&&i.amount>0);return !!((n=e.hiddenFromWidgets)!=null&&n.includes(WidgetType.Checkout))&&!t}function Iy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function ac({addon:e,currency:t,billingCountryCode:o}){return b(a({},e),{pricePoints:e.pricePoints.filter(r=>r.currency===t&&(o?r.billingCountryCode===o:true))})}function sc({addons:e,billingCountryCode:t,currency:o}){return (e==null?void 0:e.map(r=>ac({addon:r,currency:o,billingCountryCode:t})))||[]}function lc({addons:e,billingPeriod:t,billingCountryCode:o,currency:r}){var n;return ((n=e==null?void 0:e.filter(i=>Iy(i.addon,t)))==null?void 0:n.map(i=>b(a({},i),{addon:ac({addon:i.addon,currency:r,billingCountryCode:o})})))||[]}function cc({activeSubscription:e,plan:t,billingCountryCode:o,billingPeriod:r}){var c,u;let n=[],i=((u=(c=t==null?void 0:t.pricePoints)==null?void 0:c[0])==null?void 0:u.currency)||Currency.Usd,a=sc({addons:t==null?void 0:t.compatibleAddons,billingCountryCode:o,currency:i}),l=ic(a.filter(y=>!lt(y))),s=lc({addons:e==null?void 0:e.addons,billingPeriod:r,billingCountryCode:o,currency:i});return s!=null&&s.length&&(a!=null&&a.length)&&(n=ri(s.filter(y=>a.some(p=>p.id===y.addon.id)))),{addons:n,initialAddons:Fy(n),availableAddons:l}}function Ly(){let[,e]=_();return (t,o)=>e(r=>{if(lt(t))return;let n=r.addonsStep.addons.find(i=>i.addon.id===t.id);if(n){if(lt(n.addon))return;n.quantity=o;}else r.addonsStep.addons.push({addon:t,quantity:o}),r.addonsStep.addons=ri(r.addonsStep.addons);})}function Ny(){let[,e]=_();return t=>e(o=>{let r=o.addonsStep.addons.find(n=>n.addon.id===t);r&<(r.addon)||Ey(o.addonsStep.addons,n=>n.addon.id===t);})}function My(){let[{addonsStep:e}]=_();return e}function dc(){let e=My();return b(a({},e),{setAddon:Ly(),removeAddon:Ny()})}function Ry(){let[{checkout:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}]=_();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}}function Uy(){let[,e]=_();return t=>e(o=>{o.widgetState.readOnly=t;})}function _y(){let[,e]=_();return t=>e(o=>{o.widgetState.isValid=t;})}function Dy(){let[,e]=_();return t=>e(o=>{o.checkoutSuccess=t;})}function D(){let{checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}=Ry();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r,setWidgetReadOnly:Uy(),setIsValid:_y(),setCheckoutSuccess:Dy()}}function zy(e){var t;return (t=e==null?void 0:e.plan)!=null&&t.pricePoints?b(a({},e),{plan:b(a({},e.plan),{pricePoints:e.plan.pricePoints.filter(o=>o.pricingModel!==BillingModel.CreditBased)})}):e}function mc({planId:e,resourceId:t,billingCountryCode:o,onMockCheckoutState:r$1}){let{stigg:n}=u(),[i,a]=useState(true),[l,s]=useState();return useEffect(()=>{let c=()=>d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});s(zy(u));}catch(u){r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{a(false);}});if(r$1){a(false);let u=r$1({planId:e,resourceId:t,billingCountryCode:o});s(u);return}n.isCustomerLoaded&&(a(true),c());},[n,n.isCustomerLoaded,t,e,o,r$1]),{checkout:l,isLoading:i,showWatermark:n.getShowWatermark()}}var yr=(e,t)=>e.minUnitQuantity&&t<e.minUnitQuantity?e.minUnitQuantity:e.maxUnitQuantity&&t>e.maxUnitQuantity?e.maxUnitQuantity:t;var ni=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Monthly)),ii=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Annually)),gc=e=>ni(e)&&ii(e);var hc=(e,t,o)=>e===BillingPeriod$1.Monthly&&t||e===BillingPeriod$1.Annually&&o?e:null,Cc=({pricingModel:e})=>e===BillingModel.PerUnit;function Oy(e,t,o){var i;if(!t)return [];let r=Ul(e,"featureId"),n=Ul(yc((i=o==null?void 0:o.prices)==null?void 0:i.map(a=>{let{feature:l}=a;return !l||!Cc(a)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return yc(t==null?void 0:t.map(a=>{var u,y,p;let l=(u=a.feature)==null?void 0:u.featureId;if(!l||!Cc(a))return null;let s,c=((y=r[l])==null?void 0:y.quantity)||((p=n[l])==null?void 0:p.quantity);return s=yr(a,c||1),a.isTieredPrice&&!Wt(a.tiers)&&(s=Cn(a.tiers,s).upTo),{featureId:l,quantity:s}}))}function Hy({plan:e,activeSubscription:t,preferredBillingPeriod:o}){var a,l;let r=ni(e),n=ii(e);if(o){let s=hc(o,r,n);if(s)return s}if(((a=t==null?void 0:t.plan)==null?void 0:a.id)===(e==null?void 0:e.id))return ((l=t==null?void 0:t.price)==null?void 0:l.billingPeriod)||BillingPeriod$1.Monthly;if(t!=null&&t.prices&&(t==null?void 0:t.prices.length)>0){let s=hc(t==null?void 0:t.prices[0].billingPeriod,r,n);if(s)return s}return n?BillingPeriod$1.Annually:BillingPeriod$1.Monthly}function Pc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=Hy({plan:t,activeSubscription:o,preferredBillingPeriod:e}),a=t==null?void 0:t.pricePoints.filter(s=>s.billingPeriod===i),l=Oy(n,a,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function Wy(){let[{planStep:e}]=_();return e}function Zy(){let[,e]=_();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 Yy(){let[,e]=_();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 be(){let e=Wy();return b(a({},e),{setBillingPeriod:Yy(),setBillableFeature:Zy()})}var bc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],xc={activeStep:0,completedSteps:[],steps:bc,isDisabled:false},Ky=(e,t,o,r)=>{if(gc(e)&&!r)return false;let n=t.map(a=>a.featureId),i=o.map(a=>a.featureId);return !(n.length!==i.length||!n.every(a=>i.includes(a)))};function Sc({isLoading:e,skipCheckoutSteps:t,plan:o,availableAddons:r,availableCharges:n,preferredBillingPeriod:i,preconfiguredBillableFeatures:a$1}){if(e||!o)return xc;let l=[];return t.includes("PLAN")&&Ky(o,n,a$1,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),b(a({},xc),{steps:bc.filter(s=>!l.includes(s.key))})}function qy(){let[{progressBar:e}]=_();return e}function Jy(){let[e,t]=_();return o=>d(null,null,function*(){let{progressBar:r,planStep:n,addonsStep:i,paymentStep:a,onBeforeStepChange:l}=e;if(o!==r.activeStep&&l){let s=r.steps[r.activeStep],c=r.steps[o];if(s&&c){let u={planStep:n,addonsStep:i,paymentStep:a};if(!(yield l({from:s.key,to:c.key,state:u})))return}}t(({progressBar:s})=>{s.activeStep=o;});})}function Xy(){let[,e]=_();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function jy(e){return e.completedSteps.length>=e.steps.length-1}function eh(){let[e,t]=_();return ()=>d(null,null,function*(){let{progressBar:o,planStep:r,addonsStep:n,paymentStep:i,onBeforeStepChange:a}=e;if(o.isDisabled)return;let l=o.steps[o.activeStep],s=o.steps[o.activeStep+1];if(s&&a){let c={planStep:r,addonsStep:n,paymentStep:i};if(!(yield a({from:l.key,to:s.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 th(){let[,e]=_();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function _e(){let e=qy();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:jy(e),setActiveStep:Jy(),markStepAsCompleted:Xy(),goNext:eh(),setIsDisabled:th()}}function It(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=_();return b(a({},e),{addons:t.addons,promotionCode:o,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function hr({billingAddress:e,taxPercentage:t,taxIds:o}){if(!e&&!t&&!(o!=null&&o.length))return {};let r=o!=null&&o.length?o==null?void 0:o.filter(n=>n.value&&n.type):void 0;return {billingInformation:b(a(a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var ih=g=>d(null,[g],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:a$1,billingCountryCode:l,billingPeriod:s,billingAddress:c,taxPercentage:u,taxIds:y,onMockCheckoutPreview:p}){var b;let f=i.map(({addon:x,quantity:A})=>({addonId:x.id,quantity:A})),h=null,C=null;try{if(t&&o){let x=a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:f,billingPeriod:s,promotionCode:n,billableFeatures:Wg(a$1)?void 0:a$1},hr({billingAddress:c,taxPercentage:u,taxIds:y}));h=p?p(x):yield e.previewSubscription(x);}}catch(x){let[,A]=((b=x==null?void 0:x.message)==null?void 0:b.split("Error:"))||[];C=A==null?void 0:A.trim();}return {subscriptionPreview:h,errorMessage:C}}),si=({onMockCheckoutPreview:e}={})=>{let{stigg:t}=u(),o=It(),[{resourceId:r}]=_(),{checkoutState:n,widgetState:i}=D(),{plan:a,customer:l}=n||{};return {previewSubscriptionAction:useCallback((...u)=>d(null,[...u],function*({promotionCode:c}={}){return i.isValid?ih({stigg:t,customerId:l==null?void 0:l.id,planId:a==null?void 0:a.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,a==null?void 0:a.id,r,o.addons,o.billableFeatures,o.billingCountryCode,o.billingPeriod,o.billingAddress,o.taxPercentage,o.taxId,o.promotionCode,i.isValid,e])}},ah=500,Tc=({onMockCheckoutPreview:e}={})=>{let[t,o]=useState(null),[r,n]=useState(null),[i,a]=useState(false),{previewSubscriptionAction:l}=si({onMockCheckoutPreview:e});return useEffect(()=>{let s=()=>d(null,null,function*(){let{subscriptionPreview:u,errorMessage:y}=yield l();u&&(o(u),n(null)),y&&(n(y),o(null)),a(false);});a(true);let c=setTimeout(()=>{a(true),s();},ah);return ()=>{clearTimeout(c);}},[l]),{subscriptionPreview:t,isFetchingSubscriptionPreview:i,errorMessage:r}};function kc({customer:e,taxPercentage:t,taxId:o}){return {useNewPaymentMethod:!(e!=null&&e.paymentMethodDetails),taxPercentage:t,taxId:o}}function sh(){let[,e]=_();return useCallback(t=>e(o=>{o.paymentStep.useNewPaymentMethod=t;}),[e])}function lh(){let[,e]=_();return useCallback(t=>e(o=>{o.paymentStep.errorMessage=t;}),[e])}function ch(){let[,e]=_();return useCallback(t=>e(o=>{o.paymentStep.billingAddress=t;}),[e])}function dh(){let[{paymentStep:e}]=_();return e}function ph(){let[,e]=_();return useCallback(t=>e(o=>{o.paymentStep.taxId=t;}),[e])}function re(){let e=dh();return b(a({},e),{setUseNewPaymentMethod:sh(),setErrorMessage:lh(),setBillingAddress:ch(),setTaxId:ph()})}function Bc(e){return Fg({changePlan:"Change",billingPeriodsTitle:"Billing cycle",addAddonText:"Add",addonBillingPeriodNotAvailableText:({planBillingPeriod:o})=>o===BillingPeriod.Monthly?"Exclusively available on annual plans":"Exclusively available on monthly plans",newPaymentMethodText:"New payment method",newPaymentMethodBillingAddressTitle:"Billing address",newPaymentMethodCardTitle:"Payment method",summary:{title:"Order summary",planName:({plan:o})=>`${o.displayName} plan`,addCouponCodeText:"Add promotion code",couponCodeTitle:"Promotion code",addonsSectionTitle:"Add-ons",discountsSectionTitle:"Discounts",onlyPayAsYouGoText:"Varies by usage",startsAtText:"Starts at ",proratedTotalDueText:"Prorated charge today",baseChargeText:()=>"Base charge",totalText:"Total",totalDueText:"Total due today",totalBillingPeriodText:({billingPeriod:o})=>`Billed ${o.toLowerCase()}`,appliedCreditsTitle:"Applied credits",creditsForUnusedTimeText:({credits:o})=>`Your account will be granted credits worth ${o} for unused time, which will be automatically applied to future payments.`,discountText:({discountDetails:o,currency:r})=>{let n="";o.type===DiscountType.Percentage?n=`${o.value}% off`:n=`${H({amount:o.value,currency:r})}`;let i="";switch(o.durationType){case DiscountDurationType.Once:{i=" once";break}case DiscountDurationType.Repeating:{i=`${o.type===DiscountType.Fixed?" per month":""} for ${o.durationInMonths} months`;break}case DiscountDurationType.Forever:default:i="";}return `${n}${i}`},taxTitle:({taxDetails:o})=>`Tax (${o==null?void 0:o.percentage}%)`,changesWillApplyAtEndOfBillingPeriod:({billingPeriodEnd:o})=>`Your changes will take effect at the end of your current billing cycle on ${Z(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 no={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 Ac(e,t,o){let{palette:r}=e||{};return {primary:(t==null?void 0:t.primary)||(r==null?void 0:r.primary)||no.primary,textColor:(t==null?void 0:t.textColor)||(r==null?void 0:r.text.primary)||no.textColor,backgroundColor:(t==null?void 0:t.backgroundColor)||(r==null?void 0:r.backgroundPaper)||no.backgroundColor,borderColor:(t==null?void 0:t.borderColor)||(r==null?void 0:r.outlinedBorder)||no.borderColor,summaryBackgroundColor:(t==null?void 0:t.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||no.summaryBackgroundColor,paymentInputBackgroundColor:t==null?void 0:t.paymentInputBackgroundColor,paymentInputBorderColor:t==null?void 0:t.paymentInputBorderColor,paymentInputBorderRadius:t==null?void 0:t.paymentInputBorderRadius}}var di=gi.createContext(null);di.displayName="CheckoutContext";var _=()=>{let e=useContext(di);if(!e)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return e},xh=({children:e,initialState:t})=>{let[o,r]=useState(t);useEffect(()=>{r(t);},[t]);let n=useCallback(l=>r(s=>produce(s,c=>l(c))),[r]),[i,a]=useMemo(()=>[o,n],[n,o]);return jsx(di.Provider,{value:[i,a],children:e})};function Fc({children:e,textOverrides:t,theme:o,preferredBillingPeriod:r,billableFeatures:n,resourceId:i,planId:a,billingCountryCode:l,billingInformation:s,onMockCheckoutState:c,skipCheckoutSteps:u,onBeforeStepChange:y}){var x;let{checkout:p,isLoading:g,showWatermark:f}=mc({resourceId:i,planId:a,billingCountryCode:l,onMockCheckoutState:c}),h=p!=null&&p.configuration?Cs(p.configuration):{typography:Jt(null,Ro)},C=v(h),b=useMemo(()=>{var E,L;let A=Ac(C,o,p==null?void 0:p.configuration),S=Bc(t),F=Pc({preferredBillingPeriod:r,plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:n!=null?n:[]}),B=cc({plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingPeriod:F.billingPeriod}),k=kc({customer:p==null?void 0:p.customer,taxPercentage:(E=s==null?void 0:s.taxDetails)==null?void 0:E.taxPercentage}),T=Sc({isLoading:g,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:S,stiggTheme:C,theme:A,progressBar:T,planStep:F,addonsStep:B,paymentStep:k,resourceId:(L=p==null?void 0:p.resource)==null?void 0:L.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:g},showWatermark:f,checkoutSuccess:false,onBeforeStepChange:y}},[r,l,p,g,u,(x=s==null?void 0:s.taxDetails)==null?void 0:x.taxPercentage,y]);return jsx(w,{componentTheme:h,children:jsx(xh,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var Ec="920px",Lc=e.div`
|
|
512
512
|
margin: auto;
|
|
513
513
|
min-height: 760px;
|
|
514
|
-
max-width: ${
|
|
514
|
+
max-width: ${Ec};
|
|
515
515
|
display: flex;
|
|
516
516
|
position: relative;
|
|
517
517
|
flex-direction: column;
|
|
@@ -528,9 +528,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
528
528
|
${oe.md} {
|
|
529
529
|
padding: 32px;
|
|
530
530
|
border-radius: 10px;
|
|
531
|
-
width: ${
|
|
531
|
+
width: ${Ec};
|
|
532
532
|
}
|
|
533
|
-
`,
|
|
533
|
+
`,Nc=e(ke)`
|
|
534
534
|
display: flex;
|
|
535
535
|
align-items: flex-start;
|
|
536
536
|
gap: 32px;
|
|
@@ -541,7 +541,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
541
541
|
${oe.md} {
|
|
542
542
|
flex-direction: row;
|
|
543
543
|
}
|
|
544
|
-
`,
|
|
544
|
+
`,Mc=e(ke)`
|
|
545
545
|
display: flex;
|
|
546
546
|
flex-direction: column;
|
|
547
547
|
gap: 0;
|
|
@@ -551,18 +551,18 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
551
551
|
${oe.md} {
|
|
552
552
|
width: auto;
|
|
553
553
|
}
|
|
554
|
-
`;var
|
|
554
|
+
`;var Uc=e(Of,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({[`&.${linearProgressClasses.root}`]:{borderRadius:e.stigg.border.radius,backgroundColor:e.stigg.palette.outlinedBorder},[`& .${linearProgressClasses.bar}`]:{backgroundColor:t?e.stigg.palette.primaryLight:e.stigg.palette.primary}})),_c=e(mu)({[`&.${buttonClasses.root}`]:{textTransform:"none",lineHeight:"inherit",justifyContent:"flex-start",padding:"8px 4px"}}),Dc=e(i,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t,$shouldFill:o})=>({circle:{stroke:t?e.stigg.palette.primaryLight:e.stigg.palette.primary,fill:o?t?e.stigg.palette.primaryLight:e.stigg.palette.primary:void 0}}));var Gc=()=>{let{progressBarState:e,setActiveStep:t,currentStep:o$1}=_e(),{widgetState:r}=D(),n=me("md"),i=useRef(),{readOnly:a,isLoadingCheckoutData:l}=r,{activeStep:s,completedSteps:c,steps:u}=e||{},y=(s+1)*100/u.length,[p,g]=gi.useState(o$1);return useEffect(()=>{n||i.current&&o$1!==p&&i.current.scrollIntoView({behavior:"smooth"}),g(o$1);},[o$1,n,p,g]),e.steps.length===1?null:jsxs(ke,{className:"stigg-checkout-progress-container",sx:{width:"100%",mb:3},ref:i,children:[jsx(Uc,{variant:"determinate",value:y,$disabled:a}),jsx(Re,{container:true,display:"flex",children:u.map(({key:f$1,label:h},C)=>{let b=c.includes(C),x=a||C>s&&!b&&!c.includes(C-1)||s!==C&&e.isDisabled;return jsx(Re,{item:true,display:"flex",flexDirection:"row",flex:n?1:"auto",justifyContent:"flex-start",children:l?jsx(o,{width:120,height:20,style:{marginTop:8}}):jsx(_c,{onClick:()=>t(C),fullWidth:true,disabled:x,children:jsxs(Re,{item:true,display:"flex",flexDirection:"row",alignItems:"center",gap:1,children:[jsx(Ih,{icon:jsx(Dc,{icon:b?x?"OutlinedCheckedCircleDisabled":"OutlinedCheckedCircle":"OutlinedCircle",$disabled:x,$shouldFill:b})}),jsx(f,{variant:"h6",color:x?"primary.main.light":"primary.main",children:h})]})})},f$1)})})]})};var vh=[BillingModel.FlatFee,BillingModel.PerUnit,BillingModel.UsageBased],Lh=e=>nc(e,[t=>vh.indexOf(t.pricingModel),t=>{var o;return (o=t.feature)==null?void 0:o.displayName}]),Pr=e=>useMemo(()=>Lh(e),[e]);function Nh(){let[{promotionCode:e}]=_();return e}function Mh(){let[,e]=_();return t=>e(o=>{o.promotionCode=t;})}function Ft(){return {promotionCode:Nh(),setPromotionCode:Mh()}}var Rh=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxs("g",{id:"plus",children:[jsx("path",{id:"Shape",d:"M10 4.16666V15.8333",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{id:"Shape_2",d:"M4.16699 10H15.8337",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})})),xr=Rh;var _h=e(xr,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
555
555
|
margin-right: 8px;
|
|
556
556
|
path {
|
|
557
557
|
stroke: ${({theme:e,$disabled:t})=>t?e.stigg.palette.text.disabled:e.stigg.palette.primary};
|
|
558
558
|
}
|
|
559
|
-
`,
|
|
559
|
+
`,Vc=({onAddClick:e,checkoutLocalization:t,disabled:o})=>jsxs(te,{disabled:o,fullWidth:true,className:"stigg-checkout-summary-add-coupon-code-button",sx:{textTransform:"none",justifyContent:"flex-start",color:o?"text.disabled":"primary.main"},variant:"text",size:"medium",onClick:e,children:[jsx(_h,{$disabled:o,className:"stigg-checkout-summary-add-coupon-code-button-icon"}),jsx(f,{className:"stigg-checkout-change-plan-button-text",color:o?"disabled":"primary.main",style:{lineHeight:"24px"},variant:"h3",children:t.summary.addCouponCodeText})]});var Vh=e(te)`
|
|
560
560
|
padding: 4px 10px;
|
|
561
561
|
min-width: unset;
|
|
562
562
|
border-radius: ${({theme:e})=>e.stigg.border.radius};
|
|
563
563
|
display: flex;
|
|
564
564
|
align-items: center;
|
|
565
|
-
`,
|
|
565
|
+
`,Oc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=Ft(),[n,i$1]=useState(false),[a,l]=gi.useState(""),[s,c]=gi.useState(false),[u,y]=gi.useState(""),{previewSubscriptionAction:p}=si({onMockCheckoutPreview:o}),g=()=>d(null,null,function*(){var C;c(true),y("");let{subscriptionPreview:f,errorMessage:h}=yield p({promotionCode:a});!h&&((C=f==null?void 0:f.immediateInvoice)!=null&&C.discountDetails)?(r(a.toUpperCase()),i$1(false)):h&&y(h),c(false);});return n?jsxs(Re,{children:[jsx(f,{variant:"body1",color:u?"error":e?"disabled":"primary.main",children:t.summary.couponCodeTitle}),jsx(pe,{disabled:e,autoFocus:true,variant:"outlined",fullWidth:true,error:!!u,value:a,onChange:f=>{l(f.target.value);},inputProps:{maxLength:20},onKeyDown:f=>{f.key==="Enter"&&(g(),f.preventDefault());},InputProps:{endAdornment:jsx(Vh,{variant:"contained",disabled:e,onClick:()=>{g();},children:s?jsx(Gh,{size:18,sx:{color:"white"}}):jsx(i,{style:{display:"flex"},icon:"ArrowForward"})})}}),!!u&&jsx(f,{variant:"body1",color:"error",children:u})]}):jsx(Vc,{disabled:e,onAddClick:()=>i$1(true),checkoutLocalization:t})};var Hh=e(Re)`
|
|
566
566
|
width: auto;
|
|
567
567
|
display: inline-flex;
|
|
568
568
|
align-items: center;
|
|
@@ -571,7 +571,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
571
571
|
padding: 6px 8px;
|
|
572
572
|
border-radius: ${({theme:e})=>e.stigg.border.radius};
|
|
573
573
|
border: 1px solid ${({theme:e})=>e.stigg.palette.primary};
|
|
574
|
-
`,
|
|
574
|
+
`,Hc=e(i,{shouldForwardProp:e=>e!=="style"})`
|
|
575
575
|
display: flex;
|
|
576
576
|
|
|
577
577
|
g {
|
|
@@ -581,16 +581,16 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
581
581
|
path {
|
|
582
582
|
fill: ${({theme:e,$shouldFill:t})=>t?e.stigg.palette.primary:void 0};
|
|
583
583
|
}
|
|
584
|
-
`,
|
|
584
|
+
`,Zc=({promotionCode:e,onClearPromotionCode:t})=>jsxs(Hh,{container:true,children:[jsxs(Re,{item:true,display:"flex",gap:1,alignItems:"center",children:[jsx(Hc,{icon:"Coupon"}),jsx(f,{variant:"body1",color:"primary.main",lineHeight:"auto",children:e})]}),jsx(Re,{item:true,children:jsx(te,{variant:"text",sx:{minWidth:"unset",padding:0},onClick:t,children:jsx(Hc,{icon:"Close",$shouldFill:true})})})]});var Wh=e.div`
|
|
585
585
|
margin: 16px 0;
|
|
586
|
-
`,Uc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=wt();return jsx(Ah,{children:r?jsx(Rc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsx(Lc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var _c=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:a})=>jsx(Ih,{onClick:r,value:n,control:jsx(Bh,{checked:t,onChange:o,disabled:i,"data-testid":a}),label:Fh(e)?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var pi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:BS,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:IS$1,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:RS$1,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:US,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:ZW,example:"1234567890"}],fx="United States",yx=" # ",pr="us_ein",mr=(e,t)=>`${e}${yx}${t}`,mi=new Map(pi.map(e=>[mr(e.taxIdType,e.country),e])),Bt=e=>mi.get(e),ur=mr(pr,fx);var ui=e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var bx=e(hx)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),gr=e(f)({});gr.defaultProps={variant:"body1",color:"secondary"};function od(){let[e,t]=useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,a$1]=useState(ur),[l,s]=useState(false),d=useCallback((g,y,C)=>{n({type:y,value:C}),a$1(g);},[n,a$1]);useEffect(()=>{s(false);},[o==null?void 0:o.country]),useEffect(()=>{if(!(o!=null&&o.country)||l||!e)return;let g=pi.find(y=>y.countryCode===o.country);g&&d(mr(g.taxIdType,g.country),g.taxIdType,"");},[o,e,l,d]);let u=g=>{if(!g)return;let y=Bt(g);if(y){if(s(true),r!=null&&r.value){d(g,y.taxIdType,r.value);return}a$1(g),r!=null&&r.type&&n(void 0);}},f$1=useMemo(()=>Array.from(mi.keys()),[]),m=useMemo(()=>f$1.find(g=>g===i)||null,[f$1,i]),h=useMemo(()=>{let g=Bt(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return useEffect(()=>(e||(s(false),d(ur,pr,"")),()=>{d(ur,pr,"");}),[e,d]),jsxs(Ne,{flexDirection:"column",container:true,gap:2,children:[jsx(Ne,{flexDirection:"row",container:true,gap:2,children:jsx(_c,{checked:e,onChange:()=>t(g=>!g),label:jsx(gr,{children:"I'm purchasing as a business"})})}),jsx(Cx,{in:e,children:jsxs(Ne,{container:true,spacing:0,sx:{width:"100%"},children:[jsxs(Ne,{item:true,xs:6,children:[jsx(gr,{children:"Tax ID Type"}),jsx(bx,{fullWidth:true,options:f$1,value:m,onChange:(g,y)=>u(y),renderInput:g=>jsx(ui,b(a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=Bt(y);if(!C)return null;let{taxIdType:b$1,country:P,FlagComponent:S}=C;return createElement(ou,b(a({},g),{key:y}),jsxs(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),ed(P)," - ",td(b$1)]}))},getOptionLabel:g=>{let y=Bt(g);return y?`${ed(y.country)} - ${td(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxs(Ne,{item:true,xs:6,paddingLeft:"12px",children:[jsx(gr,{children:"Tax ID"}),jsx(ui,{id:"tax-id-value",placeholder:h,type:"text",fullWidth:true,value:(r==null?void 0:r.value)||"",onChange:g=>{let y=Bt(i);y&&d(i,y.taxIdType,g.target.value);}})]})]})})]})}function rd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o}){var g;let{checkoutState:r,checkoutLocalization:n,widgetState:i,setWidgetReadOnly:a$1}=U(),{setBillingAddress:l}=re(),{customer:s,configuration:d$1}=r||{},{readOnly:u}=i,f$1=!!(t!=null?t:(g=d$1==null?void 0:d$1.content)!=null&&g.collectPhoneNumber),m=useMemo(()=>o&&!(s!=null&&s.billingId)&&!(s!=null&&s.paymentMethodDetails),[o,s==null?void 0:s.billingId,s==null?void 0:s.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=c(S,["postal_code"]),P=a({postalCode:C},b);a$1(true),l(P),e?d(null,null,function*(){yield e({billingAddress:P}),a$1(false);}):a$1(false);};return jsxs(Ne,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxs(Ne,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsx(AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f$1?"always":"auto"},defaultValues:a({},(s==null?void 0:s.name)&&{name:s.name})}})]}),jsxs(Ne,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsx(PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:a(a({},(s==null?void 0:s.name)&&{name:s.name}),(s==null?void 0:s.email)&&{email:s.email})}}})]}),m&&jsx(od,{})]})}function nd(){let[e,t]=useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return useEffect(()=>{if(r){let{billingIdentifier:i,credentials:a}=r;if(i!==BillingVendorIdentifier.Stripe)return;let{accountId:l,publicKey:s}=a;if(!l||!s){console.error("Stripe account ID or public key is missing");return}import('@stripe/stripe-js').then(({loadStripe:d})=>{t(d(s,{stripeAccount:l}));});}},[r]),{stripePromise:e,setupIntentClientSecret:n}}function fr(){let e=kt(),[{resourceId:t}]=R(),{checkoutState:o}=U(),{plan:r}=o||{},n=e.addons.map(({addon:i,quantity:a})=>({addonId:i.id,quantity:a}));if(r!=null&&r.id)return a({resourceId:t,planId:r.id,billingPeriod:e.billingPeriod,billableFeatures:e.billableFeatures,addons:n,promotionCode:e.promotionCode,billingCountryCode:e.billingCountryCode},sr({billingAddress:e.billingAddress,taxIds:e.taxId?[e.taxId]:void 0}))}var Fx=[PaymentCollection.Failed,PaymentCollection.Processing];function Ex(t){return d(this,arguments,function*({elements:e}){if(!e){let r="Stripe elements not initialized";return console.error(r),{success:false,errorMessage:r}}let{error:o}=yield e.submit();return o?(console.log(o.message),{success:false,errorMessage:o.message||""}):{success:true}})}function Pi(o){return d(this,arguments,function*({applySubscriptionResults:e,stripe:t}){var a,l;let r=e==null?void 0:e.subscription,n=(a=r==null?void 0:r.latestInvoice)==null?void 0:a.paymentSecret,i=r==null?void 0:r.paymentCollection;if(t&&n&&i===PaymentCollection.ActionRequired){let{error:s}=yield t.handleNextAction({clientSecret:n});if(s)return {errorMessage:s.message||""}}else if(i&&Fx.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 vx(r){return d(this,arguments,function*({stripe:e,elements:t,clientSecret:o}){let n,i,{error:a}=yield e.confirmSetup({elements:t,confirmParams:{return_url:window.location.href},redirect:"if_required"});if(a)a.type==="card_error"||a.type==="validation_error"?a.type==="card_error"&&(i=a.message||""):i="An unexpected error occurred.";else try{let{setupIntent:l}=yield e.retrieveSetupIntent(o);l!=null&&l.payment_method&&(n=l.payment_method);}catch(l){i="An unexpected error occurred.",console.error(l);}return {newPaymentMethodId:n,setupErrorMessage:i}})}function id(r){return d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield Ex({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:a}=yield vx({stripe:e,elements:t,clientSecret:o});return a||!i?{success:false,errorMessage:a}:{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 yr=5e3,_x=e(Te)`
|
|
586
|
+
`,Yc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Ft();return jsx(Wh,{children:r?jsx(Zc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsx(Oc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var Qc=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:a})=>jsx(Yh,{onClick:r,value:n,control:jsx(Zh,{checked:t,onChange:o,disabled:i,"data-testid":a}),label:Qh(e)?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:e}):e});var xi=[{country:"Albania",countryCode:"AL",taxIdType:"al_tin",FlagComponent:AL,example:"J12345678N"},{country:"Andorra",countryCode:"AD",taxIdType:"ad_nrt",FlagComponent:AD,example:"A-123456-Z"},{country:"Angola",countryCode:"AO",taxIdType:"ao_tin",FlagComponent:AO,example:"5123456789"},{country:"Argentina",countryCode:"AR",taxIdType:"ar_cuit",FlagComponent:AR,example:"12-3456789-01"},{country:"Armenia",countryCode:"AM",taxIdType:"am_tin",FlagComponent:AM,example:"02538904"},{country:"Aruba",countryCode:"AW",taxIdType:"aw_tin",FlagComponent:AW,example:"12345678"},{country:"Australia",countryCode:"AU",taxIdType:"au_abn",FlagComponent:AU,example:"12345678912"},{country:"Australia",countryCode:"AU",taxIdType:"au_arn",FlagComponent:AU,example:"123456789123"},{country:"Austria",countryCode:"AT",taxIdType:"eu_vat",FlagComponent:AT,example:"ATU12345678"},{country:"Azerbaijan",countryCode:"AZ",taxIdType:"az_tin",FlagComponent:AZ,example:"0123456789"},{country:"Bahamas",countryCode:"BS",taxIdType:"bs_tin",FlagComponent:BS,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:IS,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:JP,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:JP,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:JP,example:"T1234567891234"},{country:"Kazakhstan",countryCode:"KZ",taxIdType:"kz_bin",FlagComponent:KZ,example:"123456789012"},{country:"Kenya",countryCode:"KE",taxIdType:"ke_pin",FlagComponent:KE,example:"P000111111A"},{country:"Kyrgyzstan",countryCode:"KG",taxIdType:"kg_tin",FlagComponent:KG,example:"12345678901234"},{country:"Laos",countryCode:"LA",taxIdType:"la_tin",FlagComponent:LA,example:"123456789-000"},{country:"Latvia",countryCode:"LV",taxIdType:"eu_vat",FlagComponent:LV,example:"LV12345678912"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_uid",FlagComponent:LI,example:"CHE123456789"},{country:"Liechtenstein",countryCode:"LI",taxIdType:"li_vat",FlagComponent:LI,example:"12345"},{country:"Lithuania",countryCode:"LT",taxIdType:"eu_vat",FlagComponent:LT,example:"LT123456789123"},{country:"Luxembourg",countryCode:"LU",taxIdType:"eu_vat",FlagComponent:LU,example:"LU12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_frp",FlagComponent:MY,example:"12345678"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_itn",FlagComponent:MY,example:"C 1234567890"},{country:"Malaysia",countryCode:"MY",taxIdType:"my_sst",FlagComponent:MY,example:"A12-3456-78912345"},{country:"Malta",countryCode:"MT",taxIdType:"eu_vat",FlagComponent:MT,example:"MT12345678"},{country:"Mauritania",countryCode:"MR",taxIdType:"mr_nif",FlagComponent:MR,example:"12345678"},{country:"Mexico",countryCode:"MX",taxIdType:"mx_rfc",FlagComponent:MX,example:"ABC010203AB9"},{country:"Moldova",countryCode:"MD",taxIdType:"md_vat",FlagComponent:MD,example:"1234567"},{country:"Montenegro",countryCode:"ME",taxIdType:"me_pib",FlagComponent:ME,example:"12345678"},{country:"Morocco",countryCode:"MA",taxIdType:"ma_vat",FlagComponent:MA,example:"12345678"},{country:"Nepal",countryCode:"NP",taxIdType:"np_pan",FlagComponent:NP,example:"123456789"},{country:"Netherlands",countryCode:"NL",taxIdType:"eu_vat",FlagComponent:NL,example:"NL123456789B12"},{country:"New Zealand",countryCode:"NZ",taxIdType:"nz_gst",FlagComponent:NZ,example:"123456789"},{country:"Nigeria",countryCode:"NG",taxIdType:"ng_tin",FlagComponent:NG,example:"12345678-0001"},{country:"North Macedonia",countryCode:"MK",taxIdType:"mk_vat",FlagComponent:MK,example:"MK1234567890123"},{country:"Norway",countryCode:"NO",taxIdType:"no_vat",FlagComponent:NO,example:"123456789MVA"},{country:"Norway",countryCode:"NO",taxIdType:"no_voec",FlagComponent:NO,example:"1234567"},{country:"Oman",countryCode:"OM",taxIdType:"om_vat",FlagComponent:OM,example:"OM1234567890"},{country:"Peru",countryCode:"PE",taxIdType:"pe_ruc",FlagComponent:PE,example:"12345678901"},{country:"Philippines",countryCode:"PH",taxIdType:"ph_tin",FlagComponent:PH,example:"123456789012"},{country:"Poland",countryCode:"PL",taxIdType:"eu_vat",FlagComponent:PL,example:"PL1234567890"},{country:"Portugal",countryCode:"PT",taxIdType:"eu_vat",FlagComponent:PT,example:"PT123456789"},{country:"Romania",countryCode:"RO",taxIdType:"eu_vat",FlagComponent:RO,example:"RO1234567891"},{country:"Romania",countryCode:"RO",taxIdType:"ro_tin",FlagComponent:RO,example:"1234567890123"},{country:"Russia",countryCode:"RU",taxIdType:"ru_inn",FlagComponent:RU,example:"1234567891"},{country:"Russia",countryCode:"RU",taxIdType:"ru_kpp",FlagComponent:RU,example:"123456789"},{country:"Saudi Arabia",countryCode:"SA",taxIdType:"sa_vat",FlagComponent:SA,example:"123456789012345"},{country:"Senegal",countryCode:"SN",taxIdType:"sn_ninea",FlagComponent:SN,example:"12345672A2"},{country:"Serbia",countryCode:"RS",taxIdType:"rs_pib",FlagComponent:RS,example:"123456789"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_gst",FlagComponent:SG,example:"M12345678X"},{country:"Singapore",countryCode:"SG",taxIdType:"sg_uen",FlagComponent:SG,example:"123456789F"},{country:"Slovakia",countryCode:"SK",taxIdType:"eu_vat",FlagComponent:SK,example:"SK1234567891"},{country:"Slovenia",countryCode:"SI",taxIdType:"eu_vat",FlagComponent:SI,example:"SI12345678"},{country:"Slovenia",countryCode:"SI",taxIdType:"si_tin",FlagComponent:SI,example:"12345678"},{country:"South Africa",countryCode:"ZA",taxIdType:"za_vat",FlagComponent:ZA,example:"4123456789"},{country:"South Korea",countryCode:"KR",taxIdType:"kr_brn",FlagComponent:KR,example:"123-45-67890"},{country:"Spain",countryCode:"ES",taxIdType:"es_cif",FlagComponent:ES,example:"A12345678"},{country:"Spain",countryCode:"ES",taxIdType:"eu_vat",FlagComponent:ES,example:"ESA1234567Z"},{country:"Suriname",countryCode:"SR",taxIdType:"sr_fin",FlagComponent:SR,example:"1234567890"},{country:"Sweden",countryCode:"SE",taxIdType:"eu_vat",FlagComponent:SE,example:"SE123456789123"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_uid",FlagComponent:CH,example:"CHE-123.456.789 HR"},{country:"Switzerland",countryCode:"CH",taxIdType:"ch_vat",FlagComponent:CH,example:"CHE-123.456.789 MWST"},{country:"Taiwan",countryCode:"TW",taxIdType:"tw_vat",FlagComponent:TW,example:"12345678"},{country:"Tajikistan",countryCode:"TJ",taxIdType:"tj_tin",FlagComponent:TJ,example:"123456789"},{country:"Tanzania",countryCode:"TZ",taxIdType:"tz_vat",FlagComponent:TZ,example:"12345678A"},{country:"Thailand",countryCode:"TH",taxIdType:"th_vat",FlagComponent:TH,example:"1234567891234"},{country:"Turkey",countryCode:"TR",taxIdType:"tr_tin",FlagComponent:TR,example:"0123456789"},{country:"Uganda",countryCode:"UG",taxIdType:"ug_tin",FlagComponent:UG,example:"1014751879"},{country:"Ukraine",countryCode:"UA",taxIdType:"ua_vat",FlagComponent:UA,example:"123456789"},{country:"United Arab Emirates",countryCode:"AE",taxIdType:"ae_trn",FlagComponent:AE,example:"123456789012345"},{country:"United Kingdom",countryCode:"GB",taxIdType:"eu_vat",FlagComponent:GB,example:"XI123456789"},{country:"United Kingdom",countryCode:"GB",taxIdType:"gb_vat",FlagComponent:GB,example:"GB123456789"},{country:"United States",countryCode:"US",taxIdType:"us_ein",FlagComponent:US,example:"12-3456789"},{country:"Uruguay",countryCode:"UY",taxIdType:"uy_ruc",FlagComponent:UY,example:"123456789012"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_tin",FlagComponent:UZ,example:"123456789"},{country:"Uzbekistan",countryCode:"UZ",taxIdType:"uz_vat",FlagComponent:UZ,example:"123456789012"},{country:"Venezuela",countryCode:"VE",taxIdType:"ve_rif",FlagComponent:VE,example:"A-12345678-9"},{country:"Vietnam",countryCode:"VN",taxIdType:"vn_tin",FlagComponent:VN,example:"1234567890"},{country:"Zambia",countryCode:"ZM",taxIdType:"zm_tin",FlagComponent:ZM,example:"1004751879"},{country:"Zimbabwe",countryCode:"ZW",taxIdType:"zw_tin",FlagComponent:ZW,example:"1234567890"}],MP="United States",RP=" # ",br="us_ein",Sr=(e,t)=>`${e}${RP}${t}`,bi=new Map(xi.map(e=>[Sr(e.taxIdType,e.country),e])),vt=e=>bi.get(e),Tr=Sr(br,MP);var Si=e(pe)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var GP=e(UP)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),kr=e(f)({});kr.defaultProps={variant:"body1",color:"secondary"};function ud(){let[e,t]=useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,a$1]=useState(Tr),[l,s]=useState(false),c=useCallback((f,h,C)=>{n({type:h,value:C}),a$1(f);},[n,a$1]);useEffect(()=>{s(false);},[o==null?void 0:o.country]),useEffect(()=>{if(!(o!=null&&o.country)||l||!e)return;let f=xi.find(h=>h.countryCode===o.country);f&&c(Sr(f.taxIdType,f.country),f.taxIdType,"");},[o,e,l,c]);let u=f=>{if(!f)return;let h=vt(f);if(h){if(s(true),r!=null&&r.value){c(f,h.taxIdType,r.value);return}a$1(f),r!=null&&r.type&&n(void 0);}},y=useMemo(()=>Array.from(bi.keys()),[]),p=useMemo(()=>y.find(f=>f===i)||null,[y,i]),g=useMemo(()=>{let f=vt(i);return (f==null?void 0:f.example)||"Add your VAT/GST or local tax ID."},[i]);return useEffect(()=>(e||(s(false),c(Tr,br,"")),()=>{c(Tr,br,"");}),[e,c]),jsxs(Re,{flexDirection:"column",container:true,gap:2,children:[jsx(Re,{flexDirection:"row",container:true,gap:2,children:jsx(Qc,{checked:e,onChange:()=>t(f=>!f),label:jsx(kr,{children:"I'm purchasing as a business"})})}),jsx(_P,{in:e,children:jsxs(Re,{container:true,spacing:0,sx:{width:"100%"},children:[jsxs(Re,{item:true,xs:6,children:[jsx(kr,{children:"Tax ID Type"}),jsx(GP,{fullWidth:true,options:y,value:p,onChange:(f,h)=>u(h),renderInput:f=>jsx(Si,b(a({},f),{id:"id-type",InputProps:f.InputProps})),renderOption:(f$1,h)=>{let C=vt(h);if(!C)return null;let{taxIdType:b$1,country:x,FlagComponent:A}=C;return createElement(bu,b(a({},f$1),{key:h}),jsxs(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[A&&jsx(A,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),pd(x)," - ",md(b$1)]}))},getOptionLabel:f=>{let h=vt(f);return h?`${pd(h.country)} - ${md(h.taxIdType)}`:f},ListboxProps:{sx:{maxHeight:200}}})]}),jsxs(Re,{item:true,xs:6,paddingLeft:"12px",children:[jsx(kr,{children:"Tax ID"}),jsx(Si,{id:"tax-id-value",placeholder:g,type:"text",fullWidth:true,value:(r==null?void 0:r.value)||"",onChange:f=>{let h=vt(i);h&&c(i,h.taxIdType,f.target.value);}})]})]})})]})}function gd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o}){var f$1;let{checkoutState:r,checkoutLocalization:n,widgetState:i,setWidgetReadOnly:a$1}=D(),{setBillingAddress:l}=re(),{customer:s,configuration:c$1}=r||{},{readOnly:u}=i,y=!!(t!=null?t:(f$1=c$1==null?void 0:c$1.content)!=null&&f$1.collectPhoneNumber),p=useMemo(()=>o&&!(s!=null&&s.billingId)&&!(s!=null&&s.paymentMethodDetails),[o,s==null?void 0:s.billingId,s==null?void 0:s.paymentMethodDetails]),g=h=>{if(!h.complete)return;let A=h.value.address,{postal_code:C}=A,b=c(A,["postal_code"]),x=a({postalCode:C},b);a$1(true),l(x),e?d(null,null,function*(){yield e({billingAddress:x}),a$1(false);}):a$1(false);};return jsxs(Re,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxs(Re,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsx(AddressElement,{onChange:g,options:{mode:"billing",fields:{phone:y?"always":"auto"},defaultValues:a({},(s==null?void 0:s.name)&&{name:s.name})}})]}),jsxs(Re,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsx(PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:a(a({},(s==null?void 0:s.name)&&{name:s.name}),(s==null?void 0:s.email)&&{email:s.email})}}})]}),p&&jsx(ud,{})]})}function fd(){let[e,t]=useState(null),{checkoutState:o}=D(),{billingIntegration:r,setupSecret:n}=o||{};return useEffect(()=>{if(r){let{billingIdentifier:i,credentials:a}=r;if(i!==BillingVendorIdentifier.Stripe)return;let{accountId:l,publicKey:s}=a;if(!l||!s){console.error("Stripe account ID or public key is missing");return}import('@stripe/stripe-js').then(({loadStripe:c})=>{t(c(s,{stripeAccount:l}));});}},[r]),{stripePromise:e,setupIntentClientSecret:n}}function wr(){let e=It(),[{resourceId:t}]=_(),{checkoutState:o}=D(),{plan:r}=o||{},n=e.addons.map(({addon:i,quantity:a})=>({addonId:i.id,quantity:a}));if(r!=null&&r.id)return a({resourceId:t,planId:r.id,billingPeriod:e.billingPeriod,billableFeatures:e.billableFeatures,addons:n,promotionCode:e.promotionCode,billingCountryCode:e.billingCountryCode},hr({billingAddress:e.billingAddress,taxIds:e.taxId?[e.taxId]:void 0}))}var QP=[PaymentCollection.Failed,PaymentCollection.Processing];function KP(t){return d(this,arguments,function*({elements:e}){if(!e){let r="Stripe elements not initialized";return console.error(r),{success:false,errorMessage:r}}let{error:o}=yield e.submit();return o?(console.log(o.message),{success:false,errorMessage:o.message||""}):{success:true}})}function Fi(o){return d(this,arguments,function*({applySubscriptionResults:e,stripe:t}){var a,l;let r=e==null?void 0:e.subscription,n=(a=r==null?void 0:r.latestInvoice)==null?void 0:a.paymentSecret,i=r==null?void 0:r.paymentCollection;if(t&&n&&i===PaymentCollection.ActionRequired){let{error:s}=yield t.handleNextAction({clientSecret:n});if(s)return {errorMessage:s.message||""}}else if(i&&QP.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 qP(r){return d(this,arguments,function*({stripe:e,elements:t,clientSecret:o}){let n,i,{error:a}=yield e.confirmSetup({elements:t,confirmParams:{return_url:window.location.href},redirect:"if_required"});if(a)a.type==="card_error"||a.type==="validation_error"?a.type==="card_error"&&(i=a.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 yd(r){return d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield KP({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:a}=yield qP({stripe:e,elements:t,clientSecret:o});return a||!i?{success:false,errorMessage:a}:{success:true,paymentMethodId:i}})}var hd={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 Br=5e3,ox=e(ke)`
|
|
587
587
|
@keyframes blurFade {
|
|
588
588
|
0% {
|
|
589
|
-
background-color: ${({theme:e})=>
|
|
589
|
+
background-color: ${({theme:e})=>Ei(e.stigg.palette.backgroundPaper).alpha(0).toString()};
|
|
590
590
|
backdrop-filter: blur(0px);
|
|
591
591
|
}
|
|
592
592
|
100% {
|
|
593
|
-
background-color: ${({theme:e})=>
|
|
593
|
+
background-color: ${({theme:e})=>Ei(e.stigg.palette.backgroundPaper).alpha(.9).toString()};
|
|
594
594
|
backdrop-filter: blur(6.5px);
|
|
595
595
|
}
|
|
596
596
|
}
|
|
@@ -601,7 +601,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
601
601
|
bottom: 0;
|
|
602
602
|
right: 0;
|
|
603
603
|
z-index: 5;
|
|
604
|
-
background-color: ${({theme:e})=>
|
|
604
|
+
background-color: ${({theme:e})=>Ei(e.stigg.palette.backgroundPaper).alpha(.9).toString()};
|
|
605
605
|
animation: blurFade 2s ease-in forwards;
|
|
606
606
|
display: flex;
|
|
607
607
|
flex-direction: column;
|
|
@@ -614,7 +614,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
614
614
|
& path {
|
|
615
615
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
616
616
|
}
|
|
617
|
-
`,
|
|
617
|
+
`,rx=e(f)`
|
|
618
618
|
@keyframes fadeIn {
|
|
619
619
|
0% {
|
|
620
620
|
opacity: 0;
|
|
@@ -629,19 +629,19 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
629
629
|
|
|
630
630
|
align-self: center;
|
|
631
631
|
animation: fadeIn 5s ease-in forwards;
|
|
632
|
-
`;function
|
|
632
|
+
`;function Pd({checkoutLocalization:e}){let t=useRef();return useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxs(ox,{className:"stigg-checkout-success-container",ref:t,children:[jsx(tx,{options:{animationData:hd,loop:false,autoplay:true},width:350,height:"auto",style:{display:"flex",justifyContent:"center"}}),jsx(rx,{variant:"h1",color:"primary.main",children:e.summary.checkoutSuccessText})]})}var sx=e=>new Promise(t=>setTimeout(t,e));function xd({isMocked:e=false,onCheckout:t,onCheckoutCompleted:o,onSuccess:r,disableSuccessAnimation:n}){let{stigg:i}=u(),{useNewPaymentMethod:a$1}=re(),l=wr(),{checkoutState:s,widgetState:c,setWidgetReadOnly:u$1}=D(),{setupSecret:y,customer:p}=s||{},g=useStripe(),f=useElements();return {handleSubmit:C=>d(null,null,function*(){if(C.preventDefault(),!l)return {success:false,errorMessage:"Unexpected error, please contact support."};let b$1=true,x,A=false,S;if(u$1(true),!e&&a$1){let T=yield yd({elements:f,stripe:g,setupIntentClientSecret:y});T.success?S=T.paymentMethodId:(x=T.errorMessage,b$1=false);}let F=b(a({},l),{paymentMethodId:S}),B=T=>d(null,null,function*(){A=true;try{let I=yield i.applySubscription(T),E=yield Fi({applySubscriptionResults:I,stripe:g});return {success:!E.errorMessage,errorMessage:E.errorMessage,results:I}}catch(I){return console.error(I),x=I==null?void 0:I.message,{success:false,errorMessage:x}}}),k;if(b$1)if(t){let T=yield t({customerId:p.id,checkoutParams:F,checkoutAction:B});if(T.errorMessage&&(x=T.errorMessage),!A&&T.results&&T.success){let I=yield Fi({applySubscriptionResults:T.results,stripe:g});I.errorMessage&&(x=I.errorMessage,b$1=false);}b$1=b$1&&T.success&&!x,k=T.results;}else {let T=yield B(F);!T.success&&T.errorMessage&&(x=T.errorMessage),b$1=T.success&&!x,k=T.results;}return u$1(false),b$1&&r&&(r(),n||(yield sx(Br))),yield o({success:b$1,error:x}),{results:k,success:!x,errorMessage:x}}),isLoading:!!(c!=null&&c.readOnly)}}function bd(){return !!window.Zuora}function Sd(){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 Td(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 Lt(){let{stigg:e}=u(),{setErrorMessage:t}=re(),{billingCountryCode:o}=be(),[r,n]=useState(false),{checkoutState:i}=D(),{billingIntegration:a}=i||{},l=useCallback(()=>d(null,null,function*(){if(!(i!=null&&i.customer.id)||!(i!=null&&i.plan.id))throw new Error("Customer and plan are required");let{token:u}=yield e.createPaymentSession({planId:i.plan.id,billingCountryCode:o});return u}),[i,e,o]),s=useCallback(()=>{try{bd()||Sd(),n(!0);}catch(u){t("Failed to initialize Zuora");}},[n,t]);return useEffect(()=>{if(a){let{billingIdentifier:u}=a;u===BillingVendorIdentifier.Zuora&&s();}},[a,s]),{isZuoraIntegration:(a==null?void 0:a.billingIdentifier)===BillingVendorIdentifier.Zuora,isInitialized:r,createPaymentSession:l}}var px=e=>new Promise(t=>setTimeout(t,e));function Ar({onCheckout:e,onCheckoutCompleted:t,onSuccess:o,disableSuccessAnimation:r}){let{stigg:n}=u(),i=wr(),{checkoutState:a$1,setWidgetReadOnly:l,setCheckoutSuccess:s}=D(),{setErrorMessage:c}=re();return {handleZuoraSubmit:useCallback(y=>d(null,null,function*(){l(true);let p=true,g,f=i;if(!f)p=false,g="Unexpected error, please contact support.";else {let h=b(a({},f),{paymentMethodId:y}),C=b=>d(null,null,function*(){try{return {success:!0,results:yield n.applySubscription(b)}}catch(x){return console.error(x),{success:false,errorMessage:(x==null?void 0:x.message)||"Failed to apply subscription"}}});try{if(e){let b=yield e({customerId:a$1.customer.id,checkoutParams:h,checkoutAction:C});b.errorMessage&&(g=b.errorMessage),p=p&&b.success&&!g;}else {let b=yield C(h);!b.success&&b.errorMessage&&(g=b.errorMessage),p=b.success&&!g;}}catch(b){p=false,g=b.message||"Failed to process checkout";}}return p?(s(true),o&&(o(),r||(yield px(Br)))):c(g),l(false),yield t({success:p,error:g}),{success:p,errorMessage:g}}),[n,i,a$1,e,t,o,r,l,s,c])}}var Ie=({isLoading:e,width:t=50,height:o$1=16,children:r})=>e?jsx(o,{width:t,height:o$1}):jsx(Fragment,{children:r});var gx=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{var a,l,s,c;let{immediateInvoice:r}=e||{};if(!((l=(a=r==null?void 0:r.proration)==null?void 0:a.netAmount)!=null&&l.amount)||((c=(s=r==null?void 0:r.proration)==null?void 0:s.netAmount)==null?void 0:c.amount)>=0)return null;let n=r.proration.netAmount.amount*-1,i=H({amount:n,currency:r.proration.netAmount.currency,minimumFractionDigits:2});return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-remaining-credits",children:jsx(Ie,{isLoading:t,width:"100%",children:o.summary.creditsForUnusedTimeText({credits:i})})})},fx=({subscriptionPreview:e,activeSubscription:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>{if(!(e!=null&&e.hasScheduledUpdates)||!(t!=null&&t.currentBillingPeriodEnd))return null;let{currentBillingPeriodEnd:n}=t,i=typeof r.summary.changesWillApplyAtEndOfBillingPeriod=="function"?r.summary.changesWillApplyAtEndOfBillingPeriod({billingPeriodEnd:n}):r.summary.changesWillApplyAtEndOfBillingPeriod;return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-scheduled-updates",children:jsx(Ie,{isLoading:o,width:"100%",children:i})})},yx=({subscriptionPreview:e,activeSubscription:t,plan:o,isFetchingSubscriptionPreview:r,billingPeriod:n,checkoutLocalization:i})=>{let{promotionCode:a}=Ft();if(!e)return null;let l=i.nextBillingCaption({plan:o,subscriptionPreview:e,billingPeriod:n,activeSubscription:t,promotionCode:a});return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-next-billing",children:jsx(Ie,{isLoading:r,width:"100%",children:l})})};function Ad(e){return jsxs(ke,{className:"stigg-checkout-summary-captions",children:[jsx(gx,a({},e)),jsx(fx,a({},e)),e.plan&&jsx(yx,a({},e))]})}function vi({quantity:e,totalAmount:t,pricingModel:o,billingPeriod:r,currency:n,blockSize:i,priceAmount:a,availableBillingPeriods:l}){let s=l==null?void 0:l.has(BillingPeriod.Monthly),c=o===BillingModel.PerUnit,u=i||1,y=r===BillingPeriod.Annually&&s,p=e&&(c||e>1)?`${k(e)} ${u>1?"for":"x"} `:"",g=y?" x 12 months":"",f=(a||t/e)/(y?12:1),h=H({amount:f,currency:n,minimumFractionDigits:2}),C=H({amount:t,currency:n,minimumFractionDigits:2});return `${p}${h}${g} ${g||p?` = ${C}`:""}`}function Fd(e){let{totalAmount:t,quantity:o,tiersMode:r,tiers:n,currency:i}=e;if(Ga(n)||r===TiersMode.Graduated&&!za(n,o)){let a=H({amount:t,currency:i,minimumFractionDigits:2});return `${k(o)} for ${a}`}return vi(e)}function bx(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 Fo(r)?`${k(i)} and above`:`Next ${k(i)} to ${k(r)}`}function Ed({price:e,unitQuantity:t}){let o=e.tiers||[],{checkoutState:r}=D(),n=r==null?void 0:r.plan,{breakdown:i}=Pn(o,t);return i.length===1?null:jsx(Fragment,{children:i.map(({unitQuantity:a,amount:l},s)=>jsx($e,{children:jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:bx(o,s)}),jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:vi({quantity:a,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))})})]})},s))})}var vd=e(ChevronRight)`
|
|
633
633
|
height: ${({$size:e=24})=>`${e}px`};
|
|
634
634
|
width: ${({$size:e=24})=>`${e}px`};
|
|
635
635
|
transition: all 0.2s ease-in;
|
|
636
636
|
${({$isOpen:e})=>e&&"transform: rotate(90deg)"}
|
|
637
|
-
`;var
|
|
637
|
+
`;var $e=e.div`
|
|
638
638
|
& + & {
|
|
639
639
|
margin-top: 16px;
|
|
640
640
|
}
|
|
641
|
-
`,
|
|
641
|
+
`,Nx=e.div`
|
|
642
642
|
margin-top: 16px;
|
|
643
643
|
margin-left: 16px;
|
|
644
|
-
`,
|
|
644
|
+
`,Fe=e.div`
|
|
645
645
|
display: flex;
|
|
646
646
|
flex-direction: column;
|
|
647
647
|
gap: 16px;
|
|
@@ -651,28 +651,28 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
651
651
|
align-items: center;
|
|
652
652
|
justify-content: space-between;
|
|
653
653
|
}
|
|
654
|
-
`,
|
|
654
|
+
`,Mx=({checkoutLocalization:e})=>{let t=jsx(f,{variant:"body1",children:e.summary.payAsYouGoTooltipText});return jsx(We,{placement:"left",title:t,children:jsx(i,{icon:"PayAsYouGoCharge",style:{display:"flex"}})})},Er=({checkoutLocalization:e,label:t,quantity:o,price:r})=>{let{checkoutState:n}=D(),i=n==null?void 0:n.plan,a=me("lg"),[l,s]=useState(false),c=()=>s(h=>!h),u=r.pricingModel===BillingModel.UsageBased,y=r.isTieredPrice?xt(r,o):(r.amount||0)*Math.ceil(o/(r.blockSize||1)),p;r.tiersMode===TiersMode.Graduated&&!!r.tiers&&!Wg(r.tiers)&&!Fo(r.tiers[0].upTo)&&o>r.tiers[0].upTo&&(p=jsx(Ed,{price:r,unitQuantity:o}));let f$1=jsx(f,{variant:"body1",color:"secondary",children:t});return p&&(f$1=jsx(Df,{onClick:c,underline:"none",style:{cursor:"pointer"},children:f$1})),jsxs($e,{className:"stigg-checkout-summary-base-charges-container",children:[jsxs(Fe,{style:{alignItems:"flex-start"},children:[jsxs(Re,{item:true,display:"flex",gap:.5,style:{whiteSpace:a?"nowrap":"break-spaces"},children:[f$1,p&&jsx(vx,{onClick:c,sx:{padding:0},children:jsx(vd,{$isOpen:l,$size:16})})]}),jsxs(Re,{item:true,display:"flex",gap:1,alignItems:"center",children:[u&&jsx(Mx,{checkoutLocalization:e}),jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:a?"nowrap":"break-spaces"},children:[Fd({totalAmount:y,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(h=>h.billingPeriod))}),u&&" / unit"]})]})]}),p&&jsx(_P,{in:l,children:jsx(Nx,{children:p})})]})},Ld=({label:e})=>jsx($e,{children:jsxs(Fe,{style:{alignItems:"flex-end"},children:[jsx(Re,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:e})}),jsx(Re,{item:true,display:"flex",gap:1,alignItems:"center",children:jsx(f,{variant:"body1",color:"secondary",style:{wordBreak:"break-word"},children:"Free"})})]})}),Nd=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o$1})=>{let{immediateInvoice:r,recurringInvoice:n}=e,{discount:i,discountDetails:a}=n||{};return !i||!a?null:jsx($e,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:o$1.summary.discountText({discountDetails:a,currency:r.total.currency})}),jsx(f,{variant:"body1",color:"secondary",children:t?jsx(o,{width:50,height:16}):H({amount:i.amount,currency:i.currency,minimumFractionDigits:2})})]})})},Md=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{let{immediateInvoice:r}=e||{},{credits:n}=r||{};return !n||!n.used||n.used.amount<=0?null:jsx($e,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:o.summary.appliedCreditsTitle}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:t,children:H({amount:-1*n.used.amount,currency:n.used.currency,minimumFractionDigits:2})})})]})})},Rd=({tax:e,taxDetails:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>!t||!e||(e==null?void 0:e.amount)<=0?null:jsx($e,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:r.summary.taxTitle({taxDetails:t})}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:o,children:H({amount:e==null?void 0:e.amount,currency:e==null?void 0:e.currency,minimumFractionDigits:2})})})]})});var Mi=e(ke)`
|
|
655
655
|
width: 100%;
|
|
656
656
|
max-width: 470px;
|
|
657
657
|
flex: 1.5;
|
|
658
|
-
`,
|
|
658
|
+
`,vr=e(Gx)`
|
|
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
|
-
`;
|
|
665
|
+
`;vr.defaultProps={elevation:0};var Vx=e(f)`
|
|
666
666
|
margin-bottom: 16px;
|
|
667
667
|
font-weight: 500;
|
|
668
|
-
`,
|
|
668
|
+
`,Nt=e(Fl)`
|
|
669
669
|
margin: 16px 0;
|
|
670
|
-
`,
|
|
670
|
+
`,_d=e(f)`
|
|
671
671
|
margin-bottom: 8px;
|
|
672
|
-
`;function
|
|
672
|
+
`;function Ox({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 Dd=({onCheckout:e,onCheckoutCompleted:t,disablePromotionCode:o,disableSuccessAnimation:r,isFreeDowngrade:n,onMockCheckoutPreview:i$1,showWatermark:a$1})=>{var pa,ma,ua,ga;let[l,s]=useState(false),{setErrorMessage:c,useNewPaymentMethod:u}=re(),y=_e(),p=It(),{checkoutState:g,checkoutLocalization:f$1,checkoutSuccess:h,widgetState:C}=D(),{plan:b$1,activeSubscription:x}=g||{},A=Pr(((pa=b$1==null?void 0:b$1.pricePoints)==null?void 0:pa.filter(G=>G.billingPeriod===p.billingPeriod))||[]),[S,F]=Ux(A,G=>G.pricingModel===BillingModel.FlatFee),B=S[0],k=n||y.isCheckoutComplete&&y.isLastStep,{isZuoraIntegration:T}=Lt(),I=l||h,{subscriptionPreview:E,isFetchingSubscriptionPreview:L,errorMessage:M}=Tc({onMockCheckoutPreview:i$1}),{handleSubmit:$,isLoading:R}=xd({isMocked:!!i$1,disableSuccessAnimation:r,onCheckout:e,onCheckoutCompleted:t,onSuccess:()=>{s(true),y.markStepAsCompleted(y.progressBarState.activeStep);}}),{handleZuoraSubmit:z}=Ar({onCheckout:e,onCheckoutCompleted:t,disableSuccessAnimation:r,onSuccess:()=>{y.markStepAsCompleted(y.progressBarState.activeStep);}}),K=G=>d(null,null,function*(){if(I)return;let we;T&&!u?we=yield z():we=yield $(G);let{errorMessage:ye}=we||{};ye?(c(ye),s(false)):c(void 0);}),Ve=T&&!u?C.readOnly:R,ut=G=>d(null,null,function*(){Ve||(k?yield K(G):y.goNext());}),{immediateInvoice:V,recurringInvoice:ie}=E||{},ae=!!E&&(!!(V!=null&&V.proration)||!!E.hasScheduledUpdates),Ee=!o&&!n&&!T,ho=!!(ie!=null&&ie.discountDetails)&&!n,gt=Ee||ho,sa=F.some(G=>G.pricingModel===BillingModel.UsageBased),rn=sa&&!B&&F.every(G=>G.pricingModel===BillingModel.UsageBased),la=typeof f$1.summary.baseChargeText=="function"?f$1.summary.baseChargeText({billingPeriod:p.billingPeriod}):f$1.summary.baseChargeText,ca=useMemo(()=>{var G,we;return (we=(G=p.addons)==null?void 0:G.filter(ye=>!lt(ye.addon)))!=null?we:[]},[p.addons]),da=useMemo(()=>ca.filter(G=>{var ye;return !!((ye=G.addon.pricePoints)==null?void 0:ye.find(ft=>ft.billingPeriod===p.billingPeriod))}).map(G=>{let we=G.addon.pricePoints.find(ft=>ft.billingPeriod===p.billingPeriod),ye=G.quantity&&G.quantity>0?G.quantity:1;return jsx(Er,{checkoutLocalization:f$1,label:G.addon.displayName,quantity:ye,price:we},G.addon.id)}),[ca,p.billingPeriod,f$1]);return jsxs(Mi,{className:"stigg-checkout-summary-container",children:[jsxs(vr,{children:[jsx(Vx,{variant:"h3",children:f$1.summary.title}),jsxs(Re,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:f$1.summary.planName({plan:b$1})}),jsx(Nt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),B&&jsx(Er,{checkoutLocalization:f$1,label:la,quantity:1,price:B}),!B&&n?jsx(Ld,{label:la}):null,jsx(Re,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:F.map((G,we)=>{var ft,fa,ya,ha,Ca;let ye=(ft=p.billableFeatures)==null?void 0:ft.find(fm=>{var Pa;return fm.featureId===((Pa=G.feature)==null?void 0:Pa.featureId)});return jsx(Er,{checkoutLocalization:f$1,label:Bt(((ya=G.feature)==null?void 0:ya.displayName)||"",(ha=G.feature)==null?void 0:ha.units,(Ca=G.feature)==null?void 0:Ca.unitsPlural),quantity:(ye==null?void 0:ye.quantity)||1,price:G},((fa=G.feature)==null?void 0:fa.featureId)||`usage-charge-${we}`)})}),da.length>0&&jsxs(Fragment,{children:[jsxs(Re,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:f$1.summary.addonsSectionTitle}),jsx(Nt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),da]}),!gt&&jsx(Nt,{className:"stigg-checkout-summary-divider"}),gt&&jsxs(Re,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:f$1.summary.discountsSectionTitle}),jsx(Nt,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),Ee&&jsx(Yc,{disabled:Ve||L,checkoutLocalization:f$1,onMockCheckoutPreview:i$1}),ho&&E&&jsx(Nd,{subscriptionPreview:E,isFetchingSubscriptionPreview:L,checkoutLocalization:f$1}),gt&&jsx(Nt,{className:"stigg-checkout-summary-divider"}),jsx(Rd,{tax:ie==null?void 0:ie.tax,taxDetails:ie==null?void 0:ie.taxDetails,isFetchingSubscriptionPreview:L,checkoutLocalization:f$1}),n?null:jsxs(Fragment,{children:[jsx(Fe,{style:{marginTop:16},children:jsxs(Re,{display:"flex",flexDirection:"column",container:true,children:[jsxs(Re,{item:true,display:"flex",justifyContent:"space-between",children:[jsx(f,{variant:"h6",children:f$1.summary.totalText}),jsx(f,{variant:"h6",children:jsxs(Ie,{isLoading:L,children:[rn?f$1.summary.onlyPayAsYouGoText:null,!rn&&sa?f$1.summary.startsAtText:null,rn?null:H(b(a({amount:0},ie==null?void 0:ie.total),{minimumFractionDigits:2}))]})})]}),jsx(Re,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:f$1.summary.totalBillingPeriodText({billingPeriod:p.billingPeriod})})})]})}),jsx(Nt,{className:"stigg-checkout-summary-divider"})]}),(ma=V==null?void 0:V.proration)!=null&&ma.hasProrations&&(V!=null&&V.subTotal)&&(V==null?void 0:V.subTotal.amount)>0?jsx($e,{children:jsxs(Fe,{children:[jsx(f,{variant:"body1",color:"secondary",children:f$1.summary.proratedTotalDueText}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Ie,{isLoading:L,children:H({amount:Number(((ua=V==null?void 0:V.subTotal)==null?void 0:ua.amount)||0)+Number(((ga=V==null?void 0:V.tax)==null?void 0:ga.amount)||0),currency:V==null?void 0:V.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsx(Md,{subscriptionPreview:E,isFetchingSubscriptionPreview:L,checkoutLocalization:f$1}),jsx($e,{children:jsxs(Fe,{children:[jsx(_d,{variant:"h6",children:f$1.summary.totalDueText}),jsx(_d,{variant:"h6",children:jsx(Ie,{isLoading:L,children:H(b(a({amount:0},V==null?void 0:V.total),{minimumFractionDigits:2}))})})]})}),jsx(Ad,{plan:b$1,activeSubscription:x,subscriptionPreview:E,isFetchingSubscriptionPreview:L,checkoutLocalization:f$1,billingPeriod:p.billingPeriod}),(!k||!T||T&&!u)&&jsxs(Fragment,{children:[jsx(te,{$success:I,$error:k&&n,disabled:Ve||L||y.progressBarState.isDisabled||k&&!ae||!!M,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:G=>{ut(G);},fullWidth:true,children:jsx(f,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:I?jsx(i,{icon:"Check",style:{display:"contents"}}):Ve||L?jsx(Gh,{size:20,sx:{color:"white"}}):Ox({isLastStep:k,checkoutHasChanges:ae,isFreeDowngrade:n,checkoutLocalization:f$1,isPlanUpdate:!!x&&(x==null?void 0:x.plan.id)===(b$1==null?void 0:b$1.id)})})}),M&&jsx(zx,{severity:"error",sx:{alignItems:"center",marginTop:"12px"},children:jsx(f,{overrideColor:"inherit",children:M})})]})]}),jsx(q,{source:"checkout",showWatermark:a$1,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&I&&jsx(Pd,{checkoutLocalization:f$1})]})};var $d=({showWatermark:e})=>jsxs(Mi,{children:[jsxs(vr,{children:[jsxs(l,{$flexDirection:"column",$gap:24,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsxs(l,{$flexDirection:"column",$gap:24,marginTop:5,children:[jsx(o,{height:20}),jsx(o,{height:20}),jsx(o,{height:20})]}),jsx(n,{flex:1,marginTop:5,children:jsx(o,{height:34})})]}),jsx(q,{source:"checkout",showWatermark:e,style:{marginTop:8,display:"flex",justifyContent:"center"}})]});var zd=e(Re)`
|
|
673
673
|
width: 100%;
|
|
674
674
|
gap: 8px;
|
|
675
|
-
`,
|
|
675
|
+
`,Vd=e(Re)`
|
|
676
676
|
display: flex;
|
|
677
677
|
flex-direction: column;
|
|
678
678
|
gap: 16px;
|
|
@@ -687,51 +687,51 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
687
687
|
padding-top: 16px;
|
|
688
688
|
padding-bottom: 16px;
|
|
689
689
|
}
|
|
690
|
-
`,
|
|
690
|
+
`,Od=e(te)`
|
|
691
691
|
min-width: unset;
|
|
692
692
|
width: 41px;
|
|
693
693
|
height: 41px;
|
|
694
694
|
padding: 0;
|
|
695
|
-
`;var
|
|
695
|
+
`;var Wx=styled(Re)`
|
|
696
696
|
display: flex;
|
|
697
697
|
flex-direction: row;
|
|
698
698
|
align-items: center;
|
|
699
699
|
width: 100%;
|
|
700
700
|
justify-content: flex-end;
|
|
701
|
-
`;function
|
|
701
|
+
`;function Zd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i$1,handleQuantityChange:a,handleUndo:l,handleRemoveAddon:s}){var p;let c=me("lg"),u=!!t,y=e.maxQuantity!==1;return jsxs(Wx,{item:true,sx:{gap:"16px"},container:!c,children:[o&&jsx(te,{variant:"text",size:"small",sx:{padding:"8px",minWidth:"unset"},onClick:l,children:jsx(f,{color:"primary.main",variant:"body1",children:"Undo"})}),u&&jsxs(Re,{sx:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[y&&jsx(pe,{id:`${e.id}-input`,type:"number",onWheel:bt,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:g=>{var f,h;return a((f=g==null?void 0:g.target)!=null&&f.value?Number((h=g==null?void 0:g.target)==null?void 0:h.value):null)},onFocus:g=>g.target.select()}),jsx(Od,{color:"error",onClick:s,children:jsx(i,{icon:"Trash",style:{display:"flex",padding:"8px"}})})]}),!u&&jsx(te,{sx:{paddingX:"22px",paddingY:"8px"},onClick:()=>a(1),disabled:!n,children:jsx(f,{color:n?"primary.main":"disabled",variant:"body1",children:i$1.addAddonText})})]})}var Qx=e(Re)`
|
|
702
702
|
display: flex;
|
|
703
703
|
flex-direction: column;
|
|
704
704
|
justify-content: center;
|
|
705
705
|
width: 100%;
|
|
706
706
|
height: 42px;
|
|
707
|
-
`;function
|
|
707
|
+
`;function Yd({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxs(Qx,{item:true,children:[jsx(f,{variant:"h6",lineHeight:"24px",children:e.displayName}),r?jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:`${H({amount:r.amount,currency:r.currency,minimumFractionDigits:2})}/${t===BillingPeriod.Annually?"year":"month"}`}):jsx(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:o.addonBillingPeriodNotAvailableText({planBillingPeriod:t})})]})}function Jx({addon:e,billingPeriod:t,addonState:o,initialAddonState:r,setAddon:n,removeAddon:i,checkoutLocalization:a,onAddonsValidationChange:l,onAddonChange:s}){let[c,u]=useState(void 0),y=!!o&&!!r&&o.quantity!==r.quantity||!!r&&!o,p=e.pricePoints.some(C=>C.billingPeriod===t),g=C=>d(null,null,function*(){if(!C||C<=0){l({addonId:e.id,isValid:false}),u("Minimum 1"),n(e,C!=null?C:null);return}let b=yield s==null?void 0:s({addon:e,quantity:C});u(b==null?void 0:b.errorMessage),l({addonId:e.id,isValid:!(b!=null&&b.disableNextStep)}),n(e,C);}),f=()=>d(null,null,function*(){yield s==null?void 0:s({addon:e,quantity:0}),i(e.id),l({addonId:e.id,isValid:true});});return jsxs(Vd,{children:[jsx(Yd,{addon:e,billingPeriod:t,checkoutLocalization:a}),jsx(Zd,{addon:e,addonState:o,hasChanges:y,handleUndo:()=>d(null,null,function*(){if(r){let C=yield s==null?void 0:s({addon:e,quantity:r.quantity});l({addonId:e.id,isValid:!(C!=null&&C.disableNextStep)}),n(e,r.quantity);}else yield f();l({addonId:e.id,isValid:true});}),errorMessage:c,handleQuantityChange:g,isPriceForBillingPeriodAvailable:p,checkoutLocalization:a,handleRemoveAddon:f})]})}function Kd({onAddonChange:e}){let{checkoutLocalization:t,setIsValid:o}=D(),{billingPeriod:r}=be(),{setIsDisabled:n}=_e(),{initialAddons:i,addons:a$1,availableAddons:l,setAddon:s,removeAddon:c}=dc(),[u,y]=useState((l==null?void 0:l.reduce((p,g)=>(p[g.id]=true,p),{}))||{});return useEffect(()=>{let p=Object.values(u).some(g=>!g);n(p),o(!p);},[u,n,o]),jsx(zd,{container:true,children:l==null?void 0:l.map(p=>{let g=a$1.find(h=>h.addon.id===p.id),f=i==null?void 0:i.find(h=>h.addon.id===p.id);return jsx(Jx,{addon:p,billingPeriod:r,addonState:g,initialAddonState:f,setAddon:s,removeAddon:c,checkoutLocalization:t,onAddonsValidationChange:({addonId:h,isValid:C})=>y(b(a({},u),{[h]:C})),onAddonChange:e},p.id)})})}var _i=e(Re,{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
|
-
|
|
713
|
+
`,qd=e(_i)`
|
|
714
714
|
flex-direction: column;
|
|
715
715
|
align-items: unset;
|
|
716
716
|
${({$hideBorders:e})=>e&&css`
|
|
717
717
|
border: none;
|
|
718
718
|
padding: 0;
|
|
719
719
|
`}
|
|
720
|
-
`,
|
|
720
|
+
`,Jd=e(Re)`
|
|
721
721
|
display: flex;
|
|
722
722
|
align-items: center;
|
|
723
723
|
flex: 1;
|
|
724
724
|
gap: 12px;
|
|
725
|
-
`,
|
|
725
|
+
`,Xd=e(Re)`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
|
-
`;var
|
|
728
|
+
`;var ab=e(ke)`
|
|
729
729
|
position: relative;
|
|
730
730
|
max-width: 500px;
|
|
731
|
-
`,
|
|
731
|
+
`,sb=e(ke)`
|
|
732
732
|
opacity: ${({$showLoading:e})=>e?.6:1};
|
|
733
733
|
pointer-events: ${({$showLoading:e})=>e?"none":"auto"};
|
|
734
|
-
`,
|
|
734
|
+
`,lb=e(ke)`
|
|
735
735
|
position: absolute;
|
|
736
736
|
top: 40px;
|
|
737
737
|
left: 0;
|
|
@@ -743,18 +743,18 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
743
743
|
justify-content: center;
|
|
744
744
|
border-radius: 4px;
|
|
745
745
|
z-index: 10;
|
|
746
|
-
`,
|
|
746
|
+
`,cb=e(ke)`
|
|
747
747
|
display: flex;
|
|
748
748
|
flex-direction: column;
|
|
749
749
|
align-items: center;
|
|
750
750
|
gap: 12px;
|
|
751
|
-
`;function
|
|
751
|
+
`;function jd({onCheckout:e,onCheckoutCompleted:t}){var C,b,x;let{isZuoraIntegration:o,isInitialized:r,createPaymentSession:n}=Lt(),{setErrorMessage:i}=re(),{billingCountryCode:a}=be(),{checkoutState:l,widgetState:s}=D(),{handleZuoraSubmit:c}=Ar({onCheckout:e,onCheckoutCompleted:t}),u=useRef(false),[y,p]=gi.useState(false),g=((x=(b=(C=l==null?void 0:l.plan)==null?void 0:C.pricePoints)==null?void 0:b[0])==null?void 0:x.currency)||Currency.Usd,{publishableKey:f}=l==null?void 0:l.billingIntegration.billingCredentials,h=useCallback(A=>d(null,null,function*(){var S;if(!A.success||!A.paymentMethodId){let F=((S=A.error)==null?void 0:S.message)||"Payment failed";i(F),yield t({success:false,error:F});return}yield c(A.paymentMethodId);}),[c,i,t]);return useEffect(()=>(d(null,null,function*(){if(!(!r||u.current)){p(true),i(void 0);try{u.current=!0;let S=window.Zuora(f),F=Td(n,h,g,a);(yield S.createPaymentForm(F)).mount("#zuora_payment");}catch(S){u.current=false,i("Failed to render Zuora payment form");}finally{p(false);}}}),()=>{u.current=false;}),[r]),o?jsxs(ab,{children:[jsx(sb,{id:"zuora_payment",$showLoading:s.readOnly||y}),(s.readOnly||y)&&jsx(lb,{children:jsx(cb,{children:jsx(Gh,{size:28})})})]}):null}function tp({checked:e,text:t,subtitle:o,readOnly:r}){return jsxs(Jd,{children:[jsx(mb,{checked:e,disabled:r}),jsxs(Xd,{container:true,children:[jsx(Re,{item:true,children:t}),o&&jsx(Re,{item:true,children:o})]})]})}function op({checked:e,paymentMethodDetails:t,readOnly:o,onSelect:r}){if(!t)return null;let{last4Digits:n,expirationMonth:i,expirationYear:a}=t;return jsx(_i,{item:true,onClick:r,$disabled:o,children:jsx(tp,{checked:e,readOnly:o,text:jsx(f,{variant:"h6",children:`Card ending in ${n}`}),subtitle:!!i&&!!a&&jsx(f,{variant:"body1",children:`Expires ${i.toString().padStart(2,"0")}/${a}`})})})}function rp({hasExistingPaymentMethod:e,checked:t,onSelect:o,readOnly:r,checkoutLocalization:n,onBillingAddressChange:i,collectPhoneNumber:a,collectTaxId:l,onCheckout:s,onCheckoutCompleted:c}){let{isZuoraIntegration:u}=Lt();return jsxs(qd,{item:true,$hideBorders:!e,onClick:o,$disabled:r,children:[e&&jsx(tp,{checked:t,readOnly:r,text:jsx(f,{variant:"h6",children:n.newPaymentMethodText})}),jsx(_P,{in:t,children:u?jsx(jd,{onCheckout:s,onCheckoutCompleted:c}):jsx(gd,{onBillingAddressChange:i,collectPhoneNumber:a,collectTaxId:l})})]})}var fb=e(Re)`
|
|
752
752
|
display: flex;
|
|
753
753
|
flex-direction: column;
|
|
754
754
|
gap: 24px;
|
|
755
|
-
`;function
|
|
755
|
+
`;function np({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n}){let{checkoutState:i,checkoutLocalization:a,widgetState:l}=D(),{customer:s}=i||{},{errorMessage:c,useNewPaymentMethod:u,setUseNewPaymentMethod:y}=re(),{readOnly:p}=l,g=f=>{p||y(f);};return jsxs(fb,{container:true,children:[!!c&&jsx(zx,{severity:"error",sx:{alignItems:"center"},children:jsx(f,{overrideColor:"inherit",children:c})}),jsx(op,{readOnly:p,checked:!u,paymentMethodDetails:s==null?void 0:s.paymentMethodDetails,onSelect:()=>g(false)}),jsx(rp,{hasExistingPaymentMethod:!!(s!=null&&s.paymentMethodDetails),readOnly:p,checked:u,checkoutLocalization:a,onSelect:()=>g(true),onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n})]})}var _r=({onClick:e,checkoutLocalization:t,size:o})=>jsx(mu,{className:"stigg-checkout-change-plan-button",sx:{textTransform:"none"},variant:"text",size:o,onClick:e,children:jsx(f,{className:"stigg-checkout-change-plan-button-text",color:"primary.main",variant:"h3",style:{lineHeight:"24px"},children:t.changePlan})});function sp({allowChangePlan:e=false,onChangePlan:t}){let{checkoutState:o,checkoutLocalization:r}=D(),{plan:n}=o||{};return jsxs(Fragment,{children:[jsxs(ke,{sx:{marginBottom:"16px"},children:[jsx(f,{variant:"body1",color:"disabled",style:{opacity:.6,marginBottom:"8px"},children:"Selected plan"}),jsxs(ke,{sx:{display:"flex",justifyContent:"space-between"},children:[jsx(f,{variant:"h1",children:n==null?void 0:n.displayName}),e&&t&&jsx(_r,{onClick:()=>{t({currentPlan:n});},checkoutLocalization:r,size:"medium"})]})]}),jsx(Fl,{className:"stigg-checkout-plan-header-divider"})]})}function Gi(e){switch(e){case BillingPeriod.Annually:return "Annual";case BillingPeriod.Monthly:return "Monthly";default:return ""}}var dp=e(ke)`
|
|
756
756
|
margin: 16px 0;
|
|
757
|
-
`,
|
|
757
|
+
`,pp=e.button`
|
|
758
758
|
cursor: ${({$disabled:e,$isOnlyBillingPeriod:t})=>e||t?"default":"pointer"};
|
|
759
759
|
flex: 1;
|
|
760
760
|
display: flex;
|
|
@@ -763,7 +763,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
763
763
|
padding: 2px 8px;
|
|
764
764
|
border-radius: 10px;
|
|
765
765
|
border: ${({theme:e,$isActive:t,$isOnlyBillingPeriod:o})=>{let r=e.stigg.palette.outlinedBorder;return o?r="transparent":t&&(r=e.stigg.palette.outlinedRestingBorder),`1px solid ${r}`}};
|
|
766
|
-
background: ${({theme:e,$isActive:t,$isOnlyBillingPeriod:o})=>o?"transparent":t?
|
|
766
|
+
background: ${({theme:e,$isActive:t,$isOnlyBillingPeriod:o})=>o?"transparent":t?Ei(e.stigg.palette.primary).alpha(.15).toString():"transparent"};
|
|
767
767
|
text-transform: none;
|
|
768
768
|
text-align: start;
|
|
769
769
|
height: 36px;
|
|
@@ -774,7 +774,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
774
774
|
background: none;
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
`,
|
|
777
|
+
`,mp=e(ke)`
|
|
778
778
|
display: flex;
|
|
779
779
|
gap: 16px;
|
|
780
780
|
margin-top: 16px;
|
|
@@ -782,11 +782,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
782
782
|
display: flex;
|
|
783
783
|
align-items: baseline;
|
|
784
784
|
gap: 8px;
|
|
785
|
-
`;e(
|
|
785
|
+
`;e(xb)`
|
|
786
786
|
& .MuiChip-label {
|
|
787
787
|
font-size: 12px;
|
|
788
788
|
}
|
|
789
|
-
`;var
|
|
789
|
+
`;var up=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=be(),n=o===e;return jsxs(pp,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsx(mb,{checked:n,onChange:()=>r(e),value:e,disabled:t,inputProps:{"aria-label":Gi(e)},sx:{padding:0,marginRight:"8px"}}),jsx(ke,{children:jsx(f,{variant:"h3",color:"primary",children:Gi(e)})})]})};function gp({plan:e,checkoutLocalization:t}){let[o,r]=Ux(e==null?void 0:e.pricePoints,i=>i.billingPeriod===BillingPeriod.Monthly),n=!!(o!=null&&o.length)&&!!(r!=null&&r.length);return n?jsxs(dp,{children:[jsx(f,{variant:"h6",color:"primary",children:t.billingPeriodsTitle}),jsxs(mp,{children:[!!(o!=null&&o.length)&&jsx(up,{billingPeriod:BillingPeriod.Monthly,isOnlyBillingPeriod:!n},BillingPeriod.Monthly),!!(r!=null&&r.length)&&jsx(up,{billingPeriod:BillingPeriod.Annually,isOnlyBillingPeriod:!n},BillingPeriod.Annually)]})]}):null}var Ib=e.div`
|
|
790
790
|
display: flex;
|
|
791
791
|
min-height: 60px;
|
|
792
792
|
margin-top: 16px;
|
|
@@ -797,39 +797,39 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
797
797
|
align-items: flex-start;
|
|
798
798
|
justify-content: space-between;
|
|
799
799
|
}
|
|
800
|
-
`,
|
|
800
|
+
`,Fb=e(ke)`
|
|
801
801
|
display: flex;
|
|
802
802
|
flex-direction: column;
|
|
803
803
|
justify-content: center;
|
|
804
804
|
width: 100%;
|
|
805
805
|
height: 42px;
|
|
806
|
-
`,
|
|
806
|
+
`,Eb=e(f)`
|
|
807
807
|
display: flex;
|
|
808
808
|
align-items: center;
|
|
809
809
|
justify-content: flex-end;
|
|
810
810
|
width: 100%;
|
|
811
811
|
min-height: 42px;
|
|
812
|
-
`,
|
|
812
|
+
`,vb=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function Lb({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var f$1,h,C,b,x,A;let[i,a]=useState(void 0),l=(f$1=e.feature)==null?void 0:f$1.featureId,s=!l,c=e.pricingModel===BillingModel.UsageBased,u=s?"Base charge":Bt(((h=e.feature)==null?void 0:h.displayName)||"",(C=e.feature)==null?void 0:C.units,(b=e.feature)==null?void 0:b.unitsPlural),y=!!(e!=null&&e.minUnitQuantity||e!=null&&e.maxUnitQuantity),p=S=>d(null,null,function*(){var E,L;if(s||!l)return;let{minUnitQuantity:F,maxUnitQuantity:B}=e,k=(E=S==null?void 0:S.target)!=null&&E.value?Number((L=S==null?void 0:S.target)==null?void 0:L.value):null;if(!k||k<=0||F&&k<F||B&&k>B){r({featureId:l,isValid:false}),a(vb(e,k!=null?k:void 0)),t(l,k!=null?k:null);return}let T=yr(e,k),I=yield n==null?void 0:n({feature:e.feature,quantity:T});a(I==null?void 0:I.errorMessage),r({featureId:l,isValid:!(I!=null&&I.disableNextStep)}),t(l,T);}),g;if(s||c)g=`${H({amount:e.amount,currency:e.currency,locale:"en-us",minimumFractionDigits:2})}`,c&&(g+=" / unit");else if(e.isTieredPrice&&e.tiersMode&&l){let S=(o==null?void 0:o.quantity)||1;g=jsx(Kt,{componentId:`${l}-tiers`,tiers:e.tiers,tiersMode:e.tiersMode,value:S,errorMessage:i,handleChange:F=>d(null,null,function*(){let B=yield n==null?void 0:n({feature:e.feature,quantity:F});a(B==null?void 0:B.errorMessage),r({featureId:l,isValid:!(B!=null&&B.disableNextStep)}),t(l,F);}),width:"100%"});}else g=jsx(pe,{sx:{width:"100%"},id:`${l}-input`,type:"number",onWheel:bt,error:!!i,helperText:i,FormHelperTextProps:{sx:{margin:"4px"}},value:(x=o==null?void 0:o.quantity)!=null?x:"",onChange:p});return jsxs(Ib,{children:[jsxs(Fb,{children:[jsx(f,{variant:"h6",color:"primary",lineHeight:"24px",children:u}),y&&jsx(f,{variant:"body1",color:"secondary",lineHeight:"20px",children:So(e.minUnitQuantity,e.maxUnitQuantity,(A=e.feature)==null?void 0:A.unitsPlural)})]}),jsx(Eb,{variant:"h6",color:"primary",children:g})]})}function hp({plan:e,billingPeriod:t,onBillableFeatureChange:o}){var u;let{billableFeatures:r,setBillableFeature:n}=be(),{setIsDisabled:i}=_e(),{setIsValid:a$1}=D(),l=Pr(((u=e==null?void 0:e.pricePoints)==null?void 0:u.filter(y=>y.billingPeriod===t))||[]),[s,c]=useState(l==null?void 0:l.reduce((y,p)=>{var g;return y[((g=p.feature)==null?void 0:g.featureId)||"base-charge"]=true,y},{}));return useEffect(()=>{let y=Object.values(s).some(p=>!p);i(y),a$1(!y);},[s,i,a$1]),jsx(Fragment,{children:l==null?void 0:l.map(y=>{var g;let p=r.find(f=>{var h;return f.featureId===((h=y.feature)==null?void 0:h.featureId)});return jsx(Lb,{charge:y,setBillableFeature:n,billableFeature:p,onValidationChange:({featureId:f,isValid:h})=>c(C=>b(a({},C),{[f]:h})),onBillableFeatureChange:o},((g=y.feature)==null?void 0:g.featureId)||"base-charge")})})}var Cp=e(ke)`
|
|
813
813
|
width: 100%;
|
|
814
|
-
`;var
|
|
814
|
+
`;var xp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=D(),{plan:n}=o||{},{billingPeriod:i}=be();return jsxs(Fragment,{children:[jsx(sp,{allowChangePlan:true,onChangePlan:e}),jsxs(Cp,{children:[jsx(gp,{plan:n,checkoutLocalization:r}),jsx(hp,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var Ub=e=>jsx("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxs("g",{id:"arrow-right",children:[jsx("path",{id:"Shape",d:"M2.66699 8H13.3337",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{id:"Shape_2",d:"M9.33301 4L13.333 8L9.33301 12",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})})),bp=Ub;var Sp=e(bp)`
|
|
815
815
|
path {
|
|
816
816
|
stroke: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
817
817
|
}
|
|
818
|
-
`;var
|
|
818
|
+
`;var $b=e(ke)`
|
|
819
819
|
display: flex;
|
|
820
|
-
`,
|
|
820
|
+
`,Gb=e(zx)`
|
|
821
821
|
margin-bottom: 16px;
|
|
822
|
-
`,
|
|
822
|
+
`,zb=e(ke)`
|
|
823
823
|
padding: 16px;
|
|
824
824
|
border-radius: 10px;
|
|
825
825
|
width: 100%;
|
|
826
826
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
827
|
-
`,
|
|
827
|
+
`,Tp=({headerText:e,planName:t,priceText:o})=>jsxs(zb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsx(f,{className:"stigg-checkout-downgrade-to-free-text-header",style:{opacity:.8},variant:"caption",color:"disabled",children:e}),jsx(f,{className:"stigg-checkout-downgrade-to-free-plan-name",bold:true,variant:"h3",color:"primary",children:t}),jsx(f,{className:"stigg-checkout-downgrade-to-free-price-text",color:"secondary",children:o})]}),wp=({checkoutLocalization:e,activeSubscription:t,freePlan:o,allowChangePlan:r=false,onChangePlan:n})=>{let i;r&&n&&(i=jsx(_r,{onClick:()=>{n({currentPlan:o});},checkoutLocalization:e,size:"small"}));let a=t.prices.length>0?t.prices[0].billingPeriod:void 0;return jsxs(Fragment,{children:[jsx(Gb,{action:i,className:"stigg-checkout-downgrade-to-free-alert",severity:"info",children:jsx(f,{as:"span",color:"secondary",children:e.downgradeToFree.alertText({plan:t.plan})})}),jsxs($b,{className:"stigg-checkout-downgrade-to-free-plans-container",children:[jsx(Tp,{headerText:e.downgradeToFree.paidPlanHeader({plan:t.plan}),planName:e.downgradeToFree.paidPlanName({plan:t.plan}),priceText:e.downgradeToFree.paidPlanPriceText({plan:t.plan,billingPeriod:a})}),jsx(Sp,{className:"stigg-checkout-downgrade-to-free-arrow",style:{margin:"auto 16px",minWidth:"16px"}}),jsx(Tp,{headerText:e.downgradeToFree.freePlanHeader({plan:o}),planName:e.downgradeToFree.freePlanName({plan:o}),priceText:e.downgradeToFree.freePlanPriceText({plan:o})})]})]})};var Wb=(e,{onBillingAddressChange:t,onChangePlan:o,onBillableFeatureChange:r,onAddonChange:n,collectPhoneNumber:i,collectTaxId:a,onCheckout:l,onCheckoutCompleted:s})=>{switch(e.key){case "PLAN":return {content:jsx(xp,{onChangePlan:o,onBillableFeatureChange:r})};case "ADDONS":return {content:jsx(Kd,{onAddonChange:n})};case "PAYMENT":return {content:jsx(np,{onBillingAddressChange:t,collectPhoneNumber:i,collectTaxId:a,onCheckout:l,onCheckoutCompleted:s})};default:return {content:null}}};function Fp({onCheckout:e,onCheckoutCompleted:t,onChangePlan:o,onBillingAddressChange:r,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:a$1,collectTaxId:l,disablePromotionCode:s,disableSuccessAnimation:c,onMockCheckoutPreview:u}){let{stripePromise:y,setupIntentClientSecret:p}=fd(),[{stiggTheme:g,widgetState:f,theme:h,showWatermark:C}]=_(),{currentStep:b$1}=_e(),{isLoadingCheckoutData:x}=f,{checkoutState:A,checkoutLocalization:S}=D(),{plan:F,activeSubscription:B}=A||{},k=!!F&&F.pricingType===PricingType.Free&&!!B&&B.pricingType!==PricingType.Free,{content:T}=Wb(b$1,{onBillingAddressChange:r,onChangePlan:o,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:a$1,collectTaxId:l,onCheckout:e,onCheckoutCompleted:t}),I=jsx(Fragment,{children:k?jsx(wp,{freePlan:F,activeSubscription:B,allowChangePlan:true,checkoutLocalization:S,onChangePlan:o}):jsx(Fragment,{children:T})}),E=useMemo(()=>p?{clientSecret:p}:{mode:"setup",currency:"usd"},[p]);return jsx(Elements,{stripe:y,options:b(a({},E),{appearance:{theme:"stripe",variables:{colorText:g.palette.text.primary,colorPrimaryText:g.palette.text.primary,colorTextPlaceholder:g.palette.text.disabled,fontFamily:g.typography.fontFamily,colorBackground:h==null?void 0:h.paymentInputBackgroundColor,borderRadius:h==null?void 0:h.paymentInputBorderRadius},rules:h!=null&&h.paymentInputBorderColor?{".Input":{borderColor:h==null?void 0:h.paymentInputBorderColor}}:void 0}}),children:jsxs(Lc,{className:"stigg-checkout-layout",children:[!k&&jsx(Gc,{}),jsxs(Nc,{children:[jsx(Mc,{children:x?jsx(Qa,{}):I}),x?jsx($d,{showWatermark:C}):jsx(Dd,{disablePromotionCode:s,disableSuccessAnimation:c,onCheckout:e,onCheckoutCompleted:t,isFreeDowngrade:k,onMockCheckoutPreview:u,showWatermark:C})]})]})},p)}var vp=p=>{var g=p,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:a$1,billingInformation:l,onMockCheckoutState:s,skipCheckoutSteps:c$1,onBeforeStepChange:u}=g,y=c(g,["textOverrides","theme","resourceId","planId","preferredBillingPeriod","billingCountryCode","billableFeatures","billingInformation","onMockCheckoutState","skipCheckoutSteps","onBeforeStepChange"]);return jsx(Fc,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:a$1,billingInformation:l,onMockCheckoutState:s,skipCheckoutSteps:c$1,onBeforeStepChange:u,children:jsx(Fp,a({},y))})};function Qb(e){return useMemo(()=>{let t=new URLSearchParams(window.location.search);return t.get(e)},[e,window.location.search])}var Wi=(r=>(r.IN_PROGRESS="IN_PROGRESS",r.SUCCEEDED="SUCCEEDED",r.FAILED="FAILED",r))(Wi||{}),Np=({onProvisionStart:e,onProvisionSucceeded:t,onProvisionFailed:o}={})=>{let{stigg:r}=u(),[n,i]=useState("IN_PROGRESS"),[a,l]=useState(false),s=Qb("checkoutCompleted");return useEffect(()=>{d(null,null,function*(){if(!(!s||s.toLowerCase()==="false"||a)){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,s]),{isAwaitingCheckout:a,provisionStatus:n}};function Kb(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=x(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function Xb(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=y(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function tS(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=z(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function nS(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=B(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}var Rt=e.div`
|
|
828
828
|
display: flex;
|
|
829
829
|
align-items: center;
|
|
830
830
|
justify-content: space-between;
|
|
831
831
|
width: 100%;
|
|
832
|
-
`;var
|
|
832
|
+
`;var Ut=e.button`
|
|
833
833
|
display: flex;
|
|
834
834
|
align-items: center;
|
|
835
835
|
gap: 4px;
|
|
@@ -855,27 +855,27 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
|
858
|
+
`;var rt=(e,t)=>e?k(e,{maximumFractionDigits:t!=null?t:void 0}):0,$r=(e,t=true)=>{let{remaining:o,currency:r}=e,n=(o===1?r.unitSingular:r.unitPlural)||null,i=n!=null?n:r.displayName;return t&&i!=null?i:""},Gr=(e,t)=>t===0?0:Math.min(e/t*100,100);function zr({usagePeriodEnd:e,formatResetPeriod:t,className:o}){let r=cr({usagePeriodEnd:e,formatter:t});return r?jsx(f,{variant:"caption",color:"secondary",className:o,children:r}):null}var lS=e.div`
|
|
859
859
|
display: flex;
|
|
860
860
|
flex-direction: column;
|
|
861
861
|
gap: 4px;
|
|
862
|
-
`,
|
|
862
|
+
`,cS=e.div`
|
|
863
863
|
display: flex;
|
|
864
864
|
flex-direction: row;
|
|
865
865
|
gap: 4px;
|
|
866
866
|
align-items: baseline;
|
|
867
|
-
`;function
|
|
867
|
+
`;function Rp({entitlement:e,decimalPlaces:t=null,showUnits:o=true,formatResetPeriod:r}){if(e.isFallback)return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-balance-value-no-balance",children:"No balance data available"});let n=$r(e,o);return jsxs(lS,{children:[jsxs(cS,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-balance-value-amount",children:rt(e.remaining,t)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-balance-value-suffix",children:n})]}),jsx(zr,{usagePeriodEnd:e.usagePeriodEnd,formatResetPeriod:r,className:"stigg-credit-balance-reset-period"})]})}var Or=e(xr)`
|
|
868
868
|
width: 16px;
|
|
869
869
|
height: 16px;
|
|
870
870
|
path {
|
|
871
871
|
stroke: ${({theme:e})=>{var t,o,r;return (r=(o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.text)==null?void 0:r.primary}};
|
|
872
872
|
}
|
|
873
|
-
`;var
|
|
873
|
+
`;var dS=e.div`
|
|
874
874
|
display: flex;
|
|
875
875
|
flex-direction: column;
|
|
876
876
|
gap: 8px;
|
|
877
877
|
width: 100%;
|
|
878
|
-
`,
|
|
878
|
+
`,pS=e.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
gap: 8px;
|
|
@@ -883,40 +883,40 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
|
886
|
+
`;function Up({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,onAddCredits:n}){let i=he(ee),a$1=u({optional:true}),l=a$1==null?void 0:a$1.theme,{title:s,addCredits:c,formatResetPeriod:u$1}=a(a({},G),t),y=A({currencyId:e}),p=jsx(dS,{className:"stigg-credit-balance-container",children:jsxs(pS,{className:"stigg-credit-balance-card",children:[jsxs(Rt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-balance-title",children:s}),n&&!y.isFallback&&jsxs(Ut,{type:"button",onClick:()=>n(y),className:"stigg-credit-balance-add-credits-button",children:[jsx(Or,{className:"stigg-credit-balance-add-credits-icon"}),c]})]}),jsx(Rp,{entitlement:y,decimalPlaces:o,showUnits:r,formatResetPeriod:u$1})]})});return i?p:jsx(w,{componentTheme:l,children:p})}var gS=lazy(()=>import('./CreditUsageChart-NM74VKGO.esm.js').then(e=>({default:e.CreditUsageChart})));function Dp(e){return jsx(Suspense,{fallback:null,children:jsx(gS,a({},e))})}var fS=(e,t,o)=>o==="primary"?t.palette.primary:e>=100?t.palette.progress.high:e>=75?t.palette.progress.medium:t.palette.progress.low,yS=e.div`
|
|
887
887
|
width: 100%;
|
|
888
888
|
height: 8px;
|
|
889
889
|
background-color: ${({theme:e})=>e.stigg.palette.progress.background};
|
|
890
890
|
border-radius: 4px;
|
|
891
891
|
overflow: hidden;
|
|
892
|
-
`,
|
|
892
|
+
`,hS=e.div`
|
|
893
893
|
height: 100%;
|
|
894
894
|
width: ${({percentage:e})=>Math.max(0,Math.min(100,e))}%;
|
|
895
|
-
background-color: ${({theme:e,percentage:t,variant:o})=>
|
|
895
|
+
background-color: ${({theme:e,percentage:t,variant:o})=>fS(t,e.stigg,o)};
|
|
896
896
|
border-radius: 4px;
|
|
897
897
|
transition: width 0.3s ease-in-out;
|
|
898
|
-
`;function
|
|
898
|
+
`;function Hr({percentage:e,className:t,variant:o="utilization"}){return jsx(yS,{className:t,children:jsx(hS,{percentage:e,variant:o})})}var CS=e.div`
|
|
899
899
|
display: flex;
|
|
900
900
|
flex-direction: row;
|
|
901
901
|
justify-content: space-between;
|
|
902
902
|
align-items: baseline;
|
|
903
903
|
width: 100%;
|
|
904
|
-
`,
|
|
904
|
+
`,PS=e.div`
|
|
905
905
|
display: flex;
|
|
906
906
|
flex-direction: row;
|
|
907
907
|
gap: 4px;
|
|
908
908
|
align-items: baseline;
|
|
909
|
-
`,
|
|
909
|
+
`,xS=e.div`
|
|
910
910
|
display: flex;
|
|
911
911
|
flex-direction: row;
|
|
912
912
|
gap: 4px;
|
|
913
913
|
align-items: baseline;
|
|
914
|
-
`,
|
|
914
|
+
`,bS=({currentUsage:e,usageLimit:t})=>{let o=Gr(e,t);return jsx(Hr,{percentage:o,className:"stigg-credit-utilization-progress"})};function Gp({entitlement:e,decimalPlaces:t=null,showUnits:o=true,remainingLabel:r=H$1.remaining,formatResetPeriod:n}){if(e.isFallback)return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-utilization-value-no-balance",children:"No balance data available"});let{remaining:i,currentUsage:a,usageLimit:l}=e,s=$r(e,o);return jsxs(Fragment,{children:[jsxs(CS,{children:[jsxs(PS,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-utilization-usage",children:rt(a,t)}),jsx(f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-separator",children:"/"}),jsx(f,{variant:"h3",color:"primary",className:"stigg-credit-utilization-total",children:rt(l,t)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-suffix",children:s})]}),jsxs(xS,{children:[jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-remaining-label",children:r}),jsx(f,{variant:"caption",color:"primary",bold:true,className:"stigg-credit-utilization-remaining-value",children:rt(i,t)})]})]}),jsx(bS,{currentUsage:a,usageLimit:l}),jsx(zr,{usagePeriodEnd:e.usagePeriodEnd,formatResetPeriod:n,className:"stigg-credit-utilization-reset-period"})]})}var TS=e.div`
|
|
915
915
|
display: flex;
|
|
916
916
|
flex-direction: column;
|
|
917
917
|
gap: 8px;
|
|
918
918
|
width: 100%;
|
|
919
|
-
`,
|
|
919
|
+
`,kS=e.div`
|
|
920
920
|
display: flex;
|
|
921
921
|
flex-direction: column;
|
|
922
922
|
gap: 16px;
|
|
@@ -925,7 +925,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
|
928
|
+
`;function zp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,onAddCredits:n}){let i=he(ee),a$1=u({optional:true}),l=a$1==null?void 0:a$1.theme,s=A({currencyId:e}),{title:c,remaining:u$1,addCredits:y,formatResetPeriod:p}=a(a({},H$1),t),g=jsx(TS,{className:"stigg-credit-utilization-container",children:jsxs(kS,{className:"stigg-credit-utilization-card",children:[jsxs(Rt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-utilization-title",children:c}),n&&!s.isFallback&&jsxs(Ut,{type:"button",onClick:()=>n(s),className:"stigg-credit-utilization-add-credits-button",children:[jsx(Or,{className:"stigg-credit-utilization-add-credits-icon"}),y]})]}),jsx(Gp,{entitlement:s,decimalPlaces:o,showUnits:r,remainingLabel:u$1,formatResetPeriod:p})]})});return i?g:jsx(w,{componentTheme:l,children:g})}function Zr(e){let t=u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=useCallback(()=>d(null,null,function*(){if(!o||!o.isCustomerLoaded)return null;try{return o.getCreditGrants({currencyId:e.currencyId,paging:e.paging})}catch(s){throw console.error("Error fetching credit grants:",s),s}}),[o,e.currencyId,e.paging,r]),{data:i,error:a,isLoading:l}=C({func:n});return useMemo(()=>({creditGrants:(i==null?void 0:i.data)||[],paging:i==null?void 0:i.pageInfo,totalCount:i==null?void 0:i.totalCount,isLoading:l,error:a}),[i,a,l])}function Qi({skeletonRows:e,visibleHeadCells:t,hideLastRowBorder:o}){return jsx(Fragment,{children:Array.from({length:e}).map((r,n)=>jsx(AS,{children:t.map(i=>jsx(_t,{$alignment:i.alignment,$width:i.width,$maxWidth:i.maxWidth,$minWidth:i.minWidth,$isLastRow:n===e-1,$hideLastRowBorder:o,children:jsx(Je,{width:i.width?parseInt(i.width.replace("px",""))-40:100,height:20})},String(i.id)))},n))})}function Ki({data:e,visibleHeadCells:t,onRowClick:o,hideLastRowBorder:r}){return jsx(Fragment,{children:e.map((n,i)=>jsx(qi,{$clickable:!!o,onClick:()=>o&&o(n),children:t.map(a=>jsx(_t,{$alignment:a.alignment,$width:a.width,$maxWidth:a.maxWidth,$minWidth:a.minWidth,$isLastRow:i===e.length-1,$hideLastRowBorder:r,onClick:a.disableClick?l=>l.stopPropagation():void 0,children:jsx(Ji,{$alignment:a.alignment,children:a.render(n)})},String(a.id)))},i))})}function Kr({errorMessage:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"error",className:t,children:e||"An error occurred"}):jsx(Fragment,{children:e})}function qr({message:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"secondary",className:t,children:e||"No data available"}):jsx(Fragment,{children:e})}var GS=e(TableContainer)`
|
|
929
929
|
border-radius: 8px;
|
|
930
930
|
border: 1px solid ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
931
931
|
background-color: ${({theme:e})=>e.stigg.palette.backgroundPaper};
|
|
@@ -938,13 +938,13 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
938
938
|
align-items: center;
|
|
939
939
|
justify-content: center;
|
|
940
940
|
`}
|
|
941
|
-
`,
|
|
941
|
+
`,zS=e(Table)`
|
|
942
942
|
min-width: 600px;
|
|
943
943
|
table-layout: auto;
|
|
944
944
|
width: 100%;
|
|
945
|
-
`,
|
|
945
|
+
`,VS=e(Divider)`
|
|
946
946
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
947
|
-
`,
|
|
947
|
+
`,_t=e(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 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
957
957
|
${({$minWidth:e})=>e&&`min-width: ${e};`}
|
|
958
958
|
|
|
959
959
|
${({$isLastRow:e,$hideLastRowBorder:t})=>e&&t&&"border-bottom: none;"}
|
|
960
|
-
`,
|
|
960
|
+
`,OS=e(_t)`
|
|
961
961
|
background-color: transparent;
|
|
962
|
-
`,
|
|
962
|
+
`,qi=e(TableRow)`
|
|
963
963
|
${({$clickable:e,theme:t})=>e&&`
|
|
964
964
|
cursor: pointer;
|
|
965
965
|
&:hover {
|
|
966
966
|
background-color: ${t.stigg.palette.backgroundHighlight};
|
|
967
967
|
}
|
|
968
968
|
`}
|
|
969
|
-
`,
|
|
969
|
+
`,Ji=e.div`
|
|
970
970
|
display: flex;
|
|
971
971
|
align-items: center;
|
|
972
972
|
justify-content: ${({$alignment:e})=>{switch(e){case "center":return "center";case "right":return "flex-end";default:return "flex-start"}}};
|
|
973
973
|
width: 100%;
|
|
974
|
-
`,
|
|
974
|
+
`,HS=e(TablePagination)`
|
|
975
975
|
color: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
976
|
-
`;function
|
|
976
|
+
`;function WS({visibleHeadCells:e}){return jsx(TableHead,{children:jsx(TableRow,{children:e.map(t=>jsx(OS,{$alignment:t.alignment,$width:t.width,$maxWidth:t.maxWidth,$minWidth:t.minWidth,children:jsx(f,{variant:"caption",children:t.label})},String(t.id)))})})}function Jr({data:e,headCells:t,isLoading:o=false,error:r=null,emptyMessage:n,errorMessage:i,onRowClick:a,className:l,skeletonRows:s=3,hideLastRowBorder:c=true,pageSize:u,pageNum:y,totalCount:p,onPageChange:g}){let f=t.filter(C=>C.visible!==false),h=!!r||!o&&e.length===0;return jsx(GS,{className:l,$hasMinHeight:h,children:r?jsx(Kr,{errorMessage:i,className:`${l}-error`}):!o&&e.length===0?jsx(qr,{message:n,className:`${l}-empty`}):jsxs(Fragment,{children:[jsxs(zS,{children:[jsx(WS,{visibleHeadCells:f}),jsx(TableBody,{children:o?jsx(Qi,{skeletonRows:s,visibleHeadCells:f,hideLastRowBorder:c}):jsx(Ki,{data:e,visibleHeadCells:f,onRowClick:a,hideLastRowBorder:c})})]}),!!(e!=null&&e.length)&&g&&jsxs(Fragment,{children:[jsx(VS,{}),jsx(HS,{component:"div",rowsPerPage:u!=null?u:e.length,rowsPerPageOptions:[u!=null?u:e.length],count:p!=null?p:e.length,page:y!=null?y:1,onPageChange:g,labelDisplayedRows:({from:C,to:b,count:x})=>`${se(C)}-${se(b)} of ${x!==-1?se(x):`more than ${se(b)}`}`})]})]})})}var YS=e(xb)`
|
|
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
|
|
983
|
+
`;function uo(i){var a$1=i,{variant:e,label:t,className:o,size:r="small"}=a$1,n=c(a$1,["variant","label","className","size"]);return jsx(YS,a({label:t,size:r,$variant:e,className:o},n))}function Zp(e){let t=Z(),o=Z(e.effectiveAt),r=e.expireAt?Z(e.expireAt):null;return o.isAfter(t)?"SCHEDULED":r&&r.isBefore(t)?"EXPIRED":"AVAILABLE"}function Yp(e,t){return `${rt(e.consumedAmount,t)} / ${e.amount}`}var ea=e=>{switch(e){case "AVAILABLE":return "success";case "SCHEDULED":return "warning";case "EXPIRED":return "error";default:return "neutral"}},Qp=e=>{if(e.automaticRechargeConfigurationId)return "Automatic recharge";switch(e.grantType){case CreditGrantType.Promotional:return "Promotional";case CreditGrantType.Paid:return "Top-up";case CreditGrantType.Recurring:return "Recurring";default:return "Unknown"}};function Kp({creditGrants:e,isLoading:t,error:o,localization:r,decimalPlaces:n,pageSize:i,pageNum:a$1,totalCount:l,onPageChange:s}){let c=e.map(y=>b(a({},y),{status:Zp(y)})),u=[{id:"effectiveAt",label:r.receivedAt,width:"205px",render:({effectiveAt:y})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-effective-date",children:jn(y)})},{id:"grantType",label:r.grantType,width:"205px",render:y=>jsx(f,{variant:"body1",className:"stigg-credit-grants-grant-type",children:Qp(y)})},{id:"status",label:r.status,width:"205px",render:({status:y})=>{let p=qS(y),g=ea(y);return jsx(uo,{label:p,variant:g,className:"stigg-credit-grants-status-chip"})}},{id:"amount",label:r.balance,width:"205px",render:y=>jsx(f,{variant:"body1",className:"stigg-credit-grants-balance",children:Yp(y,n)})},{id:"expireAt",label:r.expiryDate,width:"205px",render:({expireAt:y})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-expiry-date",children:y?ei(y):"-"})}];return jsx(Jr,{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:a$1,pageSize:i,totalCount:l,onPageChange:s})}var Jp=(e,t,o)=>{let[r,n]=useState(0),[i,a]=useState(0);return {pageNumber:i,lastVisitedPage:r,pageChangeFunc:(s,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),a(c);}}};var XS=10,jS=e.div`
|
|
984
984
|
display: flex;
|
|
985
985
|
flex-direction: column;
|
|
986
986
|
gap: 8px;
|
|
987
|
-
`,
|
|
987
|
+
`,eT=e.div`
|
|
988
988
|
display: flex;
|
|
989
989
|
flex-direction: column;
|
|
990
990
|
gap: 16px;
|
|
991
|
-
`;function
|
|
991
|
+
`;function Xp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=XS}){let n=u({optional:true}),i=n==null?void 0:n.stigg,a$1=n==null?void 0:n.theme,l=a(a({},I),t),[s,c]=useState({first:r}),{creditGrants:u$1,isLoading:y,error:p,paging:g,totalCount:f}=Zr({currencyId:e,pageSize:r,paging:s}),{pageNumber:h,pageChangeFunc:C}=Jp(g,c,r);return jsx(w,{componentTheme:a$1,children:jsxs(jS,{className:"stigg-credit-grants-container",children:[jsx(eT,{className:"stigg-credit-grants-card",children:jsx(Kp,{creditGrants:u$1,isLoading:y,error:p,localization:l,decimalPlaces:o,pageSize:r,pageNum:h,totalCount:f,onPageChange:C})}),jsx(q,{source:"grant_list",align:"end",smallScreenAlign:"end",style:{marginTop:0},showWatermark:i==null?void 0:i.getShowWatermark()})]})})}var jp=e.div`
|
|
992
992
|
display: flex;
|
|
993
993
|
flex-direction: column;
|
|
994
994
|
gap: 16px;
|
|
@@ -997,16 +997,16 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
|
1000
|
+
`;var em=e.div`
|
|
1001
1001
|
display: flex;
|
|
1002
1002
|
align-items: center;
|
|
1003
1003
|
gap: 4px;
|
|
1004
|
-
`;var
|
|
1004
|
+
`;var ta=e.div`
|
|
1005
1005
|
display: flex;
|
|
1006
1006
|
flex-direction: column;
|
|
1007
1007
|
gap: 4px;
|
|
1008
1008
|
width: 100%;
|
|
1009
|
-
`;var
|
|
1009
|
+
`;var tm=e.div`
|
|
1010
1010
|
display: flex;
|
|
1011
1011
|
align-items: center;
|
|
1012
1012
|
justify-content: center;
|
|
@@ -1014,26 +1014,26 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
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
|
|
1017
|
+
`;function jr(e){let t=u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=useCallback(()=>d(null,null,function*(){if(!o)throw new Error("Stigg SDK is not initialized. Please check your API configuration.");if(!o.isCustomerLoaded)return null;try{let s={customerId:e.customerId,currencyId:e.currencyId};return yield o.getAutomaticRechargeConfiguration(s)}catch(s){throw console.error("Error fetching automatic recharge configuration:",s),s}}),[o,e.customerId,e.currencyId,r]),{data:i,error:a,isLoading:l}=C({func:n});return {config:i,isLoading:l,error:a}}function om({customerId:e,currencyId:t}){let{config:o,isLoading:r,error:n}=jr({customerId:e,currencyId:t}),i=useMemo(()=>{if(!o)return {isConfigured:false,isEnabled:false,thresholdValue:0,targetBalance:0,currentMonthlySpend:0,maxSpendLimit:0,spendPercentage:0,showActiveState:false};let a=o.maxSpendLimit&&o.maxSpendLimit>0?Gr(o.currentMonthlySpend||0,o.maxSpendLimit):0,l=true,s=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:a,showActiveState:s}},[o]);return b(a({},i),{isLoading:r,error:n})}var rm=e(jp)`
|
|
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
|
-
`,
|
|
1021
|
+
`,nm=e.div`
|
|
1022
1022
|
display: flex;
|
|
1023
1023
|
align-items: center;
|
|
1024
1024
|
justify-content: flex-start;
|
|
1025
|
-
`;function
|
|
1025
|
+
`;function im(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 am({customerId:e,currencyId:t,currencyUnit:o="Credits",billingCurrency:r="$",onManageClick:n,className:i,localization:a$1}){let{thresholdValue:l,targetBalance:s,currentMonthlySpend:c,maxSpendLimit:u,spendPercentage:y,showActiveState:p,isLoading:g,error:f$1}=om({customerId:e,currencyId:t}),h=a(a({},K),a$1&&Object.fromEntries(Object.entries(a$1).filter(([x,A])=>A!==void 0))),C=im(h.descriptionTemplate,{target:Gt(s),unit:o,threshold:Gt(l)}),b=im(h.spendTemplate,{currency:r,current:Gt(c),limit:Gt(u)});return f$1?jsx(rm,{className:`stigg-auto-recharge-status stigg-auto-recharge-status-error ${i||""}`,children:jsx(f,{variant:"body1",color:"error",children:f$1.message||"Failed to load auto-recharge status"})}):jsxs(rm,{className:`stigg-auto-recharge-status ${i||""}`,children:[jsxs(Rt,{children:[jsxs(em,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-auto-recharge-title",children:h.title}),!g&&p&&jsx(uo,{variant:"success",label:h.activeLabel,className:"stigg-auto-recharge-status-chip",size:"small"})]}),g?jsx(Je,{width:70,height:38,borderRadius:10}):jsx(Ut,{type:"button",onClick:n,className:"stigg-auto-recharge-manage-button","aria-label":`${h.manageButton} auto-recharge settings`,children:h.manageButton})]}),g?jsxs(ta,{children:[jsx(Je,{width:"100%",height:20}),jsx(Je,{width:"100%",height:8,borderRadius:0}),jsx(nm,{children:jsx(Je,{width:200,height:16})})]}):p?jsxs(ta,{children:[jsx(f,{variant:"body1",color:"primary",className:"stigg-auto-recharge-description",children:C}),jsx(Hr,{percentage:y,variant:"primary",className:"stigg-auto-recharge-progress"}),jsx(nm,{children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-spend",children:u>0?b:h.unlimitedSpendLimit})})]}):jsx(tm,{className:"stigg-auto-recharge-empty",children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-empty-text",children:h.emptyStateMessage})})]})}var nT=e.div`
|
|
1026
1026
|
display: flex;
|
|
1027
1027
|
flex-direction: column;
|
|
1028
1028
|
gap: 8px;
|
|
1029
1029
|
width: 100%;
|
|
1030
|
-
`;function
|
|
1030
|
+
`;function sm(e){let t=he(ee),o=u({optional:true}),r=o==null?void 0:o.theme,n=jsx(nT,{className:"stigg-auto-recharge-status-container",children:jsx(am,a({},e))});return t?n:jsx(w,{componentTheme:r,children:n})}function lm(e){return Fg({},{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 nt(e,t={},o){var a,l,s,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=((a=o.thresholdMax)==null?void 0:a.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=((s=o.spendLimitMin)==null?void 0:s.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 tn({initialData:e,poolSize:t,localization:o}){var C,b$1,x,A,S,F,B,k,T,I,E,L,M,$;let[r,n]=useState({enabled:(C=e==null?void 0:e.enabled)!=null?C:false,thresholdAmount:(x=(b$1=e==null?void 0:e.thresholdAmount)==null?void 0:b$1.toString())!=null?x:"",targetBalance:(S=(A=e==null?void 0:e.targetBalance)==null?void 0:A.toString())!=null?S:"",maxSpendLimit:(B=(F=e==null?void 0:e.maxSpendLimit)==null?void 0:F.toString())!=null?B:""}),[i,a$1]=useState({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),l=nt({enabled:(k=e==null?void 0:e.enabled)!=null?k:false,thresholdAmount:(I=(T=e==null?void 0:e.thresholdAmount)==null?void 0:T.toString())!=null?I:"",targetBalance:(L=(E=e==null?void 0:e.targetBalance)==null?void 0:E.toString())!=null?L:"",maxSpendLimit:($=(M=e==null?void 0:e.maxSpendLimit)==null?void 0:M.toString())!=null?$:""},{poolSize:t},o),[s,c]=useState(l);return {formData:r,errors:s,touched:i,handleEnabledChange:R=>{let z=R.target.checked;if(n(K=>b(a({},K),{enabled:z})),!z)c({}),a$1({});else {let K=nt(b(a({},r),{enabled:true}),{poolSize:t},o);c(K),a$1({thresholdAmount:true,targetBalance:true,maxSpendLimit:true});}},handleFieldChange:R=>z=>{let K=z.target.value,Ve=b(a({},r),{[R]:K});n(Ve),a$1(V=>b(a({},V),{[R]:true}));let ut=nt(Ve,{poolSize:t},o);c(ut);},handleFieldBlur:R=>()=>{a$1(K=>b(a({},K),{[R]:true}));let z=nt(r,{poolSize:t},o);c(z);},getFieldError:R=>i[R]?s[R]:void 0,validate:()=>{let R=nt(r,{poolSize:t},o);return c(R),r.enabled&&a$1({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),Object.keys(R).length===0},getFormValues:()=>{var R,z,K;return {enabled:r.enabled,thresholdAmount:(R=r.thresholdAmount)!=null&&R.trim()?parseFloat(r.thresholdAmount.trim()):void 0,targetBalance:(z=r.targetBalance)!=null&&z.trim()?parseFloat(r.targetBalance.trim()):void 0,maxSpendLimit:(K=r.maxSpendLimit)!=null&&K.trim()?parseFloat(r.maxSpendLimit.trim()):void 0}}}}var fo=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
|
-
`,
|
|
1036
|
+
`,yo=e.div`
|
|
1037
1037
|
display: flex;
|
|
1038
1038
|
flex-direction: column;
|
|
1039
1039
|
gap: 8px;
|
|
@@ -1042,12 +1042,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,B,A,G,H as H$1,C,I,q,r,k,K,o,l,m,n}fro
|
|
|
1042
1042
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
1043
1043
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
1044
1044
|
box-shadow: 1px 6px 14px 0px rgba(26, 26, 26, 0.1);
|
|
1045
|
-
`,
|
|
1045
|
+
`,na=e(Info)`
|
|
1046
1046
|
width: 12px;
|
|
1047
1047
|
height: 12px;
|
|
1048
1048
|
color: ${({theme:e})=>{var t,o,r;return (r=(o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.text)==null?void 0:r.secondary}};
|
|
1049
1049
|
cursor: help;
|
|
1050
|
-
`,
|
|
1050
|
+
`,ia=e(zx)`
|
|
1051
1051
|
font-family: custom-font, 'DM Sans', sans-serif;
|
|
1052
1052
|
align-items: center;
|
|
1053
|
-
`;function
|
|
1053
|
+
`;function on({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:a$1,readOnly:l=false,localization:s,onSave:c,onCancel:u$1}){var E,L,M;let y=he(ee),p=u({optional:true}),g=p==null?void 0:p.theme,f$1=useMemo(()=>lm(s),[s]),{formData:h,errors:C,handleEnabledChange:b,handleFieldChange:x,handleFieldBlur:A,getFieldError:S,validate:F,getFormValues:B}=tn({initialData:o,poolSize:n,localization:f$1}),k=useMemo(()=>h.enabled?Object.keys(C).length>0:false,[C,h.enabled]),T=useCallback(()=>{if(F()&&c){let $=B();c(a({customerId:e,currencyId:t},$));}},[F,c,B,e,t]),I=jsx(fo,{className:"stigg-automatic-recharge-form-container",children:jsxs(yo,{className:"stigg-automatic-recharge-form-card",children:[jsxs(ke,{display:"flex",flexDirection:"column",gap:.5,children:[jsx(f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:f$1.title}),jsx(f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:f$1.enableLabel})]}),jsx(ke,{display:"flex",flexDirection:"column",gap:1,children:jsx(Yh,{control:jsx(Zh,{checked:h.enabled,onChange:b,disabled:l}),label:jsx(f,{variant:"body1",color:"primary",children:f$1.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxs(ke,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:f$1.thresholdFieldPrefix})," ",f$1.thresholdFieldSuffix]}),jsx(We,{title:f$1.thresholdTooltip,children:jsx(na,{})})]}),jsx(NumericFormat,{customInput:pe,fullWidth:true,thousandSeparator:true,value:h.thresholdAmount,onValueChange:$=>{let R={target:{value:$.value}};x("thresholdAmount")(R);},onBlur:A("thresholdAmount"),placeholder:f$1.thresholdFieldPlaceholder,error:!!S("thresholdAmount"),helperText:(E=S("thresholdAmount"))!=null?E:"",disabled:l||!h.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-threshold-input"})]}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-target-field",children:[jsxs(ke,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:f$1.targetFieldPrefix})," ",f$1.targetFieldSuffix]}),jsx(We,{title:f$1.targetBalanceTooltip,children:jsx(na,{})})]}),jsx(NumericFormat,{customInput:pe,fullWidth:true,thousandSeparator:true,value:h.targetBalance,onValueChange:$=>{let R={target:{value:$.value}};x("targetBalance")(R);},onBlur:A("targetBalance"),placeholder:f$1.targetFieldPlaceholder,error:!!S("targetBalance"),helperText:(L=S("targetBalance"))!=null?L:"",disabled:l||!h.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-target-input"})]}),jsxs(ke,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-spend-limit-field",children:[jsxs(ke,{display:"flex",flexDirection:"column",gap:.5,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(ke,{component:"span",fontWeight:"bold",children:f$1.spendLimitFieldPrefix})," ",f$1.spendLimitFieldSuffix]}),jsx(f,{variant:"caption",color:"secondary",style:{fontSize:"12px"},children:f$1.spendLimitHelpText})]}),jsx(NumericFormat,{customInput:pe,fullWidth:true,thousandSeparator:true,value:h.maxSpendLimit,onValueChange:$=>{let R={target:{value:$.value}};x("maxSpendLimit")(R);},onBlur:A("maxSpendLimit"),placeholder:f$1.spendLimitFieldPlaceholder,error:!!S("maxSpendLimit"),helperText:(M=S("maxSpendLimit"))!=null?M:"",disabled:l||!h.enabled,InputProps:{startAdornment:jsx(f,{variant:"body1",color:"secondary",children:"$"}),endAdornment:jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:["/ ",f$1.spendLimitPeriod]})},className:"stigg-automatic-recharge-form-spend-limit-input"})]}),!l&&h.enabled&&h.thresholdAmount&&jsxs(Fragment,{children:[i!==void 0&&i<=parseFloat(h.thresholdAmount)&&jsx(ia,{severity:"warning",className:"stigg-automatic-recharge-form-warning",children:f$1.immediateRechargeWarning.replace("{{threshold}}",se(parseFloat(h.thresholdAmount))||"0").replace("{{currencyUnit}}",r||"")}),h.maxSpendLimit&&h.maxSpendLimit.trim()!==""&&parseFloat(h.maxSpendLimit)>0&&a$1!==void 0&&a$1+0>=parseFloat(h.maxSpendLimit)&&jsx(ia,{severity:"warning",className:"stigg-automatic-recharge-form-spend-limit-warning",children:f$1.spendLimitTooLowWarning.replace("{{currentSpend}}",cn(a$1)).replace("{{spendLimit}}",cn(parseFloat(h.maxSpendLimit)))})]}),!l&&jsxs(ke,{display:"flex",justifyContent:"flex-end",gap:1,pt:2,className:"stigg-automatic-recharge-form-actions",children:[u$1&&jsx(te,{variant:"outlined",onClick:u$1,className:"stigg-automatic-recharge-form-cancel-button",children:f$1.cancelButton}),c&&jsx(te,{variant:"contained",onClick:T,disabled:k,className:"stigg-automatic-recharge-form-save-button",children:f$1.saveButton})]})]})});return y?I:jsx(w,{componentTheme:g,children:I})}function pm(){let e=u(),t=e==null?void 0:e.stigg,[o,r]=useState(false),[n,i]=useState(null);return {updateConfig:useCallback(l=>d(null,null,function*(){var s,c,u;if(!t||!t.isCustomerLoaded){let y=new Error("Stigg SDK not initialized or customer not loaded");throw i(y),y}r(true),i(null);try{let y={customerId:l.customerId,currencyId:l.currencyId,isEnabled:l.enabled,thresholdValue:(s=l.thresholdAmount)!=null?s:0,thresholdType:ThresholdType.CreditAmount,targetBalance:(c=l.targetBalance)!=null?c:0,maxSpendLimit:(u=l.maxSpendLimit)!=null?u:null},p=yield t.saveAutomaticRechargeConfiguration(y);return yield t.refresh(),r(!1),p}catch(y){let p=y instanceof Error?y: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 gm({customerId:e,currencyId:t,currencyUnit:o,poolSize:r,readOnly:n=false,localization:i,onSave:a,onCancel:l}){var B;let s=he(ee),c=u({optional:true}),u$1=c==null?void 0:c.theme,{config:y,isLoading:p,error:g}=jr({customerId:e,currencyId:t}),f$1=A({currencyId:t}),{updateConfig:h,isLoading:C,error:b}=pm(),x=useCallback(k=>d(null,null,function*(){try{yield h(k),a&&a(k);}catch(T){console.error("Failed to save automatic recharge configuration:",T);}}),[h,a]),A$1=y?{id:"",enabled:y.isEnabled,thresholdAmount:y.thresholdValue,targetBalance:y.targetBalance,maxSpendLimit:(B=y.maxSpendLimit)!=null?B:void 0,currencyId:y.currencyId,customerId:y.customerId}:void 0;if(p){let k=jsxs("div",{children:[jsx(Je,{width:300,height:24,style:{marginBottom:"16px"}}),jsx(Je,{width:400,height:200})]});return s?k:jsx(w,{componentTheme:u$1,children:k})}if(g){let k=jsx(fo,{className:"stigg-automatic-recharge-form-container",children:jsx(yo,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:g.message||"Failed to load automatic recharge configuration"})})});return s?k:jsx(w,{componentTheme:u$1,children:k})}if(f$1.isFallback){let k=jsx(fo,{className:"stigg-automatic-recharge-form-container",children:jsx(yo,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:"Failed to load credit balance"})})});return s?k:jsx(w,{componentTheme:u$1,children:k})}let S=o||f$1.currency.unitPlural||f$1.currency.displayName||"Credits",F=jsxs(Fragment,{children:[b&&jsx(f,{variant:"body1",color:"error",style:{marginBottom:"16px"},children:b.message||"Failed to save automatic recharge configuration"}),jsx(on,{customerId:e,currencyId:t,initialData:A$1,currencyUnit:S,poolSize:r,currentBalance:f$1.remaining,currentMonthlySpend:y==null?void 0:y.currentMonthlySpend,readOnly:n||C,localization:i,onSave:x,onCancel:l})]});return s?F:jsx(w,{componentTheme:u$1,children:F})}export{$o as AddonsList,sm as AutoRechargeStatus,gm as AutomaticRechargeConfig,on as AutomaticRechargeConfigForm,Kb as BooleanEntitlementGuard,vp as Checkout,Up as CreditBalance,Xp as CreditGrants,Dp as CreditUsageChart,zp as CreditUtilization,rc as CustomerPortal,Do as CustomerPortalProvider,ur as CustomerUsageData,qr as EmptyState,nS as EnumEntitlementGuard,Kr as ErrorState,Jr as GenericTable,gr as InvoicesSection,tS as MeteredEntitlementGuard,Xb as NumericEntitlementGuard,ar as PaymentDetailsSection,Es as Paywall,zo as Promotions,Wi as ProvisionStatus,uo as StatusChip,un as SubscribeIntentionType,tr as SubscriptionsOverview,ei as formatDateOnly,jn as formatDateTime,er as isCreditEntitlement,kt as isFeatureEntitlement,ea as mapCreditGrantStatusToVariant,tn as useAutomaticRechargeForm,Zr as useCreditGrants,Np as useWaitForCheckoutCompleted,nt as validateAutomaticRechargeForm};
|