@schematichq/schematic-components 1.1.4 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1976,6 +1976,83 @@ function getEntitlementCost(entitlement, period = "month") {
1976
1976
  }
1977
1977
  }
1978
1978
 
1979
+ // src/utils/api/credit.ts
1980
+ function getResetCadencePeriod(cadence) {
1981
+ switch (cadence) {
1982
+ case "yearly" /* Year */:
1983
+ return "year";
1984
+ case "monthly" /* Month */:
1985
+ return "month";
1986
+ case "weekly" /* Week */:
1987
+ return "week";
1988
+ case "daily" /* Day */:
1989
+ return "day";
1990
+ }
1991
+ }
1992
+ function groupPlanCreditGrants(creditGrants) {
1993
+ const map = creditGrants.reduce(
1994
+ (acc, grant) => {
1995
+ const key = grant.creditId;
1996
+ acc[key] = {
1997
+ id: grant.creditId,
1998
+ name: grant.creditName,
1999
+ singularName: grant.singularName,
2000
+ pluralName: grant.pluralName,
2001
+ description: grant.creditDescription,
2002
+ icon: grant.creditIcon,
2003
+ grantReason: "plan",
2004
+ quantity: grant.creditAmount,
2005
+ planId: grant.planId,
2006
+ planName: grant.planName,
2007
+ period: getResetCadencePeriod(grant.resetCadence)
2008
+ };
2009
+ return acc;
2010
+ },
2011
+ {}
2012
+ );
2013
+ return Object.values(map);
2014
+ }
2015
+ function groupCreditGrants(creditGrants, options2) {
2016
+ const today = /* @__PURE__ */ new Date();
2017
+ const map = creditGrants.reduce(
2018
+ (acc, grant) => {
2019
+ const isExpired = !!grant.expiresAt && grant.expiresAt <= today;
2020
+ const isZeroedOut = !!grant.zeroedOutDate;
2021
+ if (!isExpired && !isZeroedOut) {
2022
+ const key = options2?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options2?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2023
+ const current = acc[key];
2024
+ acc[key] = {
2025
+ // credit-specific attributes
2026
+ id: grant.billingCreditId,
2027
+ name: grant.creditName,
2028
+ singularName: grant.singularName,
2029
+ pluralName: grant.pluralName,
2030
+ description: grant.creditDescription,
2031
+ icon: grant.creditIcon,
2032
+ grantReason: grant.grantReason,
2033
+ quantity: grant.quantity,
2034
+ // shared attributes
2035
+ companyId: grant.companyId,
2036
+ companyName: grant.companyName,
2037
+ planId: grant.planId,
2038
+ planName: grant.planName,
2039
+ bundleId: grant.billingCreditBundleId,
2040
+ // custom attributes
2041
+ total: {
2042
+ value: (current?.total?.value ?? 0) + grant.quantity,
2043
+ remaining: (current?.total?.remaining ?? 0) + grant.quantityRemaining,
2044
+ used: (current?.total?.used ?? 0) + grant.quantityUsed
2045
+ },
2046
+ grants: [...current?.grants ?? [], grant]
2047
+ };
2048
+ }
2049
+ return acc;
2050
+ },
2051
+ {}
2052
+ );
2053
+ return Object.values(map);
2054
+ }
2055
+
1979
2056
  // src/utils/api/entitlement.ts
1980
2057
  var PeriodName = {
1981
2058
  billing: "billing period",
@@ -2555,6 +2632,11 @@ function shortenPeriod(period) {
2555
2632
  return "yr";
2556
2633
  }
2557
2634
  }
2635
+ function modifyDate(date, days) {
2636
+ const copy3 = new Date(date);
2637
+ copy3.setDate(copy3.getDate() + days);
2638
+ return copy3;
2639
+ }
2558
2640
 
2559
2641
  // src/utils/error.ts
2560
2642
  function isError(value) {
@@ -4011,22 +4093,10 @@ function useAvailablePlans(activePeriod) {
4011
4093
  }, [data?.activePlans, data?.activeAddOns]);
4012
4094
  const getActivePlans = useCallback(
4013
4095
  (plans) => {
4014
- const customPlanExist = plans.some((plan) => plan.custom);
4015
- const plansWithSelected = settings.mode === "edit" ? plans.slice() : plans.filter(
4096
+ const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter(
4016
4097
  (plan) => activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime
4017
4098
  );
4018
- if (!customPlanExist) {
4019
- plansWithSelected?.sort((a2, b2) => {
4020
- if (activePeriod === "year") {
4021
- return (a2.yearlyPrice?.price ?? 0) - (b2.yearlyPrice?.price ?? 0);
4022
- }
4023
- if (activePeriod === "month") {
4024
- return (a2.monthlyPrice?.price ?? 0) - (b2.monthlyPrice?.price ?? 0);
4025
- }
4026
- return 0;
4027
- });
4028
- }
4029
- return plansWithSelected?.map((plan) => ({ ...plan, isSelected: false }));
4099
+ return activePlans.map((plan) => ({ ...plan, isSelected: false }));
4030
4100
  },
4031
4101
  [activePeriod, settings.mode]
4032
4102
  );
@@ -4036,12 +4106,7 @@ function useAvailablePlans(activePeriod) {
4036
4106
  addOns: getActivePlans(data?.activeAddOns || []),
4037
4107
  periods: getAvailablePeriods()
4038
4108
  };
4039
- }, [
4040
- data?.activePlans,
4041
- data?.activeAddOns,
4042
- getAvailablePeriods,
4043
- getActivePlans
4044
- ]);
4109
+ }, [data, getAvailablePeriods, getActivePlans]);
4045
4110
  }
4046
4111
 
4047
4112
  // src/hooks/useEmbed.ts
@@ -6625,12 +6690,13 @@ var en_default = {
6625
6690
  "Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
6626
6691
  "Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
6627
6692
  "Error updating payment method. Please try again.": "Error updating payment method. Please try again.",
6628
- "Estimated bill.": "Estimated bill.",
6693
+ "Estimated bill": "Estimated bill",
6629
6694
  "Everything in": "Everything in {{plan}}, plus",
6630
6695
  Expired: "Expired",
6631
6696
  "Expires in X months": "Expires in {{months}} mo",
6632
6697
  Expires: "Expires {{date}}",
6633
6698
  "Hide all": "Hide all",
6699
+ "Hide balance details": "Hide balance details",
6634
6700
  "Hide details": "Hide details",
6635
6701
  "Invalid access token; your temporary access token will start with `token_`.": "Invalid access token; your temporary access token will start with `token_`.",
6636
6702
  "Invalid discount code.": "Invalid discount code.",
@@ -6667,6 +6733,7 @@ var en_default = {
6667
6733
  "Save with yearly billing": "Save up to {{percent}}% with yearly billing",
6668
6734
  "Saving with yearly billing": "You are saving {{percent}}% with yearly billing",
6669
6735
  "See all": "See all",
6736
+ "See balance details": "See balance details",
6670
6737
  "See less": "See less",
6671
6738
  "See more": "See more",
6672
6739
  "Select add-ons": "Select add-ons",
@@ -6709,6 +6776,9 @@ var en_default = {
6709
6776
  "Use existing payment method": "Use existing payment method",
6710
6777
  "X additional": "{{amount}} additional",
6711
6778
  "X included": "{{amount}} included",
6779
+ "X item bundle": "{{amount}} {{item}} bundle purchased {{createdAt}}",
6780
+ "X item grant": "{{amount}} promotional {{item}} granted {{createdAt}}",
6781
+ "X items included in plan": "{{amount}} {{item}} included in plan",
6712
6782
  "X off": "{{amount}} off",
6713
6783
  "X% off": "{{percent}}% off",
6714
6784
  "Yearly total": "Yearly total",
@@ -6720,7 +6790,9 @@ var en_default = {
6720
6790
  "one time": "one time",
6721
6791
  per: "per",
6722
6792
  then: "then",
6793
+ use: "use",
6723
6794
  used: "used",
6795
+ purchased: "purchased {{date}}",
6724
6796
  usage: {
6725
6797
  limited: "{{amount}} of {{allocation}} used",
6726
6798
  unlimited: "{{amount}} used"
@@ -10171,7 +10243,7 @@ var EmbedProvider = ({
10171
10243
  });
10172
10244
  const customHeaders = useMemo3(
10173
10245
  () => ({
10174
- "X-Schematic-Components-Version": "1.1.4",
10246
+ "X-Schematic-Components-Version": "1.2.0",
10175
10247
  "X-Schematic-Session-ID": sessionIdRef.current
10176
10248
  }),
10177
10249
  []
@@ -10664,7 +10736,14 @@ var Box = dt.div((props) => {
10664
10736
  return styles;
10665
10737
  });
10666
10738
  var TransitionBox = dt(Box)`
10667
- height: auto;
10739
+ ${({ $isExpanded = true }) => {
10740
+ return $isExpanded ? lt`
10741
+ height: auto;
10742
+ ` : lt`
10743
+ height: 0;
10744
+ overflow: hidden;
10745
+ `;
10746
+ }}
10668
10747
  opacity: 1;
10669
10748
  transition:
10670
10749
  height 0.1s ease-in,
@@ -10685,6 +10764,7 @@ var Icon2 = dt(Icon).attrs(({ name, title, onClick }) => ({
10685
10764
  justify-content: center;
10686
10765
  align-items: center;
10687
10766
  flex-shrink: 0;
10767
+ transition: 0.1s;
10688
10768
 
10689
10769
  ${({ onClick }) => onClick && lt`
10690
10770
  &:hover {
@@ -11845,11 +11925,7 @@ var EntitlementRow = (entitlement) => {
11845
11925
  // src/components/shared/sidebar/Proration.tsx
11846
11926
  import { useState as useState6 } from "react";
11847
11927
  import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
11848
- var Proration = ({
11849
- currency,
11850
- charges,
11851
- selectedPlan
11852
- }) => {
11928
+ var Proration = ({ currency, charges }) => {
11853
11929
  const { t: t2 } = useTranslation();
11854
11930
  const [open, setOpen] = useState6(false);
11855
11931
  const toggle = (e2) => {
@@ -11858,7 +11934,7 @@ var Proration = ({
11858
11934
  setOpen((open2) => !open2);
11859
11935
  };
11860
11936
  return /* @__PURE__ */ jsxs7(Fragment4, { children: [
11861
- /* @__PURE__ */ jsx11(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx11(Text, { $size: 14, children: charges.proration > 0 ? t2("Proration") : isHydratedPlan(selectedPlan) && !selectedPlan?.companyCanTrial && t2("Credits") }) }),
11937
+ /* @__PURE__ */ jsx11(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx11(Text, { $size: 14, children: t2("Proration") }) }),
11862
11938
  /* @__PURE__ */ jsxs7(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
11863
11939
  open && charges?.upcomingInvoiceLineItems.map(
11864
11940
  ({ amount, description }, index) => {
@@ -11899,6 +11975,7 @@ var StageButton = ({
11899
11975
  checkoutStages,
11900
11976
  hasAddOns,
11901
11977
  hasPayInAdvanceEntitlements,
11978
+ hasCreditBundles,
11902
11979
  hasPaymentMethod,
11903
11980
  hasPlan,
11904
11981
  inEditMode,
@@ -11956,7 +12033,7 @@ var StageButton = ({
11956
12033
  );
11957
12034
  }
11958
12035
  if (!isPaymentMethodRequired && !checkoutStages?.some(
11959
- (stage) => stage.id === "usage" || stage.id === "addons"
12036
+ (stage) => stage.id === "usage" || stage.id === "addons" || stage.id === "credits"
11960
12037
  )) {
11961
12038
  return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
11962
12039
  }
@@ -11967,7 +12044,7 @@ var StageButton = ({
11967
12044
  disabled: isDisabled,
11968
12045
  onClick: async () => {
11969
12046
  setCheckoutStage?.(
11970
- hasPayInAdvanceEntitlements ? "usage" : hasAddOns ? "addons" : "checkout"
12047
+ hasPayInAdvanceEntitlements ? "usage" : hasAddOns ? "addons" : hasCreditBundles ? "credits" : "checkout"
11971
12048
  );
11972
12049
  },
11973
12050
  $isLoading: isLoading,
@@ -11976,14 +12053,16 @@ var StageButton = ({
11976
12053
  t2("Next"),
11977
12054
  ":",
11978
12055
  " ",
11979
- hasPayInAdvanceEntitlements ? t2("Usage") : hasAddOns ? t2("Addons") : t2("Checkout"),
12056
+ hasPayInAdvanceEntitlements ? t2("Usage") : hasAddOns ? t2("Addons") : hasCreditBundles ? t2("Credits") : t2("Checkout"),
11980
12057
  /* @__PURE__ */ jsx12(Icon3, { name: "arrow-right" })
11981
12058
  ] })
11982
12059
  }
11983
12060
  );
11984
12061
  }
11985
12062
  if (checkoutStage === "usage") {
11986
- if (!isPaymentMethodRequired && !checkoutStages?.some((stage) => stage.id === "addons")) {
12063
+ if (!isPaymentMethodRequired && !checkoutStages?.some(
12064
+ (stage) => stage.id === "addons" || stage.id === "credits"
12065
+ )) {
11987
12066
  return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
11988
12067
  }
11989
12068
  return /* @__PURE__ */ jsx12(
@@ -11992,7 +12071,9 @@ var StageButton = ({
11992
12071
  type: "button",
11993
12072
  disabled: isDisabled,
11994
12073
  onClick: async () => {
11995
- setCheckoutStage?.(hasAddOns ? "addons" : "checkout");
12074
+ setCheckoutStage?.(
12075
+ hasAddOns ? "addons" : hasCreditBundles ? "credits" : "checkout"
12076
+ );
11996
12077
  },
11997
12078
  $isLoading: isLoading,
11998
12079
  $fullWidth: true,
@@ -12005,8 +12086,9 @@ var StageButton = ({
12005
12086
  $padding: "0 1rem",
12006
12087
  children: [
12007
12088
  t2("Next"),
12008
- ": ",
12009
- hasAddOns ? t2("Addons") : t2("Checkout"),
12089
+ ":",
12090
+ " ",
12091
+ hasAddOns ? t2("Addons") : hasCreditBundles ? t2("Credits") : t2("Checkout"),
12010
12092
  /* @__PURE__ */ jsx12(Icon3, { name: "arrow-right" })
12011
12093
  ]
12012
12094
  }
@@ -12015,6 +12097,38 @@ var StageButton = ({
12015
12097
  );
12016
12098
  }
12017
12099
  if (checkoutStage === "addons") {
12100
+ if (!isPaymentMethodRequired && !checkoutStages?.some((stage) => stage.id === "credits")) {
12101
+ return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
12102
+ }
12103
+ return /* @__PURE__ */ jsx12(
12104
+ Button,
12105
+ {
12106
+ type: "button",
12107
+ disabled: isDisabled,
12108
+ onClick: async () => {
12109
+ setCheckoutStage?.(hasCreditBundles ? "credits" : "checkout");
12110
+ },
12111
+ $isLoading: isLoading,
12112
+ $fullWidth: true,
12113
+ children: /* @__PURE__ */ jsxs8(
12114
+ Flex,
12115
+ {
12116
+ $gap: "0.5rem",
12117
+ $justifyContent: "center",
12118
+ $alignItems: "center",
12119
+ $padding: "0 1rem",
12120
+ children: [
12121
+ t2("Next"),
12122
+ ": ",
12123
+ hasCreditBundles ? t2("Credits") : t2("Checkout"),
12124
+ /* @__PURE__ */ jsx12(Icon3, { name: "arrow-right" })
12125
+ ]
12126
+ }
12127
+ )
12128
+ }
12129
+ );
12130
+ }
12131
+ if (checkoutStage === "credits") {
12018
12132
  if (!isPaymentMethodRequired) {
12019
12133
  return /* @__PURE__ */ jsx12(NoPaymentRequired, {});
12020
12134
  }
@@ -12070,6 +12184,7 @@ var Sidebar = ({
12070
12184
  planPeriod,
12071
12185
  selectedPlan,
12072
12186
  addOns,
12187
+ creditBundles = [],
12073
12188
  usageBasedEntitlements,
12074
12189
  charges,
12075
12190
  checkoutRef,
@@ -12187,6 +12302,65 @@ var Sidebar = ({
12187
12302
  proration: charges?.proration ?? 0
12188
12303
  };
12189
12304
  }, [charges]);
12305
+ const updatedUsageBasedEntitlements = useMemo7(() => {
12306
+ const changedUsageBasedEntitlements = [];
12307
+ const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
12308
+ (acc, selected) => {
12309
+ const changed = currentUsageBasedEntitlements.find(
12310
+ (current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
12311
+ );
12312
+ if (changed) {
12313
+ changedUsageBasedEntitlements.push({
12314
+ previous: changed,
12315
+ next: selected
12316
+ });
12317
+ } else {
12318
+ acc.push(selected);
12319
+ }
12320
+ return acc;
12321
+ },
12322
+ []
12323
+ ) : [];
12324
+ const removedUsageBasedEntitlements = selectedPlan ? currentUsageBasedEntitlements.reduce(
12325
+ (acc, current) => {
12326
+ const match2 = usageBasedEntitlements.every(
12327
+ (entitlement) => entitlement.id !== current.entitlementId
12328
+ ) && currentEntitlements.find(
12329
+ (usage) => usage.entitlementId === current.entitlementId
12330
+ );
12331
+ if (match2) {
12332
+ acc.push({
12333
+ ...match2,
12334
+ allocation: current.allocation,
12335
+ usage: current.usage,
12336
+ quantity: current.quantity
12337
+ });
12338
+ }
12339
+ return acc;
12340
+ },
12341
+ []
12342
+ ) : [];
12343
+ const willUsageBasedEntitlementsChange = changedUsageBasedEntitlements.length > 0 || addedUsageBasedEntitlements.length > 0 || removedUsageBasedEntitlements.length > 0;
12344
+ return {
12345
+ changed: changedUsageBasedEntitlements,
12346
+ added: addedUsageBasedEntitlements,
12347
+ removed: removedUsageBasedEntitlements,
12348
+ willChange: willUsageBasedEntitlementsChange
12349
+ };
12350
+ }, [
12351
+ selectedPlan,
12352
+ currentEntitlements,
12353
+ currentUsageBasedEntitlements,
12354
+ usageBasedEntitlements
12355
+ ]);
12356
+ const selectedAddOns = useMemo7(
12357
+ () => addOns.filter((addOn) => addOn.isSelected),
12358
+ [addOns]
12359
+ );
12360
+ const addedCreditBundles = useMemo7(
12361
+ () => creditBundles.filter((bundle) => bundle.count > 0),
12362
+ [creditBundles]
12363
+ );
12190
12364
  const handleCheckout = useCallback8(async () => {
12191
12365
  const planId = selectedPlan?.id;
12192
12366
  const priceId = (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
@@ -12224,7 +12398,18 @@ var Sidebar = ({
12224
12398
  },
12225
12399
  []
12226
12400
  ),
12227
- creditBundles: [],
12401
+ creditBundles: creditBundles.reduce(
12402
+ (acc, { id, count }) => {
12403
+ if (count > 0) {
12404
+ acc.push({
12405
+ bundleId: id,
12406
+ quantity: count
12407
+ });
12408
+ }
12409
+ return acc;
12410
+ },
12411
+ []
12412
+ ),
12228
12413
  skipTrial: !willTrialWithoutPaymentMethod,
12229
12414
  ...paymentMethodId && { paymentMethodId },
12230
12415
  ...promoCode && { promoCode }
@@ -12245,6 +12430,7 @@ var Sidebar = ({
12245
12430
  planPeriod,
12246
12431
  selectedPlan,
12247
12432
  addOns,
12433
+ creditBundles,
12248
12434
  setError,
12249
12435
  setIsLoading,
12250
12436
  setLayout,
@@ -12265,68 +12451,21 @@ var Sidebar = ({
12265
12451
  setError(t2("Unsubscribe failed"));
12266
12452
  }
12267
12453
  }, [t2, unsubscribe, setError, setIsLoading, setLayout]);
12268
- const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
12269
- const updatedUsageBasedEntitlements = useMemo7(() => {
12270
- const changedUsageBasedEntitlements = [];
12271
- const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
12272
- (acc, selected) => {
12273
- const changed = currentUsageBasedEntitlements.find(
12274
- (current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
12275
- );
12276
- if (changed) {
12277
- changedUsageBasedEntitlements.push({
12278
- previous: changed,
12279
- next: selected
12280
- });
12281
- } else {
12282
- acc.push(selected);
12283
- }
12284
- return acc;
12285
- },
12286
- []
12287
- ) : [];
12288
- const removedUsageBasedEntitlements = selectedPlan ? currentUsageBasedEntitlements.reduce(
12289
- (acc, current) => {
12290
- const match2 = usageBasedEntitlements.every(
12291
- (entitlement) => entitlement.id !== current.entitlementId
12292
- ) && currentEntitlements.find(
12293
- (usage) => usage.entitlementId === current.entitlementId
12294
- );
12295
- if (match2) {
12296
- acc.push({
12297
- ...match2,
12298
- allocation: current.allocation,
12299
- usage: current.usage,
12300
- quantity: current.quantity
12301
- });
12302
- }
12303
- return acc;
12304
- },
12305
- []
12306
- ) : [];
12307
- const willUsageBasedEntitlementsChange = changedUsageBasedEntitlements.length > 0 || addedUsageBasedEntitlements.length > 0 || removedUsageBasedEntitlements.length > 0;
12454
+ const willPlanChange = isHydratedPlan(selectedPlan) && !selectedPlan.current;
12455
+ const { removedAddOns, willAddOnsChange } = useMemo7(() => {
12456
+ const addedAddOns = selectedAddOns.filter(
12457
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
12458
+ );
12459
+ const removedAddOns2 = currentAddOns.filter(
12460
+ (current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
12461
+ );
12462
+ const willAddOnsChange2 = removedAddOns2.length > 0 || addedAddOns.length > 0;
12308
12463
  return {
12309
- changed: changedUsageBasedEntitlements,
12310
- added: addedUsageBasedEntitlements,
12311
- removed: removedUsageBasedEntitlements,
12312
- willChange: willUsageBasedEntitlementsChange
12464
+ addedAddOns,
12465
+ removedAddOns: removedAddOns2,
12466
+ willAddOnsChange: willAddOnsChange2
12313
12467
  };
12314
- }, [
12315
- selectedPlan,
12316
- currentEntitlements,
12317
- currentUsageBasedEntitlements,
12318
- usageBasedEntitlements
12319
- ]);
12320
- const willPlanChange = isHydratedPlan(selectedPlan) && !selectedPlan.current;
12321
- const removedAddOns = currentAddOns.filter(
12322
- (current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
12323
- );
12324
- const addedAddOns = selectedAddOns.filter(
12325
- (selected) => !currentAddOns.some((current) => selected.id === current.id)
12326
- );
12327
- const willAddOnsChange = removedAddOns.length > 0 || addedAddOns.length > 0;
12328
- const inEditMode = settings.mode === "edit";
12329
- const hasPaymentMethod = typeof paymentMethod !== "undefined" || typeof paymentMethodId === "string";
12468
+ }, [currentAddOns, selectedAddOns]);
12330
12469
  const isSelectedPlanTrialable = isHydratedPlan(selectedPlan) && selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
12331
12470
  const now = /* @__PURE__ */ new Date();
12332
12471
  const trialEndsOn = new Date(now);
@@ -12611,6 +12750,48 @@ var Sidebar = ({
12611
12750
  );
12612
12751
  })
12613
12752
  ] }),
12753
+ addedCreditBundles.length > 0 && /* @__PURE__ */ jsxs9(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
12754
+ /* @__PURE__ */ jsx13(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx13(Text, { $size: 14, children: t2("Credits") }) }),
12755
+ addedCreditBundles.reduce(
12756
+ (acc, bundle, index) => {
12757
+ const price = typeof bundle.price?.priceDecimal === "string" ? Number(bundle.price.priceDecimal) : typeof bundle.price?.price === "number" ? bundle.price.price : void 0;
12758
+ const amount = (bundle.quantity ?? 0) * bundle.count;
12759
+ if (price)
12760
+ acc.push(
12761
+ /* @__PURE__ */ jsxs9(
12762
+ Flex,
12763
+ {
12764
+ $justifyContent: "space-between",
12765
+ $alignItems: "center",
12766
+ $gap: "1rem",
12767
+ children: [
12768
+ /* @__PURE__ */ jsxs9(Box, { children: [
12769
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsxs9(Text, { display: "heading4", children: [
12770
+ bundle.name,
12771
+ " (",
12772
+ bundle.count,
12773
+ ")"
12774
+ ] }) }),
12775
+ /* @__PURE__ */ jsx13(Box, { children: /* @__PURE__ */ jsxs9(Text, { children: [
12776
+ amount,
12777
+ " ",
12778
+ getFeatureName(bundle, amount)
12779
+ ] }) })
12780
+ ] }),
12781
+ bundle.count > 0 && /* @__PURE__ */ jsx13(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx13(Text, { children: formatCurrency(
12782
+ price * bundle.count,
12783
+ bundle.price?.currency
12784
+ ) }) })
12785
+ ]
12786
+ },
12787
+ index
12788
+ )
12789
+ );
12790
+ return acc;
12791
+ },
12792
+ []
12793
+ )
12794
+ ] }),
12614
12795
  proration !== 0 && charges && selectedPlanCurrency && /* @__PURE__ */ jsx13(
12615
12796
  Proration,
12616
12797
  {
@@ -12759,9 +12940,10 @@ var Sidebar = ({
12759
12940
  checkoutStages,
12760
12941
  hasAddOns: addOns.length > 0,
12761
12942
  hasPayInAdvanceEntitlements: payInAdvanceEntitlements.length > 0,
12762
- hasPaymentMethod,
12943
+ hasCreditBundles: creditBundles.length > 0,
12944
+ hasPaymentMethod: typeof paymentMethod !== "undefined" || typeof paymentMethodId === "string",
12763
12945
  hasPlan: typeof selectedPlan !== "undefined",
12764
- inEditMode,
12946
+ inEditMode: settings.mode === "edit",
12765
12947
  isLoading,
12766
12948
  isPaymentMethodRequired,
12767
12949
  isSelectedPlanTrialable,
@@ -12800,7 +12982,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12800
12982
  const { settings } = useEmbed();
12801
12983
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
12802
12984
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
12803
- return /* @__PURE__ */ jsx14(Fragment5, { children: /* @__PURE__ */ jsx14(
12985
+ return /* @__PURE__ */ jsx14(
12804
12986
  Box,
12805
12987
  {
12806
12988
  $display: "grid",
@@ -12897,7 +13079,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12897
13079
  );
12898
13080
  })
12899
13081
  }
12900
- ) });
13082
+ );
12901
13083
  };
12902
13084
 
12903
13085
  // src/components/shared/checkout-dialog/Checkout.tsx
@@ -12964,8 +13146,75 @@ var Checkout = ({
12964
13146
  ] });
12965
13147
  };
12966
13148
 
13149
+ // src/components/shared/checkout-dialog/Credits.tsx
13150
+ import { jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
13151
+ var Credits = ({ bundles, updateCount }) => {
13152
+ const { settings } = useEmbed();
13153
+ const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13154
+ return /* @__PURE__ */ jsx16(
13155
+ Box,
13156
+ {
13157
+ $display: "grid",
13158
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
13159
+ $gap: "1rem",
13160
+ children: bundles.map((bundle, index) => {
13161
+ const billingPrice = bundle.price;
13162
+ const price = typeof billingPrice?.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : typeof billingPrice?.price === "number" ? billingPrice.price : void 0;
13163
+ return /* @__PURE__ */ jsxs12(
13164
+ Flex,
13165
+ {
13166
+ $position: "relative",
13167
+ $flexDirection: "column",
13168
+ $gap: "2rem",
13169
+ $padding: `${cardPadding}rem`,
13170
+ $backgroundColor: settings.theme.card.background,
13171
+ $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13172
+ ...settings.theme.card.hasShadow && {
13173
+ $boxShadow: cardBoxShadow
13174
+ },
13175
+ children: [
13176
+ /* @__PURE__ */ jsxs12(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
13177
+ /* @__PURE__ */ jsxs12(Box, { children: [
13178
+ /* @__PURE__ */ jsx16(Box, { children: /* @__PURE__ */ jsx16(Text, { display: "heading3", children: bundle.name }) }),
13179
+ /* @__PURE__ */ jsx16(Box, { children: /* @__PURE__ */ jsxs12(Text, { display: "heading6", children: [
13180
+ bundle.quantity ?? 0,
13181
+ " ",
13182
+ getFeatureName(bundle)
13183
+ ] }) })
13184
+ ] }),
13185
+ typeof price === "number" && /* @__PURE__ */ jsx16(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx16(Text, { children: formatCurrency(price, bundle.price?.currency) }) })
13186
+ ] }),
13187
+ /* @__PURE__ */ jsx16(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: /* @__PURE__ */ jsx16(
13188
+ Input,
13189
+ {
13190
+ $size: "lg",
13191
+ type: "number",
13192
+ value: bundle.count,
13193
+ min: 0,
13194
+ autoFocus: true,
13195
+ onFocus: (event) => {
13196
+ event.target.select();
13197
+ },
13198
+ onChange: (event) => {
13199
+ event.preventDefault();
13200
+ const value = parseInt(event.target.value);
13201
+ if (!isNaN(value)) {
13202
+ updateCount(bundle.id, value);
13203
+ }
13204
+ }
13205
+ }
13206
+ ) })
13207
+ ]
13208
+ },
13209
+ index
13210
+ );
13211
+ })
13212
+ }
13213
+ );
13214
+ };
13215
+
12967
13216
  // src/components/shared/checkout-dialog/Navigation.tsx
12968
- import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs12 } from "react/jsx-runtime";
13217
+ import { Fragment as Fragment7, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
12969
13218
  var Navigation = ({
12970
13219
  name,
12971
13220
  index,
@@ -12975,9 +13224,9 @@ var Navigation = ({
12975
13224
  }) => {
12976
13225
  const { settings } = useEmbed();
12977
13226
  const isLightBackground = useIsLightBackground();
12978
- return /* @__PURE__ */ jsxs12(Fragment7, { children: [
12979
- /* @__PURE__ */ jsxs12(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
12980
- /* @__PURE__ */ jsx16(
13227
+ return /* @__PURE__ */ jsxs13(Fragment7, { children: [
13228
+ /* @__PURE__ */ jsxs13(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
13229
+ /* @__PURE__ */ jsx17(
12981
13230
  Box,
12982
13231
  {
12983
13232
  $display: "none",
@@ -12986,7 +13235,7 @@ var Navigation = ({
12986
13235
  $display: "block"
12987
13236
  }
12988
13237
  },
12989
- children: index >= activeIndex ? /* @__PURE__ */ jsx16(
13238
+ children: index >= activeIndex ? /* @__PURE__ */ jsx17(
12990
13239
  Box,
12991
13240
  {
12992
13241
  $width: `${20 / TEXT_BASE_SIZE}rem`,
@@ -12996,7 +13245,7 @@ var Navigation = ({
12996
13245
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
12997
13246
  $borderRadius: "9999px"
12998
13247
  }
12999
- ) : /* @__PURE__ */ jsx16(
13248
+ ) : /* @__PURE__ */ jsx17(
13000
13249
  Icon3,
13001
13250
  {
13002
13251
  name: "check",
@@ -13012,7 +13261,7 @@ var Navigation = ({
13012
13261
  )
13013
13262
  }
13014
13263
  ),
13015
- /* @__PURE__ */ jsxs12(
13264
+ /* @__PURE__ */ jsxs13(
13016
13265
  Box,
13017
13266
  {
13018
13267
  $whiteSpace: "nowrap",
@@ -13035,7 +13284,7 @@ var Navigation = ({
13035
13284
  }
13036
13285
  )
13037
13286
  ] }),
13038
- !isLast && /* @__PURE__ */ jsx16(
13287
+ !isLast && /* @__PURE__ */ jsx17(
13039
13288
  Icon3,
13040
13289
  {
13041
13290
  name: "chevron-right",
@@ -13050,7 +13299,7 @@ var Navigation = ({
13050
13299
 
13051
13300
  // src/components/shared/checkout-dialog/Plan.tsx
13052
13301
  import { useEffect as useEffect4, useMemo as useMemo8, useState as useState8 } from "react";
13053
- import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
13302
+ import { Fragment as Fragment8, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
13054
13303
  var Selected = ({ isCurrent = false, isTrial = false }) => {
13055
13304
  const { t: t2 } = useTranslation();
13056
13305
  const { settings } = useEmbed();
@@ -13060,7 +13309,7 @@ var Selected = ({ isCurrent = false, isTrial = false }) => {
13060
13309
  }
13061
13310
  return isTrial ? t2("Trial selected") : t2("Plan selected");
13062
13311
  }, [t2, isCurrent, isTrial]);
13063
- return /* @__PURE__ */ jsxs13(
13312
+ return /* @__PURE__ */ jsxs14(
13064
13313
  Flex,
13065
13314
  {
13066
13315
  $justifyContent: "center",
@@ -13068,8 +13317,8 @@ var Selected = ({ isCurrent = false, isTrial = false }) => {
13068
13317
  $gap: "0.25rem",
13069
13318
  $padding: "0.625rem 0",
13070
13319
  children: [
13071
- /* @__PURE__ */ jsx17(Icon3, { name: "check-rounded", color: settings.theme.primary }),
13072
- /* @__PURE__ */ jsx17(
13320
+ /* @__PURE__ */ jsx18(Icon3, { name: "check-rounded", color: settings.theme.primary }),
13321
+ /* @__PURE__ */ jsx18(
13073
13322
  Text,
13074
13323
  {
13075
13324
  $size: 0.9375 * settings.theme.typography.text.fontSize,
@@ -13105,8 +13354,8 @@ var PlanButtonGroup = ({
13105
13354
  };
13106
13355
  }, [data, plan]);
13107
13356
  if (isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable) {
13108
- return /* @__PURE__ */ jsxs13(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
13109
- !isTrialing && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && shouldTrial ? /* @__PURE__ */ jsx17(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ jsx17(
13357
+ return /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
13358
+ !isTrialing && /* @__PURE__ */ jsx18(Fragment8, { children: isSelected && shouldTrial ? /* @__PURE__ */ jsx18(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ jsx18(
13110
13359
  Button,
13111
13360
  {
13112
13361
  type: "button",
@@ -13128,16 +13377,16 @@ var PlanButtonGroup = ({
13128
13377
  $color: "primary",
13129
13378
  $variant: "filled",
13130
13379
  $fullWidth: true,
13131
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx17(
13380
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx18(
13132
13381
  Tooltip,
13133
13382
  {
13134
- trigger: /* @__PURE__ */ jsx17(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13135
- content: /* @__PURE__ */ jsx17(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13383
+ trigger: /* @__PURE__ */ jsx18(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13384
+ content: /* @__PURE__ */ jsx18(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13136
13385
  }
13137
13386
  ) : t2("Start X day trial", { days: plan.trialDays })
13138
13387
  }
13139
13388
  ) }),
13140
- !plan.custom && /* @__PURE__ */ jsx17(Fragment8, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ jsx17(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsx17(
13389
+ !plan.custom && /* @__PURE__ */ jsx18(Fragment8, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ jsx18(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsx18(
13141
13390
  Button,
13142
13391
  {
13143
13392
  type: "button",
@@ -13149,18 +13398,18 @@ var PlanButtonGroup = ({
13149
13398
  $color: "primary",
13150
13399
  $variant: isTrialing ? "filled" : "text",
13151
13400
  $fullWidth: true,
13152
- children: !isValidPlan ? /* @__PURE__ */ jsx17(
13401
+ children: !isValidPlan ? /* @__PURE__ */ jsx18(
13153
13402
  Tooltip,
13154
13403
  {
13155
- trigger: /* @__PURE__ */ jsx17(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13156
- content: /* @__PURE__ */ jsx17(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13404
+ trigger: /* @__PURE__ */ jsx18(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13405
+ content: /* @__PURE__ */ jsx18(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13157
13406
  }
13158
13407
  ) : t2("Choose plan")
13159
13408
  }
13160
13409
  ) })
13161
13410
  ] });
13162
13411
  }
13163
- return isSelected ? /* @__PURE__ */ jsx17(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsx17(
13412
+ return isSelected ? /* @__PURE__ */ jsx18(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsx18(
13164
13413
  Button,
13165
13414
  {
13166
13415
  type: "button",
@@ -13179,11 +13428,11 @@ var PlanButtonGroup = ({
13179
13428
  $color: "primary",
13180
13429
  $variant: "filled",
13181
13430
  $fullWidth: true,
13182
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx17(
13431
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx18(
13183
13432
  Tooltip,
13184
13433
  {
13185
- trigger: /* @__PURE__ */ jsx17(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13186
- content: /* @__PURE__ */ jsx17(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13434
+ trigger: /* @__PURE__ */ jsx18(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13435
+ content: /* @__PURE__ */ jsx18(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13187
13436
  }
13188
13437
  ) : t2("Choose plan")
13189
13438
  }
@@ -13226,7 +13475,7 @@ var Plan = ({
13226
13475
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
13227
13476
  }, [plans]);
13228
13477
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13229
- return /* @__PURE__ */ jsx17(Fragment8, { children: /* @__PURE__ */ jsx17(
13478
+ return /* @__PURE__ */ jsx18(
13230
13479
  Box,
13231
13480
  {
13232
13481
  $display: "grid",
@@ -13235,6 +13484,7 @@ var Plan = ({
13235
13484
  $flexGrow: 1,
13236
13485
  children: plans.map((plan, planIndex) => {
13237
13486
  const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, period) || {};
13487
+ const credits = isHydratedPlan(plan) ? groupPlanCreditGrants(plan.includedCreditGrants) : [];
13238
13488
  const hasUsageBasedEntitlements = plan.entitlements.some(
13239
13489
  (entitlement) => !!entitlement.priceBehavior
13240
13490
  );
@@ -13242,7 +13492,7 @@ var Plan = ({
13242
13492
  const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? settings.theme.typography.heading3 : settings.theme.typography.heading2;
13243
13493
  const count = entitlementCounts[plan.id];
13244
13494
  const isExpanded = count && count.limit > VISIBLE_ENTITLEMENT_COUNT;
13245
- return /* @__PURE__ */ jsxs13(
13495
+ return /* @__PURE__ */ jsxs14(
13246
13496
  Flex,
13247
13497
  {
13248
13498
  $position: "relative",
@@ -13257,7 +13507,7 @@ var Plan = ({
13257
13507
  $boxShadow: cardBoxShadow
13258
13508
  },
13259
13509
  children: [
13260
- /* @__PURE__ */ jsxs13(
13510
+ /* @__PURE__ */ jsxs14(
13261
13511
  Flex,
13262
13512
  {
13263
13513
  $flexDirection: "column",
@@ -13273,10 +13523,10 @@ var Plan = ({
13273
13523
  }
13274
13524
  },
13275
13525
  children: [
13276
- /* @__PURE__ */ jsx17(Box, { children: /* @__PURE__ */ jsx17(Text, { display: "heading2", children: plan.name }) }),
13277
- /* @__PURE__ */ jsx17(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ jsx17(Text, { children: plan.description }) }),
13278
- /* @__PURE__ */ jsxs13(Box, { children: [
13279
- /* @__PURE__ */ jsx17(
13526
+ /* @__PURE__ */ jsx18(Box, { children: /* @__PURE__ */ jsx18(Text, { display: "heading2", children: plan.name }) }),
13527
+ /* @__PURE__ */ jsx18(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ jsx18(Text, { children: plan.description }) }),
13528
+ /* @__PURE__ */ jsxs14(Box, { children: [
13529
+ /* @__PURE__ */ jsx18(
13280
13530
  Text,
13281
13531
  {
13282
13532
  $font: headerPriceFontStyle.fontFamily,
@@ -13286,7 +13536,7 @@ var Plan = ({
13286
13536
  children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
13287
13537
  }
13288
13538
  ),
13289
- !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs13(
13539
+ !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs14(
13290
13540
  Text,
13291
13541
  {
13292
13542
  display: "heading2",
@@ -13298,7 +13548,58 @@ var Plan = ({
13298
13548
  }
13299
13549
  )
13300
13550
  ] }),
13301
- isHydratedPlan(plan) && plan.current && /* @__PURE__ */ jsx17(
13551
+ credits.length > 0 && /* @__PURE__ */ jsx18(
13552
+ Flex,
13553
+ {
13554
+ $flexDirection: "column",
13555
+ $gap: "1rem",
13556
+ $flexGrow: 1,
13557
+ $marginTop: "0.5rem",
13558
+ children: credits.map((credit, creditIndex) => {
13559
+ return /* @__PURE__ */ jsx18(
13560
+ Flex,
13561
+ {
13562
+ $flexWrap: "wrap",
13563
+ $justifyContent: "space-between",
13564
+ $alignItems: "center",
13565
+ $gap: "1rem",
13566
+ children: /* @__PURE__ */ jsxs14(Flex, { $gap: "1rem", children: [
13567
+ credit.icon && /* @__PURE__ */ jsx18(
13568
+ Icon3,
13569
+ {
13570
+ name: credit.icon,
13571
+ color: settings.theme.primary,
13572
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13573
+ rounded: true
13574
+ }
13575
+ ),
13576
+ /* @__PURE__ */ jsx18(
13577
+ Flex,
13578
+ {
13579
+ $flexDirection: "column",
13580
+ $justifyContent: "center",
13581
+ $gap: "0.5rem",
13582
+ children: /* @__PURE__ */ jsxs14(Text, { children: [
13583
+ credit.quantity,
13584
+ " ",
13585
+ getFeatureName(credit, credit.quantity),
13586
+ credit.period && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13587
+ " ",
13588
+ t2("per"),
13589
+ " ",
13590
+ credit.period
13591
+ ] })
13592
+ ] })
13593
+ }
13594
+ )
13595
+ ] })
13596
+ },
13597
+ creditIndex
13598
+ );
13599
+ })
13600
+ }
13601
+ ),
13602
+ isHydratedPlan(plan) && plan.current && /* @__PURE__ */ jsx18(
13302
13603
  Flex,
13303
13604
  {
13304
13605
  $position: "absolute",
@@ -13307,7 +13608,7 @@ var Plan = ({
13307
13608
  $backgroundColor: settings.theme.primary,
13308
13609
  $borderRadius: "9999px",
13309
13610
  $padding: "0.125rem 0.85rem",
13310
- children: /* @__PURE__ */ jsx17(
13611
+ children: /* @__PURE__ */ jsx18(
13311
13612
  Text,
13312
13613
  {
13313
13614
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -13320,7 +13621,7 @@ var Plan = ({
13320
13621
  ]
13321
13622
  }
13322
13623
  ),
13323
- /* @__PURE__ */ jsxs13(
13624
+ /* @__PURE__ */ jsxs14(
13324
13625
  Flex,
13325
13626
  {
13326
13627
  $flexDirection: "column",
@@ -13329,55 +13630,115 @@ var Plan = ({
13329
13630
  $gap: `${cardPadding}rem`,
13330
13631
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13331
13632
  children: [
13332
- /* @__PURE__ */ jsxs13(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
13333
- plan.entitlements.reduce(
13334
- (acc, entitlement, entitlementIndex) => {
13335
- const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
13336
- const limit = entitlement.softLimit ?? entitlement.valueNumeric;
13337
- const {
13338
- price: entitlementPrice,
13339
- priceTier: entitlementPriceTiers,
13340
- currency: entitlementCurrency,
13341
- packageSize: entitlementPackageSize = 1
13342
- } = getEntitlementPrice(entitlement, period) || {};
13343
- const metricPeriodName = getMetricPeriodName(entitlement);
13344
- if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
13345
- return acc;
13346
- }
13347
- acc.push(
13348
- /* @__PURE__ */ jsx17(
13349
- Flex,
13350
- {
13351
- $flexWrap: "wrap",
13352
- $justifyContent: "space-between",
13353
- $alignItems: "center",
13354
- $gap: "1rem",
13355
- children: /* @__PURE__ */ jsxs13(Flex, { $gap: "1rem", children: [
13356
- entitlement.feature?.icon && /* @__PURE__ */ jsx17(
13357
- Icon3,
13358
- {
13359
- name: entitlement.feature.icon,
13360
- color: settings.theme.primary,
13361
- background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13362
- rounded: true
13363
- }
13364
- ),
13365
- entitlement.feature?.name && /* @__PURE__ */ jsxs13(
13366
- Flex,
13367
- {
13368
- $flexDirection: "column",
13369
- $justifyContent: "center",
13370
- $gap: "0.5rem",
13371
- children: [
13372
- /* @__PURE__ */ jsx17(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs13(Fragment8, { children: [
13373
- formatCurrency(
13633
+ plan.entitlements.length > 0 && /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
13634
+ plan.entitlements.map((entitlement, entitlementIndex) => {
13635
+ const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
13636
+ const limit = entitlement.softLimit ?? entitlement.valueNumeric;
13637
+ const {
13638
+ price: entitlementPrice,
13639
+ priceTier: entitlementPriceTiers,
13640
+ currency: entitlementCurrency,
13641
+ packageSize: entitlementPackageSize = 1
13642
+ } = getEntitlementPrice(entitlement, period) || {};
13643
+ const metricPeriodName = getMetricPeriodName(entitlement);
13644
+ return /* @__PURE__ */ jsx18(
13645
+ Flex,
13646
+ {
13647
+ $flexWrap: "wrap",
13648
+ $justifyContent: "space-between",
13649
+ $alignItems: "center",
13650
+ $gap: "1rem",
13651
+ children: /* @__PURE__ */ jsxs14(Flex, { $gap: "1rem", children: [
13652
+ entitlement.feature?.icon && /* @__PURE__ */ jsx18(
13653
+ Icon3,
13654
+ {
13655
+ name: entitlement.feature.icon,
13656
+ color: settings.theme.primary,
13657
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13658
+ rounded: true
13659
+ }
13660
+ ),
13661
+ entitlement.feature?.name && /* @__PURE__ */ jsxs14(
13662
+ Flex,
13663
+ {
13664
+ $flexDirection: "column",
13665
+ $justifyContent: "center",
13666
+ $gap: "0.5rem",
13667
+ children: [
13668
+ /* @__PURE__ */ jsx18(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
13669
+ formatCurrency(
13670
+ entitlementPrice,
13671
+ entitlementCurrency
13672
+ ),
13673
+ " ",
13674
+ t2("per"),
13675
+ " ",
13676
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13677
+ entitlementPackageSize,
13678
+ " "
13679
+ ] }),
13680
+ getFeatureName(
13681
+ entitlement.feature,
13682
+ entitlementPackageSize
13683
+ ),
13684
+ entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13685
+ " ",
13686
+ t2("per"),
13687
+ " ",
13688
+ period
13689
+ ] })
13690
+ ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ jsx18(
13691
+ TieredPricingDetails,
13692
+ {
13693
+ entitlement,
13694
+ period
13695
+ }
13696
+ ) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
13697
+ entitlement.consumptionRate,
13698
+ " ",
13699
+ getFeatureName(
13700
+ entitlement.valueCredit,
13701
+ entitlement.consumptionRate || void 0
13702
+ ),
13703
+ " ",
13704
+ t2("per"),
13705
+ " ",
13706
+ getFeatureName(entitlement.feature, 1)
13707
+ ] }) : hasNumericValue ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
13708
+ entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
13709
+ item: getFeatureName(
13710
+ entitlement.feature
13711
+ )
13712
+ }) : typeof limit === "number" && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13713
+ formatNumber(limit),
13714
+ " ",
13715
+ getFeatureName(
13716
+ entitlement.feature,
13717
+ limit
13718
+ )
13719
+ ] }),
13720
+ metricPeriodName && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13721
+ " ",
13722
+ t2("per"),
13723
+ " ",
13724
+ t2(metricPeriodName)
13725
+ ] })
13726
+ ] }) : entitlement.feature.name }),
13727
+ entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsxs14(
13728
+ Text,
13729
+ {
13730
+ style: { opacity: 0.54 },
13731
+ $size: 0.875 * settings.theme.typography.text.fontSize,
13732
+ $color: settings.theme.typography.text.color,
13733
+ children: [
13734
+ t2("then"),
13735
+ " ",
13736
+ formatCurrency(
13374
13737
  entitlementPrice,
13375
13738
  entitlementCurrency
13376
13739
  ),
13377
- " ",
13378
- t2("per"),
13379
- " ",
13380
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13740
+ "/",
13741
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13381
13742
  entitlementPackageSize,
13382
13743
  " "
13383
13744
  ] }),
@@ -13385,99 +13746,41 @@ var Plan = ({
13385
13746
  entitlement.feature,
13386
13747
  entitlementPackageSize
13387
13748
  ),
13388
- entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13389
- " ",
13390
- t2("per"),
13391
- " ",
13392
- period
13393
- ] })
13394
- ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ jsx17(
13395
- TieredPricingDetails,
13396
- {
13397
- entitlement,
13398
- period
13399
- }
13400
- ) : hasNumericValue ? /* @__PURE__ */ jsxs13(Fragment8, { children: [
13401
- entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
13402
- item: getFeatureName(
13403
- entitlement.feature
13404
- )
13405
- }) : typeof limit === "number" && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13406
- formatNumber(limit),
13407
- " ",
13408
- getFeatureName(
13409
- entitlement.feature,
13410
- limit
13411
- )
13412
- ] }),
13413
- metricPeriodName && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13414
- " ",
13415
- t2("per"),
13416
- " ",
13417
- t2(metricPeriodName)
13749
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs14(Fragment8, { children: [
13750
+ "/",
13751
+ shortenPeriod(period)
13418
13752
  ] })
13419
- ] }) : entitlement.feature.name }),
13420
- entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsxs13(
13421
- Text,
13422
- {
13423
- style: { opacity: 0.54 },
13424
- $size: 0.875 * settings.theme.typography.text.fontSize,
13425
- $color: settings.theme.typography.text.color,
13426
- children: [
13427
- t2("then"),
13428
- " ",
13429
- formatCurrency(
13430
- entitlementPrice,
13431
- entitlementCurrency
13432
- ),
13433
- "/",
13434
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13435
- entitlementPackageSize,
13436
- " "
13437
- ] }),
13438
- getFeatureName(
13439
- entitlement.feature,
13440
- entitlementPackageSize
13441
- ),
13442
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs13(Fragment8, { children: [
13443
- "/",
13444
- shortenPeriod(period)
13445
- ] })
13446
- ]
13447
- }
13448
- ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs13(Flex, { $alignItems: "center", children: [
13449
- /* @__PURE__ */ jsx17(
13450
- PricingTiersTooltip,
13451
- {
13452
- feature: entitlement.feature,
13453
- period,
13454
- currency: entitlementCurrency,
13455
- priceTiers: entitlementPriceTiers
13456
- }
13457
- ),
13458
- /* @__PURE__ */ jsx17(
13459
- Text,
13460
- {
13461
- style: { opacity: 0.54 },
13462
- $size: 0.875 * settings.theme.typography.text.fontSize,
13463
- $color: settings.theme.typography.text.color,
13464
- children: t2("Tier-based")
13465
- }
13466
- )
13467
- ] })
13468
- ]
13469
- }
13470
- )
13471
- ] })
13472
- },
13473
- entitlementIndex
13474
- )
13475
- );
13476
- return acc;
13477
- },
13478
- []
13479
- ).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
13480
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs13(
13753
+ ]
13754
+ }
13755
+ ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs14(Flex, { $alignItems: "center", children: [
13756
+ /* @__PURE__ */ jsx18(
13757
+ PricingTiersTooltip,
13758
+ {
13759
+ feature: entitlement.feature,
13760
+ period,
13761
+ currency: entitlementCurrency,
13762
+ priceTiers: entitlementPriceTiers
13763
+ }
13764
+ ),
13765
+ /* @__PURE__ */ jsx18(
13766
+ Text,
13767
+ {
13768
+ style: { opacity: 0.54 },
13769
+ $size: 0.875 * settings.theme.typography.text.fontSize,
13770
+ $color: settings.theme.typography.text.color,
13771
+ children: t2("Tier-based")
13772
+ }
13773
+ )
13774
+ ] })
13775
+ ]
13776
+ }
13777
+ )
13778
+ ] })
13779
+ },
13780
+ entitlementIndex
13781
+ );
13782
+ }).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
13783
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs14(
13481
13784
  Flex,
13482
13785
  {
13483
13786
  $alignItems: "center",
@@ -13485,14 +13788,14 @@ var Plan = ({
13485
13788
  $gap: "0.5rem",
13486
13789
  $marginTop: "1rem",
13487
13790
  children: [
13488
- /* @__PURE__ */ jsx17(
13791
+ /* @__PURE__ */ jsx18(
13489
13792
  Icon3,
13490
13793
  {
13491
13794
  name: isExpanded ? "chevron-up" : "chevron-down",
13492
13795
  color: "#D0D0D0"
13493
13796
  }
13494
13797
  ),
13495
- /* @__PURE__ */ jsx17(
13798
+ /* @__PURE__ */ jsx18(
13496
13799
  Text,
13497
13800
  {
13498
13801
  onClick: () => handleToggleShowAll(plan.id),
@@ -13512,7 +13815,7 @@ var Plan = ({
13512
13815
  }
13513
13816
  )
13514
13817
  ] }),
13515
- /* @__PURE__ */ jsx17(
13818
+ /* @__PURE__ */ jsx18(
13516
13819
  PlanButtonGroup,
13517
13820
  {
13518
13821
  plan,
@@ -13531,147 +13834,144 @@ var Plan = ({
13531
13834
  );
13532
13835
  })
13533
13836
  }
13534
- ) });
13837
+ );
13535
13838
  };
13536
13839
 
13537
13840
  // src/components/shared/checkout-dialog/Usage.tsx
13538
- import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
13841
+ import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
13539
13842
  var Usage = ({ entitlements, updateQuantity, period }) => {
13540
13843
  const { settings } = useEmbed();
13541
13844
  const { t: t2 } = useTranslation();
13542
13845
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13543
13846
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
13544
- return /* @__PURE__ */ jsx18(Fragment9, { children: /* @__PURE__ */ jsx18(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
13545
- (acc, entitlement, index) => {
13546
- if (entitlement.feature) {
13547
- const {
13548
- price,
13549
- currency,
13550
- packageSize = 1
13551
- } = getEntitlementPrice(entitlement, period) || {};
13552
- acc.push(
13553
- /* @__PURE__ */ jsxs14(
13554
- Flex,
13555
- {
13556
- $justifyContent: "space-between",
13557
- $alignItems: "center",
13558
- $gap: "1rem",
13559
- $padding: `${cardPadding}rem`,
13560
- $backgroundColor: settings.theme.card.background,
13561
- $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13562
- ...settings.theme.card.hasShadow && {
13563
- $boxShadow: cardBoxShadow
13564
- },
13565
- children: [
13566
- /* @__PURE__ */ jsxs14(
13567
- Flex,
13568
- {
13569
- $flexDirection: "column",
13570
- $gap: "0.75rem",
13571
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13572
- children: [
13573
- /* @__PURE__ */ jsx18(Box, { children: /* @__PURE__ */ jsx18(Text, { display: "heading2", children: entitlement.feature.name }) }),
13574
- entitlement.feature.description && /* @__PURE__ */ jsx18(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx18(Text, { children: entitlement.feature.description }) })
13575
- ]
13576
- }
13577
- ),
13578
- /* @__PURE__ */ jsxs14(
13579
- Flex,
13580
- {
13581
- $flexDirection: "column",
13582
- $gap: "0.5rem",
13583
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13584
- children: [
13585
- /* @__PURE__ */ jsx18(
13586
- Input,
13587
- {
13588
- $size: "lg",
13589
- type: "number",
13590
- value: entitlement.quantity,
13591
- min: 1,
13592
- autoFocus: true,
13593
- onFocus: (event) => {
13594
- event.target.select();
13595
- },
13596
- onChange: (event) => {
13597
- event.preventDefault();
13598
- const value = parseInt(event.target.value);
13599
- if (!isNaN(value) && value > 0) {
13600
- updateQuantity(entitlement.id, value);
13601
- }
13847
+ return /* @__PURE__ */ jsx19(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement, index) => {
13848
+ if (entitlement.feature) {
13849
+ const {
13850
+ price,
13851
+ currency,
13852
+ packageSize = 1
13853
+ } = getEntitlementPrice(entitlement, period) || {};
13854
+ acc.push(
13855
+ /* @__PURE__ */ jsxs15(
13856
+ Flex,
13857
+ {
13858
+ $justifyContent: "space-between",
13859
+ $alignItems: "center",
13860
+ $gap: "1rem",
13861
+ $padding: `${cardPadding}rem`,
13862
+ $backgroundColor: settings.theme.card.background,
13863
+ $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13864
+ ...settings.theme.card.hasShadow && {
13865
+ $boxShadow: cardBoxShadow
13866
+ },
13867
+ children: [
13868
+ /* @__PURE__ */ jsxs15(
13869
+ Flex,
13870
+ {
13871
+ $flexDirection: "column",
13872
+ $gap: "0.75rem",
13873
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13874
+ children: [
13875
+ /* @__PURE__ */ jsx19(Box, { children: /* @__PURE__ */ jsx19(Text, { display: "heading2", children: entitlement.feature.name }) }),
13876
+ entitlement.feature.description && /* @__PURE__ */ jsx19(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx19(Text, { children: entitlement.feature.description }) })
13877
+ ]
13878
+ }
13879
+ ),
13880
+ /* @__PURE__ */ jsxs15(
13881
+ Flex,
13882
+ {
13883
+ $flexDirection: "column",
13884
+ $gap: "0.5rem",
13885
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13886
+ children: [
13887
+ /* @__PURE__ */ jsx19(
13888
+ Input,
13889
+ {
13890
+ $size: "lg",
13891
+ type: "number",
13892
+ value: entitlement.quantity,
13893
+ min: 1,
13894
+ autoFocus: true,
13895
+ onFocus: (event) => {
13896
+ event.target.select();
13897
+ },
13898
+ onChange: (event) => {
13899
+ event.preventDefault();
13900
+ const value = parseInt(event.target.value);
13901
+ if (!isNaN(value) && value > 0) {
13902
+ updateQuantity(entitlement.id, value);
13602
13903
  }
13603
13904
  }
13905
+ }
13906
+ ),
13907
+ /* @__PURE__ */ jsx19(
13908
+ Text,
13909
+ {
13910
+ style: { opacity: 0.54 },
13911
+ $size: unitPriceFontSize,
13912
+ $color: settings.theme.typography.text.color,
13913
+ children: t2("Currently using", {
13914
+ quantity: entitlement.usage,
13915
+ unit: getFeatureName(entitlement.feature)
13916
+ })
13917
+ }
13918
+ ),
13919
+ entitlement.quantity < entitlement.usage && /* @__PURE__ */ jsx19(Text, { $size: unitPriceFontSize, $color: "#DB6669", children: t2("Cannot downgrade entitlement") })
13920
+ ]
13921
+ }
13922
+ ),
13923
+ /* @__PURE__ */ jsxs15(
13924
+ Box,
13925
+ {
13926
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13927
+ $textAlign: "right",
13928
+ children: [
13929
+ /* @__PURE__ */ jsx19(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs15(Text, { children: [
13930
+ formatCurrency(
13931
+ (price ?? 0) * entitlement.quantity,
13932
+ currency
13604
13933
  ),
13605
- /* @__PURE__ */ jsx18(
13606
- Text,
13607
- {
13608
- style: { opacity: 0.54 },
13609
- $size: unitPriceFontSize,
13610
- $color: settings.theme.typography.text.color,
13611
- children: t2("Currently using", {
13612
- quantity: entitlement.usage,
13613
- unit: getFeatureName(entitlement.feature)
13614
- })
13615
- }
13616
- ),
13617
- entitlement.quantity < entitlement.usage && /* @__PURE__ */ jsx18(Text, { $size: unitPriceFontSize, $color: "#DB6669", children: t2("Cannot downgrade entitlement") })
13618
- ]
13619
- }
13620
- ),
13621
- /* @__PURE__ */ jsxs14(
13622
- Box,
13623
- {
13624
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13625
- $textAlign: "right",
13626
- children: [
13627
- /* @__PURE__ */ jsx18(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs14(Text, { children: [
13628
- formatCurrency(
13629
- (price ?? 0) * entitlement.quantity,
13630
- currency
13631
- ),
13632
- /* @__PURE__ */ jsxs14("sub", { children: [
13633
- "/",
13634
- shortenPeriod(period)
13635
- ] })
13636
- ] }) }),
13637
- /* @__PURE__ */ jsx18(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs14(
13638
- Text,
13639
- {
13640
- style: { opacity: 0.54 },
13641
- $size: unitPriceFontSize,
13642
- $color: settings.theme.typography.text.color,
13643
- children: [
13644
- formatCurrency(price ?? 0, currency),
13645
- /* @__PURE__ */ jsxs14("sub", { children: [
13646
- "/",
13647
- packageSize > 1 && /* @__PURE__ */ jsxs14(Fragment9, { children: [
13648
- packageSize,
13649
- " "
13650
- ] }),
13651
- getFeatureName(entitlement.feature, packageSize),
13652
- "/",
13653
- shortenPeriod(period)
13654
- ] })
13655
- ]
13656
- }
13657
- ) })
13658
- ]
13659
- }
13660
- )
13661
- ]
13662
- },
13663
- index
13664
- )
13665
- );
13666
- }
13667
- return acc;
13668
- },
13669
- []
13670
- ) }) });
13934
+ /* @__PURE__ */ jsxs15("sub", { children: [
13935
+ "/",
13936
+ shortenPeriod(period)
13937
+ ] })
13938
+ ] }) }),
13939
+ /* @__PURE__ */ jsx19(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs15(
13940
+ Text,
13941
+ {
13942
+ style: { opacity: 0.54 },
13943
+ $size: unitPriceFontSize,
13944
+ $color: settings.theme.typography.text.color,
13945
+ children: [
13946
+ formatCurrency(price ?? 0, currency),
13947
+ /* @__PURE__ */ jsxs15("sub", { children: [
13948
+ "/",
13949
+ packageSize > 1 && /* @__PURE__ */ jsxs15(Fragment9, { children: [
13950
+ packageSize,
13951
+ " "
13952
+ ] }),
13953
+ getFeatureName(entitlement.feature, packageSize),
13954
+ "/",
13955
+ shortenPeriod(period)
13956
+ ] })
13957
+ ]
13958
+ }
13959
+ ) })
13960
+ ]
13961
+ }
13962
+ )
13963
+ ]
13964
+ },
13965
+ index
13966
+ )
13967
+ );
13968
+ }
13969
+ return acc;
13970
+ }, []) });
13671
13971
  };
13672
13972
 
13673
13973
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
13674
- import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
13974
+ import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
13675
13975
  var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc, entitlement) => {
13676
13976
  if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice)) {
13677
13977
  const featureUsage = entitlements.find(
@@ -13748,6 +14048,15 @@ var CheckoutDialog = ({ top = 0 }) => {
13748
14048
  }
13749
14049
  return [];
13750
14050
  });
14051
+ const [creditBundles, setCreditBundles] = useState9(() => {
14052
+ if (isCheckoutData(data)) {
14053
+ return data.creditBundles.map((bundle) => ({
14054
+ ...bundle,
14055
+ count: 0
14056
+ }));
14057
+ }
14058
+ return [];
14059
+ });
13751
14060
  const [usageBasedEntitlements, setUsageBasedEntitlements] = useState9(
13752
14061
  () => (selectedPlan?.entitlements || []).reduce(
13753
14062
  createActiveUsageBasedEntitlementsReducer(
@@ -13772,7 +14081,7 @@ var CheckoutDialog = ({ top = 0 }) => {
13772
14081
  const isSelectedPlanTrialable = isHydratedPlan(selectedPlan) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
13773
14082
  const checkoutStages = useMemo9(() => {
13774
14083
  const stages = [];
13775
- if (availablePlans) {
14084
+ if (availablePlans.length > 0) {
13776
14085
  stages.push({
13777
14086
  id: "plan",
13778
14087
  name: t2("Plan"),
@@ -13797,6 +14106,14 @@ var CheckoutDialog = ({ top = 0 }) => {
13797
14106
  description: t2("Optionally add features to your subscription")
13798
14107
  });
13799
14108
  }
14109
+ if (creditBundles.length > 0) {
14110
+ stages.push({
14111
+ id: "credits",
14112
+ name: t2("Credits"),
14113
+ label: t2("Select credits"),
14114
+ description: t2("Optionally add credit bundles to your subscription")
14115
+ });
14116
+ }
13800
14117
  if (isPaymentMethodRequired) {
13801
14118
  stages.push({
13802
14119
  id: "checkout",
@@ -13808,11 +14125,12 @@ var CheckoutDialog = ({ top = 0 }) => {
13808
14125
  }, [
13809
14126
  t2,
13810
14127
  availablePlans,
13811
- addOns,
13812
- payInAdvanceEntitlements,
13813
- shouldTrial,
13814
14128
  willTrialWithoutPaymentMethod,
14129
+ payInAdvanceEntitlements,
14130
+ addOns,
13815
14131
  isSelectedPlanTrialable,
14132
+ shouldTrial,
14133
+ creditBundles,
13816
14134
  isPaymentMethodRequired
13817
14135
  ]);
13818
14136
  const [checkoutStage, setCheckoutStage] = useState9(() => {
@@ -13822,8 +14140,11 @@ var CheckoutDialog = ({ top = 0 }) => {
13822
14140
  if (checkoutState?.usage) {
13823
14141
  return "usage";
13824
14142
  }
14143
+ if (checkoutState?.credits) {
14144
+ return "credits";
14145
+ }
13825
14146
  if (checkoutState?.planId !== currentPlanId) {
13826
- return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : "plan";
14147
+ return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : checkoutStages.some((stage) => stage.id === "credits") ? "credits" : "plan";
13827
14148
  }
13828
14149
  return "plan";
13829
14150
  });
@@ -13873,7 +14194,18 @@ var CheckoutDialog = ({ top = 0 }) => {
13873
14194
  },
13874
14195
  []
13875
14196
  ),
13876
- creditBundles: [],
14197
+ creditBundles: (updates.creditBundles || creditBundles).reduce(
14198
+ (acc, { id, count }) => {
14199
+ if (count > 0) {
14200
+ acc.push({
14201
+ bundleId: id,
14202
+ quantity: count
14203
+ });
14204
+ }
14205
+ return acc;
14206
+ },
14207
+ []
14208
+ ),
13877
14209
  skipTrial,
13878
14210
  ...code && { promoCode: code }
13879
14211
  });
@@ -13919,6 +14251,7 @@ var CheckoutDialog = ({ top = 0 }) => {
13919
14251
  selectedPlan,
13920
14252
  payInAdvanceEntitlements,
13921
14253
  addOns,
14254
+ creditBundles,
13922
14255
  shouldTrial,
13923
14256
  promoCode
13924
14257
  ]
@@ -14015,6 +14348,21 @@ var CheckoutDialog = ({ top = 0 }) => {
14015
14348
  },
14016
14349
  [handlePreviewCheckout]
14017
14350
  );
14351
+ const updateCreditBundleCount = useCallback9(
14352
+ (id, updatedCount) => {
14353
+ setCreditBundles((prev2) => {
14354
+ const updated = prev2.map(
14355
+ (bundle) => bundle.id === id ? {
14356
+ ...bundle,
14357
+ count: updatedCount
14358
+ } : bundle
14359
+ );
14360
+ handlePreviewCheckout({ creditBundles: updated });
14361
+ return updated;
14362
+ });
14363
+ },
14364
+ [handlePreviewCheckout]
14365
+ );
14018
14366
  const updatePromoCode = useCallback9(
14019
14367
  async (code) => {
14020
14368
  handlePreviewCheckout({ promoCode: code });
@@ -14067,8 +14415,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14067
14415
  const activeCheckoutStage = checkoutStages.find(
14068
14416
  (stage) => stage.id === checkoutStage
14069
14417
  );
14070
- return /* @__PURE__ */ jsxs15(Modal2, { size: "lg", top, contentRef, children: [
14071
- /* @__PURE__ */ jsx19(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx19(
14418
+ return /* @__PURE__ */ jsxs16(Modal2, { size: "lg", top, contentRef, children: [
14419
+ /* @__PURE__ */ jsx20(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx20(
14072
14420
  Flex,
14073
14421
  {
14074
14422
  $flexWrap: "wrap",
@@ -14078,7 +14426,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14078
14426
  $gap: "1rem"
14079
14427
  }
14080
14428
  },
14081
- children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ jsx19(
14429
+ children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ jsx20(
14082
14430
  Navigation,
14083
14431
  {
14084
14432
  name: stage.name,
@@ -14093,7 +14441,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14093
14441
  ))
14094
14442
  }
14095
14443
  ) }),
14096
- /* @__PURE__ */ jsxs15(
14444
+ /* @__PURE__ */ jsxs16(
14097
14445
  Flex,
14098
14446
  {
14099
14447
  $position: "relative",
@@ -14106,7 +14454,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14106
14454
  }
14107
14455
  },
14108
14456
  children: [
14109
- /* @__PURE__ */ jsxs15(
14457
+ /* @__PURE__ */ jsxs16(
14110
14458
  Flex,
14111
14459
  {
14112
14460
  $flexDirection: "column",
@@ -14121,7 +14469,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14121
14469
  }
14122
14470
  },
14123
14471
  children: [
14124
- /* @__PURE__ */ jsxs15(
14472
+ /* @__PURE__ */ jsxs16(
14125
14473
  Flex,
14126
14474
  {
14127
14475
  $flexDirection: "column",
@@ -14136,8 +14484,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14136
14484
  }
14137
14485
  },
14138
14486
  children: [
14139
- activeCheckoutStage && /* @__PURE__ */ jsxs15(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
14140
- activeCheckoutStage.label && /* @__PURE__ */ jsx19(
14487
+ activeCheckoutStage && /* @__PURE__ */ jsxs16(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
14488
+ activeCheckoutStage.label && /* @__PURE__ */ jsx20(
14141
14489
  Text,
14142
14490
  {
14143
14491
  as: "h3",
@@ -14146,9 +14494,9 @@ var CheckoutDialog = ({ top = 0 }) => {
14146
14494
  children: activeCheckoutStage.label
14147
14495
  }
14148
14496
  ),
14149
- activeCheckoutStage.description && /* @__PURE__ */ jsx19(Text, { as: "p", children: activeCheckoutStage.description })
14497
+ activeCheckoutStage.description && /* @__PURE__ */ jsx20(Text, { as: "p", children: activeCheckoutStage.description })
14150
14498
  ] }),
14151
- checkoutStage === "plan" && availablePeriods.length > 1 && /* @__PURE__ */ jsx19(
14499
+ checkoutStage === "plan" && availablePeriods.length > 1 && /* @__PURE__ */ jsx20(
14152
14500
  PeriodToggle,
14153
14501
  {
14154
14502
  options: availablePeriods,
@@ -14160,7 +14508,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14160
14508
  ]
14161
14509
  }
14162
14510
  ),
14163
- checkoutStage === "plan" && /* @__PURE__ */ jsx19(
14511
+ checkoutStage === "plan" && /* @__PURE__ */ jsx20(
14164
14512
  Plan,
14165
14513
  {
14166
14514
  isLoading,
@@ -14171,7 +14519,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14171
14519
  shouldTrial
14172
14520
  }
14173
14521
  ),
14174
- checkoutStage === "usage" && /* @__PURE__ */ jsx19(
14522
+ checkoutStage === "usage" && /* @__PURE__ */ jsx20(
14175
14523
  Usage,
14176
14524
  {
14177
14525
  isLoading,
@@ -14181,7 +14529,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14181
14529
  updateQuantity: updateUsageBasedEntitlementQuantity
14182
14530
  }
14183
14531
  ),
14184
- checkoutStage === "addons" && /* @__PURE__ */ jsx19(
14532
+ checkoutStage === "addons" && /* @__PURE__ */ jsx20(
14185
14533
  AddOns,
14186
14534
  {
14187
14535
  isLoading,
@@ -14190,7 +14538,15 @@ var CheckoutDialog = ({ top = 0 }) => {
14190
14538
  toggle: (id) => toggleAddOn(id)
14191
14539
  }
14192
14540
  ),
14193
- checkoutStage === "checkout" && /* @__PURE__ */ jsx19(
14541
+ checkoutStage === "credits" && /* @__PURE__ */ jsx20(
14542
+ Credits,
14543
+ {
14544
+ isLoading,
14545
+ bundles: creditBundles,
14546
+ updateCount: updateCreditBundleCount
14547
+ }
14548
+ ),
14549
+ checkoutStage === "checkout" && /* @__PURE__ */ jsx20(
14194
14550
  Checkout,
14195
14551
  {
14196
14552
  isPaymentMethodRequired,
@@ -14201,13 +14557,14 @@ var CheckoutDialog = ({ top = 0 }) => {
14201
14557
  ]
14202
14558
  }
14203
14559
  ),
14204
- /* @__PURE__ */ jsx19(
14560
+ /* @__PURE__ */ jsx20(
14205
14561
  Sidebar,
14206
14562
  {
14207
14563
  planPeriod,
14208
14564
  selectedPlan,
14209
14565
  addOns,
14210
14566
  usageBasedEntitlements,
14567
+ creditBundles,
14211
14568
  charges,
14212
14569
  checkoutRef,
14213
14570
  checkoutStage,
@@ -14233,13 +14590,13 @@ var CheckoutDialog = ({ top = 0 }) => {
14233
14590
 
14234
14591
  // src/components/shared/payment-dialog/PaymentDialog.tsx
14235
14592
  import { useRef as useRef7 } from "react";
14236
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
14593
+ import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
14237
14594
  var PaymentDialog = ({ top = 0 }) => {
14238
14595
  const { t: t2 } = useTranslation();
14239
14596
  const contentRef = useRef7(null);
14240
- return /* @__PURE__ */ jsxs16(Modal2, { size: "md", top, contentRef, children: [
14241
- /* @__PURE__ */ jsx20(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx20(Text, { $size: 18, children: t2("Edit payment method") }) }),
14242
- /* @__PURE__ */ jsx20(PaymentMethodDetails, {})
14597
+ return /* @__PURE__ */ jsxs17(Modal2, { size: "md", top, contentRef, children: [
14598
+ /* @__PURE__ */ jsx21(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx21(Text, { $size: 18, children: t2("Edit payment method") }) }),
14599
+ /* @__PURE__ */ jsx21(PaymentMethodDetails, {})
14243
14600
  ] });
14244
14601
  };
14245
14602
 
@@ -14250,7 +14607,7 @@ import {
14250
14607
  useStripe
14251
14608
  } from "@stripe/react-stripe-js";
14252
14609
  import { useState as useState10 } from "react";
14253
- import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
14610
+ import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
14254
14611
  var PaymentForm = ({ onConfirm }) => {
14255
14612
  const { t: t2 } = useTranslation();
14256
14613
  const stripe = useStripe();
@@ -14289,7 +14646,7 @@ var PaymentForm = ({ onConfirm }) => {
14289
14646
  setIsLoading(false);
14290
14647
  }
14291
14648
  };
14292
- return /* @__PURE__ */ jsxs17(
14649
+ return /* @__PURE__ */ jsxs18(
14293
14650
  "form",
14294
14651
  {
14295
14652
  id: "payment-form",
@@ -14301,7 +14658,7 @@ var PaymentForm = ({ onConfirm }) => {
14301
14658
  overflowY: "auto"
14302
14659
  },
14303
14660
  children: [
14304
- /* @__PURE__ */ jsx21(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx21(
14661
+ /* @__PURE__ */ jsx22(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx22(
14305
14662
  PaymentElement,
14306
14663
  {
14307
14664
  id: "payment-element",
@@ -14310,7 +14667,7 @@ var PaymentForm = ({ onConfirm }) => {
14310
14667
  }
14311
14668
  }
14312
14669
  ) }),
14313
- /* @__PURE__ */ jsx21(
14670
+ /* @__PURE__ */ jsx22(
14314
14671
  Button,
14315
14672
  {
14316
14673
  id: "submit",
@@ -14322,7 +14679,7 @@ var PaymentForm = ({ onConfirm }) => {
14322
14679
  children: isLoading ? t2("Loading") : t2("Save payment method")
14323
14680
  }
14324
14681
  ),
14325
- message && /* @__PURE__ */ jsx21(Box, { $margin: "1rem 0", children: /* @__PURE__ */ jsx21(Text, { id: "payment-message", $size: 15, $weight: 500, $color: "#DB6669", children: message }) })
14682
+ message && /* @__PURE__ */ jsx22(Box, { $margin: "1rem 0", children: /* @__PURE__ */ jsx22(Text, { id: "payment-message", $size: 15, $weight: 500, $color: "#DB6669", children: message }) })
14326
14683
  ]
14327
14684
  }
14328
14685
  );
@@ -14330,7 +14687,7 @@ var PaymentForm = ({ onConfirm }) => {
14330
14687
 
14331
14688
  // src/components/shared/period-toggle/PeriodToggle.tsx
14332
14689
  import { useMemo as useMemo10 } from "react";
14333
- import { jsx as jsx22 } from "react/jsx-runtime";
14690
+ import { jsx as jsx23 } from "react/jsx-runtime";
14334
14691
  var PeriodToggle = ({
14335
14692
  options: options2,
14336
14693
  selectedOption,
@@ -14350,7 +14707,7 @@ var PeriodToggle = ({
14350
14707
  }
14351
14708
  return 0;
14352
14709
  }, [selectedPlan]);
14353
- return /* @__PURE__ */ jsx22(
14710
+ return /* @__PURE__ */ jsx23(
14354
14711
  Flex,
14355
14712
  {
14356
14713
  $margin: 0,
@@ -14366,7 +14723,7 @@ var PeriodToggle = ({
14366
14723
  }
14367
14724
  },
14368
14725
  children: options2.map((option) => {
14369
- const element = /* @__PURE__ */ jsx22(
14726
+ const element = /* @__PURE__ */ jsx23(
14370
14727
  Flex,
14371
14728
  {
14372
14729
  tabIndex: 0,
@@ -14386,7 +14743,7 @@ var PeriodToggle = ({
14386
14743
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.125)"
14387
14744
  },
14388
14745
  $borderRadius: "2.5rem",
14389
- children: /* @__PURE__ */ jsx22(
14746
+ children: /* @__PURE__ */ jsx23(
14390
14747
  Text,
14391
14748
  {
14392
14749
  style: { flexShrink: 0 },
@@ -14399,11 +14756,11 @@ var PeriodToggle = ({
14399
14756
  option
14400
14757
  );
14401
14758
  if (option === "year" && savingsPercentage > 0) {
14402
- return /* @__PURE__ */ jsx22(
14759
+ return /* @__PURE__ */ jsx23(
14403
14760
  Tooltip,
14404
14761
  {
14405
14762
  trigger: element,
14406
- content: /* @__PURE__ */ jsx22(Text, { $size: 11, $leading: 1, children: selectedOption === "month" ? t2("Save with yearly billing", {
14763
+ content: /* @__PURE__ */ jsx23(Text, { $size: 11, $leading: 1, children: selectedOption === "month" ? t2("Save with yearly billing", {
14407
14764
  percent: savingsPercentage
14408
14765
  }) : t2("Saving with yearly billing", {
14409
14766
  percent: savingsPercentage
@@ -14424,7 +14781,7 @@ import { useMemo as useMemo12 } from "react";
14424
14781
 
14425
14782
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
14426
14783
  import { useMemo as useMemo11 } from "react";
14427
- import { Fragment as Fragment10, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
14784
+ import { Fragment as Fragment10, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
14428
14785
  var PriceText = ({
14429
14786
  feature,
14430
14787
  period,
@@ -14434,42 +14791,42 @@ var PriceText = ({
14434
14791
  }) => {
14435
14792
  const text = useMemo11(() => {
14436
14793
  if (!flatAmount && perUnitPrice) {
14437
- return /* @__PURE__ */ jsxs18(Fragment10, { children: [
14794
+ return /* @__PURE__ */ jsxs19(Fragment10, { children: [
14438
14795
  formatCurrency(perUnitPrice, currency),
14439
- /* @__PURE__ */ jsxs18("sub", { children: [
14796
+ /* @__PURE__ */ jsxs19("sub", { children: [
14440
14797
  "/",
14441
14798
  getFeatureName(feature, 1)
14442
14799
  ] })
14443
14800
  ] });
14444
14801
  }
14445
14802
  if (flatAmount && !perUnitPrice) {
14446
- return /* @__PURE__ */ jsxs18(Fragment10, { children: [
14803
+ return /* @__PURE__ */ jsxs19(Fragment10, { children: [
14447
14804
  formatCurrency(flatAmount, currency),
14448
- period && /* @__PURE__ */ jsxs18("sub", { children: [
14805
+ period && /* @__PURE__ */ jsxs19("sub", { children: [
14449
14806
  "/",
14450
14807
  shortenPeriod(period)
14451
14808
  ] })
14452
14809
  ] });
14453
14810
  }
14454
- return /* @__PURE__ */ jsxs18(Fragment10, { children: [
14811
+ return /* @__PURE__ */ jsxs19(Fragment10, { children: [
14455
14812
  formatCurrency(perUnitPrice, currency),
14456
- /* @__PURE__ */ jsxs18("sub", { children: [
14813
+ /* @__PURE__ */ jsxs19("sub", { children: [
14457
14814
  "/",
14458
14815
  getFeatureName(feature, 1)
14459
14816
  ] }),
14460
14817
  " + ",
14461
14818
  formatCurrency(flatAmount, currency),
14462
- period && /* @__PURE__ */ jsxs18("sub", { children: [
14819
+ period && /* @__PURE__ */ jsxs19("sub", { children: [
14463
14820
  "/",
14464
14821
  shortenPeriod(period)
14465
14822
  ] })
14466
14823
  ] });
14467
14824
  }, [feature, period, currency, flatAmount, perUnitPrice]);
14468
- return /* @__PURE__ */ jsx23(Text, { $leading: 1, children: text });
14825
+ return /* @__PURE__ */ jsx24(Text, { $leading: 1, children: text });
14469
14826
  };
14470
14827
 
14471
14828
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
14472
- import { Fragment as Fragment11, jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
14829
+ import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
14473
14830
  var PricingTiersTooltip = ({
14474
14831
  feature,
14475
14832
  period,
@@ -14497,10 +14854,10 @@ var PricingTiersTooltip = ({
14497
14854
  if (!priceTiers.length) {
14498
14855
  return null;
14499
14856
  }
14500
- return /* @__PURE__ */ jsx24(
14857
+ return /* @__PURE__ */ jsx25(
14501
14858
  Tooltip,
14502
14859
  {
14503
- trigger: /* @__PURE__ */ jsx24(
14860
+ trigger: /* @__PURE__ */ jsx25(
14504
14861
  Icon3,
14505
14862
  {
14506
14863
  title: "tiered pricing",
@@ -14509,22 +14866,23 @@ var PricingTiersTooltip = ({
14509
14866
  style: { marginLeft: `-${1 / 3}rem` }
14510
14867
  }
14511
14868
  ),
14512
- content: /* @__PURE__ */ jsxs19(Flex, { $flexDirection: "column", $gap: "1rem", children: [
14513
- /* @__PURE__ */ jsx24("dl", { children: tiers.map((tier, index) => {
14869
+ content: /* @__PURE__ */ jsxs20(Flex, { $flexDirection: "column", $gap: "1rem", children: [
14870
+ /* @__PURE__ */ jsx25("dl", { children: tiers.map((tier, index) => {
14514
14871
  const flatAmount = typeof tier.flatAmount === "number" ? tier.flatAmount : void 0;
14515
14872
  const perUnitPrice = typeof tier.perUnitPriceDecimal === "string" ? Number(tier.perUnitPriceDecimal) : typeof tier.perUnitPrice === "number" ? tier.perUnitPrice : void 0;
14516
- return /* @__PURE__ */ jsxs19(
14873
+ return /* @__PURE__ */ jsxs20(
14517
14874
  Flex,
14518
14875
  {
14519
14876
  $justifyContent: "space-between",
14877
+ $alignItems: "center",
14520
14878
  $gap: "1rem",
14521
14879
  $padding: "0.5rem",
14522
14880
  children: [
14523
- /* @__PURE__ */ jsx24("dt", { children: /* @__PURE__ */ jsxs19(Text, { children: [
14881
+ /* @__PURE__ */ jsx25("dt", { children: /* @__PURE__ */ jsxs20(Text, { children: [
14524
14882
  tier.from,
14525
- tier.to === Infinity ? "+" : `\u2013${tier.to}`
14883
+ tier.from !== tier.to && /* @__PURE__ */ jsx25(Fragment11, { children: tier.to === Infinity ? "+" : `\u2013${tier.to}` })
14526
14884
  ] }) }),
14527
- /* @__PURE__ */ jsx24("dd", { children: /* @__PURE__ */ jsx24(
14885
+ /* @__PURE__ */ jsx25("dd", { children: /* @__PURE__ */ jsx25(
14528
14886
  PriceText,
14529
14887
  {
14530
14888
  period,
@@ -14539,8 +14897,8 @@ var PricingTiersTooltip = ({
14539
14897
  index
14540
14898
  );
14541
14899
  }) }),
14542
- (tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ jsxs19(Fragment11, { children: [
14543
- /* @__PURE__ */ jsx24(
14900
+ (tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ jsxs20(Fragment11, { children: [
14901
+ /* @__PURE__ */ jsx25(
14544
14902
  "hr",
14545
14903
  {
14546
14904
  style: {
@@ -14550,7 +14908,7 @@ var PricingTiersTooltip = ({
14550
14908
  }
14551
14909
  }
14552
14910
  ),
14553
- /* @__PURE__ */ jsx24(Box, { children: /* @__PURE__ */ jsxs19(Text, { children: [
14911
+ /* @__PURE__ */ jsx25(Box, { children: /* @__PURE__ */ jsxs20(Text, { children: [
14554
14912
  "\u2139\uFE0F",
14555
14913
  " ",
14556
14914
  tiersMode === "volume" /* Volume */ ? t2("Price by unit based on final tier reached.") : t2("Tiers apply progressively as quantity increases.")
@@ -14619,7 +14977,7 @@ var TieredPricingDetails = ({
14619
14977
 
14620
14978
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
14621
14979
  import { useMemo as useMemo14, useRef as useRef8, useState as useState11 } from "react";
14622
- import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
14980
+ import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
14623
14981
  var UnsubscribeDialog = ({ top = 0 }) => {
14624
14982
  const { t: t2 } = useTranslation();
14625
14983
  const { data, setCheckoutState } = useEmbed();
@@ -14663,9 +15021,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14663
15021
  })),
14664
15022
  [currentAddOns, availableAddOns]
14665
15023
  );
14666
- return /* @__PURE__ */ jsxs20(Modal2, { size: "auto", top, contentRef, children: [
14667
- /* @__PURE__ */ jsx25(ModalHeader, {}),
14668
- /* @__PURE__ */ jsxs20(
15024
+ return /* @__PURE__ */ jsxs21(Modal2, { size: "auto", top, contentRef, children: [
15025
+ /* @__PURE__ */ jsx26(ModalHeader, {}),
15026
+ /* @__PURE__ */ jsxs21(
14669
15027
  Flex,
14670
15028
  {
14671
15029
  $position: "relative",
@@ -14676,7 +15034,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14676
15034
  }
14677
15035
  },
14678
15036
  children: [
14679
- /* @__PURE__ */ jsxs20(
15037
+ /* @__PURE__ */ jsxs21(
14680
15038
  Flex,
14681
15039
  {
14682
15040
  $flexDirection: "column",
@@ -14686,9 +15044,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14686
15044
  $marginTop: "-2.5rem",
14687
15045
  $padding: "0 2.5rem 2.5rem",
14688
15046
  children: [
14689
- /* @__PURE__ */ jsxs20(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
14690
- /* @__PURE__ */ jsx25(Text, { as: "h2", display: "heading2", children: t2("Cancel subscription") }),
14691
- /* @__PURE__ */ jsxs20(Text, { as: "p", children: [
15047
+ /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
15048
+ /* @__PURE__ */ jsx26(Text, { as: "h2", display: "heading2", children: t2("Cancel subscription") }),
15049
+ /* @__PURE__ */ jsxs21(Text, { as: "p", children: [
14692
15050
  t2(
14693
15051
  "You will retain access to your plan until the end of the billing period, on"
14694
15052
  ),
@@ -14698,9 +15056,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14698
15056
  })
14699
15057
  ] })
14700
15058
  ] }),
14701
- /* @__PURE__ */ jsxs20(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
14702
- /* @__PURE__ */ jsx25(Text, { as: "p", children: t2("Not ready to cancel?") }),
14703
- /* @__PURE__ */ jsx25(
15059
+ /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
15060
+ /* @__PURE__ */ jsx26(Text, { as: "p", children: t2("Not ready to cancel?") }),
15061
+ /* @__PURE__ */ jsx26(
14704
15062
  Button,
14705
15063
  {
14706
15064
  type: "button",
@@ -14721,7 +15079,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14721
15079
  ]
14722
15080
  }
14723
15081
  ),
14724
- /* @__PURE__ */ jsx25(
15082
+ /* @__PURE__ */ jsx26(
14725
15083
  Sidebar,
14726
15084
  {
14727
15085
  planPeriod,
@@ -14742,11 +15100,11 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14742
15100
  };
14743
15101
 
14744
15102
  // src/components/ui/badge/Badge.tsx
14745
- import { jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
15103
+ import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
14746
15104
  var Badge = () => {
14747
15105
  const { t: t2 } = useTranslation();
14748
15106
  const { settings } = useEmbed();
14749
- return /* @__PURE__ */ jsxs21(
15107
+ return /* @__PURE__ */ jsxs22(
14750
15108
  Flex,
14751
15109
  {
14752
15110
  as: "a",
@@ -14759,82 +15117,82 @@ var Badge = () => {
14759
15117
  $gridColumn: "1 / -1",
14760
15118
  $color: settings.theme.typography.text.color,
14761
15119
  children: [
14762
- /* @__PURE__ */ jsxs21(Text, { $size: 12, children: [
15120
+ /* @__PURE__ */ jsxs22(Text, { $size: 12, children: [
14763
15121
  t2("Powered by"),
14764
15122
  " "
14765
15123
  ] }),
14766
- /* @__PURE__ */ jsxs21("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
14767
- /* @__PURE__ */ jsx26(
15124
+ /* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
15125
+ /* @__PURE__ */ jsx27(
14768
15126
  "path",
14769
15127
  {
14770
15128
  d: "M21.2354 6.16227C21.1796 5.95015 21.0494 5.76779 20.8261 5.61893C20.6028 5.46635 20.3423 5.39564 20.0408 5.39564C19.3151 5.39564 18.7941 5.69708 18.7941 6.2367C18.7941 6.49721 18.9095 6.69073 19.1402 6.81726C19.3635 6.94379 19.732 7.07033 20.2344 7.18569C21.0084 7.37177 21.4922 7.51691 21.9686 7.7402C22.203 7.85557 22.3928 7.97465 22.5305 8.10863C22.7948 8.3803 22.9548 8.74501 22.9362 9.20276C22.9176 9.86147 22.6571 10.375 22.1547 10.7397C21.6523 11.1082 20.9563 11.2905 20.0818 11.2905C19.2072 11.2905 18.5597 11.1268 18.0312 10.8067C17.5065 10.4867 17.2013 10.0215 17.1194 9.41116L18.6192 9.27719C18.6974 9.57491 18.8723 9.7982 19.1514 9.94706C19.4305 10.0959 19.7394 10.1778 20.0818 10.1778C20.4614 10.1778 20.7777 10.0996 21.0308 9.9359C21.2838 9.77959 21.4104 9.56002 21.4104 9.28835C21.4104 8.90876 21.0531 8.61104 20.5991 8.43613C20.3683 8.35053 20.0855 8.27238 19.7468 8.19423C19.2705 8.07886 18.8946 7.97094 18.6155 7.87418C18.3364 7.78486 18.0908 7.66205 17.8712 7.51319C17.4358 7.21547 17.2832 6.8247 17.2832 6.2367C17.2832 5.61521 17.5325 5.13141 18.0312 4.79648C18.5262 4.46526 19.2035 4.29407 20.0669 4.29407C21.5853 4.29407 22.5752 4.9044 22.7389 6.05807L21.228 6.16227H21.2354Z",
14771
15129
  fill: "currentColor"
14772
15130
  }
14773
15131
  ),
14774
- /* @__PURE__ */ jsx26(
15132
+ /* @__PURE__ */ jsx27(
14775
15133
  "path",
14776
15134
  {
14777
15135
  d: "M29.4145 8.9796L30.7803 9.55271C30.49 10.0923 30.0621 10.5129 29.5001 10.8217C28.9382 11.1344 28.3167 11.2944 27.6319 11.2944C26.9472 11.2944 26.3629 11.1567 25.8121 10.8701C25.2613 10.5873 24.8147 10.1742 24.4835 9.6383C24.1523 9.09868 23.9811 8.48835 23.9811 7.79987C23.9811 7.11138 24.1486 6.49361 24.4835 5.95771C24.8147 5.41809 25.2613 5.00873 25.8121 4.72589C26.3629 4.44305 26.9732 4.30164 27.6319 4.30164C28.2906 4.30164 28.9382 4.45794 29.5038 4.77427C30.0658 5.08688 30.4938 5.51113 30.7803 6.05075L29.4145 6.62015C29.0535 5.93539 28.3985 5.56323 27.6319 5.56323C27.0327 5.56323 26.5303 5.77536 26.1135 6.19961C25.6967 6.62387 25.492 7.15977 25.492 7.80731C25.492 8.45486 25.6967 8.99076 26.1135 9.40757C26.5303 9.83182 27.0327 10.0439 27.6319 10.0439C28.3985 10.0439 29.0535 9.66807 29.4145 8.98703V8.9796Z",
14778
15136
  fill: "currentColor"
14779
15137
  }
14780
15138
  ),
14781
- /* @__PURE__ */ jsx26(
15139
+ /* @__PURE__ */ jsx27(
14782
15140
  "path",
14783
15141
  {
14784
15142
  d: "M37.4386 11.2049V7.80341C37.4386 6.35945 36.9139 5.59282 35.697 5.59282C35.0978 5.59282 34.614 5.7975 34.2419 6.21059C33.8623 6.61996 33.6725 7.15214 33.6725 7.80713V11.2086H32.1615V1.9234H33.6725V5.47745C34.1004 4.73315 35.001 4.29773 36.1919 4.29773C37.167 4.29773 37.8666 4.59917 38.302 5.19834C38.7375 5.7975 38.9533 6.66834 38.9533 7.80341V11.2049H37.4349H37.4386Z",
14785
15143
  fill: "currentColor"
14786
15144
  }
14787
15145
  ),
14788
- /* @__PURE__ */ jsx26(
15146
+ /* @__PURE__ */ jsx27(
14789
15147
  "path",
14790
15148
  {
14791
15149
  d: "M46.5692 5.38819C47.2167 6.07295 47.5777 7.1187 47.5107 8.30587H41.8242C41.9284 8.83805 42.1741 9.26602 42.5611 9.59352C42.9481 9.92473 43.4022 10.0885 43.9157 10.0885C44.8052 10.0885 45.5234 9.59724 45.8844 8.78222L47.1795 9.40372C46.8818 9.99172 46.4352 10.4495 45.8509 10.7881C45.2629 11.1268 44.6191 11.2943 43.9157 11.2943C42.9295 11.2943 42.0178 10.9444 41.3516 10.3453C40.6855 9.7461 40.2649 8.83432 40.2649 7.79602C40.2649 6.75771 40.6892 5.84222 41.3516 5.23933C42.0178 4.64017 42.9295 4.29034 43.9157 4.29034C44.9801 4.29034 45.9216 4.69971 46.5692 5.38447V5.38819ZM42.5388 6.00224C42.1592 6.32974 41.921 6.75772 41.8205 7.29734H46.0221C45.9179 6.75772 45.6835 6.3223 45.3039 5.99852C44.9243 5.67847 44.4628 5.51473 43.9195 5.51473C43.3761 5.51473 42.9221 5.67847 42.5425 6.00597L42.5388 6.00224Z",
14792
15150
  fill: "currentColor"
14793
15151
  }
14794
15152
  ),
14795
- /* @__PURE__ */ jsx26(
15153
+ /* @__PURE__ */ jsx27(
14796
15154
  "path",
14797
15155
  {
14798
15156
  d: "M59.7699 5.23933C60.1495 5.86827 60.3132 6.68329 60.3132 7.80347V11.2049H58.8023V7.80347C58.8023 6.35952 58.3371 5.59288 57.2318 5.59288C56.6438 5.59288 56.1861 5.79384 55.8586 6.19577C55.5311 6.60141 55.3673 7.13731 55.3673 7.80347V11.2049H53.8489V7.80347C53.8489 6.35952 53.3838 5.59288 52.2785 5.59288C51.6905 5.59288 51.2327 5.79384 50.9052 6.19577C50.574 6.60141 50.4102 7.13731 50.4102 7.80347V11.2049H48.8993V4.39827H50.3433L50.4102 5.47379C50.8196 4.65878 51.5825 4.29407 52.8106 4.29407C53.9606 4.29407 54.7161 4.78531 55.077 5.76407C55.5199 4.81508 56.4428 4.29407 57.7677 4.29407C58.7093 4.29407 59.3829 4.61412 59.7699 5.23562V5.23933Z",
14799
15157
  fill: "currentColor"
14800
15158
  }
14801
15159
  ),
14802
- /* @__PURE__ */ jsx26(
15160
+ /* @__PURE__ */ jsx27(
14803
15161
  "path",
14804
15162
  {
14805
15163
  d: "M67.4264 5.47382L67.4934 4.3983H68.9373V11.205H67.4934L67.4264 10.1294C67.0282 10.9147 66.1797 11.3092 64.8809 11.3017C63.102 11.3427 61.591 9.79823 61.6283 7.8035C61.591 5.8162 63.102 4.2606 64.8809 4.29782C66.0643 4.29782 67.0096 4.7444 67.4264 5.47754V5.47382ZM66.8049 9.37398C67.2217 8.95717 67.4264 8.43243 67.4264 7.79605C67.4264 7.15967 67.2217 6.64238 66.8049 6.21813C66.3881 5.80132 65.8782 5.58919 65.2828 5.58919C64.6874 5.58919 64.1887 5.80132 63.7719 6.21813C63.355 6.64238 63.1504 7.16711 63.1504 7.79605C63.1504 8.42499 63.355 8.95717 63.7719 9.37398C64.1887 9.79823 64.6911 10.0104 65.2828 10.0104C65.8745 10.0104 66.3881 9.79823 66.8049 9.37398Z",
14806
15164
  fill: "currentColor"
14807
15165
  }
14808
15166
  ),
14809
- /* @__PURE__ */ jsx26(
15167
+ /* @__PURE__ */ jsx27(
14810
15168
  "path",
14811
15169
  {
14812
15170
  d: "M71.3891 2.85757H72.8926V4.39828H74.6455V5.58172H72.8926V8.9683C72.8926 9.5898 73.1048 9.90985 73.5923 9.96568C73.89 10.0252 74.2398 10.0141 74.6455 9.9359V11.1863C74.1989 11.257 73.7858 11.2943 73.4062 11.2943C72.6731 11.2943 72.1595 11.1082 71.8543 10.7323C71.5454 10.3639 71.3891 9.79076 71.3891 9.02041V5.58172H70.4215V4.39828H71.3891V2.85757Z",
14813
15171
  fill: "currentColor"
14814
15172
  }
14815
15173
  ),
14816
- /* @__PURE__ */ jsx26(
15174
+ /* @__PURE__ */ jsx27(
14817
15175
  "path",
14818
15176
  {
14819
15177
  d: "M76.1747 3.15526C75.9923 2.98035 75.903 2.76078 75.903 2.50772C75.903 2.25466 75.9923 2.04997 76.1747 1.86762C76.3496 1.69271 76.5691 1.60339 76.8222 1.60339C77.0753 1.60339 77.2874 1.69271 77.4623 1.86762C77.6372 2.04997 77.7265 2.2621 77.7265 2.50772C77.7265 2.75334 77.6372 2.97291 77.4623 3.15526C77.2874 3.33762 77.0678 3.42694 76.8222 3.42694C76.5766 3.42694 76.3496 3.33762 76.1747 3.15526ZM76.0593 4.39826H77.5777V11.2049H76.0593V4.39826Z",
14820
15178
  fill: "currentColor"
14821
15179
  }
14822
15180
  ),
14823
- /* @__PURE__ */ jsx26(
15181
+ /* @__PURE__ */ jsx27(
14824
15182
  "path",
14825
15183
  {
14826
15184
  d: "M84.3023 8.9796L85.6681 9.55271C85.3778 10.0923 84.9498 10.5129 84.3879 10.8217C83.8259 11.1344 83.2044 11.2944 82.5197 11.2944C81.8349 11.2944 81.2506 11.1567 80.6998 10.8701C80.1491 10.5873 79.7025 10.1742 79.3713 9.6383C79.04 9.09868 78.8689 8.48835 78.8689 7.79987C78.8689 7.11138 79.0363 6.49361 79.3713 5.95771C79.7025 5.41809 80.1528 5.00873 80.6998 4.72589C81.2469 4.44305 81.8609 4.30164 82.5197 4.30164C83.1784 4.30164 83.8259 4.45794 84.3916 4.77427C84.9535 5.08688 85.3815 5.51113 85.6681 6.05075L84.3023 6.62015C83.9413 5.93539 83.2863 5.56323 82.5197 5.56323C81.9205 5.56323 81.4181 5.77536 81.0013 6.19961C80.5845 6.62387 80.3798 7.15977 80.3798 7.80731C80.3798 8.45486 80.5845 8.99076 81.0013 9.40757C81.4181 9.83182 81.9205 10.0439 82.5197 10.0439C83.2863 10.0439 83.9413 9.66807 84.3023 8.98703V8.9796Z",
14827
15185
  fill: "currentColor"
14828
15186
  }
14829
15187
  ),
14830
- /* @__PURE__ */ jsx26(
15188
+ /* @__PURE__ */ jsx27(
14831
15189
  "path",
14832
15190
  {
14833
15191
  d: "M5.93091 10.8141L7.2758 9.41753L3.83719 5.84667C2.98568 4.9624 2.98568 3.52157 3.83719 2.63731C4.68871 1.75305 6.07617 1.75305 6.92769 2.63731L10.3663 6.20817L11.7112 4.81156L8.27258 1.24069C6.67975 -0.413401 4.08513 -0.413401 2.4923 1.24069C0.899472 2.89479 0.899472 5.58919 2.4923 7.24328L5.93091 10.8141Z",
14834
15192
  fill: "currentColor"
14835
15193
  }
14836
15194
  ),
14837
- /* @__PURE__ */ jsx26(
15195
+ /* @__PURE__ */ jsx27(
14838
15196
  "path",
14839
15197
  {
14840
15198
  d: "M6.05827 3.54751C5.68761 3.1626 5.08404 3.1626 4.71338 3.54751C4.34272 3.93243 4.34272 4.55921 4.71338 4.94413L9.02103 9.41746L5.93054 12.6268L1.62288 8.15349C1.25223 7.76857 0.648653 7.76857 0.277994 8.15349C-0.0926647 8.5384 -0.0926647 9.16519 0.277994 9.5501L5.93054 15.4201L11.7108 9.41746L6.05827 3.54751Z",
@@ -14848,9 +15206,9 @@ var Badge = () => {
14848
15206
  };
14849
15207
 
14850
15208
  // src/components/layout/RenderLayout.tsx
14851
- import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
15209
+ import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
14852
15210
  var Disabled = () => {
14853
- return /* @__PURE__ */ jsx27(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx27(Card, { children: /* @__PURE__ */ jsxs22(
15211
+ return /* @__PURE__ */ jsx28(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx28(Card, { children: /* @__PURE__ */ jsxs23(
14854
15212
  Element,
14855
15213
  {
14856
15214
  as: Flex,
@@ -14859,8 +15217,8 @@ var Disabled = () => {
14859
15217
  $alignItems: "center",
14860
15218
  $whiteSpace: "nowrap",
14861
15219
  children: [
14862
- /* @__PURE__ */ jsx27(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx27(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
14863
- /* @__PURE__ */ jsx27(Text, { as: "p", children: "Please try again later." })
15220
+ /* @__PURE__ */ jsx28(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx28(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
15221
+ /* @__PURE__ */ jsx28(Text, { as: "p", children: "Please try again later." })
14864
15222
  ]
14865
15223
  }
14866
15224
  ) }) });
@@ -14869,7 +15227,7 @@ var RenderLayout = ({ children }) => {
14869
15227
  const { layout } = useEmbed();
14870
15228
  switch (layout) {
14871
15229
  case "disabled":
14872
- return /* @__PURE__ */ jsx27(Disabled, {});
15230
+ return /* @__PURE__ */ jsx28(Disabled, {});
14873
15231
  default:
14874
15232
  return children;
14875
15233
  }
@@ -14894,7 +15252,7 @@ var StyledViewport = dt.div.withConfig({
14894
15252
  `;
14895
15253
 
14896
15254
  // src/components/layout/viewport/Viewport.tsx
14897
- import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
15255
+ import { Fragment as Fragment12, jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
14898
15256
  var Viewport = forwardRef5(
14899
15257
  ({ children, portal, ...props }, ref) => {
14900
15258
  const { data, layout, settings } = useEmbed();
@@ -14920,24 +15278,24 @@ var Viewport = forwardRef5(
14920
15278
  parent.style.overflow = "";
14921
15279
  };
14922
15280
  }, [portal, layout]);
14923
- return /* @__PURE__ */ jsxs23(Fragment12, { children: [
14924
- /* @__PURE__ */ jsxs23(StyledViewport, { ref, ...props, children: [
14925
- /* @__PURE__ */ jsx28(RenderLayout, { children }),
14926
- isBadgeVisible && /* @__PURE__ */ jsx28(Badge, {})
15281
+ return /* @__PURE__ */ jsxs24(Fragment12, { children: [
15282
+ /* @__PURE__ */ jsxs24(StyledViewport, { ref, ...props, children: [
15283
+ /* @__PURE__ */ jsx29(RenderLayout, { children }),
15284
+ isBadgeVisible && /* @__PURE__ */ jsx29(Badge, {})
14927
15285
  ] }),
14928
- canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx28(CheckoutDialog, { top }), portal || document.body),
15286
+ canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx29(CheckoutDialog, { top }), portal || document.body),
14929
15287
  layout === "unsubscribe" && createPortal2(
14930
- /* @__PURE__ */ jsx28(UnsubscribeDialog, { top }),
15288
+ /* @__PURE__ */ jsx29(UnsubscribeDialog, { top }),
14931
15289
  portal || document.body
14932
15290
  ),
14933
- layout === "payment" && createPortal2(/* @__PURE__ */ jsx28(PaymentDialog, { top }), portal || document.body)
15291
+ layout === "payment" && createPortal2(/* @__PURE__ */ jsx29(PaymentDialog, { top }), portal || document.body)
14934
15292
  ] });
14935
15293
  }
14936
15294
  );
14937
15295
  Viewport.displayName = "Viewport";
14938
15296
 
14939
15297
  // src/components/elements/button/Button.tsx
14940
- import { jsx as jsx29 } from "react/jsx-runtime";
15298
+ import { jsx as jsx30 } from "react/jsx-runtime";
14941
15299
  var resolveDesignProps = (props) => {
14942
15300
  return {
14943
15301
  button: {
@@ -14968,7 +15326,7 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
14968
15326
  variant: "text"
14969
15327
  }
14970
15328
  };
14971
- return /* @__PURE__ */ jsx29(
15329
+ return /* @__PURE__ */ jsx30(
14972
15330
  Element,
14973
15331
  {
14974
15332
  as: Flex,
@@ -14976,7 +15334,7 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
14976
15334
  className,
14977
15335
  $flexDirection: "column",
14978
15336
  $gap: "2rem",
14979
- children: /* @__PURE__ */ jsx29(
15337
+ children: /* @__PURE__ */ jsx30(
14980
15338
  Button,
14981
15339
  {
14982
15340
  as: "a",
@@ -15001,7 +15359,7 @@ import { forwardRef as forwardRef7, useMemo as useMemo17, useRef as useRef9, use
15001
15359
 
15002
15360
  // src/components/elements/included-features/UsageDetails.tsx
15003
15361
  import { Fragment as Fragment13, useMemo as useMemo16 } from "react";
15004
- import { Fragment as Fragment14, jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
15362
+ import { Fragment as Fragment14, jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
15005
15363
  var UsageDetails = ({
15006
15364
  entitlement,
15007
15365
  shouldWrapChildren,
@@ -15011,6 +15369,7 @@ var UsageDetails = ({
15011
15369
  allocation,
15012
15370
  allocationType,
15013
15371
  feature,
15372
+ planEntitlement,
15014
15373
  priceBehavior,
15015
15374
  usage,
15016
15375
  softLimit,
@@ -15031,19 +15390,19 @@ var UsageDetails = ({
15031
15390
  }
15032
15391
  const { price, currency, packageSize = 1 } = billingPrice || {};
15033
15392
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof allocation === "number") {
15034
- return /* @__PURE__ */ jsxs24(Fragment14, { children: [
15393
+ return /* @__PURE__ */ jsxs25(Fragment14, { children: [
15035
15394
  formatNumber(allocation),
15036
15395
  " ",
15037
15396
  getFeatureName(feature, allocation)
15038
15397
  ] });
15039
15398
  }
15040
15399
  if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof price === "number") {
15041
- return /* @__PURE__ */ jsxs24(Fragment14, { children: [
15400
+ return /* @__PURE__ */ jsxs25(Fragment14, { children: [
15042
15401
  formatCurrency(price, currency),
15043
15402
  " ",
15044
15403
  t2("per"),
15045
15404
  " ",
15046
- packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment14, { children: [
15405
+ packageSize > 1 && /* @__PURE__ */ jsxs25(Fragment14, { children: [
15047
15406
  packageSize,
15048
15407
  " "
15049
15408
  ] }),
@@ -15051,22 +15410,36 @@ var UsageDetails = ({
15051
15410
  ] });
15052
15411
  }
15053
15412
  if (priceBehavior === "overage" /* Overage */ && typeof softLimit === "number") {
15054
- return /* @__PURE__ */ jsxs24(Fragment14, { children: [
15413
+ return /* @__PURE__ */ jsxs25(Fragment14, { children: [
15055
15414
  formatNumber(softLimit),
15056
15415
  " ",
15057
15416
  getFeatureName(feature, softLimit)
15058
15417
  ] });
15059
15418
  }
15060
15419
  if (priceBehavior === "tier" /* Tiered */) {
15061
- return /* @__PURE__ */ jsx30(Fragment14, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
15420
+ return /* @__PURE__ */ jsx31(Fragment14, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
15062
15421
  feature: getFeatureName(feature)
15063
15422
  }) : t2("Up to X units in this tier", {
15064
15423
  amount: formatNumber(currentTier.to),
15065
15424
  feature: getFeatureName(feature, currentTier?.to)
15066
15425
  })) });
15067
15426
  }
15427
+ if (priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
15428
+ return /* @__PURE__ */ jsxs25(Fragment14, { children: [
15429
+ planEntitlement.consumptionRate,
15430
+ " ",
15431
+ getFeatureName(
15432
+ planEntitlement.valueCredit,
15433
+ planEntitlement.consumptionRate
15434
+ ),
15435
+ " ",
15436
+ t2("per"),
15437
+ " ",
15438
+ t2("use")
15439
+ ] });
15440
+ }
15068
15441
  if (!priceBehavior && typeof allocation === "number") {
15069
- return /* @__PURE__ */ jsxs24(Fragment14, { children: [
15442
+ return /* @__PURE__ */ jsxs25(Fragment14, { children: [
15070
15443
  formatNumber(allocation),
15071
15444
  " ",
15072
15445
  getFeatureName(feature, allocation)
@@ -15080,6 +15453,7 @@ var UsageDetails = ({
15080
15453
  allocation,
15081
15454
  allocationType,
15082
15455
  feature,
15456
+ planEntitlement,
15083
15457
  priceBehavior,
15084
15458
  softLimit,
15085
15459
  billingPrice,
@@ -15094,10 +15468,10 @@ var UsageDetails = ({
15094
15468
  let index = 0;
15095
15469
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof period === "string" && typeof price === "number") {
15096
15470
  acc.push(
15097
- /* @__PURE__ */ jsxs24(Fragment13, { children: [
15471
+ /* @__PURE__ */ jsxs25(Fragment13, { children: [
15098
15472
  formatCurrency(price, currency),
15099
15473
  "/",
15100
- packageSize > 1 && /* @__PURE__ */ jsxs24(Fragment14, { children: [
15474
+ packageSize > 1 && /* @__PURE__ */ jsxs25(Fragment14, { children: [
15101
15475
  packageSize,
15102
15476
  " "
15103
15477
  ] }),
@@ -15107,9 +15481,9 @@ var UsageDetails = ({
15107
15481
  ] }, index)
15108
15482
  );
15109
15483
  index += 1;
15110
- } else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && typeof usage === "number") {
15484
+ } else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */ || priceBehavior === "credit_burndown" /* Credit */) && typeof usage === "number") {
15111
15485
  acc.push(
15112
- /* @__PURE__ */ jsxs24(Fragment13, { children: [
15486
+ /* @__PURE__ */ jsxs25(Fragment13, { children: [
15113
15487
  usage,
15114
15488
  " ",
15115
15489
  getFeatureName(feature, usage),
@@ -15121,14 +15495,14 @@ var UsageDetails = ({
15121
15495
  }
15122
15496
  if (typeof cost === "number" && cost > 0) {
15123
15497
  acc.push(
15124
- /* @__PURE__ */ jsxs24(Fragment13, { children: [
15125
- acc.length > 0 && /* @__PURE__ */ jsx30(Fragment14, { children: " \u2022 " }),
15498
+ /* @__PURE__ */ jsxs25(Fragment13, { children: [
15499
+ acc.length > 0 && /* @__PURE__ */ jsx31(Fragment14, { children: " \u2022 " }),
15126
15500
  formatCurrency(cost, currency)
15127
15501
  ] }, index)
15128
15502
  );
15129
15503
  index += 1;
15130
15504
  if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
15131
- acc.push(/* @__PURE__ */ jsxs24(Fragment13, { children: [
15505
+ acc.push(/* @__PURE__ */ jsxs25(Fragment13, { children: [
15132
15506
  "/",
15133
15507
  shortenPeriod(period)
15134
15508
  ] }, index));
@@ -15137,8 +15511,8 @@ var UsageDetails = ({
15137
15511
  }
15138
15512
  if (metricResetAt) {
15139
15513
  acc.push(
15140
- /* @__PURE__ */ jsxs24(Fragment13, { children: [
15141
- acc.length > 0 && /* @__PURE__ */ jsx30(Fragment14, { children: " \u2022 " }),
15514
+ /* @__PURE__ */ jsxs25(Fragment13, { children: [
15515
+ acc.length > 0 && /* @__PURE__ */ jsx31(Fragment14, { children: " \u2022 " }),
15142
15516
  t2("Resets", {
15143
15517
  date: toPrettyDate(metricResetAt, {
15144
15518
  month: "numeric",
@@ -15175,16 +15549,16 @@ var UsageDetails = ({
15175
15549
  if (!text || !feature?.name) {
15176
15550
  return null;
15177
15551
  }
15178
- return /* @__PURE__ */ jsxs24(
15552
+ return /* @__PURE__ */ jsxs25(
15179
15553
  Box,
15180
15554
  {
15181
15555
  $flexBasis: "min-content",
15182
15556
  $flexGrow: "1",
15183
15557
  $textAlign: shouldWrapChildren ? "left" : "right",
15184
15558
  children: [
15185
- layout.entitlement.isVisible && /* @__PURE__ */ jsx30(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx30(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
15186
- layout.usage.isVisible && usageText && /* @__PURE__ */ jsxs24(Flex, { $justifyContent: "end", $alignItems: "center", $whiteSpace: "nowrap", children: [
15187
- priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx30(
15559
+ layout.entitlement.isVisible && /* @__PURE__ */ jsx31(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx31(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
15560
+ layout.usage.isVisible && usageText && /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "end", $alignItems: "center", $whiteSpace: "nowrap", children: [
15561
+ priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx31(
15188
15562
  PricingTiersTooltip,
15189
15563
  {
15190
15564
  feature,
@@ -15193,7 +15567,7 @@ var UsageDetails = ({
15193
15567
  priceTiers: billingPrice?.priceTier
15194
15568
  }
15195
15569
  ),
15196
- /* @__PURE__ */ jsx30(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText })
15570
+ /* @__PURE__ */ jsx31(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText })
15197
15571
  ] })
15198
15572
  ]
15199
15573
  }
@@ -15201,7 +15575,7 @@ var UsageDetails = ({
15201
15575
  };
15202
15576
 
15203
15577
  // src/components/elements/included-features/IncludedFeatures.tsx
15204
- import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
15578
+ import { jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
15205
15579
  function resolveDesignProps2(props) {
15206
15580
  return {
15207
15581
  header: {
@@ -15276,7 +15650,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15276
15650
  }
15277
15651
  const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
15278
15652
  const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
15279
- return /* @__PURE__ */ jsxs25(
15653
+ return /* @__PURE__ */ jsxs26(
15280
15654
  Element,
15281
15655
  {
15282
15656
  as: Flex,
@@ -15285,10 +15659,10 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15285
15659
  $flexDirection: "column",
15286
15660
  $gap: "1rem",
15287
15661
  children: [
15288
- props.header.isVisible && /* @__PURE__ */ jsx31(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx31(Text, { display: props.header.fontStyle, children: props.header.text }) }),
15662
+ props.header.isVisible && /* @__PURE__ */ jsx32(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx32(Text, { display: props.header.fontStyle, children: props.header.text }) }),
15289
15663
  featureUsage.slice(0, showCount).map((entitlement, index) => {
15290
15664
  const shouldShowDetails = entitlement.feature?.name && (entitlement.feature?.featureType === "event" /* Event */ || entitlement.feature?.featureType === "trait" /* Trait */);
15291
- return /* @__PURE__ */ jsxs25(
15665
+ return /* @__PURE__ */ jsxs26(
15292
15666
  Flex,
15293
15667
  {
15294
15668
  ref: (el) => {
@@ -15301,7 +15675,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15301
15675
  $alignItems: "center",
15302
15676
  $gap: "1rem",
15303
15677
  children: [
15304
- /* @__PURE__ */ jsxs25(
15678
+ /* @__PURE__ */ jsxs26(
15305
15679
  Flex,
15306
15680
  {
15307
15681
  $alignItems: "center",
@@ -15309,7 +15683,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15309
15683
  $flexBasis: "min-content",
15310
15684
  $gap: "1rem",
15311
15685
  children: [
15312
- props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ jsx31(
15686
+ props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ jsx32(
15313
15687
  Icon3,
15314
15688
  {
15315
15689
  name: entitlement.feature.icon,
@@ -15318,8 +15692,8 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15318
15692
  rounded: true
15319
15693
  }
15320
15694
  ),
15321
- entitlement.feature?.name && /* @__PURE__ */ jsx31(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
15322
- props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ jsxs25(
15695
+ entitlement.feature?.name && /* @__PURE__ */ jsx32(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
15696
+ props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ jsxs26(
15323
15697
  Text,
15324
15698
  {
15325
15699
  display: props.entitlementExpiration.fontStyle,
@@ -15336,7 +15710,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15336
15710
  ]
15337
15711
  }
15338
15712
  ),
15339
- shouldShowDetails && /* @__PURE__ */ jsx31(
15713
+ shouldShowDetails && /* @__PURE__ */ jsx32(
15340
15714
  UsageDetails,
15341
15715
  {
15342
15716
  entitlement,
@@ -15349,15 +15723,15 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
15349
15723
  index
15350
15724
  );
15351
15725
  }),
15352
- shouldShowExpand && /* @__PURE__ */ jsxs25(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
15353
- /* @__PURE__ */ jsx31(
15726
+ shouldShowExpand && /* @__PURE__ */ jsxs26(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
15727
+ /* @__PURE__ */ jsx32(
15354
15728
  Icon3,
15355
15729
  {
15356
15730
  name: isExpanded ? "chevron-up" : "chevron-down",
15357
15731
  color: "#D0D0D0"
15358
15732
  }
15359
15733
  ),
15360
- /* @__PURE__ */ jsx31(
15734
+ /* @__PURE__ */ jsx32(
15361
15735
  Text,
15362
15736
  {
15363
15737
  onClick: handleToggleShowAll,
@@ -15375,7 +15749,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
15375
15749
 
15376
15750
  // src/components/elements/invoices/Invoices.tsx
15377
15751
  import { forwardRef as forwardRef8, useCallback as useCallback10, useEffect as useEffect6, useState as useState14 } from "react";
15378
- import { Fragment as Fragment15, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
15752
+ import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
15379
15753
  function resolveDesignProps3(props) {
15380
15754
  return {
15381
15755
  header: {
@@ -15445,9 +15819,9 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
15445
15819
  if (invoices.length === 0) {
15446
15820
  return null;
15447
15821
  }
15448
- return /* @__PURE__ */ jsxs26(Element, { ref, className, children: [
15449
- /* @__PURE__ */ jsx32(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx32(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
15450
- error ? /* @__PURE__ */ jsxs26(
15822
+ return /* @__PURE__ */ jsxs27(Element, { ref, className, children: [
15823
+ /* @__PURE__ */ jsx33(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx33(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
15824
+ error ? /* @__PURE__ */ jsxs27(
15451
15825
  Flex,
15452
15826
  {
15453
15827
  as: TransitionBox,
@@ -15456,8 +15830,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
15456
15830
  $alignItems: "center",
15457
15831
  $gap: "1rem",
15458
15832
  children: [
15459
- /* @__PURE__ */ jsx32(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
15460
- /* @__PURE__ */ jsx32(
15833
+ /* @__PURE__ */ jsx33(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
15834
+ /* @__PURE__ */ jsx33(
15461
15835
  Button,
15462
15836
  {
15463
15837
  type: "button",
@@ -15470,12 +15844,12 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
15470
15844
  )
15471
15845
  ]
15472
15846
  }
15473
- ) : !isLoading && /* @__PURE__ */ jsx32(TransitionBox, { children: /* @__PURE__ */ jsxs26(Flex, { $flexDirection: "column", $gap: "1rem", children: [
15474
- props.header.isVisible && /* @__PURE__ */ jsx32(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx32(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
15475
- invoices.length > 0 ? /* @__PURE__ */ jsxs26(Fragment15, { children: [
15476
- /* @__PURE__ */ jsx32(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
15477
- return /* @__PURE__ */ jsxs26(Flex, { $justifyContent: "space-between", children: [
15478
- props.date.isVisible && /* @__PURE__ */ jsx32(
15847
+ ) : !isLoading && /* @__PURE__ */ jsx33(TransitionBox, { children: /* @__PURE__ */ jsxs27(Flex, { $flexDirection: "column", $gap: "1rem", children: [
15848
+ props.header.isVisible && /* @__PURE__ */ jsx33(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx33(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
15849
+ invoices.length > 0 ? /* @__PURE__ */ jsxs27(Fragment15, { children: [
15850
+ /* @__PURE__ */ jsx33(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
15851
+ return /* @__PURE__ */ jsxs27(Flex, { $justifyContent: "space-between", children: [
15852
+ props.date.isVisible && /* @__PURE__ */ jsx33(
15479
15853
  Text,
15480
15854
  {
15481
15855
  display: props.date.fontStyle,
@@ -15489,18 +15863,18 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
15489
15863
  children: date
15490
15864
  }
15491
15865
  ),
15492
- props.amount.isVisible && /* @__PURE__ */ jsx32(Text, { display: props.amount.fontStyle, children: amount })
15866
+ props.amount.isVisible && /* @__PURE__ */ jsx33(Text, { display: props.amount.fontStyle, children: amount })
15493
15867
  ] }, index);
15494
15868
  }) }),
15495
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs26(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15496
- /* @__PURE__ */ jsx32(
15869
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs27(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15870
+ /* @__PURE__ */ jsx33(
15497
15871
  Icon3,
15498
15872
  {
15499
15873
  name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
15500
15874
  color: "#D0D0D0"
15501
15875
  }
15502
15876
  ),
15503
- /* @__PURE__ */ jsx32(
15877
+ /* @__PURE__ */ jsx33(
15504
15878
  Text,
15505
15879
  {
15506
15880
  onClick: toggleListSize,
@@ -15512,24 +15886,24 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
15512
15886
  }
15513
15887
  )
15514
15888
  ] })
15515
- ] }) : /* @__PURE__ */ jsx32(Text, { display: "heading2", children: t2("No invoices created yet") })
15889
+ ] }) : /* @__PURE__ */ jsx33(Text, { display: "heading2", children: t2("No invoices created yet") })
15516
15890
  ] }) })
15517
15891
  ] });
15518
15892
  });
15519
15893
  Invoices.displayName = "Invoices";
15520
15894
 
15521
15895
  // src/components/elements/metered-features/MeteredFeatures.tsx
15522
- import { forwardRef as forwardRef9, useMemo as useMemo18, useRef as useRef10 } from "react";
15896
+ import { forwardRef as forwardRef9, useCallback as useCallback11, useMemo as useMemo18, useRef as useRef10, useState as useState15 } from "react";
15523
15897
 
15524
15898
  // src/components/elements/metered-features/Meter.tsx
15525
- import { jsx as jsx33 } from "react/jsx-runtime";
15899
+ import { jsx as jsx34 } from "react/jsx-runtime";
15526
15900
  var Meter = ({ entitlement, usageDetails }) => {
15527
15901
  const { priceBehavior, usage } = entitlement;
15528
15902
  const limit = usageDetails.limit ?? usageDetails.currentTier?.to;
15529
15903
  if (typeof usage !== "number" || !limit || limit === Infinity) {
15530
15904
  return null;
15531
15905
  }
15532
- const meter = /* @__PURE__ */ jsx33(
15906
+ const meter = /* @__PURE__ */ jsx34(
15533
15907
  ProgressBar,
15534
15908
  {
15535
15909
  progress: Math.min(usage, limit) / Math.max(usage, limit) * 100,
@@ -15546,7 +15920,7 @@ var Meter = ({ entitlement, usageDetails }) => {
15546
15920
  };
15547
15921
 
15548
15922
  // src/components/elements/metered-features/PriceDetails.tsx
15549
- import { Fragment as Fragment16, jsx as jsx34, jsxs as jsxs27 } from "react/jsx-runtime";
15923
+ import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
15550
15924
  var PriceDetails = ({
15551
15925
  entitlement,
15552
15926
  usageDetails,
@@ -15573,7 +15947,7 @@ var PriceDetails = ({
15573
15947
  if (!feature || typeof currentTierPerUnitPrice !== "number") {
15574
15948
  return null;
15575
15949
  }
15576
- return /* @__PURE__ */ jsxs27(
15950
+ return /* @__PURE__ */ jsxs28(
15577
15951
  Flex,
15578
15952
  {
15579
15953
  $justifyContent: "space-between",
@@ -15587,30 +15961,30 @@ var PriceDetails = ({
15587
15961
  $borderBottomRightRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`
15588
15962
  },
15589
15963
  children: [
15590
- priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ jsxs27(Text, { children: [
15964
+ priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ jsxs28(Text, { children: [
15591
15965
  t2("Additional"),
15592
15966
  ": ",
15593
15967
  formatCurrency(currentTierPerUnitPrice, currency),
15594
- /* @__PURE__ */ jsxs27(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15968
+ /* @__PURE__ */ jsxs28(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15595
15969
  "/",
15596
- packageSize > 1 && /* @__PURE__ */ jsxs27(Fragment16, { children: [
15970
+ packageSize > 1 && /* @__PURE__ */ jsxs28(Fragment16, { children: [
15597
15971
  packageSize,
15598
15972
  " "
15599
15973
  ] }),
15600
15974
  getFeatureName(feature, packageSize),
15601
- feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ jsxs27(Fragment16, { children: [
15975
+ feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ jsxs28(Fragment16, { children: [
15602
15976
  "/",
15603
15977
  shortenPeriod(period)
15604
15978
  ] })
15605
15979
  ] })
15606
- ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs27(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15607
- /* @__PURE__ */ jsxs27(Text, { children: [
15980
+ ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs28(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15981
+ /* @__PURE__ */ jsxs28(Text, { children: [
15608
15982
  t2("Tier"),
15609
15983
  ": ",
15610
15984
  currentTier?.from || 1,
15611
- typeof currentTier?.to === "number" && (currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}`)
15985
+ typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */ jsx35(Fragment16, { children: currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}` })
15612
15986
  ] }),
15613
- /* @__PURE__ */ jsx34(
15987
+ /* @__PURE__ */ jsx35(
15614
15988
  PricingTiersTooltip,
15615
15989
  {
15616
15990
  period,
@@ -15621,19 +15995,19 @@ var PriceDetails = ({
15621
15995
  }
15622
15996
  )
15623
15997
  ] }),
15624
- typeof amount === "number" && /* @__PURE__ */ jsx34(Fragment16, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ jsxs27(Text, { children: [
15998
+ typeof amount === "number" && /* @__PURE__ */ jsx35(Fragment16, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ jsxs28(Text, { children: [
15625
15999
  formatNumber(amount),
15626
16000
  " ",
15627
16001
  getFeatureName(feature, amount),
15628
16002
  " \xB7 ",
15629
16003
  formatCurrency(currentTierPerUnitPrice * amount, currency),
15630
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ jsxs27(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16004
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ jsxs28(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15631
16005
  "/",
15632
16006
  shortenPeriod(period)
15633
16007
  ] })
15634
- ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ jsxs27(Text, { children: [
16008
+ ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ jsxs28(Text, { children: [
15635
16009
  formatCurrency(cost, currency),
15636
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ jsxs27(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16010
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ jsxs28(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15637
16011
  "/",
15638
16012
  shortenPeriod(period)
15639
16013
  ] })
@@ -15661,7 +16035,7 @@ var Container2 = dt.div`
15661
16035
  `;
15662
16036
 
15663
16037
  // src/components/elements/metered-features/MeteredFeatures.tsx
15664
- import { Fragment as Fragment17, jsx as jsx35, jsxs as jsxs28 } from "react/jsx-runtime";
16038
+ import { Fragment as Fragment17, jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
15665
16039
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
15666
16040
  const { t: t2 } = useTranslation();
15667
16041
  const { feature, priceBehavior, allocation, usage, metricResetAt } = entitlement;
@@ -15690,7 +16064,7 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
15690
16064
  })
15691
16065
  );
15692
16066
  }
15693
- return /* @__PURE__ */ jsx35(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx35(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
16067
+ return /* @__PURE__ */ jsx36(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx36(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
15694
16068
  };
15695
16069
  function resolveDesignProps4(props) {
15696
16070
  return {
@@ -15724,7 +16098,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
15724
16098
  const { t: t2 } = useTranslation();
15725
16099
  const { data, settings, setCheckoutState } = useEmbed();
15726
16100
  const isLightBackground = useIsLightBackground();
15727
- const { meteredFeatures, period } = useMemo18(() => {
16101
+ const { period, meteredFeatures, creditGroups } = useMemo18(() => {
15728
16102
  if (isCheckoutData(data)) {
15729
16103
  const period2 = typeof data.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0;
15730
16104
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
@@ -15740,122 +16114,292 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
15740
16114
  []
15741
16115
  );
15742
16116
  return {
16117
+ period: period2,
15743
16118
  meteredFeatures: (orderedFeatureUsage || data.featureUsage?.features || []).filter(
15744
- ({ feature }) => feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */
16119
+ ({ priceBehavior, feature }) => (
16120
+ // credit-based entitlements behave differently and should not be shown as a metered feature
16121
+ priceBehavior !== "credit_burndown" /* Credit */ && (feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */)
16122
+ )
15745
16123
  ),
15746
- period: period2
16124
+ creditGroups: groupCreditGrants(data.creditGrants, {
16125
+ groupBy: "credit"
16126
+ })
15747
16127
  };
15748
16128
  }
15749
16129
  return {
16130
+ period: void 0,
15750
16131
  meteredFeatures: [],
15751
- period: void 0
16132
+ creditGroups: []
15752
16133
  };
15753
16134
  }, [props.visibleFeatures, data]);
16135
+ const [creditVisibility, setCreditVisibility] = useState15(
16136
+ creditGroups.map(({ id }) => ({ id, isExpanded: false }))
16137
+ );
16138
+ const toggleBalanceDetails = useCallback11((id) => {
16139
+ setCreditVisibility(
16140
+ (prev2) => prev2.map(
16141
+ (item) => item.id === id ? { ...item, isExpanded: !item.isExpanded } : item
16142
+ )
16143
+ );
16144
+ }, []);
15754
16145
  const shouldShowFeatures = meteredFeatures.length > 0;
15755
16146
  if (!shouldShowFeatures) {
15756
16147
  return null;
15757
16148
  }
15758
- return /* @__PURE__ */ jsx35(Container2, { ref, className, children: meteredFeatures.reduce((acc, entitlement, index) => {
15759
- if (!entitlement.feature) {
16149
+ return /* @__PURE__ */ jsxs29(Container2, { ref, className, children: [
16150
+ meteredFeatures.reduce((acc, entitlement, index) => {
16151
+ if (!entitlement.feature) {
16152
+ return acc;
16153
+ }
16154
+ const { feature, priceBehavior, usage } = entitlement;
16155
+ const usageDetails = getUsageDetails(entitlement, period);
16156
+ const { limit } = usageDetails;
16157
+ acc.push(
16158
+ /* @__PURE__ */ jsxs29(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
16159
+ /* @__PURE__ */ jsxs29(Flex, { $gap: "1.5rem", children: [
16160
+ props.icon.isVisible && /* @__PURE__ */ jsx36(
16161
+ Icon3,
16162
+ {
16163
+ name: feature.icon,
16164
+ color: settings.theme.primary,
16165
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
16166
+ rounded: true
16167
+ }
16168
+ ),
16169
+ /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
16170
+ /* @__PURE__ */ jsxs29(
16171
+ Flex,
16172
+ {
16173
+ ref: (el) => {
16174
+ if (el) {
16175
+ elements.current.push(el);
16176
+ }
16177
+ },
16178
+ $flexWrap: "wrap",
16179
+ $gap: "1rem",
16180
+ children: [
16181
+ /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
16182
+ /* @__PURE__ */ jsx36(Box, { children: /* @__PURE__ */ jsx36(Text, { display: props.header.fontStyle, children: feature.name }) }),
16183
+ props.description.isVisible && /* @__PURE__ */ jsx36(Box, { children: /* @__PURE__ */ jsx36(Text, { display: props.description.fontStyle, children: feature.description }) })
16184
+ ] }),
16185
+ /* @__PURE__ */ jsxs29(
16186
+ Box,
16187
+ {
16188
+ $flexBasis: "min-content",
16189
+ $flexGrow: 1,
16190
+ $textAlign: shouldWrapChildren ? "left" : "right",
16191
+ children: [
16192
+ props.usage.isVisible && /* @__PURE__ */ jsx36(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx36(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ jsxs29(Fragment17, { children: [
16193
+ typeof limit === "number" && /* @__PURE__ */ jsxs29(Fragment17, { children: [
16194
+ formatNumber(limit),
16195
+ " "
16196
+ ] }),
16197
+ getFeatureName(feature, limit)
16198
+ ] }) : typeof usage === "number" && /* @__PURE__ */ jsxs29(Fragment17, { children: [
16199
+ formatNumber(usage),
16200
+ " ",
16201
+ getFeatureName(feature, usage),
16202
+ " ",
16203
+ t2("used")
16204
+ ] }) }) }),
16205
+ props.allocation.isVisible && /* @__PURE__ */ jsx36(
16206
+ Limit,
16207
+ {
16208
+ entitlement,
16209
+ usageDetails,
16210
+ fontStyle: props.allocation.fontStyle
16211
+ }
16212
+ )
16213
+ ]
16214
+ }
16215
+ )
16216
+ ]
16217
+ }
16218
+ ),
16219
+ props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ jsx36(
16220
+ Meter,
16221
+ {
16222
+ entitlement,
16223
+ usageDetails
16224
+ }
16225
+ ),
16226
+ priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsx36(
16227
+ Button,
16228
+ {
16229
+ type: "button",
16230
+ onClick: () => {
16231
+ setCheckoutState({ usage: true });
16232
+ },
16233
+ style: { whiteSpace: "nowrap" },
16234
+ children: t2("Add More")
16235
+ }
16236
+ )
16237
+ ] })
16238
+ ] }),
16239
+ (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ jsx36(
16240
+ PriceDetails,
16241
+ {
16242
+ entitlement,
16243
+ usageDetails,
16244
+ period
16245
+ }
16246
+ )
16247
+ ] }, index)
16248
+ );
15760
16249
  return acc;
15761
- }
15762
- const { feature, priceBehavior, usage } = entitlement;
15763
- const usageDetails = getUsageDetails(entitlement, period);
15764
- const { limit } = usageDetails;
15765
- acc.push(
15766
- /* @__PURE__ */ jsxs28(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
15767
- /* @__PURE__ */ jsxs28(Flex, { $gap: "1.5rem", children: [
15768
- props.icon.isVisible && /* @__PURE__ */ jsx35(
16250
+ }, []),
16251
+ creditGroups.map((credit, index) => {
16252
+ const isExpanded = creditVisibility.find(({ id }) => credit.id === id)?.isExpanded ?? false;
16253
+ return /* @__PURE__ */ jsxs29(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
16254
+ /* @__PURE__ */ jsxs29(Flex, { $gap: "1.5rem", children: [
16255
+ props.icon.isVisible && /* @__PURE__ */ jsx36(
15769
16256
  Icon3,
15770
16257
  {
15771
- name: feature.icon,
16258
+ name: credit.icon,
15772
16259
  color: settings.theme.primary,
15773
16260
  background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
15774
16261
  rounded: true
15775
16262
  }
15776
16263
  ),
15777
- /* @__PURE__ */ jsxs28(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
15778
- /* @__PURE__ */ jsxs28(
15779
- Flex,
15780
- {
15781
- ref: (el) => {
15782
- if (el) {
15783
- elements.current.push(el);
15784
- }
15785
- },
15786
- $flexWrap: "wrap",
15787
- $gap: "1rem",
15788
- children: [
15789
- /* @__PURE__ */ jsxs28(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
15790
- /* @__PURE__ */ jsx35(Box, { children: /* @__PURE__ */ jsx35(Text, { display: props.header.fontStyle, children: feature.name }) }),
15791
- props.description.isVisible && /* @__PURE__ */ jsx35(Box, { children: /* @__PURE__ */ jsx35(Text, { display: props.description.fontStyle, children: feature.description }) })
15792
- ] }),
15793
- /* @__PURE__ */ jsxs28(
15794
- Box,
15795
- {
15796
- $flexBasis: "min-content",
15797
- $flexGrow: 1,
15798
- $textAlign: shouldWrapChildren ? "left" : "right",
15799
- children: [
15800
- props.usage.isVisible && /* @__PURE__ */ jsx35(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx35(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ jsxs28(Fragment17, { children: [
15801
- typeof limit === "number" && /* @__PURE__ */ jsxs28(Fragment17, { children: [
15802
- formatNumber(limit),
15803
- " "
15804
- ] }),
15805
- getFeatureName(feature, limit)
15806
- ] }) : typeof usage === "number" && /* @__PURE__ */ jsxs28(Fragment17, { children: [
15807
- formatNumber(usage),
15808
- " ",
15809
- getFeatureName(feature, usage),
15810
- " ",
15811
- t2("used")
15812
- ] }) }) }),
15813
- props.allocation.isVisible && /* @__PURE__ */ jsx35(
15814
- Limit,
15815
- {
15816
- entitlement,
15817
- usageDetails,
15818
- fontStyle: props.allocation.fontStyle
15819
- }
15820
- )
15821
- ]
15822
- }
15823
- )
15824
- ]
15825
- }
15826
- ),
15827
- props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ jsx35(
15828
- Meter,
15829
- {
15830
- entitlement,
15831
- usageDetails
15832
- }
15833
- ),
15834
- priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsx35(
15835
- Button,
15836
- {
15837
- type: "button",
15838
- onClick: () => {
15839
- setCheckoutState({ usage: true });
15840
- },
15841
- style: { whiteSpace: "nowrap" },
15842
- children: t2("Add More")
15843
- }
15844
- )
16264
+ /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
16265
+ /* @__PURE__ */ jsx36(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
16266
+ /* @__PURE__ */ jsx36(Box, { children: /* @__PURE__ */ jsx36(Text, { display: props.header.fontStyle, children: credit.name }) }),
16267
+ props.description.isVisible && /* @__PURE__ */ jsx36(Box, { children: /* @__PURE__ */ jsx36(Text, { display: props.description.fontStyle, children: credit.description }) })
16268
+ ] }) }),
16269
+ /* @__PURE__ */ jsxs29(Flex, { $gap: "1rem", children: [
16270
+ /* @__PURE__ */ jsx36(
16271
+ ProgressBar,
16272
+ {
16273
+ progress: credit.total.used / credit.total.value * 100,
16274
+ value: credit.total.used,
16275
+ total: credit.total.value,
16276
+ color: progressColorMap[Math.floor(
16277
+ credit.total.used / credit.total.value * (progressColorMap.length - 1)
16278
+ )]
16279
+ }
16280
+ ),
16281
+ /* @__PURE__ */ jsx36(
16282
+ Button,
16283
+ {
16284
+ type: "button",
16285
+ onClick: () => {
16286
+ setCheckoutState({ credits: true });
16287
+ },
16288
+ style: { whiteSpace: "nowrap" },
16289
+ $size: "sm",
16290
+ children: t2("Buy More")
16291
+ }
16292
+ )
16293
+ ] })
15845
16294
  ] })
15846
16295
  ] }),
15847
- (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ jsx35(
15848
- PriceDetails,
16296
+ /* @__PURE__ */ jsx36(
16297
+ Box,
15849
16298
  {
15850
- entitlement,
15851
- usageDetails,
15852
- period
16299
+ $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
16300
+ $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
16301
+ children: /* @__PURE__ */ jsx36(
16302
+ TransitionBox,
16303
+ {
16304
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
16305
+ $isExpanded: isExpanded,
16306
+ children: credit.grants.map((grant, index2) => {
16307
+ const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
16308
+ const padding = index2 > 0 ? `0 ${paddingX}rem 1rem` : `1rem ${paddingX}rem`;
16309
+ return /* @__PURE__ */ jsx36(Box, { $display: "table-row", children: grant.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ jsxs29(Fragment17, { children: [
16310
+ /* @__PURE__ */ jsx36(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx36(Text, { children: t2("X items included in plan", {
16311
+ amount: grant.quantity,
16312
+ item: getFeatureName(credit, grant.quantity)
16313
+ }) }) }),
16314
+ /* @__PURE__ */ jsx36(
16315
+ Box,
16316
+ {
16317
+ $display: "table-cell",
16318
+ $padding: padding,
16319
+ $textAlign: "right",
16320
+ $whiteSpace: "nowrap",
16321
+ children: grant.expiresAt && /* @__PURE__ */ jsx36(Text, { children: t2("Resets", {
16322
+ date: toPrettyDate(
16323
+ modifyDate(grant.expiresAt, 1),
16324
+ {
16325
+ day: "2-digit",
16326
+ month: "2-digit",
16327
+ year: "2-digit"
16328
+ }
16329
+ )
16330
+ }) })
16331
+ }
16332
+ )
16333
+ ] }) : /* @__PURE__ */ jsxs29(Fragment17, { children: [
16334
+ /* @__PURE__ */ jsx36(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx36(Text, { children: grant.grantReason === "purchased" /* Purchased */ ? /* @__PURE__ */ jsx36(Fragment17, { children: t2("X item bundle", {
16335
+ amount: grant.quantity,
16336
+ item: getFeatureName(credit, 1),
16337
+ createdAt: toPrettyDate(grant.createdAt, {
16338
+ day: "2-digit",
16339
+ month: "2-digit",
16340
+ year: "2-digit"
16341
+ })
16342
+ }) }) : /* @__PURE__ */ jsx36(Fragment17, { children: t2("X item grant", {
16343
+ amount: grant.quantity,
16344
+ item: getFeatureName(
16345
+ credit,
16346
+ grant.quantity
16347
+ ),
16348
+ createdAt: toPrettyDate(grant.createdAt, {
16349
+ day: "2-digit",
16350
+ month: "2-digit",
16351
+ year: "2-digit"
16352
+ })
16353
+ }) }) }) }),
16354
+ /* @__PURE__ */ jsx36(
16355
+ Box,
16356
+ {
16357
+ $display: "table-cell",
16358
+ $padding: padding,
16359
+ $textAlign: "right",
16360
+ $whiteSpace: "nowrap",
16361
+ children: grant.expiresAt && /* @__PURE__ */ jsx36(Text, { children: t2("Expires", {
16362
+ date: toPrettyDate(
16363
+ modifyDate(grant.expiresAt, 1),
16364
+ {
16365
+ day: "2-digit",
16366
+ month: "2-digit",
16367
+ year: "2-digit"
16368
+ }
16369
+ )
16370
+ }) })
16371
+ }
16372
+ )
16373
+ ] }) }, grant.id);
16374
+ })
16375
+ }
16376
+ )
15853
16377
  }
15854
- )
15855
- ] }, index)
15856
- );
15857
- return acc;
15858
- }, []) });
16378
+ ),
16379
+ /* @__PURE__ */ jsxs29(Flex, { $gap: "0.25rem", children: [
16380
+ /* @__PURE__ */ jsx36(
16381
+ Icon3,
16382
+ {
16383
+ name: "chevron-down",
16384
+ color: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
16385
+ style: {
16386
+ marginLeft: `-${1 / 3}rem`,
16387
+ ...isExpanded && { transform: "rotate(180deg)" }
16388
+ }
16389
+ }
16390
+ ),
16391
+ /* @__PURE__ */ jsx36(
16392
+ Text,
16393
+ {
16394
+ onClick: () => toggleBalanceDetails(credit.id),
16395
+ display: "link",
16396
+ children: isExpanded ? t2("Hide balance details") : t2("See balance details")
16397
+ }
16398
+ )
16399
+ ] })
16400
+ ] }, index);
16401
+ })
16402
+ ] });
15859
16403
  });
15860
16404
  MeteredFeatures.displayName = "MeteredFeatures";
15861
16405
 
@@ -15864,24 +16408,24 @@ import { forwardRef as forwardRef10, useMemo as useMemo20 } from "react";
15864
16408
 
15865
16409
  // src/components/elements/payment-method/PaymentMethodElement.tsx
15866
16410
  import { useMemo as useMemo19 } from "react";
15867
- import { jsx as jsx36, jsxs as jsxs29 } from "react/jsx-runtime";
16411
+ import { jsx as jsx37, jsxs as jsxs30 } from "react/jsx-runtime";
15868
16412
  var PaymentElement2 = ({
15869
16413
  iconName,
15870
16414
  iconTitle,
15871
16415
  label,
15872
16416
  paymentLast4
15873
16417
  }) => {
15874
- return /* @__PURE__ */ jsx36(Text, { children: /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
15875
- iconName && /* @__PURE__ */ jsx36(Icon3, { name: iconName, title: iconTitle }),
15876
- (label || paymentLast4) && /* @__PURE__ */ jsxs29(Box, { $flexGrow: 1, children: [
15877
- label && /* @__PURE__ */ jsx36(Text, { children: label }),
16418
+ return /* @__PURE__ */ jsx37(Text, { children: /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
16419
+ iconName && /* @__PURE__ */ jsx37(Icon3, { name: iconName, title: iconTitle }),
16420
+ (label || paymentLast4) && /* @__PURE__ */ jsxs30(Box, { $flexGrow: 1, children: [
16421
+ label && /* @__PURE__ */ jsx37(Text, { children: label }),
15878
16422
  " ",
15879
- paymentLast4 && /* @__PURE__ */ jsx36(Text, { children: paymentLast4 })
16423
+ paymentLast4 && /* @__PURE__ */ jsx37(Text, { children: paymentLast4 })
15880
16424
  ] })
15881
16425
  ] }) });
15882
16426
  };
15883
16427
  var EmptyPaymentElement = () => {
15884
- return /* @__PURE__ */ jsx36(Text, { children: /* @__PURE__ */ jsx36(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx36(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx36(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
16428
+ return /* @__PURE__ */ jsx37(Text, { children: /* @__PURE__ */ jsx37(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx37(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx37(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
15885
16429
  };
15886
16430
  var getPaymentMethodData = ({
15887
16431
  accountLast4,
@@ -15946,12 +16490,12 @@ var PaymentMethodElement = ({
15946
16490
  const { t: t2 } = useTranslation();
15947
16491
  const isLightBackground = useIsLightBackground();
15948
16492
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
15949
- return /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
15950
- props.header.isVisible && /* @__PURE__ */ jsxs29(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
15951
- /* @__PURE__ */ jsx36(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
15952
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx36(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
16493
+ return /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
16494
+ props.header.isVisible && /* @__PURE__ */ jsxs30(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
16495
+ /* @__PURE__ */ jsx37(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
16496
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx37(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
15953
16497
  ] }),
15954
- /* @__PURE__ */ jsxs29(
16498
+ /* @__PURE__ */ jsxs30(
15955
16499
  Flex,
15956
16500
  {
15957
16501
  $justifyContent: "space-between",
@@ -15960,8 +16504,8 @@ var PaymentMethodElement = ({
15960
16504
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
15961
16505
  $borderRadius: "9999px",
15962
16506
  children: [
15963
- paymentMethod ? /* @__PURE__ */ jsx36(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx36(EmptyPaymentElement, {}),
15964
- props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx36(
16507
+ paymentMethod ? /* @__PURE__ */ jsx37(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx37(EmptyPaymentElement, {}),
16508
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx37(
15965
16509
  Text,
15966
16510
  {
15967
16511
  onClick: onEdit,
@@ -15994,7 +16538,7 @@ var PaymentListElement = ({
15994
16538
  }
15995
16539
  return `${cardExpMonth}/${formatedYear}`;
15996
16540
  }, [paymentMethod]);
15997
- return /* @__PURE__ */ jsxs29(
16541
+ return /* @__PURE__ */ jsxs30(
15998
16542
  Flex,
15999
16543
  {
16000
16544
  $flexDirection: "row",
@@ -16006,21 +16550,21 @@ var PaymentListElement = ({
16006
16550
  $borderStyle: "solid",
16007
16551
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
16008
16552
  children: [
16009
- iconName && /* @__PURE__ */ jsx36(Icon3, { name: iconName, title: iconTitle }),
16010
- (label || paymentLast4) && /* @__PURE__ */ jsxs29(Box, { $flexGrow: 1, children: [
16011
- label && /* @__PURE__ */ jsx36(Text, { children: label }),
16553
+ iconName && /* @__PURE__ */ jsx37(Icon3, { name: iconName, title: iconTitle }),
16554
+ (label || paymentLast4) && /* @__PURE__ */ jsxs30(Box, { $flexGrow: 1, children: [
16555
+ label && /* @__PURE__ */ jsx37(Text, { children: label }),
16012
16556
  " ",
16013
- paymentLast4 && /* @__PURE__ */ jsx36(Text, { children: paymentLast4 })
16557
+ paymentLast4 && /* @__PURE__ */ jsx37(Text, { children: paymentLast4 })
16014
16558
  ] }),
16015
- expirationDate && /* @__PURE__ */ jsx36(
16559
+ expirationDate && /* @__PURE__ */ jsx37(
16016
16560
  Box,
16017
16561
  {
16018
16562
  $flexGrow: 1,
16019
16563
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
16020
- children: /* @__PURE__ */ jsx36(Text, { children: t("Expires", { date: expirationDate }) })
16564
+ children: /* @__PURE__ */ jsx37(Text, { children: t("Expires", { date: expirationDate }) })
16021
16565
  }
16022
16566
  ),
16023
- /* @__PURE__ */ jsx36(Box, { children: /* @__PURE__ */ jsx36(
16567
+ /* @__PURE__ */ jsx37(Box, { children: /* @__PURE__ */ jsx37(
16024
16568
  Text,
16025
16569
  {
16026
16570
  onClick: () => {
@@ -16033,7 +16577,7 @@ var PaymentListElement = ({
16033
16577
  children: t("Set default")
16034
16578
  }
16035
16579
  ) }),
16036
- /* @__PURE__ */ jsx36(
16580
+ /* @__PURE__ */ jsx37(
16037
16581
  Icon3,
16038
16582
  {
16039
16583
  tabIndex: 0,
@@ -16055,7 +16599,7 @@ var PaymentListElement = ({
16055
16599
  };
16056
16600
 
16057
16601
  // src/components/elements/payment-method/PaymentMethod.tsx
16058
- import { jsx as jsx37 } from "react/jsx-runtime";
16602
+ import { jsx as jsx38 } from "react/jsx-runtime";
16059
16603
  var resolveDesignProps5 = (props) => {
16060
16604
  return {
16061
16605
  header: {
@@ -16096,7 +16640,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
16096
16640
  monthsToExpiration: void 0
16097
16641
  };
16098
16642
  }, [data]);
16099
- return /* @__PURE__ */ jsx37(Element, { ref, className, children: /* @__PURE__ */ jsx37(
16643
+ return /* @__PURE__ */ jsx38(Element, { ref, className, children: /* @__PURE__ */ jsx38(
16100
16644
  PaymentMethodElement,
16101
16645
  {
16102
16646
  paymentMethod,
@@ -16264,8 +16808,8 @@ var loadStripe = function loadStripe2() {
16264
16808
  };
16265
16809
 
16266
16810
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
16267
- import { useCallback as useCallback11, useEffect as useEffect7, useMemo as useMemo21, useState as useState15 } from "react";
16268
- import { jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
16811
+ import { useCallback as useCallback12, useEffect as useEffect7, useMemo as useMemo21, useState as useState16 } from "react";
16812
+ import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
16269
16813
  var resolveDesignProps6 = () => {
16270
16814
  return {
16271
16815
  header: {
@@ -16305,13 +16849,13 @@ var PaymentMethodDetails = ({
16305
16849
  };
16306
16850
  }, [data]);
16307
16851
  const isLightBackground = useIsLightBackground();
16308
- const [isLoading, setIsLoading] = useState15(false);
16309
- const [error, setError] = useState15();
16310
- const [showPaymentForm, setShowPaymentForm] = useState15(false);
16311
- const [stripe, setStripe] = useState15(null);
16312
- const [setupIntent, setSetupIntent] = useState15();
16313
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState15(false);
16314
- const [currentPaymentMethod, setCurrentPaymentMethod] = useState15(subscription?.paymentMethod || defaultPaymentMethod);
16852
+ const [isLoading, setIsLoading] = useState16(false);
16853
+ const [error, setError] = useState16();
16854
+ const [showPaymentForm, setShowPaymentForm] = useState16(false);
16855
+ const [stripe, setStripe] = useState16(null);
16856
+ const [setupIntent, setSetupIntent] = useState16();
16857
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState16(false);
16858
+ const [currentPaymentMethod, setCurrentPaymentMethod] = useState16(subscription?.paymentMethod || defaultPaymentMethod);
16315
16859
  const monthsToExpiration = useMemo21(() => {
16316
16860
  let expiration;
16317
16861
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
@@ -16335,7 +16879,7 @@ var PaymentMethodDetails = ({
16335
16879
  const toggleShowPaymentMethods = () => {
16336
16880
  setShowDifferentPaymentMethods((prev2) => !prev2);
16337
16881
  };
16338
- const initializePaymentMethod = useCallback11(async () => {
16882
+ const initializePaymentMethod = useCallback12(async () => {
16339
16883
  try {
16340
16884
  setIsLoading(true);
16341
16885
  const response = await createSetupIntent();
@@ -16351,7 +16895,7 @@ var PaymentMethodDetails = ({
16351
16895
  setIsLoading(false);
16352
16896
  }
16353
16897
  }, [t2, createSetupIntent]);
16354
- const handleUpdatePaymentMethod = useCallback11(
16898
+ const handleUpdatePaymentMethod = useCallback12(
16355
16899
  async (paymentMethodId) => {
16356
16900
  try {
16357
16901
  setIsLoading(true);
@@ -16370,7 +16914,7 @@ var PaymentMethodDetails = ({
16370
16914
  },
16371
16915
  [t2, setPaymentMethodId, updatePaymentMethod]
16372
16916
  );
16373
- const handleDeletePaymentMethod = useCallback11(
16917
+ const handleDeletePaymentMethod = useCallback12(
16374
16918
  async (paymentMethodId) => {
16375
16919
  try {
16376
16920
  setIsLoading(true);
@@ -16404,8 +16948,8 @@ var PaymentMethodDetails = ({
16404
16948
  showPaymentForm,
16405
16949
  initializePaymentMethod
16406
16950
  ]);
16407
- return /* @__PURE__ */ jsxs30(Flex, { $position: "relative", children: [
16408
- /* @__PURE__ */ jsx38(
16951
+ return /* @__PURE__ */ jsxs31(Flex, { $position: "relative", children: [
16952
+ /* @__PURE__ */ jsx39(
16409
16953
  Flex,
16410
16954
  {
16411
16955
  $position: "absolute",
@@ -16414,7 +16958,7 @@ var PaymentMethodDetails = ({
16414
16958
  $alignItems: "center",
16415
16959
  $width: "100%",
16416
16960
  $height: "100%",
16417
- children: /* @__PURE__ */ jsx38(
16961
+ children: /* @__PURE__ */ jsx39(
16418
16962
  Loader,
16419
16963
  {
16420
16964
  $color: settings.theme.primary,
@@ -16424,7 +16968,7 @@ var PaymentMethodDetails = ({
16424
16968
  )
16425
16969
  }
16426
16970
  ),
16427
- /* @__PURE__ */ jsxs30(
16971
+ /* @__PURE__ */ jsxs31(
16428
16972
  Flex,
16429
16973
  {
16430
16974
  $position: "relative",
@@ -16437,7 +16981,7 @@ var PaymentMethodDetails = ({
16437
16981
  $visibility: isLoading ? "hidden" : "visible",
16438
16982
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
16439
16983
  children: [
16440
- setupIntent && showPaymentForm ? /* @__PURE__ */ jsxs30(
16984
+ setupIntent && showPaymentForm ? /* @__PURE__ */ jsxs31(
16441
16985
  Elements,
16442
16986
  {
16443
16987
  stripe,
@@ -16467,7 +17011,7 @@ var PaymentMethodDetails = ({
16467
17011
  clientSecret: setupIntent?.setupIntentClientSecret
16468
17012
  },
16469
17013
  children: [
16470
- /* @__PURE__ */ jsx38(
17014
+ /* @__PURE__ */ jsx39(
16471
17015
  PaymentForm,
16472
17016
  {
16473
17017
  onConfirm: async (paymentMethodId) => {
@@ -16477,7 +17021,7 @@ var PaymentMethodDetails = ({
16477
17021
  }
16478
17022
  }
16479
17023
  ),
16480
- currentPaymentMethod && /* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(
17024
+ currentPaymentMethod && /* @__PURE__ */ jsx39(Box, { children: /* @__PURE__ */ jsx39(
16481
17025
  Text,
16482
17026
  {
16483
17027
  onClick: focusExistingPaymentMethods,
@@ -16490,8 +17034,8 @@ var PaymentMethodDetails = ({
16490
17034
  ) })
16491
17035
  ]
16492
17036
  }
16493
- ) : /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "2rem", children: [
16494
- /* @__PURE__ */ jsx38(
17037
+ ) : /* @__PURE__ */ jsxs31(Flex, { $flexDirection: "column", $gap: "2rem", children: [
17038
+ /* @__PURE__ */ jsx39(
16495
17039
  PaymentMethodElement,
16496
17040
  {
16497
17041
  paymentMethod: currentPaymentMethod,
@@ -16499,8 +17043,8 @@ var PaymentMethodDetails = ({
16499
17043
  ...props
16500
17044
  }
16501
17045
  ),
16502
- paymentMethods.length > 0 && /* @__PURE__ */ jsxs30(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16503
- /* @__PURE__ */ jsx38(
17046
+ paymentMethods.length > 0 && /* @__PURE__ */ jsxs31(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17047
+ /* @__PURE__ */ jsx39(
16504
17048
  Text,
16505
17049
  {
16506
17050
  onClick: toggleShowPaymentMethods,
@@ -16511,17 +17055,17 @@ var PaymentMethodDetails = ({
16511
17055
  children: t2("Choose different payment method")
16512
17056
  }
16513
17057
  ),
16514
- /* @__PURE__ */ jsx38(
17058
+ /* @__PURE__ */ jsx39(
16515
17059
  Icon3,
16516
17060
  {
16517
17061
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down"
16518
17062
  }
16519
17063
  )
16520
17064
  ] }),
16521
- showDifferentPaymentMethods && /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
16522
- /* @__PURE__ */ jsx38(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
17065
+ showDifferentPaymentMethods && /* @__PURE__ */ jsxs31(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
17066
+ /* @__PURE__ */ jsx39(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
16523
17067
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
16524
- ) || []).map((paymentMethod) => /* @__PURE__ */ jsx38(
17068
+ ) || []).map((paymentMethod) => /* @__PURE__ */ jsx39(
16525
17069
  PaymentListElement,
16526
17070
  {
16527
17071
  paymentMethod,
@@ -16530,7 +17074,7 @@ var PaymentMethodDetails = ({
16530
17074
  },
16531
17075
  paymentMethod.id
16532
17076
  )) }),
16533
- (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ jsx38(
17077
+ (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ jsx39(
16534
17078
  Button,
16535
17079
  {
16536
17080
  type: "button",
@@ -16542,7 +17086,7 @@ var PaymentMethodDetails = ({
16542
17086
  )
16543
17087
  ] })
16544
17088
  ] }),
16545
- !isLoading && error && /* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(Text, { $weight: 500, $color: "#DB6669", children: error }) })
17089
+ !isLoading && error && /* @__PURE__ */ jsx39(Box, { children: /* @__PURE__ */ jsx39(Text, { $weight: 500, $color: "#DB6669", children: error }) })
16546
17090
  ]
16547
17091
  }
16548
17092
  )
@@ -16553,9 +17097,9 @@ var PaymentMethodDetails = ({
16553
17097
  import { forwardRef as forwardRef11, useMemo as useMemo23 } from "react";
16554
17098
 
16555
17099
  // src/components/elements/plan-manager/AddOn.tsx
16556
- import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
17100
+ import { jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
16557
17101
  var AddOn = ({ addOn, currency, layout }) => {
16558
- return /* @__PURE__ */ jsxs31(
17102
+ return /* @__PURE__ */ jsxs32(
16559
17103
  Flex,
16560
17104
  {
16561
17105
  $justifyContent: "space-between",
@@ -16563,10 +17107,10 @@ var AddOn = ({ addOn, currency, layout }) => {
16563
17107
  $flexWrap: "wrap",
16564
17108
  $gap: "1rem",
16565
17109
  children: [
16566
- /* @__PURE__ */ jsx39(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
16567
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsxs31(Text, { children: [
17110
+ /* @__PURE__ */ jsx40(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
17111
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsxs32(Text, { children: [
16568
17112
  formatCurrency(addOn.planPrice, currency),
16569
- /* @__PURE__ */ jsx39("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
17113
+ /* @__PURE__ */ jsx40("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
16570
17114
  ] })
16571
17115
  ]
16572
17116
  }
@@ -16575,7 +17119,7 @@ var AddOn = ({ addOn, currency, layout }) => {
16575
17119
 
16576
17120
  // src/components/elements/plan-manager/UsageDetails.tsx
16577
17121
  import { Fragment as Fragment18, useMemo as useMemo22 } from "react";
16578
- import { Fragment as Fragment19, jsx as jsx40, jsxs as jsxs32 } from "react/jsx-runtime";
17122
+ import { Fragment as Fragment19, jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
16579
17123
  var UsageDetails2 = ({
16580
17124
  entitlement,
16581
17125
  period,
@@ -16597,9 +17141,9 @@ var UsageDetails2 = ({
16597
17141
  let index = 0;
16598
17142
  if (entitlement.priceBehavior === "overage" /* Overage */) {
16599
17143
  acc.push(
16600
- amount > 0 ? /* @__PURE__ */ jsx40(Fragment18, { children: t2("X additional", {
17144
+ amount > 0 ? /* @__PURE__ */ jsx41(Fragment18, { children: t2("X additional", {
16601
17145
  amount
16602
- }) }, index) : /* @__PURE__ */ jsxs32(Fragment18, { children: [
17146
+ }) }, index) : /* @__PURE__ */ jsxs33(Fragment18, { children: [
16603
17147
  t2("Additional"),
16604
17148
  ": "
16605
17149
  ] }, index)
@@ -16610,16 +17154,16 @@ var UsageDetails2 = ({
16610
17154
  if (entitlement.priceBehavior !== "tier" /* Tiered */ && entitlement.feature && typeof price === "number" && !amount) {
16611
17155
  const packageSize = billingPrice?.packageSize ?? 1;
16612
17156
  acc.push(
16613
- /* @__PURE__ */ jsxs32(Fragment18, { children: [
17157
+ /* @__PURE__ */ jsxs33(Fragment18, { children: [
16614
17158
  formatCurrency(price, billingPrice?.currency),
16615
- /* @__PURE__ */ jsxs32("sub", { children: [
17159
+ /* @__PURE__ */ jsxs33("sub", { children: [
16616
17160
  "/",
16617
- packageSize > 1 && /* @__PURE__ */ jsxs32(Fragment19, { children: [
17161
+ packageSize > 1 && /* @__PURE__ */ jsxs33(Fragment19, { children: [
16618
17162
  packageSize,
16619
17163
  " "
16620
17164
  ] }),
16621
17165
  getFeatureName(entitlement.feature, packageSize),
16622
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs32(Fragment19, { children: [
17166
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs33(Fragment19, { children: [
16623
17167
  "/",
16624
17168
  shortenPeriod(period)
16625
17169
  ] })
@@ -16628,13 +17172,40 @@ var UsageDetails2 = ({
16628
17172
  );
16629
17173
  index += 1;
16630
17174
  }
17175
+ if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
17176
+ const creditAmount = entitlement.planEntitlement.consumptionRate * amount;
17177
+ acc.push(
17178
+ creditAmount > 0 ? /* @__PURE__ */ jsxs33(Fragment18, { children: [
17179
+ creditAmount,
17180
+ " ",
17181
+ getFeatureName(
17182
+ entitlement.planEntitlement.valueCredit,
17183
+ creditAmount
17184
+ ),
17185
+ " ",
17186
+ t2("used")
17187
+ ] }, index) : /* @__PURE__ */ jsxs33(Fragment18, { children: [
17188
+ entitlement.planEntitlement.consumptionRate,
17189
+ " ",
17190
+ getFeatureName(
17191
+ entitlement.planEntitlement.valueCredit,
17192
+ entitlement.planEntitlement.consumptionRate
17193
+ ),
17194
+ " ",
17195
+ t2("per"),
17196
+ " ",
17197
+ t2("use")
17198
+ ] }, index)
17199
+ );
17200
+ index += 1;
17201
+ }
16631
17202
  return acc;
16632
17203
  }, [t2, period, entitlement, billingPrice, amount]);
16633
17204
  if (!entitlement.feature?.name) {
16634
17205
  return null;
16635
17206
  }
16636
17207
  const quantity = limit || amount;
16637
- return /* @__PURE__ */ jsxs32(
17208
+ return /* @__PURE__ */ jsxs33(
16638
17209
  Flex,
16639
17210
  {
16640
17211
  $justifyContent: "space-between",
@@ -16642,13 +17213,13 @@ var UsageDetails2 = ({
16642
17213
  $flexWrap: "wrap",
16643
17214
  $gap: "0.5rem",
16644
17215
  children: [
16645
- /* @__PURE__ */ jsx40(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ jsxs32(Fragment19, { children: [
17216
+ /* @__PURE__ */ jsx41(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ jsxs33(Fragment19, { children: [
16646
17217
  quantity,
16647
17218
  " ",
16648
- getFeatureName(entitlement.feature, quantity)
16649
- ] }) : getFeatureName(entitlement.feature) }),
16650
- /* @__PURE__ */ jsxs32(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16651
- description.length > 0 && /* @__PURE__ */ jsx40(
17219
+ entitlement.feature.name
17220
+ ] }) : entitlement.feature.name }),
17221
+ /* @__PURE__ */ jsxs33(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17222
+ description.length > 0 && /* @__PURE__ */ jsx41(
16652
17223
  Text,
16653
17224
  {
16654
17225
  style: { opacity: 0.54 },
@@ -16657,8 +17228,8 @@ var UsageDetails2 = ({
16657
17228
  children: description
16658
17229
  }
16659
17230
  ),
16660
- (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ jsxs32(Flex, { $alignItems: "center", children: [
16661
- entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx40(
17231
+ (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ jsxs33(Flex, { $alignItems: "center", children: [
17232
+ entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx41(
16662
17233
  PricingTiersTooltip,
16663
17234
  {
16664
17235
  feature: entitlement.feature,
@@ -16667,9 +17238,9 @@ var UsageDetails2 = ({
16667
17238
  priceTiers: billingPrice?.priceTier
16668
17239
  }
16669
17240
  ),
16670
- /* @__PURE__ */ jsxs32(Text, { children: [
17241
+ /* @__PURE__ */ jsxs33(Text, { children: [
16671
17242
  formatCurrency(cost, billingPrice?.currency),
16672
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs32("sub", { children: [
17243
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs33("sub", { children: [
16673
17244
  "/",
16674
17245
  shortenPeriod(period)
16675
17246
  ] })
@@ -16682,7 +17253,7 @@ var UsageDetails2 = ({
16682
17253
  };
16683
17254
 
16684
17255
  // src/components/elements/plan-manager/PlanManager.tsx
16685
- import { Fragment as Fragment20, jsx as jsx41, jsxs as jsxs33 } from "react/jsx-runtime";
17256
+ import { Fragment as Fragment20, jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
16686
17257
  var resolveDesignProps7 = (props) => {
16687
17258
  return {
16688
17259
  header: {
@@ -16720,6 +17291,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16720
17291
  const {
16721
17292
  currentPlan,
16722
17293
  currentAddOns,
17294
+ creditBundles,
17295
+ creditGroups,
16723
17296
  billingSubscription,
16724
17297
  canCheckout,
16725
17298
  defaultPlan,
@@ -16727,19 +17300,32 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16727
17300
  trialPaymentMethodRequired
16728
17301
  } = useMemo23(() => {
16729
17302
  if (isCheckoutData(data)) {
17303
+ const {
17304
+ company,
17305
+ creditBundles: creditBundles2,
17306
+ creditGrants,
17307
+ capabilities,
17308
+ defaultPlan: defaultPlan2,
17309
+ featureUsage: featureUsage2,
17310
+ trialPaymentMethodRequired: trialPaymentMethodRequired2
17311
+ } = data;
16730
17312
  return {
16731
- currentPlan: data.company?.plan,
16732
- currentAddOns: data.company?.addOns || [],
16733
- billingSubscription: data.company?.billingSubscription,
16734
- canCheckout: data.capabilities?.checkout ?? true,
16735
- defaultPlan: data.defaultPlan,
16736
- featureUsage: data.featureUsage?.features || [],
16737
- trialPaymentMethodRequired: data.trialPaymentMethodRequired
17313
+ currentPlan: company?.plan,
17314
+ currentAddOns: company?.addOns || [],
17315
+ creditBundles: creditBundles2,
17316
+ creditGroups: groupCreditGrants(creditGrants, { groupBy: "bundle" }),
17317
+ billingSubscription: company?.billingSubscription,
17318
+ canCheckout: capabilities?.checkout ?? true,
17319
+ defaultPlan: defaultPlan2,
17320
+ featureUsage: featureUsage2?.features || [],
17321
+ trialPaymentMethodRequired: trialPaymentMethodRequired2
16738
17322
  };
16739
17323
  }
16740
17324
  return {
16741
17325
  currentPlan: void 0,
16742
17326
  currentAddOns: [],
17327
+ creditBundles: [],
17328
+ creditGroups: [],
16743
17329
  billingSubscription: void 0,
16744
17330
  canCheckout: false,
16745
17331
  defaultPlan: void 0,
@@ -16751,19 +17337,26 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16751
17337
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
16752
17338
  [featureUsage]
16753
17339
  );
16754
- const { subscriptionCurrency, willSubscriptionCancel, isTrialSubscription } = useMemo23(() => {
17340
+ const {
17341
+ subscriptionInterval,
17342
+ subscriptionCurrency,
17343
+ willSubscriptionCancel,
17344
+ isTrialSubscription
17345
+ } = useMemo23(() => {
17346
+ const subscriptionInterval2 = billingSubscription?.interval;
16755
17347
  const subscriptionCurrency2 = billingSubscription?.currency;
16756
17348
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
16757
17349
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
16758
17350
  return {
17351
+ subscriptionInterval: subscriptionInterval2,
16759
17352
  subscriptionCurrency: subscriptionCurrency2,
16760
- willSubscriptionCancel: willSubscriptionCancel2,
16761
- isTrialSubscription: isTrialSubscription2
17353
+ isTrialSubscription: isTrialSubscription2,
17354
+ willSubscriptionCancel: willSubscriptionCancel2
16762
17355
  };
16763
17356
  }, [billingSubscription]);
16764
17357
  const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
16765
- return /* @__PURE__ */ jsxs33(Fragment20, { children: [
16766
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs33(
17358
+ return /* @__PURE__ */ jsxs34(Fragment20, { children: [
17359
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs34(
16767
17360
  Notice,
16768
17361
  {
16769
17362
  as: Flex,
@@ -16773,15 +17366,15 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16773
17366
  $textAlign: "center",
16774
17367
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
16775
17368
  children: [
16776
- typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ jsx41(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
16777
- /* @__PURE__ */ jsx41(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : defaultPlan ? t2("After the trial, cancel", {
17369
+ typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ jsx42(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
17370
+ /* @__PURE__ */ jsx42(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : defaultPlan ? t2("After the trial, cancel", {
16778
17371
  defaultPlanName: defaultPlan?.name
16779
17372
  }) : t2("After the trial, cancel no default", {
16780
17373
  planName: currentPlan?.name
16781
17374
  }) })
16782
17375
  ]
16783
17376
  }
16784
- ) : willSubscriptionCancel && /* @__PURE__ */ jsxs33(
17377
+ ) : willSubscriptionCancel && /* @__PURE__ */ jsxs34(
16785
17378
  Notice,
16786
17379
  {
16787
17380
  as: Flex,
@@ -16791,8 +17384,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16791
17384
  $textAlign: "center",
16792
17385
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
16793
17386
  children: [
16794
- /* @__PURE__ */ jsx41(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
16795
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx41(
17387
+ /* @__PURE__ */ jsx42(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
17388
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx42(
16796
17389
  Text,
16797
17390
  {
16798
17391
  as: "p",
@@ -16810,7 +17403,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16810
17403
  ]
16811
17404
  }
16812
17405
  ),
16813
- /* @__PURE__ */ jsxs33(
17406
+ /* @__PURE__ */ jsxs34(
16814
17407
  Element,
16815
17408
  {
16816
17409
  as: Flex,
@@ -16819,20 +17412,19 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16819
17412
  $flexDirection: "column",
16820
17413
  $gap: "2rem",
16821
17414
  children: [
16822
- props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs33(
17415
+ props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs34(
16823
17416
  Flex,
16824
17417
  {
16825
17418
  $justifyContent: "space-between",
16826
17419
  $alignItems: "center",
16827
- $flexWrap: "wrap",
16828
17420
  $gap: "1rem",
16829
17421
  children: [
16830
- /* @__PURE__ */ jsxs33(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16831
- /* @__PURE__ */ jsx41(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
16832
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx41(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
17422
+ /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17423
+ /* @__PURE__ */ jsx42(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
17424
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx42(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
16833
17425
  ] }),
16834
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs33(Box, { children: [
16835
- /* @__PURE__ */ jsx41(
17426
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs34(Box, { children: [
17427
+ /* @__PURE__ */ jsx42(
16836
17428
  Text,
16837
17429
  {
16838
17430
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -16842,7 +17434,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16842
17434
  )
16843
17435
  }
16844
17436
  ),
16845
- !isUsageBasedPlan && /* @__PURE__ */ jsx41(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs33("sub", { children: [
17437
+ !isUsageBasedPlan && /* @__PURE__ */ jsx42(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs34("sub", { children: [
16846
17438
  "/",
16847
17439
  shortenPeriod(currentPlan.planPeriod)
16848
17440
  ] }) })
@@ -16850,8 +17442,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16850
17442
  ]
16851
17443
  }
16852
17444
  ),
16853
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs33(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16854
- props.addOns.showLabel && /* @__PURE__ */ jsx41(
17445
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17446
+ props.addOns.showLabel && /* @__PURE__ */ jsx42(
16855
17447
  Text,
16856
17448
  {
16857
17449
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -16859,7 +17451,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16859
17451
  children: t2("Add-ons")
16860
17452
  }
16861
17453
  ),
16862
- currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx41(
17454
+ /* @__PURE__ */ jsx42(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx42(
16863
17455
  AddOn,
16864
17456
  {
16865
17457
  addOn,
@@ -16867,10 +17459,10 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16867
17459
  layout: props
16868
17460
  },
16869
17461
  addOnIndex
16870
- ))
17462
+ )) })
16871
17463
  ] }),
16872
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs33(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16873
- props.addOns.showLabel && /* @__PURE__ */ jsx41(
17464
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17465
+ props.addOns.showLabel && /* @__PURE__ */ jsx42(
16874
17466
  Text,
16875
17467
  {
16876
17468
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -16878,8 +17470,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16878
17470
  children: t2("Usage-based")
16879
17471
  }
16880
17472
  ),
16881
- usageBasedEntitlements.map((entitlement, entitlementIndex) => {
16882
- return /* @__PURE__ */ jsx41(
17473
+ /* @__PURE__ */ jsx42(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
17474
+ return /* @__PURE__ */ jsx42(
16883
17475
  UsageDetails2,
16884
17476
  {
16885
17477
  entitlement,
@@ -16888,9 +17480,81 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
16888
17480
  },
16889
17481
  entitlementIndex
16890
17482
  );
16891
- })
17483
+ }) })
16892
17484
  ] }),
16893
- canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx41(
17485
+ props.addOns.isVisible && creditGroups.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17486
+ props.addOns.showLabel && /* @__PURE__ */ jsx42(
17487
+ Text,
17488
+ {
17489
+ $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
17490
+ $leading: 1,
17491
+ children: t2("Credits")
17492
+ }
17493
+ ),
17494
+ /* @__PURE__ */ jsx42(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.reduce(
17495
+ (acc, group, groupIndex) => {
17496
+ const bundle = group.grantReason === "purchased" /* Purchased */ && group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
17497
+ acc.push(
17498
+ /* @__PURE__ */ jsxs34(
17499
+ Flex,
17500
+ {
17501
+ $justifyContent: "space-between",
17502
+ $alignItems: "center",
17503
+ $flexWrap: "wrap",
17504
+ $gap: "0.5rem",
17505
+ children: [
17506
+ group.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ jsxs34(Text, { display: props.addOns.fontStyle, children: [
17507
+ group.quantity,
17508
+ " ",
17509
+ getFeatureName(group, group.quantity),
17510
+ " ",
17511
+ subscriptionInterval && /* @__PURE__ */ jsxs34(Fragment20, { children: [
17512
+ t2("per"),
17513
+ " ",
17514
+ t2(subscriptionInterval)
17515
+ ] })
17516
+ ] }) : bundle ? /* @__PURE__ */ jsxs34(Text, { display: props.addOns.fontStyle, children: [
17517
+ group.grants.length > 1 && /* @__PURE__ */ jsxs34(Text, { style: { opacity: 0.5 }, children: [
17518
+ "(",
17519
+ group.grants.length,
17520
+ ")",
17521
+ " "
17522
+ ] }),
17523
+ bundle.name,
17524
+ " (",
17525
+ group.quantity,
17526
+ " ",
17527
+ getFeatureName(group, group.quantity),
17528
+ ")"
17529
+ ] }) : /* @__PURE__ */ jsxs34(Text, { display: props.addOns.fontStyle, children: [
17530
+ group.quantity,
17531
+ " ",
17532
+ getFeatureName(group, group.quantity)
17533
+ ] }),
17534
+ group.total.used > 0 && /* @__PURE__ */ jsxs34(
17535
+ Text,
17536
+ {
17537
+ style: { opacity: 0.54 },
17538
+ $size: 0.875 * settings.theme.typography.text.fontSize,
17539
+ $color: settings.theme.typography.text.color,
17540
+ children: [
17541
+ group.total.used,
17542
+ " ",
17543
+ t2("used")
17544
+ ]
17545
+ }
17546
+ )
17547
+ ]
17548
+ },
17549
+ groupIndex
17550
+ )
17551
+ );
17552
+ return acc;
17553
+ },
17554
+ []
17555
+ ) })
17556
+ ] }),
17557
+ canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx42(
16894
17558
  Button,
16895
17559
  {
16896
17560
  type: "button",
@@ -16916,16 +17580,16 @@ PlanManager.displayName = "PlanManager";
16916
17580
 
16917
17581
  // src/components/elements/pricing-table/PricingTable.tsx
16918
17582
  import {
16919
- Fragment as Fragment23,
17583
+ Fragment as Fragment24,
16920
17584
  forwardRef as forwardRef12,
16921
17585
  useEffect as useEffect8,
16922
17586
  useMemo as useMemo26,
16923
- useState as useState16
17587
+ useState as useState17
16924
17588
  } from "react";
16925
17589
 
16926
17590
  // src/components/elements/pricing-table/AddOn.tsx
16927
17591
  import { useMemo as useMemo24 } from "react";
16928
- import { Fragment as Fragment21, jsx as jsx42, jsxs as jsxs34 } from "react/jsx-runtime";
17592
+ import { Fragment as Fragment21, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
16929
17593
  var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16930
17594
  const { layout } = sharedProps;
16931
17595
  const { t: t2 } = useTranslation();
@@ -16951,7 +17615,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16951
17615
  const isCurrentAddOn = isHydratedPlan(addOn) && addOn.current;
16952
17616
  const isActiveAddOn = isCurrentAddOn && selectedPeriod === currentAddOns.find((currentAddOn) => currentAddOn.id === addOn.id)?.planPeriod;
16953
17617
  const { price: addOnPrice, currency: addOnCurrency } = getAddOnPrice(addOn, selectedPeriod) || {};
16954
- return /* @__PURE__ */ jsxs34(
17618
+ return /* @__PURE__ */ jsxs35(
16955
17619
  Flex,
16956
17620
  {
16957
17621
  $position: "relative",
@@ -16967,17 +17631,17 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16967
17631
  $boxShadow: cardBoxShadow
16968
17632
  },
16969
17633
  children: [
16970
- /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
16971
- /* @__PURE__ */ jsx42(Box, { children: /* @__PURE__ */ jsx42(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
16972
- layout.addOns.showDescription && /* @__PURE__ */ jsx42(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx42(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
16973
- /* @__PURE__ */ jsx42(Box, { children: /* @__PURE__ */ jsxs34(Text, { display: layout.plans.name.fontStyle, children: [
17634
+ /* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
17635
+ /* @__PURE__ */ jsx43(Box, { children: /* @__PURE__ */ jsx43(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
17636
+ layout.addOns.showDescription && /* @__PURE__ */ jsx43(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx43(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
17637
+ /* @__PURE__ */ jsx43(Box, { children: /* @__PURE__ */ jsxs35(Text, { display: layout.plans.name.fontStyle, children: [
16974
17638
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
16975
- /* @__PURE__ */ jsxs34("sub", { children: [
17639
+ /* @__PURE__ */ jsxs35("sub", { children: [
16976
17640
  "/",
16977
17641
  selectedPeriod
16978
17642
  ] })
16979
17643
  ] }) }),
16980
- isActiveAddOn && /* @__PURE__ */ jsx42(
17644
+ isActiveAddOn && /* @__PURE__ */ jsx43(
16981
17645
  Flex,
16982
17646
  {
16983
17647
  $position: "absolute",
@@ -16986,7 +17650,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16986
17650
  $backgroundColor: settings.theme.primary,
16987
17651
  $borderRadius: "9999px",
16988
17652
  $padding: "0.125rem 0.85rem",
16989
- children: /* @__PURE__ */ jsx42(
17653
+ children: /* @__PURE__ */ jsx43(
16990
17654
  Text,
16991
17655
  {
16992
17656
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -16997,7 +17661,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16997
17661
  }
16998
17662
  )
16999
17663
  ] }),
17000
- /* @__PURE__ */ jsxs34(
17664
+ /* @__PURE__ */ jsxs35(
17001
17665
  Flex,
17002
17666
  {
17003
17667
  $flexDirection: "column",
@@ -17005,7 +17669,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17005
17669
  $gap: `${cardPadding}rem`,
17006
17670
  $flexGrow: 1,
17007
17671
  children: [
17008
- layout.addOns.showEntitlements && /* @__PURE__ */ jsx42(
17672
+ layout.addOns.showEntitlements && /* @__PURE__ */ jsx43(
17009
17673
  Flex,
17010
17674
  {
17011
17675
  $flexDirection: "column",
@@ -17014,15 +17678,15 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17014
17678
  $flexGrow: 1,
17015
17679
  children: addOn.entitlements.map((entitlement, entitlementIndex) => {
17016
17680
  const metricPeriodName = getMetricPeriodName(entitlement);
17017
- return /* @__PURE__ */ jsx42(
17681
+ return /* @__PURE__ */ jsx43(
17018
17682
  Flex,
17019
17683
  {
17020
17684
  $flexWrap: "wrap",
17021
17685
  $justifyContent: "space-between",
17022
17686
  $alignItems: "center",
17023
17687
  $gap: "1rem",
17024
- children: /* @__PURE__ */ jsxs34(Flex, { $gap: "1rem", children: [
17025
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx42(
17688
+ children: /* @__PURE__ */ jsxs35(Flex, { $gap: "1rem", children: [
17689
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx43(
17026
17690
  Icon3,
17027
17691
  {
17028
17692
  name: entitlement.feature.icon,
@@ -17031,11 +17695,11 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17031
17695
  rounded: true
17032
17696
  }
17033
17697
  ),
17034
- /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17035
- entitlement.feature?.name && /* @__PURE__ */ jsx42(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ jsx42(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs34(Fragment21, { children: [
17698
+ /* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17699
+ entitlement.feature?.name && /* @__PURE__ */ jsx43(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ jsx43(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs35(Fragment21, { children: [
17036
17700
  entitlement.valueType === "unlimited" /* Unlimited */ ? t2("Unlimited", {
17037
17701
  item: getFeatureName(entitlement.feature)
17038
- }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs34(Fragment21, { children: [
17702
+ }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs35(Fragment21, { children: [
17039
17703
  formatNumber(entitlement.valueNumeric),
17040
17704
  " ",
17041
17705
  getFeatureName(
@@ -17043,14 +17707,14 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17043
17707
  entitlement.valueNumeric
17044
17708
  )
17045
17709
  ] }),
17046
- metricPeriodName && /* @__PURE__ */ jsxs34(Fragment21, { children: [
17710
+ metricPeriodName && /* @__PURE__ */ jsxs35(Fragment21, { children: [
17047
17711
  " ",
17048
17712
  t2("per"),
17049
17713
  " ",
17050
17714
  t2(metricPeriodName)
17051
17715
  ] })
17052
17716
  ] }) : entitlement.feature.name }) }),
17053
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx42(
17717
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx43(
17054
17718
  Text,
17055
17719
  {
17056
17720
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17066,7 +17730,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17066
17730
  })
17067
17731
  }
17068
17732
  ),
17069
- showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ jsx42(
17733
+ showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ jsx43(
17070
17734
  Button,
17071
17735
  {
17072
17736
  type: "button",
@@ -17107,7 +17771,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17107
17771
  import { useMemo as useMemo25 } from "react";
17108
17772
 
17109
17773
  // src/components/elements/pricing-table/Entitlement.tsx
17110
- import { Fragment as Fragment22, jsx as jsx43, jsxs as jsxs35 } from "react/jsx-runtime";
17774
+ import { Fragment as Fragment22, jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
17111
17775
  var Entitlement = ({
17112
17776
  entitlement,
17113
17777
  sharedProps,
@@ -17128,8 +17792,8 @@ var Entitlement = ({
17128
17792
  }
17129
17793
  const limit = entitlement.softLimit ?? entitlement.valueNumeric;
17130
17794
  const metricPeriodName = getMetricPeriodName(entitlement);
17131
- return /* @__PURE__ */ jsxs35(Flex, { $gap: "1rem", children: [
17132
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx43(
17795
+ return /* @__PURE__ */ jsxs36(Flex, { $gap: "1rem", children: [
17796
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx44(
17133
17797
  Icon3,
17134
17798
  {
17135
17799
  name: entitlement.feature.icon,
@@ -17138,46 +17802,46 @@ var Entitlement = ({
17138
17802
  rounded: true
17139
17803
  }
17140
17804
  ),
17141
- entitlement.feature?.name && /* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17142
- /* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
17143
- /* @__PURE__ */ jsx43(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs35(Fragment22, { children: [
17805
+ entitlement.feature?.name && /* @__PURE__ */ jsxs36(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17806
+ /* @__PURE__ */ jsxs36(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
17807
+ /* @__PURE__ */ jsx44(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs36(Fragment22, { children: [
17144
17808
  formatCurrency(entitlementPrice, entitlementCurrency),
17145
17809
  " ",
17146
17810
  t2("per"),
17147
17811
  " ",
17148
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17812
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17149
17813
  entitlementPackageSize,
17150
17814
  " "
17151
17815
  ] }),
17152
17816
  getFeatureName(entitlement.feature, entitlementPackageSize),
17153
- entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17817
+ entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17154
17818
  " ",
17155
17819
  t2("per"),
17156
17820
  " ",
17157
17821
  selectedPeriod
17158
17822
  ] })
17159
- ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ jsx43(
17823
+ ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ jsx44(
17160
17824
  TieredPricingDetails,
17161
17825
  {
17162
17826
  entitlement,
17163
17827
  period: selectedPeriod
17164
17828
  }
17165
- ) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs35(Fragment22, { children: [
17829
+ ) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs36(Fragment22, { children: [
17166
17830
  entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
17167
17831
  item: getFeatureName(entitlement.feature)
17168
- }) : typeof limit === "number" && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17832
+ }) : typeof limit === "number" && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17169
17833
  formatNumber(limit),
17170
17834
  " ",
17171
17835
  getFeatureName(entitlement.feature, limit)
17172
17836
  ] }),
17173
- metricPeriodName && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17837
+ metricPeriodName && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17174
17838
  " ",
17175
17839
  t2("per"),
17176
17840
  " ",
17177
17841
  t2(metricPeriodName)
17178
17842
  ] })
17179
17843
  ] }) : entitlement.feature.name }),
17180
- entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsxs35(
17844
+ entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsxs36(
17181
17845
  Text,
17182
17846
  {
17183
17847
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17187,19 +17851,19 @@ var Entitlement = ({
17187
17851
  " ",
17188
17852
  formatCurrency(entitlementPrice, entitlementCurrency),
17189
17853
  "/",
17190
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17854
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17191
17855
  entitlementPackageSize,
17192
17856
  " "
17193
17857
  ] }),
17194
17858
  getFeatureName(entitlement.feature, entitlementPackageSize),
17195
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs35(Fragment22, { children: [
17859
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs36(Fragment22, { children: [
17196
17860
  "/",
17197
17861
  shortenPeriod(selectedPeriod)
17198
17862
  ] })
17199
17863
  ]
17200
17864
  }
17201
- ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs35(Flex, { $alignItems: "center", children: [
17202
- /* @__PURE__ */ jsx43(
17865
+ ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs36(Flex, { $alignItems: "center", children: [
17866
+ /* @__PURE__ */ jsx44(
17203
17867
  PricingTiersTooltip,
17204
17868
  {
17205
17869
  feature: entitlement.feature,
@@ -17208,7 +17872,7 @@ var Entitlement = ({
17208
17872
  priceTiers: entitlementPriceTiers
17209
17873
  }
17210
17874
  ),
17211
- /* @__PURE__ */ jsx43(
17875
+ /* @__PURE__ */ jsx44(
17212
17876
  Text,
17213
17877
  {
17214
17878
  style: { opacity: 0.54 },
@@ -17219,7 +17883,7 @@ var Entitlement = ({
17219
17883
  )
17220
17884
  ] })
17221
17885
  ] }),
17222
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx43(
17886
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx44(
17223
17887
  Text,
17224
17888
  {
17225
17889
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17232,7 +17896,7 @@ var Entitlement = ({
17232
17896
  };
17233
17897
 
17234
17898
  // src/components/elements/pricing-table/Plan.tsx
17235
- import { jsx as jsx44, jsxs as jsxs36 } from "react/jsx-runtime";
17899
+ import { Fragment as Fragment23, jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
17236
17900
  var Plan2 = ({
17237
17901
  plan,
17238
17902
  index,
@@ -17298,6 +17962,7 @@ var Plan2 = ({
17298
17962
  );
17299
17963
  const isActivePlan = isHydratedPlan(plan) && plan.current && currentPeriod === selectedPeriod;
17300
17964
  const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, selectedPeriod) || {};
17965
+ const credits = isHydratedPlan(plan) ? groupPlanCreditGrants(plan.includedCreditGrants) : [];
17301
17966
  const hasUsageBasedEntitlements = plan.entitlements.some(
17302
17967
  (entitlement) => !!entitlement.priceBehavior
17303
17968
  );
@@ -17305,7 +17970,7 @@ var Plan2 = ({
17305
17970
  const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? settings.theme.typography.heading3 : settings.theme.typography[layout.plans.name.fontStyle];
17306
17971
  const count = entitlementCounts[plan.id];
17307
17972
  const isExpanded = count && count.limit > VISIBLE_ENTITLEMENT_COUNT;
17308
- return /* @__PURE__ */ jsxs36(
17973
+ return /* @__PURE__ */ jsxs37(
17309
17974
  Flex,
17310
17975
  {
17311
17976
  className: "sch-PricingTable_Plan",
@@ -17322,7 +17987,7 @@ var Plan2 = ({
17322
17987
  $boxShadow: cardBoxShadow
17323
17988
  },
17324
17989
  children: [
17325
- /* @__PURE__ */ jsxs36(
17990
+ /* @__PURE__ */ jsxs37(
17326
17991
  Flex,
17327
17992
  {
17328
17993
  $flexDirection: "column",
@@ -17333,9 +17998,9 @@ var Plan2 = ({
17333
17998
  $borderStyle: "solid",
17334
17999
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
17335
18000
  children: [
17336
- /* @__PURE__ */ jsx44(Box, { children: /* @__PURE__ */ jsx44(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
17337
- layout.plans.description.isVisible && /* @__PURE__ */ jsx44(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx44(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
17338
- /* @__PURE__ */ jsx44(Box, { children: /* @__PURE__ */ jsxs36(
18001
+ /* @__PURE__ */ jsx45(Box, { children: /* @__PURE__ */ jsx45(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
18002
+ layout.plans.description.isVisible && /* @__PURE__ */ jsx45(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx45(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
18003
+ /* @__PURE__ */ jsx45(Box, { children: /* @__PURE__ */ jsxs37(
17339
18004
  Text,
17340
18005
  {
17341
18006
  $font: headerPriceFontStyle.fontFamily,
@@ -17344,14 +18009,55 @@ var Plan2 = ({
17344
18009
  $color: headerPriceFontStyle.color,
17345
18010
  children: [
17346
18011
  plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency),
17347
- !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs36("sub", { children: [
18012
+ !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ jsxs37("sub", { children: [
17348
18013
  "/",
17349
18014
  selectedPeriod
17350
18015
  ] })
17351
18016
  ]
17352
18017
  }
17353
18018
  ) }),
17354
- isActivePlan && /* @__PURE__ */ jsx44(
18019
+ credits.length > 0 && /* @__PURE__ */ jsx45(
18020
+ Flex,
18021
+ {
18022
+ $flexDirection: "column",
18023
+ $gap: "1rem",
18024
+ $flexGrow: 1,
18025
+ $marginTop: "0.5rem",
18026
+ children: credits.map((credit, idx) => {
18027
+ return /* @__PURE__ */ jsxs37(Flex, { $gap: "1rem", children: [
18028
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx45(
18029
+ Icon3,
18030
+ {
18031
+ name: credit.icon,
18032
+ color: settings.theme.primary,
18033
+ background: `color-mix(in oklch, ${settings.theme.card.background} 87.5%, ${isLightBackground ? "black" : "white"})`,
18034
+ rounded: true
18035
+ }
18036
+ ),
18037
+ credit.name && /* @__PURE__ */ jsx45(
18038
+ Flex,
18039
+ {
18040
+ $flexDirection: "column",
18041
+ $justifyContent: "center",
18042
+ $gap: "0.5rem",
18043
+ children: /* @__PURE__ */ jsxs37(Text, { children: [
18044
+ credit.quantity,
18045
+ " ",
18046
+ getFeatureName(credit, credit.quantity),
18047
+ credit.period && /* @__PURE__ */ jsxs37(Fragment23, { children: [
18048
+ " ",
18049
+ t2("per"),
18050
+ " ",
18051
+ credit.period
18052
+ ] })
18053
+ ] })
18054
+ }
18055
+ )
18056
+ ] }, idx);
18057
+ })
18058
+ }
18059
+ ),
18060
+ isActivePlan && /* @__PURE__ */ jsx45(
17355
18061
  Flex,
17356
18062
  {
17357
18063
  $position: "absolute",
@@ -17360,7 +18066,7 @@ var Plan2 = ({
17360
18066
  $backgroundColor: settings.theme.primary,
17361
18067
  $borderRadius: "9999px",
17362
18068
  $padding: "0.125rem 0.85rem",
17363
- children: /* @__PURE__ */ jsx44(
18069
+ children: /* @__PURE__ */ jsx45(
17364
18070
  Text,
17365
18071
  {
17366
18072
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -17373,7 +18079,7 @@ var Plan2 = ({
17373
18079
  ]
17374
18080
  }
17375
18081
  ),
17376
- /* @__PURE__ */ jsxs36(
18082
+ /* @__PURE__ */ jsxs37(
17377
18083
  Flex,
17378
18084
  {
17379
18085
  $flexDirection: "column",
@@ -17382,11 +18088,11 @@ var Plan2 = ({
17382
18088
  $gap: `${cardPadding}rem`,
17383
18089
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
17384
18090
  children: [
17385
- layout.plans.showEntitlements && /* @__PURE__ */ jsxs36(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
17386
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx44(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx44(Text, { children: t2("Everything in", {
18091
+ layout.plans.showEntitlements && /* @__PURE__ */ jsxs37(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
18092
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx45(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx45(Text, { children: t2("Everything in", {
17387
18093
  plan: plans[index - 1].name
17388
18094
  }) }) }),
17389
- plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ jsx44(
18095
+ plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ jsx45(
17390
18096
  Entitlement,
17391
18097
  {
17392
18098
  entitlement,
@@ -17395,7 +18101,7 @@ var Plan2 = ({
17395
18101
  },
17396
18102
  idx
17397
18103
  )).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
17398
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs36(
18104
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs37(
17399
18105
  Flex,
17400
18106
  {
17401
18107
  $justifyContent: "start",
@@ -17403,14 +18109,14 @@ var Plan2 = ({
17403
18109
  $gap: "0.5rem",
17404
18110
  $marginTop: "1rem",
17405
18111
  children: [
17406
- /* @__PURE__ */ jsx44(
18112
+ /* @__PURE__ */ jsx45(
17407
18113
  Icon3,
17408
18114
  {
17409
18115
  name: isExpanded ? "chevron-up" : "chevron-down",
17410
18116
  color: "#D0D0D0"
17411
18117
  }
17412
18118
  ),
17413
- /* @__PURE__ */ jsx44(
18119
+ /* @__PURE__ */ jsx45(
17414
18120
  Text,
17415
18121
  {
17416
18122
  onClick: () => handleToggleShowAll(plan.id),
@@ -17430,7 +18136,7 @@ var Plan2 = ({
17430
18136
  }
17431
18137
  )
17432
18138
  ] }),
17433
- isActivePlan ? /* @__PURE__ */ jsxs36(
18139
+ isActivePlan ? /* @__PURE__ */ jsxs37(
17434
18140
  Flex,
17435
18141
  {
17436
18142
  $justifyContent: "center",
@@ -17438,7 +18144,7 @@ var Plan2 = ({
17438
18144
  $gap: "0.25rem",
17439
18145
  $padding: "0.625rem 0",
17440
18146
  children: [
17441
- /* @__PURE__ */ jsx44(
18147
+ /* @__PURE__ */ jsx45(
17442
18148
  Icon3,
17443
18149
  {
17444
18150
  name: "check-rounded",
@@ -17446,10 +18152,10 @@ var Plan2 = ({
17446
18152
  color: settings.theme.primary
17447
18153
  }
17448
18154
  ),
17449
- /* @__PURE__ */ jsx44(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
18155
+ /* @__PURE__ */ jsx45(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
17450
18156
  ]
17451
18157
  }
17452
- ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx44(
18158
+ ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx45(
17453
18159
  Button,
17454
18160
  {
17455
18161
  type: "button",
@@ -17486,11 +18192,11 @@ var Plan2 = ({
17486
18192
  }
17487
18193
  },
17488
18194
  $fullWidth: true,
17489
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ jsx44(
18195
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ jsx45(
17490
18196
  Tooltip,
17491
18197
  {
17492
- trigger: /* @__PURE__ */ jsx44(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
17493
- content: /* @__PURE__ */ jsx44(Text, { children: t2("Current usage exceeds the limit of this plan.") })
18198
+ trigger: /* @__PURE__ */ jsx45(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
18199
+ content: /* @__PURE__ */ jsx45(Text, { children: t2("Current usage exceeds the limit of this plan.") })
17494
18200
  }
17495
18201
  ) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
17496
18202
  }
@@ -17504,7 +18210,7 @@ var Plan2 = ({
17504
18210
  };
17505
18211
 
17506
18212
  // src/components/elements/pricing-table/PricingTable.tsx
17507
- import { Fragment as Fragment24, jsx as jsx45, jsxs as jsxs37 } from "react/jsx-runtime";
18213
+ import { Fragment as Fragment25, jsx as jsx46, jsxs as jsxs38 } from "react/jsx-runtime";
17508
18214
  var resolveDesignProps8 = (props) => {
17509
18215
  return {
17510
18216
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -17574,9 +18280,9 @@ var PricingTable = forwardRef12(
17574
18280
  isStandalone: true
17575
18281
  };
17576
18282
  }, [data]);
17577
- const [selectedPeriod, setSelectedPeriod] = useState16(currentPeriod);
18283
+ const [selectedPeriod, setSelectedPeriod] = useState17(currentPeriod);
17578
18284
  const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
17579
- const [entitlementCounts, setEntitlementCounts] = useState16(
18285
+ const [entitlementCounts, setEntitlementCounts] = useState17(
17580
18286
  () => plans.reduce(entitlementCountsReducer, {})
17581
18287
  );
17582
18288
  const handleToggleShowAll = (id) => {
@@ -17602,8 +18308,8 @@ var PricingTable = forwardRef12(
17602
18308
  useEffect8(() => {
17603
18309
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
17604
18310
  }, [plans]);
17605
- const Wrapper = isStandalone ? Container : Fragment23;
17606
- return /* @__PURE__ */ jsx45(Wrapper, { children: /* @__PURE__ */ jsxs37(
18311
+ const Wrapper = isStandalone ? Container : Fragment24;
18312
+ return /* @__PURE__ */ jsx46(Wrapper, { children: /* @__PURE__ */ jsxs38(
17607
18313
  FussyChild,
17608
18314
  {
17609
18315
  ref,
@@ -17612,8 +18318,8 @@ var PricingTable = forwardRef12(
17612
18318
  $flexDirection: "column",
17613
18319
  $gap: "2rem",
17614
18320
  children: [
17615
- /* @__PURE__ */ jsxs37(Box, { children: [
17616
- /* @__PURE__ */ jsxs37(
18321
+ /* @__PURE__ */ jsxs38(Box, { children: [
18322
+ /* @__PURE__ */ jsxs38(
17617
18323
  Flex,
17618
18324
  {
17619
18325
  $flexDirection: "column",
@@ -17628,7 +18334,7 @@ var PricingTable = forwardRef12(
17628
18334
  }
17629
18335
  },
17630
18336
  children: [
17631
- /* @__PURE__ */ jsx45(
18337
+ /* @__PURE__ */ jsx46(
17632
18338
  Text,
17633
18339
  {
17634
18340
  display: props.header.fontStyle,
@@ -17636,7 +18342,7 @@ var PricingTable = forwardRef12(
17636
18342
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
17637
18343
  }
17638
18344
  ),
17639
- props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx45(
18345
+ props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx46(
17640
18346
  PeriodToggle,
17641
18347
  {
17642
18348
  options: periods,
@@ -17651,13 +18357,13 @@ var PricingTable = forwardRef12(
17651
18357
  ]
17652
18358
  }
17653
18359
  ),
17654
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx45(
18360
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx46(
17655
18361
  Box,
17656
18362
  {
17657
18363
  $display: "grid",
17658
18364
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
17659
18365
  $gap: "1rem",
17660
- children: plans.map((plan, index, self2) => /* @__PURE__ */ jsx45(
18366
+ children: plans.map((plan, index, self2) => /* @__PURE__ */ jsx46(
17661
18367
  Plan2,
17662
18368
  {
17663
18369
  plan,
@@ -17678,14 +18384,14 @@ var PricingTable = forwardRef12(
17678
18384
  }
17679
18385
  )
17680
18386
  ] }),
17681
- /* @__PURE__ */ jsx45(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs37(Fragment24, { children: [
17682
- props.header.isVisible && /* @__PURE__ */ jsx45(
18387
+ /* @__PURE__ */ jsx46(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs38(Fragment25, { children: [
18388
+ props.header.isVisible && /* @__PURE__ */ jsx46(
17683
18389
  Flex,
17684
18390
  {
17685
18391
  $justifyContent: "space-between",
17686
18392
  $alignItems: "center",
17687
18393
  $marginBottom: "1rem",
17688
- children: /* @__PURE__ */ jsx45(
18394
+ children: /* @__PURE__ */ jsx46(
17689
18395
  Text,
17690
18396
  {
17691
18397
  display: props.header.fontStyle,
@@ -17695,13 +18401,13 @@ var PricingTable = forwardRef12(
17695
18401
  )
17696
18402
  }
17697
18403
  ),
17698
- /* @__PURE__ */ jsx45(
18404
+ /* @__PURE__ */ jsx46(
17699
18405
  Box,
17700
18406
  {
17701
18407
  $display: "grid",
17702
18408
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
17703
18409
  $gap: "1rem",
17704
- children: addOns.map((addOn, index) => /* @__PURE__ */ jsx45(
18410
+ children: addOns.map((addOn, index) => /* @__PURE__ */ jsx46(
17705
18411
  AddOn2,
17706
18412
  {
17707
18413
  addOn,
@@ -17727,7 +18433,7 @@ PricingTable.displayName = "PricingTable";
17727
18433
 
17728
18434
  // src/components/elements/text/Text.tsx
17729
18435
  import { forwardRef as forwardRef13 } from "react";
17730
- import { jsx as jsx46 } from "react/jsx-runtime";
18436
+ import { jsx as jsx47 } from "react/jsx-runtime";
17731
18437
  var resolveDesignProps9 = (props) => {
17732
18438
  return {
17733
18439
  text: {
@@ -17739,7 +18445,7 @@ var resolveDesignProps9 = (props) => {
17739
18445
  };
17740
18446
  var TextElement = forwardRef13(({ children, className, ...rest }, ref) => {
17741
18447
  const props = resolveDesignProps9(rest);
17742
- return /* @__PURE__ */ jsx46(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx46(
18448
+ return /* @__PURE__ */ jsx47(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx47(
17743
18449
  Text,
17744
18450
  {
17745
18451
  display: props.text.fontStyle,
@@ -17753,7 +18459,7 @@ TextElement.displayName = "Text";
17753
18459
 
17754
18460
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
17755
18461
  import { forwardRef as forwardRef14, useMemo as useMemo27 } from "react";
17756
- import { jsx as jsx47 } from "react/jsx-runtime";
18462
+ import { jsx as jsx48 } from "react/jsx-runtime";
17757
18463
  var buttonStyles = {
17758
18464
  primary: {
17759
18465
  color: "primary",
@@ -17789,7 +18495,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
17789
18495
  if (!hasActiveSubscription) {
17790
18496
  return null;
17791
18497
  }
17792
- return /* @__PURE__ */ jsx47(
18498
+ return /* @__PURE__ */ jsx48(
17793
18499
  Element,
17794
18500
  {
17795
18501
  as: Flex,
@@ -17797,7 +18503,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
17797
18503
  className,
17798
18504
  $flexDirection: "column",
17799
18505
  $gap: "2rem",
17800
- children: /* @__PURE__ */ jsx47(
18506
+ children: /* @__PURE__ */ jsx48(
17801
18507
  Button,
17802
18508
  {
17803
18509
  type: "button",
@@ -17818,8 +18524,8 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
17818
18524
  UnsubscribeButton.displayName = "UnsubscribeButton";
17819
18525
 
17820
18526
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
17821
- import { forwardRef as forwardRef15, useCallback as useCallback12, useEffect as useEffect9, useMemo as useMemo28, useState as useState17 } from "react";
17822
- import { jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
18527
+ import { forwardRef as forwardRef15, useCallback as useCallback13, useEffect as useEffect9, useMemo as useMemo28, useState as useState18 } from "react";
18528
+ import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
17823
18529
  function resolveDesignProps11(props) {
17824
18530
  return {
17825
18531
  header: {
@@ -17843,9 +18549,9 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17843
18549
  const { t: t2 } = useTranslation();
17844
18550
  const { data, settings, getUpcomingInvoice } = useEmbed();
17845
18551
  const isLightBackground = useIsLightBackground();
17846
- const [isLoading, setIsLoading] = useState17(false);
17847
- const [error, setError] = useState17();
17848
- const [upcomingInvoice, setUpcomingInvoice] = useState17();
18552
+ const [isLoading, setIsLoading] = useState18(false);
18553
+ const [error, setError] = useState18();
18554
+ const [upcomingInvoice, setUpcomingInvoice] = useState18();
17849
18555
  const discounts = useMemo28(() => {
17850
18556
  return (isCheckoutData(data) && data.subscription?.discounts || []).map(
17851
18557
  (discount) => ({
@@ -17858,7 +18564,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17858
18564
  })
17859
18565
  );
17860
18566
  }, [data]);
17861
- const getInvoice = useCallback12(async () => {
18567
+ const getInvoice = useCallback13(async () => {
17862
18568
  if (isCheckoutData(data) && data.component?.id && data.subscription && !data.subscription.cancelAt) {
17863
18569
  try {
17864
18570
  setError(void 0);
@@ -17880,9 +18586,9 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17880
18586
  if (!isCheckoutData(data) || !data.subscription || data.subscription.cancelAt) {
17881
18587
  return null;
17882
18588
  }
17883
- return /* @__PURE__ */ jsxs38(Element, { ref, className, children: [
17884
- /* @__PURE__ */ jsx48(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx48(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
17885
- error ? /* @__PURE__ */ jsxs38(
18589
+ return /* @__PURE__ */ jsxs39(Element, { ref, className, children: [
18590
+ /* @__PURE__ */ jsx49(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx49(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
18591
+ error ? /* @__PURE__ */ jsxs39(
17886
18592
  Flex,
17887
18593
  {
17888
18594
  as: TransitionBox,
@@ -17891,8 +18597,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17891
18597
  $alignItems: "center",
17892
18598
  $gap: "1rem",
17893
18599
  children: [
17894
- /* @__PURE__ */ jsx48(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
17895
- /* @__PURE__ */ jsx48(
18600
+ /* @__PURE__ */ jsx49(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
18601
+ /* @__PURE__ */ jsx49(
17896
18602
  Button,
17897
18603
  {
17898
18604
  type: "button",
@@ -17905,36 +18611,36 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17905
18611
  )
17906
18612
  ]
17907
18613
  }
17908
- ) : !isLoading && /* @__PURE__ */ jsx48(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs38(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17909
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs38(Text, { display: props.header.fontStyle, children: [
18614
+ ) : !isLoading && /* @__PURE__ */ jsx49(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs39(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18615
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs39(Text, { display: props.header.fontStyle, children: [
17910
18616
  props.header.prefix,
17911
18617
  " ",
17912
18618
  toPrettyDate(upcomingInvoice.dueDate)
17913
18619
  ] }),
17914
- /* @__PURE__ */ jsxs38(
18620
+ /* @__PURE__ */ jsxs39(
17915
18621
  Flex,
17916
18622
  {
17917
18623
  $justifyContent: "space-between",
17918
18624
  $alignItems: "start",
17919
18625
  $gap: "1rem",
17920
18626
  children: [
17921
- props.price.isVisible && /* @__PURE__ */ jsx48(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
18627
+ props.price.isVisible && /* @__PURE__ */ jsx49(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
17922
18628
  upcomingInvoice.amountDue,
17923
18629
  upcomingInvoice.currency
17924
18630
  ) }),
17925
- /* @__PURE__ */ jsx48(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx48(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill.") }) })
18631
+ /* @__PURE__ */ jsx49(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx49(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill") }) })
17926
18632
  ]
17927
18633
  }
17928
18634
  ),
17929
- discounts.length > 0 && /* @__PURE__ */ jsxs38(
18635
+ discounts.length > 0 && /* @__PURE__ */ jsxs39(
17930
18636
  Flex,
17931
18637
  {
17932
18638
  $justifyContent: "space-between",
17933
18639
  $alignItems: "start",
17934
18640
  $gap: "1rem",
17935
18641
  children: [
17936
- /* @__PURE__ */ jsx48(Text, { $weight: 600, children: t2("Discount") }),
17937
- /* @__PURE__ */ jsx48(
18642
+ /* @__PURE__ */ jsx49(Text, { $weight: 600, children: t2("Discount") }),
18643
+ /* @__PURE__ */ jsx49(
17938
18644
  Flex,
17939
18645
  {
17940
18646
  $flexDirection: "column",
@@ -17944,13 +18650,13 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17944
18650
  (acc, discount) => {
17945
18651
  if (typeof discount.percentOff === "number" || typeof discount.amountOff === "number") {
17946
18652
  acc.push(
17947
- /* @__PURE__ */ jsxs38(
18653
+ /* @__PURE__ */ jsxs39(
17948
18654
  Flex,
17949
18655
  {
17950
18656
  $alignItems: "center",
17951
18657
  $gap: "0.5rem",
17952
18658
  children: [
17953
- discount.customerFacingCode && /* @__PURE__ */ jsx48(
18659
+ discount.customerFacingCode && /* @__PURE__ */ jsx49(
17954
18660
  Flex,
17955
18661
  {
17956
18662
  $alignItems: "center",
@@ -17959,7 +18665,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17959
18665
  $borderStyle: "solid",
17960
18666
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
17961
18667
  $borderRadius: "0.3125rem",
17962
- children: /* @__PURE__ */ jsx48(
18668
+ children: /* @__PURE__ */ jsx49(
17963
18669
  Text,
17964
18670
  {
17965
18671
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -17969,7 +18675,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17969
18675
  )
17970
18676
  }
17971
18677
  ),
17972
- /* @__PURE__ */ jsx48(Box, { children: /* @__PURE__ */ jsx48(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
18678
+ /* @__PURE__ */ jsx49(Box, { children: /* @__PURE__ */ jsx49(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
17973
18679
  percent: discount.percentOff
17974
18680
  }) : t2("Amount off", {
17975
18681
  amount: formatCurrency(
@@ -17993,7 +18699,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
17993
18699
  ]
17994
18700
  }
17995
18701
  )
17996
- ] }) : /* @__PURE__ */ jsx48(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
18702
+ ] }) : /* @__PURE__ */ jsx49(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
17997
18703
  ] });
17998
18704
  });
17999
18705
  UpcomingBill.displayName = "UpcomingBill";
@@ -22173,7 +22879,7 @@ var { Inflate, inflate, inflateRaw, ungzip } = inflate_1$1;
22173
22879
  var inflate_1 = inflate;
22174
22880
 
22175
22881
  // src/components/embed/Embed.tsx
22176
- import { useContext as useContext5, useEffect as useEffect10, useState as useState18 } from "react";
22882
+ import { useContext as useContext5, useEffect as useEffect10, useState as useState19 } from "react";
22177
22883
 
22178
22884
  // src/components/embed/renderer.ts
22179
22885
  import { createElement as createElement5 } from "react";
@@ -22253,10 +22959,10 @@ function createRenderer(options2) {
22253
22959
  }
22254
22960
 
22255
22961
  // src/components/embed/Embed.tsx
22256
- import { Fragment as Fragment25, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
22962
+ import { Fragment as Fragment26, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
22257
22963
  var Loading = () => {
22258
22964
  const { settings } = useEmbed();
22259
- return /* @__PURE__ */ jsx49(
22965
+ return /* @__PURE__ */ jsx50(
22260
22966
  Flex,
22261
22967
  {
22262
22968
  $width: "100%",
@@ -22264,13 +22970,13 @@ var Loading = () => {
22264
22970
  $alignItems: "center",
22265
22971
  $justifyContent: "center",
22266
22972
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
22267
- children: /* @__PURE__ */ jsx49(Loader, { $color: "#194BFB", $size: "2xl" })
22973
+ children: /* @__PURE__ */ jsx50(Loader, { $color: "#194BFB", $size: "2xl" })
22268
22974
  }
22269
22975
  );
22270
22976
  };
22271
22977
  var Error2 = ({ message }) => {
22272
22978
  const { settings } = useEmbed();
22273
- return /* @__PURE__ */ jsxs39(
22979
+ return /* @__PURE__ */ jsxs40(
22274
22980
  Flex,
22275
22981
  {
22276
22982
  $flexDirection: "column",
@@ -22281,14 +22987,14 @@ var Error2 = ({ message }) => {
22281
22987
  $alignItems: "center",
22282
22988
  $justifyContent: "center",
22283
22989
  children: [
22284
- /* @__PURE__ */ jsx49(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx49(Text, { display: "heading1", children: "Error" }) }),
22285
- /* @__PURE__ */ jsx49(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx49(Text, { children: message }) })
22990
+ /* @__PURE__ */ jsx50(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx50(Text, { display: "heading1", children: "Error" }) }),
22991
+ /* @__PURE__ */ jsx50(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx50(Text, { children: message }) })
22286
22992
  ]
22287
22993
  }
22288
22994
  );
22289
22995
  };
22290
22996
  var SchematicEmbed = ({ id, accessToken }) => {
22291
- const [children, setChildren] = useState18(/* @__PURE__ */ jsx49(Loading, {}));
22997
+ const [children, setChildren] = useState19(/* @__PURE__ */ jsx50(Loading, {}));
22292
22998
  const theme = useContext5(et);
22293
22999
  const {
22294
23000
  data,
@@ -22335,13 +23041,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
22335
23041
  return stub();
22336
23042
  }
22337
23043
  if (error) {
22338
- return /* @__PURE__ */ jsx49(Error2, { message: error.message });
23044
+ return /* @__PURE__ */ jsx50(Error2, { message: error.message });
22339
23045
  }
22340
23046
  if (accessToken?.length === 0) {
22341
- return /* @__PURE__ */ jsx49(Error2, { message: "Please provide an access token." });
23047
+ return /* @__PURE__ */ jsx50(Error2, { message: "Please provide an access token." });
22342
23048
  }
22343
23049
  if (!accessToken?.startsWith("token_")) {
22344
- return /* @__PURE__ */ jsx49(
23050
+ return /* @__PURE__ */ jsx50(
22345
23051
  Error2,
22346
23052
  {
22347
23053
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -22349,9 +23055,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
22349
23055
  );
22350
23056
  }
22351
23057
  if (isPending) {
22352
- return /* @__PURE__ */ jsx49(Loading, {});
23058
+ return /* @__PURE__ */ jsx50(Loading, {});
22353
23059
  }
22354
- return /* @__PURE__ */ jsx49(Fragment25, { children });
23060
+ return /* @__PURE__ */ jsx50(Fragment26, { children });
22355
23061
  };
22356
23062
  export {
22357
23063
  Box,