@stigg/react-sdk 7.28.0 → 8.1.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-767SG75X.cjs.js → CreditUsageChart-S55GF7BO.cjs.js} +19 -19
- package/dist/CreditUsageChart-WJZI2Q44.esm.js +162 -0
- package/dist/{chunk-LW3LLUI6.cjs.js → chunk-3NBXYYSD.cjs.js} +10 -10
- package/dist/{chunk-B5FDE2OH.esm.js → chunk-UL6DNWT4.esm.js} +10 -10
- package/dist/index.d.mts +13 -30
- package/dist/index.d.ts +13 -30
- package/dist/stigg-sdk.cjs.js +174 -174
- package/dist/stigg-sdk.esm.js +110 -110
- package/package.json +1 -1
- package/dist/CreditUsageChart-URN6IPYD.esm.js +0 -162
package/dist/stigg-sdk.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,
|
|
1
|
+
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}from'./chunk-UL6DNWT4.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-UL6DNWT4.esm.js';import {BillingModel,PaymentCollection,SubscriptionStatus,PricingType,BillingPeriod,SubscriptionScheduleType,ThresholdType,DiscountType,DiscountDurationType,Currency,BillingVendorIdentifier,CreditGrantType,WidgetType,FontWeight,MeterType,EntitlementResetPeriod,TiersMode,Alignment}from'@stigg/js-client-sdk';export*from'@stigg/js-client-sdk';import ii,{forwardRef,lazy,useContext,useMemo,useState,useEffect,Suspense,useCallback,useRef,createElement}from'react';import xu from'classnames';import Ne from'@mui/material/Grid/index.js';import ic from'lodash/compact.js';import {NumericFormat,numericFormatter}from'react-number-format';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import Na from'lodash/isFunction.js';import Rm from'react-spinners/ClipLoader.js';import {css,useTheme}from'@emotion/react';import yo from'dayjs';import Am from'dayjs/plugin/utc.js';import Bm from'dayjs/plugin/relativeTime.js';import Im from'dayjs/plugin/advancedFormat.js';import xo from'lodash/isNil.js';import Nm from'lodash/sum.js';import Zm from'currency-symbol-map';import jm from'@mui/material/InputAdornment/index.js';import Ym,{buttonClasses}from'@mui/material/Button/index.js';import qm from'@mui/material/TextField/index.js';import Cl from'@mui/material/Divider/index.js';import eu from'@mui/material/OutlinedInput/index.js';import tu from'@mui/material/Select/index.js';import ou from'@mui/material/MenuItem/index.js';import ru from'lodash/map.js';import Te from'@mui/material/Box/index.js';import Wu from'react-switch';import ng from'lodash/countBy.js';import ig from'lodash/uniq.js';import Yl from'lodash/sortBy.js';import dg from'lodash/merge.js';import Qe from'react-loading-skeleton';import wg from'lodash/flatMap.js';import Rs from'@mui/material/Tab/index.js';import Ag from'lodash/isEmpty.js';import Lg from'@mui/material/Tabs/index.js';import Ug from'@mui/material/useMediaQuery/index.js';import {ExternalLink,ChevronRight,Info,Minus,Plus,ArrowDown}from'react-feather';import xf from'@mui/material/Link/index.js';import uf,{tooltipClasses}from'@mui/material/Tooltip/index.js';import wl from'lodash/keyBy.js';import bi from'color';import kf,{linearProgressClasses}from'@mui/material/LinearProgress/index.js';import Hf from'lodash/padStart.js';import Ml from'lodash/isUndefined.js';import {BillingModel as BillingModel$1,BillingPeriod as BillingPeriod$1}from'@stigg/api-client-js/src/generated/sdk.js';import Vn from'lodash/lowerCase.js';import ty from'lodash/range.js';import {produce}from'immer';import dy from'lodash/cloneDeep.js';import py from'lodash/remove.js';import {Elements,useStripe,useElements,AddressElement,PaymentElement}from'@stripe/react-stripe-js';import ch from'@mui/material/StepIcon/index.js';import hP from'lodash/partition.js';import bh from'@mui/material/CircularProgress/index.js';import bP from'@mui/material/Paper/index.js';import SP from'@mui/material/Alert/index.js';import Bh from'@mui/material/Checkbox/index.js';import Ih from'@mui/material/FormControlLabel/index.js';import Fh from'lodash/isString.js';import hx from'@mui/material/Autocomplete/index.js';import Cx 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 as IS$1,IN,ID,IE,IL,IT,JP,KZ,KE,KG,LA,LV,LI,LT,LU,MY,MT,MR,MX,MD,ME,MA,NP,NL,NZ,NG,MK,NO,OM,PE,PH,PL,PT,RO,RU,SA,SN,RS as RS$1,SG,SK,SI,ZA,KR,ES,SR,SE,CH,TW,TJ,TZ,TH,TR,UG,UA,AE,GB,US,UY,UZ,VE,VN,ZM,ZW}from'country-flag-icons/react/3x2';import ed from'lodash/startCase.js';import td from'lodash/upperCase.js';import Ux from'react-lottie';import mP from'@mui/material/IconButton/index.js';import {styled}from'@mui/material/styles/index.js';import YP from'@mui/material/Radio/index.js';import tb from'@mui/material/Chip/index.js';import vS from'lodash/capitalize.js';import {TableContainer,Table,Divider,TableCell,TableRow,TablePagination,TableBody,TableHead}from'@mui/material';import lS from'@mui/material/TableRow/index.js';function uo(e,t,o){let r=o?` ${o}`:"";return (!e||e===1)&&t?`Up to ${t}${r}`:e&&e>1&&t?`${e}-${t}${r}`:e&&e>1?`Minimum ${e}${r}`:""}function ie(e,t="en-US"){if(e==null)return;let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:0,fixedDecimalScale:true};return numericFormatter(String(Math.round(e)),o)}function jr(e,t="en-US"){let o={thousandSeparator:t==="en-US"?",":" ",decimalSeparator:".",decimalScale:2,fixedDecimalScale:true};return numericFormatter(String(e),o)}function Ut(e,t=1){if(e<1e6)return ie(e)||"0";let o=[{value:1e12,suffix:"T"},{value:1e9,suffix:"B"},{value:1e6,suffix:"M"}];for(let{value:r,suffix:n}of o)if(e>=r){let a=(e/r).toFixed(t);return a.includes(".")&&(a=a.replace(/\.0+$/,"").replace(/(\.\d*[1-9])0+$/,"$1")),`${a}${n}`}return ie(e)||"0"}var dm=e(f)`
|
|
2
2
|
margin: 0;
|
|
3
3
|
`,pm=e.div`
|
|
4
4
|
display: flex;
|
|
@@ -12,11 +12,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
12
12
|
width: 24px;
|
|
13
13
|
height: 24px;
|
|
14
14
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
15
|
-
`;function
|
|
15
|
+
`;function go({displayName:e,className:t}){return jsxs(pm,{className:`stigg-entitlement-row-container ${t}`,children:[jsx(mm,{children:jsx(um,{icon:"EntitlementCheck",className:"stigg-entitlement-row-icon"})}),jsx(dm,{className:"stigg-entitlement-name",variant:"h6",color:"secondary",children:e})]})}function fm(e){if(!e)return "";switch(e){case EntitlementResetPeriod.Day:return "per day";case EntitlementResetPeriod.Hour:return "per hour";case EntitlementResetPeriod.Week:return "per week";case EntitlementResetPeriod.Month:return "per month";case EntitlementResetPeriod.Year:return "per year";default:return ""}}function ym({hasUnlimitedUsage:e,feature:t,resetPeriod:o,usageLimit:r,minUnitQuantity:n,maxUnitQuantity:i,isCustom:a,enumValues:l}){let s=n||i,d=`${o&&r?`${fm(o)}`:""}`;if(l){let u=l.length===1?t==null?void 0:t.featureUnits:t==null?void 0:t.featureUnitsPlural;return `${l.length} ${u}`}if(e)return `Unlimited ${t==null?void 0:t.featureUnitsPlural}`;if(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 `${ie(r)} ${u} ${d}`}return s?uo(n,i,t==null?void 0:t.featureUnitsPlural):t==null?void 0:t.displayName}function tn(e){let i=e,{displayNameOverride:t,feature:o}=i,r=c(i,["displayNameOverride","feature"]),n=t||ym(a({feature:o},r))||"";return jsx(go,{displayName:n,className:`stigg-entitlement-${o==null?void 0:o.refId}`})}function Cm(e){var a,l;let{amount:t,customCurrency:o,displayNameOverride:r}=e,n=t!=null?t:0;if(r)return r;let i=n===1?(a=o.units)==null?void 0:a.singular:(l=o.units)==null?void 0:l.plural;return `${ie(n)} ${i||o.displayName}`}function Ta({entitlement:e}){let t=Cm(e);return jsx(go,{displayName:t,className:`stigg-credit-entitlement-${e.id}`})}function Sm(e){return e.__typename==="PackageCreditEntitlement"}var Tm=e.div`
|
|
16
16
|
display: flex;
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
gap: 16px;
|
|
19
|
-
`;function km(e,t,o){if(t.entitlementsTitle)return t.entitlementsTitle(e);let r=o?"Includes:":"";return e.basePlan&&(r=`Everything in ${e.basePlan.displayName}${o?", plus:":""}`),r}function wa({plan:e,billingPeriod:t,paywallLocale:o}){var l;let n=(((l=e.pricePoints)==null?void 0:l.filter(
|
|
19
|
+
`;function km(e,t,o){if(t.entitlementsTitle)return t.entitlementsTitle(e);let r=o?"Includes:":"";return e.basePlan&&(r=`Everything in ${e.basePlan.displayName}${o?", plus:":""}`),r}function wa({plan:e,billingPeriod:t,paywallLocale:o}){var l;let n=(((l=e.pricePoints)==null?void 0:l.filter(s=>s.billingPeriod===t))||[]).filter(s=>(s==null?void 0:s.minUnitQuantity)&&(s==null?void 0:s.minUnitQuantity)>1||(s==null?void 0:s.maxUnitQuantity)).map(s=>{var d;return jsx(tn,{feature:s!=null&&s.feature?{refId:s.feature.featureId,featureUnits:s.feature.units,featureUnitsPlural:s.feature.unitsPlural,unitQuantity:s.feature.unitQuantity,displayName:s.feature.displayName}:null,minUnitQuantity:s==null?void 0:s.minUnitQuantity,maxUnitQuantity:s==null?void 0:s.maxUnitQuantity},`priceUnitEntitlement-${(d=s==null?void 0:s.feature)==null?void 0:d.displayName}`)}),i=ic(e.packageEntitlements).filter(s=>s.isGranted).filter(s=>{var d;return !((d=s.hiddenFromWidgets)!=null&&d.includes(WidgetType.Paywall))}),a=n.length>0||i.length>0;return jsxs(Tm,{className:"stigg-plan-entitlements-container",children:[jsx(f,{className:"stigg-plan-entitlements-title",color:"secondary",variant:"h6",bold:true,children:km(e,o,a)}),n,i.map(s=>Sm(s)?jsx(Ta,{entitlement:s},ka(s)):jsx(tn,{displayNameOverride:s.displayNameOverride,feature:s.feature,resetPeriod:s.resetPeriod,hasUnlimitedUsage:s.hasUnlimitedUsage,usageLimit:s.usageLimit,enumValues:s.enumValues,isCustom:s.isCustom},ka(s)))]})}function ka(e){return `${e.__typename}:${e.id}`}var on=(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))(on||{});yo.extend(Am);yo.extend(Bm);yo.extend(Im);var Q=yo;var nn=e=>Q.utc(e).format("MMMM Do, YYYY");function ho(e){return String(e.scheduledExecutionTime)}function vm(e){return e!=null&&e.end?String(e.end):void 0}function Co({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,d=vm(o);return xo(s)&&d&&(s=!Q(ho(e)).isSame(Q(d),"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 ",nn(ho(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 ",nn(ho(e))]}):i,"."]})}}case SubscriptionScheduleType.UnitAmount:{let s=e.scheduleVariables,u=ic(t==null?void 0:t.map(({feature:C})=>C)).find(({id:C})=>C===s.featureId),{featureUnits:f,featureUnitsPlural:m}=u||{},h=s.newUnitAmount===1?f:m,g=jsxs(Fragment,{children:["Your subscription will be updated to ",jsx("b",{children:s.newUnitAmount})," ",h," ",n?jsxs(Fragment,{children:["on ",nn(ho(e))]}):i,"."]}),y=`Until then you still have access to your current ${f} count.`;return {line1:g,line2:y}}default:return {}}}function Fa(e){return e.feature&&(e.feature.unitQuantity!==1?e.feature.unitsPlural:e.feature.units)||""}function ln(e,t){let o=[...e];o.sort((r,n)=>r.upTo?n.upTo?r.upTo-n.upTo:-1:1);for(let r of o)if(r.upTo&&t<=r.upTo)return r;return o[o.length-1]}function Ia(e,t,o){return t===BillingPeriod.Annually&&o?e/12:e}function sn(e,t,o,r){let n=0;if(e.unitPrice){let i=Ia(e.unitPrice.amount,o,r);n+=i*t;}return e.flatPrice&&(n+=Ia(e.flatPrice.amount,o,r)),n}function cn(e,t,o,r){let n=t,i=0,a=0,l=[];for(;n>0&&a<e.length;){let d=e[a],{upTo:u}=d;if(xo(u))l.push({unitQuantity:n,amount:sn(d,n,o,r)}),n=0;else {let f=u-i,m=Math.min(n,f);l.push({unitQuantity:m,amount:sn(d,m,o,r)}),n-=m,i=u;}a+=1;}let s=Nm(l.map(({amount:d})=>d));return {breakdown:l,total:s}}function yt(e,t,o,r){if(!e.tiers)return 0;switch(e.tiersMode){case TiersMode.Volume:{let n=ln(e.tiers,t);return sn(n,t,o,r)}case TiersMode.Graduated:return cn(e.tiers,t,o,r).total;default:return 0}}function Dt(e){return e==null?void 0:e.some(({unitPrice:t,upTo:o})=>t&&!xo(o))}function Ea(e){return e==null?void 0:e.every(({unitPrice:t,upTo:o})=>!t||xo(o))}function va(e,t){return (e==null?void 0:e[0].upTo)&&t<=e[0].upTo}function Po({plan:e,billingPeriod:t,currentSubscription:o,currentSubscriptionOverride:r,selectDefaultTierIndex:n}){let i=e.pricePoints.filter(a=>a.billingPeriod===t&&a.isTieredPrice);if(i.length===1){let[a]=i,{featureId:l}=a.feature,s=n?n({plan:e}):0,d=a.tiers[s],u=Dt(a.tiers)?1:d.upTo||1;if(o&&o.plan.id===e.id){let m=o.prices.find(h=>{var g;return h.pricingModel===BillingModel.PerUnit&&h.tiersMode&&((g=h.feature)==null?void 0:g.featureId)===l});m&&(u=m.feature.unitQuantity||1);}if((r==null?void 0:r.planId)===e.id){let m=r.billableFeatures.find(h=>h.featureId===l);m&&(u=m.quantity);}let f={};return f[l]=u,f}return {}}function La({perUnitQuantityByFeature:e,plan:t,currentSubscription:o,currentSubscriptionOverride:r}){var u,f;if(!o)return 0;let n=o.prices.find(m=>m.pricingModel===BillingModel.PerUnit&&m.tiersMode),i=t.id===(r==null?void 0:r.planId);if(i&&(n=(u=t.pricePoints.find(m=>m.pricingModel===BillingModel.PerUnit&&m.tiersMode))!=null?u:n),!n)return 0;let{featureId:a,unitQuantity:l}=n.feature,s=l;if(i){let m=(f=r==null?void 0:r.billableFeatures)==null?void 0:f.find(h=>h.featureId===a);m&&(s=m.quantity);}if(xo(s))return 0;let d=e[a];return d<s?-1:d>s?1:0}var Dm=e(Rm)`
|
|
20
20
|
margin-left: 10px;
|
|
21
21
|
`,$m=e.button`
|
|
22
22
|
cursor: ${({$disabled:e})=>e?"default":"pointer"};
|
|
@@ -60,7 +60,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
60
60
|
margin-top: 4px;
|
|
61
61
|
align-self: ${({theme:e})=>j(e.stigg.layout.ctaAlignment)};
|
|
62
62
|
width: 100%;
|
|
63
|
-
`;function Ma({isNextPlan:e,customer:t,plan:o,billingPeriod:r,isCustomerOnTrial:n,onPlanSelected:i,paywallLocale:
|
|
63
|
+
`;function Ma({isNextPlan:e,customer:t,plan:o,billingPeriod:r,isCustomerOnTrial:n,onPlanSelected:i,paywallLocale:a,withTrialLeftRow:l,currentSubscription:s,currentSubscriptionOverride:d,perUnitQuantityByFeature:u}){let f=useTheme(),[m,h]=useState(false),{currentPlan:g,custom:y,downgrade:C,startTrial:b,upgrade:P,startNew:S,switchToBillingPeriod:T,cancelScheduledUpdate:I}=a.planCTAButton,A=Na(C)?C(o):C,B=Na(P)?P(o):P,k={title:t?o.isLowerThanCurrentPlan?A:B:S,disabled:false,intentionType:o.isLowerThanCurrentPlan?"DOWNGRADE_PLAN":n?"UPGRADE_TRIAL_TO_PAID":"UPGRADE_PLAN"},v=o.pricingType===PricingType.Custom,{line1:N}=Co({scheduledUpdate:o.scheduledUpdate,options:{withDate:true}});if(o.isTriable&&!o.isCurrentCustomerPlan&&!n)k.title=b(o),k.intentionType="START_TRIAL";else if(o.isCurrentCustomerPlan&&!n)if(r===o.currentCustomerPlanBillingPeriod||o.pricingType&&[PricingType.Free,PricingType.Custom].includes(o.pricingType))switch(La({perUnitQuantityByFeature:u,plan:o,currentSubscription:s,currentSubscriptionOverride:d})){case -1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=A;break;case 1:k.intentionType="CHANGE_UNIT_QUANTITY",k.title=B;break;default:k.title=g,k.disabled=true;break}else k.title=T(r),k.intentionType="CHANGE_BILLING_PERIOD";else v&&(k.title=typeof y=="function"?y({plan:o,selectedBillingPeriod:r}):y,k.intentionType="REQUEST_CUSTOM_PLAN_ACCESS");e&&o.scheduledUpdate&&(k.disabled=false,k.title=I,k.intentionType="CANCEL_SCHEDULED_UPDATES");let F=m||k.disabled;return jsx(Fragment,{children:jsx(Om,{className:"stigg-paywall-plan-button-layout",children:e&&N?jsxs(zm,{color:"secondary",variant:"body1",className:"stigg-paywall-schedule-update-text",children:[N," ",jsx(Vm,{color:"secondary",onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:k.title})]}):jsxs(Fragment,{children:[jsxs($m,{className:"stigg-paywall-plan-button","data-testid":`paywall-card-cta-${o.displayName}`,disabled:F,$disabled:F,onClick:()=>{h(true),Promise.resolve(i(k.intentionType)).finally(()=>h(false));},children:[jsx(Gm,{className:"stigg-paywall-plan-button-text",variant:"h6",color:"primary.main",children:k.title}),m&&jsx(Dm,{color:f.stigg.palette.text.disabled,loading:true,size:16})]}),l?jsx(Hm,{className:"stigg-trial-days-left-text",variant:"h6",color:"secondary",children:o.isCurrentCustomerPlan&&o.trialDaysLeft&&jsxs(Fragment,{children:[jsxs("b",{children:[o.trialDaysLeft," days"]})," left on your free trial"]})}):jsx("div",{style:{height:"20px"}})]})})})}var H=({amount:e,currency:t=Currency.Usd,locale:o,maximumFractionDigits:r=5,minimumFractionDigits:n=0,removeTrailingZero:i})=>{let a$1=t.toString(),l=Zm(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 Ua({planPrices:e,paywallCalculatedPrice:t,selectedBillingPeriod:o,locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:i,perUnitQuantityByFeature:a}){var C,b,P;let{amount:l,currency:s}=t||e[0],d=l||0,u=e.length===1,f=o===BillingPeriod.Annually&&n?d/12:d,m,h,g=i.price.pricePeriod(n?BillingPeriod.Monthly:BillingPeriod.Annually),y=g;for(let S of e)if(S.isTieredPrice&&S.tiers){let T=(a==null?void 0:a[S.feature.featureId])||1;m=S.tiers,h=Fa(S),f+=yt(S,T,o,n);}if(u){let S=e[0],T=S.blockSize&&S.blockSize>1?`for ${k(S.blockSize)} ${((C=S.feature)==null?void 0:C.unitsPlural)||((b=S.feature)==null?void 0:b.units)||""}`:`per ${((P=S.feature)==null?void 0:P.units)||""}`;S.pricingModel===BillingModel.PerUnit&&!S.isTieredPrice?y=`${T} ${g}`:S.pricingModel===BillingModel.UsageBased&&(y=`${T}`);}return {price:H({amount:f,currency:s,locale:r,minimumFractionDigits:2,removeTrailingZero:true}),unit:y,tiers:m,tierUnits:h}}function bo(e,t,o,r,n,i){var a$1;switch(e.pricingType){case PricingType.Free:return typeof o.price.free=="function"?o.price.free(e.paywallCurrency):o.price.free;case PricingType.Custom:return {price:typeof o.price.custom=="function"?o.price.custom({plan:e,selectedBillingPeriod:t}):o.price.custom};case PricingType.Paid:{let l=e.pricePoints.filter(u=>u.billingPeriod===t),s=(a$1=e.paywallCalculatedPricePoints)==null?void 0:a$1.find(u=>u.billingPeriod===t);if(!(l!=null&&l.length)&&!s)return {price:o.price.priceNotSet};let d={planPrices:l,paywallCalculatedPrice:s,selectedBillingPeriod:t,perUnitQuantityByFeature:i||{}};return o.price.paid?o.price.paid(b(a({},d),{plan:e})):Ua(b(a({},d),{locale:r,shouldShowMonthlyPriceAmount:n,paywallLocale:o}))}default:return {price:""}}}var Qm=e(Ym,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
64
64
|
border-radius: 10px;
|
|
65
65
|
text-transform: none;
|
|
66
66
|
font-weight: 300;
|
|
@@ -71,10 +71,10 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
71
71
|
&:hover {
|
|
72
72
|
background-color: ${({theme:e,$success:t,$error:o})=>t?e.stigg.palette.successDark:o?e.stigg.palette.errorDark:""};
|
|
73
73
|
}
|
|
74
|
-
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(Qm,a({variant:e},t))};var ce=e(qm)(({theme:e})=>({"& .MuiOutlinedInput-root":{height:"42px",borderRadius:e.stigg.border.radius,fieldset:{borderColor:e.stigg.palette.outlinedBorder},"&:not(.Mui-focused):hover fieldset":{borderColor:e.stigg.palette.outlinedRestingBorder}},"& .MuiInputBase-input":a({padding:"8px 12px",borderRadius:e.stigg.border.radius,fontFamily:e.stigg.typography.fontFamily,color:e.stigg.palette.text.primary},e.stigg.typography.body),"& .Mui-error":{fontFamily:e.stigg.typography.fontFamily},"& .MuiFormHelperText-root":{whiteSpace:"nowrap"}}));var _a=e(
|
|
74
|
+
`,te=o=>{var r=o,{variant:e="outlined"}=r,t=c(r,["variant"]);return jsx(Qm,a({variant:e},t))};var ce=e(qm)(({theme:e})=>({"& .MuiOutlinedInput-root":{height:"42px",borderRadius:e.stigg.border.radius,fieldset:{borderColor:e.stigg.palette.outlinedBorder},"&:not(.Mui-focused):hover fieldset":{borderColor:e.stigg.palette.outlinedRestingBorder}},"& .MuiInputBase-input":a({padding:"8px 12px",borderRadius:e.stigg.border.radius,fontFamily:e.stigg.typography.fontFamily,color:e.stigg.palette.text.primary},e.stigg.typography.body),"& .Mui-error":{fontFamily:e.stigg.typography.fontFamily},"& .MuiFormHelperText-root":{whiteSpace:"nowrap"}}));var _a=e(Ne)`
|
|
75
75
|
display: flex;
|
|
76
76
|
flex-direction: column;
|
|
77
|
-
`;function Da(){return jsxs(_a,{container:true,children:[jsxs(l,{item:true,$gap:48,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsx(Cl,{className:"stigg-checkout-plan-header-divider",sx:{marginY:2}}),jsxs(_a,{item:true,children:[jsx(o,{width:120,height:20}),jsxs(m,{$gap:16,marginTop:3,children:[jsx(o,{height:20}),jsx(o,{height:20})]}),jsxs(l,{$gap:130,marginTop:3,children:[jsx(n,{flex:1,children:jsx(o,{height:20})}),jsx(n,{flex:3,children:jsx(o,{height:20})})]})]})]})}var
|
|
77
|
+
`;function Da(){return jsxs(_a,{container:true,children:[jsxs(l,{item:true,$gap:48,children:[jsx(o,{width:120,height:20}),jsx(o,{width:120,height:20})]}),jsx(Cl,{className:"stigg-checkout-plan-header-divider",sx:{marginY:2}}),jsxs(_a,{item:true,children:[jsx(o,{width:120,height:20}),jsxs(m,{$gap:16,marginTop:3,children:[jsx(o,{height:20}),jsx(o,{height:20})]}),jsxs(l,{$gap:130,marginTop:3,children:[jsx(n,{flex:1,children:jsx(o,{height:20})}),jsx(n,{flex:3,children:jsx(o,{height:20})})]})]})]})}var ht=e=>e.target.blur();function $a({width:e,tierUnits:t,value:o,handleChange:r,errorMessage:n}){return jsx(ce,{type:"number",onWheel:ht,fullWidth:true,error:!!n,sx:{minHeight:"46px",width:e},InputProps:{endAdornment:jsx(jm,{position:"end",children:jsx(f,{variant:"body1",color:"primary",children:t})})},value:o,onChange:i=>{var l,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 nu=e(tu)`
|
|
78
78
|
border-radius: 10px;
|
|
79
79
|
min-height: 42px;
|
|
80
80
|
min-width: 120px;
|
|
@@ -90,9 +90,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
90
90
|
&.Mui-focused .MuiOutlinedInput-notchedOutline {
|
|
91
91
|
border-color: ${({theme:e})=>e.stigg.palette.primary} !important;
|
|
92
92
|
}
|
|
93
|
-
`;function Ga({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsx(nu,{value:e.toString(),fullWidth:true,error:!!i,onChange:
|
|
93
|
+
`;function Ga({value:e,componentId:t,tierUnits:o,tiers:r,handleChange:n,errorMessage:i}){return r?jsx(nu,{value:e.toString(),fullWidth:true,error:!!i,onChange:a=>{var s,d;let l=(s=a==null?void 0:a.target)!=null&&s.value?Number((d=a==null?void 0:a.target)==null?void 0:d.value):null;l&&n(l);},id:t,input:jsx(iu,{}),MenuProps:{MenuListProps:{disablePadding:true},PaperProps:{sx:{marginTop:"4px",borderRadius:"10px"}}},children:ru(r,a=>{var l;return jsx(ou,{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:[ie(a.upTo)," ",o]})},a.upTo)})}):null}var lu=e(f)`
|
|
94
94
|
min-height: 46px;
|
|
95
|
-
`;function
|
|
95
|
+
`;function So(e){let{tiers:t,errorMessage:o}=e;return jsx(Fragment,{children:jsxs(Te,{display:"flex",flexDirection:"column",justifyContent:"center",style:{width:"100%"},children:[jsx(lu,{as:"div",className:"stigg-price-tier-select",children:Dt(t)?jsx($a,a({},e)):jsx(Ga,a({},e))}),jsx(f,{style:{margin:"4px"},variant:"caption",color:"error",children:o})]})})}var Va="\u200E",pu=e(f)`
|
|
96
96
|
word-break: break-word;
|
|
97
97
|
width: 100%;
|
|
98
98
|
`,mu=e(f)`
|
|
@@ -100,7 +100,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
100
100
|
`,uu=e(f)`
|
|
101
101
|
white-space: normal;
|
|
102
102
|
min-height: 39px;
|
|
103
|
-
`;function gu({plan:e,billingPeriod:t,hasMonthlyPrice:o,hasAnnuallyPrice:r,paywallLocale:n}){var l,
|
|
103
|
+
`;function gu({plan:e,billingPeriod:t,hasMonthlyPrice:o,hasAnnuallyPrice:r,paywallLocale:n}){var l,s;let i=e.pricePoints.find(d=>d.billingPeriod===t),a=Va;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 Ha=({showStartingAt:e,withUnitPriceRow:t,withStartingAtRow:o,withTiersRow:r,plan:n,billingPeriod:i,paywallLocale:a$1,locale:l,hasMonthlyPrice:s,hasAnnuallyPrice:d,perUnitQuantityByFeature:u,setPerUnitQuantityByFeature:f$1})=>{var T;let{price:m,unit:h,tiers:g,tierUnits:y}=bo(n,i,a$1,l,s,u),C=n.pricePoints.find(I=>I.billingPeriod===i&&I.isTieredPrice),b$1=C?C.feature.featureId:void 0,P=(T=u[b$1||""])!=null?T:1,S=I=>{b$1&&f$1(A=>b(a({},A),{[b$1]:I}));};return jsx(pu,{as:"div",className:"stigg-price-text",children:jsxs(Fragment,{children:[o&&jsx(f,{style:{minHeight:"20px"},className:"stigg-starting-at-text",variant:"body1",color:"secondary",children:e?a$1.price.startingAtCaption:Va}),jsx(uu,{className:"stigg-price-point",variant:"h1",children:m}),t&&jsxs(f,{as:"div",className:"stigg-price-unit-and-billing-period-text",style:{minHeight:"48px"},children:[jsx(mu,{className:"stigg-price-unit-text",as:"span",variant:"h6",color:"secondary",children:h}),jsx(gu,{plan:n,billingPeriod:i,hasAnnuallyPrice:d,hasMonthlyPrice:s,paywallLocale:a$1})]}),r?jsx(So,{componentId:`${n.id}_${b$1}_tier`,tiers:g,tierUnits:y,tiersMode:C==null?void 0:C.tiersMode,handleChange:S,value:P}):null]})})};var Pu=e(Ym)`
|
|
104
104
|
padding: 0px;
|
|
105
105
|
text-transform: none;
|
|
106
106
|
margin-left: 0px;
|
|
@@ -135,17 +135,17 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
135
135
|
white-space: nowrap;
|
|
136
136
|
min-width: 0;
|
|
137
137
|
flex-shrink: 1;
|
|
138
|
-
`,
|
|
138
|
+
`,Au=e(i)`
|
|
139
139
|
width: 24px;
|
|
140
140
|
height: 24px;
|
|
141
141
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
142
|
-
`,
|
|
142
|
+
`,Bu=e.div`
|
|
143
143
|
flex: 1;
|
|
144
144
|
min-width: 0;
|
|
145
145
|
`,Iu=e.div`
|
|
146
146
|
margin-top: 16px;
|
|
147
147
|
display: flex;
|
|
148
|
-
`,yn=4;function hn({addons:e,paywallLocale:t}){let[o,r]=useState(false);if(!e||e.length===0)return null;let n=e.filter(l=>{var
|
|
148
|
+
`,yn=4;function hn({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,yn);return a.length===0?null:jsxs(Su,{className:"stigg-compatible-addons-container",children:[jsx(f,{className:"stigg-compatible-addons-header",color:"secondary",variant:"body1",bold:true,children:t.addonsTitle}),jsx(Tu,{className:"stigg-compatible-addons-list",children:a.map(l=>jsxs(ku,{className:xu(`stigg-compatible-addon--${l.id}`,"stigg-compatible-addon-item"),children:[jsx(Au,{icon:"Add",className:"stigg-compatible-addon-icon"}),jsx(Bu,{className:"stigg-compatible-addon-content",children:jsx(wu,{variant:"body1",color:"primary",className:"stigg-compatible-addon-name",children:l.displayName})})]},l.id))}),n.length>yn&&jsx(Iu,{children:jsx(Pu,{variant:"text",onClick:i,children:jsx(bu,{color:"primary.main",children:o?"Show less":`Show ${n.length-yn} more`})})})]})}var Nu="66px",Mu=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}`};
|
|
@@ -197,7 +197,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
197
197
|
path {
|
|
198
198
|
fill: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
199
199
|
}
|
|
200
|
-
`;function Ou({text:e="Next",iconsColor:t}){return jsx(Vu,{children:jsxs(
|
|
200
|
+
`;function Ou({text:e="Next",iconsColor:t}){return jsx(Vu,{children:jsxs(Ne,{display:"flex",alignItems:"center",gap:1,children:[jsx(Hu,{$iconsColor:t}),jsx(f,{color:"primary",variant:"body1",children:e})]})})}function Wa({withUnitPriceRow:e,withTiersRow:t,withTrialLeftRow:o,customer:r,plan:n,billingPeriod:i,isHighlighted:a,currentSubscription:l,currentSubscriptionOverride:s,shouldShowDescriptionSection:d,hasMonthlyPrice:u,hasAnnuallyPrice:f,isCustomerOnTrial:m,onPlanSelected:h,paywallLocale:g,locale:y,withStartingAtRow:C,isCustomerInCustomPlan:b,selectDefaultTierIndex:P,hideCompatibleAddons:S}){var $,_,z;let T=n.isNextPlan&&n.isNextPlan(i),I=n.pricePoints.filter(q=>q.billingPeriod===i),A=($=n.paywallCalculatedPricePoints)==null?void 0:$.find(q=>q.billingPeriod===i),B=I.length>1&&!!(A!=null&&A.additionalChargesMayApply),k=!b||n.pricingType===PricingType.Custom,v=null;T?v=jsx(Ou,{text:"Next plan"}):a&&g.highlightChip&&(v=jsx($u,{className:"stigg-highlight-badge",children:jsx(Gu,{className:"stigg-highlight-badge-text",color:"white",bold:true,children:g.highlightChip})}));let[N,F]=useState(Po({plan:n,billingPeriod:i,currentSubscription:l,currentSubscriptionOverride:s,selectDefaultTierIndex:P})),Z=q=>{let Ge=Object.keys(N).map(pt=>({featureId:pt,quantity:N[pt]}));return h(q,Ge)};return jsxs(Mu,{className:xu(`stigg-${n.id}`,"stigg-plan-offering-container",{"stigg-current-plan":n.isCurrentCustomerPlan}),$isHighlighted:a,$isCurrentPlan:n.isCurrentCustomerPlan,children:[v,jsxs(zu,{className:"stigg-header-wrapper",children:[jsx(Uu,{className:"stigg-plan-header",variant:"h3",children:n.displayName}),d&&jsx(Du,{className:"stigg-plan-description",variant:"h6",color:"secondary",children:n.description}),jsx(Ha,{showStartingAt:B,withUnitPriceRow:e,withStartingAtRow:C,withTiersRow:t,plan:n,billingPeriod:i,paywallLocale:g,locale:y,hasAnnuallyPrice:f,hasMonthlyPrice:u,setPerUnitQuantityByFeature:F,perUnitQuantityByFeature:N}),k?jsx(Ma,{isNextPlan:T,customer:r,plan:n,currentSubscription:l,currentSubscriptionOverride:s,billingPeriod:i,isCustomerOnTrial:m,onPlanSelected:Z,paywallLocale:g,withTrialLeftRow:o,perUnitQuantityByFeature:N}):jsx("div",{style:{height:Nu}}),jsx(_u,{className:"stigg-plan-header-divider"})]}),jsx(wa,{plan:n,billingPeriod:i,paywallLocale:g}),jsx(Ru,{$planHasEntitlements:((z=(_=n.packageEntitlements)==null?void 0:_.length)!=null?z:0)>0,className:"stigg-addons-container",children:!S&&n.compatibleAddons&&n.compatibleAddons.length>0&&jsx(hn,{addons:n.compatibleAddons,paywallLocale:g})})]})}var Zu=e.div`
|
|
201
201
|
height: 40px;
|
|
202
202
|
padding: 0 20px;
|
|
203
203
|
margin-bottom: ${({theme:e})=>e.stigg.layout.switchBottomSpacing};
|
|
@@ -220,7 +220,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
220
220
|
background: ${({theme:e})=>e.stigg.palette.switchHandle} !important;
|
|
221
221
|
top: 0.5px !important;
|
|
222
222
|
}
|
|
223
|
-
`;function Qu({discount:e,disabled:t}){return jsxs(f,{variant:"h6",color:t?"disabled":"primary",className:"stigg-discount-rate-text",children:[e,"% off"]})}function Ya({discountRate:e,selectedBillingPeriod:t,onBillingPeriodChanged:o,availableBillingPeriods:r}){if(r.length<=1)return null;let n=t===BillingPeriod.Monthly;return jsxs(Zu,{className:"stigg-period-picker-container",children:[jsx(Za,{variant:"h6",className:"stigg-monthly-period-text",color:n?"primary":"disabled",children:"Monthly"}),jsx(Yu,{className:"stigg-period-switch",uncheckedIcon:false,checkedIcon:false,height:16,width:33,onChange:i=>o(i?BillingPeriod.Annually:BillingPeriod.Monthly),checked:!n,borderRadius:10,handleDiameter:19}),jsx(Za,{variant:"h6",className:"stigg-annual-period-text",color:n?"disabled":"primary",children:"Annual"}),e!==0&&jsx(Qu,{discount:e,disabled:n})]})}function Ku(e,t){if(!xo(e)&&!xo(t)){let o=t/12;return Math.round((e-o)/e*100)}return null}function Ja(e,t){var r;let o;if(o=(r=e.paywallCalculatedPricePoints)==null?void 0:r.find(n=>n.billingPeriod===t),o||(o=e.pricePoints.find(n=>n.billingPeriod===t)),!(o!=null&&o.amount)){let n=e.pricePoints.find(i=>i.isTieredPrice&&i.billingPeriod===t);if(n)return
|
|
223
|
+
`;function Qu({discount:e,disabled:t}){return jsxs(f,{variant:"h6",color:t?"disabled":"primary",className:"stigg-discount-rate-text",children:[e,"% off"]})}function Ya({discountRate:e,selectedBillingPeriod:t,onBillingPeriodChanged:o,availableBillingPeriods:r}){if(r.length<=1)return null;let n=t===BillingPeriod.Monthly;return jsxs(Zu,{className:"stigg-period-picker-container",children:[jsx(Za,{variant:"h6",className:"stigg-monthly-period-text",color:n?"primary":"disabled",children:"Monthly"}),jsx(Yu,{className:"stigg-period-switch",uncheckedIcon:false,checkedIcon:false,height:16,width:33,onChange:i=>o(i?BillingPeriod.Annually:BillingPeriod.Monthly),checked:!n,borderRadius:10,handleDiameter:19}),jsx(Za,{variant:"h6",className:"stigg-annual-period-text",color:n?"disabled":"primary",children:"Annual"}),e!==0&&jsx(Qu,{discount:e,disabled:n})]})}function Ku(e,t){if(!xo(e)&&!xo(t)){let o=t/12;return Math.round((e-o)/e*100)}return null}function Ja(e,t){var r;let o;if(o=(r=e.paywallCalculatedPricePoints)==null?void 0:r.find(n=>n.billingPeriod===t),o||(o=e.pricePoints.find(n=>n.billingPeriod===t)),!(o!=null&&o.amount)){let n=e.pricePoints.find(i=>i.isTieredPrice&&i.billingPeriod===t);if(n)return yt(n,1)}return o==null?void 0:o.amount}function Xa(e){return e.reduce((t,o)=>{let r=Ja(o,BillingPeriod.Monthly),n=Ja(o,BillingPeriod.Annually),i=Ku(r,n);return i&&(t=Math.max(t,i)),t},0)}function Pn(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function bn(e,t){return e.some(o=>Pn(o,t))}function ja(e,t,o){return e.filter(r=>r.pricingType!==PricingType.Paid||Pn(r,t)).filter(r=>!o||!o({plan:r}))}var ju=e.div`
|
|
224
224
|
color: ${({theme:e})=>e.stigg.palette.text.primary};
|
|
225
225
|
display: flex;
|
|
226
226
|
align-items: stretch;
|
|
@@ -240,7 +240,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
240
240
|
display: flex;
|
|
241
241
|
flex-direction: column;
|
|
242
242
|
align-items: center;
|
|
243
|
-
`,ts=({plans:e,customer:t,currentSubscription:o,highlightedPlanId:r,selectedBillingPeriod:n,onBillingPeriodChanged:i,availableBillingPeriods:
|
|
243
|
+
`,ts=({plans:e,customer:t,currentSubscription:o,highlightedPlanId:r,selectedBillingPeriod:n,onBillingPeriodChanged:i,availableBillingPeriods:a,isCustomerOnTrial:l,onPlanSelected:s,paywallLocale:d,locale:u,shouldHidePlan:f,selectDefaultTierIndex:m,currentSubscriptionOverride:h,hideCompatibleAddons:g,showWatermark:y})=>{let C=Xa(e),b=e.some(F=>!!F.description),P=bn(e,BillingPeriod.Monthly),S=bn(e,BillingPeriod.Annually),T=ja(e,n,f),I=useCallback((F,Z,$)=>s({plan:F,customer:t,subscription:o,intentionType:Z,selectedBillingPeriod:n,billableFeatures:$}),[t,n,o,s]),A=!!o&&o.plan.pricingType===PricingType.Custom,B=useMemo(()=>T.some(F=>{var _;let Z=F.pricePoints.filter(z=>z.billingPeriod===n),$=(_=F.paywallCalculatedPricePoints)==null?void 0:_.find(z=>z.billingPeriod===n);return Z.length>1&&!!($!=null&&$.additionalChargesMayApply)}),[n,T]),k=useMemo(()=>T.some(F=>!!bo(F,n,d,u,P).unit),[n,P,u,d,T]),v=useMemo(()=>!A&&T.some(F=>{let Z=Po({plan:F,billingPeriod:n,currentSubscription:o,currentSubscriptionOverride:h});return Object.values(Z).length>0}),[n,o,h,A,T]),N=T.some(F=>F.isCurrentCustomerPlan&&F.trialDaysLeft);return jsx(eg,{className:"stigg-paywall-container",children:jsxs(tg,{className:"stigg-paywall-layout",children:[jsx(Ya,{onBillingPeriodChanged:i,selectedBillingPeriod:n,availableBillingPeriods:a,discountRate:C}),jsx(ju,{className:"stigg-paywall-plans-layout",children:T.map(F=>jsx(Wa,{withUnitPriceRow:k,withTiersRow:v,withTrialLeftRow:N,shouldShowDescriptionSection:b,hasMonthlyPrice:P,hasAnnuallyPrice:S,plan:F,withStartingAtRow:B,currentSubscription:o,currentSubscriptionOverride:h,billingPeriod:n,isHighlighted:F.id===r,isCustomerOnTrial:l,onPlanSelected:(Z,$)=>I(F,Z,$),paywallLocale:d,locale:u,customer:t,isCustomerInCustomPlan:A,selectDefaultTierIndex:m,hideCompatibleAddons:g},F.id))}),jsx(q,{source:"paywall",align:"end",style:{marginTop:16},showWatermark:y})]})})};function os(e,t,o){let r=e.flatMap(l=>l.pricePoints).map(l=>l.billingPeriod),n=ng(r),i=ig(r),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 rs(e){return Q.utc(e).diff(Q.utc(),"days",false)+1}var wo={h1:{fontSize:"24px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"16px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};function Ye(e,t="px"){if(e)return `${e}${t}`}function Ao(e){if(!e)return "normal";switch(e){case FontWeight.Normal:return "normal";case FontWeight.Bold:return "bold";default:return "normal"}}function Ht(e,t){var r,n,i,a,l,s,d,u;let o=t||{h1:{fontSize:"32px",fontWeight:"bold",semanticElement:"h1"},h2:{fontSize:"24px",fontWeight:"normal",semanticElement:"h2"},h3:{fontSize:"16px",fontWeight:"normal",semanticElement:"h3"},body:{fontSize:"14px",fontWeight:"normal",semanticElement:"p"}};return {fontFamilyUrl:(e==null?void 0:e.fontFamily)||void 0,h1:{fontSize:Ye((r=e==null?void 0:e.h1)==null?void 0:r.fontSize)||o.h1.fontSize,fontWeight:Ao((n=e==null?void 0:e.h1)==null?void 0:n.fontWeight)||o.h1.fontWeight,semanticElement:o.h1.semanticElement},h2:{fontSize:Ye((i=e==null?void 0:e.h2)==null?void 0:i.fontSize)||o.h2.fontSize,fontWeight:Ao((a=e==null?void 0:e.h2)==null?void 0:a.fontWeight)||o.h2.fontWeight,semanticElement:o.h2.semanticElement},h3:{fontSize:Ye((l=e==null?void 0:e.h3)==null?void 0:l.fontSize)||o.h3.fontSize,fontWeight:Ao((s=e==null?void 0:e.h3)==null?void 0:s.fontWeight)||o.h3.fontWeight,semanticElement:o.h3.semanticElement},body:{fontSize:Ye((d=e==null?void 0:e.body)==null?void 0:d.fontSize)||o.body.fontSize,fontWeight:Ao((u=e==null?void 0:e.body)==null?void 0:u.fontWeight)||o.body.fontWeight,semanticElement:o.body.semanticElement}}}function kn(e){if(e)switch(e){case Alignment.Left:return "left";case Alignment.Center:return "center";case Alignment.Right:return "right";default:return}}function is(e){let{palette:t,customCss:o,typography:r}=e;return {palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.paywallBackgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,backgroundHighlight:(t==null?void 0:t.currentPlanBackground)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0}},typography:Ht(r),customCss:o||void 0}}function as(e){let{palette:t,layout:o,customCss:r,typography:n}=e;return {customCss:r||void 0,palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.backgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,backgroundHighlight:(t==null?void 0:t.currentPlanBackground)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0}},typography:Ht(n),layout:{ctaAlignment:kn(o==null?void 0:o.alignment),headerAlignment:kn(o==null?void 0:o.alignment),descriptionAlignment:kn(o==null?void 0:o.alignment),planMaxWidth:Ye(o==null?void 0:o.planWidth),planMinWidth:Ye(o==null?void 0:o.planWidth),planMargin:Ye(o==null?void 0:o.planMargin),planPadding:Ye(o==null?void 0:o.planPadding)}}}function ss(e){let{palette:t,typography:o,customCss:r}=e;return {palette:{primary:(t==null?void 0:t.primary)||void 0,backgroundPaper:(t==null?void 0:t.backgroundColor)||void 0,outlinedBorder:(t==null?void 0:t.borderColor)||void 0,text:{primary:(t==null?void 0:t.textColor)||void 0},backgroundHighlight:(t==null?void 0:t.summaryBackgroundColor)||void 0},typography:Ht(o,wo),customCss:r||void 0}}function sg(e){let t=true,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.InTrial))||null,r=o==null?void 0:o.plan,n=o!=null&&o.trialEndDate?rs(o.trialEndDate):void 0;return r||(t=false,o=(e==null?void 0:e.find(i=>i.status===SubscriptionStatus.Active))||null,r=o==null?void 0:o.plan),{currentSubscription:o,currentPlan:r,isCustomerOnTrial:t,trialDaysLeft:n}}function ps(e,t,o){var T,I;let{plans:r,currency:n,configuration:i,customer:a$1,activeSubscriptions:l,paywallCalculatedPricePoints:s}=e||{},{currentSubscription:d,currentPlan:u,isCustomerOnTrial:f,trialDaysLeft:m}=sg(l),h=o==null?void 0:o({currentSubscription:d}),g=(d==null?void 0:d.scheduledUpdates)||[],y=(T=d==null?void 0:d.price)==null?void 0:T.billingPeriod,C=g.find(({subscriptionScheduleType:A})=>A===SubscriptionScheduleType.Downgrade),b$1=g.find(({subscriptionScheduleType:A})=>A===SubscriptionScheduleType.BillingPeriod),P=Yl(r,A=>A.order).map(A=>{var N;let B=(N=a$1==null?void 0:a$1.eligibleForTrial)==null?void 0:N.find(F=>F.productId===A.product.id),k=h!=null&&h.planId?(h==null?void 0:h.planId)===A.id:A.id===(u==null?void 0:u.id),v=F=>{var z;let Z=C==null?void 0:C.scheduleVariables,$=b$1==null?void 0:b$1.scheduleVariables,_=A.pricePoints.some(q=>q.billingPeriod===F);return C?((z=C.targetPackage)==null?void 0:z.refId)===A.id&&(!_||Z.billingPeriod===F):b$1&&k?$.billingPeriod===F:false};return b(a({},A),{paywallCalculatedPricePoints:s==null?void 0:s.filter(F=>F.planId===A.id),isTriable:!xo(A.defaultTrialConfig)&&(!B||B.eligible),isCurrentCustomerPlan:k,currentCustomerPlanBillingPeriod:y,isUpcomingPlan:false,trialDaysLeft:m,isNextPlan:v,paywallCurrency:n,scheduledUpdate:C||b$1})});if(r&&u){let A=u&&((I=r==null?void 0:r.find(B=>B.id===(u==null?void 0:u.id)))==null?void 0:I.order);xo(A)||(P=P.map(B=>b(a({},B),{isLowerThanCurrentPlan:A>B.order})),t&&(P=P.filter(B=>B.order>=A)));}let S=i?as(i):void 0;return {currentPlan:u,currentSubscription:d,currentSubscriptionOverride:h,isCustomerOnTrial:f,plans:P,paywallConfiguration:S}}function ms({productId:e,resourceId:t,showOnlyEligiblePlans:o,billingCountryCode:r$1,preferredBillingPeriod:n,currentSubscriptionOverrideFn:i}){let{stigg:a$1,locale:l}=u(),[s,d$1]=useState(BillingPeriod.Annually),[u$1,f]=useState([]),[m,h]=useState(null),[g,y]=useState(true);useEffect(()=>{d(null,null,function*(){try{y(!0),yield a$1.waitForInitialization();let P=yield a$1.getPaywall({productId:e,resourceId:t,billingCountryCode:r$1}),{availableBillingPeriods:S,defaultBillingPeriod:T}=os(P.plans,P.activeSubscriptions,n);h(P),f(S),d$1(T);}catch(P){r.error(`Failed to load paywall ${P==null?void 0:P.message}`,P);}finally{y(false);}});},[a$1,e,a$1.isCustomerLoaded,r$1,t,n]);let C=ps(m,o,i);return a({customer:(m==null?void 0:m.customer)||null,isLoading:g,selectedBillingPeriod:s,setSelectedBillingPeriod:d$1,availableBillingPeriods:u$1,locale:l,configuration:C.paywallConfiguration,showWatermark:a$1.getShowWatermark()},C)}function gs(e){return dg({highlightChip:"Recommended",addonsTitle:"Available add-ons:",planCTAButton:{upgrade:"Upgrade",downgrade:"Downgrade",startTrial:o=>{var r;return `Start ${(r=o.defaultTrialConfig)==null?void 0:r.duration} day trial`},custom:"Contact us",currentPlan:"Current plan",startNew:"Get started",switchToBillingPeriod:o=>o===BillingPeriod.Monthly?"Switch to monthly billing":"Switch to annual billing",cancelScheduledUpdate:"Cancel"},price:{startingAtCaption:"Starts at",pricePeriod:o=>o===BillingPeriod.Monthly?"/ month":"/ year",free:o=>({price:`${o==null?void 0:o.symbol}0`}),custom:"Custom",priceNotSet:"Price not set"}},e)}var pg=e=>jsx("svg",b(a({width:15,height:11,viewBox:"0 0 15 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{d:"M5.59 7.9899L2.125 4.5249C1.73524 4.13514 1.10365 4.13402 0.712509 4.52241V4.52241C0.319409 4.91274 0.318286 5.54819 0.710005 5.9399L5.59 10.8199L14.2948 2.11513C14.6843 1.72565 14.6843 1.09417 14.2948 0.704691V0.704691C13.9055 0.315381 13.2743 0.315184 12.8848 0.70425L5.59 7.9899Z",fill:"#B2BBD3"})})),ys=pg;var mg=e.div`
|
|
244
244
|
display: flex;
|
|
245
245
|
flex-direction: column;
|
|
246
246
|
align-items: center;
|
|
@@ -263,7 +263,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
263
263
|
gap: ${({theme:e})=>e.stigg.layout.planMargin};
|
|
264
264
|
flex-wrap: wrap;
|
|
265
265
|
justify-content: center;
|
|
266
|
-
`,
|
|
266
|
+
`,An=e.div`
|
|
267
267
|
display: flex;
|
|
268
268
|
align-items: center;
|
|
269
269
|
margin-bottom: 12px;
|
|
@@ -276,7 +276,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
276
276
|
border-radius: 10px;
|
|
277
277
|
background-color: white;
|
|
278
278
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
279
|
-
`;function hg(){return jsxs(ug,{children:[jsx(Qe,{width:120,borderRadius:4}),jsx(Qe,{circle:true,width:40,height:40}),jsx(Qe,{style:{marginBottom:33},width:120,borderRadius:4}),jsxs(
|
|
279
|
+
`;function hg(){return jsxs(ug,{children:[jsx(Qe,{width:120,borderRadius:4}),jsx(Qe,{circle:true,width:40,height:40}),jsx(Qe,{style:{marginBottom:33},width:120,borderRadius:4}),jsxs(An,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(An,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsxs(An,{children:[jsx(wn,{}),jsx(Qe,{width:120,borderRadius:4})]}),jsx(fg,{children:jsx(Qe,{height:50,borderRadius:4})})]})}function hs({skeletonPlanCount:e=3}){return jsxs(mg,{className:"stigg-skeleton-loader-container",children:[jsx(yg,{className:"stigg-skeleton-loader-billing-period",children:jsx(Qe,{borderRadius:4})}),jsx(gg,{className:"stigg-skeleton-loader-plans-container",children:Array.from({length:e}).map((t,o)=>jsx(hg,{},o))})]})}var ee=ii.createContext(null);ee.displayName="CustomerPortalContext";var W=()=>{let e=useContext(ee);if(!e)throw new Error("Could not find Customer portal context; You need to wrap your customer portal components in an <CustomerPortalProvider> component.");return e};function fe(e){return !!useContext(e)}var xs=({productId:e,resourceId:t,highlightedPlanId:o,showOnlyEligiblePlans:r,textOverrides:n,onPlanSelected:i,preferredBillingPeriod:a,onBillingPeriodChange:l,billingCountryCode:s,shouldHidePlan:d,selectDefaultTierIndex:u,currentSubscriptionOverride:f,hideCompatibleAddons:m,skeletonPlanCount:h=3})=>{let g=fe(ee),y=false;if(g){let{isLoading:z,resourceId:q}=W();y=z,t=q;}let{plans:C,customer:b,currentSubscription:P,currentSubscriptionOverride:S,isCustomerOnTrial:T,isLoading:I,selectedBillingPeriod:A,setSelectedBillingPeriod:B,availableBillingPeriods:k,locale:v,configuration:N,showWatermark:F}=ms({productId:e,resourceId:t,showOnlyEligiblePlans:r,billingCountryCode:s,preferredBillingPeriod:a,currentSubscriptionOverrideFn:f}),Z=gs(n),_=!C||I||y?jsx(hs,{skeletonPlanCount:h}):jsx(ts,{plans:C,customer:b,currentSubscription:P,currentSubscriptionOverride:S,selectedBillingPeriod:A,onBillingPeriodChanged:z=>{B(z),l&&l(z);},availableBillingPeriods:k,highlightedPlanId:o,isCustomerOnTrial:T,onPlanSelected:i,paywallLocale:Z,locale:v,shouldHidePlan:d,selectDefaultTierIndex:u,hideCompatibleAddons:m,showWatermark:F});return g?_:jsx(w,{componentTheme:N,children:_})};function bs({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 d=yield o.getCustomerPortal({resourceId:e,productId:t});l(d);}catch(d){r.error(`Failed to load customer portal ${d==null?void 0:d.message}`,d);}finally{i(false);}});},[o,o.isCustomerLoaded,r$1,e,t]),{customerPortal:a,showWatermark:o.getShowWatermark(),isLoading:n}}function Ss(e){return dg({manageSubscription:"Manage",usageTabTitle:"Usage",addonsTabTitle:"Add-ons",promotionsTabTitle:"Promotions",promotionsSubtitle:"You were granted access to additional functionality at no additional cost.",contactSupportTitle:"Have questions about your subscription?",contactSupportLink:"Contact support",editBilling:"Edit billing details",invoicesTitle:"Invoices",viewInvoiceHistory:"View invoice history",editPaymentDetails:"Edit",paywallSectionTitle:"Plans",cancelScheduledUpdatesButtonTitle:"Cancel"},e)}function Ts(e,t,o){var n,i,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 Io({children:e,textOverrides:t,theme:o,resourceId:r,productId:n}){let{customerPortalUpdatedAt:i}=u(),{customerPortal:a,isLoading:l,showWatermark:s}=bs({resourceId:r,productId:n}),d=a!=null&&a.configuration?is(a.configuration):void 0,u$1=v(d),f=Ts(u$1,o,a==null?void 0:a.configuration),m=Ss(t);return jsx(w,{componentTheme:d,children:jsx(ee.Provider,{value:{customerPortal:a,isLoading:l,showWatermark:s,textOverrides:m,theme:f,resourceId:r},children:e},i==null?void 0:i.toString())})}var Ke=e(Ym)`
|
|
280
280
|
border-radius: 10px;
|
|
281
281
|
padding: 8px 16px;
|
|
282
282
|
text-transform: none;
|
|
@@ -285,7 +285,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
285
285
|
&:hover {
|
|
286
286
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedRestingBorder};
|
|
287
287
|
}
|
|
288
|
-
`;var Sg=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})),
|
|
288
|
+
`;var Sg=e=>jsx("svg",b(a({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.3333 2.5L17.5 6.66667L6.66667 17.5H2.5V13.3333L13.3333 2.5V2.5Z",stroke:"#327EEE",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})})),As=Sg;var ve=e.div`
|
|
289
289
|
display: flex;
|
|
290
290
|
align-items: center;
|
|
291
291
|
justify-content: space-between;
|
|
@@ -295,11 +295,11 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
295
295
|
margin-bottom: 32px;
|
|
296
296
|
}
|
|
297
297
|
`};
|
|
298
|
-
`;function
|
|
298
|
+
`;function Le({title:e,className:t,isLoading:o}){let{theme:r}=W();return o?jsx(Qe,{width:120}):jsx(f,{className:t,overrideColor:r.sectionTitleColor,variant:"h3",bold:true,children:e})}var kg=e(As)`
|
|
299
299
|
path {
|
|
300
300
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
301
301
|
}
|
|
302
|
-
`;function
|
|
302
|
+
`;function Es({onManageSubscription:e,hideManageButton:t,textOverrides:o}){return jsxs(ve,{className:"stigg-customer-portal-overview-header",$disableMargin:true,children:[jsx(Le,{title:"Subscription",className:"stigg-overview-title"}),!t&&jsxs(Ke,{className:"stigg-manage-subscription-button",variant:"outlined",onClick:()=>e({intentionType:"MANAGE_SUBSCRIPTION"}),children:[jsx(kg,{className:"stigg-manage-subscription-button-image"}),jsx(f,{className:"stigg-manage-subscription-button-text",color:"primary.main",style:{marginLeft:"8px"},variant:"body1",children:o==null?void 0:o.manageSubscription})]})]})}function Fo(){let{customerPortal:e}=W(),t=wg(e==null?void 0:e.subscriptions,o=>o.addons);return Ag(t)?null:jsx("div",{className:"stigg-addons-list-layout",children:t.map((o,r)=>jsxs(f,{as:"span",className:"stigg-addon-list-item-text",variant:"body1",children:[o.quantity>1&&`${o.quantity} X `,o.displayName,r===t.length-1?"":", "]},o.addonId))})}function Fg(e){return String(e.endDate)}var vs=e.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
justify-content: space-between;
|
|
305
305
|
align-items: center;
|
|
@@ -310,7 +310,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
310
310
|
& > *:first-of-type {
|
|
311
311
|
max-width: 60%;
|
|
312
312
|
}
|
|
313
|
-
`;function
|
|
313
|
+
`;function Eg(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 vo(){let{customerPortal:e,textOverrides:t,theme:o}=W(),r=e==null?void 0:e.promotionalEntitlements;return jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsx(f,{color:"secondary",children:t.promotionsSubtitle}),jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxs(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:Eg(n)}),jsx(f,{variant:"body1",color:"disabled",children:n.endDate?Q.utc(Fg(n)).format("MMM Do, YYYY"):"None"})]},`${n.displayName}-${i}`))]})]})}var Ls=e(Lg)`
|
|
314
314
|
.MuiTabs-indicator {
|
|
315
315
|
background-color: #001e6c;
|
|
316
316
|
}
|
|
@@ -318,7 +318,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
318
318
|
width: 100%;
|
|
319
319
|
flex: 1;
|
|
320
320
|
margin-top: 16px;
|
|
321
|
-
`,Ms=e(
|
|
321
|
+
`,Ms=e(Te,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
322
322
|
margin-top: 16px;
|
|
323
323
|
max-height: ${({$maxHeight:e})=>e};
|
|
324
324
|
overflow-y: auto;
|
|
@@ -331,7 +331,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
331
331
|
margin-bottom: 16px;
|
|
332
332
|
row-gap: 16px;
|
|
333
333
|
background-color: ${({$backgroundColor:e})=>e};
|
|
334
|
-
`;function Us(e){let
|
|
334
|
+
`;function Us(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(Ms,{$maxHeight:n,children:t})}))}function _s({isSelected:e,label:t,icon:o}){let r=e?"primary":"secondary";return jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[jsx(i,{icon:o,svgStrokeColor:r}),jsx(f,{variant:"h6",bold:e,color:r,children:t})]})}function Ds({customerPortal:e,hiddenSections:t,textOverrides:o,theme:r}){let n=wg(e.subscriptions,m=>m.addons),i=m=>t==null?void 0:t.some(h=>h===m),a=n.length>0&&!i("addons"),l=e.promotionalEntitlements.length>0&&!i("promotionalEntitlements"),[s,d]=useState(a?1:2),u=(m,h)=>{d(h);};return a||l?jsxs(Ns,{children:[jsx(Te,{sx:{borderBottom:1,borderColor:"divider"},children:jsxs(Ls,{value:s,onChange:u,children:[a?jsx(Rs,{sx:{textTransform:"none"},value:1,label:jsx(_s,{isSelected:s===1,label:o.addonsTabTitle,icon:"Addons"})}):null,l?jsx(Rs,{sx:{textTransform:"none"},value:2,label:jsx(_s,{isSelected:s===2,label:o.promotionsTabTitle,icon:"Promotions"})}):null]})}),jsx(Us,{value:s,index:1,maxHeight:r.tabMaxHeight,children:jsx(Fo,{})}),jsx(Us,{value:s,index:2,maxHeight:r.tabMaxHeight,children:jsx(vo,{})})]}):null}var $s={xs:320,sm:640,md:768,lg:1024,xl:1280,xxl:1536},En=e=>`(min-width: ${$s[e]}px)`,oe=Object.keys($s).reduce((e,t)=>b(a({},e),{[t]:`@media ${En(t)}`}),{});function de(e){return Ug(En(e))}var _g=e.div`
|
|
335
335
|
display: flex;
|
|
336
336
|
justify-content: space-between;
|
|
337
337
|
flex-wrap: wrap;
|
|
@@ -339,7 +339,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
339
339
|
display: flex;
|
|
340
340
|
flex-direction: column;
|
|
341
341
|
gap: 32px;
|
|
342
|
-
`;function zs(){let e=de("md");return jsxs(_g,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxs(Dg,{children:[jsx(Qe,{width:120}),jsx(Qe,{width:120})]}),jsx(Qe,{width:e?295:260,height:193})]})}function Gg({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxs(
|
|
342
|
+
`;function zs(){let e=de("md");return jsxs(_g,{className:"stigg-subscription-overview-skeleton-layout",children:[jsxs(Dg,{children:[jsx(Qe,{width:120}),jsx(Qe,{width:120})]}),jsx(Qe,{width:e?295:260,height:193})]})}function Gg({scheduleUpdate:e}){let{targetPackage:t}=e;return jsxs(Ne,{container:true,alignItems:"center",children:[jsx(Ne,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Ne,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Downgrade to the ",jsx("b",{children:t==null?void 0:t.displayName})," plan"]})})]})}function zg({scheduleUpdate:e}){let{scheduleVariables:t}=e,{billingPeriod:o}=t,r=o===BillingPeriod.Monthly?"annually":"monthly",n=o===BillingPeriod.Monthly?"monthly":"annually";return jsxs(Ne,{container:true,alignItems:"center",children:[jsx(Ne,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Ne,{item:true,children:jsxs(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:["Change from an ",r," to a ",jsx("b",{children:n})," billing cycle"]})})]})}function Vg({subscription:e,scheduleUpdate:t}){let{scheduleVariables:o}=t,{newUnitAmount:r,featureId:n}=o,a=ic(e.prices.map(({feature:u})=>u)).find(u=>u.id===n);if(!a)return null;let{featureUnits:l,featureUnitsPlural:s}=a;return jsxs(Ne,{container:true,alignItems:"flex-start",flexWrap:"nowrap",children:[jsx(Ne,{children:jsx(ArrowDown,{color:"#D94052",height:20,className:"stigg-scheduled-updates-arrow-down"})}),jsx(Ne,{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 Hs({scheduleUpdate:e,subscription:t}){switch(e.subscriptionScheduleType){case SubscriptionScheduleType.Downgrade:return jsx(Gg,{scheduleUpdate:e});case SubscriptionScheduleType.BillingPeriod:return jsx(zg,{scheduleUpdate:e});case SubscriptionScheduleType.UnitAmount:return jsx(Vg,{scheduleUpdate:e,subscription:t});default:return null}}var Yg=e(Te)`
|
|
343
343
|
border-bottom: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
344
344
|
border-top-left-radius: 10px;
|
|
345
345
|
border-top-right-radius: 10px;
|
|
@@ -352,7 +352,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
352
352
|
path {
|
|
353
353
|
fill: ${({theme:e})=>e.stigg.palette.primary};
|
|
354
354
|
}
|
|
355
|
-
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxs(Fragment,{children:[jsx(
|
|
355
|
+
`;function qg({subscription:e}){let{scheduledUpdates:t}=e;return jsxs(Fragment,{children:[jsx(Ne,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Ne,{children:jsx(f,{className:"stigg-scheduled-updates-description",variant:"body1",children:"The following updates will take effect in the next billing cycle:"})})}),jsx(Ne,{children:(t||[]).map(o=>jsx(Hs,{scheduleUpdate:o,subscription:e},o.subscriptionScheduleType))})]})}function Jg({subscription:e}){let{scheduledUpdates:t}=e,[o]=t||[],{line1:r,line2:n}=Co({scheduledUpdate:o,subscriptionPrices:e.prices,billingPeriodRange:e.billingPeriodRange,options:{postfix:"at the end of the current billing period"}});return jsxs(Fragment,{children:[jsx(Ne,{container:true,alignItems:"center",justifyContent:"space-between",gap:1,children:jsx(Ne,{children:jsx(f,{className:"stigg-scheduled-updates-title",variant:"body1",color:"primary",children:r})})}),n&&jsx(Ne,{children:jsx(f,{className:"stigg-scheduled-updates-subtitle",variant:"body1",color:"secondary",children:n})})]})}function Os({subscription:e,onCancelScheduledUpdates:t,theme:o,cancelScheduledUpdatesButtonTitle:r}){let n=useTheme(),[i$1,a]=useState(false),{scheduledUpdates:l}=e;if(!l||l.length===0)return null;let s=l.length===1;return jsx(Yg,{$borderColor:o.borderColor,className:"stigg-scheduled-updates-alert-container",children:jsxs(Ne,{container:true,alignItems:s?"center":"flex-start",gap:2,children:[jsx(Ne,{item:true,display:"flex",children:jsx(i,{icon:"ScheduleBox",svgPathColor:o.iconsColor,svgRectColor:o.iconsBackgroundColor})}),jsx(Ne,{item:true,flex:1,children:s?jsx(Jg,{subscription:e}):jsx(qg,{subscription:e})}),!!t&&jsx(Ne,{item:true,children:jsxs(Ke,{variant:"outlined",onClick:()=>{a(true),Promise.resolve(t(e)).finally(()=>a(false));},children:[i$1?jsx(Qg,{loading:true,size:16,color:n.stigg.palette.text.disabled}):jsx(Kg,{style:{display:"flex",marginRight:4},className:"stigg-scheduled-updates-cancel-update-button-icon"}),jsx(f,{variant:"body1",color:"primary.main",className:"stigg-scheduled-updates-cancel-update-button",children:r})]})})]})})}var Me=e.div`
|
|
356
356
|
width: 100%;
|
|
357
357
|
display: flex;
|
|
358
358
|
flex-direction: column;
|
|
@@ -370,7 +370,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
370
370
|
${oe.lg} {
|
|
371
371
|
padding: 64px;
|
|
372
372
|
}
|
|
373
|
-
`;function Ys({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",children:"Next estimated bill"}),jsx(f,{variant:"h1",children:H({amount:o,currency:r,maximumFractionDigits:2})}),jsxs(f,{as:"div",variant:"body1",color:"secondary",children:["Billed ",e===BillingPeriod.Monthly?"monthly":"annually"," on"," ",jsx(f,{variant:"body1",as:"span",color:"primary",children:Q.utc(t).format("MMM Do, YYYY")})]}),jsx(f,{variant:"body1",color:"secondary",children:"* Additional tax rates may apply"})]})}function
|
|
373
|
+
`;function Ys({billingPeriod:e,rangeEnd:t,amount:o,currency:r}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",children:"Next estimated bill"}),jsx(f,{variant:"h1",children:H({amount:o,currency:r,maximumFractionDigits:2})}),jsxs(f,{as:"div",variant:"body1",color:"secondary",children:["Billed ",e===BillingPeriod.Monthly?"monthly":"annually"," on"," ",jsx(f,{variant:"body1",as:"span",color:"primary",children:Q.utc(t).format("MMM Do, YYYY")})]}),jsx(f,{variant:"body1",color:"secondary",children:"* Additional tax rates may apply"})]})}function Mo({description:e}){return jsxs(Fragment,{children:[jsx(f,{variant:"h6",color:"secondary",children:"No upcoming bill"}),jsx(f,{variant:"body1",color:"secondary",children:e})]})}var rf=e.div`
|
|
374
374
|
display: flex;
|
|
375
375
|
flex-direction: column;
|
|
376
376
|
align-items: left;
|
|
@@ -392,7 +392,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
392
392
|
border: ${({$borderColor:e})=>`1px solid ${e}`};
|
|
393
393
|
padding: 32px;
|
|
394
394
|
gap: 16px;
|
|
395
|
-
`;function qs({subscription:e,theme:t,textOverrides:o,onContactSupport:r}){var
|
|
395
|
+
`;function qs({subscription:e,theme:t,textOverrides:o,onContactSupport:r}){var s,d,u,f,m,h,g;let{pricingType:n}=e,i,a=(d=(s=e.prices)==null?void 0:s.every(y=>y.billingModel!==BillingModel.UsageBased))!=null?d:true,l=(u=e.scheduledUpdates)==null?void 0:u.find(({subscriptionScheduleType:y,targetPackage:C})=>y===SubscriptionScheduleType.Downgrade&&(C==null?void 0:C.pricingType)===PricingType.Free);if(n===PricingType.Free)i=jsx(Mo,{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(Mo,{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(Mo,{description:`You\u2019re on a free trial of the ${e.planName} plan, so you don\u2019t have any upcoming charges`});else {let y=(m=(f=e.prices)==null?void 0:f[0])==null?void 0:m.billingPeriod,C=(h=e.billingPeriodRange)==null?void 0:h.end,b=(g=e.totalPrice)==null?void 0:g.total;y&&C&&b&&(i=jsx(Ys,{billingPeriod:y,rangeEnd:C,amount:b.amount,currency:b.currency}));}else n===PricingType.Custom&&(i=jsx(Ks,{onContactSupport:r,label:o.contactSupportTitle,linkLabel:o.contactSupportLink}));return jsx(df,{className:"stigg-subscription-total-price-layout",$borderColor:t.borderColor,children:i})}var pf=e=>jsxs("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:[jsx("path",{d:"M12.9469 13.5999H11.9344L11.935 10.7756C11.935 10.6288 11.87 10.4819 11.7557 10.3838L8.62061 7.91816L11.755 5.4532C11.8694 5.35507 11.9344 5.22444 11.9344 5.06132L11.935 2.40004H12.9475C13.225 2.40004 13.4375 2.18755 13.4375 1.91004C13.4375 1.63254 13.225 1.42004 12.9475 1.42004L3.05311 1.42067C2.77561 1.42067 2.56311 1.63316 2.56311 1.91067C2.56311 2.18817 2.77561 2.40067 3.05311 2.40067H4.06561L4.06498 5.06131C4.06498 5.20818 4.12998 5.35505 4.24436 5.45318L7.36244 7.91814L4.245 10.3837C4.13062 10.4819 4.06562 10.6125 4.06562 10.7756V13.5999H3.05313C2.77562 13.5999 2.56313 13.8124 2.56313 14.0899C2.56313 14.3674 2.77562 14.5799 3.05313 14.5799H12.9469C13.2244 14.5799 13.4369 14.3674 13.4369 14.0899C13.4369 13.8124 13.2244 13.5999 12.9469 13.5999ZM5.04498 2.39995H10.9551V4.81627L8.00002 7.16747L5.04498 4.81627V2.39995ZM5.04498 11.0206L8.00002 8.66939L10.9551 11.0044V13.5838H5.04498V11.0206Z",fill:"white"}),jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3.05303 1.25404L12.9474 1.25342C13.317 1.25342 13.6041 1.54053 13.6041 1.91008C13.6041 2.27964 13.317 2.56675 12.9474 2.56675H12.1016L12.101 5.06136V5.06136C12.101 5.2747 12.0135 5.45101 11.8635 5.57973L11.8581 5.58436L8.89014 7.9182L11.8642 10.2572C12.0164 10.3878 12.1016 10.5814 12.1016 10.7757L12.101 13.4333H12.9468C13.3164 13.4333 13.6035 13.7204 13.6035 14.09C13.6035 14.4595 13.3164 14.7466 12.9468 14.7466H3.05304C2.68349 14.7466 2.39638 14.4595 2.39638 14.09C2.39638 13.7204 2.68349 13.4333 3.05304 13.4333H3.89887V10.7757C3.89887 10.5623 3.98635 10.386 4.13639 10.2573L4.14144 10.253L7.09365 7.91821L4.13566 5.57982C3.98346 5.44923 3.89823 5.25562 3.89823 5.06135L3.89882 2.56738H3.05303C2.68348 2.56738 2.39636 2.28026 2.39636 1.91071C2.39636 1.54116 2.68348 1.25405 3.05303 1.25404V1.25404ZM12.9474 1.58675L3.05304 1.58738C2.86758 1.58738 2.7297 1.72525 2.7297 1.91071C2.7297 2.09617 2.86757 2.23404 3.05303 2.23404H4.23223L4.23157 5.06135V5.06135C4.23158 5.15983 4.27538 5.25908 4.35053 5.32476L7.63107 7.91815L4.35113 10.5123C4.2739 10.5795 4.23221 10.6639 4.23221 10.7757V13.7666H3.05304C2.86759 13.7666 2.72971 13.9045 2.72971 14.09C2.72971 14.2754 2.86759 14.4133 3.05304 14.4133H12.9468C13.1323 14.4133 13.2701 14.2754 13.2701 14.09C13.2701 13.9045 13.1323 13.7667 12.9468 13.7667H11.7676L11.7683 10.7757V10.7757C11.7683 10.6772 11.7245 10.5781 11.6495 10.5124L8.35092 7.91819L11.6489 5.32461C11.726 5.25743 11.7676 5.17306 11.7676 5.06136L11.7683 2.23342H12.9474C13.1329 2.23342 13.2708 2.09554 13.2708 1.91008C13.2708 1.72463 13.1329 1.58676 12.9474 1.58675V1.58675ZM4.87823 2.23332H11.1216V4.89669L7.99994 7.3805L4.87823 4.89669V2.23332ZM5.21157 2.56666V4.73593L7.99994 6.95452L10.7883 4.73593V2.56666H5.21157ZM7.99958 8.45673L11.1216 10.9237V13.7505H4.87823V10.9403L7.99958 8.45673ZM8.0003 8.88213L5.21157 11.101V13.4172H10.7883V11.0852L8.0003 8.88213Z",fill:"white"})]})),Xs=pf;var Ve=e(n=>{var i=n,{children:e,className:t,placement:o="top"}=i,r=c(i,["children","className","placement"]);return jsx(uf,b(a({arrow:true,placement:o},r),{classes:{popper:t,tooltip:"stigg-tooltip",arrow:"stigg-tooltip-arrow"},children:jsx("div",{children:e})}))})(({theme:e,$padding:t=8,$maxWidth:o=300})=>({[`& .${tooltipClasses.tooltip}`]:{backgroundColor:e.stigg.palette.white,maxWidth:o,boxShadow:e.stigg.shadows.popover,padding:t,borderRadius:e.stigg.border.radius,color:e.stigg.palette.text.primary},[`& .${tooltipClasses.arrow}`]:{color:e.stigg.palette.white}}));var hf=e(f)`
|
|
396
396
|
display: ${({$display:e})=>e};
|
|
397
397
|
-webkit-line-clamp: ${({$maxLines:e})=>e};
|
|
398
398
|
-webkit-box-orient: vertical;
|
|
@@ -406,7 +406,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
406
406
|
${({$bold:e})=>e&&css`
|
|
407
407
|
font-weight: bold;
|
|
408
408
|
`}
|
|
409
|
-
`;function ol(e){return e&&(e.clientHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)}var Ae=({leaveDelay:e,children:t,variant:o,color:r,maxLines:n=1,wordBreak:i,bold:
|
|
409
|
+
`;function ol(e){return e&&(e.clientHeight<e.scrollHeight||e.offsetWidth<e.scrollWidth)}var Ae=({leaveDelay:e,children:t,variant:o,color:r,maxLines:n=1,wordBreak:i,bold:a,tooltipPlacement:l="top",className:s,display:d="-webkit-box",style:u,"data-testid":f$1})=>{let[m,h]=useState(false),g=useRef(null),y=jsx(hf,{ref:g,variant:o,color:r,$maxLines:n,$wordBreak:i,$bold:a,className:s,$display:d,style:u,"data-testid":f$1,children:t});useEffect(()=>{if(g!=null&&g.current){let b=ol(g.current);h(b);}},[g]);let C=(g==null?void 0:g.current)&&ol(g.current);return jsx("span",{children:m||C?jsx(Ve,{placement:l,leaveDelay:e,title:jsx(f,{variant:"body1",children:t}),children:y}):y})};var Pf=e.div`
|
|
410
410
|
width: 100%;
|
|
411
411
|
display: flex;
|
|
412
412
|
align-items: center;
|
|
@@ -415,26 +415,26 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
415
415
|
border-radius: 10px;
|
|
416
416
|
padding: 8px 16px;
|
|
417
417
|
margin-top: 16px;
|
|
418
|
-
`,bf=e(
|
|
418
|
+
`,bf=e(xf)`
|
|
419
419
|
text-decoration-color: white;
|
|
420
420
|
color: white;
|
|
421
421
|
cursor: pointer;
|
|
422
|
-
`;function nl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==SubscriptionStatus.InTrial?null:jsxs(
|
|
422
|
+
`;function nl({subscription:e,includePlanName:t,onManageSubscription:o}){return (e==null?void 0:e.status)!==SubscriptionStatus.InTrial?null:jsxs(Pf,{className:"stigg-subscription-trial-badge",children:[jsx(Xs,{className:"stigg-subscription-trial-badge-image"}),jsx("div",{style:{flex:1,marginRight:4},children:jsxs(Ae,{variant:"body1",className:"stigg-subscription-trial-badge-text",color:"white",children:[`${e.trialRemainingDays} days remaining in trial`,t&&` of the ${e.planName} plan`]})}),jsx(bf,{className:"stigg-subscription-trial-upgrade-button",onClick:()=>o({intentionType:"UPGRADE_TRIAL_PLAN"}),children:jsx(f,{color:"white",children:"Upgrade plan"})})]})}function al({mainSubscription:e,trialSubscription:t,onManageSubscription:o,theme:r}){return jsxs("div",{className:"stigg-subscription-view-layout",children:[jsxs(f,{className:"stigg-subscription-plan-name",variant:"h1",overrideColor:r.planNameColor,style:{marginTop:8},children:[e.planName," plan"]}),jsx(nl,{subscription:t,includePlanName:(t==null?void 0:t.planName)!==e.planName,onManageSubscription:o})]})}var Un=70;function qe(e,t){return t===0?0:Math.min(Math.floor(e/t*100),100)}function sl(e){let t;return e<Un?t="standard":e<100?t="warning":t="error",t}function Tf(e){return String(e.usagePeriodEnd)}function ll(e){if(!e.resetPeriod||!e.usagePeriodEnd)return null;let t=Tf(e),o=r=>Q.utc(t).diff(Q.utc(),r);switch(e.resetPeriod){case EntitlementResetPeriod.Month:return `Resets monthly - in ${o("days")} days`;case EntitlementResetPeriod.Week:return `Resets weekly - in ${o("days")} days`;case EntitlementResetPeriod.Day:return `Resets daily - in ${o("hours")} hours`;case EntitlementResetPeriod.Hour:return `Resets hourly - in ${o("minutes")} minutes`;default:return null}}var Af=e(kf,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
423
423
|
height: 4px;
|
|
424
424
|
background-color: ${({theme:e})=>bi(e.stigg.palette.primary).alpha(.4).string()};
|
|
425
425
|
|
|
426
426
|
span {
|
|
427
427
|
background-color: ${({$progressStatus:e,theme:t})=>{switch(e){case "standard":return t.stigg.palette.primary;case "warning":return t.stigg.palette.warning;case "error":return t.stigg.palette.error;default:return t.stigg.palette.primary}}};
|
|
428
428
|
}
|
|
429
|
-
`;function
|
|
429
|
+
`;function $o({currentUsage:e,usageLimit:t,classNamePrefix:o="stigg-usage-progress-bar"}){let r=qe(e,t),n=sl(r);return jsx(Af,{$progressStatus:n,className:`${o} ${o}-${n}`,variant:"determinate",value:r})}var Ef=e(Cl)`
|
|
430
430
|
border-style: dotted;
|
|
431
431
|
border-bottom-width: 2px;
|
|
432
432
|
border-color: ${({theme:e})=>bi(e.stigg.palette.outlinedRestingBorder).alpha(.4).string()};
|
|
433
|
-
`;function
|
|
433
|
+
`;function Go({entitlement:e}){return e.hasUnlimitedUsage?jsx(Ef,{}):jsx($o,{currentUsage:e.currentUsage||0,usageLimit:e.usageLimit,classNamePrefix:"stigg-feature-usage-progress-bar"})}var dl=e(Ym)`
|
|
434
434
|
text-transform: none;
|
|
435
435
|
padding: 0;
|
|
436
436
|
white-space: nowrap;
|
|
437
|
-
`;function
|
|
437
|
+
`;function Vo({featureEntitlement:e,feature:t,onManageSubscription:o,onBuyMore:r,canBuyMore:n,canUpgradeSubscription:i,hasCustomSubscription:a}){return a||e.hasUnlimitedUsage||qe(e.currentUsage||0,e.usageLimit)<Un?null:n?r?jsx(dl,{variant:"text",onClick:()=>r(t,e),children:jsx(f,{color:"primary.main",children:"Buy more"})}):null:i&&o?jsx(dl,{variant:"text",onClick:()=>o({intentionType:"UPGRADE_PLAN"}),children:jsx(f,{color:"primary.main",children:"Upgrade"})}):null}function pl({amount:e,currency:t,blockSize:o,featureEntitlement:r,feature:n,hideChargePrice:i,onBuyMore:a,onManageSubscription:l,canUpgradeSubscription:s,hasCustomSubscription:d}){var u,f$1,m;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(Vo,{featureEntitlement:r,feature:n,canBuyMore:true,onBuyMore:a,onManageSubscription:l,canUpgradeSubscription:s,hasCustomSubscription:d}),jsx(f,{variant:"body1",color:"primary",style:{whiteSpace:"nowrap"},children:r.hasUnlimitedUsage?(u=r.currentUsage)==null?void 0:u.toLocaleString():`${(f$1=r.currentUsage)==null?void 0:f$1.toLocaleString()} of ${(m=r.usageLimit)==null?void 0:m.toLocaleString()}`})]})]}),jsx(Go,{entitlement:r})]})}function ul({subscription:e,entitlements:t,onBuyMore:o,onManageSubscription:r,hasCustomSubscription:n,canUpgradeSubscription:i}){let a=wl(t,"feature.refId"),l=e.prices.filter(({feature:s,price:d})=>!!s&&a[s.refId]&&!!d);return l.length?jsx("div",{className:"stigg-charge-list",style:{display:"flex",flexDirection:"column",gap:16,marginTop:32},children:l.map(({feature:s,price:d,blockSize:u,billingModel:f})=>{if(!s||!d)return null;let m=a[s.refId];return !m||!m.feature?null:jsx(pl,{featureEntitlement:m,feature:m.feature,amount:d.amount,blockSize:u,currency:d.currency,hideChargePrice:f===BillingModel.PerUnit,onBuyMore:o,onManageSubscription:r,canUpgradeSubscription:i,hasCustomSubscription:n},s.refId)})}):null}function Pt(e){return e.__typename==="FeatureEntitlement"}function Oo(e){return e.__typename==="CreditEntitlement"}function Wo({onManageSubscription:e,onBuyMore:t,onCancelScheduledUpdates:o,onContactSupport:r,hiddenSections:n,cancelScheduledUpdatesButtonTitle:i}){let{customerPortal:a,isLoading:l,textOverrides:s,theme:d}=W(),u=l||!a,{subscriptions:f,entitlementsV2:m,canUpgradeSubscription:h}=a||{},g=useMemo(()=>m?m.filter(Pt):[],[m]),y=f==null?void 0:f.find(({status:S})=>S===SubscriptionStatus.Active),C=f==null?void 0:f.find(({status:S})=>S===SubscriptionStatus.InTrial),b=(y==null?void 0:y.pricingType)===PricingType.Custom,P=y||C;return jsxs(Me,{className:"stigg-customer-portal-subscriptions-overview",$backgroundColor:d.backgroundColor,$borderColor:d.borderColor,children:[!u&&y&&y.scheduledUpdates&&jsx(Os,{theme:d,subscription:y,onCancelScheduledUpdates:o,cancelScheduledUpdatesButtonTitle:i}),u||!P?jsx(zs,{}):jsxs("div",{className:"stigg-overview-layout",style:{display:"flex",alignItems:"flex-start",gap:64,flexWrap:"wrap"},children:[jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1},children:[jsx(Es,{onManageSubscription:e,hideManageButton:b,textOverrides:s}),jsx(al,{mainSubscription:P,trialSubscription:C,theme:d,onManageSubscription:e}),y&&g.length>0&&jsx(ul,{subscription:y,entitlements:g,onBuyMore:t,onManageSubscription:e,canUpgradeSubscription:!!h,hasCustomSubscription:b}),jsx(Ds,{customerPortal:a,hiddenSections:n,textOverrides:s,theme:d})]}),jsx("div",{style:{display:"flex",flexDirection:"column",width:319,gap:24},children:jsx(qs,{subscription:P,theme:d,onContactSupport:r,textOverrides:s})})]})]})}var Uf=e.div`
|
|
438
438
|
display: flex;
|
|
439
439
|
width: 100%;
|
|
440
440
|
align-items: flex-end;
|
|
@@ -444,7 +444,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
444
444
|
text-transform: none;
|
|
445
445
|
`,$f=e(ExternalLink)`
|
|
446
446
|
color: ${({theme:e})=>e.stigg.palette.primary};
|
|
447
|
-
`;function
|
|
447
|
+
`;function Zo({text:e,url:t,className:o}){return jsx(Ke,{className:o,variant:"outlined",startIcon:jsx($f,{size:20,strokeWidth:2.5}),onClick:()=>{window.open(t,"_blank");},children:jsx(Df,{color:"primary.main",children:e})})}var Yo=e.div`
|
|
448
448
|
display: flex;
|
|
449
449
|
flex-direction: column;
|
|
450
450
|
align-items: flex-start;
|
|
@@ -456,7 +456,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
456
456
|
gap: 16px;
|
|
457
457
|
align-self: stretch;
|
|
458
458
|
flex-wrap: wrap;
|
|
459
|
-
`;function Gn({title:e,rows:t}){return jsxs(
|
|
459
|
+
`;function Gn({title:e,rows:t}){return jsxs(Yo,{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(Gf,{children:[jsx(f,b(a({className:`${o}-label`,variant:"body1",color:"secondary",style:{width:80}},i),{children:r})),jsx(f,b(a({className:`${o}-text`,variant:"body1",color:"secondary"},a$1),{children:n}))]},r))]})}function Qo(){return jsx(Qe,{width:220,height:42})}var xl="-";function qo(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=de("md"),{billingInformation:i}=e||{},a=!i||t,l=[];if(a?l.push(jsxs(Yo,{children:[jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12})]},"information-loading-data-top"),jsx(Cl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-loading-data-divider"),jsxs(Yo,{children:[jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12}),jsx(Qe,{width:220,height:12})]},"information-loading-data-bottom")):(l.push(jsx(Gn,{title:"Billed to",rows:[{classNamePrefix:"stigg-customer-name",label:"Name",value:(i==null?void 0:i.name)||xl,valueTypographyProps:i!=null&&i.name?{}:{color:"disabled"}},{classNamePrefix:"stigg-customer-email",label:"Email",value:(i==null?void 0:i.email)||xl,valueTypographyProps:i!=null&&i.email?{}:{color:"disabled"}}]},"information-billing-data-billed-to")),i!=null&&i.defaultPaymentMethodId&&i.defaultPaymentMethodLast4Digits&&i.defaultPaymentExpirationMonth&&i.defaultPaymentExpirationYear&&(l.unshift(jsx(Cl,{orientation:"vertical",style:{minHeight:93,display:n?"block":"none"}},"information-billing-data-divider")),l.unshift(jsx(Gn,{title:"Payment method",rows:[{classNamePrefix:"stigg-credit-card",label:"Card",value:`Ending in ${i.defaultPaymentMethodLast4Digits}`},{classNamePrefix:"stigg-credit-card-expiration",label:"Expires",value:`${Hf(i.defaultPaymentExpirationMonth.toString(),2,"0")}/${i.defaultPaymentExpirationYear}`}]},"information-billing-data-payment-method")))),!a&&!(i!=null&&i.name)&&!(i!=null&&i.email)&&!(i!=null&&i.defaultPaymentMethodId))return null;let s=a?jsx(Qo,{}):e!=null&&e.billingPortalUrl?jsx(Zo,{url:e.billingPortalUrl,text:o.editPaymentDetails,className:"stigg-edit-payment-details-button"}):null;return jsxs(Me,{className:"stigg-payment-details-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:[jsxs(ve,{className:"stigg-payment-details-section-header",children:[jsx(Le,{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 Pl=e(Me)`
|
|
460
460
|
position: relative;
|
|
461
461
|
|
|
462
462
|
.stigg-paywall-layout {
|
|
@@ -481,7 +481,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
481
481
|
.${p} {
|
|
482
482
|
display: none;
|
|
483
483
|
}
|
|
484
|
-
`;var zn=forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxs(
|
|
484
|
+
`;var zn=forwardRef(({paywallComponent:e,theme:t,title:o,isLoading:r},n)=>e?jsxs(Pl,{className:"stigg-customer-portal-paywall-section",ref:n,$backgroundColor:t.backgroundColor,$borderColor:t.borderColor,children:[jsx(ve,{className:"stigg-customer-portal-paywall-header",children:jsx(Le,{isLoading:r,className:"stigg-customer-portal-paywall-section-title",title:o})}),e]}):null);zn.displayName="CustomerPortalPaywall";var Sl=e.div`
|
|
485
485
|
width: 100%;
|
|
486
486
|
display: flex;
|
|
487
487
|
flex-direction: column;
|
|
@@ -496,7 +496,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
496
496
|
flex-direction: column;
|
|
497
497
|
align-items: center;
|
|
498
498
|
row-gap: 24px;
|
|
499
|
-
`;var
|
|
499
|
+
`;var Al=6;function Il({featureEntitlements:e,creditEntitlements:t,showAll:o}){let r=e.length+t.length,n=o?r:Math.min(r,Al),i=e.slice(0,n),a=n-i.length,l=t.slice(0,Math.max(0,a)),s=r>Al;return {entitlementsToShow:i,creditsToShow:l,totalItemsCount:r,showMoreVisible:s}}function Yf(e){var t,o;return ((t=e.feature)==null?void 0:t.meterType)===MeterType.Fluctuating||((o=e.feature)==null?void 0:o.meterType)===MeterType.Incremental}function Fl(e,t){return t?e>2?4:6:12}function Bl(e){let t=[],o=[];for(let r of e)Pt(r)?t.push(r):Oo(r)&&o.push(r);return {feature:t,credit:o}}function El({packageEntitlements:e,activeSubscription:t,filterEntitlements:o,filterPackageEntitlements:r}){var P,S;let{feature:n,credit:i}=Bl(e!=null?e:[]),a=n.filter(Yf),l=wl((P=t==null?void 0:t.prices)!=null?P:[],"feature.refId"),s=wl(a,"feature.refId"),d=((S=t==null?void 0:t.prices)!=null?S:[]).map(T=>T.feature?s[T.feature.refId]:void 0).filter(T=>!!T),u=a.filter(T=>T.feature&&!l[T.feature.refId]),f=[...d,...u].filter(T=>T.usageLimit!==0),m=i.filter(T=>{var I;return ((I=T.usageLimit)!=null?I:0)>0}),h=[...f,...m],g=r?r({entitlements:h}).entitlements:[...o?o(f):f,...m],{feature:y,credit:C}=Bl(g),b=(t==null?void 0:t.pricingType)===PricingType.Custom;return {subscriptionPriceByFeature:l,filteredFeatureEntitlements:y,filteredCreditEntitlements:C,hasCustomSubscription:b}}function vl({filterEntitlements:e,filterPackageEntitlements:t}){let[o,r]=useState(false),n=de("md"),{customerPortal:i,isLoading:a}=W(),l=useMemo(()=>{var B;let I=i==null?void 0:i.entitlementsV2,A=(B=i==null?void 0:i.subscriptions)==null?void 0:B.find(k=>k.status===SubscriptionStatus.Active);return El({packageEntitlements:I,activeSubscription:A,filterEntitlements:e,filterPackageEntitlements:t})},[i==null?void 0:i.entitlementsV2,i==null?void 0:i.subscriptions,e,t]),{subscriptionPriceByFeature:s,filteredFeatureEntitlements:d,filteredCreditEntitlements:u,hasCustomSubscription:f}=l,m=a||!i,h=!!(i!=null&&i.canUpgradeSubscription),{entitlementsToShow:g,creditsToShow:y,totalItemsCount:C,showMoreVisible:b}=Il({featureEntitlements:d,creditEntitlements:u,showAll:o}),P=Fl(C,n),S=()=>r(I=>!I),T=!m&&d.length===0&&u.length===0;return {isLoadingData:m,entitlementsToShow:g,creditsToShow:y,subscriptionPriceByFeature:s,totalItemsCount:C,gridSizeXs:P,hasCustomSubscription:f,canUpgradeSubscription:h,showAll:o,toggleShowAll:S,hasNoItems:T,showMoreVisible:b}}function St(e,t,o){if(!t&&!o)return e;let r=Vn(e);return r===Vn(t||"")||r===Vn(o||"")?e:`${e} (${o})`}function Ll(e){return St(e.displayName,e.featureUnits,e.featureUnitsPlural)}function Nl(e){var t,o,r;return St((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 Jo=e.div`
|
|
500
500
|
display: flex;
|
|
501
501
|
flex-direction: column;
|
|
502
502
|
padding: 24px;
|
|
@@ -506,12 +506,12 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
506
506
|
height: 100%;
|
|
507
507
|
|
|
508
508
|
${({theme:e,$highlight:t})=>t&&`background-color: ${e.stigg.palette.backgroundSection}`};
|
|
509
|
-
`;function Rl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i$1}){var
|
|
509
|
+
`;function Rl({entitlement:e,subscriptionPrice:t,onManageSubscription:o,onBuyMore:r,hasCustomSubscription:n,canUpgradeSubscription:i$1}){var s,d,u;let{theme:a}=W(),l=!e.hasUnlimitedUsage&&e.currentUsage>e.usageLimit;return e.feature?jsxs(Jo,{$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&&Ll(e.feature)}),t&&jsx(Ve,{title:jsx(f,{variant:"body1",children:t.billingModel===BillingModel$1.PerUnit?"Billed for committed usage":"Billed for actual usage"}),children:jsx(i,{icon:"DollarCoin",svgStrokeColor: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:[(d=e.currentUsage)==null?void 0:d.toLocaleString(),!e.hasUnlimitedUsage&&` / ${(u=e.usageLimit)==null?void 0:u.toLocaleString()} (${qe(e.currentUsage||0,e.usageLimit)}%)`]}),jsx(Vo,{featureEntitlement:e,feature:e.feature,onBuyMore:r,canBuyMore:!!t,onManageSubscription:o,canUpgradeSubscription:i$1,hasCustomSubscription:n})]}),jsx(Go,{entitlement:e}),!e.hasUnlimitedUsage&&!Ml(e.usageLimit)&&!Ml(e.currentUsage)&&e.resetPeriod&&e.usagePeriodEnd?jsx(f,{color:"secondary",children:ll(e)}):null,e.hasUnlimitedUsage&&jsx(f,{color:"secondary",children:"In current billing period"})]}):null}function Hn({currentUsage:e,usageLimit:t}){return jsx($o,{currentUsage:e,usageLimit:t,classNamePrefix:"stigg-credit-usage-progress-bar"})}function On(e){return Q(e).format("MMM D, YYYY h:mmA")}function Wn(e){return Q(e).format("MMM D, YYYY")}function jf(e){return Q(e).fromNow()}function jo(e){let{usagePeriodEnd:t,formatter:o}=e;return !t||t.getTime()<=Date.now()?null:`Resets ${o?o(t):jf(t)}.`}function er({creditEntitlement:e}){let{theme:t}=W(),{currency:o,currentUsage:r,usageLimit:n}=e,i=(r!=null?r:0)>(n!=null?n:0),a=qe(r!=null?r:0,n!=null?n:0),l=Nl(e),s=jo({usagePeriodEnd:e.usagePeriodEnd?new Date(e.usagePeriodEnd):void 0});return jsxs(Jo,{$highlight:false,$borderColor:t.borderColor,className:"stigg-credit-usage-container",children:[jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:16},children:jsx(Ae,{variant:"body1",className:"stigg-credit-usage-title",children:l})}),jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:8},children:jsxs(Ae,{variant:"body1",color:i?"error":"primary",className:"stigg-credit-usage-value","data-testid":`credit-usage-data-${o.currencyId}`,children:[(r!=null?r:0).toLocaleString()," / ",(n!=null?n:0).toLocaleString()," (",a,"%)"]})}),jsx(Hn,{currentUsage:r!=null?r:0,usageLimit:n!=null?n:0}),s&&jsx(f,{color:"secondary",children:s})]})}function _l({featureEntitlements:e,creditEntitlements:t,subscriptionPriceByFeature:o,gridSizeXs:r,onManageSubscription:n,onBuyMore:i,hasCustomSubscription:a,canUpgradeSubscription:l}){return jsxs(Ne,{container:true,spacing:4,children:[e.filter(s=>!!s.feature).map(s=>{let d=s.feature;return jsx(Ne,{className:`stigg-entitlement-usage-${d.refId}`,item:true,xs:r,children:jsx(Rl,{entitlement:s,subscriptionPrice:o[d.refId],onManageSubscription:n,onBuyMore:i,hasCustomSubscription:a,canUpgradeSubscription:l})},d.refId)}),t.map(s=>jsx(Ne,{className:`stigg-credit-usage-${s.currency.currencyId}`,item:true,xs:r,children:jsx(er,{creditEntitlement:s})},s.currency.currencyId))]})}var $l=e.div`
|
|
510
510
|
margin-top: 32px;
|
|
511
|
-
`;function Gl(){let e=de("md");return jsx(Me,{container:true,spacing:4,className:"stigg-subscription-usage-skeleton-layout",sx:{flexWrap:"wrap"},children:ty(6).map(t=>jsx(Me,{item:true,xs:e?4:12,children:jsx(Qe,{width:280,height:120})},t))})}function zl({showAll:e,onToggle:t}){return jsx($l,{children:jsx(Ke,{className:"stigg-usage-toggle-many-button",variant:"text",startIcon:e?jsx(Minus,{}):jsx(Plus,{}),onClick:t,children:e?"Show less":"Show more"})})}function nr({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}){let{textOverrides:n,theme:i}=W(),{isLoadingData:s,entitlementsToShow:l,creditsToShow:a,subscriptionPriceByFeature:c,gridSizeXs:u,hasCustomSubscription:f,canUpgradeSubscription:p,showAll:h,toggleShowAll:g,hasNoItems:y,showMoreVisible:C}=El({filterEntitlements:o,filterPackageEntitlements:r});return y?null:jsxs(Re,{className:"stigg-subscription-usage-layout",$backgroundColor:i.backgroundColor,$borderColor:i.borderColor,children:[jsx(Le,{children:jsx(Ne,{title:n.usageTabTitle,className:"stigg-customer-portal-usage-section-title",isLoading:s})}),s?jsx(Gl,{}):jsxs(Fragment,{children:[jsx(_l,{featureEntitlements:l,creditEntitlements:a,subscriptionPriceByFeature:c,gridSizeXs:u,onManageSubscription:e,onBuyMore:t,hasCustomSubscription:f,canUpgradeSubscription:p}),C&&jsx(zl,{showAll:h,onToggle:g})]})]})}function Ol({onManageSubscription:e,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r,onCancelScheduledUpdates:n,onContactSupport:i,paywallComponent:s,hiddenSections:l}){let{customerPortal:a,textOverrides:c,theme:u,isLoading:f,showWatermark:p}=W(),h=useRef(null),g=({intentionType:x})=>{var S,T;e?e({intentionType:x,customerSubscriptions:(S=a==null?void 0:a.subscriptions)!=null?S:[]}):(T=h==null?void 0:h.current)==null||T.scrollIntoView({behavior:"smooth"});},y=!(l!=null&&l.some(x=>x==="usage")),C=!(l!=null&&l.some(x=>x==="paymentDetails"||x==="billingInformation")),b=!(l!=null&&l.some(x=>x==="invoices"||x==="billingInformation"));return jsxs(Sl,{className:"stigg-customer-portal-layout",children:[jsx(yl,{showWatermark:p}),jsxs(Tl,{className:"stigg-customer-portal-sections",children:[jsx(Zo,{onCancelScheduledUpdates:n,onBuyMore:t,onManageSubscription:g,onContactSupport:i,hiddenSections:l,cancelScheduledUpdatesButtonTitle:c.cancelScheduledUpdatesButtonTitle}),y&&jsx(nr,{onManageSubscription:g,onBuyMore:t,filterEntitlements:o,filterPackageEntitlements:r}),jsx(zn,{ref:h,paywallComponent:s,theme:u,title:c.paywallSectionTitle,isLoading:!a||f}),C&&jsx(Jo,{}),b&&jsx(ir,{})]})]})}function Zl(i){var s=i,{textOverrides:e,theme:t,resourceId:o,productId:r}=s,n=c(s,["textOverrides","theme","resourceId","productId"]);return jsx(Fo,{textOverrides:e,theme:t,resourceId:o,productId:r,children:jsx(Ol,a({},n))})}function ir(){let{customerPortal:e,isLoading:t,textOverrides:o,theme:r}=W(),n=!e||t,i=n?jsx(Ko,{}):e!=null&&e.billingPortalUrl?jsx(Yo,{url:e.billingPortalUrl,text:o.viewInvoiceHistory,className:"stigg-view-invoice-history-button"}):null;return !n&&!(e!=null&&e.billingPortalUrl)?null:jsx(Re,{className:"stigg-invoices-section-layout",$backgroundColor:r.backgroundColor,$borderColor:r.borderColor,children:jsxs(Le,{className:"stigg-invoices-section-header",children:[jsx(Ne,{isLoading:n,className:"stigg-invoices-section-title",title:o.invoicesTitle}),i]})})}var Ql=e=>Yl(e,"displayName"),Qn=e=>Yl(e,"addon.displayName");function at(e){var r,n;let t=(r=e.pricePoints)==null?void 0:r.some(i=>i.amount&&i.amount>0);return !!((n=e.hiddenFromWidgets)!=null&&n.includes(WidgetType.Checkout))&&!t}function cy(e,t){return e.pricePoints.some(o=>o.billingPeriod===t)}function Kl({addon:e,currency:t,billingCountryCode:o}){return b(a({},e),{pricePoints:e.pricePoints.filter(r=>r.currency===t&&(o?r.billingCountryCode===o:true))})}function ql({addons:e,billingCountryCode:t,currency:o}){return (e==null?void 0:e.map(r=>Kl({addon:r,currency:o,billingCountryCode:t})))||[]}function Jl({addons:e,billingPeriod:t,billingCountryCode:o,currency:r}){var n;return ((n=e==null?void 0:e.filter(i=>cy(i.addon,t)))==null?void 0:n.map(i=>b(a({},i),{addon:Kl({addon:i.addon,currency:r,billingCountryCode:o})})))||[]}function Xl({activeSubscription:e,plan:t,billingCountryCode:o,billingPeriod:r}){var c,u;let n=[],i=((u=(c=t==null?void 0:t.pricePoints)==null?void 0:c[0])==null?void 0:u.currency)||Currency.Usd,s=ql({addons:t==null?void 0:t.compatibleAddons,billingCountryCode:o,currency:i}),l=Ql(s.filter(f=>!at(f))),a=Jl({addons:e==null?void 0:e.addons,billingPeriod:r,billingCountryCode:o,currency:i});return a!=null&&a.length&&(s!=null&&s.length)&&(n=Qn(a.filter(f=>s.some(p=>p.id===f.addon.id)))),{addons:n,initialAddons:dy(n),availableAddons:l}}function uy(){let[,e]=R();return (t,o)=>e(r=>{if(at(t))return;let n=r.addonsStep.addons.find(i=>i.addon.id===t.id);if(n){if(at(n.addon))return;n.quantity=o;}else r.addonsStep.addons.push({addon:t,quantity:o}),r.addonsStep.addons=Qn(r.addonsStep.addons);})}function gy(){let[,e]=R();return t=>e(o=>{let r=o.addonsStep.addons.find(n=>n.addon.id===t);r&&at(r.addon)||py(o.addonsStep.addons,n=>n.addon.id===t);})}function fy(){let[{addonsStep:e}]=R();return e}function jl(){let e=fy();return b(a({},e),{setAddon:uy(),removeAddon:gy()})}function yy(){let[{checkout:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}]=R();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}}function hy(){let[,e]=R();return t=>e(o=>{o.widgetState.readOnly=t;})}function Cy(){let[,e]=R();return t=>e(o=>{o.widgetState.isValid=t;})}function Py(){let[,e]=R();return t=>e(o=>{o.checkoutSuccess=t;})}function U(){let{checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r}=yy();return {checkoutState:e,widgetState:t,checkoutLocalization:o,checkoutSuccess:r,setWidgetReadOnly:hy(),setIsValid:Cy(),setCheckoutSuccess:Py()}}function Sy(e){var t;return (t=e==null?void 0:e.plan)!=null&&t.pricePoints?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,s]=useState(true),[l,a]=useState();return useEffect(()=>{let c=()=>d(null,null,function*(){try{let u=yield n.getCheckoutState({planId:e,resourceId:t,billingCountryCode:o});a(Sy(u));}catch(u){r.error(`Failed to load checkout ${u==null?void 0:u.message}`,u);}finally{s(false);}});if(r$1){s(false);let u=r$1({planId:e,resourceId:t,billingCountryCode:o});a(u);return}n.isCustomerLoaded&&(s(true),c());},[n,n.isCustomerLoaded,t,e,o,r$1]),{checkout:l,isLoading:i,showWatermark:n.getShowWatermark()}}var sr=(e,t)=>e.minUnitQuantity&&t<e.minUnitQuantity?e.minUnitQuantity:e.maxUnitQuantity&&t>e.maxUnitQuantity?e.maxUnitQuantity:t;var Kn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Monthly)),qn=e=>!!(e!=null&&e.pricePoints.some(t=>t.billingPeriod===BillingPeriod$1.Annually)),rc=e=>Kn(e)&&qn(e);var ac=(e,t,o)=>e===BillingPeriod$1.Monthly&&t||e===BillingPeriod$1.Annually&&o?e:null,sc=({pricingModel:e})=>e===BillingModel.PerUnit;function 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(s=>{let{feature:l}=s;return !l||!sc(s)?null:{featureId:l.featureId,quantity:l.unitQuantity||null}})),"featureId");return ic(t==null?void 0:t.map(s=>{var u,f,p;let l=(u=s.feature)==null?void 0:u.featureId;if(!l||!sc(s))return null;let a,c=((f=r[l])==null?void 0:f.quantity)||((p=n[l])==null?void 0:p.quantity);return a=sr(s,c||1),s.isTieredPrice&&!Gt(s.tiers)&&(a=ln(s.tiers,a).upTo),{featureId:l,quantity:a}}))}function wy({plan:e,activeSubscription:t,preferredBillingPeriod:o}){var s,l;let r=Kn(e),n=qn(e);if(o){let a=ac(o,r,n);if(a)return a}if(((s=t==null?void 0:t.plan)==null?void 0:s.id)===(e==null?void 0:e.id))return ((l=t==null?void 0:t.price)==null?void 0:l.billingPeriod)||BillingPeriod$1.Monthly;if(t!=null&&t.prices&&(t==null?void 0:t.prices.length)>0){let a=ac(t==null?void 0:t.prices[0].billingPeriod,r,n);if(a)return a}return n?BillingPeriod$1.Annually:BillingPeriod$1.Monthly}function lc({preferredBillingPeriod:e,plan:t,activeSubscription:o,billingCountryCode:r,preconfiguredBillableFeatures:n}){let i=wy({plan:t,activeSubscription:o,preferredBillingPeriod:e}),s=t==null?void 0:t.pricePoints.filter(a=>a.billingPeriod===i),l=ky(n,s,o);return {billingPeriod:i,billableFeatures:l,billingCountryCode:r}}function By(){let[{planStep:e}]=R();return e}function Ay(){let[,e]=R();return (t,o)=>e(r=>{let n=r.planStep.billableFeatures.find(i=>i.featureId===t);n?n.quantity=o:r.planStep.billableFeatures.push({featureId:t,quantity:o});})}function Iy(){let[,e]=R();return t=>e(o=>{o.planStep.billingPeriod=t,o.addonsStep.addons=o.addonsStep.addons.filter(r=>r.addon.pricePoints.some(n=>n.billingPeriod===t));})}function xe(){let e=By();return b(a({},e),{setBillingPeriod:Iy(),setBillableFeature:Ay()})}var dc=[{key:"PLAN",label:"Plan"},{key:"ADDONS",label:"Add-ons"},{key:"PAYMENT",label:"Payment details"}],cc={activeStep:0,completedSteps:[],steps:dc,isDisabled:false},vy=(e,t,o,r)=>{if(rc(e)&&!r)return false;let n=t.map(s=>s.featureId),i=o.map(s=>s.featureId);return !(n.length!==i.length||!n.every(s=>i.includes(s)))};function pc({isLoading:e,skipCheckoutSteps:t,plan:o,availableAddons:r,availableCharges:n,preferredBillingPeriod:i,preconfiguredBillableFeatures:s}){if(e||!o)return cc;let l=[];return t.includes("PLAN")&&vy(o,n,s,i)&&l.push("PLAN"),((r==null?void 0:r.length)===0||t.includes("ADDONS"))&&l.push("ADDONS"),b(a({},cc),{steps:dc.filter(a=>!l.includes(a.key))})}function Ey(){let[{progressBar:e}]=R();return e}function Ly(){let[e,t]=R();return o=>d(null,null,function*(){let{progressBar:r,planStep:n,addonsStep:i,paymentStep:s,onBeforeStepChange:l}=e;if(o!==r.activeStep&&l){let a=r.steps[r.activeStep],c=r.steps[o];if(a&&c){let u={planStep:n,addonsStep:i,paymentStep:s};if(!(yield l({from:a.key,to:c.key,state:u})))return}}t(({progressBar:a})=>{a.activeStep=o;});})}function Ny(){let[,e]=R();return t=>e(({progressBar:o})=>{o.completedSteps.push(t);})}function My(e){return e.completedSteps.length>=e.steps.length-1}function Ry(){let[e,t]=R();return ()=>d(null,null,function*(){let{progressBar:o,planStep:r,addonsStep:n,paymentStep:i,onBeforeStepChange:s}=e;if(o.isDisabled)return;let l=o.steps[o.activeStep],a=o.steps[o.activeStep+1];if(a&&s){let c={planStep:r,addonsStep:n,paymentStep:i};if(!(yield s({from:l.key,to:a.key,state:c})))return}t(({progressBar:c})=>{c.completedSteps.includes(c.activeStep)||c.completedSteps.push(c.activeStep),c.activeStep<c.steps.length-1&&(c.activeStep+=1);});})}function Uy(){let[,e]=R();return t=>e(({progressBar:o})=>{o.isDisabled=!!t;})}function Ue(){let e=Ey();return {currentStep:e.steps[e.activeStep],progressBarState:e,isLastStep:e.activeStep===e.steps.length-1,isCheckoutComplete:My(e),setActiveStep:Ly(),markStepAsCompleted:Ny(),goNext:Ry(),setIsDisabled:Uy()}}function wt(){let[{planStep:e,addonsStep:t,promotionCode:o,paymentStep:r}]=R();return b(a({},e),{addons:t.addons,promotionCode:o,billingAddress:r.billingAddress,taxPercentage:r.taxPercentage,taxId:r.taxId})}function lr({billingAddress:e,taxPercentage:t,taxIds:o}){if(!e&&!t&&!(o!=null&&o.length))return {};let r=o!=null&&o.length?o==null?void 0:o.filter(n=>n.value&&n.type):void 0;return {billingInformation:b(a(a({},e?{billingAddress:e}:{}),t?{taxPercentage:t}:{}),{taxIds:r})}}var Gy=h=>d(null,[h],function*({stigg:e,customerId:t,planId:o,resourceId:r,promotionCode:n,addons:i,billableFeatures:s,billingCountryCode:l,billingPeriod:a$1,billingAddress:c,taxPercentage:u,taxIds:f,onMockCheckoutPreview:p}){var b;let g=i.map(({addon:x,quantity:S})=>({addonId:x.id,quantity:S})),y=null,C=null;try{if(t&&o){let x=a({customerId:t,planId:o,resourceId:r,billingCountryCode:l,addons:g,billingPeriod:a$1,promotionCode:n,billableFeatures:Bg(s)?void 0:s},lr({billingAddress:c,taxPercentage:u,taxIds:f}));y=p?p(x):yield e.previewSubscription(x);}}catch(x){let[,S]=((b=x==null?void 0:x.message)==null?void 0:b.split("Error:"))||[];C=S==null?void 0:S.trim();}return {subscriptionPreview:y,errorMessage:C}}),Xn=({onMockCheckoutPreview:e}={})=>{let{stigg:t}=u(),o=wt(),[{resourceId:r}]=R(),{checkoutState:n,widgetState:i}=U(),{plan:s,customer:l}=n||{};return {previewSubscriptionAction:useCallback((...u)=>d(null,[...u],function*({promotionCode:c}={}){return i.isValid?Gy({stigg:t,customerId:l==null?void 0:l.id,planId:s==null?void 0:s.id,resourceId:r,addons:o.addons,billableFeatures:o.billableFeatures,billingCountryCode:o.billingCountryCode,billingPeriod:o.billingPeriod,billingAddress:o.billingAddress,taxPercentage:o.taxPercentage,promotionCode:c!=null?c:o.promotionCode,taxIds:o.taxId?[o.taxId]:void 0,onMockCheckoutPreview:e}):{subscriptionPreview:null,errorMessage:null}}),[t,l==null?void 0:l.id,s==null?void 0:s.id,r,o.addons,o.billableFeatures,o.billingCountryCode,o.billingPeriod,o.billingAddress,o.taxPercentage,o.taxId,o.promotionCode,i.isValid,e])}},zy=500,mc=({onMockCheckoutPreview:e}={})=>{let[t,o]=useState(null),[r,n]=useState(null),[i,s]=useState(false),{previewSubscriptionAction:l}=Xn({onMockCheckoutPreview:e});return useEffect(()=>{let a=()=>d(null,null,function*(){let{subscriptionPreview:u,errorMessage:f}=yield l();u&&(o(u),n(null)),f&&(n(f),o(null)),s(false);});s(true);let c=setTimeout(()=>{s(true),a();},zy);return ()=>{clearTimeout(c);}},[l]),{subscriptionPreview:t,isFetchingSubscriptionPreview:i,errorMessage:r}};function uc({customer:e,taxPercentage:t,taxId:o}){return {useNewPaymentMethod:!(e!=null&&e.paymentMethodDetails),taxPercentage:t,taxId:o}}function Vy(){let[,e]=R();return 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 Xt={primary:"rgb(50, 126, 238)",textColor:"rgb(0, 30, 108)",backgroundColor:"rgb(255, 255, 255)",borderColor:"rgb(235, 237, 243)",summaryBackgroundColor:"rgb(109, 121, 144)"};function yc(e,t,o){let{palette:r}=e||{};return {primary:(t==null?void 0:t.primary)||(r==null?void 0:r.primary)||Xt.primary,textColor:(t==null?void 0:t.textColor)||(r==null?void 0:r.text.primary)||Xt.textColor,backgroundColor:(t==null?void 0:t.backgroundColor)||(r==null?void 0:r.backgroundPaper)||Xt.backgroundColor,borderColor:(t==null?void 0:t.borderColor)||(r==null?void 0:r.outlinedBorder)||Xt.borderColor,summaryBackgroundColor:(t==null?void 0:t.summaryBackgroundColor)||(r==null?void 0:r.backgroundHighlight)||Xt.summaryBackgroundColor,paymentInputBackgroundColor:t==null?void 0:t.paymentInputBackgroundColor,paymentInputBorderColor:t==null?void 0:t.paymentInputBorderColor,paymentInputBorderRadius:t==null?void 0:t.paymentInputBorderRadius}}var ti=ii.createContext(null);ti.displayName="CheckoutContext";var R=()=>{let e=useContext(ti);if(!e)throw new Error("Could not find Checkout context; You need to wrap your checkout components in an <CheckoutProvider> component.");return e},th=({children:e,initialState:t})=>{let[o,r]=useState(t);useEffect(()=>{r(t);},[t]);let n=useCallback(l=>r(a=>produce(a,c=>l(c))),[r]),[i,s]=useMemo(()=>[o,n],[n,o]);return jsx(ti.Provider,{value:[i,s],children:e})};function Cc({children:e,textOverrides:t,theme:o,preferredBillingPeriod:r,billableFeatures:n,resourceId:i,planId:s,billingCountryCode:l,billingInformation:a,onMockCheckoutState:c,skipCheckoutSteps:u,onBeforeStepChange:f}){var x;let{checkout:p,isLoading:h,showWatermark:g}=tc({resourceId:i,planId:s,billingCountryCode:l,onMockCheckoutState:c}),y=p!=null&&p.configuration?ss(p.configuration):{typography:Wt(null,Bo)},C=v(y),b=useMemo(()=>{var E,A;let S=yc(C,o,p==null?void 0:p.configuration),T=fc(t),F=lc({preferredBillingPeriod:r,plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingCountryCode:l,preconfiguredBillableFeatures:n!=null?n:[]}),B=Xl({plan:p==null?void 0:p.plan,activeSubscription:p==null?void 0:p.activeSubscription,billingPeriod:F.billingPeriod}),I=uc({customer:p==null?void 0:p.customer,taxPercentage:(E=a==null?void 0:a.taxDetails)==null?void 0:E.taxPercentage}),k=pc({isLoading:h,skipCheckoutSteps:u!=null?u:[],plan:p==null?void 0:p.plan,availableAddons:B.availableAddons,availableCharges:F.billableFeatures,preferredBillingPeriod:r,preconfiguredBillableFeatures:n!=null?n:[]});return {checkout:p,checkoutLocalization:T,stiggTheme:C,theme:S,progressBar:k,planStep:F,addonsStep:B,paymentStep:I,resourceId:(A=p==null?void 0:p.resource)==null?void 0:A.id,widgetState:{readOnly:false,isValid:true,isLoadingCheckoutData:h},showWatermark:g,checkoutSuccess:false,onBeforeStepChange:f}},[r,l,p,h,u,(x=a==null?void 0:a.taxDetails)==null?void 0:x.taxPercentage,f]);return jsx(w,{componentTheme:y,children:jsx(th,{initialState:b,children:e})},p==null?void 0:p.plan.id)}var Pc="920px",bc=e.div`
|
|
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`
|
|
512
512
|
margin: auto;
|
|
513
513
|
min-height: 760px;
|
|
514
|
-
max-width: ${
|
|
514
|
+
max-width: ${xc};
|
|
515
515
|
display: flex;
|
|
516
516
|
position: relative;
|
|
517
517
|
flex-direction: column;
|
|
@@ -528,9 +528,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
528
528
|
${oe.md} {
|
|
529
529
|
padding: 32px;
|
|
530
530
|
border-radius: 10px;
|
|
531
|
-
width: ${
|
|
531
|
+
width: ${xc};
|
|
532
532
|
}
|
|
533
|
-
`,Sc=e(
|
|
533
|
+
`,Sc=e(Te)`
|
|
534
534
|
display: flex;
|
|
535
535
|
align-items: flex-start;
|
|
536
536
|
gap: 32px;
|
|
@@ -541,7 +541,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
541
541
|
${oe.md} {
|
|
542
542
|
flex-direction: row;
|
|
543
543
|
}
|
|
544
|
-
`,Tc=e(
|
|
544
|
+
`,Tc=e(Te)`
|
|
545
545
|
display: flex;
|
|
546
546
|
flex-direction: column;
|
|
547
547
|
gap: 0;
|
|
@@ -551,18 +551,18 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
551
551
|
${oe.md} {
|
|
552
552
|
width: auto;
|
|
553
553
|
}
|
|
554
|
-
`;var wc=e(kf,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({[`&.${linearProgressClasses.root}`]:{borderRadius:e.stigg.border.radius,backgroundColor:e.stigg.palette.outlinedBorder},[`& .${linearProgressClasses.bar}`]:{backgroundColor:t?e.stigg.palette.primaryLight:e.stigg.palette.primary}})),
|
|
554
|
+
`;var wc=e(kf,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t})=>({[`&.${linearProgressClasses.root}`]:{borderRadius:e.stigg.border.radius,backgroundColor:e.stigg.palette.outlinedBorder},[`& .${linearProgressClasses.bar}`]:{backgroundColor:t?e.stigg.palette.primaryLight:e.stigg.palette.primary}})),Ac=e(Ym)({[`&.${buttonClasses.root}`]:{textTransform:"none",lineHeight:"inherit",justifyContent:"flex-start",padding:"8px 4px"}}),Bc=e(i,{shouldForwardProp:e=>!e.startsWith("$")})(({theme:e,$disabled:t,$shouldFill:o})=>({circle:{stroke:t?e.stigg.palette.primaryLight:e.stigg.palette.primary,fill:o?t?e.stigg.palette.primaryLight:e.stigg.palette.primary:void 0}}));var Fc=()=>{let{progressBarState:e,setActiveStep:t,currentStep:o$1}=Re(),{widgetState:r}=U(),n=de("md"),i=useRef(),{readOnly:a,isLoadingCheckoutData:l}=r,{activeStep:s,completedSteps:d,steps:u}=e||{},f$1=(s+1)*100/u.length,[m,h]=ii.useState(o$1);return useEffect(()=>{n||i.current&&o$1!==m&&i.current.scrollIntoView({behavior:"smooth"}),h(o$1);},[o$1,n,m,h]),e.steps.length===1?null:jsxs(Te,{className:"stigg-checkout-progress-container",sx:{width:"100%",mb:3},ref:i,children:[jsx(wc,{variant:"determinate",value:f$1,$disabled:a}),jsx(Ne,{container:true,display:"flex",children:u.map(({key:g,label:y},C)=>{let b=d.includes(C),P=a||C>s&&!b&&!d.includes(C-1)||s!==C&&e.isDisabled;return jsx(Ne,{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(Ac,{onClick:()=>t(C),fullWidth:true,disabled:P,children:jsxs(Ne,{item:true,display:"flex",flexDirection:"row",alignItems:"center",gap:1,children:[jsx(ch,{icon:jsx(Bc,{icon:b?P?"OutlinedCheckedCircleDisabled":"OutlinedCheckedCircle":"OutlinedCircle",$disabled:P,$shouldFill:b})}),jsx(f,{variant:"h6",color:P?"primary.main.light":"primary.main",children:y})]})})},g)})})]})};var mh=[BillingModel.FlatFee,BillingModel.PerUnit,BillingModel.UsageBased],uh=e=>Yl(e,[t=>mh.indexOf(t.pricingModel),t=>{var o;return (o=t.feature)==null?void 0:o.displayName}]),cr=e=>useMemo(()=>uh(e),[e]);function gh(){let[{promotionCode:e}]=R();return e}function fh(){let[,e]=R();return t=>e(o=>{o.promotionCode=t;})}function wt(){return {promotionCode:gh(),setPromotionCode:fh()}}var yh=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"})]})})),dr=yh;var Ch=e(dr,{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(Ch,{$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 Th=e(te)`
|
|
560
560
|
padding: 4px 10px;
|
|
561
561
|
min-width: unset;
|
|
562
562
|
border-radius: ${({theme:e})=>e.stigg.border.radius};
|
|
563
563
|
display: flex;
|
|
564
564
|
align-items: center;
|
|
565
|
-
`,Lc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=
|
|
565
|
+
`,Lc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{setPromotionCode:r}=wt(),[n,i$1]=useState(false),[a,l]=ii.useState(""),[s,d$1]=ii.useState(false),[u,f$1]=ii.useState(""),{previewSubscriptionAction:m}=Xn({onMockCheckoutPreview:o}),h=()=>d(null,null,function*(){var C;d$1(true),f$1("");let{subscriptionPreview:g,errorMessage:y}=yield m({promotionCode:a});!y&&((C=g==null?void 0:g.immediateInvoice)!=null&&C.discountDetails)?(r(a.toUpperCase()),i$1(false)):y&&f$1(y),d$1(false);});return n?jsxs(Ne,{children:[jsx(f,{variant:"body1",color:u?"error":e?"disabled":"primary.main",children:t.summary.couponCodeTitle}),jsx(ce,{disabled:e,autoFocus:true,variant:"outlined",fullWidth:true,error:!!u,value:a,onChange:g=>{l(g.target.value);},inputProps:{maxLength:20},onKeyDown:g=>{g.key==="Enter"&&(h(),g.preventDefault());},InputProps:{endAdornment:jsx(Th,{variant:"contained",disabled:e,onClick:()=>{h();},children:s?jsx(bh,{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 wh=e(Ne)`
|
|
566
566
|
width: auto;
|
|
567
567
|
display: inline-flex;
|
|
568
568
|
align-items: center;
|
|
@@ -581,9 +581,9 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
581
581
|
path {
|
|
582
582
|
fill: ${({theme:e,$shouldFill:t})=>t?e.stigg.palette.primary:void 0};
|
|
583
583
|
}
|
|
584
|
-
`,Rc=({promotionCode:e,onClearPromotionCode:t})=>jsxs(wh,{container:true,children:[jsxs(
|
|
584
|
+
`,Rc=({promotionCode:e,onClearPromotionCode:t})=>jsxs(wh,{container:true,children:[jsxs(Ne,{item:true,display:"flex",gap:1,alignItems:"center",children:[jsx(Nc,{icon:"Coupon"}),jsx(f,{variant:"body1",color:"primary.main",lineHeight:"auto",children:e})]}),jsx(Ne,{item:true,children:jsx(te,{variant:"text",sx:{minWidth:"unset",padding:0},onClick:t,children:jsx(Nc,{icon:"Close",$shouldFill:true})})})]});var Ah=e.div`
|
|
585
585
|
margin: 16px 0;
|
|
586
|
-
`,Uc=({disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})=>{let{promotionCode:r,setPromotionCode:n}=Bt();return jsx(Bh,{children:r?jsx(Rc,{promotionCode:r,onClearPromotionCode:()=>{n("");}}):jsx(Lc,{disabled:e,checkoutLocalization:t,onMockCheckoutPreview:o})})};var _c=({label:e,checked:t,onChange:o,onClick:r,value:n,disabled:i,dataTestId:s})=>jsx(Ih,{onClick:r,value:n,control:jsx(Ah,{checked:t,onChange:o,disabled:i,"data-testid":s}),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$1,example:"123.456.789"},{country:"Bahrain",countryCode:"BH",taxIdType:"bh_vat",FlagComponent:BH,example:"123456789012345"},{country:"Bangladesh",countryCode:"BD",taxIdType:"bd_bin",FlagComponent:BD,example:"123456789-0123"},{country:"Barbados",countryCode:"BB",taxIdType:"bb_tin",FlagComponent:BB,example:"1123456789012"},{country:"Belarus",countryCode:"BY",taxIdType:"by_tin",FlagComponent:BY,example:"123456789"},{country:"Belgium",countryCode:"BE",taxIdType:"eu_vat",FlagComponent:BE,example:"BE0123456789"},{country:"Benin",countryCode:"BJ",taxIdType:"bj_ifu",FlagComponent:BJ,example:"1234567890123"},{country:"Bolivia",countryCode:"BO",taxIdType:"bo_tin",FlagComponent:BO,example:"123456789"},{country:"Bosnia & Herzegovina",countryCode:"BA",taxIdType:"ba_tin",FlagComponent:BA,example:"123456789012"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cnpj",FlagComponent:BR,example:"01.234.456/5432-10"},{country:"Brazil",countryCode:"BR",taxIdType:"br_cpf",FlagComponent:BR,example:"123.456.789-87"},{country:"Bulgaria",countryCode:"BG",taxIdType:"bg_uic",FlagComponent:BG,example:"123456789"},{country:"Bulgaria",countryCode:"BG",taxIdType:"eu_vat",FlagComponent:BG,example:"BG0123456789"},{country:"Burkina Faso",countryCode:"BF",taxIdType:"bf_ifu",FlagComponent:BF,example:"12345678A"},{country:"Cambodia",countryCode:"KH",taxIdType:"kh_tin",FlagComponent:KH,example:"1001-123456789"},{country:"Cameroon",countryCode:"CM",taxIdType:"cm_niu",FlagComponent:CM,example:"M123456789000L"},{country:"Canada",countryCode:"CA",taxIdType:"ca_bn",FlagComponent:CA,example:"123456789"},{country:"Canada",countryCode:"CA",taxIdType:"ca_gst_hst",FlagComponent:CA,example:"123456789RT0002"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_bc",FlagComponent:CA,example:"PST-1234-5678"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_mb",FlagComponent:CA,example:"123456-7"},{country:"Canada",countryCode:"CA",taxIdType:"ca_pst_sk",FlagComponent:CA,example:"1234567"},{country:"Canada",countryCode:"CA",taxIdType:"ca_qst",FlagComponent:CA,example:"1234567890TQ1234"},{country:"Cape Verde",countryCode:"CV",taxIdType:"cv_nif",FlagComponent:CV,example:"213456789"},{country:"Chile",countryCode:"CL",taxIdType:"cl_tin",FlagComponent:CL,example:"12.345.678-K"},{country:"China",countryCode:"CN",taxIdType:"cn_tin",FlagComponent:CN,example:"123456789012345678"},{country:"Colombia",countryCode:"CO",taxIdType:"co_nit",FlagComponent:CO,example:"123.456.789-0"},{country:"Congo - Kinshasa",countryCode:"CD",taxIdType:"cd_nif",FlagComponent:CD,example:"A0123456M"},{country:"Costa Rica",countryCode:"CR",taxIdType:"cr_tin",FlagComponent:CR,example:"1-234-567890"},{country:"Croatia",countryCode:"HR",taxIdType:"eu_vat",FlagComponent:HR,example:"HR12345678912"},{country:"Croatia",countryCode:"HR",taxIdType:"hr_oib",FlagComponent:HR,example:"12345678901"},{country:"Cyprus",countryCode:"CY",taxIdType:"eu_vat",FlagComponent:CY,example:"CY12345678Z"},{country:"Czech Republic",countryCode:"CZ",taxIdType:"eu_vat",FlagComponent:CZ,example:"CZ1234567890"},{country:"Denmark",countryCode:"DK",taxIdType:"eu_vat",FlagComponent:DK,example:"DK12345678"},{country:"Dominican Republic",countryCode:"DO",taxIdType:"do_rcn",FlagComponent:DO,example:"123-4567890-1"},{country:"Ecuador",countryCode:"EC",taxIdType:"ec_ruc",FlagComponent:EC,example:"1234567890001"},{country:"Egypt",countryCode:"EG",taxIdType:"eg_tin",FlagComponent:EG,example:"123456789"},{country:"El Salvador",countryCode:"SV",taxIdType:"sv_nit",FlagComponent:SV,example:"1234-567890-123-4"},{country:"Estonia",countryCode:"EE",taxIdType:"eu_vat",FlagComponent:EE,example:"EE123456789"},{country:"Ethiopia",countryCode:"ET",taxIdType:"et_tin",FlagComponent:ET,example:"1234567890"},{country:"EU",countryCode:"EU",taxIdType:"eu_oss_vat",FlagComponent:EU,example:"EU123456789"},{country:"Finland",countryCode:"FI",taxIdType:"eu_vat",FlagComponent:FI,example:"FI12345678"},{country:"France",countryCode:"FR",taxIdType:"eu_vat",FlagComponent:FR,example:"FRAB123456789"},{country:"Georgia",countryCode:"GE",taxIdType:"ge_vat",FlagComponent:GE,example:"123456789"},{country:"Germany",countryCode:"DE",taxIdType:"de_stn",FlagComponent:DE,example:"1234567890"},{country:"Germany",countryCode:"DE",taxIdType:"eu_vat",FlagComponent:DE,example:"DE123456789"},{country:"Greece",countryCode:"GR",taxIdType:"eu_vat",FlagComponent:GR,example:"EL123456789"},{country:"Guinea",countryCode:"GN",taxIdType:"gn_nif",FlagComponent:GN,example:"123456789"},{country:"Hong Kong",countryCode:"HK",taxIdType:"hk_br",FlagComponent:HK,example:"12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"eu_vat",FlagComponent:HU,example:"HU12345678"},{country:"Hungary",countryCode:"HU",taxIdType:"hu_tin",FlagComponent:HU,example:"12345678-1-23"},{country:"Iceland",countryCode:"IS",taxIdType:"is_vat",FlagComponent:IS$1,example:"123456"},{country:"India",countryCode:"IN",taxIdType:"in_gst",FlagComponent:IN,example:"12ABCDE3456FGZH"},{country:"Indonesia",countryCode:"ID",taxIdType:"id_npwp",FlagComponent:ID,example:"012.345.678.9-012.345"},{country:"Ireland",countryCode:"IE",taxIdType:"eu_vat",FlagComponent:IE,example:"IE1234567AB"},{country:"Israel",countryCode:"IL",taxIdType:"il_vat",FlagComponent:IL,example:"000012345"},{country:"Italy",countryCode:"IT",taxIdType:"eu_vat",FlagComponent:IT,example:"IT12345678912"},{country:"Japan",countryCode:"JP",taxIdType:"jp_cn",FlagComponent:JP$1,example:"1234567891234"},{country:"Japan",countryCode:"JP",taxIdType:"jp_rn",FlagComponent:JP$1,example:"12345"},{country:"Japan",countryCode:"JP",taxIdType:"jp_trn",FlagComponent:JP$1,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"}],fP="United States",yP=" # ",mr="us_ein",ur=(e,t)=>`${e}${yP}${t}`,mi=new Map(pi.map(e=>[ur(e.taxIdType,e.country),e])),It=e=>mi.get(e),gr=ur(mr,fP);var ui=e(ce)(()=>({"& .MuiOutlinedInput-root":{borderRadius:"5px",padding:"12px",fieldset:{borderColor:"#e6e6e6"}},"& .MuiInputBase-input":{borderRadius:"5px",fontSize:"16px",padding:"0 0"}}));var bP=e(hP)(()=>({"& .MuiAutocomplete-input":{padding:"0 !important"}})),fr=e(f)({});fr.defaultProps={variant:"body1",color:"secondary"};function od(){let[e,t]=useState(false),{billingAddress:o,taxId:r,setTaxId:n}=re(),[i,s]=useState(gr),[l,a$1]=useState(false),c=useCallback((g,y,C)=>{n({type:y,value:C}),s(g);},[n,s]);useEffect(()=>{a$1(false);},[o==null?void 0:o.country]),useEffect(()=>{if(!(o!=null&&o.country)||l||!e)return;let g=pi.find(y=>y.countryCode===o.country);g&&c(ur(g.taxIdType,g.country),g.taxIdType,"");},[o,e,l,c]);let u=g=>{if(!g)return;let y=It(g);if(y){if(a$1(true),r!=null&&r.value){c(g,y.taxIdType,r.value);return}s(g),r!=null&&r.type&&n(void 0);}},f$1=useMemo(()=>Array.from(mi.keys()),[]),p=useMemo(()=>f$1.find(g=>g===i)||null,[f$1,i]),h=useMemo(()=>{let g=It(i);return (g==null?void 0:g.example)||"Add your VAT/GST or local tax ID."},[i]);return useEffect(()=>(e||(a$1(false),c(gr,mr,"")),()=>{c(gr,mr,"");}),[e,c]),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(Me,{flexDirection:"row",container:true,gap:2,children:jsx(_c,{checked:e,onChange:()=>t(g=>!g),label:jsx(fr,{children:"I'm purchasing as a business"})})}),jsx(CP,{in:e,children:jsxs(Me,{container:true,spacing:0,sx:{width:"100%"},children:[jsxs(Me,{item:true,xs:6,children:[jsx(fr,{children:"Tax ID Type"}),jsx(bP,{fullWidth:true,options:f$1,value:p,onChange:(g,y)=>u(y),renderInput:g=>jsx(ui,b(a({},g),{id:"id-type",InputProps:g.InputProps})),renderOption:(g,y)=>{let C=It(y);if(!C)return null;let{taxIdType:b$1,country:x,FlagComponent:S}=C;return createElement(ou,b(a({},g),{key:y}),jsxs(f,{variant:"body1",lineHeight:"20px",color:"secondary",children:[S&&jsx(S,{width:15,style:{marginRight:"5px",borderRadius:"8%"}}),ed(x)," - ",td(b$1)]}))},getOptionLabel:g=>{let y=It(g);return y?`${ed(y.country)} - ${td(y.taxIdType)}`:g},ListboxProps:{sx:{maxHeight:200}}})]}),jsxs(Me,{item:true,xs:6,paddingLeft:"12px",children:[jsx(fr,{children:"Tax ID"}),jsx(ui,{id:"tax-id-value",placeholder:h,type:"text",fullWidth:true,value:(r==null?void 0:r.value)||"",onChange:g=>{let y=It(i);y&&c(i,y.taxIdType,g.target.value);}})]})]})})]})}function rd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o}){var g;let{checkoutState:r,checkoutLocalization:n,widgetState:i,setWidgetReadOnly:s}=U(),{setBillingAddress:l}=re(),{customer:a$1,configuration:c$1}=r||{},{readOnly:u}=i,f$1=!!(t!=null?t:(g=c$1==null?void 0:c$1.content)!=null&&g.collectPhoneNumber),p=useMemo(()=>o&&!(a$1!=null&&a$1.billingId)&&!(a$1!=null&&a$1.paymentMethodDetails),[o,a$1==null?void 0:a$1.billingId,a$1==null?void 0:a$1.paymentMethodDetails]),h=y=>{if(!y.complete)return;let S=y.value.address,{postal_code:C}=S,b=c(S,["postal_code"]),x=a({postalCode:C},b);s(true),l(x),e?d(null,null,function*(){yield e({billingAddress:x}),s(false);}):s(false);};return jsxs(Me,{flexDirection:"column",container:true,gap:3,padding:"16px",sx:{pointerEvents:u?"none":void 0},children:[jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodBillingAddressTitle}),jsx(AddressElement,{onChange:h,options:{mode:"billing",fields:{phone:f$1?"always":"auto"},defaultValues:a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name})}})]}),jsxs(Me,{flexDirection:"column",container:true,gap:2,children:[jsx(f,{variant:"h6",children:n.newPaymentMethodCardTitle}),jsx(PaymentElement,{onChange:()=>{},onReady:()=>{},options:{readOnly:u,terms:{card:"never"},defaultValues:{billingDetails:a(a({},(a$1==null?void 0:a$1.name)&&{name:a$1.name}),(a$1==null?void 0:a$1.email)&&{email:a$1.email})}}})]}),p&&jsx(od,{})]})}function nd(){let[e,t]=useState(null),{checkoutState:o}=U(),{billingIntegration:r,setupSecret:n}=o||{};return useEffect(()=>{if(r){let{billingIdentifier:i,credentials:s}=r;if(i!==BillingVendorIdentifier.Stripe)return;let{accountId:l,publicKey:a}=s;if(!l||!a){console.error("Stripe account ID or public key is missing");return}import('@stripe/stripe-js').then(({loadStripe:c})=>{t(c(a,{stripeAccount:l}));});}},[r]),{stripePromise:e,setupIntentClientSecret:n}}function yr(){let e=wt(),[{resourceId:t}]=R(),{checkoutState:o}=U(),{plan:r}=o||{},n=e.addons.map(({addon:i,quantity:s})=>({addonId:i.id,quantity:s}));if(r!=null&&r.id)return a({resourceId:t,planId:r.id,billingPeriod:e.billingPeriod,billableFeatures:e.billableFeatures,addons:n,promotionCode:e.promotionCode,billingCountryCode:e.billingCountryCode},lr({taxIds:e.taxId?[e.taxId]:void 0}))}var FP=[PaymentCollection.Failed,PaymentCollection.Processing];function vP(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 xi(o){return d(this,arguments,function*({applySubscriptionResults:e,stripe:t}){var s,l;let r=e==null?void 0:e.subscription,n=(s=r==null?void 0:r.latestInvoice)==null?void 0:s.paymentSecret,i=r==null?void 0:r.paymentCollection;if(t&&n&&i===PaymentCollection.ActionRequired){let{error:a}=yield t.handleNextAction({clientSecret:n});if(a)return {errorMessage:a.message||""}}else if(i&&FP.includes(i))return {errorMessage:((l=r==null?void 0:r.latestInvoice)==null?void 0:l.errorMessage)||"An error occurred - try again later"};return {subscription:r}})}function EP(r){return d(this,arguments,function*({stripe:e,elements:t,clientSecret:o}){let n,i,{error:s}=yield e.confirmSetup({elements:t,confirmParams:{return_url:window.location.href},redirect:"if_required"});if(s)s.type==="card_error"||s.type==="validation_error"?s.type==="card_error"&&(i=s.message||""):i="An unexpected error occurred.";else try{let{setupIntent:l}=yield e.retrieveSetupIntent(o);l!=null&&l.payment_method&&(n=l.payment_method);}catch(l){i="An unexpected error occurred.",console.error(l);}return {newPaymentMethodId:n,setupErrorMessage:i}})}function id(r){return d(this,arguments,function*({stripe:e,elements:t,setupIntentClientSecret:o}){if(!e||!t||!o)return {success:false};let n=yield vP({elements:t});if(!n.success)return {success:false,errorMessage:n.errorMessage};let{newPaymentMethodId:i,setupErrorMessage:s}=yield EP({stripe:e,elements:t,clientSecret:o});return s||!i?{success:false,errorMessage:s}:{success:true,paymentMethodId:i}})}var ad={v:"5.12.1",fr:30,ip:0,op:201,w:700,h:700,nm:"Check",ddd:0,assets:[],layers:[{ddd:0,ind:1,ty:4,nm:"Shape Layer 8",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:315,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:2,ty:4,nm:"Shape Layer 7",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:270,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:3,ty:4,nm:"Shape Layer 6",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:225,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:4,ty:4,nm:"Shape Layer 5",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:180,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:5,ty:4,nm:"Shape Layer 4",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:135,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:6,ty:4,nm:"Shape Layer 3",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:90,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:7,ty:4,nm:"Shape Layer 2",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:45,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:8,ty:4,nm:"Shape Layer 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[-304,91,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0]],o:[[0,0],[0,0]],v:[[-304,-241],[-304,-161]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:9,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:135,s:[100]},{t:145.5,s:[0]}],ix:1},e:{a:1,k:[{i:{x:[.667],y:[1]},o:{x:[.333],y:[0]},t:130,s:[100]},{t:139.6005859375,s:[0]}],ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:130,op:204,st:-2,ct:1,bm:0},{ddd:0,ind:9,ty:4,nm:"Check v",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:-1.9,ix:10},p:{a:0,k:[352,360,0],ix:2,l:2},a:{a:0,k:[-120.265,116.765,0],ix:1,l:2},s:{a:0,k:[278,278,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{ind:0,ty:"sh",ix:1,ks:{a:0,k:{i:[[0,0],[0,0],[0,0]],o:[[0,0],[0,0],[0,0]],v:[[-161,123],[-137,148],[-79.531,85.531]],c:false},ix:2},nm:"Path 1",mn:"ADBE Vector Shape - Group",hd:false},{ty:"st",c:{a:0,k:[1,1,1,1],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:5.5,ix:5},lc:2,lj:2,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[0,0],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Shape 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[0],y:[1]},o:{x:[.333],y:[0]},t:135,s:[0]},{t:148,s:[100]}],ix:1},e:{a:0,k:0,ix:2},o:{a:0,k:0,ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:135,op:201,st:-35,ct:1,bm:0},{ddd:0,ind:11,ty:4,nm:"Circle Stroke",sr:1,ks:{o:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[0]},{t:7,s:[100]}],ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[4,-6,0],ix:1,l:2},s:{a:0,k:[132,132,100],ix:6,l:2}},ao:0,shapes:[{ty:"gr",it:[{d:1,ty:"el",s:{a:0,k:[306,306],ix:2},p:{a:0,k:[0,0],ix:3},nm:"Ellipse Path 1",mn:"ADBE Vector Shape - Ellipse",hd:false},{ty:"st",c:{a:1,k:[{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:0,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:30,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:61,s:[1,1,1,1]},{i:{x:[.833],y:[.833]},o:{x:[.167],y:[.167]},t:87,s:[1,1,1,1]},{t:136,s:[1,1,1,1]}],ix:3},o:{a:0,k:100,ix:4},w:{a:0,k:8,ix:5},lc:2,lj:1,ml:4,bm:0,nm:"Stroke 1",mn:"ADBE Vector Graphic - Stroke",hd:false},{ty:"tr",p:{a:0,k:[4,-6],ix:2},a:{a:0,k:[0,0],ix:1},s:{a:0,k:[100,100],ix:3},r:{a:0,k:0,ix:6},o:{a:0,k:100,ix:7},sk:{a:0,k:0,ix:4},sa:{a:0,k:0,ix:5},nm:"Transform"}],nm:"Ellipse 1",np:3,cix:2,bm:0,ix:1,mn:"ADBE Vector Group",hd:false},{ty:"tm",s:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[50]},{t:122,s:[100]}],ix:1},e:{a:1,k:[{i:{x:[.338],y:[1]},o:{x:[.333],y:[0]},t:87,s:[45]},{t:122,s:[0]}],ix:2},o:{a:1,k:[{i:{x:[.474],y:[1]},o:{x:[.43],y:[0]},t:0,s:[-170.4]},{t:111,s:[-1250.4]}],ix:3},m:1,ix:2,nm:"Trim Paths 1",mn:"ADBE Vector Filter - Trim",hd:false}],ip:0,op:201,st:0,ct:1,bm:0},{ddd:0,ind:13,ty:1,nm:"Dark Gray Solid 1",sr:1,ks:{o:{a:0,k:100,ix:11},r:{a:0,k:0,ix:10},p:{a:0,k:[350,350,0],ix:2,l:2},a:{a:0,k:[350,350,0],ix:1,l:2},s:{a:0,k:[100,100,100],ix:6,l:2}},ao:0,sw:700,sh:700,sc:"#2d2d2d",ip:0,op:201,st:0,bm:0}],markers:[],props:{}};var hr=5e3,_P=e(ke)`
|
|
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)`
|
|
587
587
|
@keyframes blurFade {
|
|
588
588
|
0% {
|
|
589
589
|
background-color: ${({theme:e})=>bi(e.stigg.palette.backgroundPaper).alpha(0).toString()};
|
|
@@ -614,7 +614,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
614
614
|
& path {
|
|
615
615
|
stroke: ${({theme:e})=>e.stigg.palette.primary};
|
|
616
616
|
}
|
|
617
|
-
`,
|
|
617
|
+
`,Dx=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,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
629
629
|
|
|
630
630
|
align-self: center;
|
|
631
631
|
animation: fadeIn 5s ease-in forwards;
|
|
632
|
-
`;function ld({checkoutLocalization:e}){let t=useRef();return useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxs(
|
|
632
|
+
`;function ld({checkoutLocalization:e}){let t=useRef();return useEffect(()=>{t.current&&t.current.scrollIntoView({behavior:"smooth",block:"center",inline:"center"});},[]),jsxs(_x,{className:"stigg-checkout-success-container",ref:t,children:[jsx(Ux,{options:{animationData:ad,loop:false,autoplay:true},width:350,height:"auto",style:{display:"flex",justifyContent:"center"}}),jsx(Dx,{variant:"h1",color:"primary.main",children:e.summary.checkoutSuccessText})]})}var Vx=e=>new Promise(t=>setTimeout(t,e));function cd({isMocked:e=false,onCheckout:t,onCheckoutCompleted:o,onSuccess:r,disableSuccessAnimation:n}){let{stigg:i}=u(),{useNewPaymentMethod:a$1}=re(),l=fr(),{checkoutState:s,widgetState:d$1,setWidgetReadOnly:u$1}=U(),{setupSecret:f,customer:m}=s||{},h=useStripe(),g=useElements();return {handleSubmit:C=>d(null,null,function*(){if(C.preventDefault(),!l)return {success:false,errorMessage:"Unexpected error, please contact support."};let b$1=true,P,S=false,T;if(u$1(true),!e&&a$1){let k=yield id({elements:g,stripe:h,setupIntentClientSecret:f});k.success?T=k.paymentMethodId:(P=k.errorMessage,b$1=false);}let I=b(a({},l),{paymentMethodId:T}),A=k=>d(null,null,function*(){S=true;try{let v=yield i.applySubscription(k),N=yield Pi({applySubscriptionResults:v,stripe:h});return {success:!N.errorMessage,errorMessage:N.errorMessage,results:v}}catch(v){return console.error(v),P=v==null?void 0:v.message,{success:false,errorMessage:P}}}),B;if(b$1)if(t){let k=yield t({customerId:m.id,checkoutParams:I,checkoutAction:A});if(k.errorMessage&&(P=k.errorMessage),!S&&k.results&&k.success){let v=yield Pi({applySubscriptionResults:k.results,stripe:h});v.errorMessage&&(P=v.errorMessage,b$1=false);}b$1=b$1&&k.success&&!P,B=k.results;}else {let k=yield A(I);!k.success&&k.errorMessage&&(P=k.errorMessage),b$1=k.success&&!P,B=k.results;}return u$1(false),b$1&&r&&(r(),n||(yield Vx(yr))),yield o({success:b$1,error:P}),{results:B,success:!P,errorMessage:P}}),isLoading:!!(d$1!=null&&d$1.readOnly)}}function dd(){return !!window.Zuora}function pd(){let e=document.createElement("script");e.type="text/javascript",e.src="https://js.zuora.com/payment/v3/zuora.js",e.async=true,e.onerror=()=>{throw new Error("Failed to load Zuora library")},document.head.appendChild(e);}function md(e,t,o,r){return {locale:r||"en",region:(r==null?void 0:r.toUpperCase())||"US",currency:o,amount:"1",createPaymentSession:e,onComplete:t}}function It(){let{stigg:e}=u(),{setErrorMessage:t}=re(),{billingCountryCode:o}=Pe(),[r,n]=useState(false),{checkoutState:i}=U(),{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{dd()||pd(),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 Zx=e=>new Promise(t=>setTimeout(t,e));function hr({onCheckout:e,onCheckoutCompleted:t,onSuccess:o,disableSuccessAnimation:r}){let{stigg:n}=u(),i=fr(),{checkoutState:a$1,setWidgetReadOnly:l,setCheckoutSuccess:s}=U(),{setErrorMessage:d$1}=re();return {handleZuoraSubmit:useCallback(f=>d(null,null,function*(){l(true);let m=true,h,g=i;if(!g)m=false,h="Unexpected error, please contact support.";else {let y=b(a({},g),{paymentMethodId:f}),C=b=>d(null,null,function*(){try{return {success:!0,results:yield n.applySubscription(b)}}catch(P){return console.error(P),{success:false,errorMessage:(P==null?void 0:P.message)||"Failed to apply subscription"}}});try{if(e){let b=yield e({customerId:a$1.customer.id,checkoutParams:y,checkoutAction:C});b.errorMessage&&(h=b.errorMessage),m=m&&b.success&&!h;}else {let b=yield C(y);!b.success&&b.errorMessage&&(h=b.errorMessage),m=b.success&&!h;}}catch(b){m=false,h=b.message||"Failed to process checkout";}}return m?(s(true),o&&(o(),r||(yield Zx(yr)))):d$1(h),l(false),yield t({success:m,error:h}),{success:m,errorMessage:h}}),[n,i,a$1,e,t,o,r,l,s,d$1])}}var Be=({isLoading:e,width:t=50,height:o$1=16,children:r})=>e?jsx(o,{width:t,height:o$1}):jsx(Fragment,{children:r});var Kx=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o})=>{var a,l,s,d;let{immediateInvoice:r}=e||{};if(!((l=(a=r==null?void 0:r.proration)==null?void 0:a.netAmount)!=null&&l.amount)||((d=(s=r==null?void 0:r.proration)==null?void 0:s.netAmount)==null?void 0:d.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(Be,{isLoading:t,width:"100%",children:o.summary.creditsForUnusedTimeText({credits:i})})})},qx=({subscriptionPreview:e,activeSubscription:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>{if(!(e!=null&&e.hasScheduledUpdates)||!(t!=null&&t.currentBillingPeriodEnd))return null;let{currentBillingPeriodEnd:n}=t,i=typeof r.summary.changesWillApplyAtEndOfBillingPeriod=="function"?r.summary.changesWillApplyAtEndOfBillingPeriod({billingPeriodEnd:n}):r.summary.changesWillApplyAtEndOfBillingPeriod;return jsx(f,{variant:"body1",style:{marginTop:14},className:"stigg-checkout-summary-captions-scheduled-updates",children:jsx(Be,{isLoading:o,width:"100%",children:i})})},Jx=({subscriptionPreview:e,activeSubscription:t,plan:o,isFetchingSubscriptionPreview:r,billingPeriod:n,checkoutLocalization:i})=>{let{promotionCode:a}=wt();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(Be,{isLoading:r,width:"100%",children:l})})};function yd(e){return jsxs(Te,{className:"stigg-checkout-summary-captions",children:[jsx(Kx,a({},e)),jsx(qx,a({},e)),e.plan&&jsx(Jx,a({},e))]})}function Si({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),d=o===BillingModel.PerUnit,u=i||1,f=r===BillingPeriod.Annually&&s,m=e&&(d||e>1)?`${k(e)} ${u>1?"for":"x"} `:"",h=f?" x 12 months":"",g=(a||t/e)/(f?12:1),y=H({amount:g,currency:n,minimumFractionDigits:2}),C=H({amount:t,currency:n,minimumFractionDigits:2});return `${m}${y}${h} ${h||m?` = ${C}`:""}`}function Cd(e){let{totalAmount:t,quantity:o,tiersMode:r,tiers:n,currency:i}=e;if(Ea(n)||r===TiersMode.Graduated&&!va(n,o)){let a=H({amount:t,currency:i,minimumFractionDigits:2});return `${k(o)} for ${a}`}return Si(e)}function oP(e,t){let{unitPrice:o,upTo:r}=e[t];if(!o)return "";if(t===0)return `First ${r}`;let i=(e[t-1].upTo||0)+1;return xo(r)?`${k(i)} and above`:`Next ${k(i)} to ${k(r)}`}function xd({price:e,unitQuantity:t}){let o=e.tiers||[],{checkoutState:r}=U(),n=r==null?void 0:r.plan,{breakdown:i}=cn(o,t);return i.length===1?null:jsx(Fragment,{children:i.map(({unitQuantity:a,amount:l},s)=>jsx(_e,{children:jsxs(Ie,{style:{alignItems:"flex-start"},children:[jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:oP(o,s)}),jsx(f,{variant:"body1",color:"tertiary",style:{whiteSpace:"nowrap"},children:Si({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(d=>d.billingPeriod))})})]})},s))})}var Pd=e(ChevronRight)`
|
|
633
633
|
height: ${({$size:e=24})=>`${e}px`};
|
|
634
634
|
width: ${({$size:e=24})=>`${e}px`};
|
|
635
635
|
transition: all 0.2s ease-in;
|
|
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
|
+
`,gP=e.div`
|
|
642
642
|
margin-top: 16px;
|
|
643
643
|
margin-left: 16px;
|
|
644
|
-
`,
|
|
644
|
+
`,Ie=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,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
651
651
|
align-items: center;
|
|
652
652
|
justify-content: space-between;
|
|
653
653
|
}
|
|
654
|
-
`,
|
|
654
|
+
`,fP=({checkoutLocalization:e})=>{let t=jsx(f,{variant:"body1",children:e.summary.payAsYouGoTooltipText});return jsx(Ve,{placement:"left",title:t,children:jsx(i,{icon:"PayAsYouGoCharge",style:{display:"flex"}})})},Pr=({checkoutLocalization:e,label:t,quantity:o,price:r})=>{let{checkoutState:n}=U(),i=n==null?void 0:n.plan,a=de("lg"),[l,s]=useState(false),d=()=>s(y=>!y),u=r.pricingModel===BillingModel.UsageBased,f$1=r.isTieredPrice?yt(r,o):(r.amount||0)*Math.ceil(o/(r.blockSize||1)),m;r.tiersMode===TiersMode.Graduated&&!!r.tiers&&!Ag(r.tiers)&&!xo(r.tiers[0].upTo)&&o>r.tiers[0].upTo&&(m=jsx(xd,{price:r,unitQuantity:o}));let g=jsx(f,{variant:"body1",color:"secondary",children:t});return m&&(g=jsx(xf,{onClick:d,underline:"none",style:{cursor:"pointer"},children:g})),jsxs(_e,{className:"stigg-checkout-summary-base-charges-container",children:[jsxs(Ie,{style:{alignItems:"flex-start"},children:[jsxs(Ne,{item:true,display:"flex",gap:.5,style:{whiteSpace:a?"nowrap":"break-spaces"},children:[g,m&&jsx(mP,{onClick:d,sx:{padding:0},children:jsx(Pd,{$isOpen:l,$size:16})})]}),jsxs(Ne,{item:true,display:"flex",gap:1,alignItems:"center",children:[u&&jsx(fP,{checkoutLocalization:e}),jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:a?"nowrap":"break-spaces"},children:[Cd({totalAmount:f$1,quantity:o,currency:r.currency,pricingModel:r.pricingModel,billingPeriod:r.billingPeriod,tiers:r.tiers,tiersMode:r.tiersMode,blockSize:r.blockSize,priceAmount:r.amount,availableBillingPeriods:new Set(i==null?void 0:i.pricePoints.map(y=>y.billingPeriod))}),u&&" / unit"]})]})]}),m&&jsx(Cx,{in:l,children:jsx(gP,{children:m})})]})},bd=({label:e})=>jsx(_e,{children:jsxs(Ie,{style:{alignItems:"flex-end"},children:[jsx(Ne,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:e})}),jsx(Ne,{item:true,display:"flex",gap:1,alignItems:"center",children:jsx(f,{variant:"body1",color:"secondary",style:{wordBreak:"break-word"},children:"Free"})})]})}),Sd=({subscriptionPreview:e,isFetchingSubscriptionPreview:t,checkoutLocalization:o$1})=>{let{immediateInvoice:r,recurringInvoice:n}=e,{discount:i,discountDetails:a}=n||{};return !i||!a?null:jsx(_e,{children:jsxs(Ie,{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})})]})})},Td=({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(Ie,{children:[jsx(f,{variant:"body1",color:"secondary",children:o.summary.appliedCreditsTitle}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Be,{isLoading:t,children:H({amount:-1*n.used.amount,currency:n.used.currency,minimumFractionDigits:2})})})]})})},kd=({tax:e,taxDetails:t,isFetchingSubscriptionPreview:o,checkoutLocalization:r})=>!t||!e||(e==null?void 0:e.amount)<=0?null:jsx(_e,{children:jsxs(Ie,{children:[jsx(f,{variant:"body1",color:"secondary",children:r.summary.taxTitle({taxDetails:t})}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Be,{isLoading:o,children:H({amount:e==null?void 0:e.amount,currency:e==null?void 0:e.currency,minimumFractionDigits:2})})})]})});var wi=e(Te)`
|
|
655
655
|
width: 100%;
|
|
656
656
|
max-width: 470px;
|
|
657
657
|
flex: 1.5;
|
|
658
|
-
`,
|
|
658
|
+
`,br=e(bP)`
|
|
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
|
+
`;br.defaultProps={elevation:0};var TP=e(f)`
|
|
666
666
|
margin-bottom: 16px;
|
|
667
667
|
font-weight: 500;
|
|
668
|
-
`,
|
|
668
|
+
`,Ft=e(Cl)`
|
|
669
669
|
margin: 16px 0;
|
|
670
|
-
`,
|
|
670
|
+
`,Ad=e(f)`
|
|
671
671
|
margin-bottom: 8px;
|
|
672
|
-
`;function
|
|
672
|
+
`;function kP({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 Bd=({onCheckout:e,onCheckoutCompleted:t,disablePromotionCode:o,disableSuccessAnimation:r,isFreeDowngrade:n,onMockCheckoutPreview:i$1,showWatermark:a$1})=>{var ia,aa,sa,la;let[l,s]=useState(false),{setErrorMessage:d$1,useNewPaymentMethod:u}=re(),f$1=Re(),m=kt(),{checkoutState:h,checkoutLocalization:g,checkoutSuccess:y,widgetState:C}=U(),{plan:b$1,activeSubscription:P}=h||{},S=cr(((ia=b$1==null?void 0:b$1.pricePoints)==null?void 0:ia.filter(D=>D.billingPeriod===m.billingPeriod))||[]),[T,I]=hP(S,D=>D.pricingModel===BillingModel.FlatFee),A=T[0],B=n||f$1.isCheckoutComplete&&f$1.isLastStep,{isZuoraIntegration:k}=It(),v=l||y,{subscriptionPreview:N,isFetchingSubscriptionPreview:F,errorMessage:Z}=mc({onMockCheckoutPreview:i$1}),{handleSubmit:$,isLoading:_}=cd({isMocked:!!i$1,disableSuccessAnimation:r,onCheckout:e,onCheckoutCompleted:t,onSuccess:()=>{s(true),f$1.markStepAsCompleted(f$1.progressBarState.activeStep);}}),{handleZuoraSubmit:z}=hr({onCheckout:e,onCheckoutCompleted:t,disableSuccessAnimation:r,onSuccess:()=>{f$1.markStepAsCompleted(f$1.progressBarState.activeStep);}}),q$1=D=>d(null,null,function*(){if(v)return;let ke;k&&!u?ke=yield z():ke=yield $(D);let{errorMessage:ge}=ke||{};ge?(d$1(ge),s(false)):d$1(void 0);}),Ge=k&&!u?C.readOnly:_,pt=D=>d(null,null,function*(){Ge||(B?yield q$1(D):f$1.goNext());}),{immediateInvoice:V,recurringInvoice:xe}=N||{},Xi=!!N&&(!!(V!=null&&V.proration)||!!N.hasScheduledUpdates),ji=!o&&!n&&!k,ea=!!(xe!=null&&xe.discountDetails)&&!n,Yr=ji||ea,ta=I.some(D=>D.pricingModel===BillingModel.UsageBased),Qr=ta&&!A&&I.every(D=>D.pricingModel===BillingModel.UsageBased),oa=typeof g.summary.baseChargeText=="function"?g.summary.baseChargeText({billingPeriod:m.billingPeriod}):g.summary.baseChargeText,ra=useMemo(()=>{var D,ke;return (ke=(D=m.addons)==null?void 0:D.filter(ge=>!at(ge.addon)))!=null?ke:[]},[m.addons]),na=useMemo(()=>ra.filter(D=>{var ge;return !!((ge=D.addon.pricePoints)==null?void 0:ge.find(mt=>mt.billingPeriod===m.billingPeriod))}).map(D=>{let ke=D.addon.pricePoints.find(mt=>mt.billingPeriod===m.billingPeriod),ge=D.quantity&&D.quantity>0?D.quantity:1;return jsx(Pr,{checkoutLocalization:g,label:D.addon.displayName,quantity:ge,price:ke},D.addon.id)}),[ra,m.billingPeriod,g]);return jsxs(wi,{className:"stigg-checkout-summary-container",children:[jsxs(br,{children:[jsx(TP,{variant:"h3",children:g.summary.title}),jsxs(Ne,{className:"stigg-checkout-summary-plan-title-container",display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.planName({plan:b$1})}),jsx(Ft,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),A&&jsx(Pr,{checkoutLocalization:g,label:oa,quantity:1,price:A}),!A&&n?jsx(bd,{label:oa}):null,jsx(Ne,{item:true,className:"stigg-checkout-summary-usage-charges-container",children:I.map((D,ke)=>{var mt,ca,da,pa,ma;let ge=(mt=m.billableFeatures)==null?void 0:mt.find(nm=>{var ua;return nm.featureId===((ua=D.feature)==null?void 0:ua.featureId)});return jsx(Pr,{checkoutLocalization:g,label:St(((da=D.feature)==null?void 0:da.displayName)||"",(pa=D.feature)==null?void 0:pa.units,(ma=D.feature)==null?void 0:ma.unitsPlural),quantity:(ge==null?void 0:ge.quantity)||1,price:D},((ca=D.feature)==null?void 0:ca.featureId)||`usage-charge-${ke}`)})}),na.length>0&&jsxs(Fragment,{children:[jsxs(Ne,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.addonsSectionTitle}),jsx(Ft,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),na]}),!Yr&&jsx(Ft,{className:"stigg-checkout-summary-divider"}),Yr&&jsxs(Ne,{display:"flex",flexDirection:"row",alignItems:"center",marginY:2,children:[jsx(f,{variant:"h6",color:"primary",style:{paddingRight:"8px"},children:g.summary.discountsSectionTitle}),jsx(Ft,{className:"stigg-checkout-summary-divider",sx:{flex:1,margin:"0 !important"}})]}),ji&&jsx(Uc,{disabled:Ge||F,checkoutLocalization:g,onMockCheckoutPreview:i$1}),ea&&N&&jsx(Sd,{subscriptionPreview:N,isFetchingSubscriptionPreview:F,checkoutLocalization:g}),Yr&&jsx(Ft,{className:"stigg-checkout-summary-divider"}),jsx(kd,{tax:xe==null?void 0:xe.tax,taxDetails:xe==null?void 0:xe.taxDetails,isFetchingSubscriptionPreview:F,checkoutLocalization:g}),n?null:jsxs(Fragment,{children:[jsx(Ie,{style:{marginTop:16},children:jsxs(Ne,{display:"flex",flexDirection:"column",container:true,children:[jsxs(Ne,{item:true,display:"flex",justifyContent:"space-between",children:[jsx(f,{variant:"h6",children:g.summary.totalText}),jsx(f,{variant:"h6",children:jsxs(Be,{isLoading:F,children:[Qr?g.summary.onlyPayAsYouGoText:null,!Qr&&ta?g.summary.startsAtText:null,Qr?null:H(b(a({amount:0},xe==null?void 0:xe.total),{minimumFractionDigits:2}))]})})]}),jsx(Ne,{item:true,children:jsx(f,{variant:"body1",color:"secondary",children:g.summary.totalBillingPeriodText({billingPeriod:m.billingPeriod})})})]})}),jsx(Ft,{className:"stigg-checkout-summary-divider"})]}),(aa=V==null?void 0:V.proration)!=null&&aa.hasProrations&&(V!=null&&V.subTotal)&&(V==null?void 0:V.subTotal.amount)>0?jsx(_e,{children:jsxs(Ie,{children:[jsx(f,{variant:"body1",color:"secondary",children:g.summary.proratedTotalDueText}),jsx(f,{variant:"body1",color:"secondary",children:jsx(Be,{isLoading:F,children:H({amount:Number(((sa=V==null?void 0:V.subTotal)==null?void 0:sa.amount)||0)+Number(((la=V==null?void 0:V.tax)==null?void 0:la.amount)||0),currency:V==null?void 0:V.subTotal.currency,minimumFractionDigits:2})})})]})}):null,jsx(Td,{subscriptionPreview:N,isFetchingSubscriptionPreview:F,checkoutLocalization:g}),jsx(_e,{children:jsxs(Ie,{children:[jsx(Ad,{variant:"h6",children:g.summary.totalDueText}),jsx(Ad,{variant:"h6",children:jsx(Be,{isLoading:F,children:H(b(a({amount:0},V==null?void 0:V.total),{minimumFractionDigits:2}))})})]})}),jsx(yd,{plan:b$1,activeSubscription:P,subscriptionPreview:N,isFetchingSubscriptionPreview:F,checkoutLocalization:g,billingPeriod:m.billingPeriod}),(!B||!k||k&&!u)&&jsxs(Fragment,{children:[jsx(te,{$success:v,$error:B&&n,disabled:Ge||F||f$1.progressBarState.isDisabled||B&&!Xi||!!Z,className:"stigg-checkout-summary-cta-button",sx:{textTransform:"none",borderRadius:"10px",marginTop:"24px",height:"36px"},variant:"contained",size:"medium",onClick:D=>{pt(D);},fullWidth:true,children:jsx(f,{className:"stigg-checkout-summary-cta-button-text",variant:"h3",color:"white",style:{display:"flex"},children:v?jsx(i,{icon:"Check",style:{display:"contents"}}):Ge||F?jsx(bh,{size:20,sx:{color:"white"}}):kP({isLastStep:B,checkoutHasChanges:Xi,isFreeDowngrade:n,checkoutLocalization:g,isPlanUpdate:!!P&&(P==null?void 0:P.plan.id)===(b$1==null?void 0:b$1.id)})})}),Z&&jsx(SP,{severity:"error",sx:{alignItems:"center",marginTop:"12px"},children:jsx(f,{overrideColor:"inherit",children:Z})})]})]}),jsx(q,{source:"checkout",showWatermark:a$1,style:{marginTop:8,display:"flex",justifyContent:"center"}}),!r&&v&&jsx(ld,{checkoutLocalization:g})]})};var Id=({showWatermark:e})=>jsxs(wi,{children:[jsxs(br,{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 Ed=e(Ne)`
|
|
673
673
|
width: 100%;
|
|
674
674
|
gap: 8px;
|
|
675
|
-
`,
|
|
675
|
+
`,vd=e(Ne)`
|
|
676
676
|
display: flex;
|
|
677
677
|
flex-direction: column;
|
|
678
678
|
gap: 16px;
|
|
@@ -692,19 +692,19 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
692
692
|
width: 41px;
|
|
693
693
|
height: 41px;
|
|
694
694
|
padding: 0;
|
|
695
|
-
`;var
|
|
695
|
+
`;var AP=styled(Ne)`
|
|
696
696
|
display: flex;
|
|
697
697
|
flex-direction: row;
|
|
698
698
|
align-items: center;
|
|
699
699
|
width: 100%;
|
|
700
700
|
justify-content: flex-end;
|
|
701
|
-
`;function Rd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i$1,handleQuantityChange:
|
|
701
|
+
`;function Rd({addon:e,addonState:t,hasChanges:o,errorMessage:r,isPriceForBillingPeriodAvailable:n,checkoutLocalization:i$1,handleQuantityChange:a,handleUndo:l,handleRemoveAddon:s}){var m;let d=de("lg"),u=!!t,f$1=e.maxQuantity!==1;return jsxs(AP,{item:true,sx:{gap:"16px"},container:!d,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(Ne,{sx:{display:"flex",width:"100%",justifyContent:"flex-end"},children:[f$1&&jsx(ce,{id:`${e.id}-input`,type:"number",onWheel:ht,sx:d?{marginX:2,width:"100%"}:{flex:1},value:(m=t==null?void 0:t.quantity)!=null?m:"",error:!!r,helperText:r,FormHelperTextProps:{sx:{margin:"4px"}},onChange:h=>{var g,y;return a((g=h==null?void 0:h.target)!=null&&g.value?Number((y=h==null?void 0:h.target)==null?void 0:y.value):null)},onFocus:h=>h.target.select()}),jsx(Ld,{color:"error",onClick: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 FP=e(Ne)`
|
|
702
702
|
display: flex;
|
|
703
703
|
flex-direction: column;
|
|
704
704
|
justify-content: center;
|
|
705
705
|
width: 100%;
|
|
706
706
|
height: 42px;
|
|
707
|
-
`;function Ud({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxs(
|
|
707
|
+
`;function Ud({addon:e,billingPeriod:t,checkoutLocalization:o}){let r=e.pricePoints.find(n=>n.billingPeriod===t);return jsxs(FP,{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 LP({addon:e,billingPeriod:t,addonState:o,initialAddonState:r,setAddon:n,removeAddon:i,checkoutLocalization:a,onAddonsValidationChange:l,onAddonChange:s}){let[d$1,u]=useState(void 0),f=!!o&&!!r&&o.quantity!==r.quantity||!!r&&!o,m=e.pricePoints.some(C=>C.billingPeriod===t),h=C=>d(null,null,function*(){if(!C||C<=0){l({addonId:e.id,isValid:false}),u("Minimum 1"),n(e,C!=null?C:null);return}let b=yield 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);}),g=()=>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(Ud,{addon:e,billingPeriod:t,checkoutLocalization:a}),jsx(Rd,{addon:e,addonState:o,hasChanges:f,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 g();l({addonId:e.id,isValid:true});}),errorMessage:d$1,handleQuantityChange:h,isPriceForBillingPeriodAvailable:m,checkoutLocalization:a,handleRemoveAddon:g})]})}function Dd({onAddonChange:e}){let{checkoutLocalization:t,setIsValid:o}=U(),{billingPeriod:r}=Pe(),{setIsDisabled:n}=Re(),{initialAddons:i,addons:a$1,availableAddons:l,setAddon:s,removeAddon:d}=jl(),[u,f]=useState((l==null?void 0:l.reduce((m,h)=>(m[h.id]=true,m),{}))||{});return useEffect(()=>{let m=Object.values(u).some(h=>!h);n(m),o(!m);},[u,n,o]),jsx(Ed,{container:true,children:l==null?void 0:l.map(m=>{let h=a$1.find(y=>y.addon.id===m.id),g=i==null?void 0:i.find(y=>y.addon.id===m.id);return jsx(LP,{addon:m,billingPeriod:r,addonState:h,initialAddonState:g,setAddon:s,removeAddon:d,checkoutLocalization:t,onAddonsValidationChange:({addonId:y,isValid:C})=>f(b(a({},u),{[y]:C})),onAddonChange:e},m.id)})})}var Ii=e(Ne,{shouldForwardProp:e=>!e.startsWith("$")})`
|
|
708
708
|
padding: 8px;
|
|
709
709
|
border-radius: 10px;
|
|
710
710
|
border: 1px solid ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
@@ -717,21 +717,21 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
717
717
|
border: none;
|
|
718
718
|
padding: 0;
|
|
719
719
|
`}
|
|
720
|
-
`,Gd=e(
|
|
720
|
+
`,Gd=e(Ne)`
|
|
721
721
|
display: flex;
|
|
722
722
|
align-items: center;
|
|
723
723
|
flex: 1;
|
|
724
724
|
gap: 12px;
|
|
725
|
-
`,zd=e(
|
|
725
|
+
`,zd=e(Ne)`
|
|
726
726
|
display: flex;
|
|
727
727
|
flex-direction: column;
|
|
728
|
-
`;var
|
|
728
|
+
`;var zP=e(Te)`
|
|
729
729
|
position: relative;
|
|
730
730
|
max-width: 500px;
|
|
731
|
-
`,
|
|
731
|
+
`,VP=e(Te)`
|
|
732
732
|
opacity: ${({$showLoading:e})=>e?.6:1};
|
|
733
733
|
pointer-events: ${({$showLoading:e})=>e?"none":"auto"};
|
|
734
|
-
`,
|
|
734
|
+
`,HP=e(Te)`
|
|
735
735
|
position: absolute;
|
|
736
736
|
top: 40px;
|
|
737
737
|
left: 0;
|
|
@@ -743,16 +743,16 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
743
743
|
justify-content: center;
|
|
744
744
|
border-radius: 4px;
|
|
745
745
|
z-index: 10;
|
|
746
|
-
`,
|
|
746
|
+
`,OP=e(Te)`
|
|
747
747
|
display: flex;
|
|
748
748
|
flex-direction: column;
|
|
749
749
|
align-items: center;
|
|
750
750
|
gap: 12px;
|
|
751
|
-
`;function Vd({onCheckout:e,onCheckoutCompleted:t}){var C,b,
|
|
751
|
+
`;function Vd({onCheckout:e,onCheckoutCompleted:t}){var C,b,P;let{isZuoraIntegration:o,isInitialized:r,createPaymentSession:n}=It(),{setErrorMessage:i}=re(),{billingCountryCode:a}=Pe(),{checkoutState:l,widgetState:s}=U(),{handleZuoraSubmit:d$1}=hr({onCheckout:e,onCheckoutCompleted:t}),u=useRef(false),[f,m]=ii.useState(false),h=((P=(b=(C=l==null?void 0:l.plan)==null?void 0:C.pricePoints)==null?void 0:b[0])==null?void 0:P.currency)||Currency.Usd,{publishableKey:g}=l==null?void 0:l.billingIntegration.billingCredentials,y=useCallback(S=>d(null,null,function*(){var T;if(!S.success||!S.paymentMethodId){let I=((T=S.error)==null?void 0:T.message)||"Payment failed";i(I),yield t({success:false,error:I});return}yield d$1(S.paymentMethodId);}),[d$1,i,t]);return useEffect(()=>(d(null,null,function*(){if(!(!r||u.current)){m(true),i(void 0);try{u.current=!0;let T=window.Zuora(g),I=md(n,y,h,a);(yield T.createPaymentForm(I)).mount("#zuora_payment");}catch(T){u.current=false,i("Failed to render Zuora payment form");}finally{m(false);}}}),()=>{u.current=false;}),[r]),o?jsxs(zP,{children:[jsx(VP,{id:"zuora_payment",$showLoading:s.readOnly||f}),(s.readOnly||f)&&jsx(HP,{children:jsx(OP,{children:jsx(bh,{size:28})})})]}):null}function Od({checked:e,text:t,subtitle:o,readOnly:r}){return jsxs(Gd,{children:[jsx(YP,{checked:e,disabled:r}),jsxs(zd,{container:true,children:[jsx(Ne,{item:true,children:t}),o&&jsx(Ne,{item:true,children:o})]})]})}function Wd({checked:e,paymentMethodDetails:t,readOnly:o,onSelect:r}){if(!t)return null;let{last4Digits:n,expirationMonth:i,expirationYear:a}=t;return jsx(Ii,{item:true,onClick:r,$disabled:o,children:jsx(Od,{checked:e,readOnly:o,text:jsx(f,{variant:"h6",children:`Card ending in ${n}`}),subtitle:!!i&&!!a&&jsx(f,{variant:"body1",children:`Expires ${i.toString().padStart(2,"0")}/${a}`})})})}function Zd({hasExistingPaymentMethod:e,checked:t,onSelect:o,readOnly:r,checkoutLocalization:n,onBillingAddressChange:i,collectPhoneNumber:a,collectTaxId:l,onCheckout:s,onCheckoutCompleted:d}){let{isZuoraIntegration:u}=It();return jsxs($d,{item:true,$hideBorders:!e,onClick:o,$disabled:r,children:[e&&jsx(Od,{checked:t,readOnly:r,text:jsx(f,{variant:"h6",children:n.newPaymentMethodText})}),jsx(Cx,{in:t,children:u?jsx(Vd,{onCheckout:s,onCheckoutCompleted:d}):jsx(rd,{onBillingAddressChange:i,collectPhoneNumber:a,collectTaxId:l})})]})}var qP=e(Ne)`
|
|
752
752
|
display: flex;
|
|
753
753
|
flex-direction: column;
|
|
754
754
|
gap: 24px;
|
|
755
|
-
`;function Yd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n}){let{checkoutState:i,checkoutLocalization:
|
|
755
|
+
`;function Yd({onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n}){let{checkoutState:i,checkoutLocalization:a,widgetState:l}=U(),{customer:s}=i||{},{errorMessage:d,useNewPaymentMethod:u,setUseNewPaymentMethod:f$1}=re(),{readOnly:m}=l,h=g=>{m||f$1(g);};return jsxs(qP,{container:true,children:[!!d&&jsx(SP,{severity:"error",sx:{alignItems:"center"},children:jsx(f,{overrideColor:"inherit",children:d})}),jsx(Wd,{readOnly:m,checked:!u,paymentMethodDetails:s==null?void 0:s.paymentMethodDetails,onSelect:()=>h(false)}),jsx(Zd,{hasExistingPaymentMethod:!!(s!=null&&s.paymentMethodDetails),readOnly:m,checked:u,checkoutLocalization:a,onSelect:()=>h(true),onBillingAddressChange:e,collectPhoneNumber:t,collectTaxId:o,onCheckout:r,onCheckoutCompleted:n})]})}var Br=({onClick:e,checkoutLocalization:t,size:o})=>jsx(Ym,{className:"stigg-checkout-change-plan-button",sx:{textTransform:"none"},variant:"text",size:o,onClick:e,children:jsx(f,{className:"stigg-checkout-change-plan-button-text",color:"primary.main",variant:"h3",style:{lineHeight:"24px"},children:t.changePlan})});function qd({allowChangePlan:e=false,onChangePlan:t}){let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{};return jsxs(Fragment,{children:[jsxs(Te,{sx:{marginBottom:"16px"},children:[jsx(f,{variant:"body1",color:"disabled",style:{opacity:.6,marginBottom:"8px"},children:"Selected plan"}),jsxs(Te,{sx:{display:"flex",justifyContent:"space-between"},children:[jsx(f,{variant:"h1",children:n==null?void 0:n.displayName}),e&&t&&jsx(Br,{onClick:()=>{t({currentPlan:n});},checkoutLocalization:r,size:"medium"})]})]}),jsx(Cl,{className:"stigg-checkout-plan-header-divider"})]})}function vi(e){switch(e){case BillingPeriod.Annually:return "Annual";case BillingPeriod.Monthly:return "Monthly";default:return ""}}var jd=e(Te)`
|
|
756
756
|
margin: 16px 0;
|
|
757
757
|
`,ep=e.button`
|
|
758
758
|
cursor: ${({$disabled:e,$isOnlyBillingPeriod:t})=>e||t?"default":"pointer"};
|
|
@@ -774,7 +774,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
774
774
|
background: none;
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
|
-
`,tp=e(
|
|
777
|
+
`,tp=e(Te)`
|
|
778
778
|
display: flex;
|
|
779
779
|
gap: 16px;
|
|
780
780
|
margin-top: 16px;
|
|
@@ -786,7 +786,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
786
786
|
& .MuiChip-label {
|
|
787
787
|
font-size: 12px;
|
|
788
788
|
}
|
|
789
|
-
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=
|
|
789
|
+
`;var op=({billingPeriod:e,isOnlyBillingPeriod:t})=>{let{billingPeriod:o,setBillingPeriod:r}=Pe(),n=o===e;return jsxs(ep,{onClick:()=>r(e),$isActive:n,$isOnlyBillingPeriod:t,children:[jsx(YP,{checked:n,onChange:()=>r(e),value:e,disabled:t,inputProps:{"aria-label":vi(e)},sx:{padding:0,marginRight:"8px"}}),jsx(Te,{children:jsx(f,{variant:"h3",color:"primary",children:vi(e)})})]})};function rp({plan:e,checkoutLocalization:t}){let[o,r]=hP(e==null?void 0:e.pricePoints,i=>i.billingPeriod===BillingPeriod.Monthly),n=!!(o!=null&&o.length)&&!!(r!=null&&r.length);return n?jsxs(jd,{children:[jsx(f,{variant:"h6",color:"primary",children:t.billingPeriodsTitle}),jsxs(tp,{children:[!!(o!=null&&o.length)&&jsx(op,{billingPeriod:BillingPeriod.Monthly,isOnlyBillingPeriod:!n},BillingPeriod.Monthly),!!(r!=null&&r.length)&&jsx(op,{billingPeriod:BillingPeriod.Annually,isOnlyBillingPeriod:!n},BillingPeriod.Annually)]})]}):null}var cb=e.div`
|
|
790
790
|
display: flex;
|
|
791
791
|
min-height: 60px;
|
|
792
792
|
margin-top: 16px;
|
|
@@ -797,7 +797,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
797
797
|
align-items: flex-start;
|
|
798
798
|
justify-content: space-between;
|
|
799
799
|
}
|
|
800
|
-
`,db=e(
|
|
800
|
+
`,db=e(Te)`
|
|
801
801
|
display: flex;
|
|
802
802
|
flex-direction: column;
|
|
803
803
|
justify-content: center;
|
|
@@ -809,27 +809,27 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
809
809
|
justify-content: flex-end;
|
|
810
810
|
width: 100%;
|
|
811
811
|
min-height: 42px;
|
|
812
|
-
`,mb=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function ub({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var g,y,C,b,
|
|
812
|
+
`,mb=(e,t)=>{let{minUnitQuantity:o,maxUnitQuantity:r}=e;return !t||t<(o||1)?`Minimum ${o||1}`:r&&t>r?`Maximum ${r}`:""};function ub({charge:e,setBillableFeature:t,billableFeature:o,onValidationChange:r,onBillableFeatureChange:n}){var g,y,C,b,P,S;let[i,a]=useState(void 0),l=(g=e.feature)==null?void 0:g.featureId,s=!l,d$1=e.pricingModel===BillingModel.UsageBased,u=s?"Base charge":St(((y=e.feature)==null?void 0:y.displayName)||"",(C=e.feature)==null?void 0:C.units,(b=e.feature)==null?void 0:b.unitsPlural),f$1=!!(e!=null&&e.minUnitQuantity||e!=null&&e.maxUnitQuantity),m=T=>d(null,null,function*(){var N,F;if(s||!l)return;let{minUnitQuantity:I,maxUnitQuantity:A}=e,B=(N=T==null?void 0:T.target)!=null&&N.value?Number((F=T==null?void 0:T.target)==null?void 0:F.value):null;if(!B||B<=0||I&&B<I||A&&B>A){r({featureId:l,isValid:false}),a(mb(e,B!=null?B:void 0)),t(l,B!=null?B:null);return}let k=ar(e,B),v=yield n==null?void 0:n({feature:e.feature,quantity:k});a(v==null?void 0:v.errorMessage),r({featureId:l,isValid:!(v!=null&&v.disableNextStep)}),t(l,k);}),h;if(s||d$1)h=`${H({amount:e.amount,currency:e.currency,locale:"en-us",minimumFractionDigits:2})}`,d$1&&(h+=" / unit");else if(e.isTieredPrice&&e.tiersMode&&l){let T=(o==null?void 0:o.quantity)||1;h=jsx(So,{componentId:`${l}-tiers`,tiers:e.tiers,tiersMode:e.tiersMode,value:T,errorMessage:i,handleChange:I=>d(null,null,function*(){let A=yield n==null?void 0:n({feature:e.feature,quantity:I});a(A==null?void 0:A.errorMessage),r({featureId:l,isValid:!(A!=null&&A.disableNextStep)}),t(l,I);}),width:"100%"});}else h=jsx(ce,{sx:{width:"100%"},id:`${l}-input`,type:"number",onWheel:ht,error:!!i,helperText:i,FormHelperTextProps:{sx:{margin:"4px"}},value:(P=o==null?void 0:o.quantity)!=null?P:"",onChange:m});return jsxs(cb,{children:[jsxs(db,{children:[jsx(f,{variant:"h6",color:"primary",lineHeight:"24px",children:u}),f$1&&jsx(f,{variant:"body1",color:"secondary",lineHeight:"20px",children:uo(e.minUnitQuantity,e.maxUnitQuantity,(S=e.feature)==null?void 0:S.unitsPlural)})]}),jsx(pb,{variant:"h6",color:"primary",children:h})]})}function ap({plan:e,billingPeriod:t,onBillableFeatureChange:o}){var u;let{billableFeatures:r,setBillableFeature:n}=Pe(),{setIsDisabled:i}=Re(),{setIsValid:a$1}=U(),l=cr(((u=e==null?void 0:e.pricePoints)==null?void 0:u.filter(f=>f.billingPeriod===t))||[]),[s,d]=useState(l==null?void 0:l.reduce((f,m)=>{var h;return f[((h=m.feature)==null?void 0:h.featureId)||"base-charge"]=true,f},{}));return useEffect(()=>{let f=Object.values(s).some(m=>!m);i(f),a$1(!f);},[s,i,a$1]),jsx(Fragment,{children:l==null?void 0:l.map(f=>{var h;let m=r.find(g=>{var y;return g.featureId===((y=f.feature)==null?void 0:y.featureId)});return jsx(ub,{charge:f,setBillableFeature:n,billableFeature:m,onValidationChange:({featureId:g,isValid:y})=>d(C=>b(a({},C),{[g]:y})),onBillableFeatureChange:o},((h=f.feature)==null?void 0:h.featureId)||"base-charge")})})}var sp=e(Te)`
|
|
813
813
|
width: 100%;
|
|
814
|
-
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=
|
|
814
|
+
`;var cp=({onChangePlan:e,onBillableFeatureChange:t})=>{let{checkoutState:o,checkoutLocalization:r}=U(),{plan:n}=o||{},{billingPeriod:i}=Pe();return jsxs(Fragment,{children:[jsx(qd,{allowChangePlan:true,onChangePlan:e}),jsxs(sp,{children:[jsx(rp,{plan:n,checkoutLocalization:r}),jsx(ap,{plan:n,billingPeriod:i,onBillableFeatureChange:t})]})]})};var hb=e=>jsx("svg",b(a({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),{children:jsxs("g",{id:"arrow-right",children:[jsx("path",{id:"Shape",d:"M2.66699 8H13.3337",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"}),jsx("path",{id:"Shape_2",d:"M9.33301 4L13.333 8L9.33301 12",stroke:"#7586B0",strokeWidth:1.33333,strokeLinecap:"round",strokeLinejoin:"round"})]})})),dp=hb;var pp=e(dp)`
|
|
815
815
|
path {
|
|
816
816
|
stroke: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
817
817
|
}
|
|
818
|
-
`;var
|
|
818
|
+
`;var Pb=e(Te)`
|
|
819
819
|
display: flex;
|
|
820
|
-
`,bb=e(
|
|
820
|
+
`,bb=e(SP)`
|
|
821
821
|
margin-bottom: 16px;
|
|
822
|
-
`,Sb=e(
|
|
822
|
+
`,Sb=e(Te)`
|
|
823
823
|
padding: 16px;
|
|
824
824
|
border-radius: 10px;
|
|
825
825
|
width: 100%;
|
|
826
826
|
border: ${({theme:e})=>`1px solid ${e.stigg.palette.outlinedBorder}`};
|
|
827
|
-
`,mp=({headerText:e,planName:t,priceText:o})=>jsxs(Sb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsx(f,{className:"stigg-checkout-downgrade-to-free-text-header",style:{opacity:.8},variant:"caption",color:"disabled",children:e}),jsx(f,{className:"stigg-checkout-downgrade-to-free-plan-name",bold:true,variant:"h3",color:"primary",children:t}),jsx(f,{className:"stigg-checkout-downgrade-to-free-price-text",color:"secondary",children:o})]}),gp=({checkoutLocalization:e,activeSubscription:t,freePlan:o,allowChangePlan:r=false,onChangePlan:n})=>{let i;r&&n&&(i=jsx(
|
|
827
|
+
`,mp=({headerText:e,planName:t,priceText:o})=>jsxs(Sb,{className:"stigg-checkout-downgrade-to-free-container",children:[jsx(f,{className:"stigg-checkout-downgrade-to-free-text-header",style:{opacity:.8},variant:"caption",color:"disabled",children:e}),jsx(f,{className:"stigg-checkout-downgrade-to-free-plan-name",bold:true,variant:"h3",color:"primary",children:t}),jsx(f,{className:"stigg-checkout-downgrade-to-free-price-text",color:"secondary",children:o})]}),gp=({checkoutLocalization:e,activeSubscription:t,freePlan:o,allowChangePlan:r=false,onChangePlan:n})=>{let i;r&&n&&(i=jsx(Br,{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(bb,{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(Pb,{className:"stigg-checkout-downgrade-to-free-plans-container",children:[jsx(mp,{headerText:e.downgradeToFree.paidPlanHeader({plan:t.plan}),planName:e.downgradeToFree.paidPlanName({plan:t.plan}),priceText:e.downgradeToFree.paidPlanPriceText({plan:t.plan,billingPeriod:a})}),jsx(pp,{className:"stigg-checkout-downgrade-to-free-arrow",style:{margin:"auto 16px",minWidth:"16px"}}),jsx(mp,{headerText:e.downgradeToFree.freePlanHeader({plan:o}),planName:e.downgradeToFree.freePlanName({plan:o}),priceText:e.downgradeToFree.freePlanPriceText({plan:o})})]})]})};var Ab=(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(cp,{onChangePlan:o,onBillableFeatureChange:r})};case "ADDONS":return {content:jsx(Dd,{onAddonChange:n})};case "PAYMENT":return {content:jsx(Yd,{onBillingAddressChange:t,collectPhoneNumber:i,collectTaxId:a,onCheckout:l,onCheckoutCompleted:s})};default:return {content:null}}};function Cp({onCheckout:e,onCheckoutCompleted:t,onChangePlan:o,onBillingAddressChange:r,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:a$1,collectTaxId:l,disablePromotionCode:s,disableSuccessAnimation:d,onMockCheckoutPreview:u}){let{stripePromise:f,setupIntentClientSecret:m}=nd(),[{stiggTheme:h,widgetState:g,theme:y,showWatermark:C}]=R(),{currentStep:b$1}=Re(),{isLoadingCheckoutData:P}=g,{checkoutState:S,checkoutLocalization:T}=U(),{plan:I,activeSubscription:A}=S||{},B=!!I&&I.pricingType===PricingType.Free&&!!A&&A.pricingType!==PricingType.Free,{content:k}=Ab(b$1,{onBillingAddressChange:r,onChangePlan:o,onBillableFeatureChange:n,onAddonChange:i,collectPhoneNumber:a$1,collectTaxId:l,onCheckout:e,onCheckoutCompleted:t}),v=jsx(Fragment,{children:B?jsx(gp,{freePlan:I,activeSubscription:A,allowChangePlan:true,checkoutLocalization:T,onChangePlan:o}):jsx(Fragment,{children:k})}),N=useMemo(()=>m?{clientSecret:m}:{mode:"setup",currency:"usd"},[m]);return jsx(Elements,{stripe:f,options:b(a({},N),{appearance:{theme:"stripe",variables:{colorText:h.palette.text.primary,colorPrimaryText:h.palette.text.primary,colorTextPlaceholder:h.palette.text.disabled,fontFamily:h.typography.fontFamily,colorBackground:y==null?void 0:y.paymentInputBackgroundColor,borderRadius:y==null?void 0:y.paymentInputBorderRadius},rules:y!=null&&y.paymentInputBorderColor?{".Input":{borderColor:y==null?void 0:y.paymentInputBorderColor}}:void 0}}),children:jsxs(bc,{className:"stigg-checkout-layout",children:[!B&&jsx(Fc,{}),jsxs(Sc,{children:[jsx(Tc,{children:P?jsx(Da,{}):v}),P?jsx(Id,{showWatermark:C}):jsx(Bd,{disablePromotionCode:s,disableSuccessAnimation:d,onCheckout:e,onCheckoutCompleted:t,isFreeDowngrade:B,onMockCheckoutPreview:u,showWatermark:C})]})]})},m)}var Pp=m=>{var h=m,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:a$1,billingInformation:l,onMockCheckoutState:s,skipCheckoutSteps:d,onBeforeStepChange:u}=h,f=c(h,["textOverrides","theme","resourceId","planId","preferredBillingPeriod","billingCountryCode","billableFeatures","billingInformation","onMockCheckoutState","skipCheckoutSteps","onBeforeStepChange"]);return jsx(Cc,{textOverrides:e,theme:t,resourceId:o,planId:r,preferredBillingPeriod:n,billingCountryCode:i,billableFeatures:a$1,billingInformation:l,onMockCheckoutState:s,skipCheckoutSteps:d,onBeforeStepChange:u,children:jsx(Cp,a({},f))})};function Fb(e){return useMemo(()=>{let t=new URLSearchParams(window.location.search);return t.get(e)},[e,window.location.search])}var Ui=(r=>(r.IN_PROGRESS="IN_PROGRESS",r.SUCCEEDED="SUCCEEDED",r.FAILED="FAILED",r))(Ui||{}),Sp=({onProvisionStart:e,onProvisionSucceeded:t,onProvisionFailed:o}={})=>{let{stigg:r}=u(),[n,i]=useState("IN_PROGRESS"),[a,l]=useState(false),s=Fb("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 Eb(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 Nb(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 Ub(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=z(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}function $b(r){var n=r,{noAccessComponent:e,children:t}=n,o=c(n,["noAccessComponent","children"]);let{hasAccess:i}=B(o);return i?t:jsx(Fragment,{children:e!=null?e:null})}var vt=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 Lt=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,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
855
855
|
outline: 2px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.primary}};
|
|
856
856
|
outline-offset: 2px;
|
|
857
857
|
}
|
|
858
|
-
`;var
|
|
858
|
+
`;var et=(e,t)=>e?k(e,{maximumFractionDigits:t!=null?t:void 0}):0,Fr=(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:""},Er=(e,t)=>t===0?0:Math.min(e/t*100,100);function vr({usagePeriodEnd:e,formatResetPeriod:t,className:o}){let r=jo({usagePeriodEnd:e,formatter:t});return r?jsx(f,{variant:"caption",color:"secondary",className:o,children:r}):null}var Hb=e.div`
|
|
859
859
|
display: flex;
|
|
860
860
|
flex-direction: column;
|
|
861
861
|
gap: 4px;
|
|
862
|
-
`,
|
|
862
|
+
`,Ob=e.div`
|
|
863
863
|
display: flex;
|
|
864
864
|
flex-direction: row;
|
|
865
865
|
gap: 4px;
|
|
866
866
|
align-items: baseline;
|
|
867
|
-
`;function kp({
|
|
867
|
+
`;function kp({entitlement:e,decimalPlaces:t=null,showUnits:o=true}){if(e.isFallback)return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-balance-value-no-balance",children:"No balance data available"});let r=Fr(e,o);return jsxs(Hb,{children:[jsxs(Ob,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-balance-value-amount",children:et(e.remaining,t)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-balance-value-suffix",children:r})]}),jsx(vr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-balance-reset-period"})]})}var Nr=e(dr)`
|
|
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 Wb=e.div`
|
|
874
874
|
display: flex;
|
|
875
875
|
flex-direction: column;
|
|
876
876
|
gap: 8px;
|
|
877
877
|
width: 100%;
|
|
878
|
-
`,
|
|
878
|
+
`,Zb=e.div`
|
|
879
879
|
display: flex;
|
|
880
880
|
flex-direction: column;
|
|
881
881
|
gap: 8px;
|
|
@@ -883,40 +883,40 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
883
883
|
border-radius: 8px;
|
|
884
884
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
885
885
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e==null?void 0:e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
886
|
-
`;function wp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,
|
|
886
|
+
`;function wp({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,onAddCredits:n}){let i=fe(ee),a$1=u({optional:true}),l=a$1==null?void 0:a$1.theme,s=A({currencyId:e}),{title:d,addCredits:u$1}=a(a({},G),t),f$1=jsx(Wb,{className:"stigg-credit-balance-container",children:jsxs(Zb,{className:"stigg-credit-balance-card",children:[jsxs(vt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-balance-title",children:d}),n&&!s.isFallback&&jsxs(Lt,{type:"button",onClick:()=>n(s),className:"stigg-credit-balance-add-credits-button",children:[jsx(Nr,{className:"stigg-credit-balance-add-credits-icon"}),u$1]})]}),jsx(kp,{entitlement:s,decimalPlaces:o,showUnits:r})]})});return i?f$1:jsx(w,{componentTheme:l,children:f$1})}var Kb=lazy(()=>import('./CreditUsageChart-WJZI2Q44.esm.js').then(e=>({default:e.CreditUsageChart})));function Bp(e){return jsx(Suspense,{fallback:null,children:jsx(Kb,a({},e))})}var qb=(e,t,o)=>o==="primary"?t.palette.primary:e>=100?t.palette.progress.high:e>=75?t.palette.progress.medium:t.palette.progress.low,Jb=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
|
+
`,Xb=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})=>qb(t,e.stigg,o)};
|
|
896
896
|
border-radius: 4px;
|
|
897
897
|
transition: width 0.3s ease-in-out;
|
|
898
|
-
`;function Mr({percentage:e,className:t,variant:o="utilization"}){return jsx(
|
|
898
|
+
`;function Mr({percentage:e,className:t,variant:o="utilization"}){return jsx(Jb,{className:t,children:jsx(Xb,{percentage:e,variant:o})})}var jb=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
|
+
`,eS=e.div`
|
|
905
905
|
display: flex;
|
|
906
906
|
flex-direction: row;
|
|
907
907
|
gap: 4px;
|
|
908
908
|
align-items: baseline;
|
|
909
|
-
`,
|
|
909
|
+
`,tS=e.div`
|
|
910
910
|
display: flex;
|
|
911
911
|
flex-direction: row;
|
|
912
912
|
gap: 4px;
|
|
913
913
|
align-items: baseline;
|
|
914
|
-
`,
|
|
914
|
+
`,oS=({currentUsage:e,usageLimit:t})=>{let o=Er(e,t);return jsx(Mr,{percentage:o,className:"stigg-credit-utilization-progress"})};function Fp({entitlement:e,decimalPlaces:t=null,showUnits:o=true,remainingLabel:r=H$1.remaining}){if(e.isFallback)return jsx(f,{variant:"body1",color:"disabled",className:"stigg-credit-utilization-value-no-balance",children:"No balance data available"});let{remaining:n,currentUsage:i,usageLimit:a}=e,l=Fr(e,o);return jsxs(Fragment,{children:[jsxs(jb,{children:[jsxs(eS,{children:[jsx(f,{variant:"h3",color:"primary",bold:true,className:"stigg-credit-utilization-usage",children:et(i,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:et(a,t)}),jsx(f,{variant:"caption",color:"secondary",className:"stigg-credit-utilization-suffix",children:l})]}),jsxs(tS,{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:et(n,t)})]})]}),jsx(oS,{currentUsage:i,usageLimit:a}),jsx(vr,{usagePeriodEnd:e.usagePeriodEnd,className:"stigg-credit-utilization-reset-period"})]})}var nS=e.div`
|
|
915
915
|
display: flex;
|
|
916
916
|
flex-direction: column;
|
|
917
917
|
gap: 8px;
|
|
918
918
|
width: 100%;
|
|
919
|
-
`,
|
|
919
|
+
`,iS=e.div`
|
|
920
920
|
display: flex;
|
|
921
921
|
flex-direction: column;
|
|
922
922
|
gap: 16px;
|
|
@@ -925,7 +925,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
925
925
|
border: 1px solid ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
926
926
|
background-color: ${({theme:e})=>{var t,o;return (o=(t=e==null?void 0:e.stigg)==null?void 0:t.palette)==null?void 0:o.backgroundPaper}};
|
|
927
927
|
min-height: 90px;
|
|
928
|
-
`;function
|
|
928
|
+
`;function Ep({currencyId:e,localization:t,decimalPlaces:o,showUnits:r=true,onAddCredits:n}){let i=fe(ee),a$1=u({optional:true}),l=a$1==null?void 0:a$1.theme,s=A({currencyId:e}),{title:d,remaining:u$1,addCredits:f$1}=a(a({},H$1),t),m=jsx(nS,{className:"stigg-credit-utilization-container",children:jsxs(iS,{className:"stigg-credit-utilization-card",children:[jsxs(vt,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-credit-utilization-title",children:d}),n&&!s.isFallback&&jsxs(Lt,{type:"button",onClick:()=>n(s),className:"stigg-credit-utilization-add-credits-button",children:[jsx(Nr,{className:"stigg-credit-utilization-add-credits-icon"}),f$1]})]}),jsx(Fp,{entitlement:s,decimalPlaces:o,showUnits:r,remainingLabel:u$1})]})});return i?m:jsx(w,{componentTheme:l,children:m})}function Ur(e){let t=u(),o=t==null?void 0:t.stigg,r=t==null?void 0:t.updatedAt,n=useCallback(()=>d(null,null,function*(){if(!o||!o.isCustomerLoaded)return null;try{return o.getCreditGrants({currencyId:e.currencyId,paging:e.paging})}catch(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 $i({skeletonRows:e,visibleHeadCells:t,hideLastRowBorder:o}){return jsx(Fragment,{children:Array.from({length:e}).map((r,n)=>jsx(lS,{children:t.map(i=>jsx(Nt,{$alignment:i.alignment,$width:i.width,$maxWidth:i.maxWidth,$minWidth:i.minWidth,$isLastRow:n===e-1,$hideLastRowBorder:o,children:jsx(Qe,{width:i.width?parseInt(i.width.replace("px",""))-40:100,height:20})},String(i.id)))},n))})}function Gi({data:e,visibleHeadCells:t,onRowClick:o,hideLastRowBorder:r}){return jsx(Fragment,{children:e.map((n,i)=>jsx(zi,{$clickable:!!o,onClick:()=>o&&o(n),children:t.map(a=>jsx(Nt,{$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(Vi,{$alignment:a.alignment,children:a.render(n)})},String(a.id)))},i))})}function $r({errorMessage:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"error",className:t,children:e||"An error occurred"}):jsx(Fragment,{children:e})}function Gr({message:e,className:t}){return e===void 0||typeof e=="string"?jsx(f,{variant:"body1",color:"secondary",className:t,children:e||"No data available"}):jsx(Fragment,{children:e})}var bS=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,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
938
938
|
align-items: center;
|
|
939
939
|
justify-content: center;
|
|
940
940
|
`}
|
|
941
|
-
`,
|
|
941
|
+
`,SS=e(Table)`
|
|
942
942
|
min-width: 600px;
|
|
943
943
|
table-layout: auto;
|
|
944
944
|
width: 100%;
|
|
945
|
-
`,
|
|
945
|
+
`,TS=e(Divider)`
|
|
946
946
|
border-color: ${({theme:e})=>e.stigg.palette.outlinedBorder};
|
|
947
|
-
`,
|
|
947
|
+
`,Nt=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,7 +957,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
957
957
|
${({$minWidth:e})=>e&&`min-width: ${e};`}
|
|
958
958
|
|
|
959
959
|
${({$isLastRow:e,$hideLastRowBorder:t})=>e&&t&&"border-bottom: none;"}
|
|
960
|
-
`,
|
|
960
|
+
`,kS=e(Nt)`
|
|
961
961
|
background-color: transparent;
|
|
962
962
|
`,zi=e(TableRow)`
|
|
963
963
|
${({$clickable:e,theme:t})=>e&&`
|
|
@@ -971,24 +971,24 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
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
|
+
`,wS=e(TablePagination)`
|
|
975
975
|
color: ${({theme:e})=>e.stigg.palette.text.secondary};
|
|
976
|
-
`;function
|
|
976
|
+
`;function AS({visibleHeadCells:e}){return jsx(TableHead,{children:jsx(TableRow,{children:e.map(t=>jsx(kS,{$alignment:t.alignment,$width:t.width,$maxWidth:t.maxWidth,$minWidth:t.minWidth,children:jsx(f,{variant:"caption",children:t.label})},String(t.id)))})})}function zr({data:e,headCells:t,isLoading:o=false,error:r=null,emptyMessage:n,errorMessage:i,onRowClick:a,className:l,skeletonRows:s=3,hideLastRowBorder:d=true,pageSize:u,pageNum:f,totalCount:m,onPageChange:h}){let g=t.filter(C=>C.visible!==false),y=!!r||!o&&e.length===0;return jsx(bS,{className:l,$hasMinHeight:y,children:r?jsx($r,{errorMessage:i,className:`${l}-error`}):!o&&e.length===0?jsx(Gr,{message:n,className:`${l}-empty`}):jsxs(Fragment,{children:[jsxs(SS,{children:[jsx(AS,{visibleHeadCells:g}),jsx(TableBody,{children:o?jsx($i,{skeletonRows:s,visibleHeadCells:g,hideLastRowBorder:d}):jsx(Gi,{data:e,visibleHeadCells:g,onRowClick:a,hideLastRowBorder:d})})]}),!!(e!=null&&e.length)&&h&&jsxs(Fragment,{children:[jsx(TS,{}),jsx(wS,{component:"div",rowsPerPage:u!=null?u:e.length,rowsPerPageOptions:[u!=null?u:e.length],count:m!=null?m:e.length,page:f!=null?f:1,onPageChange:h,labelDisplayedRows:({from:C,to:b,count:P})=>`${ie(C)}-${ie(b)} of ${P!==-1?ie(P):`more than ${ie(b)}`}`})]})]})})}var IS=e(tb)`
|
|
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 no(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(IS,a({label:t,size:r,$variant:e,className:o},n))}function Rp(e){let t=Q(),o=Q(e.effectiveAt),r=e.expireAt?Q(e.expireAt):null;return o.isAfter(t)?"SCHEDULED":r&&r.isBefore(t)?"EXPIRED":"AVAILABLE"}function Up(e,t){return `${et(e.consumedAmount,t)} / ${e.amount}`}var Wi=e=>{switch(e){case "AVAILABLE":return "success";case "SCHEDULED":return "warning";case "EXPIRED":return "error";default:return "neutral"}},_p=e=>{if(e.automaticRechargeConfigurationId)return "Automatic recharge";switch(e.grantType){case CreditGrantType.Promotional:return "Promotional";case CreditGrantType.Paid:return "Top-up";case CreditGrantType.Recurring:return "Recurring";default:return "Unknown"}};function Dp({creditGrants:e,isLoading:t,error:o,localization:r,decimalPlaces:n,pageSize:i,pageNum:a$1,totalCount:l,onPageChange:s}){let d=e.map(f=>b(a({},f),{status:Rp(f)})),u=[{id:"effectiveAt",label:r.receivedAt,width:"205px",render:({effectiveAt:f$1})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-effective-date",children:On(f$1)})},{id:"grantType",label:r.grantType,width:"205px",render:f$1=>jsx(f,{variant:"body1",className:"stigg-credit-grants-grant-type",children:_p(f$1)})},{id:"status",label:r.status,width:"205px",render:({status:f})=>{let m=vS(f),h=Wi(f);return jsx(no,{label:m,variant:h,className:"stigg-credit-grants-status-chip"})}},{id:"amount",label:r.balance,width:"205px",render:f$1=>jsx(f,{variant:"body1",className:"stigg-credit-grants-balance",children:Up(f$1,n)})},{id:"expireAt",label:r.expiryDate,width:"205px",render:({expireAt:f$1})=>jsx(f,{variant:"body1",className:"stigg-credit-grants-expiry-date",children:f$1?Wn(f$1):"-"})}];return jsx(zr,{data:d,headCells:u,isLoading:t,error:o,emptyMessage:r.emptyState,loadingMessage:r.loadingState,errorMessage:r.errorState,className:"stigg-credit-grants-table",skeletonRows:(d==null?void 0:d.length)||3,pageNum:a$1,pageSize:i,totalCount:l,onPageChange:s})}var Gp=(e,t,o)=>{let[r,n]=useState(0),[i,a]=useState(0);return {pageNumber:i,lastVisitedPage:r,pageChangeFunc:(s,d)=>{let u=d>i?{after:e==null?void 0:e.endCursor,first:o}:{before:e==null?void 0:e.startCursor,last:o};t(u),n(i),a(d);}}};var NS=10,MS=e.div`
|
|
984
984
|
display: flex;
|
|
985
985
|
flex-direction: column;
|
|
986
986
|
gap: 8px;
|
|
987
|
-
|
|
987
|
+
`,RS=e.div`
|
|
988
988
|
display: flex;
|
|
989
989
|
flex-direction: column;
|
|
990
990
|
gap: 16px;
|
|
991
|
-
`;function zp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=
|
|
991
|
+
`;function zp({currencyId:e,localization:t,decimalPlaces:o,pageSize:r=NS}){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,d]=useState({first:r}),{creditGrants:u$1,isLoading:f,error:m,paging:h,totalCount:g}=Ur({currencyId:e,pageSize:r,paging:s}),{pageNumber:y,pageChangeFunc:C}=Gp(h,d,r);return jsx(w,{componentTheme:a$1,children:jsxs(MS,{className:"stigg-credit-grants-container",children:[jsx(RS,{className:"stigg-credit-grants-card",children:jsx(Dp,{creditGrants:u$1,isLoading:f,error:m,localization:l,decimalPlaces:o,pageSize:r,pageNum:y,totalCount:g,onPageChange:C})}),jsx(q,{source:"grant_list",align:"end",smallScreenAlign:"end",style:{marginTop:0},showWatermark:i==null?void 0:i.getShowWatermark()})]})})}var Vp=e.div`
|
|
992
992
|
display: flex;
|
|
993
993
|
flex-direction: column;
|
|
994
994
|
gap: 16px;
|
|
@@ -1014,7 +1014,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1014
1014
|
min-height: 60px;
|
|
1015
1015
|
border: 1px dashed ${({theme:e})=>{var t,o;return (o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.outlinedBorder}};
|
|
1016
1016
|
border-radius: 8px;
|
|
1017
|
-
`;function Hr(e){let t=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
|
|
1017
|
+
`;function Hr(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 Wp({customerId:e,currencyId:t}){let{config:o,isLoading:r,error:n}=Hr({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?Er(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 Zp=e(Vp)`
|
|
1018
1018
|
width: 406px;
|
|
1019
1019
|
box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.05);
|
|
1020
1020
|
box-sizing: border-box;
|
|
@@ -1022,18 +1022,18 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1022
1022
|
display: flex;
|
|
1023
1023
|
align-items: center;
|
|
1024
1024
|
justify-content: flex-start;
|
|
1025
|
-
`;function Qp(e,t){return e?Object.entries(t).reduce((o,[r,n])=>{let i=new RegExp(`{{\\s*${r}\\s*}}`,"g"),l=String(n!=null?n:"").replace(/\$/g,"$$$$");return o.replace(i,l)},e):""}function Kp({customerId:e,currencyId:t,currencyUnit:o="Credits",billingCurrency:r="$",onManageClick:n,className:i,localization:
|
|
1025
|
+
`;function Qp(e,t){return e?Object.entries(t).reduce((o,[r,n])=>{let i=new RegExp(`{{\\s*${r}\\s*}}`,"g"),l=String(n!=null?n:"").replace(/\$/g,"$$$$");return o.replace(i,l)},e):""}function Kp({customerId:e,currencyId:t,currencyUnit:o="Credits",billingCurrency:r="$",onManageClick:n,className:i,localization:a$1}){let{thresholdValue:l,targetBalance:s,currentMonthlySpend:d,maxSpendLimit:u,spendPercentage:f$1,showActiveState:m,isLoading:h,error:g}=Wp({customerId:e,currencyId:t}),y=a(a({},K),a$1&&Object.fromEntries(Object.entries(a$1).filter(([P,S])=>S!==void 0))),C=Qp(y.descriptionTemplate,{target:Ut(s),unit:o,threshold:Ut(l)}),b=Qp(y.spendTemplate,{currency:r,current:Ut(d),limit:Ut(u)});return g?jsx(Zp,{className:`stigg-auto-recharge-status stigg-auto-recharge-status-error ${i||""}`,children:jsx(f,{variant:"body1",color:"error",children:g.message||"Failed to load auto-recharge status"})}):jsxs(Zp,{className:`stigg-auto-recharge-status ${i||""}`,children:[jsxs(vt,{children:[jsxs(Hp,{children:[jsx(f,{variant:"h6",color:"primary",className:"stigg-auto-recharge-title",children:y.title}),!h&&m&&jsx(no,{variant:"success",label:y.activeLabel,className:"stigg-auto-recharge-status-chip",size:"small"})]}),h?jsx(Qe,{width:70,height:38,borderRadius:10}):jsx(Lt,{type:"button",onClick:n,className:"stigg-auto-recharge-manage-button","aria-label":`${y.manageButton} auto-recharge settings`,children:y.manageButton})]}),h?jsxs(Zi,{children:[jsx(Qe,{width:"100%",height:20}),jsx(Qe,{width:"100%",height:8,borderRadius:0}),jsx(Yp,{children:jsx(Qe,{width:200,height:16})})]}):m?jsxs(Zi,{children:[jsx(f,{variant:"body1",color:"primary",className:"stigg-auto-recharge-description",children:C}),jsx(Mr,{percentage:f$1,variant:"primary",className:"stigg-auto-recharge-progress"}),jsx(Yp,{children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-spend",children:u>0?b:y.unlimitedSpendLimit})})]}):jsx(Op,{className:"stigg-auto-recharge-empty",children:jsx(f,{variant:"caption",color:"tertiary",className:"stigg-auto-recharge-empty-text",children:y.emptyStateMessage})})]})}var $S=e.div`
|
|
1026
1026
|
display: flex;
|
|
1027
1027
|
flex-direction: column;
|
|
1028
1028
|
gap: 8px;
|
|
1029
1029
|
width: 100%;
|
|
1030
|
-
`;function qp(e){let t=fe(ee),o=u({optional:true}),r=o==null?void 0:o.theme,n=jsx(
|
|
1030
|
+
`;function qp(e){let t=fe(ee),o=u({optional:true}),r=o==null?void 0:o.theme,n=jsx($S,{className:"stigg-auto-recharge-status-container",children:jsx(Kp,a({},e))});return t?n:jsx(w,{componentTheme:r,children:n})}function Jp(e){return dg({},{title:"Auto recharge settings",enableLabel:"Recharge credits automatically when balance is low",enableDescription:"Allow auto-recharge",thresholdFieldPrefix:"When",thresholdFieldSuffix:"balance goes below",thresholdTooltip:"The credit balance threshold that triggers an automatic recharge",thresholdFieldPlaceholder:"Enter threshold amount",thresholdFieldHint:"Current threshold: {{value}}",thresholdRequired:"Threshold amount is required",thresholdMin:"Threshold must be at least 0",thresholdMax:"Threshold must be less than {{max}}",targetFieldPrefix:"Then",targetFieldSuffix:"recharge balance up to",targetBalanceTooltip:"The target credit balance to reach after a recharge",targetFieldPlaceholder:"Enter target balance",targetFieldHint:"Current target: {{value}}",targetRequired:"Target balance is required",targetMin:"Target must be greater than threshold",targetMax:"Target cannot exceed {{max}}",spendLimitFieldPrefix:"Limit",spendLimitFieldSuffix:"total spend",spendLimitFieldPlaceholder:"0.00",spendLimitHelpText:"Limit recharging to spending cap when enabled",spendLimitPeriod:"month",spendLimitPositive:"Spend limit must be greater than 0",spendLimitMin:"Spend limit must be at least {{min}}",spendLimitMax:"Spend limit cannot exceed {{max}}",immediateRechargeWarning:"Recharge will run immediately after saving. Current balance is below threshold {{threshold}} {{currencyUnit}}.",spendLimitTooLowWarning:"Auto-recharge may not run. Current monthly spend (${{currentSpend}} USD) is approaching or exceeds the spend limit (${{spendLimit}} USD).",cancelButton:"Cancel",saveButton:"Save settings",editButton:"Edit",loadingState:"Loading automatic recharge settings...",errorState:"Failed to load automatic recharge settings",emptyState:"No automatic recharge configuration found"},e)}function tt(e,t={},o){var a,l,s,d;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=((d=o.spendLimitMax)==null?void 0:d.replace("{{max}}",String(t.maxSpendLimit)))||`Spend limit cannot exceed ${t.maxSpendLimit}`);}return r}function Wr({initialData:e,poolSize:t,localization:o}){var C,b$1,P,S,T,I,A,B,k,v,N,F,Z,$;let[r,n]=useState({enabled:(C=e==null?void 0:e.enabled)!=null?C:false,thresholdAmount:(P=(b$1=e==null?void 0:e.thresholdAmount)==null?void 0:b$1.toString())!=null?P:"",targetBalance:(T=(S=e==null?void 0:e.targetBalance)==null?void 0:S.toString())!=null?T:"",maxSpendLimit:(A=(I=e==null?void 0:e.maxSpendLimit)==null?void 0:I.toString())!=null?A:""}),[i,a$1]=useState({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),l=tt({enabled:(B=e==null?void 0:e.enabled)!=null?B:false,thresholdAmount:(v=(k=e==null?void 0:e.thresholdAmount)==null?void 0:k.toString())!=null?v:"",targetBalance:(F=(N=e==null?void 0:e.targetBalance)==null?void 0:N.toString())!=null?F:"",maxSpendLimit:($=(Z=e==null?void 0:e.maxSpendLimit)==null?void 0:Z.toString())!=null?$:""},{poolSize:t},o),[s,d]=useState(l);return {formData:r,errors:s,touched:i,handleEnabledChange:_=>{let z=_.target.checked;if(n(q=>b(a({},q),{enabled:z})),!z)d({}),a$1({});else {let q=tt(b(a({},r),{enabled:true}),{poolSize:t},o);d(q),a$1({thresholdAmount:true,targetBalance:true,maxSpendLimit:true});}},handleFieldChange:_=>z=>{let q=z.target.value,Ge=b(a({},r),{[_]:q});n(Ge),a$1(V=>b(a({},V),{[_]:true}));let pt=tt(Ge,{poolSize:t},o);d(pt);},handleFieldBlur:_=>()=>{a$1(q=>b(a({},q),{[_]:true}));let z=tt(r,{poolSize:t},o);d(z);},getFieldError:_=>i[_]?s[_]:void 0,validate:()=>{let _=tt(r,{poolSize:t},o);return d(_),r.enabled&&a$1({thresholdAmount:true,targetBalance:true,maxSpendLimit:true}),Object.keys(_).length===0},getFormValues:()=>{var _,z,q;return {enabled:r.enabled,thresholdAmount:(_=r.thresholdAmount)!=null&&_.trim()?parseFloat(r.thresholdAmount.trim()):void 0,targetBalance:(z=r.targetBalance)!=null&&z.trim()?parseFloat(r.targetBalance.trim()):void 0,maxSpendLimit:(q=r.maxSpendLimit)!=null&&q.trim()?parseFloat(r.maxSpendLimit.trim()):void 0}}}}var ao=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
|
+
`,so=e.div`
|
|
1037
1037
|
display: flex;
|
|
1038
1038
|
flex-direction: column;
|
|
1039
1039
|
gap: 8px;
|
|
@@ -1047,7 +1047,7 @@ import {e,f,i,j,a,g,b,h,c,p,w,u,v,d,x,y,z,A,B,F,G,H as H$1,q,r,k,J,o,l,m,n}from'
|
|
|
1047
1047
|
height: 12px;
|
|
1048
1048
|
color: ${({theme:e})=>{var t,o,r;return (r=(o=(t=e.stigg)==null?void 0:t.palette)==null?void 0:o.text)==null?void 0:r.secondary}};
|
|
1049
1049
|
cursor: help;
|
|
1050
|
-
`,qi=e(
|
|
1050
|
+
`,qi=e(SP)`
|
|
1051
1051
|
font-family: custom-font, 'DM Sans', sans-serif;
|
|
1052
1052
|
align-items: center;
|
|
1053
|
-
`;function Zr({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:
|
|
1053
|
+
`;function Zr({customerId:e,currencyId:t,initialData:o,currencyUnit:r,poolSize:n,currentBalance:i,currentMonthlySpend:a$1,readOnly:l=false,localization:s,onSave:d,onCancel:u$1}){var N,F,Z;let f$1=fe(ee),m=u({optional:true}),h=m==null?void 0:m.theme,g=useMemo(()=>Jp(s),[s]),{formData:y,errors:C,handleEnabledChange:b,handleFieldChange:P,handleFieldBlur:S,getFieldError:T,validate:I,getFormValues:A}=Wr({initialData:o,poolSize:n,localization:g}),B=useMemo(()=>y.enabled?Object.keys(C).length>0:false,[C,y.enabled]),k=useCallback(()=>{if(I()&&d){let $=A();d(a({customerId:e,currencyId:t},$));}},[I,d,A,e,t]),v=jsx(ao,{className:"stigg-automatic-recharge-form-container",children:jsxs(so,{className:"stigg-automatic-recharge-form-card",children:[jsxs(Te,{display:"flex",flexDirection:"column",gap:.5,children:[jsx(f,{variant:"h3",color:"primary",className:"stigg-automatic-recharge-form-title",children:g.title}),jsx(f,{variant:"body1",color:"secondary",className:"stigg-automatic-recharge-form-subtitle",children:g.enableLabel})]}),jsx(Te,{display:"flex",flexDirection:"column",gap:1,children:jsx(Ih,{control:jsx(Bh,{checked:y.enabled,onChange:b,disabled:l}),label:jsx(f,{variant:"body1",color:"primary",children:g.enableDescription}),className:"stigg-automatic-recharge-form-enable-checkbox"})}),jsxs(Te,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-threshold-field",children:[jsxs(Te,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(Te,{component:"span",fontWeight:"bold",children:g.thresholdFieldPrefix})," ",g.thresholdFieldSuffix]}),jsx(Ve,{title:g.thresholdTooltip,children:jsx(Ki,{})})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.thresholdAmount,onValueChange:$=>{let _={target:{value:$.value}};P("thresholdAmount")(_);},onBlur:S("thresholdAmount"),placeholder:g.thresholdFieldPlaceholder,error:!!T("thresholdAmount"),helperText:(N=T("thresholdAmount"))!=null?N:"",disabled:l||!y.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-threshold-input"})]}),jsxs(Te,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-target-field",children:[jsxs(Te,{display:"flex",alignItems:"center",gap:1,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(Te,{component:"span",fontWeight:"bold",children:g.targetFieldPrefix})," ",g.targetFieldSuffix]}),jsx(Ve,{title:g.targetBalanceTooltip,children:jsx(Ki,{})})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.targetBalance,onValueChange:$=>{let _={target:{value:$.value}};P("targetBalance")(_);},onBlur:S("targetBalance"),placeholder:g.targetFieldPlaceholder,error:!!T("targetBalance"),helperText:(F=T("targetBalance"))!=null?F:"",disabled:l||!y.enabled,InputProps:{endAdornment:r?jsx(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:r}):void 0},className:"stigg-automatic-recharge-form-target-input"})]}),jsxs(Te,{display:"flex",flexDirection:"column",gap:1,className:"stigg-automatic-recharge-form-spend-limit-field",children:[jsxs(Te,{display:"flex",flexDirection:"column",gap:.5,children:[jsxs(f,{variant:"body1",color:"primary",children:[jsx(Te,{component:"span",fontWeight:"bold",children:g.spendLimitFieldPrefix})," ",g.spendLimitFieldSuffix]}),jsx(f,{variant:"caption",color:"secondary",style:{fontSize:"12px"},children:g.spendLimitHelpText})]}),jsx(NumericFormat,{customInput:ce,fullWidth:true,thousandSeparator:true,value:y.maxSpendLimit,onValueChange:$=>{let _={target:{value:$.value}};P("maxSpendLimit")(_);},onBlur:S("maxSpendLimit"),placeholder:g.spendLimitFieldPlaceholder,error:!!T("maxSpendLimit"),helperText:(Z=T("maxSpendLimit"))!=null?Z:"",disabled:l||!y.enabled,InputProps:{startAdornment:jsx(f,{variant:"body1",color:"secondary",children:"$"}),endAdornment:jsxs(f,{variant:"body1",color:"secondary",style:{whiteSpace:"nowrap"},children:["/ ",g.spendLimitPeriod]})},className:"stigg-automatic-recharge-form-spend-limit-input"})]}),!l&&y.enabled&&y.thresholdAmount&&jsxs(Fragment,{children:[i!==void 0&&i<=parseFloat(y.thresholdAmount)&&jsx(qi,{severity:"warning",className:"stigg-automatic-recharge-form-warning",children:g.immediateRechargeWarning.replace("{{threshold}}",ie(parseFloat(y.thresholdAmount))||"0").replace("{{currencyUnit}}",r||"")}),y.maxSpendLimit&&y.maxSpendLimit.trim()!==""&&parseFloat(y.maxSpendLimit)>0&&a$1!==void 0&&a$1+0>=parseFloat(y.maxSpendLimit)&&jsx(qi,{severity:"warning",className:"stigg-automatic-recharge-form-spend-limit-warning",children:g.spendLimitTooLowWarning.replace("{{currentSpend}}",jr(a$1)).replace("{{spendLimit}}",jr(parseFloat(y.maxSpendLimit)))})]}),!l&&jsxs(Te,{display:"flex",justifyContent:"flex-end",gap:1,pt:2,className:"stigg-automatic-recharge-form-actions",children:[u$1&&jsx(te,{variant:"outlined",onClick:u$1,className:"stigg-automatic-recharge-form-cancel-button",children:g.cancelButton}),d&&jsx(te,{variant:"contained",onClick:k,disabled:B,className:"stigg-automatic-recharge-form-save-button",children:g.saveButton})]})]})});return f$1?v:jsx(w,{componentTheme:h,children:v})}function em(){let e=u(),t=e==null?void 0:e.stigg,[o,r]=useState(false),[n,i]=useState(null);return {updateConfig:useCallback(l=>d(null,null,function*(){var s,d,u;if(!t||!t.isCustomerLoaded){let f=new Error("Stigg SDK not initialized or customer not loaded");throw i(f),f}r(true),i(null);try{let f={customerId:l.customerId,currencyId:l.currencyId,isEnabled:l.enabled,thresholdValue:(s=l.thresholdAmount)!=null?s:0,thresholdType:ThresholdType.CreditAmount,targetBalance:(d=l.targetBalance)!=null?d:0,maxSpendLimit:(u=l.maxSpendLimit)!=null?u:null},m=yield t.saveAutomaticRechargeConfiguration(f);return yield t.refresh(),r(!1),m}catch(f){let m=f instanceof Error?f:new Error("Failed to save automatic recharge configuration");throw console.error("Error saving automatic recharge configuration:",m),i(m),r(false),m}}),[t]),isLoading:o,error:n}}function rm({customerId:e,currencyId:t,currencyUnit:o,poolSize:r,readOnly:n=false,localization:i,onSave:a,onCancel:l}){var A$1;let s=fe(ee),d$1=u({optional:true}),u$1=d$1==null?void 0:d$1.theme,{config:f$1,isLoading:m,error:h}=Hr({customerId:e,currencyId:t}),g=A({currencyId:t}),{updateConfig:y,isLoading:C,error:b}=em(),P=useCallback(B=>d(null,null,function*(){try{yield y(B),a&&a(B);}catch(k){console.error("Failed to save automatic recharge configuration:",k);}}),[y,a]),S=f$1?{id:"",enabled:f$1.isEnabled,thresholdAmount:f$1.thresholdValue,targetBalance:f$1.targetBalance,maxSpendLimit:(A$1=f$1.maxSpendLimit)!=null?A$1:void 0,currencyId:f$1.currencyId,customerId:f$1.customerId}:void 0;if(m){let B=jsxs("div",{children:[jsx(Qe,{width:300,height:24,style:{marginBottom:"16px"}}),jsx(Qe,{width:400,height:200})]});return s?B:jsx(w,{componentTheme:u$1,children:B})}if(h){let B=jsx(ao,{className:"stigg-automatic-recharge-form-container",children:jsx(so,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:h.message||"Failed to load automatic recharge configuration"})})});return s?B:jsx(w,{componentTheme:u$1,children:B})}if(g.isFallback){let B=jsx(ao,{className:"stigg-automatic-recharge-form-container",children:jsx(so,{className:"stigg-automatic-recharge-form-card",children:jsx(f,{variant:"body1",color:"error",children:"Failed to load credit balance"})})});return s?B:jsx(w,{componentTheme:u$1,children:B})}let T=o||g.currency.unitPlural||g.currency.displayName||"Credits",I=jsxs(Fragment,{children:[b&&jsx(f,{variant:"body1",color:"error",style:{marginBottom:"16px"},children:b.message||"Failed to save automatic recharge configuration"}),jsx(Zr,{customerId:e,currencyId:t,initialData:S,currencyUnit:T,poolSize:r,currentBalance:g.remaining,currentMonthlySpend:f$1==null?void 0:f$1.currentMonthlySpend,readOnly:n||C,localization:i,onSave:P,onCancel:l})]});return s?I:jsx(w,{componentTheme:u$1,children:I})}export{Fo as AddonsList,qp as AutoRechargeStatus,rm as AutomaticRechargeConfig,Zr as AutomaticRechargeConfigForm,Eb as BooleanEntitlementGuard,Pp as Checkout,wp as CreditBalance,zp as CreditGrants,Bp as CreditUsageChart,Ep as CreditUtilization,Zl as CustomerPortal,Io as CustomerPortalProvider,rr as CustomerUsageData,Gr as EmptyState,$b as EnumEntitlementGuard,$r as ErrorState,zr as GenericTable,nr as InvoicesSection,Ub as MeteredEntitlementGuard,Nb as NumericEntitlementGuard,qo as PaymentDetailsSection,xs as Paywall,vo as Promotions,Ui as ProvisionStatus,no as StatusChip,on as SubscribeIntentionType,Wo as SubscriptionsOverview,Wn as formatDateOnly,On as formatDateTime,Oo as isCreditEntitlement,Pt as isFeatureEntitlement,Wi as mapCreditGrantStatusToVariant,Wr as useAutomaticRechargeForm,Ur as useCreditGrants,Sp as useWaitForCheckoutCompleted,tt as validateAutomaticRechargeForm};
|