@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.
@@ -2040,6 +2040,83 @@ function getEntitlementCost(entitlement, period = "month") {
2040
2040
  }
2041
2041
  }
2042
2042
 
2043
+ // src/utils/api/credit.ts
2044
+ function getResetCadencePeriod(cadence) {
2045
+ switch (cadence) {
2046
+ case "yearly" /* Year */:
2047
+ return "year";
2048
+ case "monthly" /* Month */:
2049
+ return "month";
2050
+ case "weekly" /* Week */:
2051
+ return "week";
2052
+ case "daily" /* Day */:
2053
+ return "day";
2054
+ }
2055
+ }
2056
+ function groupPlanCreditGrants(creditGrants) {
2057
+ const map = creditGrants.reduce(
2058
+ (acc, grant) => {
2059
+ const key = grant.creditId;
2060
+ acc[key] = {
2061
+ id: grant.creditId,
2062
+ name: grant.creditName,
2063
+ singularName: grant.singularName,
2064
+ pluralName: grant.pluralName,
2065
+ description: grant.creditDescription,
2066
+ icon: grant.creditIcon,
2067
+ grantReason: "plan",
2068
+ quantity: grant.creditAmount,
2069
+ planId: grant.planId,
2070
+ planName: grant.planName,
2071
+ period: getResetCadencePeriod(grant.resetCadence)
2072
+ };
2073
+ return acc;
2074
+ },
2075
+ {}
2076
+ );
2077
+ return Object.values(map);
2078
+ }
2079
+ function groupCreditGrants(creditGrants, options2) {
2080
+ const today = /* @__PURE__ */ new Date();
2081
+ const map = creditGrants.reduce(
2082
+ (acc, grant) => {
2083
+ const isExpired = !!grant.expiresAt && grant.expiresAt <= today;
2084
+ const isZeroedOut = !!grant.zeroedOutDate;
2085
+ if (!isExpired && !isZeroedOut) {
2086
+ const key = options2?.groupBy === "bundle" ? grant.billingCreditBundleId || grant.id : options2?.groupBy === "credit" ? grant.billingCreditId : grant.id;
2087
+ const current = acc[key];
2088
+ acc[key] = {
2089
+ // credit-specific attributes
2090
+ id: grant.billingCreditId,
2091
+ name: grant.creditName,
2092
+ singularName: grant.singularName,
2093
+ pluralName: grant.pluralName,
2094
+ description: grant.creditDescription,
2095
+ icon: grant.creditIcon,
2096
+ grantReason: grant.grantReason,
2097
+ quantity: grant.quantity,
2098
+ // shared attributes
2099
+ companyId: grant.companyId,
2100
+ companyName: grant.companyName,
2101
+ planId: grant.planId,
2102
+ planName: grant.planName,
2103
+ bundleId: grant.billingCreditBundleId,
2104
+ // custom attributes
2105
+ total: {
2106
+ value: (current?.total?.value ?? 0) + grant.quantity,
2107
+ remaining: (current?.total?.remaining ?? 0) + grant.quantityRemaining,
2108
+ used: (current?.total?.used ?? 0) + grant.quantityUsed
2109
+ },
2110
+ grants: [...current?.grants ?? [], grant]
2111
+ };
2112
+ }
2113
+ return acc;
2114
+ },
2115
+ {}
2116
+ );
2117
+ return Object.values(map);
2118
+ }
2119
+
2043
2120
  // src/utils/api/entitlement.ts
2044
2121
  var PeriodName = {
2045
2122
  billing: "billing period",
@@ -2619,6 +2696,11 @@ function shortenPeriod(period) {
2619
2696
  return "yr";
2620
2697
  }
2621
2698
  }
2699
+ function modifyDate(date, days) {
2700
+ const copy3 = new Date(date);
2701
+ copy3.setDate(copy3.getDate() + days);
2702
+ return copy3;
2703
+ }
2622
2704
 
2623
2705
  // src/utils/error.ts
2624
2706
  function isError(value) {
@@ -4075,22 +4157,10 @@ function useAvailablePlans(activePeriod) {
4075
4157
  }, [data?.activePlans, data?.activeAddOns]);
4076
4158
  const getActivePlans = (0, import_react2.useCallback)(
4077
4159
  (plans) => {
4078
- const customPlanExist = plans.some((plan) => plan.custom);
4079
- const plansWithSelected = settings.mode === "edit" ? plans.slice() : plans.filter(
4160
+ const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter(
4080
4161
  (plan) => activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime
4081
4162
  );
4082
- if (!customPlanExist) {
4083
- plansWithSelected?.sort((a2, b2) => {
4084
- if (activePeriod === "year") {
4085
- return (a2.yearlyPrice?.price ?? 0) - (b2.yearlyPrice?.price ?? 0);
4086
- }
4087
- if (activePeriod === "month") {
4088
- return (a2.monthlyPrice?.price ?? 0) - (b2.monthlyPrice?.price ?? 0);
4089
- }
4090
- return 0;
4091
- });
4092
- }
4093
- return plansWithSelected?.map((plan) => ({ ...plan, isSelected: false }));
4163
+ return activePlans.map((plan) => ({ ...plan, isSelected: false }));
4094
4164
  },
4095
4165
  [activePeriod, settings.mode]
4096
4166
  );
@@ -4100,12 +4170,7 @@ function useAvailablePlans(activePeriod) {
4100
4170
  addOns: getActivePlans(data?.activeAddOns || []),
4101
4171
  periods: getAvailablePeriods()
4102
4172
  };
4103
- }, [
4104
- data?.activePlans,
4105
- data?.activeAddOns,
4106
- getAvailablePeriods,
4107
- getActivePlans
4108
- ]);
4173
+ }, [data, getAvailablePeriods, getActivePlans]);
4109
4174
  }
4110
4175
 
4111
4176
  // src/hooks/useEmbed.ts
@@ -6689,12 +6754,13 @@ var en_default = {
6689
6754
  "Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
6690
6755
  "Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
6691
6756
  "Error updating payment method. Please try again.": "Error updating payment method. Please try again.",
6692
- "Estimated bill.": "Estimated bill.",
6757
+ "Estimated bill": "Estimated bill",
6693
6758
  "Everything in": "Everything in {{plan}}, plus",
6694
6759
  Expired: "Expired",
6695
6760
  "Expires in X months": "Expires in {{months}} mo",
6696
6761
  Expires: "Expires {{date}}",
6697
6762
  "Hide all": "Hide all",
6763
+ "Hide balance details": "Hide balance details",
6698
6764
  "Hide details": "Hide details",
6699
6765
  "Invalid access token; your temporary access token will start with `token_`.": "Invalid access token; your temporary access token will start with `token_`.",
6700
6766
  "Invalid discount code.": "Invalid discount code.",
@@ -6731,6 +6797,7 @@ var en_default = {
6731
6797
  "Save with yearly billing": "Save up to {{percent}}% with yearly billing",
6732
6798
  "Saving with yearly billing": "You are saving {{percent}}% with yearly billing",
6733
6799
  "See all": "See all",
6800
+ "See balance details": "See balance details",
6734
6801
  "See less": "See less",
6735
6802
  "See more": "See more",
6736
6803
  "Select add-ons": "Select add-ons",
@@ -6773,6 +6840,9 @@ var en_default = {
6773
6840
  "Use existing payment method": "Use existing payment method",
6774
6841
  "X additional": "{{amount}} additional",
6775
6842
  "X included": "{{amount}} included",
6843
+ "X item bundle": "{{amount}} {{item}} bundle purchased {{createdAt}}",
6844
+ "X item grant": "{{amount}} promotional {{item}} granted {{createdAt}}",
6845
+ "X items included in plan": "{{amount}} {{item}} included in plan",
6776
6846
  "X off": "{{amount}} off",
6777
6847
  "X% off": "{{percent}}% off",
6778
6848
  "Yearly total": "Yearly total",
@@ -6784,7 +6854,9 @@ var en_default = {
6784
6854
  "one time": "one time",
6785
6855
  per: "per",
6786
6856
  then: "then",
6857
+ use: "use",
6787
6858
  used: "used",
6859
+ purchased: "purchased {{date}}",
6788
6860
  usage: {
6789
6861
  limited: "{{amount}} of {{allocation}} used",
6790
6862
  unlimited: "{{amount}} used"
@@ -10228,7 +10300,7 @@ var EmbedProvider = ({
10228
10300
  });
10229
10301
  const customHeaders = (0, import_react12.useMemo)(
10230
10302
  () => ({
10231
- "X-Schematic-Components-Version": "1.1.4",
10303
+ "X-Schematic-Components-Version": "1.2.0",
10232
10304
  "X-Schematic-Session-ID": sessionIdRef.current
10233
10305
  }),
10234
10306
  []
@@ -10721,7 +10793,14 @@ var Box = dt.div((props) => {
10721
10793
  return styles;
10722
10794
  });
10723
10795
  var TransitionBox = dt(Box)`
10724
- height: auto;
10796
+ ${({ $isExpanded = true }) => {
10797
+ return $isExpanded ? lt`
10798
+ height: auto;
10799
+ ` : lt`
10800
+ height: 0;
10801
+ overflow: hidden;
10802
+ `;
10803
+ }}
10725
10804
  opacity: 1;
10726
10805
  transition:
10727
10806
  height 0.1s ease-in,
@@ -10742,6 +10821,7 @@ var Icon2 = dt(Icon).attrs(({ name, title, onClick }) => ({
10742
10821
  justify-content: center;
10743
10822
  align-items: center;
10744
10823
  flex-shrink: 0;
10824
+ transition: 0.1s;
10745
10825
 
10746
10826
  ${({ onClick }) => onClick && lt`
10747
10827
  &:hover {
@@ -11892,11 +11972,7 @@ var EntitlementRow = (entitlement) => {
11892
11972
  // src/components/shared/sidebar/Proration.tsx
11893
11973
  var import_react26 = require("react");
11894
11974
  var import_jsx_runtime12 = require("react/jsx-runtime");
11895
- var Proration = ({
11896
- currency,
11897
- charges,
11898
- selectedPlan
11899
- }) => {
11975
+ var Proration = ({ currency, charges }) => {
11900
11976
  const { t: t2 } = useTranslation();
11901
11977
  const [open, setOpen] = (0, import_react26.useState)(false);
11902
11978
  const toggle = (e2) => {
@@ -11905,7 +11981,7 @@ var Proration = ({
11905
11981
  setOpen((open2) => !open2);
11906
11982
  };
11907
11983
  return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
11908
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { $size: 14, children: charges.proration > 0 ? t2("Proration") : isHydratedPlan(selectedPlan) && !selectedPlan?.companyCanTrial && t2("Credits") }) }),
11984
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { $size: 14, children: t2("Proration") }) }),
11909
11985
  /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
11910
11986
  open && charges?.upcomingInvoiceLineItems.map(
11911
11987
  ({ amount, description }, index) => {
@@ -11946,6 +12022,7 @@ var StageButton = ({
11946
12022
  checkoutStages,
11947
12023
  hasAddOns,
11948
12024
  hasPayInAdvanceEntitlements,
12025
+ hasCreditBundles,
11949
12026
  hasPaymentMethod,
11950
12027
  hasPlan,
11951
12028
  inEditMode,
@@ -12003,7 +12080,7 @@ var StageButton = ({
12003
12080
  );
12004
12081
  }
12005
12082
  if (!isPaymentMethodRequired && !checkoutStages?.some(
12006
- (stage) => stage.id === "usage" || stage.id === "addons"
12083
+ (stage) => stage.id === "usage" || stage.id === "addons" || stage.id === "credits"
12007
12084
  )) {
12008
12085
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
12009
12086
  }
@@ -12014,7 +12091,7 @@ var StageButton = ({
12014
12091
  disabled: isDisabled,
12015
12092
  onClick: async () => {
12016
12093
  setCheckoutStage?.(
12017
- hasPayInAdvanceEntitlements ? "usage" : hasAddOns ? "addons" : "checkout"
12094
+ hasPayInAdvanceEntitlements ? "usage" : hasAddOns ? "addons" : hasCreditBundles ? "credits" : "checkout"
12018
12095
  );
12019
12096
  },
12020
12097
  $isLoading: isLoading,
@@ -12023,14 +12100,16 @@ var StageButton = ({
12023
12100
  t2("Next"),
12024
12101
  ":",
12025
12102
  " ",
12026
- hasPayInAdvanceEntitlements ? t2("Usage") : hasAddOns ? t2("Addons") : t2("Checkout"),
12103
+ hasPayInAdvanceEntitlements ? t2("Usage") : hasAddOns ? t2("Addons") : hasCreditBundles ? t2("Credits") : t2("Checkout"),
12027
12104
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon3, { name: "arrow-right" })
12028
12105
  ] })
12029
12106
  }
12030
12107
  );
12031
12108
  }
12032
12109
  if (checkoutStage === "usage") {
12033
- if (!isPaymentMethodRequired && !checkoutStages?.some((stage) => stage.id === "addons")) {
12110
+ if (!isPaymentMethodRequired && !checkoutStages?.some(
12111
+ (stage) => stage.id === "addons" || stage.id === "credits"
12112
+ )) {
12034
12113
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
12035
12114
  }
12036
12115
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
@@ -12039,7 +12118,9 @@ var StageButton = ({
12039
12118
  type: "button",
12040
12119
  disabled: isDisabled,
12041
12120
  onClick: async () => {
12042
- setCheckoutStage?.(hasAddOns ? "addons" : "checkout");
12121
+ setCheckoutStage?.(
12122
+ hasAddOns ? "addons" : hasCreditBundles ? "credits" : "checkout"
12123
+ );
12043
12124
  },
12044
12125
  $isLoading: isLoading,
12045
12126
  $fullWidth: true,
@@ -12052,8 +12133,9 @@ var StageButton = ({
12052
12133
  $padding: "0 1rem",
12053
12134
  children: [
12054
12135
  t2("Next"),
12055
- ": ",
12056
- hasAddOns ? t2("Addons") : t2("Checkout"),
12136
+ ":",
12137
+ " ",
12138
+ hasAddOns ? t2("Addons") : hasCreditBundles ? t2("Credits") : t2("Checkout"),
12057
12139
  /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon3, { name: "arrow-right" })
12058
12140
  ]
12059
12141
  }
@@ -12062,6 +12144,38 @@ var StageButton = ({
12062
12144
  );
12063
12145
  }
12064
12146
  if (checkoutStage === "addons") {
12147
+ if (!isPaymentMethodRequired && !checkoutStages?.some((stage) => stage.id === "credits")) {
12148
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
12149
+ }
12150
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
12151
+ Button,
12152
+ {
12153
+ type: "button",
12154
+ disabled: isDisabled,
12155
+ onClick: async () => {
12156
+ setCheckoutStage?.(hasCreditBundles ? "credits" : "checkout");
12157
+ },
12158
+ $isLoading: isLoading,
12159
+ $fullWidth: true,
12160
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
12161
+ Flex,
12162
+ {
12163
+ $gap: "0.5rem",
12164
+ $justifyContent: "center",
12165
+ $alignItems: "center",
12166
+ $padding: "0 1rem",
12167
+ children: [
12168
+ t2("Next"),
12169
+ ": ",
12170
+ hasCreditBundles ? t2("Credits") : t2("Checkout"),
12171
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon3, { name: "arrow-right" })
12172
+ ]
12173
+ }
12174
+ )
12175
+ }
12176
+ );
12177
+ }
12178
+ if (checkoutStage === "credits") {
12065
12179
  if (!isPaymentMethodRequired) {
12066
12180
  return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NoPaymentRequired, {});
12067
12181
  }
@@ -12117,6 +12231,7 @@ var Sidebar = ({
12117
12231
  planPeriod,
12118
12232
  selectedPlan,
12119
12233
  addOns,
12234
+ creditBundles = [],
12120
12235
  usageBasedEntitlements,
12121
12236
  charges,
12122
12237
  checkoutRef,
@@ -12234,6 +12349,65 @@ var Sidebar = ({
12234
12349
  proration: charges?.proration ?? 0
12235
12350
  };
12236
12351
  }, [charges]);
12352
+ const updatedUsageBasedEntitlements = (0, import_react27.useMemo)(() => {
12353
+ const changedUsageBasedEntitlements = [];
12354
+ const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
12355
+ (acc, selected) => {
12356
+ const changed = currentUsageBasedEntitlements.find(
12357
+ (current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
12358
+ );
12359
+ if (changed) {
12360
+ changedUsageBasedEntitlements.push({
12361
+ previous: changed,
12362
+ next: selected
12363
+ });
12364
+ } else {
12365
+ acc.push(selected);
12366
+ }
12367
+ return acc;
12368
+ },
12369
+ []
12370
+ ) : [];
12371
+ const removedUsageBasedEntitlements = selectedPlan ? currentUsageBasedEntitlements.reduce(
12372
+ (acc, current) => {
12373
+ const match2 = usageBasedEntitlements.every(
12374
+ (entitlement) => entitlement.id !== current.entitlementId
12375
+ ) && currentEntitlements.find(
12376
+ (usage) => usage.entitlementId === current.entitlementId
12377
+ );
12378
+ if (match2) {
12379
+ acc.push({
12380
+ ...match2,
12381
+ allocation: current.allocation,
12382
+ usage: current.usage,
12383
+ quantity: current.quantity
12384
+ });
12385
+ }
12386
+ return acc;
12387
+ },
12388
+ []
12389
+ ) : [];
12390
+ const willUsageBasedEntitlementsChange = changedUsageBasedEntitlements.length > 0 || addedUsageBasedEntitlements.length > 0 || removedUsageBasedEntitlements.length > 0;
12391
+ return {
12392
+ changed: changedUsageBasedEntitlements,
12393
+ added: addedUsageBasedEntitlements,
12394
+ removed: removedUsageBasedEntitlements,
12395
+ willChange: willUsageBasedEntitlementsChange
12396
+ };
12397
+ }, [
12398
+ selectedPlan,
12399
+ currentEntitlements,
12400
+ currentUsageBasedEntitlements,
12401
+ usageBasedEntitlements
12402
+ ]);
12403
+ const selectedAddOns = (0, import_react27.useMemo)(
12404
+ () => addOns.filter((addOn) => addOn.isSelected),
12405
+ [addOns]
12406
+ );
12407
+ const addedCreditBundles = (0, import_react27.useMemo)(
12408
+ () => creditBundles.filter((bundle) => bundle.count > 0),
12409
+ [creditBundles]
12410
+ );
12237
12411
  const handleCheckout = (0, import_react27.useCallback)(async () => {
12238
12412
  const planId = selectedPlan?.id;
12239
12413
  const priceId = (planPeriod === "year" ? selectedPlan?.yearlyPrice : selectedPlan?.monthlyPrice)?.id;
@@ -12271,7 +12445,18 @@ var Sidebar = ({
12271
12445
  },
12272
12446
  []
12273
12447
  ),
12274
- creditBundles: [],
12448
+ creditBundles: creditBundles.reduce(
12449
+ (acc, { id, count }) => {
12450
+ if (count > 0) {
12451
+ acc.push({
12452
+ bundleId: id,
12453
+ quantity: count
12454
+ });
12455
+ }
12456
+ return acc;
12457
+ },
12458
+ []
12459
+ ),
12275
12460
  skipTrial: !willTrialWithoutPaymentMethod,
12276
12461
  ...paymentMethodId && { paymentMethodId },
12277
12462
  ...promoCode && { promoCode }
@@ -12292,6 +12477,7 @@ var Sidebar = ({
12292
12477
  planPeriod,
12293
12478
  selectedPlan,
12294
12479
  addOns,
12480
+ creditBundles,
12295
12481
  setError,
12296
12482
  setIsLoading,
12297
12483
  setLayout,
@@ -12312,68 +12498,21 @@ var Sidebar = ({
12312
12498
  setError(t2("Unsubscribe failed"));
12313
12499
  }
12314
12500
  }, [t2, unsubscribe, setError, setIsLoading, setLayout]);
12315
- const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
12316
- const updatedUsageBasedEntitlements = (0, import_react27.useMemo)(() => {
12317
- const changedUsageBasedEntitlements = [];
12318
- const addedUsageBasedEntitlements = selectedPlan ? usageBasedEntitlements.reduce(
12319
- (acc, selected) => {
12320
- const changed = currentUsageBasedEntitlements.find(
12321
- (current) => current.entitlementId === selected.id && current.quantity !== selected.quantity
12322
- );
12323
- if (changed) {
12324
- changedUsageBasedEntitlements.push({
12325
- previous: changed,
12326
- next: selected
12327
- });
12328
- } else {
12329
- acc.push(selected);
12330
- }
12331
- return acc;
12332
- },
12333
- []
12334
- ) : [];
12335
- const removedUsageBasedEntitlements = selectedPlan ? currentUsageBasedEntitlements.reduce(
12336
- (acc, current) => {
12337
- const match2 = usageBasedEntitlements.every(
12338
- (entitlement) => entitlement.id !== current.entitlementId
12339
- ) && currentEntitlements.find(
12340
- (usage) => usage.entitlementId === current.entitlementId
12341
- );
12342
- if (match2) {
12343
- acc.push({
12344
- ...match2,
12345
- allocation: current.allocation,
12346
- usage: current.usage,
12347
- quantity: current.quantity
12348
- });
12349
- }
12350
- return acc;
12351
- },
12352
- []
12353
- ) : [];
12354
- const willUsageBasedEntitlementsChange = changedUsageBasedEntitlements.length > 0 || addedUsageBasedEntitlements.length > 0 || removedUsageBasedEntitlements.length > 0;
12501
+ const willPlanChange = isHydratedPlan(selectedPlan) && !selectedPlan.current;
12502
+ const { removedAddOns, willAddOnsChange } = (0, import_react27.useMemo)(() => {
12503
+ const addedAddOns = selectedAddOns.filter(
12504
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
12505
+ );
12506
+ const removedAddOns2 = currentAddOns.filter(
12507
+ (current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
12508
+ );
12509
+ const willAddOnsChange2 = removedAddOns2.length > 0 || addedAddOns.length > 0;
12355
12510
  return {
12356
- changed: changedUsageBasedEntitlements,
12357
- added: addedUsageBasedEntitlements,
12358
- removed: removedUsageBasedEntitlements,
12359
- willChange: willUsageBasedEntitlementsChange
12511
+ addedAddOns,
12512
+ removedAddOns: removedAddOns2,
12513
+ willAddOnsChange: willAddOnsChange2
12360
12514
  };
12361
- }, [
12362
- selectedPlan,
12363
- currentEntitlements,
12364
- currentUsageBasedEntitlements,
12365
- usageBasedEntitlements
12366
- ]);
12367
- const willPlanChange = isHydratedPlan(selectedPlan) && !selectedPlan.current;
12368
- const removedAddOns = currentAddOns.filter(
12369
- (current) => !selectedAddOns.some((selected) => current.id === selected.id) && current.planPeriod !== "one-time"
12370
- );
12371
- const addedAddOns = selectedAddOns.filter(
12372
- (selected) => !currentAddOns.some((current) => selected.id === current.id)
12373
- );
12374
- const willAddOnsChange = removedAddOns.length > 0 || addedAddOns.length > 0;
12375
- const inEditMode = settings.mode === "edit";
12376
- const hasPaymentMethod = typeof paymentMethod !== "undefined" || typeof paymentMethodId === "string";
12515
+ }, [currentAddOns, selectedAddOns]);
12377
12516
  const isSelectedPlanTrialable = isHydratedPlan(selectedPlan) && selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
12378
12517
  const now = /* @__PURE__ */ new Date();
12379
12518
  const trialEndsOn = new Date(now);
@@ -12658,6 +12797,48 @@ var Sidebar = ({
12658
12797
  );
12659
12798
  })
12660
12799
  ] }),
12800
+ addedCreditBundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $marginBottom: "1.5rem", children: [
12801
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { $size: 14, children: t2("Credits") }) }),
12802
+ addedCreditBundles.reduce(
12803
+ (acc, bundle, index) => {
12804
+ const price = typeof bundle.price?.priceDecimal === "string" ? Number(bundle.price.priceDecimal) : typeof bundle.price?.price === "number" ? bundle.price.price : void 0;
12805
+ const amount = (bundle.quantity ?? 0) * bundle.count;
12806
+ if (price)
12807
+ acc.push(
12808
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
12809
+ Flex,
12810
+ {
12811
+ $justifyContent: "space-between",
12812
+ $alignItems: "center",
12813
+ $gap: "1rem",
12814
+ children: [
12815
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Box, { children: [
12816
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { display: "heading4", children: [
12817
+ bundle.name,
12818
+ " (",
12819
+ bundle.count,
12820
+ ")"
12821
+ ] }) }),
12822
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Text, { children: [
12823
+ amount,
12824
+ " ",
12825
+ getFeatureName(bundle, amount)
12826
+ ] }) })
12827
+ ] }),
12828
+ bundle.count > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text, { children: formatCurrency(
12829
+ price * bundle.count,
12830
+ bundle.price?.currency
12831
+ ) }) })
12832
+ ]
12833
+ },
12834
+ index
12835
+ )
12836
+ );
12837
+ return acc;
12838
+ },
12839
+ []
12840
+ )
12841
+ ] }),
12661
12842
  proration !== 0 && charges && selectedPlanCurrency && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
12662
12843
  Proration,
12663
12844
  {
@@ -12806,9 +12987,10 @@ var Sidebar = ({
12806
12987
  checkoutStages,
12807
12988
  hasAddOns: addOns.length > 0,
12808
12989
  hasPayInAdvanceEntitlements: payInAdvanceEntitlements.length > 0,
12809
- hasPaymentMethod,
12990
+ hasCreditBundles: creditBundles.length > 0,
12991
+ hasPaymentMethod: typeof paymentMethod !== "undefined" || typeof paymentMethodId === "string",
12810
12992
  hasPlan: typeof selectedPlan !== "undefined",
12811
- inEditMode,
12993
+ inEditMode: settings.mode === "edit",
12812
12994
  isLoading,
12813
12995
  isPaymentMethodRequired,
12814
12996
  isSelectedPlanTrialable,
@@ -12847,7 +13029,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12847
13029
  const { settings } = useEmbed();
12848
13030
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
12849
13031
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
12850
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_jsx_runtime15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
13032
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
12851
13033
  Box,
12852
13034
  {
12853
13035
  $display: "grid",
@@ -12944,7 +13126,7 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
12944
13126
  );
12945
13127
  })
12946
13128
  }
12947
- ) });
13129
+ );
12948
13130
  };
12949
13131
 
12950
13132
  // src/components/shared/checkout-dialog/Checkout.tsx
@@ -13011,8 +13193,75 @@ var Checkout = ({
13011
13193
  ] });
13012
13194
  };
13013
13195
 
13014
- // src/components/shared/checkout-dialog/Navigation.tsx
13196
+ // src/components/shared/checkout-dialog/Credits.tsx
13015
13197
  var import_jsx_runtime17 = require("react/jsx-runtime");
13198
+ var Credits = ({ bundles, updateCount }) => {
13199
+ const { settings } = useEmbed();
13200
+ const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13201
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13202
+ Box,
13203
+ {
13204
+ $display: "grid",
13205
+ $gridTemplateColumns: "repeat(auto-fill, minmax(300px, 1fr))",
13206
+ $gap: "1rem",
13207
+ children: bundles.map((bundle, index) => {
13208
+ const billingPrice = bundle.price;
13209
+ const price = typeof billingPrice?.priceDecimal === "string" ? Number(billingPrice.priceDecimal) : typeof billingPrice?.price === "number" ? billingPrice.price : void 0;
13210
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
13211
+ Flex,
13212
+ {
13213
+ $position: "relative",
13214
+ $flexDirection: "column",
13215
+ $gap: "2rem",
13216
+ $padding: `${cardPadding}rem`,
13217
+ $backgroundColor: settings.theme.card.background,
13218
+ $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13219
+ ...settings.theme.card.hasShadow && {
13220
+ $boxShadow: cardBoxShadow
13221
+ },
13222
+ children: [
13223
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
13224
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Box, { children: [
13225
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { display: "heading3", children: bundle.name }) }),
13226
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Text, { display: "heading6", children: [
13227
+ bundle.quantity ?? 0,
13228
+ " ",
13229
+ getFeatureName(bundle)
13230
+ ] }) })
13231
+ ] }),
13232
+ typeof price === "number" && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Text, { children: formatCurrency(price, bundle.price?.currency) }) })
13233
+ ] }),
13234
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13235
+ Input,
13236
+ {
13237
+ $size: "lg",
13238
+ type: "number",
13239
+ value: bundle.count,
13240
+ min: 0,
13241
+ autoFocus: true,
13242
+ onFocus: (event) => {
13243
+ event.target.select();
13244
+ },
13245
+ onChange: (event) => {
13246
+ event.preventDefault();
13247
+ const value = parseInt(event.target.value);
13248
+ if (!isNaN(value)) {
13249
+ updateCount(bundle.id, value);
13250
+ }
13251
+ }
13252
+ }
13253
+ ) })
13254
+ ]
13255
+ },
13256
+ index
13257
+ );
13258
+ })
13259
+ }
13260
+ );
13261
+ };
13262
+
13263
+ // src/components/shared/checkout-dialog/Navigation.tsx
13264
+ var import_jsx_runtime18 = require("react/jsx-runtime");
13016
13265
  var Navigation = ({
13017
13266
  name,
13018
13267
  index,
@@ -13022,9 +13271,9 @@ var Navigation = ({
13022
13271
  }) => {
13023
13272
  const { settings } = useEmbed();
13024
13273
  const isLightBackground = useIsLightBackground();
13025
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
13026
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
13027
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13274
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13275
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $gap: "0.5rem", $alignItems: "center", children: [
13276
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13028
13277
  Box,
13029
13278
  {
13030
13279
  $display: "none",
@@ -13033,7 +13282,7 @@ var Navigation = ({
13033
13282
  $display: "block"
13034
13283
  }
13035
13284
  },
13036
- children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13285
+ children: index >= activeIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13037
13286
  Box,
13038
13287
  {
13039
13288
  $width: `${20 / TEXT_BASE_SIZE}rem`,
@@ -13043,7 +13292,7 @@ var Navigation = ({
13043
13292
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.25)",
13044
13293
  $borderRadius: "9999px"
13045
13294
  }
13046
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13295
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13047
13296
  Icon3,
13048
13297
  {
13049
13298
  name: "check",
@@ -13059,7 +13308,7 @@ var Navigation = ({
13059
13308
  )
13060
13309
  }
13061
13310
  ),
13062
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
13311
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13063
13312
  Box,
13064
13313
  {
13065
13314
  $whiteSpace: "nowrap",
@@ -13082,7 +13331,7 @@ var Navigation = ({
13082
13331
  }
13083
13332
  )
13084
13333
  ] }),
13085
- !isLast && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
13334
+ !isLast && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13086
13335
  Icon3,
13087
13336
  {
13088
13337
  name: "chevron-right",
@@ -13097,7 +13346,7 @@ var Navigation = ({
13097
13346
 
13098
13347
  // src/components/shared/checkout-dialog/Plan.tsx
13099
13348
  var import_react29 = require("react");
13100
- var import_jsx_runtime18 = require("react/jsx-runtime");
13349
+ var import_jsx_runtime19 = require("react/jsx-runtime");
13101
13350
  var Selected = ({ isCurrent = false, isTrial = false }) => {
13102
13351
  const { t: t2 } = useTranslation();
13103
13352
  const { settings } = useEmbed();
@@ -13107,7 +13356,7 @@ var Selected = ({ isCurrent = false, isTrial = false }) => {
13107
13356
  }
13108
13357
  return isTrial ? t2("Trial selected") : t2("Plan selected");
13109
13358
  }, [t2, isCurrent, isTrial]);
13110
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13359
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13111
13360
  Flex,
13112
13361
  {
13113
13362
  $justifyContent: "center",
@@ -13115,8 +13364,8 @@ var Selected = ({ isCurrent = false, isTrial = false }) => {
13115
13364
  $gap: "0.25rem",
13116
13365
  $padding: "0.625rem 0",
13117
13366
  children: [
13118
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon3, { name: "check-rounded", color: settings.theme.primary }),
13119
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13367
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon3, { name: "check-rounded", color: settings.theme.primary }),
13368
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13120
13369
  Text,
13121
13370
  {
13122
13371
  $size: 0.9375 * settings.theme.typography.text.fontSize,
@@ -13152,8 +13401,8 @@ var PlanButtonGroup = ({
13152
13401
  };
13153
13402
  }, [data, plan]);
13154
13403
  if (isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable) {
13155
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
13156
- !isTrialing && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: isSelected && shouldTrial ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13404
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
13405
+ !isTrialing && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: isSelected && shouldTrial ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13157
13406
  Button,
13158
13407
  {
13159
13408
  type: "button",
@@ -13175,16 +13424,16 @@ var PlanButtonGroup = ({
13175
13424
  $color: "primary",
13176
13425
  $variant: "filled",
13177
13426
  $fullWidth: true,
13178
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13427
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13179
13428
  Tooltip,
13180
13429
  {
13181
- trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13182
- content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13430
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13431
+ content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13183
13432
  }
13184
13433
  ) : t2("Start X day trial", { days: plan.trialDays })
13185
13434
  }
13186
13435
  ) }),
13187
- !plan.custom && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13436
+ !plan.custom && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13188
13437
  Button,
13189
13438
  {
13190
13439
  type: "button",
@@ -13196,18 +13445,18 @@ var PlanButtonGroup = ({
13196
13445
  $color: "primary",
13197
13446
  $variant: isTrialing ? "filled" : "text",
13198
13447
  $fullWidth: true,
13199
- children: !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13448
+ children: !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13200
13449
  Tooltip,
13201
13450
  {
13202
- trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13203
- content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13451
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13452
+ content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13204
13453
  }
13205
13454
  ) : t2("Choose plan")
13206
13455
  }
13207
13456
  ) })
13208
13457
  ] });
13209
13458
  }
13210
- return isSelected ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13459
+ return isSelected ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13211
13460
  Button,
13212
13461
  {
13213
13462
  type: "button",
@@ -13226,11 +13475,11 @@ var PlanButtonGroup = ({
13226
13475
  $color: "primary",
13227
13476
  $variant: "filled",
13228
13477
  $fullWidth: true,
13229
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13478
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13230
13479
  Tooltip,
13231
13480
  {
13232
- trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13233
- content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13481
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
13482
+ content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
13234
13483
  }
13235
13484
  ) : t2("Choose plan")
13236
13485
  }
@@ -13273,7 +13522,7 @@ var Plan = ({
13273
13522
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
13274
13523
  }, [plans]);
13275
13524
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13276
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13525
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13277
13526
  Box,
13278
13527
  {
13279
13528
  $display: "grid",
@@ -13282,6 +13531,7 @@ var Plan = ({
13282
13531
  $flexGrow: 1,
13283
13532
  children: plans.map((plan, planIndex) => {
13284
13533
  const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, period) || {};
13534
+ const credits = isHydratedPlan(plan) ? groupPlanCreditGrants(plan.includedCreditGrants) : [];
13285
13535
  const hasUsageBasedEntitlements = plan.entitlements.some(
13286
13536
  (entitlement) => !!entitlement.priceBehavior
13287
13537
  );
@@ -13289,7 +13539,7 @@ var Plan = ({
13289
13539
  const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? settings.theme.typography.heading3 : settings.theme.typography.heading2;
13290
13540
  const count = entitlementCounts[plan.id];
13291
13541
  const isExpanded = count && count.limit > VISIBLE_ENTITLEMENT_COUNT;
13292
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13542
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13293
13543
  Flex,
13294
13544
  {
13295
13545
  $position: "relative",
@@ -13304,7 +13554,7 @@ var Plan = ({
13304
13554
  $boxShadow: cardBoxShadow
13305
13555
  },
13306
13556
  children: [
13307
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13557
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13308
13558
  Flex,
13309
13559
  {
13310
13560
  $flexDirection: "column",
@@ -13320,10 +13570,10 @@ var Plan = ({
13320
13570
  }
13321
13571
  },
13322
13572
  children: [
13323
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { display: "heading2", children: plan.name }) }),
13324
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: plan.description }) }),
13325
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Box, { children: [
13326
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13573
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { display: "heading2", children: plan.name }) }),
13574
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $marginBottom: "0.5rem", $lineHeight: 1.35, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: plan.description }) }),
13575
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Box, { children: [
13576
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13327
13577
  Text,
13328
13578
  {
13329
13579
  $font: headerPriceFontStyle.fontFamily,
@@ -13333,7 +13583,7 @@ var Plan = ({
13333
13583
  children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency)
13334
13584
  }
13335
13585
  ),
13336
- !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13586
+ !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13337
13587
  Text,
13338
13588
  {
13339
13589
  display: "heading2",
@@ -13345,7 +13595,58 @@ var Plan = ({
13345
13595
  }
13346
13596
  )
13347
13597
  ] }),
13348
- isHydratedPlan(plan) && plan.current && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13598
+ credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13599
+ Flex,
13600
+ {
13601
+ $flexDirection: "column",
13602
+ $gap: "1rem",
13603
+ $flexGrow: 1,
13604
+ $marginTop: "0.5rem",
13605
+ children: credits.map((credit, creditIndex) => {
13606
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13607
+ Flex,
13608
+ {
13609
+ $flexWrap: "wrap",
13610
+ $justifyContent: "space-between",
13611
+ $alignItems: "center",
13612
+ $gap: "1rem",
13613
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $gap: "1rem", children: [
13614
+ credit.icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13615
+ Icon3,
13616
+ {
13617
+ name: credit.icon,
13618
+ color: settings.theme.primary,
13619
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13620
+ rounded: true
13621
+ }
13622
+ ),
13623
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13624
+ Flex,
13625
+ {
13626
+ $flexDirection: "column",
13627
+ $justifyContent: "center",
13628
+ $gap: "0.5rem",
13629
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text, { children: [
13630
+ credit.quantity,
13631
+ " ",
13632
+ getFeatureName(credit, credit.quantity),
13633
+ credit.period && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13634
+ " ",
13635
+ t2("per"),
13636
+ " ",
13637
+ credit.period
13638
+ ] })
13639
+ ] })
13640
+ }
13641
+ )
13642
+ ] })
13643
+ },
13644
+ creditIndex
13645
+ );
13646
+ })
13647
+ }
13648
+ ),
13649
+ isHydratedPlan(plan) && plan.current && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13349
13650
  Flex,
13350
13651
  {
13351
13652
  $position: "absolute",
@@ -13354,7 +13655,7 @@ var Plan = ({
13354
13655
  $backgroundColor: settings.theme.primary,
13355
13656
  $borderRadius: "9999px",
13356
13657
  $padding: "0.125rem 0.85rem",
13357
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13658
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13358
13659
  Text,
13359
13660
  {
13360
13661
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -13367,7 +13668,7 @@ var Plan = ({
13367
13668
  ]
13368
13669
  }
13369
13670
  ),
13370
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13671
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13371
13672
  Flex,
13372
13673
  {
13373
13674
  $flexDirection: "column",
@@ -13376,55 +13677,115 @@ var Plan = ({
13376
13677
  $gap: `${cardPadding}rem`,
13377
13678
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13378
13679
  children: [
13379
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
13380
- plan.entitlements.reduce(
13381
- (acc, entitlement, entitlementIndex) => {
13382
- const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
13383
- const limit = entitlement.softLimit ?? entitlement.valueNumeric;
13384
- const {
13385
- price: entitlementPrice,
13386
- priceTier: entitlementPriceTiers,
13387
- currency: entitlementCurrency,
13388
- packageSize: entitlementPackageSize = 1
13389
- } = getEntitlementPrice(entitlement, period) || {};
13390
- const metricPeriodName = getMetricPeriodName(entitlement);
13391
- if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
13392
- return acc;
13393
- }
13394
- acc.push(
13395
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13396
- Flex,
13397
- {
13398
- $flexWrap: "wrap",
13399
- $justifyContent: "space-between",
13400
- $alignItems: "center",
13401
- $gap: "1rem",
13402
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $gap: "1rem", children: [
13403
- entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13404
- Icon3,
13405
- {
13406
- name: entitlement.feature.icon,
13407
- color: settings.theme.primary,
13408
- background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13409
- rounded: true
13410
- }
13411
- ),
13412
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13413
- Flex,
13414
- {
13415
- $flexDirection: "column",
13416
- $justifyContent: "center",
13417
- $gap: "0.5rem",
13418
- children: [
13419
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13680
+ plan.entitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
13681
+ plan.entitlements.map((entitlement, entitlementIndex) => {
13682
+ const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
13683
+ const limit = entitlement.softLimit ?? entitlement.valueNumeric;
13684
+ const {
13685
+ price: entitlementPrice,
13686
+ priceTier: entitlementPriceTiers,
13687
+ currency: entitlementCurrency,
13688
+ packageSize: entitlementPackageSize = 1
13689
+ } = getEntitlementPrice(entitlement, period) || {};
13690
+ const metricPeriodName = getMetricPeriodName(entitlement);
13691
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13692
+ Flex,
13693
+ {
13694
+ $flexWrap: "wrap",
13695
+ $justifyContent: "space-between",
13696
+ $alignItems: "center",
13697
+ $gap: "1rem",
13698
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $gap: "1rem", children: [
13699
+ entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13700
+ Icon3,
13701
+ {
13702
+ name: entitlement.feature.icon,
13703
+ color: settings.theme.primary,
13704
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
13705
+ rounded: true
13706
+ }
13707
+ ),
13708
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13709
+ Flex,
13710
+ {
13711
+ $flexDirection: "column",
13712
+ $justifyContent: "center",
13713
+ $gap: "0.5rem",
13714
+ children: [
13715
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13716
+ formatCurrency(
13717
+ entitlementPrice,
13718
+ entitlementCurrency
13719
+ ),
13720
+ " ",
13721
+ t2("per"),
13722
+ " ",
13723
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13724
+ entitlementPackageSize,
13725
+ " "
13726
+ ] }),
13727
+ getFeatureName(
13728
+ entitlement.feature,
13729
+ entitlementPackageSize
13730
+ ),
13731
+ entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13732
+ " ",
13733
+ t2("per"),
13734
+ " ",
13735
+ period
13736
+ ] })
13737
+ ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13738
+ TieredPricingDetails,
13739
+ {
13740
+ entitlement,
13741
+ period
13742
+ }
13743
+ ) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13744
+ entitlement.consumptionRate,
13745
+ " ",
13746
+ getFeatureName(
13747
+ entitlement.valueCredit,
13748
+ entitlement.consumptionRate || void 0
13749
+ ),
13750
+ " ",
13751
+ t2("per"),
13752
+ " ",
13753
+ getFeatureName(entitlement.feature, 1)
13754
+ ] }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13755
+ entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
13756
+ item: getFeatureName(
13757
+ entitlement.feature
13758
+ )
13759
+ }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13760
+ formatNumber(limit),
13761
+ " ",
13762
+ getFeatureName(
13763
+ entitlement.feature,
13764
+ limit
13765
+ )
13766
+ ] }),
13767
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13768
+ " ",
13769
+ t2("per"),
13770
+ " ",
13771
+ t2(metricPeriodName)
13772
+ ] })
13773
+ ] }) : entitlement.feature.name }),
13774
+ entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13775
+ Text,
13776
+ {
13777
+ style: { opacity: 0.54 },
13778
+ $size: 0.875 * settings.theme.typography.text.fontSize,
13779
+ $color: settings.theme.typography.text.color,
13780
+ children: [
13781
+ t2("then"),
13782
+ " ",
13420
13783
  formatCurrency(
13421
13784
  entitlementPrice,
13422
13785
  entitlementCurrency
13423
13786
  ),
13424
- " ",
13425
- t2("per"),
13426
- " ",
13427
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13787
+ "/",
13788
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13428
13789
  entitlementPackageSize,
13429
13790
  " "
13430
13791
  ] }),
@@ -13432,99 +13793,41 @@ var Plan = ({
13432
13793
  entitlement.feature,
13433
13794
  entitlementPackageSize
13434
13795
  ),
13435
- entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13436
- " ",
13437
- t2("per"),
13438
- " ",
13439
- period
13440
- ] })
13441
- ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13442
- TieredPricingDetails,
13443
- {
13444
- entitlement,
13445
- period
13446
- }
13447
- ) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13448
- entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
13449
- item: getFeatureName(
13450
- entitlement.feature
13451
- )
13452
- }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13453
- formatNumber(limit),
13454
- " ",
13455
- getFeatureName(
13456
- entitlement.feature,
13457
- limit
13458
- )
13459
- ] }),
13460
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13461
- " ",
13462
- t2("per"),
13463
- " ",
13464
- t2(metricPeriodName)
13796
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13797
+ "/",
13798
+ shortenPeriod(period)
13465
13799
  ] })
13466
- ] }) : entitlement.feature.name }),
13467
- entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13468
- Text,
13469
- {
13470
- style: { opacity: 0.54 },
13471
- $size: 0.875 * settings.theme.typography.text.fontSize,
13472
- $color: settings.theme.typography.text.color,
13473
- children: [
13474
- t2("then"),
13475
- " ",
13476
- formatCurrency(
13477
- entitlementPrice,
13478
- entitlementCurrency
13479
- ),
13480
- "/",
13481
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13482
- entitlementPackageSize,
13483
- " "
13484
- ] }),
13485
- getFeatureName(
13486
- entitlement.feature,
13487
- entitlementPackageSize
13488
- ),
13489
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
13490
- "/",
13491
- shortenPeriod(period)
13492
- ] })
13493
- ]
13494
- }
13495
- ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Flex, { $alignItems: "center", children: [
13496
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13497
- PricingTiersTooltip,
13498
- {
13499
- feature: entitlement.feature,
13500
- period,
13501
- currency: entitlementCurrency,
13502
- priceTiers: entitlementPriceTiers
13503
- }
13504
- ),
13505
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13506
- Text,
13507
- {
13508
- style: { opacity: 0.54 },
13509
- $size: 0.875 * settings.theme.typography.text.fontSize,
13510
- $color: settings.theme.typography.text.color,
13511
- children: t2("Tier-based")
13512
- }
13513
- )
13514
- ] })
13515
- ]
13516
- }
13517
- )
13518
- ] })
13519
- },
13520
- entitlementIndex
13521
- )
13522
- );
13523
- return acc;
13524
- },
13525
- []
13526
- ).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
13527
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
13800
+ ]
13801
+ }
13802
+ ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Flex, { $alignItems: "center", children: [
13803
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13804
+ PricingTiersTooltip,
13805
+ {
13806
+ feature: entitlement.feature,
13807
+ period,
13808
+ currency: entitlementCurrency,
13809
+ priceTiers: entitlementPriceTiers
13810
+ }
13811
+ ),
13812
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13813
+ Text,
13814
+ {
13815
+ style: { opacity: 0.54 },
13816
+ $size: 0.875 * settings.theme.typography.text.fontSize,
13817
+ $color: settings.theme.typography.text.color,
13818
+ children: t2("Tier-based")
13819
+ }
13820
+ )
13821
+ ] })
13822
+ ]
13823
+ }
13824
+ )
13825
+ ] })
13826
+ },
13827
+ entitlementIndex
13828
+ );
13829
+ }).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
13830
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13528
13831
  Flex,
13529
13832
  {
13530
13833
  $alignItems: "center",
@@ -13532,14 +13835,14 @@ var Plan = ({
13532
13835
  $gap: "0.5rem",
13533
13836
  $marginTop: "1rem",
13534
13837
  children: [
13535
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13838
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13536
13839
  Icon3,
13537
13840
  {
13538
13841
  name: isExpanded ? "chevron-up" : "chevron-down",
13539
13842
  color: "#D0D0D0"
13540
13843
  }
13541
13844
  ),
13542
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13845
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13543
13846
  Text,
13544
13847
  {
13545
13848
  onClick: () => handleToggleShowAll(plan.id),
@@ -13559,7 +13862,7 @@ var Plan = ({
13559
13862
  }
13560
13863
  )
13561
13864
  ] }),
13562
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
13865
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13563
13866
  PlanButtonGroup,
13564
13867
  {
13565
13868
  plan,
@@ -13578,147 +13881,144 @@ var Plan = ({
13578
13881
  );
13579
13882
  })
13580
13883
  }
13581
- ) });
13884
+ );
13582
13885
  };
13583
13886
 
13584
13887
  // src/components/shared/checkout-dialog/Usage.tsx
13585
- var import_jsx_runtime19 = require("react/jsx-runtime");
13888
+ var import_jsx_runtime20 = require("react/jsx-runtime");
13586
13889
  var Usage = ({ entitlements, updateQuantity, period }) => {
13587
13890
  const { settings } = useEmbed();
13588
13891
  const { t: t2 } = useTranslation();
13589
13892
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13590
13893
  const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
13591
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce(
13592
- (acc, entitlement, index) => {
13593
- if (entitlement.feature) {
13594
- const {
13595
- price,
13596
- currency,
13597
- packageSize = 1
13598
- } = getEntitlementPrice(entitlement, period) || {};
13599
- acc.push(
13600
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13601
- Flex,
13602
- {
13603
- $justifyContent: "space-between",
13604
- $alignItems: "center",
13605
- $gap: "1rem",
13606
- $padding: `${cardPadding}rem`,
13607
- $backgroundColor: settings.theme.card.background,
13608
- $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13609
- ...settings.theme.card.hasShadow && {
13610
- $boxShadow: cardBoxShadow
13611
- },
13612
- children: [
13613
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13614
- Flex,
13615
- {
13616
- $flexDirection: "column",
13617
- $gap: "0.75rem",
13618
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13619
- children: [
13620
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { display: "heading2", children: entitlement.feature.name }) }),
13621
- entitlement.feature.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { children: entitlement.feature.description }) })
13622
- ]
13623
- }
13624
- ),
13625
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13626
- Flex,
13627
- {
13628
- $flexDirection: "column",
13629
- $gap: "0.5rem",
13630
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13631
- children: [
13632
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13633
- Input,
13634
- {
13635
- $size: "lg",
13636
- type: "number",
13637
- value: entitlement.quantity,
13638
- min: 1,
13639
- autoFocus: true,
13640
- onFocus: (event) => {
13641
- event.target.select();
13642
- },
13643
- onChange: (event) => {
13644
- event.preventDefault();
13645
- const value = parseInt(event.target.value);
13646
- if (!isNaN(value) && value > 0) {
13647
- updateQuantity(entitlement.id, value);
13648
- }
13894
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement, index) => {
13895
+ if (entitlement.feature) {
13896
+ const {
13897
+ price,
13898
+ currency,
13899
+ packageSize = 1
13900
+ } = getEntitlementPrice(entitlement, period) || {};
13901
+ acc.push(
13902
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13903
+ Flex,
13904
+ {
13905
+ $justifyContent: "space-between",
13906
+ $alignItems: "center",
13907
+ $gap: "1rem",
13908
+ $padding: `${cardPadding}rem`,
13909
+ $backgroundColor: settings.theme.card.background,
13910
+ $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13911
+ ...settings.theme.card.hasShadow && {
13912
+ $boxShadow: cardBoxShadow
13913
+ },
13914
+ children: [
13915
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13916
+ Flex,
13917
+ {
13918
+ $flexDirection: "column",
13919
+ $gap: "0.75rem",
13920
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13921
+ children: [
13922
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { display: "heading2", children: entitlement.feature.name }) }),
13923
+ entitlement.feature.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { children: entitlement.feature.description }) })
13924
+ ]
13925
+ }
13926
+ ),
13927
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13928
+ Flex,
13929
+ {
13930
+ $flexDirection: "column",
13931
+ $gap: "0.5rem",
13932
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13933
+ children: [
13934
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13935
+ Input,
13936
+ {
13937
+ $size: "lg",
13938
+ type: "number",
13939
+ value: entitlement.quantity,
13940
+ min: 1,
13941
+ autoFocus: true,
13942
+ onFocus: (event) => {
13943
+ event.target.select();
13944
+ },
13945
+ onChange: (event) => {
13946
+ event.preventDefault();
13947
+ const value = parseInt(event.target.value);
13948
+ if (!isNaN(value) && value > 0) {
13949
+ updateQuantity(entitlement.id, value);
13649
13950
  }
13650
13951
  }
13952
+ }
13953
+ ),
13954
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
13955
+ Text,
13956
+ {
13957
+ style: { opacity: 0.54 },
13958
+ $size: unitPriceFontSize,
13959
+ $color: settings.theme.typography.text.color,
13960
+ children: t2("Currently using", {
13961
+ quantity: entitlement.usage,
13962
+ unit: getFeatureName(entitlement.feature)
13963
+ })
13964
+ }
13965
+ ),
13966
+ entitlement.quantity < entitlement.usage && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { $size: unitPriceFontSize, $color: "#DB6669", children: t2("Cannot downgrade entitlement") })
13967
+ ]
13968
+ }
13969
+ ),
13970
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13971
+ Box,
13972
+ {
13973
+ $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13974
+ $textAlign: "right",
13975
+ children: [
13976
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Text, { children: [
13977
+ formatCurrency(
13978
+ (price ?? 0) * entitlement.quantity,
13979
+ currency
13651
13980
  ),
13652
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
13653
- Text,
13654
- {
13655
- style: { opacity: 0.54 },
13656
- $size: unitPriceFontSize,
13657
- $color: settings.theme.typography.text.color,
13658
- children: t2("Currently using", {
13659
- quantity: entitlement.usage,
13660
- unit: getFeatureName(entitlement.feature)
13661
- })
13662
- }
13663
- ),
13664
- entitlement.quantity < entitlement.usage && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Text, { $size: unitPriceFontSize, $color: "#DB6669", children: t2("Cannot downgrade entitlement") })
13665
- ]
13666
- }
13667
- ),
13668
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13669
- Box,
13670
- {
13671
- $flexBasis: `calc(${100 / 3}% - 0.375rem)`,
13672
- $textAlign: "right",
13673
- children: [
13674
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Text, { children: [
13675
- formatCurrency(
13676
- (price ?? 0) * entitlement.quantity,
13677
- currency
13678
- ),
13679
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
13680
- "/",
13681
- shortenPeriod(period)
13682
- ] })
13683
- ] }) }),
13684
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
13685
- Text,
13686
- {
13687
- style: { opacity: 0.54 },
13688
- $size: unitPriceFontSize,
13689
- $color: settings.theme.typography.text.color,
13690
- children: [
13691
- formatCurrency(price ?? 0, currency),
13692
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
13693
- "/",
13694
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
13695
- packageSize,
13696
- " "
13697
- ] }),
13698
- getFeatureName(entitlement.feature, packageSize),
13699
- "/",
13700
- shortenPeriod(period)
13701
- ] })
13702
- ]
13703
- }
13704
- ) })
13705
- ]
13706
- }
13707
- )
13708
- ]
13709
- },
13710
- index
13711
- )
13712
- );
13713
- }
13714
- return acc;
13715
- },
13716
- []
13717
- ) }) });
13981
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("sub", { children: [
13982
+ "/",
13983
+ shortenPeriod(period)
13984
+ ] })
13985
+ ] }) }),
13986
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
13987
+ Text,
13988
+ {
13989
+ style: { opacity: 0.54 },
13990
+ $size: unitPriceFontSize,
13991
+ $color: settings.theme.typography.text.color,
13992
+ children: [
13993
+ formatCurrency(price ?? 0, currency),
13994
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("sub", { children: [
13995
+ "/",
13996
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
13997
+ packageSize,
13998
+ " "
13999
+ ] }),
14000
+ getFeatureName(entitlement.feature, packageSize),
14001
+ "/",
14002
+ shortenPeriod(period)
14003
+ ] })
14004
+ ]
14005
+ }
14006
+ ) })
14007
+ ]
14008
+ }
14009
+ )
14010
+ ]
14011
+ },
14012
+ index
14013
+ )
14014
+ );
14015
+ }
14016
+ return acc;
14017
+ }, []) });
13718
14018
  };
13719
14019
 
13720
14020
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
13721
- var import_jsx_runtime20 = require("react/jsx-runtime");
14021
+ var import_jsx_runtime21 = require("react/jsx-runtime");
13722
14022
  var createActiveUsageBasedEntitlementsReducer = (entitlements, period) => (acc, entitlement) => {
13723
14023
  if (entitlement.priceBehavior && (period === "month" && entitlement.meteredMonthlyPrice || period === "year" && entitlement.meteredYearlyPrice)) {
13724
14024
  const featureUsage = entitlements.find(
@@ -13795,6 +14095,15 @@ var CheckoutDialog = ({ top = 0 }) => {
13795
14095
  }
13796
14096
  return [];
13797
14097
  });
14098
+ const [creditBundles, setCreditBundles] = (0, import_react30.useState)(() => {
14099
+ if (isCheckoutData(data)) {
14100
+ return data.creditBundles.map((bundle) => ({
14101
+ ...bundle,
14102
+ count: 0
14103
+ }));
14104
+ }
14105
+ return [];
14106
+ });
13798
14107
  const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react30.useState)(
13799
14108
  () => (selectedPlan?.entitlements || []).reduce(
13800
14109
  createActiveUsageBasedEntitlementsReducer(
@@ -13819,7 +14128,7 @@ var CheckoutDialog = ({ top = 0 }) => {
13819
14128
  const isSelectedPlanTrialable = isHydratedPlan(selectedPlan) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
13820
14129
  const checkoutStages = (0, import_react30.useMemo)(() => {
13821
14130
  const stages = [];
13822
- if (availablePlans) {
14131
+ if (availablePlans.length > 0) {
13823
14132
  stages.push({
13824
14133
  id: "plan",
13825
14134
  name: t2("Plan"),
@@ -13844,6 +14153,14 @@ var CheckoutDialog = ({ top = 0 }) => {
13844
14153
  description: t2("Optionally add features to your subscription")
13845
14154
  });
13846
14155
  }
14156
+ if (creditBundles.length > 0) {
14157
+ stages.push({
14158
+ id: "credits",
14159
+ name: t2("Credits"),
14160
+ label: t2("Select credits"),
14161
+ description: t2("Optionally add credit bundles to your subscription")
14162
+ });
14163
+ }
13847
14164
  if (isPaymentMethodRequired) {
13848
14165
  stages.push({
13849
14166
  id: "checkout",
@@ -13855,11 +14172,12 @@ var CheckoutDialog = ({ top = 0 }) => {
13855
14172
  }, [
13856
14173
  t2,
13857
14174
  availablePlans,
13858
- addOns,
13859
- payInAdvanceEntitlements,
13860
- shouldTrial,
13861
14175
  willTrialWithoutPaymentMethod,
14176
+ payInAdvanceEntitlements,
14177
+ addOns,
13862
14178
  isSelectedPlanTrialable,
14179
+ shouldTrial,
14180
+ creditBundles,
13863
14181
  isPaymentMethodRequired
13864
14182
  ]);
13865
14183
  const [checkoutStage, setCheckoutStage] = (0, import_react30.useState)(() => {
@@ -13869,8 +14187,11 @@ var CheckoutDialog = ({ top = 0 }) => {
13869
14187
  if (checkoutState?.usage) {
13870
14188
  return "usage";
13871
14189
  }
14190
+ if (checkoutState?.credits) {
14191
+ return "credits";
14192
+ }
13872
14193
  if (checkoutState?.planId !== currentPlanId) {
13873
- return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : "plan";
14194
+ return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : checkoutStages.some((stage) => stage.id === "credits") ? "credits" : "plan";
13874
14195
  }
13875
14196
  return "plan";
13876
14197
  });
@@ -13920,7 +14241,18 @@ var CheckoutDialog = ({ top = 0 }) => {
13920
14241
  },
13921
14242
  []
13922
14243
  ),
13923
- creditBundles: [],
14244
+ creditBundles: (updates.creditBundles || creditBundles).reduce(
14245
+ (acc, { id, count }) => {
14246
+ if (count > 0) {
14247
+ acc.push({
14248
+ bundleId: id,
14249
+ quantity: count
14250
+ });
14251
+ }
14252
+ return acc;
14253
+ },
14254
+ []
14255
+ ),
13924
14256
  skipTrial,
13925
14257
  ...code && { promoCode: code }
13926
14258
  });
@@ -13966,6 +14298,7 @@ var CheckoutDialog = ({ top = 0 }) => {
13966
14298
  selectedPlan,
13967
14299
  payInAdvanceEntitlements,
13968
14300
  addOns,
14301
+ creditBundles,
13969
14302
  shouldTrial,
13970
14303
  promoCode
13971
14304
  ]
@@ -14062,6 +14395,21 @@ var CheckoutDialog = ({ top = 0 }) => {
14062
14395
  },
14063
14396
  [handlePreviewCheckout]
14064
14397
  );
14398
+ const updateCreditBundleCount = (0, import_react30.useCallback)(
14399
+ (id, updatedCount) => {
14400
+ setCreditBundles((prev2) => {
14401
+ const updated = prev2.map(
14402
+ (bundle) => bundle.id === id ? {
14403
+ ...bundle,
14404
+ count: updatedCount
14405
+ } : bundle
14406
+ );
14407
+ handlePreviewCheckout({ creditBundles: updated });
14408
+ return updated;
14409
+ });
14410
+ },
14411
+ [handlePreviewCheckout]
14412
+ );
14065
14413
  const updatePromoCode = (0, import_react30.useCallback)(
14066
14414
  async (code) => {
14067
14415
  handlePreviewCheckout({ promoCode: code });
@@ -14114,8 +14462,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14114
14462
  const activeCheckoutStage = checkoutStages.find(
14115
14463
  (stage) => stage.id === checkoutStage
14116
14464
  );
14117
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Modal2, { size: "lg", top, contentRef, children: [
14118
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14465
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Modal2, { size: "lg", top, contentRef, children: [
14466
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14119
14467
  Flex,
14120
14468
  {
14121
14469
  $flexWrap: "wrap",
@@ -14125,7 +14473,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14125
14473
  $gap: "1rem"
14126
14474
  }
14127
14475
  },
14128
- children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14476
+ children: checkoutStages.map((stage, index, stages) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14129
14477
  Navigation,
14130
14478
  {
14131
14479
  name: stage.name,
@@ -14140,7 +14488,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14140
14488
  ))
14141
14489
  }
14142
14490
  ) }),
14143
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
14491
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
14144
14492
  Flex,
14145
14493
  {
14146
14494
  $position: "relative",
@@ -14153,7 +14501,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14153
14501
  }
14154
14502
  },
14155
14503
  children: [
14156
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
14504
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
14157
14505
  Flex,
14158
14506
  {
14159
14507
  $flexDirection: "column",
@@ -14168,7 +14516,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14168
14516
  }
14169
14517
  },
14170
14518
  children: [
14171
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
14519
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
14172
14520
  Flex,
14173
14521
  {
14174
14522
  $flexDirection: "column",
@@ -14183,8 +14531,8 @@ var CheckoutDialog = ({ top = 0 }) => {
14183
14531
  }
14184
14532
  },
14185
14533
  children: [
14186
- activeCheckoutStage && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
14187
- activeCheckoutStage.label && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14534
+ activeCheckoutStage && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
14535
+ activeCheckoutStage.label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14188
14536
  Text,
14189
14537
  {
14190
14538
  as: "h3",
@@ -14193,9 +14541,9 @@ var CheckoutDialog = ({ top = 0 }) => {
14193
14541
  children: activeCheckoutStage.label
14194
14542
  }
14195
14543
  ),
14196
- activeCheckoutStage.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: "p", children: activeCheckoutStage.description })
14544
+ activeCheckoutStage.description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { as: "p", children: activeCheckoutStage.description })
14197
14545
  ] }),
14198
- checkoutStage === "plan" && availablePeriods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14546
+ checkoutStage === "plan" && availablePeriods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14199
14547
  PeriodToggle,
14200
14548
  {
14201
14549
  options: availablePeriods,
@@ -14207,7 +14555,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14207
14555
  ]
14208
14556
  }
14209
14557
  ),
14210
- checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14558
+ checkoutStage === "plan" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14211
14559
  Plan,
14212
14560
  {
14213
14561
  isLoading,
@@ -14218,7 +14566,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14218
14566
  shouldTrial
14219
14567
  }
14220
14568
  ),
14221
- checkoutStage === "usage" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14569
+ checkoutStage === "usage" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14222
14570
  Usage,
14223
14571
  {
14224
14572
  isLoading,
@@ -14228,7 +14576,7 @@ var CheckoutDialog = ({ top = 0 }) => {
14228
14576
  updateQuantity: updateUsageBasedEntitlementQuantity
14229
14577
  }
14230
14578
  ),
14231
- checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14579
+ checkoutStage === "addons" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14232
14580
  AddOns,
14233
14581
  {
14234
14582
  isLoading,
@@ -14237,7 +14585,15 @@ var CheckoutDialog = ({ top = 0 }) => {
14237
14585
  toggle: (id) => toggleAddOn(id)
14238
14586
  }
14239
14587
  ),
14240
- checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14588
+ checkoutStage === "credits" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14589
+ Credits,
14590
+ {
14591
+ isLoading,
14592
+ bundles: creditBundles,
14593
+ updateCount: updateCreditBundleCount
14594
+ }
14595
+ ),
14596
+ checkoutStage === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14241
14597
  Checkout,
14242
14598
  {
14243
14599
  isPaymentMethodRequired,
@@ -14248,13 +14604,14 @@ var CheckoutDialog = ({ top = 0 }) => {
14248
14604
  ]
14249
14605
  }
14250
14606
  ),
14251
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14607
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
14252
14608
  Sidebar,
14253
14609
  {
14254
14610
  planPeriod,
14255
14611
  selectedPlan,
14256
14612
  addOns,
14257
14613
  usageBasedEntitlements,
14614
+ creditBundles,
14258
14615
  charges,
14259
14616
  checkoutRef,
14260
14617
  checkoutStage,
@@ -14280,20 +14637,20 @@ var CheckoutDialog = ({ top = 0 }) => {
14280
14637
 
14281
14638
  // src/components/shared/payment-dialog/PaymentDialog.tsx
14282
14639
  var import_react31 = require("react");
14283
- var import_jsx_runtime21 = require("react/jsx-runtime");
14640
+ var import_jsx_runtime22 = require("react/jsx-runtime");
14284
14641
  var PaymentDialog = ({ top = 0 }) => {
14285
14642
  const { t: t2 } = useTranslation();
14286
14643
  const contentRef = (0, import_react31.useRef)(null);
14287
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Modal2, { size: "md", top, contentRef, children: [
14288
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Text, { $size: 18, children: t2("Edit payment method") }) }),
14289
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(PaymentMethodDetails, {})
14644
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Modal2, { size: "md", top, contentRef, children: [
14645
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { $size: 18, children: t2("Edit payment method") }) }),
14646
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(PaymentMethodDetails, {})
14290
14647
  ] });
14291
14648
  };
14292
14649
 
14293
14650
  // src/components/shared/payment-form/PaymentForm.tsx
14294
14651
  var import_react_stripe_js = require("@stripe/react-stripe-js");
14295
14652
  var import_react32 = require("react");
14296
- var import_jsx_runtime22 = require("react/jsx-runtime");
14653
+ var import_jsx_runtime23 = require("react/jsx-runtime");
14297
14654
  var PaymentForm = ({ onConfirm }) => {
14298
14655
  const { t: t2 } = useTranslation();
14299
14656
  const stripe = (0, import_react_stripe_js.useStripe)();
@@ -14332,7 +14689,7 @@ var PaymentForm = ({ onConfirm }) => {
14332
14689
  setIsLoading(false);
14333
14690
  }
14334
14691
  };
14335
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
14692
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
14336
14693
  "form",
14337
14694
  {
14338
14695
  id: "payment-form",
@@ -14344,7 +14701,7 @@ var PaymentForm = ({ onConfirm }) => {
14344
14701
  overflowY: "auto"
14345
14702
  },
14346
14703
  children: [
14347
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
14704
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14348
14705
  import_react_stripe_js.PaymentElement,
14349
14706
  {
14350
14707
  id: "payment-element",
@@ -14353,7 +14710,7 @@ var PaymentForm = ({ onConfirm }) => {
14353
14710
  }
14354
14711
  }
14355
14712
  ) }),
14356
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
14713
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14357
14714
  Button,
14358
14715
  {
14359
14716
  id: "submit",
@@ -14365,7 +14722,7 @@ var PaymentForm = ({ onConfirm }) => {
14365
14722
  children: isLoading ? t2("Loading") : t2("Save payment method")
14366
14723
  }
14367
14724
  ),
14368
- message && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $margin: "1rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Text, { id: "payment-message", $size: 15, $weight: 500, $color: "#DB6669", children: message }) })
14725
+ message && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Box, { $margin: "1rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { id: "payment-message", $size: 15, $weight: 500, $color: "#DB6669", children: message }) })
14369
14726
  ]
14370
14727
  }
14371
14728
  );
@@ -14373,7 +14730,7 @@ var PaymentForm = ({ onConfirm }) => {
14373
14730
 
14374
14731
  // src/components/shared/period-toggle/PeriodToggle.tsx
14375
14732
  var import_react33 = require("react");
14376
- var import_jsx_runtime23 = require("react/jsx-runtime");
14733
+ var import_jsx_runtime24 = require("react/jsx-runtime");
14377
14734
  var PeriodToggle = ({
14378
14735
  options: options2,
14379
14736
  selectedOption,
@@ -14393,7 +14750,7 @@ var PeriodToggle = ({
14393
14750
  }
14394
14751
  return 0;
14395
14752
  }, [selectedPlan]);
14396
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14753
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
14397
14754
  Flex,
14398
14755
  {
14399
14756
  $margin: 0,
@@ -14409,7 +14766,7 @@ var PeriodToggle = ({
14409
14766
  }
14410
14767
  },
14411
14768
  children: options2.map((option) => {
14412
- const element = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14769
+ const element = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
14413
14770
  Flex,
14414
14771
  {
14415
14772
  tabIndex: 0,
@@ -14429,7 +14786,7 @@ var PeriodToggle = ({
14429
14786
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.125)" : "hsla(0, 0%, 100%, 0.125)"
14430
14787
  },
14431
14788
  $borderRadius: "2.5rem",
14432
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14789
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
14433
14790
  Text,
14434
14791
  {
14435
14792
  style: { flexShrink: 0 },
@@ -14442,11 +14799,11 @@ var PeriodToggle = ({
14442
14799
  option
14443
14800
  );
14444
14801
  if (option === "year" && savingsPercentage > 0) {
14445
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
14802
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
14446
14803
  Tooltip,
14447
14804
  {
14448
14805
  trigger: element,
14449
- content: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Text, { $size: 11, $leading: 1, children: selectedOption === "month" ? t2("Save with yearly billing", {
14806
+ content: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { $size: 11, $leading: 1, children: selectedOption === "month" ? t2("Save with yearly billing", {
14450
14807
  percent: savingsPercentage
14451
14808
  }) : t2("Saving with yearly billing", {
14452
14809
  percent: savingsPercentage
@@ -14467,7 +14824,7 @@ var import_react35 = require("react");
14467
14824
 
14468
14825
  // src/components/shared/pricing-tiers-tooltip/PriceText.tsx
14469
14826
  var import_react34 = require("react");
14470
- var import_jsx_runtime24 = require("react/jsx-runtime");
14827
+ var import_jsx_runtime25 = require("react/jsx-runtime");
14471
14828
  var PriceText = ({
14472
14829
  feature,
14473
14830
  period,
@@ -14477,42 +14834,42 @@ var PriceText = ({
14477
14834
  }) => {
14478
14835
  const text = (0, import_react34.useMemo)(() => {
14479
14836
  if (!flatAmount && perUnitPrice) {
14480
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
14837
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14481
14838
  formatCurrency(perUnitPrice, currency),
14482
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("sub", { children: [
14839
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("sub", { children: [
14483
14840
  "/",
14484
14841
  getFeatureName(feature, 1)
14485
14842
  ] })
14486
14843
  ] });
14487
14844
  }
14488
14845
  if (flatAmount && !perUnitPrice) {
14489
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
14846
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14490
14847
  formatCurrency(flatAmount, currency),
14491
- period && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("sub", { children: [
14848
+ period && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("sub", { children: [
14492
14849
  "/",
14493
14850
  shortenPeriod(period)
14494
14851
  ] })
14495
14852
  ] });
14496
14853
  }
14497
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
14854
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14498
14855
  formatCurrency(perUnitPrice, currency),
14499
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("sub", { children: [
14856
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("sub", { children: [
14500
14857
  "/",
14501
14858
  getFeatureName(feature, 1)
14502
14859
  ] }),
14503
14860
  " + ",
14504
14861
  formatCurrency(flatAmount, currency),
14505
- period && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("sub", { children: [
14862
+ period && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("sub", { children: [
14506
14863
  "/",
14507
14864
  shortenPeriod(period)
14508
14865
  ] })
14509
14866
  ] });
14510
14867
  }, [feature, period, currency, flatAmount, perUnitPrice]);
14511
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Text, { $leading: 1, children: text });
14868
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Text, { $leading: 1, children: text });
14512
14869
  };
14513
14870
 
14514
14871
  // src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
14515
- var import_jsx_runtime25 = require("react/jsx-runtime");
14872
+ var import_jsx_runtime26 = require("react/jsx-runtime");
14516
14873
  var PricingTiersTooltip = ({
14517
14874
  feature,
14518
14875
  period,
@@ -14540,10 +14897,10 @@ var PricingTiersTooltip = ({
14540
14897
  if (!priceTiers.length) {
14541
14898
  return null;
14542
14899
  }
14543
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14900
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14544
14901
  Tooltip,
14545
14902
  {
14546
- trigger: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14903
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14547
14904
  Icon3,
14548
14905
  {
14549
14906
  title: "tiered pricing",
@@ -14552,22 +14909,23 @@ var PricingTiersTooltip = ({
14552
14909
  style: { marginLeft: `-${1 / 3}rem` }
14553
14910
  }
14554
14911
  ),
14555
- content: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
14556
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("dl", { children: tiers.map((tier, index) => {
14912
+ content: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
14913
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dl", { children: tiers.map((tier, index) => {
14557
14914
  const flatAmount = typeof tier.flatAmount === "number" ? tier.flatAmount : void 0;
14558
14915
  const perUnitPrice = typeof tier.perUnitPriceDecimal === "string" ? Number(tier.perUnitPriceDecimal) : typeof tier.perUnitPrice === "number" ? tier.perUnitPrice : void 0;
14559
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
14916
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
14560
14917
  Flex,
14561
14918
  {
14562
14919
  $justifyContent: "space-between",
14920
+ $alignItems: "center",
14563
14921
  $gap: "1rem",
14564
14922
  $padding: "0.5rem",
14565
14923
  children: [
14566
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("dt", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Text, { children: [
14924
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dt", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { children: [
14567
14925
  tier.from,
14568
- tier.to === Infinity ? "+" : `\u2013${tier.to}`
14926
+ tier.from !== tier.to && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_jsx_runtime26.Fragment, { children: tier.to === Infinity ? "+" : `\u2013${tier.to}` })
14569
14927
  ] }) }),
14570
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14928
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("dd", { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14571
14929
  PriceText,
14572
14930
  {
14573
14931
  period,
@@ -14582,8 +14940,8 @@ var PricingTiersTooltip = ({
14582
14940
  index
14583
14941
  );
14584
14942
  }) }),
14585
- (tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
14586
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
14943
+ (tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
14944
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
14587
14945
  "hr",
14588
14946
  {
14589
14947
  style: {
@@ -14593,7 +14951,7 @@ var PricingTiersTooltip = ({
14593
14951
  }
14594
14952
  }
14595
14953
  ),
14596
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Text, { children: [
14954
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { children: [
14597
14955
  "\u2139\uFE0F",
14598
14956
  " ",
14599
14957
  tiersMode === "volume" /* Volume */ ? t2("Price by unit based on final tier reached.") : t2("Tiers apply progressively as quantity increases.")
@@ -14662,7 +15020,7 @@ var TieredPricingDetails = ({
14662
15020
 
14663
15021
  // src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
14664
15022
  var import_react37 = require("react");
14665
- var import_jsx_runtime26 = require("react/jsx-runtime");
15023
+ var import_jsx_runtime27 = require("react/jsx-runtime");
14666
15024
  var UnsubscribeDialog = ({ top = 0 }) => {
14667
15025
  const { t: t2 } = useTranslation();
14668
15026
  const { data, setCheckoutState } = useEmbed();
@@ -14706,9 +15064,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14706
15064
  })),
14707
15065
  [currentAddOns, availableAddOns]
14708
15066
  );
14709
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Modal2, { size: "auto", top, contentRef, children: [
14710
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ModalHeader, {}),
14711
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
15067
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Modal2, { size: "auto", top, contentRef, children: [
15068
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ModalHeader, {}),
15069
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
14712
15070
  Flex,
14713
15071
  {
14714
15072
  $position: "relative",
@@ -14719,7 +15077,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14719
15077
  }
14720
15078
  },
14721
15079
  children: [
14722
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
15080
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
14723
15081
  Flex,
14724
15082
  {
14725
15083
  $flexDirection: "column",
@@ -14729,9 +15087,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14729
15087
  $marginTop: "-2.5rem",
14730
15088
  $padding: "0 2.5rem 2.5rem",
14731
15089
  children: [
14732
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
14733
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { as: "h2", display: "heading2", children: t2("Cancel subscription") }),
14734
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Text, { as: "p", children: [
15090
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
15091
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { as: "h2", display: "heading2", children: t2("Cancel subscription") }),
15092
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Text, { as: "p", children: [
14735
15093
  t2(
14736
15094
  "You will retain access to your plan until the end of the billing period, on"
14737
15095
  ),
@@ -14741,9 +15099,9 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14741
15099
  })
14742
15100
  ] })
14743
15101
  ] }),
14744
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
14745
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Text, { as: "p", children: t2("Not ready to cancel?") }),
14746
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
15102
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
15103
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Text, { as: "p", children: t2("Not ready to cancel?") }),
15104
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14747
15105
  Button,
14748
15106
  {
14749
15107
  type: "button",
@@ -14764,7 +15122,7 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14764
15122
  ]
14765
15123
  }
14766
15124
  ),
14767
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
15125
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
14768
15126
  Sidebar,
14769
15127
  {
14770
15128
  planPeriod,
@@ -14785,11 +15143,11 @@ var UnsubscribeDialog = ({ top = 0 }) => {
14785
15143
  };
14786
15144
 
14787
15145
  // src/components/ui/badge/Badge.tsx
14788
- var import_jsx_runtime27 = require("react/jsx-runtime");
15146
+ var import_jsx_runtime28 = require("react/jsx-runtime");
14789
15147
  var Badge = () => {
14790
15148
  const { t: t2 } = useTranslation();
14791
15149
  const { settings } = useEmbed();
14792
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
15150
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
14793
15151
  Flex,
14794
15152
  {
14795
15153
  as: "a",
@@ -14802,82 +15160,82 @@ var Badge = () => {
14802
15160
  $gridColumn: "1 / -1",
14803
15161
  $color: settings.theme.typography.text.color,
14804
15162
  children: [
14805
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Text, { $size: 12, children: [
15163
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Text, { $size: 12, children: [
14806
15164
  t2("Powered by"),
14807
15165
  " "
14808
15166
  ] }),
14809
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
14810
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15167
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
15168
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14811
15169
  "path",
14812
15170
  {
14813
15171
  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",
14814
15172
  fill: "currentColor"
14815
15173
  }
14816
15174
  ),
14817
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15175
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14818
15176
  "path",
14819
15177
  {
14820
15178
  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",
14821
15179
  fill: "currentColor"
14822
15180
  }
14823
15181
  ),
14824
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15182
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14825
15183
  "path",
14826
15184
  {
14827
15185
  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",
14828
15186
  fill: "currentColor"
14829
15187
  }
14830
15188
  ),
14831
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15189
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14832
15190
  "path",
14833
15191
  {
14834
15192
  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",
14835
15193
  fill: "currentColor"
14836
15194
  }
14837
15195
  ),
14838
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15196
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14839
15197
  "path",
14840
15198
  {
14841
15199
  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",
14842
15200
  fill: "currentColor"
14843
15201
  }
14844
15202
  ),
14845
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15203
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14846
15204
  "path",
14847
15205
  {
14848
15206
  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",
14849
15207
  fill: "currentColor"
14850
15208
  }
14851
15209
  ),
14852
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15210
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14853
15211
  "path",
14854
15212
  {
14855
15213
  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",
14856
15214
  fill: "currentColor"
14857
15215
  }
14858
15216
  ),
14859
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15217
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14860
15218
  "path",
14861
15219
  {
14862
15220
  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",
14863
15221
  fill: "currentColor"
14864
15222
  }
14865
15223
  ),
14866
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15224
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14867
15225
  "path",
14868
15226
  {
14869
15227
  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",
14870
15228
  fill: "currentColor"
14871
15229
  }
14872
15230
  ),
14873
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15231
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14874
15232
  "path",
14875
15233
  {
14876
15234
  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",
14877
15235
  fill: "currentColor"
14878
15236
  }
14879
15237
  ),
14880
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
15238
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
14881
15239
  "path",
14882
15240
  {
14883
15241
  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",
@@ -14891,9 +15249,9 @@ var Badge = () => {
14891
15249
  };
14892
15250
 
14893
15251
  // src/components/layout/RenderLayout.tsx
14894
- var import_jsx_runtime28 = require("react/jsx-runtime");
15252
+ var import_jsx_runtime29 = require("react/jsx-runtime");
14895
15253
  var Disabled = () => {
14896
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
15254
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
14897
15255
  Element,
14898
15256
  {
14899
15257
  as: Flex,
@@ -14902,8 +15260,8 @@ var Disabled = () => {
14902
15260
  $alignItems: "center",
14903
15261
  $whiteSpace: "nowrap",
14904
15262
  children: [
14905
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
14906
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Text, { as: "p", children: "Please try again later." })
15263
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
15264
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text, { as: "p", children: "Please try again later." })
14907
15265
  ]
14908
15266
  }
14909
15267
  ) }) });
@@ -14912,7 +15270,7 @@ var RenderLayout = ({ children }) => {
14912
15270
  const { layout } = useEmbed();
14913
15271
  switch (layout) {
14914
15272
  case "disabled":
14915
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Disabled, {});
15273
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Disabled, {});
14916
15274
  default:
14917
15275
  return children;
14918
15276
  }
@@ -14937,7 +15295,7 @@ var StyledViewport = dt.div.withConfig({
14937
15295
  `;
14938
15296
 
14939
15297
  // src/components/layout/viewport/Viewport.tsx
14940
- var import_jsx_runtime29 = require("react/jsx-runtime");
15298
+ var import_jsx_runtime30 = require("react/jsx-runtime");
14941
15299
  var Viewport = (0, import_react38.forwardRef)(
14942
15300
  ({ children, portal, ...props }, ref) => {
14943
15301
  const { data, layout, settings } = useEmbed();
@@ -14963,24 +15321,24 @@ var Viewport = (0, import_react38.forwardRef)(
14963
15321
  parent.style.overflow = "";
14964
15322
  };
14965
15323
  }, [portal, layout]);
14966
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
14967
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(StyledViewport, { ref, ...props, children: [
14968
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(RenderLayout, { children }),
14969
- isBadgeVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Badge, {})
15324
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
15325
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(StyledViewport, { ref, ...props, children: [
15326
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(RenderLayout, { children }),
15327
+ isBadgeVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Badge, {})
14970
15328
  ] }),
14971
- canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CheckoutDialog, { top }), portal || document.body),
15329
+ canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(CheckoutDialog, { top }), portal || document.body),
14972
15330
  layout === "unsubscribe" && (0, import_react_dom2.createPortal)(
14973
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(UnsubscribeDialog, { top }),
15331
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(UnsubscribeDialog, { top }),
14974
15332
  portal || document.body
14975
15333
  ),
14976
- layout === "payment" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PaymentDialog, { top }), portal || document.body)
15334
+ layout === "payment" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(PaymentDialog, { top }), portal || document.body)
14977
15335
  ] });
14978
15336
  }
14979
15337
  );
14980
15338
  Viewport.displayName = "Viewport";
14981
15339
 
14982
15340
  // src/components/elements/button/Button.tsx
14983
- var import_jsx_runtime30 = require("react/jsx-runtime");
15341
+ var import_jsx_runtime31 = require("react/jsx-runtime");
14984
15342
  var resolveDesignProps = (props) => {
14985
15343
  return {
14986
15344
  button: {
@@ -15011,7 +15369,7 @@ var ButtonElement = (0, import_react39.forwardRef)(({ children, className, ...re
15011
15369
  variant: "text"
15012
15370
  }
15013
15371
  };
15014
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
15372
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
15015
15373
  Element,
15016
15374
  {
15017
15375
  as: Flex,
@@ -15019,7 +15377,7 @@ var ButtonElement = (0, import_react39.forwardRef)(({ children, className, ...re
15019
15377
  className,
15020
15378
  $flexDirection: "column",
15021
15379
  $gap: "2rem",
15022
- children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
15380
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
15023
15381
  Button,
15024
15382
  {
15025
15383
  as: "a",
@@ -15044,7 +15402,7 @@ var import_react41 = require("react");
15044
15402
 
15045
15403
  // src/components/elements/included-features/UsageDetails.tsx
15046
15404
  var import_react40 = require("react");
15047
- var import_jsx_runtime31 = require("react/jsx-runtime");
15405
+ var import_jsx_runtime32 = require("react/jsx-runtime");
15048
15406
  var UsageDetails = ({
15049
15407
  entitlement,
15050
15408
  shouldWrapChildren,
@@ -15054,6 +15412,7 @@ var UsageDetails = ({
15054
15412
  allocation,
15055
15413
  allocationType,
15056
15414
  feature,
15415
+ planEntitlement,
15057
15416
  priceBehavior,
15058
15417
  usage,
15059
15418
  softLimit,
@@ -15074,19 +15433,19 @@ var UsageDetails = ({
15074
15433
  }
15075
15434
  const { price, currency, packageSize = 1 } = billingPrice || {};
15076
15435
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof allocation === "number") {
15077
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15436
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15078
15437
  formatNumber(allocation),
15079
15438
  " ",
15080
15439
  getFeatureName(feature, allocation)
15081
15440
  ] });
15082
15441
  }
15083
15442
  if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof price === "number") {
15084
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15443
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15085
15444
  formatCurrency(price, currency),
15086
15445
  " ",
15087
15446
  t2("per"),
15088
15447
  " ",
15089
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15448
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15090
15449
  packageSize,
15091
15450
  " "
15092
15451
  ] }),
@@ -15094,22 +15453,36 @@ var UsageDetails = ({
15094
15453
  ] });
15095
15454
  }
15096
15455
  if (priceBehavior === "overage" /* Overage */ && typeof softLimit === "number") {
15097
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15456
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15098
15457
  formatNumber(softLimit),
15099
15458
  " ",
15100
15459
  getFeatureName(feature, softLimit)
15101
15460
  ] });
15102
15461
  }
15103
15462
  if (priceBehavior === "tier" /* Tiered */) {
15104
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
15463
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
15105
15464
  feature: getFeatureName(feature)
15106
15465
  }) : t2("Up to X units in this tier", {
15107
15466
  amount: formatNumber(currentTier.to),
15108
15467
  feature: getFeatureName(feature, currentTier?.to)
15109
15468
  })) });
15110
15469
  }
15470
+ if (priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
15471
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15472
+ planEntitlement.consumptionRate,
15473
+ " ",
15474
+ getFeatureName(
15475
+ planEntitlement.valueCredit,
15476
+ planEntitlement.consumptionRate
15477
+ ),
15478
+ " ",
15479
+ t2("per"),
15480
+ " ",
15481
+ t2("use")
15482
+ ] });
15483
+ }
15111
15484
  if (!priceBehavior && typeof allocation === "number") {
15112
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15485
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15113
15486
  formatNumber(allocation),
15114
15487
  " ",
15115
15488
  getFeatureName(feature, allocation)
@@ -15123,6 +15496,7 @@ var UsageDetails = ({
15123
15496
  allocation,
15124
15497
  allocationType,
15125
15498
  feature,
15499
+ planEntitlement,
15126
15500
  priceBehavior,
15127
15501
  softLimit,
15128
15502
  billingPrice,
@@ -15137,10 +15511,10 @@ var UsageDetails = ({
15137
15511
  let index = 0;
15138
15512
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof period === "string" && typeof price === "number") {
15139
15513
  acc.push(
15140
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
15514
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Fragment, { children: [
15141
15515
  formatCurrency(price, currency),
15142
15516
  "/",
15143
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
15517
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
15144
15518
  packageSize,
15145
15519
  " "
15146
15520
  ] }),
@@ -15150,9 +15524,9 @@ var UsageDetails = ({
15150
15524
  ] }, index)
15151
15525
  );
15152
15526
  index += 1;
15153
- } else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && typeof usage === "number") {
15527
+ } else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */ || priceBehavior === "credit_burndown" /* Credit */) && typeof usage === "number") {
15154
15528
  acc.push(
15155
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
15529
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Fragment, { children: [
15156
15530
  usage,
15157
15531
  " ",
15158
15532
  getFeatureName(feature, usage),
@@ -15164,14 +15538,14 @@ var UsageDetails = ({
15164
15538
  }
15165
15539
  if (typeof cost === "number" && cost > 0) {
15166
15540
  acc.push(
15167
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
15168
- acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: " \u2022 " }),
15541
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Fragment, { children: [
15542
+ acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: " \u2022 " }),
15169
15543
  formatCurrency(cost, currency)
15170
15544
  ] }, index)
15171
15545
  );
15172
15546
  index += 1;
15173
15547
  if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
15174
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
15548
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Fragment, { children: [
15175
15549
  "/",
15176
15550
  shortenPeriod(period)
15177
15551
  ] }, index));
@@ -15180,8 +15554,8 @@ var UsageDetails = ({
15180
15554
  }
15181
15555
  if (metricResetAt) {
15182
15556
  acc.push(
15183
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_react40.Fragment, { children: [
15184
- acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: " \u2022 " }),
15557
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_react40.Fragment, { children: [
15558
+ acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: " \u2022 " }),
15185
15559
  t2("Resets", {
15186
15560
  date: toPrettyDate(metricResetAt, {
15187
15561
  month: "numeric",
@@ -15218,16 +15592,16 @@ var UsageDetails = ({
15218
15592
  if (!text || !feature?.name) {
15219
15593
  return null;
15220
15594
  }
15221
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
15595
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
15222
15596
  Box,
15223
15597
  {
15224
15598
  $flexBasis: "min-content",
15225
15599
  $flexGrow: "1",
15226
15600
  $textAlign: shouldWrapChildren ? "left" : "right",
15227
15601
  children: [
15228
- layout.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
15229
- layout.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $justifyContent: "end", $alignItems: "center", $whiteSpace: "nowrap", children: [
15230
- priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
15602
+ layout.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
15603
+ layout.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $justifyContent: "end", $alignItems: "center", $whiteSpace: "nowrap", children: [
15604
+ priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
15231
15605
  PricingTiersTooltip,
15232
15606
  {
15233
15607
  feature,
@@ -15236,7 +15610,7 @@ var UsageDetails = ({
15236
15610
  priceTiers: billingPrice?.priceTier
15237
15611
  }
15238
15612
  ),
15239
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText })
15613
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText })
15240
15614
  ] })
15241
15615
  ]
15242
15616
  }
@@ -15244,7 +15618,7 @@ var UsageDetails = ({
15244
15618
  };
15245
15619
 
15246
15620
  // src/components/elements/included-features/IncludedFeatures.tsx
15247
- var import_jsx_runtime32 = require("react/jsx-runtime");
15621
+ var import_jsx_runtime33 = require("react/jsx-runtime");
15248
15622
  function resolveDesignProps2(props) {
15249
15623
  return {
15250
15624
  header: {
@@ -15319,7 +15693,7 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15319
15693
  }
15320
15694
  const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
15321
15695
  const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
15322
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
15696
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15323
15697
  Element,
15324
15698
  {
15325
15699
  as: Flex,
@@ -15328,10 +15702,10 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15328
15702
  $flexDirection: "column",
15329
15703
  $gap: "1rem",
15330
15704
  children: [
15331
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { display: props.header.fontStyle, children: props.header.text }) }),
15705
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: props.header.fontStyle, children: props.header.text }) }),
15332
15706
  featureUsage.slice(0, showCount).map((entitlement, index) => {
15333
15707
  const shouldShowDetails = entitlement.feature?.name && (entitlement.feature?.featureType === "event" /* Event */ || entitlement.feature?.featureType === "trait" /* Trait */);
15334
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
15708
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15335
15709
  Flex,
15336
15710
  {
15337
15711
  ref: (el) => {
@@ -15344,7 +15718,7 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15344
15718
  $alignItems: "center",
15345
15719
  $gap: "1rem",
15346
15720
  children: [
15347
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
15721
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15348
15722
  Flex,
15349
15723
  {
15350
15724
  $alignItems: "center",
@@ -15352,7 +15726,7 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15352
15726
  $flexBasis: "min-content",
15353
15727
  $gap: "1rem",
15354
15728
  children: [
15355
- props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
15729
+ props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15356
15730
  Icon3,
15357
15731
  {
15358
15732
  name: entitlement.feature.icon,
@@ -15361,8 +15735,8 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15361
15735
  rounded: true
15362
15736
  }
15363
15737
  ),
15364
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
15365
- props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
15738
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
15739
+ props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15366
15740
  Text,
15367
15741
  {
15368
15742
  display: props.entitlementExpiration.fontStyle,
@@ -15379,7 +15753,7 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15379
15753
  ]
15380
15754
  }
15381
15755
  ),
15382
- shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
15756
+ shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15383
15757
  UsageDetails,
15384
15758
  {
15385
15759
  entitlement,
@@ -15392,15 +15766,15 @@ var IncludedFeatures = (0, import_react41.forwardRef)(({ className, ...rest }, r
15392
15766
  index
15393
15767
  );
15394
15768
  }),
15395
- shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
15396
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
15769
+ shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
15770
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15397
15771
  Icon3,
15398
15772
  {
15399
15773
  name: isExpanded ? "chevron-up" : "chevron-down",
15400
15774
  color: "#D0D0D0"
15401
15775
  }
15402
15776
  ),
15403
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
15777
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15404
15778
  Text,
15405
15779
  {
15406
15780
  onClick: handleToggleShowAll,
@@ -15418,7 +15792,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
15418
15792
 
15419
15793
  // src/components/elements/invoices/Invoices.tsx
15420
15794
  var import_react42 = require("react");
15421
- var import_jsx_runtime33 = require("react/jsx-runtime");
15795
+ var import_jsx_runtime34 = require("react/jsx-runtime");
15422
15796
  function resolveDesignProps3(props) {
15423
15797
  return {
15424
15798
  header: {
@@ -15488,9 +15862,9 @@ var Invoices = (0, import_react42.forwardRef)(({ className, data, ...rest }, ref
15488
15862
  if (invoices.length === 0) {
15489
15863
  return null;
15490
15864
  }
15491
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Element, { ref, className, children: [
15492
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
15493
- error ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
15865
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Element, { ref, className, children: [
15866
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
15867
+ error ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
15494
15868
  Flex,
15495
15869
  {
15496
15870
  as: TransitionBox,
@@ -15499,8 +15873,8 @@ var Invoices = (0, import_react42.forwardRef)(({ className, data, ...rest }, ref
15499
15873
  $alignItems: "center",
15500
15874
  $gap: "1rem",
15501
15875
  children: [
15502
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
15503
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15876
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
15877
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15504
15878
  Button,
15505
15879
  {
15506
15880
  type: "button",
@@ -15513,12 +15887,12 @@ var Invoices = (0, import_react42.forwardRef)(({ className, data, ...rest }, ref
15513
15887
  )
15514
15888
  ]
15515
15889
  }
15516
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TransitionBox, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
15517
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
15518
- invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
15519
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
15520
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $justifyContent: "space-between", children: [
15521
- props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15890
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TransitionBox, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
15891
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
15892
+ invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
15893
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
15894
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $justifyContent: "space-between", children: [
15895
+ props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15522
15896
  Text,
15523
15897
  {
15524
15898
  display: props.date.fontStyle,
@@ -15532,18 +15906,18 @@ var Invoices = (0, import_react42.forwardRef)(({ className, data, ...rest }, ref
15532
15906
  children: date
15533
15907
  }
15534
15908
  ),
15535
- props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: props.amount.fontStyle, children: amount })
15909
+ props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: props.amount.fontStyle, children: amount })
15536
15910
  ] }, index);
15537
15911
  }) }),
15538
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15539
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15912
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15913
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15540
15914
  Icon3,
15541
15915
  {
15542
15916
  name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
15543
15917
  color: "#D0D0D0"
15544
15918
  }
15545
15919
  ),
15546
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
15920
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15547
15921
  Text,
15548
15922
  {
15549
15923
  onClick: toggleListSize,
@@ -15555,7 +15929,7 @@ var Invoices = (0, import_react42.forwardRef)(({ className, data, ...rest }, ref
15555
15929
  }
15556
15930
  )
15557
15931
  ] })
15558
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: "heading2", children: t2("No invoices created yet") })
15932
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: "heading2", children: t2("No invoices created yet") })
15559
15933
  ] }) })
15560
15934
  ] });
15561
15935
  });
@@ -15565,14 +15939,14 @@ Invoices.displayName = "Invoices";
15565
15939
  var import_react43 = require("react");
15566
15940
 
15567
15941
  // src/components/elements/metered-features/Meter.tsx
15568
- var import_jsx_runtime34 = require("react/jsx-runtime");
15942
+ var import_jsx_runtime35 = require("react/jsx-runtime");
15569
15943
  var Meter = ({ entitlement, usageDetails }) => {
15570
15944
  const { priceBehavior, usage } = entitlement;
15571
15945
  const limit = usageDetails.limit ?? usageDetails.currentTier?.to;
15572
15946
  if (typeof usage !== "number" || !limit || limit === Infinity) {
15573
15947
  return null;
15574
15948
  }
15575
- const meter = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
15949
+ const meter = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
15576
15950
  ProgressBar,
15577
15951
  {
15578
15952
  progress: Math.min(usage, limit) / Math.max(usage, limit) * 100,
@@ -15589,7 +15963,7 @@ var Meter = ({ entitlement, usageDetails }) => {
15589
15963
  };
15590
15964
 
15591
15965
  // src/components/elements/metered-features/PriceDetails.tsx
15592
- var import_jsx_runtime35 = require("react/jsx-runtime");
15966
+ var import_jsx_runtime36 = require("react/jsx-runtime");
15593
15967
  var PriceDetails = ({
15594
15968
  entitlement,
15595
15969
  usageDetails,
@@ -15616,7 +15990,7 @@ var PriceDetails = ({
15616
15990
  if (!feature || typeof currentTierPerUnitPrice !== "number") {
15617
15991
  return null;
15618
15992
  }
15619
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
15993
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
15620
15994
  Flex,
15621
15995
  {
15622
15996
  $justifyContent: "space-between",
@@ -15630,30 +16004,30 @@ var PriceDetails = ({
15630
16004
  $borderBottomRightRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`
15631
16005
  },
15632
16006
  children: [
15633
- priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { children: [
16007
+ priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Text, { children: [
15634
16008
  t2("Additional"),
15635
16009
  ": ",
15636
16010
  formatCurrency(currentTierPerUnitPrice, currency),
15637
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16011
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15638
16012
  "/",
15639
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
16013
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
15640
16014
  packageSize,
15641
16015
  " "
15642
16016
  ] }),
15643
16017
  getFeatureName(feature, packageSize),
15644
- feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
16018
+ feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
15645
16019
  "/",
15646
16020
  shortenPeriod(period)
15647
16021
  ] })
15648
16022
  ] })
15649
- ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
15650
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { children: [
16023
+ ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16024
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Text, { children: [
15651
16025
  t2("Tier"),
15652
16026
  ": ",
15653
16027
  currentTier?.from || 1,
15654
- typeof currentTier?.to === "number" && (currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}`)
16028
+ typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}` })
15655
16029
  ] }),
15656
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
16030
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15657
16031
  PricingTiersTooltip,
15658
16032
  {
15659
16033
  period,
@@ -15664,19 +16038,19 @@ var PriceDetails = ({
15664
16038
  }
15665
16039
  )
15666
16040
  ] }),
15667
- typeof amount === "number" && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { children: [
16041
+ typeof amount === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Text, { children: [
15668
16042
  formatNumber(amount),
15669
16043
  " ",
15670
16044
  getFeatureName(feature, amount),
15671
16045
  " \xB7 ",
15672
16046
  formatCurrency(currentTierPerUnitPrice * amount, currency),
15673
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16047
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15674
16048
  "/",
15675
16049
  shortenPeriod(period)
15676
16050
  ] })
15677
- ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Text, { children: [
16051
+ ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Text, { children: [
15678
16052
  formatCurrency(cost, currency),
15679
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16053
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
15680
16054
  "/",
15681
16055
  shortenPeriod(period)
15682
16056
  ] })
@@ -15704,7 +16078,7 @@ var Container2 = dt.div`
15704
16078
  `;
15705
16079
 
15706
16080
  // src/components/elements/metered-features/MeteredFeatures.tsx
15707
- var import_jsx_runtime36 = require("react/jsx-runtime");
16081
+ var import_jsx_runtime37 = require("react/jsx-runtime");
15708
16082
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
15709
16083
  const { t: t2 } = useTranslation();
15710
16084
  const { feature, priceBehavior, allocation, usage, metricResetAt } = entitlement;
@@ -15733,7 +16107,7 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
15733
16107
  })
15734
16108
  );
15735
16109
  }
15736
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
16110
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
15737
16111
  };
15738
16112
  function resolveDesignProps4(props) {
15739
16113
  return {
@@ -15767,7 +16141,7 @@ var MeteredFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, re
15767
16141
  const { t: t2 } = useTranslation();
15768
16142
  const { data, settings, setCheckoutState } = useEmbed();
15769
16143
  const isLightBackground = useIsLightBackground();
15770
- const { meteredFeatures, period } = (0, import_react43.useMemo)(() => {
16144
+ const { period, meteredFeatures, creditGroups } = (0, import_react43.useMemo)(() => {
15771
16145
  if (isCheckoutData(data)) {
15772
16146
  const period2 = typeof data.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0;
15773
16147
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
@@ -15783,122 +16157,292 @@ var MeteredFeatures = (0, import_react43.forwardRef)(({ className, ...rest }, re
15783
16157
  []
15784
16158
  );
15785
16159
  return {
16160
+ period: period2,
15786
16161
  meteredFeatures: (orderedFeatureUsage || data.featureUsage?.features || []).filter(
15787
- ({ feature }) => feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */
16162
+ ({ priceBehavior, feature }) => (
16163
+ // credit-based entitlements behave differently and should not be shown as a metered feature
16164
+ priceBehavior !== "credit_burndown" /* Credit */ && (feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */)
16165
+ )
15788
16166
  ),
15789
- period: period2
16167
+ creditGroups: groupCreditGrants(data.creditGrants, {
16168
+ groupBy: "credit"
16169
+ })
15790
16170
  };
15791
16171
  }
15792
16172
  return {
16173
+ period: void 0,
15793
16174
  meteredFeatures: [],
15794
- period: void 0
16175
+ creditGroups: []
15795
16176
  };
15796
16177
  }, [props.visibleFeatures, data]);
16178
+ const [creditVisibility, setCreditVisibility] = (0, import_react43.useState)(
16179
+ creditGroups.map(({ id }) => ({ id, isExpanded: false }))
16180
+ );
16181
+ const toggleBalanceDetails = (0, import_react43.useCallback)((id) => {
16182
+ setCreditVisibility(
16183
+ (prev2) => prev2.map(
16184
+ (item) => item.id === id ? { ...item, isExpanded: !item.isExpanded } : item
16185
+ )
16186
+ );
16187
+ }, []);
15797
16188
  const shouldShowFeatures = meteredFeatures.length > 0;
15798
16189
  if (!shouldShowFeatures) {
15799
16190
  return null;
15800
16191
  }
15801
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Container2, { ref, className, children: meteredFeatures.reduce((acc, entitlement, index) => {
15802
- if (!entitlement.feature) {
16192
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Container2, { ref, className, children: [
16193
+ meteredFeatures.reduce((acc, entitlement, index) => {
16194
+ if (!entitlement.feature) {
16195
+ return acc;
16196
+ }
16197
+ const { feature, priceBehavior, usage } = entitlement;
16198
+ const usageDetails = getUsageDetails(entitlement, period);
16199
+ const { limit } = usageDetails;
16200
+ acc.push(
16201
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
16202
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $gap: "1.5rem", children: [
16203
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16204
+ Icon3,
16205
+ {
16206
+ name: feature.icon,
16207
+ color: settings.theme.primary,
16208
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
16209
+ rounded: true
16210
+ }
16211
+ ),
16212
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
16213
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
16214
+ Flex,
16215
+ {
16216
+ ref: (el) => {
16217
+ if (el) {
16218
+ elements.current.push(el);
16219
+ }
16220
+ },
16221
+ $flexWrap: "wrap",
16222
+ $gap: "1rem",
16223
+ children: [
16224
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
16225
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
16226
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
16227
+ ] }),
16228
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
16229
+ Box,
16230
+ {
16231
+ $flexBasis: "min-content",
16232
+ $flexGrow: 1,
16233
+ $textAlign: shouldWrapChildren ? "left" : "right",
16234
+ children: [
16235
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
16236
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
16237
+ formatNumber(limit),
16238
+ " "
16239
+ ] }),
16240
+ getFeatureName(feature, limit)
16241
+ ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
16242
+ formatNumber(usage),
16243
+ " ",
16244
+ getFeatureName(feature, usage),
16245
+ " ",
16246
+ t2("used")
16247
+ ] }) }) }),
16248
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16249
+ Limit,
16250
+ {
16251
+ entitlement,
16252
+ usageDetails,
16253
+ fontStyle: props.allocation.fontStyle
16254
+ }
16255
+ )
16256
+ ]
16257
+ }
16258
+ )
16259
+ ]
16260
+ }
16261
+ ),
16262
+ props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16263
+ Meter,
16264
+ {
16265
+ entitlement,
16266
+ usageDetails
16267
+ }
16268
+ ),
16269
+ priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16270
+ Button,
16271
+ {
16272
+ type: "button",
16273
+ onClick: () => {
16274
+ setCheckoutState({ usage: true });
16275
+ },
16276
+ style: { whiteSpace: "nowrap" },
16277
+ children: t2("Add More")
16278
+ }
16279
+ )
16280
+ ] })
16281
+ ] }),
16282
+ (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16283
+ PriceDetails,
16284
+ {
16285
+ entitlement,
16286
+ usageDetails,
16287
+ period
16288
+ }
16289
+ )
16290
+ ] }, index)
16291
+ );
15803
16292
  return acc;
15804
- }
15805
- const { feature, priceBehavior, usage } = entitlement;
15806
- const usageDetails = getUsageDetails(entitlement, period);
15807
- const { limit } = usageDetails;
15808
- acc.push(
15809
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
15810
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $gap: "1.5rem", children: [
15811
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16293
+ }, []),
16294
+ creditGroups.map((credit, index) => {
16295
+ const isExpanded = creditVisibility.find(({ id }) => credit.id === id)?.isExpanded ?? false;
16296
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
16297
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $gap: "1.5rem", children: [
16298
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
15812
16299
  Icon3,
15813
16300
  {
15814
- name: feature.icon,
16301
+ name: credit.icon,
15815
16302
  color: settings.theme.primary,
15816
16303
  background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
15817
16304
  rounded: true
15818
16305
  }
15819
16306
  ),
15820
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
15821
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
15822
- Flex,
15823
- {
15824
- ref: (el) => {
15825
- if (el) {
15826
- elements.current.push(el);
15827
- }
15828
- },
15829
- $flexWrap: "wrap",
15830
- $gap: "1rem",
15831
- children: [
15832
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
15833
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
15834
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
15835
- ] }),
15836
- /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
15837
- Box,
15838
- {
15839
- $flexBasis: "min-content",
15840
- $flexGrow: 1,
15841
- $textAlign: shouldWrapChildren ? "left" : "right",
15842
- children: [
15843
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
15844
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
15845
- formatNumber(limit),
15846
- " "
15847
- ] }),
15848
- getFeatureName(feature, limit)
15849
- ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
15850
- formatNumber(usage),
15851
- " ",
15852
- getFeatureName(feature, usage),
15853
- " ",
15854
- t2("used")
15855
- ] }) }) }),
15856
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15857
- Limit,
15858
- {
15859
- entitlement,
15860
- usageDetails,
15861
- fontStyle: props.allocation.fontStyle
15862
- }
15863
- )
15864
- ]
15865
- }
15866
- )
15867
- ]
15868
- }
15869
- ),
15870
- props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15871
- Meter,
15872
- {
15873
- entitlement,
15874
- usageDetails
15875
- }
15876
- ),
15877
- priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15878
- Button,
15879
- {
15880
- type: "button",
15881
- onClick: () => {
15882
- setCheckoutState({ usage: true });
15883
- },
15884
- style: { whiteSpace: "nowrap" },
15885
- children: t2("Add More")
15886
- }
15887
- )
16307
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
16308
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
16309
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
16310
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
16311
+ ] }) }),
16312
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $gap: "1rem", children: [
16313
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16314
+ ProgressBar,
16315
+ {
16316
+ progress: credit.total.used / credit.total.value * 100,
16317
+ value: credit.total.used,
16318
+ total: credit.total.value,
16319
+ color: progressColorMap[Math.floor(
16320
+ credit.total.used / credit.total.value * (progressColorMap.length - 1)
16321
+ )]
16322
+ }
16323
+ ),
16324
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16325
+ Button,
16326
+ {
16327
+ type: "button",
16328
+ onClick: () => {
16329
+ setCheckoutState({ credits: true });
16330
+ },
16331
+ style: { whiteSpace: "nowrap" },
16332
+ $size: "sm",
16333
+ children: t2("Buy More")
16334
+ }
16335
+ )
16336
+ ] })
15888
16337
  ] })
15889
16338
  ] }),
15890
- (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
15891
- PriceDetails,
16339
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16340
+ Box,
15892
16341
  {
15893
- entitlement,
15894
- usageDetails,
15895
- period
16342
+ $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
16343
+ $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
16344
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16345
+ TransitionBox,
16346
+ {
16347
+ $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
16348
+ $isExpanded: isExpanded,
16349
+ children: credit.grants.map((grant, index2) => {
16350
+ const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
16351
+ const padding = index2 > 0 ? `0 ${paddingX}rem 1rem` : `1rem ${paddingX}rem`;
16352
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $display: "table-row", children: grant.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
16353
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: t2("X items included in plan", {
16354
+ amount: grant.quantity,
16355
+ item: getFeatureName(credit, grant.quantity)
16356
+ }) }) }),
16357
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16358
+ Box,
16359
+ {
16360
+ $display: "table-cell",
16361
+ $padding: padding,
16362
+ $textAlign: "right",
16363
+ $whiteSpace: "nowrap",
16364
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: t2("Resets", {
16365
+ date: toPrettyDate(
16366
+ modifyDate(grant.expiresAt, 1),
16367
+ {
16368
+ day: "2-digit",
16369
+ month: "2-digit",
16370
+ year: "2-digit"
16371
+ }
16372
+ )
16373
+ }) })
16374
+ }
16375
+ )
16376
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
16377
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: grant.grantReason === "purchased" /* Purchased */ ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: t2("X item bundle", {
16378
+ amount: grant.quantity,
16379
+ item: getFeatureName(credit, 1),
16380
+ createdAt: toPrettyDate(grant.createdAt, {
16381
+ day: "2-digit",
16382
+ month: "2-digit",
16383
+ year: "2-digit"
16384
+ })
16385
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: t2("X item grant", {
16386
+ amount: grant.quantity,
16387
+ item: getFeatureName(
16388
+ credit,
16389
+ grant.quantity
16390
+ ),
16391
+ createdAt: toPrettyDate(grant.createdAt, {
16392
+ day: "2-digit",
16393
+ month: "2-digit",
16394
+ year: "2-digit"
16395
+ })
16396
+ }) }) }) }),
16397
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16398
+ Box,
16399
+ {
16400
+ $display: "table-cell",
16401
+ $padding: padding,
16402
+ $textAlign: "right",
16403
+ $whiteSpace: "nowrap",
16404
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: t2("Expires", {
16405
+ date: toPrettyDate(
16406
+ modifyDate(grant.expiresAt, 1),
16407
+ {
16408
+ day: "2-digit",
16409
+ month: "2-digit",
16410
+ year: "2-digit"
16411
+ }
16412
+ )
16413
+ }) })
16414
+ }
16415
+ )
16416
+ ] }) }, grant.id);
16417
+ })
16418
+ }
16419
+ )
15896
16420
  }
15897
- )
15898
- ] }, index)
15899
- );
15900
- return acc;
15901
- }, []) });
16421
+ ),
16422
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $gap: "0.25rem", children: [
16423
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16424
+ Icon3,
16425
+ {
16426
+ name: "chevron-down",
16427
+ color: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
16428
+ style: {
16429
+ marginLeft: `-${1 / 3}rem`,
16430
+ ...isExpanded && { transform: "rotate(180deg)" }
16431
+ }
16432
+ }
16433
+ ),
16434
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16435
+ Text,
16436
+ {
16437
+ onClick: () => toggleBalanceDetails(credit.id),
16438
+ display: "link",
16439
+ children: isExpanded ? t2("Hide balance details") : t2("See balance details")
16440
+ }
16441
+ )
16442
+ ] })
16443
+ ] }, index);
16444
+ })
16445
+ ] });
15902
16446
  });
15903
16447
  MeteredFeatures.displayName = "MeteredFeatures";
15904
16448
 
@@ -15907,24 +16451,24 @@ var import_react45 = require("react");
15907
16451
 
15908
16452
  // src/components/elements/payment-method/PaymentMethodElement.tsx
15909
16453
  var import_react44 = require("react");
15910
- var import_jsx_runtime37 = require("react/jsx-runtime");
16454
+ var import_jsx_runtime38 = require("react/jsx-runtime");
15911
16455
  var PaymentElement2 = ({
15912
16456
  iconName,
15913
16457
  iconTitle,
15914
16458
  label,
15915
16459
  paymentLast4
15916
16460
  }) => {
15917
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
15918
- iconName && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon3, { name: iconName, title: iconTitle }),
15919
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { $flexGrow: 1, children: [
15920
- label && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: label }),
16461
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
16462
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon3, { name: iconName, title: iconTitle }),
16463
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box, { $flexGrow: 1, children: [
16464
+ label && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: label }),
15921
16465
  " ",
15922
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: paymentLast4 })
16466
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: paymentLast4 })
15923
16467
  ] })
15924
16468
  ] }) });
15925
16469
  };
15926
16470
  var EmptyPaymentElement = () => {
15927
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
16471
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
15928
16472
  };
15929
16473
  var getPaymentMethodData = ({
15930
16474
  accountLast4,
@@ -15989,12 +16533,12 @@ var PaymentMethodElement = ({
15989
16533
  const { t: t2 } = useTranslation();
15990
16534
  const isLightBackground = useIsLightBackground();
15991
16535
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
15992
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
15993
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
15994
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
15995
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
16536
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
16537
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
16538
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
16539
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
15996
16540
  ] }),
15997
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
16541
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
15998
16542
  Flex,
15999
16543
  {
16000
16544
  $justifyContent: "space-between",
@@ -16003,8 +16547,8 @@ var PaymentMethodElement = ({
16003
16547
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
16004
16548
  $borderRadius: "9999px",
16005
16549
  children: [
16006
- paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(EmptyPaymentElement, {}),
16007
- props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16550
+ paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(EmptyPaymentElement, {}),
16551
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16008
16552
  Text,
16009
16553
  {
16010
16554
  onClick: onEdit,
@@ -16037,7 +16581,7 @@ var PaymentListElement = ({
16037
16581
  }
16038
16582
  return `${cardExpMonth}/${formatedYear}`;
16039
16583
  }, [paymentMethod]);
16040
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
16584
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
16041
16585
  Flex,
16042
16586
  {
16043
16587
  $flexDirection: "row",
@@ -16049,21 +16593,21 @@ var PaymentListElement = ({
16049
16593
  $borderStyle: "solid",
16050
16594
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
16051
16595
  children: [
16052
- iconName && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Icon3, { name: iconName, title: iconTitle }),
16053
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { $flexGrow: 1, children: [
16054
- label && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: label }),
16596
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Icon3, { name: iconName, title: iconTitle }),
16597
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box, { $flexGrow: 1, children: [
16598
+ label && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: label }),
16055
16599
  " ",
16056
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: paymentLast4 })
16600
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: paymentLast4 })
16057
16601
  ] }),
16058
- expirationDate && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16602
+ expirationDate && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16059
16603
  Box,
16060
16604
  {
16061
16605
  $flexGrow: 1,
16062
16606
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
16063
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
16607
+ children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
16064
16608
  }
16065
16609
  ),
16066
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16610
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16067
16611
  Text,
16068
16612
  {
16069
16613
  onClick: () => {
@@ -16076,7 +16620,7 @@ var PaymentListElement = ({
16076
16620
  children: t("Set default")
16077
16621
  }
16078
16622
  ) }),
16079
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16623
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16080
16624
  Icon3,
16081
16625
  {
16082
16626
  tabIndex: 0,
@@ -16098,7 +16642,7 @@ var PaymentListElement = ({
16098
16642
  };
16099
16643
 
16100
16644
  // src/components/elements/payment-method/PaymentMethod.tsx
16101
- var import_jsx_runtime38 = require("react/jsx-runtime");
16645
+ var import_jsx_runtime39 = require("react/jsx-runtime");
16102
16646
  var resolveDesignProps5 = (props) => {
16103
16647
  return {
16104
16648
  header: {
@@ -16139,7 +16683,7 @@ var PaymentMethod = (0, import_react45.forwardRef)(({ children, className, porta
16139
16683
  monthsToExpiration: void 0
16140
16684
  };
16141
16685
  }, [data]);
16142
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16686
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
16143
16687
  PaymentMethodElement,
16144
16688
  {
16145
16689
  paymentMethod,
@@ -16308,7 +16852,7 @@ var loadStripe = function loadStripe2() {
16308
16852
 
16309
16853
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
16310
16854
  var import_react46 = require("react");
16311
- var import_jsx_runtime39 = require("react/jsx-runtime");
16855
+ var import_jsx_runtime40 = require("react/jsx-runtime");
16312
16856
  var resolveDesignProps6 = () => {
16313
16857
  return {
16314
16858
  header: {
@@ -16447,8 +16991,8 @@ var PaymentMethodDetails = ({
16447
16991
  showPaymentForm,
16448
16992
  initializePaymentMethod
16449
16993
  ]);
16450
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $position: "relative", children: [
16451
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
16994
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $position: "relative", children: [
16995
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16452
16996
  Flex,
16453
16997
  {
16454
16998
  $position: "absolute",
@@ -16457,7 +17001,7 @@ var PaymentMethodDetails = ({
16457
17001
  $alignItems: "center",
16458
17002
  $width: "100%",
16459
17003
  $height: "100%",
16460
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17004
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16461
17005
  Loader,
16462
17006
  {
16463
17007
  $color: settings.theme.primary,
@@ -16467,7 +17011,7 @@ var PaymentMethodDetails = ({
16467
17011
  )
16468
17012
  }
16469
17013
  ),
16470
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17014
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
16471
17015
  Flex,
16472
17016
  {
16473
17017
  $position: "relative",
@@ -16480,7 +17024,7 @@ var PaymentMethodDetails = ({
16480
17024
  $visibility: isLoading ? "hidden" : "visible",
16481
17025
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
16482
17026
  children: [
16483
- setupIntent && showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17027
+ setupIntent && showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
16484
17028
  import_react_stripe_js2.Elements,
16485
17029
  {
16486
17030
  stripe,
@@ -16510,7 +17054,7 @@ var PaymentMethodDetails = ({
16510
17054
  clientSecret: setupIntent?.setupIntentClientSecret
16511
17055
  },
16512
17056
  children: [
16513
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17057
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16514
17058
  PaymentForm,
16515
17059
  {
16516
17060
  onConfirm: async (paymentMethodId) => {
@@ -16520,7 +17064,7 @@ var PaymentMethodDetails = ({
16520
17064
  }
16521
17065
  }
16522
17066
  ),
16523
- currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17067
+ currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16524
17068
  Text,
16525
17069
  {
16526
17070
  onClick: focusExistingPaymentMethods,
@@ -16533,8 +17077,8 @@ var PaymentMethodDetails = ({
16533
17077
  ) })
16534
17078
  ]
16535
17079
  }
16536
- ) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
16537
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17080
+ ) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
17081
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16538
17082
  PaymentMethodElement,
16539
17083
  {
16540
17084
  paymentMethod: currentPaymentMethod,
@@ -16542,8 +17086,8 @@ var PaymentMethodDetails = ({
16542
17086
  ...props
16543
17087
  }
16544
17088
  ),
16545
- paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16546
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17089
+ paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17090
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16547
17091
  Text,
16548
17092
  {
16549
17093
  onClick: toggleShowPaymentMethods,
@@ -16554,17 +17098,17 @@ var PaymentMethodDetails = ({
16554
17098
  children: t2("Choose different payment method")
16555
17099
  }
16556
17100
  ),
16557
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17101
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16558
17102
  Icon3,
16559
17103
  {
16560
17104
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down"
16561
17105
  }
16562
17106
  )
16563
17107
  ] }),
16564
- showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
16565
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
17108
+ showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
17109
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
16566
17110
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
16567
- ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17111
+ ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16568
17112
  PaymentListElement,
16569
17113
  {
16570
17114
  paymentMethod,
@@ -16573,7 +17117,7 @@ var PaymentMethodDetails = ({
16573
17117
  },
16574
17118
  paymentMethod.id
16575
17119
  )) }),
16576
- (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17120
+ (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
16577
17121
  Button,
16578
17122
  {
16579
17123
  type: "button",
@@ -16585,7 +17129,7 @@ var PaymentMethodDetails = ({
16585
17129
  )
16586
17130
  ] })
16587
17131
  ] }),
16588
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
17132
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
16589
17133
  ]
16590
17134
  }
16591
17135
  )
@@ -16596,9 +17140,9 @@ var PaymentMethodDetails = ({
16596
17140
  var import_react48 = require("react");
16597
17141
 
16598
17142
  // src/components/elements/plan-manager/AddOn.tsx
16599
- var import_jsx_runtime40 = require("react/jsx-runtime");
17143
+ var import_jsx_runtime41 = require("react/jsx-runtime");
16600
17144
  var AddOn = ({ addOn, currency, layout }) => {
16601
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
17145
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
16602
17146
  Flex,
16603
17147
  {
16604
17148
  $justifyContent: "space-between",
@@ -16606,10 +17150,10 @@ var AddOn = ({ addOn, currency, layout }) => {
16606
17150
  $flexWrap: "wrap",
16607
17151
  $gap: "1rem",
16608
17152
  children: [
16609
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
16610
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Text, { children: [
17153
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
17154
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { children: [
16611
17155
  formatCurrency(addOn.planPrice, currency),
16612
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
17156
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
16613
17157
  ] })
16614
17158
  ]
16615
17159
  }
@@ -16618,7 +17162,7 @@ var AddOn = ({ addOn, currency, layout }) => {
16618
17162
 
16619
17163
  // src/components/elements/plan-manager/UsageDetails.tsx
16620
17164
  var import_react47 = require("react");
16621
- var import_jsx_runtime41 = require("react/jsx-runtime");
17165
+ var import_jsx_runtime42 = require("react/jsx-runtime");
16622
17166
  var UsageDetails2 = ({
16623
17167
  entitlement,
16624
17168
  period,
@@ -16640,9 +17184,9 @@ var UsageDetails2 = ({
16640
17184
  let index = 0;
16641
17185
  if (entitlement.priceBehavior === "overage" /* Overage */) {
16642
17186
  acc.push(
16643
- amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react47.Fragment, { children: t2("X additional", {
17187
+ amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react47.Fragment, { children: t2("X additional", {
16644
17188
  amount
16645
- }) }, index) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react47.Fragment, { children: [
17189
+ }) }, index) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react47.Fragment, { children: [
16646
17190
  t2("Additional"),
16647
17191
  ": "
16648
17192
  ] }, index)
@@ -16653,16 +17197,16 @@ var UsageDetails2 = ({
16653
17197
  if (entitlement.priceBehavior !== "tier" /* Tiered */ && entitlement.feature && typeof price === "number" && !amount) {
16654
17198
  const packageSize = billingPrice?.packageSize ?? 1;
16655
17199
  acc.push(
16656
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react47.Fragment, { children: [
17200
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react47.Fragment, { children: [
16657
17201
  formatCurrency(price, billingPrice?.currency),
16658
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("sub", { children: [
17202
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
16659
17203
  "/",
16660
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
17204
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
16661
17205
  packageSize,
16662
17206
  " "
16663
17207
  ] }),
16664
17208
  getFeatureName(entitlement.feature, packageSize),
16665
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
17209
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
16666
17210
  "/",
16667
17211
  shortenPeriod(period)
16668
17212
  ] })
@@ -16671,13 +17215,40 @@ var UsageDetails2 = ({
16671
17215
  );
16672
17216
  index += 1;
16673
17217
  }
17218
+ if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
17219
+ const creditAmount = entitlement.planEntitlement.consumptionRate * amount;
17220
+ acc.push(
17221
+ creditAmount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react47.Fragment, { children: [
17222
+ creditAmount,
17223
+ " ",
17224
+ getFeatureName(
17225
+ entitlement.planEntitlement.valueCredit,
17226
+ creditAmount
17227
+ ),
17228
+ " ",
17229
+ t2("used")
17230
+ ] }, index) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_react47.Fragment, { children: [
17231
+ entitlement.planEntitlement.consumptionRate,
17232
+ " ",
17233
+ getFeatureName(
17234
+ entitlement.planEntitlement.valueCredit,
17235
+ entitlement.planEntitlement.consumptionRate
17236
+ ),
17237
+ " ",
17238
+ t2("per"),
17239
+ " ",
17240
+ t2("use")
17241
+ ] }, index)
17242
+ );
17243
+ index += 1;
17244
+ }
16674
17245
  return acc;
16675
17246
  }, [t2, period, entitlement, billingPrice, amount]);
16676
17247
  if (!entitlement.feature?.name) {
16677
17248
  return null;
16678
17249
  }
16679
17250
  const quantity = limit || amount;
16680
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
17251
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
16681
17252
  Flex,
16682
17253
  {
16683
17254
  $justifyContent: "space-between",
@@ -16685,13 +17256,13 @@ var UsageDetails2 = ({
16685
17256
  $flexWrap: "wrap",
16686
17257
  $gap: "0.5rem",
16687
17258
  children: [
16688
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
17259
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
16689
17260
  quantity,
16690
17261
  " ",
16691
- getFeatureName(entitlement.feature, quantity)
16692
- ] }) : getFeatureName(entitlement.feature) }),
16693
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16694
- description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
17262
+ entitlement.feature.name
17263
+ ] }) : entitlement.feature.name }),
17264
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17265
+ description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
16695
17266
  Text,
16696
17267
  {
16697
17268
  style: { opacity: 0.54 },
@@ -16700,8 +17271,8 @@ var UsageDetails2 = ({
16700
17271
  children: description
16701
17272
  }
16702
17273
  ),
16703
- (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $alignItems: "center", children: [
16704
- entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
17274
+ (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $alignItems: "center", children: [
17275
+ entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
16705
17276
  PricingTiersTooltip,
16706
17277
  {
16707
17278
  feature: entitlement.feature,
@@ -16710,9 +17281,9 @@ var UsageDetails2 = ({
16710
17281
  priceTiers: billingPrice?.priceTier
16711
17282
  }
16712
17283
  ),
16713
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Text, { children: [
17284
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
16714
17285
  formatCurrency(cost, billingPrice?.currency),
16715
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("sub", { children: [
17286
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
16716
17287
  "/",
16717
17288
  shortenPeriod(period)
16718
17289
  ] })
@@ -16725,7 +17296,7 @@ var UsageDetails2 = ({
16725
17296
  };
16726
17297
 
16727
17298
  // src/components/elements/plan-manager/PlanManager.tsx
16728
- var import_jsx_runtime42 = require("react/jsx-runtime");
17299
+ var import_jsx_runtime43 = require("react/jsx-runtime");
16729
17300
  var resolveDesignProps7 = (props) => {
16730
17301
  return {
16731
17302
  header: {
@@ -16763,6 +17334,8 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16763
17334
  const {
16764
17335
  currentPlan,
16765
17336
  currentAddOns,
17337
+ creditBundles,
17338
+ creditGroups,
16766
17339
  billingSubscription,
16767
17340
  canCheckout,
16768
17341
  defaultPlan,
@@ -16770,19 +17343,32 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16770
17343
  trialPaymentMethodRequired
16771
17344
  } = (0, import_react48.useMemo)(() => {
16772
17345
  if (isCheckoutData(data)) {
17346
+ const {
17347
+ company,
17348
+ creditBundles: creditBundles2,
17349
+ creditGrants,
17350
+ capabilities,
17351
+ defaultPlan: defaultPlan2,
17352
+ featureUsage: featureUsage2,
17353
+ trialPaymentMethodRequired: trialPaymentMethodRequired2
17354
+ } = data;
16773
17355
  return {
16774
- currentPlan: data.company?.plan,
16775
- currentAddOns: data.company?.addOns || [],
16776
- billingSubscription: data.company?.billingSubscription,
16777
- canCheckout: data.capabilities?.checkout ?? true,
16778
- defaultPlan: data.defaultPlan,
16779
- featureUsage: data.featureUsage?.features || [],
16780
- trialPaymentMethodRequired: data.trialPaymentMethodRequired
17356
+ currentPlan: company?.plan,
17357
+ currentAddOns: company?.addOns || [],
17358
+ creditBundles: creditBundles2,
17359
+ creditGroups: groupCreditGrants(creditGrants, { groupBy: "bundle" }),
17360
+ billingSubscription: company?.billingSubscription,
17361
+ canCheckout: capabilities?.checkout ?? true,
17362
+ defaultPlan: defaultPlan2,
17363
+ featureUsage: featureUsage2?.features || [],
17364
+ trialPaymentMethodRequired: trialPaymentMethodRequired2
16781
17365
  };
16782
17366
  }
16783
17367
  return {
16784
17368
  currentPlan: void 0,
16785
17369
  currentAddOns: [],
17370
+ creditBundles: [],
17371
+ creditGroups: [],
16786
17372
  billingSubscription: void 0,
16787
17373
  canCheckout: false,
16788
17374
  defaultPlan: void 0,
@@ -16794,19 +17380,26 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16794
17380
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
16795
17381
  [featureUsage]
16796
17382
  );
16797
- const { subscriptionCurrency, willSubscriptionCancel, isTrialSubscription } = (0, import_react48.useMemo)(() => {
17383
+ const {
17384
+ subscriptionInterval,
17385
+ subscriptionCurrency,
17386
+ willSubscriptionCancel,
17387
+ isTrialSubscription
17388
+ } = (0, import_react48.useMemo)(() => {
17389
+ const subscriptionInterval2 = billingSubscription?.interval;
16798
17390
  const subscriptionCurrency2 = billingSubscription?.currency;
16799
17391
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
16800
17392
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
16801
17393
  return {
17394
+ subscriptionInterval: subscriptionInterval2,
16802
17395
  subscriptionCurrency: subscriptionCurrency2,
16803
- willSubscriptionCancel: willSubscriptionCancel2,
16804
- isTrialSubscription: isTrialSubscription2
17396
+ isTrialSubscription: isTrialSubscription2,
17397
+ willSubscriptionCancel: willSubscriptionCancel2
16805
17398
  };
16806
17399
  }, [billingSubscription]);
16807
17400
  const isUsageBasedPlan = currentPlan?.planPrice === 0 && usageBasedEntitlements.length > 0;
16808
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
16809
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
17401
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
17402
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
16810
17403
  Notice,
16811
17404
  {
16812
17405
  as: Flex,
@@ -16816,15 +17409,15 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16816
17409
  $textAlign: "center",
16817
17410
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
16818
17411
  children: [
16819
- typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
16820
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : defaultPlan ? t2("After the trial, cancel", {
17412
+ typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
17413
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : defaultPlan ? t2("After the trial, cancel", {
16821
17414
  defaultPlanName: defaultPlan?.name
16822
17415
  }) : t2("After the trial, cancel no default", {
16823
17416
  planName: currentPlan?.name
16824
17417
  }) })
16825
17418
  ]
16826
17419
  }
16827
- ) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
17420
+ ) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
16828
17421
  Notice,
16829
17422
  {
16830
17423
  as: Flex,
@@ -16834,8 +17427,8 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16834
17427
  $textAlign: "center",
16835
17428
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
16836
17429
  children: [
16837
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
16838
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17430
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
17431
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16839
17432
  Text,
16840
17433
  {
16841
17434
  as: "p",
@@ -16853,7 +17446,7 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16853
17446
  ]
16854
17447
  }
16855
17448
  ),
16856
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
17449
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
16857
17450
  Element,
16858
17451
  {
16859
17452
  as: Flex,
@@ -16862,20 +17455,19 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16862
17455
  $flexDirection: "column",
16863
17456
  $gap: "2rem",
16864
17457
  children: [
16865
- props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
17458
+ props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
16866
17459
  Flex,
16867
17460
  {
16868
17461
  $justifyContent: "space-between",
16869
17462
  $alignItems: "center",
16870
- $flexWrap: "wrap",
16871
17463
  $gap: "1rem",
16872
17464
  children: [
16873
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16874
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
16875
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
17465
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17466
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
17467
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
16876
17468
  ] }),
16877
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Box, { children: [
16878
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17469
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Box, { children: [
17470
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16879
17471
  Text,
16880
17472
  {
16881
17473
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -16885,7 +17477,7 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16885
17477
  )
16886
17478
  }
16887
17479
  ),
16888
- !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
17480
+ !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("sub", { children: [
16889
17481
  "/",
16890
17482
  shortenPeriod(currentPlan.planPeriod)
16891
17483
  ] }) })
@@ -16893,8 +17485,8 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16893
17485
  ]
16894
17486
  }
16895
17487
  ),
16896
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16897
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17488
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17489
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16898
17490
  Text,
16899
17491
  {
16900
17492
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -16902,7 +17494,7 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16902
17494
  children: t2("Add-ons")
16903
17495
  }
16904
17496
  ),
16905
- currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17497
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16906
17498
  AddOn,
16907
17499
  {
16908
17500
  addOn,
@@ -16910,10 +17502,10 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16910
17502
  layout: props
16911
17503
  },
16912
17504
  addOnIndex
16913
- ))
17505
+ )) })
16914
17506
  ] }),
16915
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16916
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17507
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17508
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16917
17509
  Text,
16918
17510
  {
16919
17511
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -16921,8 +17513,8 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16921
17513
  children: t2("Usage-based")
16922
17514
  }
16923
17515
  ),
16924
- usageBasedEntitlements.map((entitlement, entitlementIndex) => {
16925
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17516
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
17517
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16926
17518
  UsageDetails2,
16927
17519
  {
16928
17520
  entitlement,
@@ -16931,9 +17523,81 @@ var PlanManager = (0, import_react48.forwardRef)(({ children, className, portal,
16931
17523
  },
16932
17524
  entitlementIndex
16933
17525
  );
16934
- })
17526
+ }) })
17527
+ ] }),
17528
+ props.addOns.isVisible && creditGroups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17529
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17530
+ Text,
17531
+ {
17532
+ $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
17533
+ $leading: 1,
17534
+ children: t2("Credits")
17535
+ }
17536
+ ),
17537
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.reduce(
17538
+ (acc, group, groupIndex) => {
17539
+ const bundle = group.grantReason === "purchased" /* Purchased */ && group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
17540
+ acc.push(
17541
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
17542
+ Flex,
17543
+ {
17544
+ $justifyContent: "space-between",
17545
+ $alignItems: "center",
17546
+ $flexWrap: "wrap",
17547
+ $gap: "0.5rem",
17548
+ children: [
17549
+ group.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { display: props.addOns.fontStyle, children: [
17550
+ group.quantity,
17551
+ " ",
17552
+ getFeatureName(group, group.quantity),
17553
+ " ",
17554
+ subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
17555
+ t2("per"),
17556
+ " ",
17557
+ t2(subscriptionInterval)
17558
+ ] })
17559
+ ] }) : bundle ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { display: props.addOns.fontStyle, children: [
17560
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { style: { opacity: 0.5 }, children: [
17561
+ "(",
17562
+ group.grants.length,
17563
+ ")",
17564
+ " "
17565
+ ] }),
17566
+ bundle.name,
17567
+ " (",
17568
+ group.quantity,
17569
+ " ",
17570
+ getFeatureName(group, group.quantity),
17571
+ ")"
17572
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { display: props.addOns.fontStyle, children: [
17573
+ group.quantity,
17574
+ " ",
17575
+ getFeatureName(group, group.quantity)
17576
+ ] }),
17577
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
17578
+ Text,
17579
+ {
17580
+ style: { opacity: 0.54 },
17581
+ $size: 0.875 * settings.theme.typography.text.fontSize,
17582
+ $color: settings.theme.typography.text.color,
17583
+ children: [
17584
+ group.total.used,
17585
+ " ",
17586
+ t2("used")
17587
+ ]
17588
+ }
17589
+ )
17590
+ ]
17591
+ },
17592
+ groupIndex
17593
+ )
17594
+ );
17595
+ return acc;
17596
+ },
17597
+ []
17598
+ ) })
16935
17599
  ] }),
16936
- canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17600
+ canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
16937
17601
  Button,
16938
17602
  {
16939
17603
  type: "button",
@@ -16962,7 +17626,7 @@ var import_react51 = require("react");
16962
17626
 
16963
17627
  // src/components/elements/pricing-table/AddOn.tsx
16964
17628
  var import_react49 = require("react");
16965
- var import_jsx_runtime43 = require("react/jsx-runtime");
17629
+ var import_jsx_runtime44 = require("react/jsx-runtime");
16966
17630
  var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16967
17631
  const { layout } = sharedProps;
16968
17632
  const { t: t2 } = useTranslation();
@@ -16988,7 +17652,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
16988
17652
  const isCurrentAddOn = isHydratedPlan(addOn) && addOn.current;
16989
17653
  const isActiveAddOn = isCurrentAddOn && selectedPeriod === currentAddOns.find((currentAddOn) => currentAddOn.id === addOn.id)?.planPeriod;
16990
17654
  const { price: addOnPrice, currency: addOnCurrency } = getAddOnPrice(addOn, selectedPeriod) || {};
16991
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
17655
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
16992
17656
  Flex,
16993
17657
  {
16994
17658
  $position: "relative",
@@ -17004,17 +17668,17 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17004
17668
  $boxShadow: cardBoxShadow
17005
17669
  },
17006
17670
  children: [
17007
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
17008
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
17009
- layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
17010
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { display: layout.plans.name.fontStyle, children: [
17671
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
17672
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
17673
+ layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
17674
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { display: layout.plans.name.fontStyle, children: [
17011
17675
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
17012
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("sub", { children: [
17676
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("sub", { children: [
17013
17677
  "/",
17014
17678
  selectedPeriod
17015
17679
  ] })
17016
17680
  ] }) }),
17017
- isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17681
+ isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17018
17682
  Flex,
17019
17683
  {
17020
17684
  $position: "absolute",
@@ -17023,7 +17687,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17023
17687
  $backgroundColor: settings.theme.primary,
17024
17688
  $borderRadius: "9999px",
17025
17689
  $padding: "0.125rem 0.85rem",
17026
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17690
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17027
17691
  Text,
17028
17692
  {
17029
17693
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -17034,7 +17698,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17034
17698
  }
17035
17699
  )
17036
17700
  ] }),
17037
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
17701
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
17038
17702
  Flex,
17039
17703
  {
17040
17704
  $flexDirection: "column",
@@ -17042,7 +17706,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17042
17706
  $gap: `${cardPadding}rem`,
17043
17707
  $flexGrow: 1,
17044
17708
  children: [
17045
- layout.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17709
+ layout.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17046
17710
  Flex,
17047
17711
  {
17048
17712
  $flexDirection: "column",
@@ -17051,15 +17715,15 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17051
17715
  $flexGrow: 1,
17052
17716
  children: addOn.entitlements.map((entitlement, entitlementIndex) => {
17053
17717
  const metricPeriodName = getMetricPeriodName(entitlement);
17054
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17718
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17055
17719
  Flex,
17056
17720
  {
17057
17721
  $flexWrap: "wrap",
17058
17722
  $justifyContent: "space-between",
17059
17723
  $alignItems: "center",
17060
17724
  $gap: "1rem",
17061
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $gap: "1rem", children: [
17062
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17725
+ children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $gap: "1rem", children: [
17726
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17063
17727
  Icon3,
17064
17728
  {
17065
17729
  name: entitlement.feature.icon,
@@ -17068,11 +17732,11 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17068
17732
  rounded: true
17069
17733
  }
17070
17734
  ),
17071
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17072
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
17735
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17736
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17073
17737
  entitlement.valueType === "unlimited" /* Unlimited */ ? t2("Unlimited", {
17074
17738
  item: getFeatureName(entitlement.feature)
17075
- }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
17739
+ }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17076
17740
  formatNumber(entitlement.valueNumeric),
17077
17741
  " ",
17078
17742
  getFeatureName(
@@ -17080,14 +17744,14 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17080
17744
  entitlement.valueNumeric
17081
17745
  )
17082
17746
  ] }),
17083
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
17747
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17084
17748
  " ",
17085
17749
  t2("per"),
17086
17750
  " ",
17087
17751
  t2(metricPeriodName)
17088
17752
  ] })
17089
17753
  ] }) : entitlement.feature.name }) }),
17090
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17754
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17091
17755
  Text,
17092
17756
  {
17093
17757
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17103,7 +17767,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17103
17767
  })
17104
17768
  }
17105
17769
  ),
17106
- showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
17770
+ showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17107
17771
  Button,
17108
17772
  {
17109
17773
  type: "button",
@@ -17144,7 +17808,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
17144
17808
  var import_react50 = require("react");
17145
17809
 
17146
17810
  // src/components/elements/pricing-table/Entitlement.tsx
17147
- var import_jsx_runtime44 = require("react/jsx-runtime");
17811
+ var import_jsx_runtime45 = require("react/jsx-runtime");
17148
17812
  var Entitlement = ({
17149
17813
  entitlement,
17150
17814
  sharedProps,
@@ -17165,8 +17829,8 @@ var Entitlement = ({
17165
17829
  }
17166
17830
  const limit = entitlement.softLimit ?? entitlement.valueNumeric;
17167
17831
  const metricPeriodName = getMetricPeriodName(entitlement);
17168
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $gap: "1rem", children: [
17169
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17832
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $gap: "1rem", children: [
17833
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
17170
17834
  Icon3,
17171
17835
  {
17172
17836
  name: entitlement.feature.icon,
@@ -17175,46 +17839,46 @@ var Entitlement = ({
17175
17839
  rounded: true
17176
17840
  }
17177
17841
  ),
17178
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17179
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
17180
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17842
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
17843
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
17844
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17181
17845
  formatCurrency(entitlementPrice, entitlementCurrency),
17182
17846
  " ",
17183
17847
  t2("per"),
17184
17848
  " ",
17185
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17849
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17186
17850
  entitlementPackageSize,
17187
17851
  " "
17188
17852
  ] }),
17189
17853
  getFeatureName(entitlement.feature, entitlementPackageSize),
17190
- entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17854
+ entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17191
17855
  " ",
17192
17856
  t2("per"),
17193
17857
  " ",
17194
17858
  selectedPeriod
17195
17859
  ] })
17196
- ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17860
+ ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
17197
17861
  TieredPricingDetails,
17198
17862
  {
17199
17863
  entitlement,
17200
17864
  period: selectedPeriod
17201
17865
  }
17202
- ) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17866
+ ) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17203
17867
  entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
17204
17868
  item: getFeatureName(entitlement.feature)
17205
- }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17869
+ }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17206
17870
  formatNumber(limit),
17207
17871
  " ",
17208
17872
  getFeatureName(entitlement.feature, limit)
17209
17873
  ] }),
17210
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17874
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17211
17875
  " ",
17212
17876
  t2("per"),
17213
17877
  " ",
17214
17878
  t2(metricPeriodName)
17215
17879
  ] })
17216
17880
  ] }) : entitlement.feature.name }),
17217
- entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
17881
+ entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
17218
17882
  Text,
17219
17883
  {
17220
17884
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17224,19 +17888,19 @@ var Entitlement = ({
17224
17888
  " ",
17225
17889
  formatCurrency(entitlementPrice, entitlementCurrency),
17226
17890
  "/",
17227
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17891
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17228
17892
  entitlementPackageSize,
17229
17893
  " "
17230
17894
  ] }),
17231
17895
  getFeatureName(entitlement.feature, entitlementPackageSize),
17232
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
17896
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
17233
17897
  "/",
17234
17898
  shortenPeriod(selectedPeriod)
17235
17899
  ] })
17236
17900
  ]
17237
17901
  }
17238
- ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $alignItems: "center", children: [
17239
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17902
+ ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $alignItems: "center", children: [
17903
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
17240
17904
  PricingTiersTooltip,
17241
17905
  {
17242
17906
  feature: entitlement.feature,
@@ -17245,7 +17909,7 @@ var Entitlement = ({
17245
17909
  priceTiers: entitlementPriceTiers
17246
17910
  }
17247
17911
  ),
17248
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17912
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
17249
17913
  Text,
17250
17914
  {
17251
17915
  style: { opacity: 0.54 },
@@ -17256,7 +17920,7 @@ var Entitlement = ({
17256
17920
  )
17257
17921
  ] })
17258
17922
  ] }),
17259
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
17923
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
17260
17924
  Text,
17261
17925
  {
17262
17926
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -17269,7 +17933,7 @@ var Entitlement = ({
17269
17933
  };
17270
17934
 
17271
17935
  // src/components/elements/pricing-table/Plan.tsx
17272
- var import_jsx_runtime45 = require("react/jsx-runtime");
17936
+ var import_jsx_runtime46 = require("react/jsx-runtime");
17273
17937
  var Plan2 = ({
17274
17938
  plan,
17275
17939
  index,
@@ -17335,6 +17999,7 @@ var Plan2 = ({
17335
17999
  );
17336
18000
  const isActivePlan = isHydratedPlan(plan) && plan.current && currentPeriod === selectedPeriod;
17337
18001
  const { price: planPrice, currency: planCurrency } = getPlanPrice(plan, selectedPeriod) || {};
18002
+ const credits = isHydratedPlan(plan) ? groupPlanCreditGrants(plan.includedCreditGrants) : [];
17338
18003
  const hasUsageBasedEntitlements = plan.entitlements.some(
17339
18004
  (entitlement) => !!entitlement.priceBehavior
17340
18005
  );
@@ -17342,7 +18007,7 @@ var Plan2 = ({
17342
18007
  const headerPriceFontStyle = plan.custom || isUsageBasedPlan ? settings.theme.typography.heading3 : settings.theme.typography[layout.plans.name.fontStyle];
17343
18008
  const count = entitlementCounts[plan.id];
17344
18009
  const isExpanded = count && count.limit > VISIBLE_ENTITLEMENT_COUNT;
17345
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18010
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17346
18011
  Flex,
17347
18012
  {
17348
18013
  className: "sch-PricingTable_Plan",
@@ -17359,7 +18024,7 @@ var Plan2 = ({
17359
18024
  $boxShadow: cardBoxShadow
17360
18025
  },
17361
18026
  children: [
17362
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18027
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17363
18028
  Flex,
17364
18029
  {
17365
18030
  $flexDirection: "column",
@@ -17370,9 +18035,9 @@ var Plan2 = ({
17370
18035
  $borderStyle: "solid",
17371
18036
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
17372
18037
  children: [
17373
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
17374
- layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
17375
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18038
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
18039
+ layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
18040
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17376
18041
  Text,
17377
18042
  {
17378
18043
  $font: headerPriceFontStyle.fontFamily,
@@ -17381,14 +18046,55 @@ var Plan2 = ({
17381
18046
  $color: headerPriceFontStyle.color,
17382
18047
  children: [
17383
18048
  plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : formatCurrency(planPrice ?? 0, planCurrency),
17384
- !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("sub", { children: [
18049
+ !plan.custom && !isUsageBasedPlan && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
17385
18050
  "/",
17386
18051
  selectedPeriod
17387
18052
  ] })
17388
18053
  ]
17389
18054
  }
17390
18055
  ) }),
17391
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18056
+ credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18057
+ Flex,
18058
+ {
18059
+ $flexDirection: "column",
18060
+ $gap: "1rem",
18061
+ $flexGrow: 1,
18062
+ $marginTop: "0.5rem",
18063
+ children: credits.map((credit, idx) => {
18064
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $gap: "1rem", children: [
18065
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18066
+ Icon3,
18067
+ {
18068
+ name: credit.icon,
18069
+ color: settings.theme.primary,
18070
+ background: `color-mix(in oklch, ${settings.theme.card.background} 87.5%, ${isLightBackground ? "black" : "white"})`,
18071
+ rounded: true
18072
+ }
18073
+ ),
18074
+ credit.name && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18075
+ Flex,
18076
+ {
18077
+ $flexDirection: "column",
18078
+ $justifyContent: "center",
18079
+ $gap: "0.5rem",
18080
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Text, { children: [
18081
+ credit.quantity,
18082
+ " ",
18083
+ getFeatureName(credit, credit.quantity),
18084
+ credit.period && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
18085
+ " ",
18086
+ t2("per"),
18087
+ " ",
18088
+ credit.period
18089
+ ] })
18090
+ ] })
18091
+ }
18092
+ )
18093
+ ] }, idx);
18094
+ })
18095
+ }
18096
+ ),
18097
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17392
18098
  Flex,
17393
18099
  {
17394
18100
  $position: "absolute",
@@ -17397,7 +18103,7 @@ var Plan2 = ({
17397
18103
  $backgroundColor: settings.theme.primary,
17398
18104
  $borderRadius: "9999px",
17399
18105
  $padding: "0.125rem 0.85rem",
17400
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18106
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17401
18107
  Text,
17402
18108
  {
17403
18109
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -17410,7 +18116,7 @@ var Plan2 = ({
17410
18116
  ]
17411
18117
  }
17412
18118
  ),
17413
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18119
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17414
18120
  Flex,
17415
18121
  {
17416
18122
  $flexDirection: "column",
@@ -17419,11 +18125,11 @@ var Plan2 = ({
17419
18125
  $gap: `${cardPadding}rem`,
17420
18126
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
17421
18127
  children: [
17422
- layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
17423
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: t2("Everything in", {
18128
+ layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
18129
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { children: t2("Everything in", {
17424
18130
  plan: plans[index - 1].name
17425
18131
  }) }) }),
17426
- plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18132
+ plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17427
18133
  Entitlement,
17428
18134
  {
17429
18135
  entitlement,
@@ -17432,7 +18138,7 @@ var Plan2 = ({
17432
18138
  },
17433
18139
  idx
17434
18140
  )).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
17435
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18141
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17436
18142
  Flex,
17437
18143
  {
17438
18144
  $justifyContent: "start",
@@ -17440,14 +18146,14 @@ var Plan2 = ({
17440
18146
  $gap: "0.5rem",
17441
18147
  $marginTop: "1rem",
17442
18148
  children: [
17443
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18149
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17444
18150
  Icon3,
17445
18151
  {
17446
18152
  name: isExpanded ? "chevron-up" : "chevron-down",
17447
18153
  color: "#D0D0D0"
17448
18154
  }
17449
18155
  ),
17450
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18156
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17451
18157
  Text,
17452
18158
  {
17453
18159
  onClick: () => handleToggleShowAll(plan.id),
@@ -17467,7 +18173,7 @@ var Plan2 = ({
17467
18173
  }
17468
18174
  )
17469
18175
  ] }),
17470
- isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18176
+ isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
17471
18177
  Flex,
17472
18178
  {
17473
18179
  $justifyContent: "center",
@@ -17475,7 +18181,7 @@ var Plan2 = ({
17475
18181
  $gap: "0.25rem",
17476
18182
  $padding: "0.625rem 0",
17477
18183
  children: [
17478
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18184
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17479
18185
  Icon3,
17480
18186
  {
17481
18187
  name: "check-rounded",
@@ -17483,10 +18189,10 @@ var Plan2 = ({
17483
18189
  color: settings.theme.primary
17484
18190
  }
17485
18191
  ),
17486
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
18192
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
17487
18193
  ]
17488
18194
  }
17489
- ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18195
+ ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17490
18196
  Button,
17491
18197
  {
17492
18198
  type: "button",
@@ -17523,11 +18229,11 @@ var Plan2 = ({
17523
18229
  }
17524
18230
  },
17525
18231
  $fullWidth: true,
17526
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18232
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
17527
18233
  Tooltip,
17528
18234
  {
17529
- trigger: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
17530
- content: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
18235
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
18236
+ content: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
17531
18237
  }
17532
18238
  ) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
17533
18239
  }
@@ -17541,7 +18247,7 @@ var Plan2 = ({
17541
18247
  };
17542
18248
 
17543
18249
  // src/components/elements/pricing-table/PricingTable.tsx
17544
- var import_jsx_runtime46 = require("react/jsx-runtime");
18250
+ var import_jsx_runtime47 = require("react/jsx-runtime");
17545
18251
  var resolveDesignProps8 = (props) => {
17546
18252
  return {
17547
18253
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -17640,7 +18346,7 @@ var PricingTable = (0, import_react51.forwardRef)(
17640
18346
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
17641
18347
  }, [plans]);
17642
18348
  const Wrapper = isStandalone ? Container : import_react51.Fragment;
17643
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
18349
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
17644
18350
  FussyChild,
17645
18351
  {
17646
18352
  ref,
@@ -17649,8 +18355,8 @@ var PricingTable = (0, import_react51.forwardRef)(
17649
18355
  $flexDirection: "column",
17650
18356
  $gap: "2rem",
17651
18357
  children: [
17652
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Box, { children: [
17653
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
18358
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Box, { children: [
18359
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
17654
18360
  Flex,
17655
18361
  {
17656
18362
  $flexDirection: "column",
@@ -17665,7 +18371,7 @@ var PricingTable = (0, import_react51.forwardRef)(
17665
18371
  }
17666
18372
  },
17667
18373
  children: [
17668
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18374
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17669
18375
  Text,
17670
18376
  {
17671
18377
  display: props.header.fontStyle,
@@ -17673,7 +18379,7 @@ var PricingTable = (0, import_react51.forwardRef)(
17673
18379
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
17674
18380
  }
17675
18381
  ),
17676
- props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18382
+ props.showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17677
18383
  PeriodToggle,
17678
18384
  {
17679
18385
  options: periods,
@@ -17688,13 +18394,13 @@ var PricingTable = (0, import_react51.forwardRef)(
17688
18394
  ]
17689
18395
  }
17690
18396
  ),
17691
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18397
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17692
18398
  Box,
17693
18399
  {
17694
18400
  $display: "grid",
17695
18401
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
17696
18402
  $gap: "1rem",
17697
- children: plans.map((plan, index, self2) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18403
+ children: plans.map((plan, index, self2) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17698
18404
  Plan2,
17699
18405
  {
17700
18406
  plan,
@@ -17715,14 +18421,14 @@ var PricingTable = (0, import_react51.forwardRef)(
17715
18421
  }
17716
18422
  )
17717
18423
  ] }),
17718
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
17719
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18424
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18425
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17720
18426
  Flex,
17721
18427
  {
17722
18428
  $justifyContent: "space-between",
17723
18429
  $alignItems: "center",
17724
18430
  $marginBottom: "1rem",
17725
- children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18431
+ children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17726
18432
  Text,
17727
18433
  {
17728
18434
  display: props.header.fontStyle,
@@ -17732,13 +18438,13 @@ var PricingTable = (0, import_react51.forwardRef)(
17732
18438
  )
17733
18439
  }
17734
18440
  ),
17735
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18441
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17736
18442
  Box,
17737
18443
  {
17738
18444
  $display: "grid",
17739
18445
  $gridTemplateColumns: "repeat(auto-fill, minmax(320px, 1fr))",
17740
18446
  $gap: "1rem",
17741
- children: addOns.map((addOn, index) => /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18447
+ children: addOns.map((addOn, index) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
17742
18448
  AddOn2,
17743
18449
  {
17744
18450
  addOn,
@@ -17764,7 +18470,7 @@ PricingTable.displayName = "PricingTable";
17764
18470
 
17765
18471
  // src/components/elements/text/Text.tsx
17766
18472
  var import_react52 = require("react");
17767
- var import_jsx_runtime47 = require("react/jsx-runtime");
18473
+ var import_jsx_runtime48 = require("react/jsx-runtime");
17768
18474
  var resolveDesignProps9 = (props) => {
17769
18475
  return {
17770
18476
  text: {
@@ -17776,7 +18482,7 @@ var resolveDesignProps9 = (props) => {
17776
18482
  };
17777
18483
  var TextElement = (0, import_react52.forwardRef)(({ children, className, ...rest }, ref) => {
17778
18484
  const props = resolveDesignProps9(rest);
17779
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18485
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
17780
18486
  Text,
17781
18487
  {
17782
18488
  display: props.text.fontStyle,
@@ -17790,7 +18496,7 @@ TextElement.displayName = "Text";
17790
18496
 
17791
18497
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
17792
18498
  var import_react53 = require("react");
17793
- var import_jsx_runtime48 = require("react/jsx-runtime");
18499
+ var import_jsx_runtime49 = require("react/jsx-runtime");
17794
18500
  var buttonStyles = {
17795
18501
  primary: {
17796
18502
  color: "primary",
@@ -17826,7 +18532,7 @@ var UnsubscribeButton = (0, import_react53.forwardRef)(({ children, className, .
17826
18532
  if (!hasActiveSubscription) {
17827
18533
  return null;
17828
18534
  }
17829
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18535
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
17830
18536
  Element,
17831
18537
  {
17832
18538
  as: Flex,
@@ -17834,7 +18540,7 @@ var UnsubscribeButton = (0, import_react53.forwardRef)(({ children, className, .
17834
18540
  className,
17835
18541
  $flexDirection: "column",
17836
18542
  $gap: "2rem",
17837
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18543
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
17838
18544
  Button,
17839
18545
  {
17840
18546
  type: "button",
@@ -17856,7 +18562,7 @@ UnsubscribeButton.displayName = "UnsubscribeButton";
17856
18562
 
17857
18563
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
17858
18564
  var import_react54 = require("react");
17859
- var import_jsx_runtime49 = require("react/jsx-runtime");
18565
+ var import_jsx_runtime50 = require("react/jsx-runtime");
17860
18566
  function resolveDesignProps11(props) {
17861
18567
  return {
17862
18568
  header: {
@@ -17917,9 +18623,9 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
17917
18623
  if (!isCheckoutData(data) || !data.subscription || data.subscription.cancelAt) {
17918
18624
  return null;
17919
18625
  }
17920
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Element, { ref, className, children: [
17921
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
17922
- error ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
18626
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Element, { ref, className, children: [
18627
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
18628
+ error ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
17923
18629
  Flex,
17924
18630
  {
17925
18631
  as: TransitionBox,
@@ -17928,8 +18634,8 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
17928
18634
  $alignItems: "center",
17929
18635
  $gap: "1rem",
17930
18636
  children: [
17931
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
17932
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18637
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
18638
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
17933
18639
  Button,
17934
18640
  {
17935
18641
  type: "button",
@@ -17942,36 +18648,36 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
17942
18648
  )
17943
18649
  ]
17944
18650
  }
17945
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17946
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Text, { display: props.header.fontStyle, children: [
18651
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18652
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Text, { display: props.header.fontStyle, children: [
17947
18653
  props.header.prefix,
17948
18654
  " ",
17949
18655
  toPrettyDate(upcomingInvoice.dueDate)
17950
18656
  ] }),
17951
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
18657
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
17952
18658
  Flex,
17953
18659
  {
17954
18660
  $justifyContent: "space-between",
17955
18661
  $alignItems: "start",
17956
18662
  $gap: "1rem",
17957
18663
  children: [
17958
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
18664
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
17959
18665
  upcomingInvoice.amountDue,
17960
18666
  upcomingInvoice.currency
17961
18667
  ) }),
17962
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill.") }) })
18668
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill") }) })
17963
18669
  ]
17964
18670
  }
17965
18671
  ),
17966
- discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
18672
+ discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
17967
18673
  Flex,
17968
18674
  {
17969
18675
  $justifyContent: "space-between",
17970
18676
  $alignItems: "start",
17971
18677
  $gap: "1rem",
17972
18678
  children: [
17973
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { $weight: 600, children: t2("Discount") }),
17974
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18679
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { $weight: 600, children: t2("Discount") }),
18680
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
17975
18681
  Flex,
17976
18682
  {
17977
18683
  $flexDirection: "column",
@@ -17981,13 +18687,13 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
17981
18687
  (acc, discount) => {
17982
18688
  if (typeof discount.percentOff === "number" || typeof discount.amountOff === "number") {
17983
18689
  acc.push(
17984
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
18690
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
17985
18691
  Flex,
17986
18692
  {
17987
18693
  $alignItems: "center",
17988
18694
  $gap: "0.5rem",
17989
18695
  children: [
17990
- discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18696
+ discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
17991
18697
  Flex,
17992
18698
  {
17993
18699
  $alignItems: "center",
@@ -17996,7 +18702,7 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
17996
18702
  $borderStyle: "solid",
17997
18703
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
17998
18704
  $borderRadius: "0.3125rem",
17999
- children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18705
+ children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
18000
18706
  Text,
18001
18707
  {
18002
18708
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -18006,7 +18712,7 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
18006
18712
  )
18007
18713
  }
18008
18714
  ),
18009
- /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
18715
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
18010
18716
  percent: discount.percentOff
18011
18717
  }) : t2("Amount off", {
18012
18718
  amount: formatCurrency(
@@ -18030,7 +18736,7 @@ var UpcomingBill = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
18030
18736
  ]
18031
18737
  }
18032
18738
  )
18033
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
18739
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
18034
18740
  ] });
18035
18741
  });
18036
18742
  UpcomingBill.displayName = "UpcomingBill";
@@ -22290,10 +22996,10 @@ function createRenderer(options2) {
22290
22996
  }
22291
22997
 
22292
22998
  // src/components/embed/Embed.tsx
22293
- var import_jsx_runtime50 = require("react/jsx-runtime");
22999
+ var import_jsx_runtime51 = require("react/jsx-runtime");
22294
23000
  var Loading = () => {
22295
23001
  const { settings } = useEmbed();
22296
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
23002
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
22297
23003
  Flex,
22298
23004
  {
22299
23005
  $width: "100%",
@@ -22301,13 +23007,13 @@ var Loading = () => {
22301
23007
  $alignItems: "center",
22302
23008
  $justifyContent: "center",
22303
23009
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
22304
- children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
23010
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
22305
23011
  }
22306
23012
  );
22307
23013
  };
22308
23014
  var Error2 = ({ message }) => {
22309
23015
  const { settings } = useEmbed();
22310
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(
23016
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
22311
23017
  Flex,
22312
23018
  {
22313
23019
  $flexDirection: "column",
@@ -22318,14 +23024,14 @@ var Error2 = ({ message }) => {
22318
23024
  $alignItems: "center",
22319
23025
  $justifyContent: "center",
22320
23026
  children: [
22321
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { display: "heading1", children: "Error" }) }),
22322
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { children: message }) })
23027
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { display: "heading1", children: "Error" }) }),
23028
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { children: message }) })
22323
23029
  ]
22324
23030
  }
22325
23031
  );
22326
23032
  };
22327
23033
  var SchematicEmbed = ({ id, accessToken }) => {
22328
- const [children, setChildren] = (0, import_react56.useState)(/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Loading, {}));
23034
+ const [children, setChildren] = (0, import_react56.useState)(/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Loading, {}));
22329
23035
  const theme = (0, import_react56.useContext)(et);
22330
23036
  const {
22331
23037
  data,
@@ -22372,13 +23078,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
22372
23078
  return stub();
22373
23079
  }
22374
23080
  if (error) {
22375
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Error2, { message: error.message });
23081
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Error2, { message: error.message });
22376
23082
  }
22377
23083
  if (accessToken?.length === 0) {
22378
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Error2, { message: "Please provide an access token." });
23084
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Error2, { message: "Please provide an access token." });
22379
23085
  }
22380
23086
  if (!accessToken?.startsWith("token_")) {
22381
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
23087
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
22382
23088
  Error2,
22383
23089
  {
22384
23090
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -22386,9 +23092,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
22386
23092
  );
22387
23093
  }
22388
23094
  if (isPending) {
22389
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Loading, {});
23095
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Loading, {});
22390
23096
  }
22391
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_jsx_runtime50.Fragment, { children });
23097
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, { children });
22392
23098
  };
22393
23099
  /*! Bundled license information:
22394
23100