@schematichq/schematic-components 1.7.1 → 1.9.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.
@@ -1919,7 +1919,7 @@ var HOURS_IN_MS = MINUTES_IN_MS * 60;
1919
1919
  var DAYS_IN_MS = HOURS_IN_MS * 24;
1920
1920
 
1921
1921
  // src/const/debounce.ts
1922
- var DEBOUNCE_SETTINGS = {
1922
+ var LEADING_DEBOUNCE_SETTINGS = {
1923
1923
  leading: true,
1924
1924
  trailing: false
1925
1925
  };
@@ -2159,6 +2159,8 @@ function getUsageDetails(entitlement, period) {
2159
2159
  limit = entitlement.allocation;
2160
2160
  } else if (entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlement.softLimit === "number") {
2161
2161
  limit = entitlement.softLimit;
2162
+ } else if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && typeof entitlement.creditTotal === "number" && typeof entitlement.creditConsumptionRate === "number") {
2163
+ limit = entitlement.creditTotal / entitlement.creditConsumptionRate;
2162
2164
  }
2163
2165
  let amount;
2164
2166
  if (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof entitlement.allocation === "number") {
@@ -2167,6 +2169,8 @@ function getUsageDetails(entitlement, period) {
2167
2169
  amount = entitlement.usage;
2168
2170
  } else if (entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlement.usage === "number" && typeof entitlement.softLimit === "number") {
2169
2171
  amount = Math.max(0, entitlement.usage - entitlement.softLimit);
2172
+ } else if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && typeof entitlement.creditUsed === "number" && typeof entitlement.creditConsumptionRate === "number") {
2173
+ amount = entitlement.creditUsed / entitlement.creditConsumptionRate;
2170
2174
  }
2171
2175
  const cost = getEntitlementCost(entitlement, period);
2172
2176
  const tiers = billingPrice?.priceTier || [];
@@ -2198,6 +2202,36 @@ function getUsageDetails(entitlement, period) {
2198
2202
  }
2199
2203
  return { billingPrice, limit, amount, cost, currentTier };
2200
2204
  }
2205
+ function getCreditBasedEntitlementLimit(entitlement, credits) {
2206
+ const matchedCredit = credits.find(
2207
+ (credit) => credit.id === entitlement.valueCredit?.id
2208
+ );
2209
+ if (matchedCredit && entitlement.consumptionRate) {
2210
+ return {
2211
+ limit: Math.floor(matchedCredit.quantity / entitlement.consumptionRate),
2212
+ period: matchedCredit.period
2213
+ };
2214
+ }
2215
+ }
2216
+ function extractCurrentUsageBasedEntitlements(features = [], planPeriod) {
2217
+ return features.reduce((acc, entitlement) => {
2218
+ if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
2219
+ const allocation = entitlement.allocation || 0;
2220
+ const usage = entitlement.usage || 0;
2221
+ const quantity = allocation ?? usage;
2222
+ acc.push({
2223
+ ...entitlement,
2224
+ allocation,
2225
+ usage,
2226
+ quantity
2227
+ });
2228
+ }
2229
+ return acc;
2230
+ }, []);
2231
+ }
2232
+ function getEntitlementFeatureName(entitlement, defaultValue) {
2233
+ return entitlement.feature?.pluralName || entitlement.feature?.name || entitlement.featureName || defaultValue || "";
2234
+ }
2201
2235
 
2202
2236
  // src/utils/pluralize.ts
2203
2237
  var pluralRules = [];
@@ -4777,7 +4811,12 @@ var Translator = class _Translator extends EventEmitter {
4777
4811
  };
4778
4812
  if (key == null) return false;
4779
4813
  const resolved = this.resolve(key, opt);
4780
- return resolved?.res !== void 0;
4814
+ if (resolved?.res === void 0) return false;
4815
+ const isObject2 = shouldHandleAsObject(resolved.res);
4816
+ if (opt.returnObjects === false && isObject2) {
4817
+ return false;
4818
+ }
4819
+ return true;
4781
4820
  }
4782
4821
  extractFromKey(key, opt) {
4783
4822
  let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
@@ -6787,6 +6826,7 @@ var en_default = {
6787
6826
  "An unknown error occurred.": "An unknown error occurred.",
6788
6827
  Billed: "Billed {{period}}",
6789
6828
  "Cancel subscription": "Cancel subscription",
6829
+ "Cannot change to this plan.": "{{reason, list(style: 'long'; type: 'disjunction';)}} usage is over the limit.",
6790
6830
  "Cannot downgrade entitlement": "Cannot downgrade to a quantity lower than current usage.",
6791
6831
  "Card ending in": "\u{1F4B3} Card ending in {{value}}",
6792
6832
  "Change add-on": "Change add-on",
@@ -6840,7 +6880,7 @@ var en_default = {
6840
6880
  "One time ": "One time",
6841
6881
  "Optionally add features to your subscription": "Optionally add features to your subscription",
6842
6882
  "Other existing payment method": "Other existing payment method",
6843
- "Over usage limit": "Over usage limit",
6883
+ "Over plan limit": "Over plan limit",
6844
6884
  "Pay-in-advance features require a quantity.": "Pay-in-advance features require a quantity.",
6845
6885
  "Pay now": "Pay now",
6846
6886
  "Payment Method": "Payment Method",
@@ -6895,6 +6935,8 @@ var en_default = {
6895
6935
  "Unsubscribe failed": "Unsubscribe failed",
6896
6936
  Unsubscribe: "Unsubscribe",
6897
6937
  "Unused time": "Unused time",
6938
+ "Up to X units": "Up to {{amount}} {{units}}",
6939
+ "Up to X units per period": "Up to {{amount}} {{units}} per {{period}}",
6898
6940
  "Up to a limit of": "Up to a limit of {{amount}} {{units}}",
6899
6941
  "Up to X units at $Y/unit": "Up to {{X}} {{units}} at {{Y}} per {{unit}}",
6900
6942
  "Up to X units at $Y/unit + $Z/period": "Up to {{X}} {{units}} at {{Y}} per {{unit}} plus {{Z}} per {{period}}",
@@ -8094,6 +8136,85 @@ function EntityTraitDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8094
8136
  };
8095
8137
  }
8096
8138
 
8139
+ // src/api/checkoutexternal/models/TraitDefinition.ts
8140
+ function TraitDefinitionFromJSON(json) {
8141
+ return TraitDefinitionFromJSONTyped(json, false);
8142
+ }
8143
+ function TraitDefinitionFromJSONTyped(json, ignoreDiscriminator) {
8144
+ if (json == null) {
8145
+ return json;
8146
+ }
8147
+ return {
8148
+ comparableType: json["comparable_type"],
8149
+ entityType: json["entity_type"],
8150
+ id: json["id"]
8151
+ };
8152
+ }
8153
+
8154
+ // src/api/checkoutexternal/models/Condition.ts
8155
+ function ConditionFromJSON(json) {
8156
+ return ConditionFromJSONTyped(json, false);
8157
+ }
8158
+ function ConditionFromJSONTyped(json, ignoreDiscriminator) {
8159
+ if (json == null) {
8160
+ return json;
8161
+ }
8162
+ return {
8163
+ accountId: json["account_id"],
8164
+ comparisonTraitDefinition: json["comparison_trait_definition"] == null ? void 0 : TraitDefinitionFromJSON(json["comparison_trait_definition"]),
8165
+ conditionType: json["condition_type"],
8166
+ consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
8167
+ creditId: json["credit_id"] == null ? void 0 : json["credit_id"],
8168
+ environmentId: json["environment_id"],
8169
+ eventSubtype: json["event_subtype"] == null ? void 0 : json["event_subtype"],
8170
+ id: json["id"],
8171
+ metricPeriod: json["metric_period"] == null ? void 0 : json["metric_period"],
8172
+ metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : json["metric_period_month_reset"],
8173
+ metricValue: json["metric_value"] == null ? void 0 : json["metric_value"],
8174
+ operator: json["operator"],
8175
+ resourceIds: json["resource_ids"],
8176
+ traitDefinition: json["trait_definition"] == null ? void 0 : TraitDefinitionFromJSON(json["trait_definition"]),
8177
+ traitValue: json["trait_value"]
8178
+ };
8179
+ }
8180
+
8181
+ // src/api/checkoutexternal/models/ConditionGroup.ts
8182
+ function ConditionGroupFromJSON(json) {
8183
+ return ConditionGroupFromJSONTyped(json, false);
8184
+ }
8185
+ function ConditionGroupFromJSONTyped(json, ignoreDiscriminator) {
8186
+ if (json == null) {
8187
+ return json;
8188
+ }
8189
+ return {
8190
+ conditions: json["conditions"].map(ConditionFromJSON)
8191
+ };
8192
+ }
8193
+
8194
+ // src/api/checkoutexternal/models/Rule.ts
8195
+ function RuleFromJSON(json) {
8196
+ return RuleFromJSONTyped(json, false);
8197
+ }
8198
+ function RuleFromJSONTyped(json, ignoreDiscriminator) {
8199
+ if (json == null) {
8200
+ return json;
8201
+ }
8202
+ return {
8203
+ accountId: json["account_id"],
8204
+ conditionGroups: json["condition_groups"].map(
8205
+ ConditionGroupFromJSON
8206
+ ),
8207
+ conditions: json["conditions"].map(ConditionFromJSON),
8208
+ environmentId: json["environment_id"],
8209
+ flagId: json["flag_id"] == null ? void 0 : json["flag_id"],
8210
+ id: json["id"],
8211
+ name: json["name"],
8212
+ priority: json["priority"],
8213
+ ruleType: json["rule_type"],
8214
+ value: json["value"]
8215
+ };
8216
+ }
8217
+
8097
8218
  // src/api/checkoutexternal/models/GenericPreviewObject.ts
8098
8219
  function GenericPreviewObjectFromJSON(json) {
8099
8220
  return GenericPreviewObjectFromJSONTyped(json, false);
@@ -8146,6 +8267,7 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8146
8267
  ),
8147
8268
  plan: json["plan"] == null ? void 0 : CompanyPlanWithBillingSubViewFromJSON(json["plan"]),
8148
8269
  plans: json["plans"].map(GenericPreviewObjectFromJSON),
8270
+ rules: json["rules"].map(RuleFromJSON),
8149
8271
  traits: json["traits"] == null ? void 0 : json["traits"],
8150
8272
  updatedAt: new Date(json["updated_at"]),
8151
8273
  userCount: json["user_count"]
@@ -8560,14 +8682,20 @@ function FeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8560
8682
  creditTotal: json["credit_total"] == null ? void 0 : json["credit_total"],
8561
8683
  creditTypeIcon: json["credit_type_icon"] == null ? void 0 : json["credit_type_icon"],
8562
8684
  creditUsed: json["credit_used"] == null ? void 0 : json["credit_used"],
8685
+ effectiveLimit: json["effective_limit"] == null ? void 0 : json["effective_limit"],
8686
+ effectivePrice: json["effective_price"] == null ? void 0 : json["effective_price"],
8563
8687
  entitlementExpirationDate: json["entitlement_expiration_date"] == null ? void 0 : new Date(json["entitlement_expiration_date"]),
8564
8688
  entitlementId: json["entitlement_id"],
8565
8689
  entitlementSource: json["entitlement_source"] == null ? void 0 : json["entitlement_source"],
8566
8690
  entitlementType: json["entitlement_type"],
8567
8691
  feature: json["feature"] == null ? void 0 : FeatureDetailResponseDataFromJSON(json["feature"]),
8692
+ hasValidAllocation: json["has_valid_allocation"] == null ? void 0 : json["has_valid_allocation"],
8693
+ isUnlimited: json["is_unlimited"] == null ? void 0 : json["is_unlimited"],
8568
8694
  metricResetAt: json["metric_reset_at"] == null ? void 0 : new Date(json["metric_reset_at"]),
8569
8695
  monthReset: json["month_reset"] == null ? void 0 : json["month_reset"],
8570
8696
  monthlyUsageBasedPrice: json["monthly_usage_based_price"] == null ? void 0 : BillingPriceViewFromJSON(json["monthly_usage_based_price"]),
8697
+ overuse: json["overuse"] == null ? void 0 : json["overuse"],
8698
+ percentUsed: json["percent_used"] == null ? void 0 : json["percent_used"],
8571
8699
  period: json["period"] == null ? void 0 : json["period"],
8572
8700
  plan: json["plan"] == null ? void 0 : PlanResponseDataFromJSON(json["plan"]),
8573
8701
  planEntitlement: json["plan_entitlement"] == null ? void 0 : PlanEntitlementResponseDataFromJSON(json["plan_entitlement"]),
@@ -10648,7 +10776,7 @@ var EmbedProvider = ({
10648
10776
  });
10649
10777
  const customHeaders = (0, import_react12.useMemo)(
10650
10778
  () => ({
10651
- "X-Schematic-Components-Version": "1.7.1",
10779
+ "X-Schematic-Components-Version": "1.9.0",
10652
10780
  "X-Schematic-Session-ID": sessionIdRef.current
10653
10781
  }),
10654
10782
  []
@@ -10690,7 +10818,11 @@ var EmbedProvider = ({
10690
10818
  }
10691
10819
  }, [api.public]);
10692
10820
  const debouncedHydratePublic = (0, import_react12.useMemo)(
10693
- () => (0, import_debounce.default)(hydratePublic, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10821
+ () => (0, import_debounce.default)(
10822
+ hydratePublic,
10823
+ FETCH_DEBOUNCE_TIMEOUT,
10824
+ LEADING_DEBOUNCE_SETTINGS
10825
+ ),
10694
10826
  [hydratePublic]
10695
10827
  );
10696
10828
  const hydrate = (0, import_react12.useCallback)(async () => {
@@ -10712,7 +10844,7 @@ var EmbedProvider = ({
10712
10844
  }
10713
10845
  }, [api.checkout]);
10714
10846
  const debouncedHydrate = (0, import_react12.useMemo)(
10715
- () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10847
+ () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
10716
10848
  [hydrate]
10717
10849
  );
10718
10850
  const hydrateComponent = (0, import_react12.useCallback)(
@@ -10739,7 +10871,11 @@ var EmbedProvider = ({
10739
10871
  [api.checkout]
10740
10872
  );
10741
10873
  const debouncedHydrateComponent = (0, import_react12.useMemo)(
10742
- () => (0, import_debounce.default)(hydrateComponent, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10874
+ () => (0, import_debounce.default)(
10875
+ hydrateComponent,
10876
+ FETCH_DEBOUNCE_TIMEOUT,
10877
+ LEADING_DEBOUNCE_SETTINGS
10878
+ ),
10743
10879
  [hydrateComponent]
10744
10880
  );
10745
10881
  const hydrateExternal = (0, import_react12.useCallback)(async function(fn) {
@@ -10759,14 +10895,22 @@ var EmbedProvider = ({
10759
10895
  }
10760
10896
  }, []);
10761
10897
  const debouncedHydrateExternal = (0, import_react12.useMemo)(
10762
- () => (0, import_debounce.default)(hydrateExternal, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10898
+ () => (0, import_debounce.default)(
10899
+ hydrateExternal,
10900
+ FETCH_DEBOUNCE_TIMEOUT,
10901
+ LEADING_DEBOUNCE_SETTINGS
10902
+ ),
10763
10903
  [hydrateExternal]
10764
10904
  );
10765
10905
  const createSetupIntent = (0, import_react12.useCallback)(async () => {
10766
10906
  return api.checkout?.createSetupIntent();
10767
10907
  }, [api.checkout]);
10768
10908
  const debouncedCreateSetupIntent = (0, import_react12.useMemo)(
10769
- () => (0, import_debounce.default)(createSetupIntent, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10909
+ () => (0, import_debounce.default)(
10910
+ createSetupIntent,
10911
+ FETCH_DEBOUNCE_TIMEOUT,
10912
+ LEADING_DEBOUNCE_SETTINGS
10913
+ ),
10770
10914
  [createSetupIntent]
10771
10915
  );
10772
10916
  const updatePaymentMethod = (0, import_react12.useCallback)(
@@ -10785,7 +10929,11 @@ var EmbedProvider = ({
10785
10929
  [api.checkout]
10786
10930
  );
10787
10931
  const debouncedUpdatePaymentMethod = (0, import_react12.useMemo)(
10788
- () => (0, import_debounce.default)(updatePaymentMethod, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10932
+ () => (0, import_debounce.default)(
10933
+ updatePaymentMethod,
10934
+ FETCH_DEBOUNCE_TIMEOUT,
10935
+ LEADING_DEBOUNCE_SETTINGS
10936
+ ),
10789
10937
  [updatePaymentMethod]
10790
10938
  );
10791
10939
  const deletePaymentMethod = (0, import_react12.useCallback)(
@@ -10804,7 +10952,11 @@ var EmbedProvider = ({
10804
10952
  [api.checkout]
10805
10953
  );
10806
10954
  const debouncedDeletePaymentMethod = (0, import_react12.useMemo)(
10807
- () => (0, import_debounce.default)(deletePaymentMethod, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10955
+ () => (0, import_debounce.default)(
10956
+ deletePaymentMethod,
10957
+ FETCH_DEBOUNCE_TIMEOUT,
10958
+ LEADING_DEBOUNCE_SETTINGS
10959
+ ),
10808
10960
  [deletePaymentMethod]
10809
10961
  );
10810
10962
  const checkout = (0, import_react12.useCallback)(
@@ -10823,7 +10975,7 @@ var EmbedProvider = ({
10823
10975
  [api.checkout]
10824
10976
  );
10825
10977
  const debouncedCheckout = (0, import_react12.useMemo)(
10826
- () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10978
+ () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
10827
10979
  [checkout]
10828
10980
  );
10829
10981
  const previewCheckout = (0, import_react12.useCallback)(
@@ -10832,15 +10984,6 @@ var EmbedProvider = ({
10832
10984
  },
10833
10985
  [api.checkout]
10834
10986
  );
10835
- const debouncedPreviewCheckout = (0, import_react12.useMemo)(
10836
- () => (0, import_debounce.default)(previewCheckout, FETCH_DEBOUNCE_TIMEOUT, {
10837
- // invoke immediately for minimal latency
10838
- leading: true,
10839
- // but also ensure latest data is fetched
10840
- trailing: true
10841
- }),
10842
- [previewCheckout]
10843
- );
10844
10987
  const unsubscribe = (0, import_react12.useCallback)(async () => {
10845
10988
  const response = await api.checkout?.checkoutUnsubscribe();
10846
10989
  if (response) {
@@ -10852,7 +10995,7 @@ var EmbedProvider = ({
10852
10995
  return response;
10853
10996
  }, [api.checkout]);
10854
10997
  const debouncedUnsubscribe = (0, import_react12.useMemo)(
10855
- () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
10998
+ () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
10856
10999
  [unsubscribe]
10857
11000
  );
10858
11001
  const getUpcomingInvoice = (0, import_react12.useCallback)(
@@ -10864,21 +11007,29 @@ var EmbedProvider = ({
10864
11007
  [api.checkout]
10865
11008
  );
10866
11009
  const debouncedGetUpcomingInvoice = (0, import_react12.useMemo)(
10867
- () => (0, import_debounce.default)(getUpcomingInvoice, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
11010
+ () => (0, import_debounce.default)(
11011
+ getUpcomingInvoice,
11012
+ FETCH_DEBOUNCE_TIMEOUT,
11013
+ LEADING_DEBOUNCE_SETTINGS
11014
+ ),
10868
11015
  [getUpcomingInvoice]
10869
11016
  );
10870
11017
  const getCustomerBalance = (0, import_react12.useCallback)(async () => {
10871
11018
  return api.checkout?.fetchCustomerBalance();
10872
11019
  }, [api.checkout]);
10873
11020
  const debouncedGetCustomerBalance = (0, import_react12.useMemo)(
10874
- () => (0, import_debounce.default)(getCustomerBalance, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
11021
+ () => (0, import_debounce.default)(
11022
+ getCustomerBalance,
11023
+ FETCH_DEBOUNCE_TIMEOUT,
11024
+ LEADING_DEBOUNCE_SETTINGS
11025
+ ),
10875
11026
  [getCustomerBalance]
10876
11027
  );
10877
11028
  const listInvoices = (0, import_react12.useCallback)(async () => {
10878
11029
  return api.checkout?.listInvoices();
10879
11030
  }, [api.checkout]);
10880
11031
  const debouncedListInvoices = (0, import_react12.useMemo)(
10881
- () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, DEBOUNCE_SETTINGS),
11032
+ () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
10882
11033
  [listInvoices]
10883
11034
  );
10884
11035
  const setError = (0, import_react12.useCallback)(
@@ -11018,7 +11169,7 @@ var EmbedProvider = ({
11018
11169
  updatePaymentMethod: debouncedUpdatePaymentMethod,
11019
11170
  deletePaymentMethod: debouncedDeletePaymentMethod,
11020
11171
  checkout: debouncedCheckout,
11021
- previewCheckout: debouncedPreviewCheckout,
11172
+ previewCheckout,
11022
11173
  unsubscribe: debouncedUnsubscribe,
11023
11174
  getUpcomingInvoice: debouncedGetUpcomingInvoice,
11024
11175
  getCustomerBalance: debouncedGetCustomerBalance,
@@ -12859,21 +13010,9 @@ var Sidebar = ({
12859
13010
  currentPlan: data.company?.plan,
12860
13011
  currentAddOns: data.company?.addOns || [],
12861
13012
  currentEntitlements: currentEntitlements2,
12862
- currentUsageBasedEntitlements: currentEntitlements2.reduce(
12863
- (acc, entitlement) => {
12864
- if (entitlement.priceBehavior && (planPeriod === "month" && entitlement.monthlyUsageBasedPrice || planPeriod === "year" && entitlement.yearlyUsageBasedPrice)) {
12865
- const allocation = entitlement.allocation || 0;
12866
- const usage = entitlement.usage || 0;
12867
- acc.push({
12868
- ...entitlement,
12869
- allocation,
12870
- usage,
12871
- quantity: allocation ?? usage
12872
- });
12873
- }
12874
- return acc;
12875
- },
12876
- []
13013
+ currentUsageBasedEntitlements: extractCurrentUsageBasedEntitlements(
13014
+ data.featureUsage?.features,
13015
+ planPeriod
12877
13016
  ),
12878
13017
  billingSubscription: data.company?.billingSubscription,
12879
13018
  paymentMethod: data.subscription?.paymentMethod,
@@ -13688,9 +13827,53 @@ var Sidebar = ({
13688
13827
 
13689
13828
  // src/components/shared/checkout-dialog/AddOns.tsx
13690
13829
  var import_jsx_runtime16 = require("react/jsx-runtime");
13830
+ function renderMeteredEntitlementPricing({
13831
+ priceBehavior,
13832
+ softLimit,
13833
+ price,
13834
+ currency,
13835
+ packageSize,
13836
+ feature,
13837
+ featureName,
13838
+ isTiered
13839
+ }) {
13840
+ if (priceBehavior === "overage" /* Overage */ && softLimit) {
13841
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13842
+ "Additional: ",
13843
+ formatCurrency(price, currency),
13844
+ "/",
13845
+ feature ? getFeatureName(
13846
+ feature,
13847
+ packageSize
13848
+ ) : featureName || "unit"
13849
+ ] });
13850
+ }
13851
+ if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "pay_in_advance" /* PayInAdvance */) {
13852
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13853
+ formatCurrency(price, currency),
13854
+ "/",
13855
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13856
+ packageSize,
13857
+ " "
13858
+ ] }),
13859
+ feature ? getFeatureName(
13860
+ feature,
13861
+ packageSize
13862
+ ) : featureName || "unit"
13863
+ ] });
13864
+ }
13865
+ if (isTiered) {
13866
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: "Tier-based pricing" });
13867
+ }
13868
+ return null;
13869
+ }
13870
+ function shouldShowUsageBased(price, displayableEntitlements) {
13871
+ return price < 0.01 && displayableEntitlements.some((ent) => !ent.isUnlimited);
13872
+ }
13691
13873
  var AddOns = ({ addOns, toggle, isLoading, period }) => {
13692
13874
  const { t: t2 } = useTranslation();
13693
13875
  const { settings } = useEmbed();
13876
+ const isLightBackground = useIsLightBackground();
13694
13877
  const periodKey = period === "year" ? "yearlyPrice" : "monthlyPrice";
13695
13878
  const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
13696
13879
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
@@ -13703,29 +13886,40 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
13703
13886
  const { price, currency } = getAddOnPrice(addOn, period) || {};
13704
13887
  const isAddOnValid = isHydratedPlan(addOn) && addOn.valid;
13705
13888
  const isAddOnCurrent = isHydratedPlan(addOn) && addOn.current;
13706
- const overageEntitlement = addOn.entitlements?.find(
13707
- (entitlement) => entitlement.priceBehavior === "overage" /* Overage */
13708
- );
13709
- let overageInfo = null;
13710
- if (overageEntitlement) {
13711
- const priceData = period === "year" ? overageEntitlement.meteredYearlyPrice : overageEntitlement.meteredMonthlyPrice;
13712
- if (priceData?.priceTier && priceData.priceTier.length >= 2) {
13713
- const overageTier = priceData.priceTier[priceData.priceTier.length - 1];
13714
- overageInfo = {
13715
- softLimit: overageEntitlement.softLimit,
13716
- perUnitPrice: overageTier.perUnitPriceDecimal ? Number(overageTier.perUnitPriceDecimal) : overageTier.perUnitPrice || 0,
13717
- currency: priceData.currency || currency,
13718
- featureName: overageEntitlement.feature?.name
13889
+ const displayableEntitlements = addOn.entitlements?.filter(
13890
+ (entitlement) => entitlement.valueType === "unlimited" || entitlement.priceBehavior && [
13891
+ "pay_as_you_go" /* PayAsYouGo */,
13892
+ "pay_in_advance" /* PayInAdvance */,
13893
+ "overage" /* Overage */,
13894
+ "tier" /* Tiered */
13895
+ ].includes(entitlement.priceBehavior)
13896
+ ).map((entitlement) => {
13897
+ if (entitlement.valueType === "unlimited" && !entitlement.priceBehavior) {
13898
+ return {
13899
+ isUnlimited: true,
13900
+ featureName: entitlement.feature?.name,
13901
+ feature: entitlement.feature
13719
13902
  };
13720
13903
  }
13721
- }
13904
+ const priceData = getEntitlementPrice(entitlement, period);
13905
+ return {
13906
+ isUnlimited: false,
13907
+ priceBehavior: entitlement.priceBehavior,
13908
+ softLimit: entitlement.softLimit,
13909
+ price: priceData?.price ?? 0,
13910
+ currency: priceData?.currency || currency,
13911
+ featureName: entitlement.feature?.name,
13912
+ feature: entitlement.feature,
13913
+ packageSize: priceData?.packageSize ?? 1,
13914
+ isTiered: entitlement.priceBehavior === "tier" /* Tiered */
13915
+ };
13916
+ }) || [];
13722
13917
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13723
13918
  Flex,
13724
13919
  {
13725
13920
  $position: "relative",
13726
13921
  $flexDirection: "column",
13727
- $gap: "2rem",
13728
- $padding: `${cardPadding}rem`,
13922
+ $padding: `${0.75 * cardPadding}rem 0`,
13729
13923
  $backgroundColor: settings.theme.card.background,
13730
13924
  $borderRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`,
13731
13925
  $outlineWidth: "2px",
@@ -13735,86 +13929,180 @@ var AddOns = ({ addOns, toggle, isLoading, period }) => {
13735
13929
  $boxShadow: cardBoxShadow
13736
13930
  },
13737
13931
  children: [
13738
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
13739
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading3", children: addOn.name }) }),
13740
- addOn.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: addOn.description }) }),
13741
- (addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
13742
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Box, { children: [
13743
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: formatCurrency(price ?? 0, currency) }),
13744
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13745
- Text,
13932
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13933
+ Flex,
13934
+ {
13935
+ $flexDirection: "column",
13936
+ $gap: "0.75rem",
13937
+ $padding: `0 ${cardPadding}rem ${displayableEntitlements.length > 0 ? 0.75 * cardPadding : 0}rem`,
13938
+ $borderWidth: "0",
13939
+ $borderBottomWidth: displayableEntitlements.length > 0 ? "1px" : "0",
13940
+ $borderStyle: "solid",
13941
+ $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
13942
+ children: [
13943
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading3", children: addOn.name }) }),
13944
+ addOn.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: addOn.description }) }),
13945
+ (addOn[periodKey] || addOn.chargeType === ChargeType.oneTime) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: shouldShowUsageBased(price ?? 0, displayableEntitlements) ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: t2("Usage-based") }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13946
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { display: "heading2", children: formatCurrency(price ?? 0, currency) }),
13947
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13948
+ Text,
13949
+ {
13950
+ display: "heading2",
13951
+ $size: 16 / 30 * settings.theme.typography.heading2.fontSize,
13952
+ children: addOn.chargeType === ChargeType.oneTime ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13953
+ " ",
13954
+ t2("one time")
13955
+ ] }) : `/${period}`
13956
+ }
13957
+ )
13958
+ ] }) }),
13959
+ isAddOnCurrent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13960
+ Flex,
13746
13961
  {
13747
- display: "heading2",
13748
- $size: 16 / 30 * settings.theme.typography.heading2.fontSize,
13749
- children: addOn.chargeType === ChargeType.oneTime ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13750
- " ",
13751
- t2("one time")
13752
- ] }) : `/${period}`
13962
+ $position: "absolute",
13963
+ $right: "1rem",
13964
+ $top: "1rem",
13965
+ $backgroundColor: settings.theme.primary,
13966
+ $borderRadius: "9999px",
13967
+ $padding: "0.125rem 0.85rem",
13968
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13969
+ Text,
13970
+ {
13971
+ $size: 0.75 * settings.theme.typography.text.fontSize,
13972
+ $color: hexToHSL(settings.theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13973
+ children: t2("Active")
13974
+ }
13975
+ )
13753
13976
  }
13754
13977
  )
13755
- ] }),
13756
- overageInfo && overageInfo.softLimit && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Text, { $size: 0.875, style: { opacity: 0.8 }, children: [
13757
- overageInfo.softLimit,
13758
- " ",
13759
- overageInfo.featureName || "units",
13760
- " included, then",
13761
- " ",
13762
- formatCurrency(
13763
- overageInfo.perUnitPrice,
13764
- overageInfo.currency
13765
- ),
13766
- "/",
13767
- overageInfo.featureName?.toLowerCase() || "unit"
13768
- ] }) })
13769
- ] }),
13770
- isAddOnCurrent && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13771
- Flex,
13772
- {
13773
- $position: "absolute",
13774
- $right: "1rem",
13775
- $top: "1rem",
13776
- $backgroundColor: settings.theme.primary,
13777
- $borderRadius: "9999px",
13778
- $padding: "0.125rem 0.85rem",
13779
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13780
- Text,
13978
+ ]
13979
+ }
13980
+ ),
13981
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13982
+ Flex,
13983
+ {
13984
+ $flexDirection: "column",
13985
+ $justifyContent: "end",
13986
+ $flexGrow: 1,
13987
+ $gap: `${cardPadding}rem`,
13988
+ $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
13989
+ children: [
13990
+ displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: displayableEntitlements.map((entitlement, idx) => {
13991
+ if (entitlement.isUnlimited) {
13992
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
13993
+ Flex,
13994
+ {
13995
+ $flexWrap: "wrap",
13996
+ $justifyContent: "space-between",
13997
+ $alignItems: "center",
13998
+ $gap: "1rem",
13999
+ children: [
14000
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $gap: "1rem", children: [
14001
+ entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14002
+ Icon3,
14003
+ {
14004
+ name: entitlement.feature.icon,
14005
+ color: settings.theme.primary,
14006
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
14007
+ rounded: true
14008
+ }
14009
+ ),
14010
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14011
+ Flex,
14012
+ {
14013
+ $flexDirection: "column",
14014
+ $justifyContent: "center",
14015
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: entitlement.feature?.pluralName || entitlement.feature?.name || entitlement.featureName })
14016
+ }
14017
+ )
14018
+ ] }),
14019
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14020
+ Text,
14021
+ {
14022
+ style: { opacity: 0.54 },
14023
+ $size: 0.875 * settings.theme.typography.text.fontSize,
14024
+ $color: settings.theme.typography.text.color,
14025
+ children: "Unlimited"
14026
+ }
14027
+ )
14028
+ ]
14029
+ },
14030
+ idx
14031
+ );
14032
+ }
14033
+ const meteredEntitlement = entitlement;
14034
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
14035
+ Flex,
14036
+ {
14037
+ $flexWrap: "wrap",
14038
+ $justifyContent: "space-between",
14039
+ $alignItems: "center",
14040
+ $gap: "1rem",
14041
+ children: [
14042
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Flex, { $gap: "1rem", children: [
14043
+ meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14044
+ Icon3,
14045
+ {
14046
+ name: meteredEntitlement.feature.icon,
14047
+ color: settings.theme.primary,
14048
+ background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.25)",
14049
+ rounded: true
14050
+ }
14051
+ ),
14052
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14053
+ Flex,
14054
+ {
14055
+ $flexDirection: "column",
14056
+ $justifyContent: "center",
14057
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text, { children: meteredEntitlement.priceBehavior === "overage" /* Overage */ && meteredEntitlement.softLimit ? `${meteredEntitlement.softLimit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) })
14058
+ }
14059
+ )
14060
+ ] }),
14061
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14062
+ Text,
14063
+ {
14064
+ style: { opacity: 0.54 },
14065
+ $size: 0.875 * settings.theme.typography.text.fontSize,
14066
+ $color: settings.theme.typography.text.color,
14067
+ children: renderMeteredEntitlementPricing(meteredEntitlement)
14068
+ }
14069
+ )
14070
+ ]
14071
+ },
14072
+ idx
14073
+ );
14074
+ }) }),
14075
+ !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14076
+ Button,
13781
14077
  {
13782
- $size: 0.75 * settings.theme.typography.text.fontSize,
13783
- $color: hexToHSL(settings.theme.primary).l > 50 ? "#000000" : "#FFFFFF",
13784
- children: t2("Active")
14078
+ type: "button",
14079
+ disabled: isLoading || !isAddOnValid,
14080
+ onClick: () => toggle(addOn.id),
14081
+ $size: "sm",
14082
+ $color: "primary",
14083
+ $variant: "outline",
14084
+ $fullWidth: true,
14085
+ children: t2("Choose add-on")
14086
+ }
14087
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
14088
+ Button,
14089
+ {
14090
+ type: "button",
14091
+ disabled: isLoading || !isAddOnValid,
14092
+ onClick: () => toggle(addOn.id),
14093
+ $size: "sm",
14094
+ $color: isAddOnCurrent ? "danger" : "primary",
14095
+ $variant: isAddOnCurrent ? "ghost" : "text",
14096
+ $fullWidth: true,
14097
+ children: isAddOnCurrent ? t2("Remove add-on") : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
14098
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon3, { name: "check-rounded", size: "sm" }),
14099
+ t2("Selected")
14100
+ ] })
13785
14101
  }
13786
14102
  )
13787
- }
13788
- )
13789
- ] }),
13790
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Flex, { $flexDirection: "column", $justifyContent: "end", $flexGrow: "1", children: !addOn.isSelected ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13791
- Button,
13792
- {
13793
- type: "button",
13794
- disabled: isLoading || !isAddOnValid,
13795
- onClick: () => toggle(addOn.id),
13796
- $size: "sm",
13797
- $color: "primary",
13798
- $variant: "outline",
13799
- $fullWidth: true,
13800
- children: t2("Choose add-on")
13801
- }
13802
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
13803
- Button,
13804
- {
13805
- type: "button",
13806
- disabled: isLoading || !isAddOnValid,
13807
- onClick: () => toggle(addOn.id),
13808
- $size: "sm",
13809
- $color: isAddOnCurrent ? "danger" : "primary",
13810
- $variant: isAddOnCurrent ? "ghost" : "text",
13811
- $fullWidth: true,
13812
- children: isAddOnCurrent ? t2("Remove add-on") : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
13813
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon3, { name: "check-rounded", size: "sm" }),
13814
- t2("Selected")
13815
- ] })
14103
+ ]
13816
14104
  }
13817
- ) })
14105
+ )
13818
14106
  ]
13819
14107
  },
13820
14108
  index
@@ -14052,6 +14340,13 @@ var Navigation = ({
14052
14340
 
14053
14341
  // src/components/shared/checkout-dialog/Plan.tsx
14054
14342
  var import_react30 = require("react");
14343
+
14344
+ // src/components/shared/checkout-dialog/styles.ts
14345
+ var FlexWithAlignEnd = dt(Flex)`
14346
+ align-items: end;
14347
+ `;
14348
+
14349
+ // src/components/shared/checkout-dialog/Plan.tsx
14055
14350
  var import_jsx_runtime20 = require("react/jsx-runtime");
14056
14351
  var Selected = ({ isCurrent = false, isTrial = false }) => {
14057
14352
  const { t: t2 } = useTranslation();
@@ -14092,104 +14387,96 @@ var PlanButtonGroup = ({
14092
14387
  }) => {
14093
14388
  const { t: t2 } = useTranslation();
14094
14389
  const { data } = useEmbed();
14095
- const { isCurrentPlan, isValidPlan, isTrialing } = (0, import_react30.useMemo)(() => {
14390
+ const isTrialing = (0, import_react30.useMemo)(() => {
14391
+ return isCheckoutData(data) && data.subscription?.status === "trialing" || false;
14392
+ }, [data]);
14393
+ const { isCurrentPlan, isValidPlan } = (0, import_react30.useMemo)(() => {
14096
14394
  if (isCheckoutData(data)) {
14097
14395
  return {
14098
14396
  isCurrentPlan: data.company?.plan?.id === plan.id,
14099
- isValidPlan: isHydratedPlan(plan) && plan.valid,
14100
- isTrialing: data.subscription?.status === "trialing"
14397
+ isValidPlan: isHydratedPlan(plan) && plan.valid
14101
14398
  };
14102
14399
  }
14103
14400
  return {
14104
14401
  isCurrentPlan: false,
14105
- isValidPlan: true,
14106
- isTrialing: false
14402
+ isValidPlan: true
14107
14403
  };
14108
14404
  }, [data, plan]);
14109
14405
  if (isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable) {
14110
14406
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
14111
- !isTrialing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: isSelected && shouldTrial ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14112
- Button,
14113
- {
14114
- type: "button",
14115
- disabled: (isLoading || !isValidPlan) && !plan.custom,
14116
- ...plan.custom ? {
14117
- as: "a",
14118
- href: plan.customPlanConfig?.ctaWebSite ?? "#",
14119
- target: "_blank",
14120
- rel: "noreferrer"
14121
- } : {
14407
+ !isTrialing && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: isSelected && shouldTrial ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
14408
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14409
+ Button,
14410
+ {
14411
+ type: "button",
14412
+ disabled: (isLoading || !isValidPlan) && !plan.custom,
14413
+ ...plan.custom ? {
14414
+ as: "a",
14415
+ href: plan.customPlanConfig?.ctaWebSite ?? "#",
14416
+ target: "_blank",
14417
+ rel: "noreferrer"
14418
+ } : {
14419
+ onClick: () => {
14420
+ onSelect({
14421
+ plan,
14422
+ shouldTrial: true
14423
+ });
14424
+ }
14425
+ },
14426
+ $size: "sm",
14427
+ $color: "primary",
14428
+ $variant: "filled",
14429
+ $fullWidth: true,
14430
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : t2("Start X day trial", { days: plan.trialDays })
14431
+ }
14432
+ ),
14433
+ isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UsageViolationText, { violations: plan.usageViolations })
14434
+ ] }) }),
14435
+ !plan.custom && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
14436
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14437
+ Button,
14438
+ {
14439
+ type: "button",
14440
+ disabled: isLoading || !isValidPlan,
14122
14441
  onClick: () => {
14123
- onSelect({
14124
- plan,
14125
- shouldTrial: true
14126
- });
14127
- }
14128
- },
14129
- $size: "sm",
14130
- $color: "primary",
14131
- $variant: "filled",
14132
- $fullWidth: true,
14133
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14134
- Tooltip,
14135
- {
14136
- trigger: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
14137
- content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
14138
- }
14139
- ) : t2("Start X day trial", { days: plan.trialDays })
14140
- }
14141
- ) }),
14142
- !plan.custom && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14143
- Button,
14144
- {
14145
- type: "button",
14146
- disabled: isLoading || !isValidPlan,
14147
- onClick: () => {
14148
- onSelect({ plan, shouldTrial: false });
14149
- },
14150
- $size: "sm",
14151
- $color: "primary",
14152
- $variant: isTrialing ? "filled" : "text",
14153
- $fullWidth: true,
14154
- children: !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14155
- Tooltip,
14156
- {
14157
- trigger: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
14158
- content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
14159
- }
14160
- ) : t2("Choose plan")
14161
- }
14162
- ) })
14442
+ onSelect({ plan, shouldTrial: false });
14443
+ },
14444
+ $size: "sm",
14445
+ $color: "primary",
14446
+ $variant: isTrialing ? "filled" : "text",
14447
+ $fullWidth: true,
14448
+ children: !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Box, { $textAlign: "center", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) }) : t2("Choose plan")
14449
+ }
14450
+ ),
14451
+ isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UsageViolationText, { violations: plan.usageViolations })
14452
+ ] }) })
14163
14453
  ] });
14164
14454
  }
14165
- return isSelected ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14166
- Button,
14167
- {
14168
- type: "button",
14169
- disabled: (isLoading || !isValidPlan) && !plan.custom,
14170
- ...plan.custom ? {
14171
- as: "a",
14172
- href: plan.customPlanConfig?.ctaWebSite ?? "#",
14173
- target: "_blank",
14174
- rel: "noreferrer"
14175
- } : {
14176
- onClick: () => {
14177
- onSelect({ plan });
14178
- }
14179
- },
14180
- $size: "sm",
14181
- $color: "primary",
14182
- $variant: "filled",
14183
- $fullWidth: true,
14184
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14185
- Tooltip,
14186
- {
14187
- trigger: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
14188
- content: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
14189
- }
14190
- ) : t2("Choose plan")
14191
- }
14192
- );
14455
+ return isSelected ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
14456
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14457
+ Button,
14458
+ {
14459
+ type: "button",
14460
+ disabled: (isLoading || !isValidPlan) && !plan.custom,
14461
+ ...plan.custom ? {
14462
+ as: "a",
14463
+ href: plan.customPlanConfig?.ctaWebSite ?? "#",
14464
+ target: "_blank",
14465
+ rel: "noreferrer"
14466
+ } : {
14467
+ onClick: () => {
14468
+ onSelect({ plan });
14469
+ }
14470
+ },
14471
+ $size: "sm",
14472
+ $color: "primary",
14473
+ $variant: "filled",
14474
+ $fullWidth: true,
14475
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : t2("Choose plan")
14476
+ }
14477
+ ),
14478
+ isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UsageViolationText, { violations: plan.usageViolations })
14479
+ ] });
14193
14480
  };
14194
14481
  var Plan = ({
14195
14482
  isLoading,
@@ -14197,8 +14484,7 @@ var Plan = ({
14197
14484
  selectedPlan,
14198
14485
  period,
14199
14486
  selectPlan,
14200
- shouldTrial,
14201
- showPeriodToggle
14487
+ shouldTrial
14202
14488
  }) => {
14203
14489
  const { t: t2 } = useTranslation();
14204
14490
  const { data, settings } = useEmbed();
@@ -14206,16 +14492,23 @@ var Plan = ({
14206
14492
  const [entitlementCounts, setEntitlementCounts] = (0, import_react30.useState)(
14207
14493
  () => plans.reduce(entitlementCountsReducer, {})
14208
14494
  );
14209
- const { isTrialing, showZeroPriceAsFree } = (0, import_react30.useMemo)(() => {
14495
+ const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = (0, import_react30.useMemo)(() => {
14496
+ const showCredits2 = data?.showCredits ?? true;
14497
+ const showPeriodToggle2 = data?.showPeriodToggle ?? true;
14498
+ const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
14210
14499
  if (isCheckoutData(data)) {
14211
14500
  return {
14212
14501
  isTrialing: data.subscription?.status === "trialing",
14213
- showZeroPriceAsFree: data.showZeroPriceAsFree
14502
+ showCredits: showCredits2,
14503
+ showPeriodToggle: showPeriodToggle2,
14504
+ showZeroPriceAsFree: showZeroPriceAsFree2
14214
14505
  };
14215
14506
  }
14216
14507
  return {
14217
14508
  isTrialing: false,
14218
- showZeroPriceAsFree: false
14509
+ showCredits: showCredits2,
14510
+ showPeriodToggle: showPeriodToggle2,
14511
+ showZeroPriceAsFree: showZeroPriceAsFree2
14219
14512
  };
14220
14513
  }, [data]);
14221
14514
  const handleToggleShowAll = (id) => {
@@ -14312,7 +14605,7 @@ var Plan = ({
14312
14605
  }
14313
14606
  )
14314
14607
  ] }),
14315
- credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14608
+ showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14316
14609
  Flex,
14317
14610
  {
14318
14611
  $flexDirection: "column",
@@ -14398,6 +14691,7 @@ var Plan = ({
14398
14691
  plan.entitlements.map((entitlement, entitlementIndex) => {
14399
14692
  const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
14400
14693
  const limit = entitlement.softLimit ?? entitlement.valueNumeric;
14694
+ const creditBasedEntitlementLimit = getCreditBasedEntitlementLimit(entitlement, credits);
14401
14695
  const {
14402
14696
  price: entitlementPrice,
14403
14697
  priceTier: entitlementPriceTiers,
@@ -14405,6 +14699,7 @@ var Plan = ({
14405
14699
  packageSize: entitlementPackageSize = 1
14406
14700
  } = getEntitlementPrice(entitlement, planPeriod) || {};
14407
14701
  const metricPeriodName = getMetricPeriodName(entitlement);
14702
+ const UsageDetailsContainer = entitlement.billingThreshold ? FlexWithAlignEnd : import_react30.Fragment;
14408
14703
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
14409
14704
  Flex,
14410
14705
  {
@@ -14457,7 +14752,7 @@ var Plan = ({
14457
14752
  entitlement,
14458
14753
  period: planPeriod
14459
14754
  }
14460
- ) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
14755
+ ) : showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
14461
14756
  entitlement.consumptionRate,
14462
14757
  " ",
14463
14758
  getFeatureName(
@@ -14468,7 +14763,20 @@ var Plan = ({
14468
14763
  t2("per"),
14469
14764
  " ",
14470
14765
  getFeatureName(entitlement.feature, 1)
14471
- ] }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
14766
+ ] }) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_jsx_runtime20.Fragment, { children: creditBasedEntitlementLimit?.period ? t2("Up to X units per period", {
14767
+ amount: creditBasedEntitlementLimit.limit,
14768
+ units: getFeatureName(
14769
+ entitlement.feature,
14770
+ creditBasedEntitlementLimit.limit
14771
+ ),
14772
+ period: creditBasedEntitlementLimit.period
14773
+ }) : t2("Up to X units", {
14774
+ amount: creditBasedEntitlementLimit.limit,
14775
+ units: getFeatureName(
14776
+ entitlement.feature,
14777
+ creditBasedEntitlementLimit.limit
14778
+ )
14779
+ }) }) : hasNumericValue ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
14472
14780
  entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
14473
14781
  item: getFeatureName(
14474
14782
  entitlement.feature
@@ -14488,7 +14796,7 @@ var Plan = ({
14488
14796
  t2(metricPeriodName)
14489
14797
  ] })
14490
14798
  ] }) : entitlement.feature.name }),
14491
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $alignItems: "end", children: [
14799
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(UsageDetailsContainer, { children: [
14492
14800
  entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
14493
14801
  Text,
14494
14802
  {
@@ -14783,18 +15091,19 @@ var CheckoutDialog = ({ top = 0 }) => {
14783
15091
  showPeriodToggle,
14784
15092
  trialPaymentMethodRequired
14785
15093
  } = (0, import_react31.useMemo)(() => {
15094
+ const showPeriodToggle2 = data?.showPeriodToggle ?? true;
14786
15095
  if (isCheckoutData(data)) {
14787
15096
  return {
14788
15097
  currentPlanId: data.company?.plan?.id,
14789
15098
  currentEntitlements: data.featureUsage ? data.featureUsage.features : [],
14790
- showPeriodToggle: data.showPeriodToggle,
15099
+ showPeriodToggle: showPeriodToggle2,
14791
15100
  trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
14792
15101
  };
14793
15102
  }
14794
15103
  return {
14795
15104
  currentPlanId: void 0,
14796
15105
  currentEntitlements: [],
14797
- showPeriodToggle: true,
15106
+ showPeriodToggle: showPeriodToggle2,
14798
15107
  trialPaymentMethodRequired: false
14799
15108
  };
14800
15109
  }, [data]);
@@ -15397,8 +15706,7 @@ var CheckoutDialog = ({ top = 0 }) => {
15397
15706
  plans: availablePlans,
15398
15707
  selectedPlan,
15399
15708
  selectPlan,
15400
- shouldTrial,
15401
- showPeriodToggle
15709
+ shouldTrial
15402
15710
  }
15403
15711
  ) : checkoutStage === "usage" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
15404
15712
  Usage,
@@ -16095,12 +16403,35 @@ var UnsubscribeDialog = ({ top = 0 }) => {
16095
16403
  ] });
16096
16404
  };
16097
16405
 
16098
- // src/components/ui/badge/Badge.tsx
16406
+ // src/components/shared/usage-violation-text/UsageViolationText.tsx
16099
16407
  var import_jsx_runtime29 = require("react/jsx-runtime");
16408
+ var UsageViolationText = ({ violations }) => {
16409
+ const { t: t2 } = useTranslation();
16410
+ const { settings } = useEmbed();
16411
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16412
+ Text,
16413
+ {
16414
+ $size: 0.875 * settings.theme.typography.text.fontSize,
16415
+ $leading: 1.35,
16416
+ style: { opacity: 0.625 },
16417
+ children: t2("Cannot change to this plan.", {
16418
+ reason: violations.reduce((acc, violation) => {
16419
+ if (violation.feature) {
16420
+ acc.push(violation.feature.name);
16421
+ }
16422
+ return acc;
16423
+ }, [])
16424
+ })
16425
+ }
16426
+ );
16427
+ };
16428
+
16429
+ // src/components/ui/badge/Badge.tsx
16430
+ var import_jsx_runtime30 = require("react/jsx-runtime");
16100
16431
  var Badge = () => {
16101
16432
  const { t: t2 } = useTranslation();
16102
16433
  const { settings } = useEmbed();
16103
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
16434
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
16104
16435
  Flex,
16105
16436
  {
16106
16437
  as: "a",
@@ -16113,82 +16444,82 @@ var Badge = () => {
16113
16444
  $gridColumn: "1 / -1",
16114
16445
  $color: settings.theme.typography.text.color,
16115
16446
  children: [
16116
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Text, { $size: 12, children: [
16447
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Text, { $size: 12, children: [
16117
16448
  t2("Powered by"),
16118
16449
  " "
16119
16450
  ] }),
16120
- /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
16121
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16451
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
16452
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16122
16453
  "path",
16123
16454
  {
16124
16455
  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",
16125
16456
  fill: "currentColor"
16126
16457
  }
16127
16458
  ),
16128
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16459
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16129
16460
  "path",
16130
16461
  {
16131
16462
  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",
16132
16463
  fill: "currentColor"
16133
16464
  }
16134
16465
  ),
16135
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16466
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16136
16467
  "path",
16137
16468
  {
16138
16469
  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",
16139
16470
  fill: "currentColor"
16140
16471
  }
16141
16472
  ),
16142
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16473
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16143
16474
  "path",
16144
16475
  {
16145
16476
  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",
16146
16477
  fill: "currentColor"
16147
16478
  }
16148
16479
  ),
16149
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16480
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16150
16481
  "path",
16151
16482
  {
16152
16483
  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",
16153
16484
  fill: "currentColor"
16154
16485
  }
16155
16486
  ),
16156
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16487
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16157
16488
  "path",
16158
16489
  {
16159
16490
  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",
16160
16491
  fill: "currentColor"
16161
16492
  }
16162
16493
  ),
16163
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16494
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16164
16495
  "path",
16165
16496
  {
16166
16497
  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",
16167
16498
  fill: "currentColor"
16168
16499
  }
16169
16500
  ),
16170
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16501
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16171
16502
  "path",
16172
16503
  {
16173
16504
  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",
16174
16505
  fill: "currentColor"
16175
16506
  }
16176
16507
  ),
16177
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16508
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16178
16509
  "path",
16179
16510
  {
16180
16511
  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",
16181
16512
  fill: "currentColor"
16182
16513
  }
16183
16514
  ),
16184
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16515
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16185
16516
  "path",
16186
16517
  {
16187
16518
  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",
16188
16519
  fill: "currentColor"
16189
16520
  }
16190
16521
  ),
16191
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
16522
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
16192
16523
  "path",
16193
16524
  {
16194
16525
  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",
@@ -16202,9 +16533,9 @@ var Badge = () => {
16202
16533
  };
16203
16534
 
16204
16535
  // src/components/layout/RenderLayout.tsx
16205
- var import_jsx_runtime30 = require("react/jsx-runtime");
16536
+ var import_jsx_runtime31 = require("react/jsx-runtime");
16206
16537
  var Disabled = () => {
16207
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
16538
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
16208
16539
  Element,
16209
16540
  {
16210
16541
  as: Flex,
@@ -16213,8 +16544,8 @@ var Disabled = () => {
16213
16544
  $alignItems: "center",
16214
16545
  $whiteSpace: "nowrap",
16215
16546
  children: [
16216
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
16217
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { as: "p", children: "Please try again later." })
16547
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
16548
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Text, { as: "p", children: "Please try again later." })
16218
16549
  ]
16219
16550
  }
16220
16551
  ) }) });
@@ -16223,7 +16554,7 @@ var RenderLayout = ({ children }) => {
16223
16554
  const { layout } = useEmbed();
16224
16555
  switch (layout) {
16225
16556
  case "disabled":
16226
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Disabled, {});
16557
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Disabled, {});
16227
16558
  default:
16228
16559
  return children;
16229
16560
  }
@@ -16248,7 +16579,7 @@ var StyledViewport = dt.div.withConfig({
16248
16579
  `;
16249
16580
 
16250
16581
  // src/components/layout/viewport/Viewport.tsx
16251
- var import_jsx_runtime31 = require("react/jsx-runtime");
16582
+ var import_jsx_runtime32 = require("react/jsx-runtime");
16252
16583
  var Viewport = (0, import_react39.forwardRef)(
16253
16584
  ({ children, portal, ...props }, ref) => {
16254
16585
  const { data, layout, settings } = useEmbed();
@@ -16274,24 +16605,24 @@ var Viewport = (0, import_react39.forwardRef)(
16274
16605
  parent.style.overflow = "";
16275
16606
  };
16276
16607
  }, [portal, layout]);
16277
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
16278
- /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(StyledViewport, { ref, ...props, children: [
16279
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RenderLayout, { children }),
16280
- isBadgeVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Badge, {})
16608
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
16609
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(StyledViewport, { ref, ...props, children: [
16610
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RenderLayout, { children }),
16611
+ isBadgeVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Badge, {})
16281
16612
  ] }),
16282
- canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(CheckoutDialog, { top }), portal || document.body),
16613
+ canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(CheckoutDialog, { top }), portal || document.body),
16283
16614
  layout === "unsubscribe" && (0, import_react_dom2.createPortal)(
16284
- /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(UnsubscribeDialog, { top }),
16615
+ /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(UnsubscribeDialog, { top }),
16285
16616
  portal || document.body
16286
16617
  ),
16287
- layout === "payment" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PaymentDialog, { top }), portal || document.body)
16618
+ layout === "payment" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PaymentDialog, { top }), portal || document.body)
16288
16619
  ] });
16289
16620
  }
16290
16621
  );
16291
16622
  Viewport.displayName = "Viewport";
16292
16623
 
16293
16624
  // src/components/elements/button/Button.tsx
16294
- var import_jsx_runtime32 = require("react/jsx-runtime");
16625
+ var import_jsx_runtime33 = require("react/jsx-runtime");
16295
16626
  var resolveDesignProps = (props) => {
16296
16627
  return {
16297
16628
  button: {
@@ -16322,7 +16653,7 @@ var ButtonElement = (0, import_react40.forwardRef)(({ children, className, ...re
16322
16653
  variant: "text"
16323
16654
  }
16324
16655
  };
16325
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
16656
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
16326
16657
  Element,
16327
16658
  {
16328
16659
  as: Flex,
@@ -16330,7 +16661,7 @@ var ButtonElement = (0, import_react40.forwardRef)(({ children, className, ...re
16330
16661
  className,
16331
16662
  $flexDirection: "column",
16332
16663
  $gap: "2rem",
16333
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
16664
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
16334
16665
  Button,
16335
16666
  {
16336
16667
  as: "a",
@@ -16355,7 +16686,7 @@ var import_react42 = require("react");
16355
16686
 
16356
16687
  // src/components/elements/included-features/UsageDetails.tsx
16357
16688
  var import_react41 = require("react");
16358
- var import_jsx_runtime33 = require("react/jsx-runtime");
16689
+ var import_jsx_runtime34 = require("react/jsx-runtime");
16359
16690
  var UsageDetails = ({
16360
16691
  entitlement,
16361
16692
  shouldWrapChildren,
@@ -16373,8 +16704,18 @@ var UsageDetails = ({
16373
16704
  } = entitlement;
16374
16705
  const { t: t2 } = useTranslation();
16375
16706
  const { data } = useEmbed();
16376
- const period = (0, import_react41.useMemo)(() => {
16377
- return isCheckoutData(data) && typeof data.company?.plan?.planPeriod === "string" ? data.company.plan.planPeriod : void 0;
16707
+ const { period, showCredits } = (0, import_react41.useMemo)(() => {
16708
+ const showCredits2 = data?.showCredits ?? true;
16709
+ if (isCheckoutData(data)) {
16710
+ return {
16711
+ period: data.company?.plan?.planPeriod || void 0,
16712
+ showCredits: showCredits2
16713
+ };
16714
+ }
16715
+ return {
16716
+ period: void 0,
16717
+ showCredits: showCredits2
16718
+ };
16378
16719
  }, [data]);
16379
16720
  const { billingPrice, cost, currentTier } = (0, import_react41.useMemo)(
16380
16721
  () => getUsageDetails(entitlement, period),
@@ -16386,19 +16727,19 @@ var UsageDetails = ({
16386
16727
  }
16387
16728
  const { price, currency, packageSize = 1 } = billingPrice || {};
16388
16729
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof allocation === "number") {
16389
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16730
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16390
16731
  formatNumber(allocation),
16391
16732
  " ",
16392
16733
  getFeatureName(feature, allocation)
16393
16734
  ] });
16394
16735
  }
16395
16736
  if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof price === "number") {
16396
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16737
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16397
16738
  formatCurrency(price, currency),
16398
16739
  " ",
16399
16740
  t2("per"),
16400
16741
  " ",
16401
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16742
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16402
16743
  packageSize,
16403
16744
  " "
16404
16745
  ] }),
@@ -16406,22 +16747,22 @@ var UsageDetails = ({
16406
16747
  ] });
16407
16748
  }
16408
16749
  if (priceBehavior === "overage" /* Overage */ && typeof softLimit === "number") {
16409
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16750
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16410
16751
  formatNumber(softLimit),
16411
16752
  " ",
16412
16753
  getFeatureName(feature, softLimit)
16413
16754
  ] });
16414
16755
  }
16415
16756
  if (priceBehavior === "tier" /* Tiered */) {
16416
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
16757
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
16417
16758
  feature: getFeatureName(feature)
16418
16759
  }) : t2("Up to X units in this tier", {
16419
16760
  amount: formatNumber(currentTier.to),
16420
16761
  feature: getFeatureName(feature, currentTier?.to)
16421
16762
  })) });
16422
16763
  }
16423
- if (priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
16424
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16764
+ if (showCredits && priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
16765
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16425
16766
  planEntitlement.consumptionRate,
16426
16767
  " ",
16427
16768
  getFeatureName(
@@ -16435,7 +16776,7 @@ var UsageDetails = ({
16435
16776
  ] });
16436
16777
  }
16437
16778
  if (!priceBehavior && typeof allocation === "number") {
16438
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16779
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16439
16780
  formatNumber(allocation),
16440
16781
  " ",
16441
16782
  getFeatureName(feature, allocation)
@@ -16453,7 +16794,8 @@ var UsageDetails = ({
16453
16794
  priceBehavior,
16454
16795
  softLimit,
16455
16796
  billingPrice,
16456
- currentTier?.to
16797
+ currentTier?.to,
16798
+ showCredits
16457
16799
  ]);
16458
16800
  const usageText = (0, import_react41.useMemo)(() => {
16459
16801
  if (!feature) {
@@ -16464,10 +16806,10 @@ var UsageDetails = ({
16464
16806
  let index = 0;
16465
16807
  if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof period === "string" && typeof price === "number") {
16466
16808
  acc.push(
16467
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.Fragment, { children: [
16809
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react41.Fragment, { children: [
16468
16810
  formatCurrency(price, currency),
16469
16811
  "/",
16470
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
16812
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
16471
16813
  packageSize,
16472
16814
  " "
16473
16815
  ] }),
@@ -16479,7 +16821,7 @@ var UsageDetails = ({
16479
16821
  index += 1;
16480
16822
  } else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */ || priceBehavior === "credit_burndown" /* Credit */) && typeof usage === "number") {
16481
16823
  acc.push(
16482
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.Fragment, { children: [
16824
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react41.Fragment, { children: [
16483
16825
  usage,
16484
16826
  " ",
16485
16827
  getFeatureName(feature, usage),
@@ -16491,14 +16833,14 @@ var UsageDetails = ({
16491
16833
  }
16492
16834
  if (typeof cost === "number" && cost > 0) {
16493
16835
  acc.push(
16494
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.Fragment, { children: [
16495
- acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: " \u2022 " }),
16836
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react41.Fragment, { children: [
16837
+ acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: " \u2022 " }),
16496
16838
  formatCurrency(cost, currency)
16497
16839
  ] }, index)
16498
16840
  );
16499
16841
  index += 1;
16500
16842
  if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
16501
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.Fragment, { children: [
16843
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react41.Fragment, { children: [
16502
16844
  "/",
16503
16845
  shortenPeriod(period)
16504
16846
  ] }, index));
@@ -16507,8 +16849,8 @@ var UsageDetails = ({
16507
16849
  }
16508
16850
  if (metricResetAt) {
16509
16851
  acc.push(
16510
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.Fragment, { children: [
16511
- acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_jsx_runtime33.Fragment, { children: " \u2022 " }),
16852
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_react41.Fragment, { children: [
16853
+ acc.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: " \u2022 " }),
16512
16854
  t2("Resets", {
16513
16855
  date: toPrettyDate(metricResetAt, {
16514
16856
  month: "numeric",
@@ -16542,20 +16884,20 @@ var UsageDetails = ({
16542
16884
  billingPrice,
16543
16885
  cost
16544
16886
  ]);
16545
- if (!text || !feature?.name) {
16887
+ if (!text && !usageText || !feature) {
16546
16888
  return null;
16547
16889
  }
16548
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
16890
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
16549
16891
  Box,
16550
16892
  {
16551
16893
  $flexBasis: "min-content",
16552
16894
  $flexGrow: "1",
16553
16895
  $textAlign: shouldWrapChildren ? "left" : "right",
16554
16896
  children: [
16555
- layout.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
16556
- layout.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $justifyContent: "end", $alignItems: "end", $whiteSpace: "nowrap", children: [
16557
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText }),
16558
- priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
16897
+ layout.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
16898
+ layout.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $justifyContent: "end", $alignItems: "end", $whiteSpace: "nowrap", children: [
16899
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText }),
16900
+ priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
16559
16901
  PricingTiersTooltip,
16560
16902
  {
16561
16903
  feature,
@@ -16571,7 +16913,7 @@ var UsageDetails = ({
16571
16913
  };
16572
16914
 
16573
16915
  // src/components/elements/included-features/IncludedFeatures.tsx
16574
- var import_jsx_runtime34 = require("react/jsx-runtime");
16916
+ var import_jsx_runtime35 = require("react/jsx-runtime");
16575
16917
  function resolveDesignProps2(props) {
16576
16918
  return {
16577
16919
  header: {
@@ -16646,7 +16988,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16646
16988
  }
16647
16989
  const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
16648
16990
  const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
16649
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
16991
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
16650
16992
  Element,
16651
16993
  {
16652
16994
  as: Flex,
@@ -16655,10 +16997,10 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16655
16997
  $flexDirection: "column",
16656
16998
  $gap: "1rem",
16657
16999
  children: [
16658
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: props.header.fontStyle, children: props.header.text }) }),
17000
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { display: props.header.fontStyle, children: props.header.text }) }),
16659
17001
  featureUsage.slice(0, showCount).map((entitlement, index) => {
16660
17002
  const shouldShowDetails = entitlement.feature?.name && (entitlement.feature?.featureType === "event" /* Event */ || entitlement.feature?.featureType === "trait" /* Trait */);
16661
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
17003
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
16662
17004
  Flex,
16663
17005
  {
16664
17006
  ref: (el) => {
@@ -16671,7 +17013,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16671
17013
  $alignItems: "center",
16672
17014
  $gap: "1rem",
16673
17015
  children: [
16674
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
17016
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
16675
17017
  Flex,
16676
17018
  {
16677
17019
  $alignItems: "center",
@@ -16679,7 +17021,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16679
17021
  $flexBasis: "min-content",
16680
17022
  $gap: "1rem",
16681
17023
  children: [
16682
- props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
17024
+ props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
16683
17025
  Icon3,
16684
17026
  {
16685
17027
  name: entitlement.feature.icon,
@@ -16688,8 +17030,8 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16688
17030
  rounded: true
16689
17031
  }
16690
17032
  ),
16691
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
16692
- props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
17033
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
17034
+ props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
16693
17035
  Text,
16694
17036
  {
16695
17037
  display: props.entitlementExpiration.fontStyle,
@@ -16706,7 +17048,7 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16706
17048
  ]
16707
17049
  }
16708
17050
  ),
16709
- shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
17051
+ shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
16710
17052
  UsageDetails,
16711
17053
  {
16712
17054
  entitlement,
@@ -16719,15 +17061,15 @@ var IncludedFeatures = (0, import_react42.forwardRef)(({ className, ...rest }, r
16719
17061
  index
16720
17062
  );
16721
17063
  }),
16722
- shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
16723
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
17064
+ shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
17065
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
16724
17066
  Icon3,
16725
17067
  {
16726
17068
  name: isExpanded ? "chevron-up" : "chevron-down",
16727
17069
  color: "#D0D0D0"
16728
17070
  }
16729
17071
  ),
16730
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
17072
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
16731
17073
  Text,
16732
17074
  {
16733
17075
  onClick: handleToggleShowAll,
@@ -16745,7 +17087,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
16745
17087
 
16746
17088
  // src/components/elements/invoices/Invoices.tsx
16747
17089
  var import_react43 = require("react");
16748
- var import_jsx_runtime35 = require("react/jsx-runtime");
17090
+ var import_jsx_runtime36 = require("react/jsx-runtime");
16749
17091
  function resolveDesignProps3(props) {
16750
17092
  return {
16751
17093
  header: {
@@ -16815,9 +17157,9 @@ var Invoices = (0, import_react43.forwardRef)(({ className, data, ...rest }, ref
16815
17157
  if (invoices.length === 0) {
16816
17158
  return null;
16817
17159
  }
16818
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Element, { ref, className, children: [
16819
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
16820
- error ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
17160
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Element, { ref, className, children: [
17161
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
17162
+ error ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
16821
17163
  Flex,
16822
17164
  {
16823
17165
  as: TransitionBox,
@@ -16826,8 +17168,8 @@ var Invoices = (0, import_react43.forwardRef)(({ className, data, ...rest }, ref
16826
17168
  $alignItems: "center",
16827
17169
  $gap: "1rem",
16828
17170
  children: [
16829
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
16830
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
17171
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
17172
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16831
17173
  Button,
16832
17174
  {
16833
17175
  type: "button",
@@ -16840,12 +17182,12 @@ var Invoices = (0, import_react43.forwardRef)(({ className, data, ...rest }, ref
16840
17182
  )
16841
17183
  ]
16842
17184
  }
16843
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TransitionBox, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
16844
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
16845
- invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
16846
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
16847
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $justifyContent: "space-between", children: [
16848
- props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
17185
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TransitionBox, { children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
17186
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
17187
+ invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
17188
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
17189
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $justifyContent: "space-between", children: [
17190
+ props.date.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16849
17191
  Text,
16850
17192
  {
16851
17193
  display: props.date.fontStyle,
@@ -16859,18 +17201,18 @@ var Invoices = (0, import_react43.forwardRef)(({ className, data, ...rest }, ref
16859
17201
  children: date
16860
17202
  }
16861
17203
  ),
16862
- props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { display: props.amount.fontStyle, children: amount })
17204
+ props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: props.amount.fontStyle, children: amount })
16863
17205
  ] }, index);
16864
17206
  }) }),
16865
- props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
16866
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
17207
+ props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
17208
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16867
17209
  Icon3,
16868
17210
  {
16869
17211
  name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
16870
17212
  color: "#D0D0D0"
16871
17213
  }
16872
17214
  ),
16873
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
17215
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16874
17216
  Text,
16875
17217
  {
16876
17218
  onClick: toggleListSize,
@@ -16882,7 +17224,7 @@ var Invoices = (0, import_react43.forwardRef)(({ className, data, ...rest }, ref
16882
17224
  }
16883
17225
  )
16884
17226
  ] })
16885
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Text, { display: "heading2", children: t2("No invoices created yet") })
17227
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Text, { display: "heading2", children: t2("No invoices created yet") })
16886
17228
  ] }) })
16887
17229
  ] });
16888
17230
  });
@@ -16892,14 +17234,14 @@ Invoices.displayName = "Invoices";
16892
17234
  var import_react44 = require("react");
16893
17235
 
16894
17236
  // src/components/elements/metered-features/Meter.tsx
16895
- var import_jsx_runtime36 = require("react/jsx-runtime");
17237
+ var import_jsx_runtime37 = require("react/jsx-runtime");
16896
17238
  var Meter = ({ entitlement, usageDetails }) => {
16897
17239
  const { priceBehavior, usage } = entitlement;
16898
17240
  const limit = usageDetails.limit ?? usageDetails.currentTier?.to;
16899
17241
  if (typeof usage !== "number" || !limit || limit === Infinity) {
16900
17242
  return null;
16901
17243
  }
16902
- const meter = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
17244
+ const meter = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
16903
17245
  ProgressBar,
16904
17246
  {
16905
17247
  progress: Math.min(usage, limit) / Math.max(usage, limit) * 100,
@@ -16916,7 +17258,7 @@ var Meter = ({ entitlement, usageDetails }) => {
16916
17258
  };
16917
17259
 
16918
17260
  // src/components/elements/metered-features/PriceDetails.tsx
16919
- var import_jsx_runtime37 = require("react/jsx-runtime");
17261
+ var import_jsx_runtime38 = require("react/jsx-runtime");
16920
17262
  var PriceDetails = ({
16921
17263
  entitlement,
16922
17264
  usageDetails,
@@ -16943,7 +17285,7 @@ var PriceDetails = ({
16943
17285
  if (!feature || typeof currentTierPerUnitPrice !== "number") {
16944
17286
  return null;
16945
17287
  }
16946
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
17288
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
16947
17289
  Flex,
16948
17290
  {
16949
17291
  $justifyContent: "space-between",
@@ -16957,30 +17299,30 @@ var PriceDetails = ({
16957
17299
  $borderBottomRightRadius: `${settings.theme.card.borderRadius / TEXT_BASE_SIZE}rem`
16958
17300
  },
16959
17301
  children: [
16960
- priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text, { children: [
17302
+ priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
16961
17303
  t2("Additional"),
16962
17304
  ": ",
16963
17305
  formatCurrency(currentTierPerUnitPrice, currency),
16964
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
17306
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
16965
17307
  "/",
16966
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
17308
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
16967
17309
  packageSize,
16968
17310
  " "
16969
17311
  ] }),
16970
17312
  getFeatureName(feature, packageSize),
16971
- feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
17313
+ feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
16972
17314
  "/",
16973
17315
  shortenPeriod(period)
16974
17316
  ] })
16975
17317
  ] })
16976
- ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Flex, { $alignItems: "end", children: [
16977
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text, { children: [
17318
+ ] }) : priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $alignItems: "end", children: [
17319
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
16978
17320
  t2("Tier"),
16979
17321
  ": ",
16980
17322
  currentTier?.from || 1,
16981
- typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}` })
17323
+ typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}` })
16982
17324
  ] }),
16983
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
17325
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
16984
17326
  PricingTiersTooltip,
16985
17327
  {
16986
17328
  period,
@@ -16991,19 +17333,19 @@ var PriceDetails = ({
16991
17333
  }
16992
17334
  )
16993
17335
  ] }),
16994
- typeof amount === "number" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text, { children: [
17336
+ typeof amount === "number" && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
16995
17337
  formatNumber(amount),
16996
17338
  " ",
16997
17339
  getFeatureName(feature, amount),
16998
17340
  " \xB7 ",
16999
17341
  formatCurrency(currentTierPerUnitPrice * amount, currency),
17000
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
17342
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
17001
17343
  "/",
17002
17344
  shortenPeriod(period)
17003
17345
  ] })
17004
- ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Text, { children: [
17346
+ ] }) : priceBehavior === "tier" /* Tiered */ && typeof cost === "number" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Text, { children: [
17005
17347
  formatCurrency(cost, currency),
17006
- feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
17348
+ feature.featureType === "trait" /* Trait */ && typeof period === "string" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Box, { as: "sub", $whiteSpace: "nowrap", children: [
17007
17349
  "/",
17008
17350
  shortenPeriod(period)
17009
17351
  ] })
@@ -17031,7 +17373,7 @@ var Container2 = dt.div`
17031
17373
  `;
17032
17374
 
17033
17375
  // src/components/elements/metered-features/MeteredFeatures.tsx
17034
- var import_jsx_runtime38 = require("react/jsx-runtime");
17376
+ var import_jsx_runtime39 = require("react/jsx-runtime");
17035
17377
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
17036
17378
  const { t: t2 } = useTranslation();
17037
17379
  const { feature, priceBehavior, allocation, usage, metricResetAt } = entitlement;
@@ -17045,7 +17387,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
17045
17387
  feature: getFeatureName(feature)
17046
17388
  }) : priceBehavior === "overage" /* Overage */ && typeof limit === "number" ? t2("X included", {
17047
17389
  amount: formatNumber(limit)
17048
- }) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : typeof allocation === "number" ? t2("Limit of", {
17390
+ }) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : priceBehavior === "credit_burndown" /* Credit */ && typeof limit === "number" ? t2("Limit of", {
17391
+ amount: formatNumber(limit)
17392
+ }) : typeof allocation === "number" ? t2("Limit of", {
17049
17393
  amount: formatNumber(allocation)
17050
17394
  }) : t2("No limit")
17051
17395
  );
@@ -17060,7 +17404,7 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
17060
17404
  })
17061
17405
  );
17062
17406
  }
17063
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
17407
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
17064
17408
  };
17065
17409
  function resolveDesignProps4(props) {
17066
17410
  return {
@@ -17094,7 +17438,8 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17094
17438
  const { t: t2 } = useTranslation();
17095
17439
  const { data, settings, setCheckoutState } = useEmbed();
17096
17440
  const isLightBackground = useIsLightBackground();
17097
- const { period, meteredFeatures, creditGroups } = (0, import_react44.useMemo)(() => {
17441
+ const { period, meteredFeatures, creditGroups, showCredits } = (0, import_react44.useMemo)(() => {
17442
+ const showCredits2 = data?.showCredits ?? true;
17098
17443
  if (isCheckoutData(data)) {
17099
17444
  const period2 = typeof data.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0;
17100
17445
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
@@ -17112,20 +17457,19 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17112
17457
  return {
17113
17458
  period: period2,
17114
17459
  meteredFeatures: (orderedFeatureUsage || data.featureUsage?.features || []).filter(
17115
- ({ priceBehavior, feature }) => (
17116
- // credit-based entitlements behave differently and should not be shown as a metered feature
17117
- priceBehavior !== "credit_burndown" /* Credit */ && (feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */)
17118
- )
17460
+ ({ feature }) => feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */
17119
17461
  ),
17120
17462
  creditGroups: groupCreditGrants(data.creditGrants, {
17121
17463
  groupBy: "credit"
17122
- })
17464
+ }),
17465
+ showCredits: showCredits2
17123
17466
  };
17124
17467
  }
17125
17468
  return {
17126
17469
  period: void 0,
17127
17470
  meteredFeatures: [],
17128
- creditGroups: []
17471
+ creditGroups: [],
17472
+ showCredits: showCredits2
17129
17473
  };
17130
17474
  }, [props.visibleFeatures, data]);
17131
17475
  const [creditVisibility, setCreditVisibility] = (0, import_react44.useState)(
@@ -17142,7 +17486,7 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17142
17486
  if (!shouldShowFeatures) {
17143
17487
  return null;
17144
17488
  }
17145
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Container2, { ref, className, children: [
17489
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Container2, { ref, className, children: [
17146
17490
  meteredFeatures.reduce((acc, entitlement, index) => {
17147
17491
  if (!entitlement.feature) {
17148
17492
  return acc;
@@ -17151,9 +17495,9 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17151
17495
  const usageDetails = getUsageDetails(entitlement, period);
17152
17496
  const { limit } = usageDetails;
17153
17497
  acc.push(
17154
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
17155
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $gap: "1.5rem", children: [
17156
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17498
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
17499
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $gap: "1.5rem", children: [
17500
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17157
17501
  Icon3,
17158
17502
  {
17159
17503
  name: feature.icon,
@@ -17162,8 +17506,8 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17162
17506
  rounded: true
17163
17507
  }
17164
17508
  ),
17165
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
17166
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
17509
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
17510
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17167
17511
  Flex,
17168
17512
  {
17169
17513
  ref: (el) => {
@@ -17174,31 +17518,31 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17174
17518
  $flexWrap: "wrap",
17175
17519
  $gap: "1rem",
17176
17520
  children: [
17177
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
17178
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
17179
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
17521
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
17522
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
17523
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
17180
17524
  ] }),
17181
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
17525
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17182
17526
  Box,
17183
17527
  {
17184
17528
  $flexBasis: "min-content",
17185
17529
  $flexGrow: 1,
17186
17530
  $textAlign: shouldWrapChildren ? "left" : "right",
17187
17531
  children: [
17188
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
17189
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
17532
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
17533
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
17190
17534
  formatNumber(limit),
17191
17535
  " "
17192
17536
  ] }),
17193
17537
  getFeatureName(feature, limit)
17194
- ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
17538
+ ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
17195
17539
  formatNumber(usage),
17196
17540
  " ",
17197
17541
  getFeatureName(feature, usage),
17198
17542
  " ",
17199
17543
  t2("used")
17200
17544
  ] }) }) }),
17201
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17545
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17202
17546
  Limit,
17203
17547
  {
17204
17548
  entitlement,
@@ -17212,14 +17556,14 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17212
17556
  ]
17213
17557
  }
17214
17558
  ),
17215
- props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17559
+ props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17216
17560
  Meter,
17217
17561
  {
17218
17562
  entitlement,
17219
17563
  usageDetails
17220
17564
  }
17221
17565
  ),
17222
- priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17566
+ priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17223
17567
  Button,
17224
17568
  {
17225
17569
  type: "button",
@@ -17232,7 +17576,7 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17232
17576
  )
17233
17577
  ] })
17234
17578
  ] }),
17235
- (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17579
+ (priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17236
17580
  PriceDetails,
17237
17581
  {
17238
17582
  entitlement,
@@ -17244,11 +17588,11 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17244
17588
  );
17245
17589
  return acc;
17246
17590
  }, []),
17247
- creditGroups.map((credit, index) => {
17591
+ showCredits && creditGroups.map((credit, index) => {
17248
17592
  const isExpanded = creditVisibility.find(({ id }) => credit.id === id)?.isExpanded ?? false;
17249
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
17250
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $gap: "1.5rem", children: [
17251
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17593
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
17594
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $gap: "1.5rem", children: [
17595
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17252
17596
  Icon3,
17253
17597
  {
17254
17598
  name: credit.icon,
@@ -17257,13 +17601,13 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17257
17601
  rounded: true
17258
17602
  }
17259
17603
  ),
17260
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
17261
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
17262
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
17263
- props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
17604
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
17605
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
17606
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
17607
+ props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
17264
17608
  ] }) }),
17265
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $gap: "1rem", children: [
17266
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17609
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $gap: "1rem", children: [
17610
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17267
17611
  ProgressBar,
17268
17612
  {
17269
17613
  progress: credit.total.used / credit.total.value * 100,
@@ -17274,7 +17618,7 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17274
17618
  )]
17275
17619
  }
17276
17620
  ),
17277
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17621
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17278
17622
  Button,
17279
17623
  {
17280
17624
  type: "button",
@@ -17289,12 +17633,12 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17289
17633
  ] })
17290
17634
  ] })
17291
17635
  ] }),
17292
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17636
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17293
17637
  Box,
17294
17638
  {
17295
17639
  $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
17296
17640
  $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
17297
- children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17641
+ children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17298
17642
  TransitionBox,
17299
17643
  {
17300
17644
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
@@ -17302,19 +17646,19 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17302
17646
  children: credit.grants.map((grant, index2) => {
17303
17647
  const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
17304
17648
  const padding = index2 > 0 ? `0 ${paddingX}rem 1rem` : `1rem ${paddingX}rem`;
17305
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $display: "table-row", children: grant.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
17306
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: t2("X items included in plan", {
17649
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $display: "table-row", children: grant.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
17650
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: t2("X items included in plan", {
17307
17651
  amount: grant.quantity,
17308
17652
  item: getFeatureName(credit, grant.quantity)
17309
17653
  }) }) }),
17310
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17654
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17311
17655
  Box,
17312
17656
  {
17313
17657
  $display: "table-cell",
17314
17658
  $padding: padding,
17315
17659
  $textAlign: "right",
17316
17660
  $whiteSpace: "nowrap",
17317
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: t2("Resets", {
17661
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: t2("Resets", {
17318
17662
  date: toPrettyDate(
17319
17663
  modifyDate(grant.expiresAt, 1),
17320
17664
  {
@@ -17326,8 +17670,8 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17326
17670
  }) })
17327
17671
  }
17328
17672
  )
17329
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [
17330
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: grant.grantReason === "purchased" /* Purchased */ ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: t2("X item bundle", {
17673
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
17674
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: grant.grantReason === "purchased" /* Purchased */ ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: t2("X item bundle", {
17331
17675
  amount: grant.quantity,
17332
17676
  item: getFeatureName(credit, 1),
17333
17677
  createdAt: toPrettyDate(grant.createdAt, {
@@ -17335,7 +17679,7 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17335
17679
  month: "2-digit",
17336
17680
  year: "2-digit"
17337
17681
  })
17338
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: t2("X item grant", {
17682
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_jsx_runtime39.Fragment, { children: t2("X item grant", {
17339
17683
  amount: grant.quantity,
17340
17684
  item: getFeatureName(
17341
17685
  credit,
@@ -17347,14 +17691,14 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17347
17691
  year: "2-digit"
17348
17692
  })
17349
17693
  }) }) }) }),
17350
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17694
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17351
17695
  Box,
17352
17696
  {
17353
17697
  $display: "table-cell",
17354
17698
  $padding: padding,
17355
17699
  $textAlign: "right",
17356
17700
  $whiteSpace: "nowrap",
17357
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(Text, { children: t2("Expires", {
17701
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: t2("Expires", {
17358
17702
  date: toPrettyDate(
17359
17703
  modifyDate(grant.expiresAt, 1),
17360
17704
  {
@@ -17372,8 +17716,8 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17372
17716
  )
17373
17717
  }
17374
17718
  ),
17375
- /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Flex, { $gap: "0.25rem", children: [
17376
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17719
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $gap: "0.25rem", children: [
17720
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17377
17721
  Icon3,
17378
17722
  {
17379
17723
  name: "chevron-down",
@@ -17384,7 +17728,7 @@ var MeteredFeatures = (0, import_react44.forwardRef)(({ className, ...rest }, re
17384
17728
  }
17385
17729
  }
17386
17730
  ),
17387
- /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
17731
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17388
17732
  Text,
17389
17733
  {
17390
17734
  onClick: () => toggleBalanceDetails(credit.id),
@@ -17404,24 +17748,24 @@ var import_react46 = require("react");
17404
17748
 
17405
17749
  // src/components/elements/payment-method/PaymentMethodElement.tsx
17406
17750
  var import_react45 = require("react");
17407
- var import_jsx_runtime39 = require("react/jsx-runtime");
17751
+ var import_jsx_runtime40 = require("react/jsx-runtime");
17408
17752
  var PaymentElement2 = ({
17409
17753
  iconName,
17410
17754
  iconTitle,
17411
17755
  label,
17412
17756
  paymentLast4
17413
17757
  }) => {
17414
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
17415
- iconName && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon3, { name: iconName, title: iconTitle }),
17416
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box, { $flexGrow: 1, children: [
17417
- label && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: label }),
17758
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
17759
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon3, { name: iconName, title: iconTitle }),
17760
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box, { $flexGrow: 1, children: [
17761
+ label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: label }),
17418
17762
  " ",
17419
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: paymentLast4 })
17763
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: paymentLast4 })
17420
17764
  ] })
17421
17765
  ] }) });
17422
17766
  };
17423
17767
  var EmptyPaymentElement = () => {
17424
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
17768
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
17425
17769
  };
17426
17770
  var getPaymentMethodData = ({
17427
17771
  accountLast4,
@@ -17486,12 +17830,12 @@ var PaymentMethodElement = ({
17486
17830
  const { t: t2 } = useTranslation();
17487
17831
  const isLightBackground = useIsLightBackground();
17488
17832
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
17489
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
17490
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
17491
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
17492
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
17833
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
17834
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
17835
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
17836
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
17493
17837
  ] }),
17494
- /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17838
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
17495
17839
  Flex,
17496
17840
  {
17497
17841
  $justifyContent: "space-between",
@@ -17500,8 +17844,8 @@ var PaymentMethodElement = ({
17500
17844
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
17501
17845
  $borderRadius: "9999px",
17502
17846
  children: [
17503
- paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(EmptyPaymentElement, {}),
17504
- props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17847
+ paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(EmptyPaymentElement, {}),
17848
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
17505
17849
  Text,
17506
17850
  {
17507
17851
  onClick: onEdit,
@@ -17534,7 +17878,7 @@ var PaymentListElement = ({
17534
17878
  }
17535
17879
  return `${cardExpMonth}/${formatedYear}`;
17536
17880
  }, [paymentMethod]);
17537
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(
17881
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
17538
17882
  Flex,
17539
17883
  {
17540
17884
  $flexDirection: "row",
@@ -17546,21 +17890,21 @@ var PaymentListElement = ({
17546
17890
  $borderStyle: "solid",
17547
17891
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
17548
17892
  children: [
17549
- iconName && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon3, { name: iconName, title: iconTitle }),
17550
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(Box, { $flexGrow: 1, children: [
17551
- label && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: label }),
17893
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon3, { name: iconName, title: iconTitle }),
17894
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(Box, { $flexGrow: 1, children: [
17895
+ label && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: label }),
17552
17896
  " ",
17553
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: paymentLast4 })
17897
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: paymentLast4 })
17554
17898
  ] }),
17555
- expirationDate && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17899
+ expirationDate && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
17556
17900
  Box,
17557
17901
  {
17558
17902
  $flexGrow: 1,
17559
17903
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
17560
- children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
17904
+ children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
17561
17905
  }
17562
17906
  ),
17563
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17907
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
17564
17908
  Text,
17565
17909
  {
17566
17910
  onClick: () => {
@@ -17573,7 +17917,7 @@ var PaymentListElement = ({
17573
17917
  children: t("Set default")
17574
17918
  }
17575
17919
  ) }),
17576
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
17920
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
17577
17921
  Icon3,
17578
17922
  {
17579
17923
  tabIndex: 0,
@@ -17595,7 +17939,7 @@ var PaymentListElement = ({
17595
17939
  };
17596
17940
 
17597
17941
  // src/components/elements/payment-method/PaymentMethod.tsx
17598
- var import_jsx_runtime40 = require("react/jsx-runtime");
17942
+ var import_jsx_runtime41 = require("react/jsx-runtime");
17599
17943
  var resolveDesignProps5 = (props) => {
17600
17944
  return {
17601
17945
  header: {
@@ -17636,7 +17980,7 @@ var PaymentMethod = (0, import_react46.forwardRef)(({ children, className, porta
17636
17980
  monthsToExpiration: void 0
17637
17981
  };
17638
17982
  }, [data]);
17639
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
17983
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
17640
17984
  PaymentMethodElement,
17641
17985
  {
17642
17986
  paymentMethod,
@@ -17652,7 +17996,7 @@ PaymentMethod.displayName = "PaymentMethod";
17652
17996
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
17653
17997
 
17654
17998
  // node_modules/@stripe/stripe-js/dist/index.mjs
17655
- var RELEASE_TRAIN = "basil";
17999
+ var RELEASE_TRAIN = "clover";
17656
18000
  var runtimeVersionToUrlVersion = function runtimeVersionToUrlVersion2(version) {
17657
18001
  return version === 3 ? "v3" : version;
17658
18002
  };
@@ -17692,7 +18036,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
17692
18036
  }
17693
18037
  stripe._registerWrapper({
17694
18038
  name: "stripe-js",
17695
- version: "7.9.0",
18039
+ version: "8.1.0",
17696
18040
  startTime
17697
18041
  });
17698
18042
  };
@@ -17767,7 +18111,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
17767
18111
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
17768
18112
  var expectedVersion = RELEASE_TRAIN;
17769
18113
  if (isTestKey && version !== expectedVersion) {
17770
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("7.9.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
18114
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("8.1.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
17771
18115
  }
17772
18116
  var stripe = maybeStripe.apply(void 0, args);
17773
18117
  registerWrapper(stripe, startTime);
@@ -17805,7 +18149,7 @@ var loadStripe = function loadStripe2() {
17805
18149
 
17806
18150
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
17807
18151
  var import_react47 = require("react");
17808
- var import_jsx_runtime41 = require("react/jsx-runtime");
18152
+ var import_jsx_runtime42 = require("react/jsx-runtime");
17809
18153
  var resolveDesignProps6 = () => {
17810
18154
  return {
17811
18155
  header: {
@@ -17963,8 +18307,8 @@ var PaymentMethodDetails = ({
17963
18307
  showPaymentForm,
17964
18308
  initializePaymentMethod
17965
18309
  ]);
17966
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $position: "relative", children: [
17967
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18310
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $position: "relative", children: [
18311
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17968
18312
  Flex,
17969
18313
  {
17970
18314
  $position: "absolute",
@@ -17973,7 +18317,7 @@ var PaymentMethodDetails = ({
17973
18317
  $alignItems: "center",
17974
18318
  $width: "100%",
17975
18319
  $height: "100%",
17976
- children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18320
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
17977
18321
  Loader,
17978
18322
  {
17979
18323
  $color: settings.theme.primary,
@@ -17983,7 +18327,7 @@ var PaymentMethodDetails = ({
17983
18327
  )
17984
18328
  }
17985
18329
  ),
17986
- /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
18330
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
17987
18331
  Flex,
17988
18332
  {
17989
18333
  $position: "relative",
@@ -17996,7 +18340,7 @@ var PaymentMethodDetails = ({
17996
18340
  $visibility: isLoading || isConfirmingPayment ? "hidden" : "visible",
17997
18341
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
17998
18342
  children: [
17999
- setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
18343
+ setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
18000
18344
  import_react_stripe_js2.Elements,
18001
18345
  {
18002
18346
  stripe,
@@ -18026,7 +18370,7 @@ var PaymentMethodDetails = ({
18026
18370
  clientSecret: setupIntent?.setupIntentClientSecret
18027
18371
  },
18028
18372
  children: [
18029
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18373
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18030
18374
  PaymentForm,
18031
18375
  {
18032
18376
  financeData,
@@ -18037,7 +18381,7 @@ var PaymentMethodDetails = ({
18037
18381
  }
18038
18382
  }
18039
18383
  ),
18040
- currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18384
+ currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18041
18385
  Text,
18042
18386
  {
18043
18387
  onClick: focusExistingPaymentMethods,
@@ -18050,8 +18394,8 @@ var PaymentMethodDetails = ({
18050
18394
  ) })
18051
18395
  ]
18052
18396
  }
18053
- ) : /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
18054
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18397
+ ) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
18398
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18055
18399
  PaymentMethodElement,
18056
18400
  {
18057
18401
  paymentMethod: currentPaymentMethod,
@@ -18059,8 +18403,8 @@ var PaymentMethodDetails = ({
18059
18403
  ...props
18060
18404
  }
18061
18405
  ),
18062
- paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
18063
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18406
+ paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
18407
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18064
18408
  Text,
18065
18409
  {
18066
18410
  onClick: toggleShowPaymentMethods,
@@ -18071,17 +18415,17 @@ var PaymentMethodDetails = ({
18071
18415
  children: t2("Choose different payment method")
18072
18416
  }
18073
18417
  ),
18074
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18418
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18075
18419
  Icon3,
18076
18420
  {
18077
18421
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down"
18078
18422
  }
18079
18423
  )
18080
18424
  ] }),
18081
- showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
18082
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
18425
+ showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
18426
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
18083
18427
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
18084
- ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18428
+ ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18085
18429
  PaymentListElement,
18086
18430
  {
18087
18431
  paymentMethod,
@@ -18090,7 +18434,7 @@ var PaymentMethodDetails = ({
18090
18434
  },
18091
18435
  paymentMethod.id
18092
18436
  )) }),
18093
- (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
18437
+ (!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
18094
18438
  Button,
18095
18439
  {
18096
18440
  type: "button",
@@ -18102,7 +18446,7 @@ var PaymentMethodDetails = ({
18102
18446
  )
18103
18447
  ] })
18104
18448
  ] }),
18105
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
18449
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
18106
18450
  ]
18107
18451
  }
18108
18452
  )
@@ -18113,9 +18457,9 @@ var PaymentMethodDetails = ({
18113
18457
  var import_react49 = require("react");
18114
18458
 
18115
18459
  // src/components/elements/plan-manager/AddOn.tsx
18116
- var import_jsx_runtime42 = require("react/jsx-runtime");
18460
+ var import_jsx_runtime43 = require("react/jsx-runtime");
18117
18461
  var AddOn = ({ addOn, currency, layout }) => {
18118
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
18462
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
18119
18463
  Flex,
18120
18464
  {
18121
18465
  $justifyContent: "space-between",
@@ -18123,10 +18467,10 @@ var AddOn = ({ addOn, currency, layout }) => {
18123
18467
  $flexWrap: "wrap",
18124
18468
  $gap: "1rem",
18125
18469
  children: [
18126
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
18127
- typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
18470
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
18471
+ typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { children: [
18128
18472
  formatCurrency(addOn.planPrice, currency),
18129
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
18473
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
18130
18474
  ] })
18131
18475
  ]
18132
18476
  }
@@ -18135,10 +18479,11 @@ var AddOn = ({ addOn, currency, layout }) => {
18135
18479
 
18136
18480
  // src/components/elements/plan-manager/UsageDetails.tsx
18137
18481
  var import_react48 = require("react");
18138
- var import_jsx_runtime43 = require("react/jsx-runtime");
18482
+ var import_jsx_runtime44 = require("react/jsx-runtime");
18139
18483
  var UsageDetails2 = ({
18140
18484
  entitlement,
18141
18485
  period,
18486
+ showCredits,
18142
18487
  layout
18143
18488
  }) => {
18144
18489
  const { t: t2 } = useTranslation();
@@ -18157,9 +18502,9 @@ var UsageDetails2 = ({
18157
18502
  let index = 0;
18158
18503
  if (entitlement.priceBehavior === "overage" /* Overage */) {
18159
18504
  acc.push(
18160
- amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react48.Fragment, { children: t2("X additional", {
18505
+ amount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react48.Fragment, { children: t2("X additional", {
18161
18506
  amount
18162
- }) }, index) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react48.Fragment, { children: [
18507
+ }) }, index) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react48.Fragment, { children: [
18163
18508
  t2("Additional"),
18164
18509
  ": "
18165
18510
  ] }, index)
@@ -18170,16 +18515,16 @@ var UsageDetails2 = ({
18170
18515
  if (entitlement.priceBehavior !== "tier" /* Tiered */ && entitlement.feature && typeof price === "number" && !amount) {
18171
18516
  const packageSize = billingPrice?.packageSize ?? 1;
18172
18517
  acc.push(
18173
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react48.Fragment, { children: [
18518
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react48.Fragment, { children: [
18174
18519
  formatCurrency(price, billingPrice?.currency),
18175
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("sub", { children: [
18520
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("sub", { children: [
18176
18521
  "/",
18177
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
18522
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
18178
18523
  packageSize,
18179
18524
  " "
18180
18525
  ] }),
18181
18526
  getFeatureName(entitlement.feature, packageSize),
18182
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
18527
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
18183
18528
  "/",
18184
18529
  shortenPeriod(period)
18185
18530
  ] })
@@ -18188,10 +18533,10 @@ var UsageDetails2 = ({
18188
18533
  );
18189
18534
  index += 1;
18190
18535
  }
18191
- if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
18536
+ if (showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
18192
18537
  const creditAmount = entitlement.planEntitlement.consumptionRate * amount;
18193
18538
  acc.push(
18194
- creditAmount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react48.Fragment, { children: [
18539
+ creditAmount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react48.Fragment, { children: [
18195
18540
  creditAmount,
18196
18541
  " ",
18197
18542
  getFeatureName(
@@ -18200,7 +18545,7 @@ var UsageDetails2 = ({
18200
18545
  ),
18201
18546
  " ",
18202
18547
  t2("used")
18203
- ] }, index) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react48.Fragment, { children: [
18548
+ ] }, index) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_react48.Fragment, { children: [
18204
18549
  entitlement.planEntitlement.consumptionRate,
18205
18550
  " ",
18206
18551
  getFeatureName(
@@ -18216,12 +18561,12 @@ var UsageDetails2 = ({
18216
18561
  index += 1;
18217
18562
  }
18218
18563
  return acc;
18219
- }, [t2, period, entitlement, billingPrice, amount]);
18220
- if (!entitlement.feature?.name) {
18564
+ }, [t2, period, showCredits, entitlement, billingPrice, amount]);
18565
+ if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && !showCredits || !entitlement.feature?.name) {
18221
18566
  return null;
18222
18567
  }
18223
- const quantity = limit || amount;
18224
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
18568
+ const quantity = entitlement.priceBehavior !== "credit_burndown" /* Credit */ ? limit || amount : void 0;
18569
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18225
18570
  Flex,
18226
18571
  {
18227
18572
  $justifyContent: "space-between",
@@ -18229,13 +18574,13 @@ var UsageDetails2 = ({
18229
18574
  $flexWrap: "wrap",
18230
18575
  $gap: "0.5rem",
18231
18576
  children: [
18232
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [
18577
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
18233
18578
  quantity,
18234
18579
  " ",
18235
18580
  entitlement.feature.name
18236
18581
  ] }) : entitlement.feature.name }),
18237
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
18238
- description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
18582
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
18583
+ description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18239
18584
  Text,
18240
18585
  {
18241
18586
  style: { opacity: 0.54 },
@@ -18244,15 +18589,15 @@ var UsageDetails2 = ({
18244
18589
  children: description
18245
18590
  }
18246
18591
  ),
18247
- (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Flex, { $alignItems: "end", children: [
18248
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Text, { children: [
18592
+ (cost > 0 || entitlement.priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $alignItems: "end", children: [
18593
+ /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { children: [
18249
18594
  formatCurrency(cost, billingPrice?.currency),
18250
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("sub", { children: [
18595
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("sub", { children: [
18251
18596
  "/",
18252
18597
  shortenPeriod(period)
18253
18598
  ] })
18254
18599
  ] }),
18255
- entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
18600
+ entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18256
18601
  PricingTiersTooltip,
18257
18602
  {
18258
18603
  feature: entitlement.feature,
@@ -18269,7 +18614,7 @@ var UsageDetails2 = ({
18269
18614
  };
18270
18615
 
18271
18616
  // src/components/elements/plan-manager/PlanManager.tsx
18272
- var import_jsx_runtime44 = require("react/jsx-runtime");
18617
+ var import_jsx_runtime45 = require("react/jsx-runtime");
18273
18618
  var resolveDesignProps7 = (props) => {
18274
18619
  return {
18275
18620
  header: {
@@ -18313,9 +18658,12 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18313
18658
  canCheckout,
18314
18659
  postTrialPlan,
18315
18660
  featureUsage,
18661
+ showCredits,
18316
18662
  showZeroPriceAsFree,
18317
18663
  trialPaymentMethodRequired
18318
18664
  } = (0, import_react49.useMemo)(() => {
18665
+ const showCredits2 = data?.showCredits ?? true;
18666
+ const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
18319
18667
  if (isCheckoutData(data)) {
18320
18668
  const {
18321
18669
  company,
@@ -18324,7 +18672,6 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18324
18672
  capabilities,
18325
18673
  postTrialPlan: postTrialPlan2,
18326
18674
  featureUsage: featureUsage2,
18327
- showZeroPriceAsFree: showZeroPriceAsFree2,
18328
18675
  trialPaymentMethodRequired: trialPaymentMethodRequired2
18329
18676
  } = data;
18330
18677
  const creditGroups2 = groupCreditGrants(creditGrants, {
@@ -18354,8 +18701,9 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18354
18701
  canCheckout: capabilities?.checkout ?? true,
18355
18702
  postTrialPlan: postTrialPlan2,
18356
18703
  featureUsage: featureUsage2?.features || [],
18357
- showZeroPriceAsFree: showZeroPriceAsFree2,
18358
- trialPaymentMethodRequired: trialPaymentMethodRequired2
18704
+ trialPaymentMethodRequired: trialPaymentMethodRequired2,
18705
+ showCredits: showCredits2,
18706
+ showZeroPriceAsFree: showZeroPriceAsFree2
18359
18707
  };
18360
18708
  }
18361
18709
  return {
@@ -18367,8 +18715,9 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18367
18715
  canCheckout: false,
18368
18716
  postTrialPlan: void 0,
18369
18717
  featureUsage: [],
18370
- showZeroPriceAsFree: false,
18371
- trialPaymentMethodRequired: false
18718
+ trialPaymentMethodRequired: false,
18719
+ showCredits: showCredits2,
18720
+ showZeroPriceAsFree: showZeroPriceAsFree2
18372
18721
  };
18373
18722
  }, [data]);
18374
18723
  const usageBasedEntitlements = (0, import_react49.useMemo)(
@@ -18394,8 +18743,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18394
18743
  }, [billingSubscription]);
18395
18744
  const isFreePlan = currentPlan?.planPrice === 0;
18396
18745
  const isUsageBasedPlan = isFreePlan && usageBasedEntitlements.length > 0;
18397
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
18398
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18746
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
18747
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18399
18748
  Notice,
18400
18749
  {
18401
18750
  as: Flex,
@@ -18405,15 +18754,15 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18405
18754
  $textAlign: "center",
18406
18755
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
18407
18756
  children: [
18408
- typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
18409
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : postTrialPlan ? t2("After the trial, cancel", {
18757
+ typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
18758
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : postTrialPlan ? t2("After the trial, cancel", {
18410
18759
  postTrialPlanName: postTrialPlan?.name
18411
18760
  }) : t2("After the trial, cancel no default", {
18412
18761
  planName: currentPlan?.name
18413
18762
  }) })
18414
18763
  ]
18415
18764
  }
18416
- ) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18765
+ ) : willSubscriptionCancel && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18417
18766
  Notice,
18418
18767
  {
18419
18768
  as: Flex,
@@ -18423,8 +18772,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18423
18772
  $textAlign: "center",
18424
18773
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
18425
18774
  children: [
18426
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
18427
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18775
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
18776
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18428
18777
  Text,
18429
18778
  {
18430
18779
  as: "p",
@@ -18442,7 +18791,7 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18442
18791
  ]
18443
18792
  }
18444
18793
  ),
18445
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18794
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18446
18795
  Element,
18447
18796
  {
18448
18797
  as: Flex,
@@ -18451,19 +18800,19 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18451
18800
  $flexDirection: "column",
18452
18801
  $gap: "2rem",
18453
18802
  children: [
18454
- props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18803
+ props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18455
18804
  Flex,
18456
18805
  {
18457
18806
  $justifyContent: "space-between",
18458
18807
  $alignItems: "center",
18459
18808
  $gap: "1rem",
18460
18809
  children: [
18461
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18462
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
18463
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
18810
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
18811
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
18812
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
18464
18813
  ] }),
18465
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Box, { children: [
18466
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18814
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Box, { children: [
18815
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18467
18816
  Text,
18468
18817
  {
18469
18818
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -18473,7 +18822,7 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18473
18822
  )
18474
18823
  }
18475
18824
  ),
18476
- !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("sub", { children: [
18825
+ !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("sub", { children: [
18477
18826
  "/",
18478
18827
  shortenPeriod(currentPlan.planPeriod)
18479
18828
  ] }) })
@@ -18481,8 +18830,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18481
18830
  ]
18482
18831
  }
18483
18832
  ),
18484
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18485
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18833
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18834
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18486
18835
  Text,
18487
18836
  {
18488
18837
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -18490,7 +18839,7 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18490
18839
  children: t2("Add-ons")
18491
18840
  }
18492
18841
  ),
18493
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18842
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18494
18843
  AddOn,
18495
18844
  {
18496
18845
  addOn,
@@ -18500,8 +18849,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18500
18849
  addOnIndex
18501
18850
  )) })
18502
18851
  ] }),
18503
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18504
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18852
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18853
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18505
18854
  Text,
18506
18855
  {
18507
18856
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -18509,20 +18858,21 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18509
18858
  children: t2("Usage-based")
18510
18859
  }
18511
18860
  ),
18512
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
18513
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18861
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
18862
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18514
18863
  UsageDetails2,
18515
18864
  {
18516
18865
  entitlement,
18517
18866
  period: currentPlan?.planPeriod || "month",
18867
+ showCredits,
18518
18868
  layout: props
18519
18869
  },
18520
18870
  entitlementIndex
18521
18871
  );
18522
18872
  }) })
18523
18873
  ] }),
18524
- props.addOns.isVisible && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18525
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18874
+ props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18875
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18526
18876
  Text,
18527
18877
  {
18528
18878
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -18530,8 +18880,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18530
18880
  children: t2("Credits in plan")
18531
18881
  }
18532
18882
  ),
18533
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.plan.map((group, groupIndex) => {
18534
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18883
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.plan.map((group, groupIndex) => {
18884
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18535
18885
  Flex,
18536
18886
  {
18537
18887
  $justifyContent: "space-between",
@@ -18539,18 +18889,18 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18539
18889
  $flexWrap: "wrap",
18540
18890
  $gap: "0.5rem",
18541
18891
  children: [
18542
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18892
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18543
18893
  group.quantity,
18544
18894
  " ",
18545
18895
  getFeatureName(group, group.quantity),
18546
18896
  " ",
18547
- subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [
18897
+ subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
18548
18898
  t2("per"),
18549
18899
  " ",
18550
18900
  t2(subscriptionInterval)
18551
18901
  ] })
18552
18902
  ] }),
18553
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18903
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18554
18904
  Text,
18555
18905
  {
18556
18906
  style: { opacity: 0.54 },
@@ -18569,8 +18919,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18569
18919
  );
18570
18920
  }) })
18571
18921
  ] }),
18572
- props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18573
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18922
+ props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18923
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18574
18924
  Text,
18575
18925
  {
18576
18926
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -18578,9 +18928,9 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18578
18928
  children: t2("Credit bundles")
18579
18929
  }
18580
18930
  ),
18581
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.bundles.map((group, groupIndex) => {
18931
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.bundles.map((group, groupIndex) => {
18582
18932
  const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
18583
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18933
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18584
18934
  Flex,
18585
18935
  {
18586
18936
  $justifyContent: "space-between",
@@ -18588,8 +18938,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18588
18938
  $flexWrap: "wrap",
18589
18939
  $gap: "0.5rem",
18590
18940
  children: [
18591
- bundle ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18592
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { style: { opacity: 0.5 }, children: [
18941
+ bundle ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18942
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { style: { opacity: 0.5 }, children: [
18593
18943
  "(",
18594
18944
  group.grants.length,
18595
18945
  ")",
@@ -18601,12 +18951,12 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18601
18951
  " ",
18602
18952
  getFeatureName(group, group.quantity),
18603
18953
  ")"
18604
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18954
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18605
18955
  group.quantity,
18606
18956
  " ",
18607
18957
  getFeatureName(group, group.quantity)
18608
18958
  ] }),
18609
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18959
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18610
18960
  Text,
18611
18961
  {
18612
18962
  style: { opacity: 0.54 },
@@ -18625,8 +18975,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18625
18975
  );
18626
18976
  }) })
18627
18977
  ] }),
18628
- props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18629
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
18978
+ props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18979
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18630
18980
  Text,
18631
18981
  {
18632
18982
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -18634,8 +18984,8 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18634
18984
  children: t2("Promotional credits")
18635
18985
  }
18636
18986
  ),
18637
- /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.promotional.map((group, groupIndex) => {
18638
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
18987
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.promotional.map((group, groupIndex) => {
18988
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18639
18989
  Flex,
18640
18990
  {
18641
18991
  $justifyContent: "space-between",
@@ -18643,12 +18993,12 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18643
18993
  $flexWrap: "wrap",
18644
18994
  $gap: "0.5rem",
18645
18995
  children: [
18646
- /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18996
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { display: props.addOns.fontStyle, children: [
18647
18997
  group.quantity,
18648
18998
  " ",
18649
18999
  getFeatureName(group, group.quantity)
18650
19000
  ] }),
18651
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
19001
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
18652
19002
  Text,
18653
19003
  {
18654
19004
  style: { opacity: 0.54 },
@@ -18667,7 +19017,7 @@ var PlanManager = (0, import_react49.forwardRef)(({ children, className, portal,
18667
19017
  );
18668
19018
  }) })
18669
19019
  ] }),
18670
- canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
19020
+ canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
18671
19021
  Button,
18672
19022
  {
18673
19023
  type: "button",
@@ -18696,7 +19046,7 @@ var import_react52 = require("react");
18696
19046
 
18697
19047
  // src/components/elements/pricing-table/AddOn.tsx
18698
19048
  var import_react50 = require("react");
18699
- var import_jsx_runtime45 = require("react/jsx-runtime");
19049
+ var import_jsx_runtime46 = require("react/jsx-runtime");
18700
19050
  var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18701
19051
  const { layout } = sharedProps;
18702
19052
  const { t: t2 } = useTranslation();
@@ -18722,7 +19072,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18722
19072
  const isCurrentAddOn = isHydratedPlan(addOn) && addOn.current;
18723
19073
  const isActiveAddOn = isCurrentAddOn && selectedPeriod === currentAddOns.find((currentAddOn) => currentAddOn.id === addOn.id)?.planPeriod;
18724
19074
  const { price: addOnPrice, currency: addOnCurrency } = getAddOnPrice(addOn, selectedPeriod) || {};
18725
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
19075
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
18726
19076
  Flex,
18727
19077
  {
18728
19078
  $position: "relative",
@@ -18738,17 +19088,17 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18738
19088
  $boxShadow: cardBoxShadow
18739
19089
  },
18740
19090
  children: [
18741
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
18742
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
18743
- layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
18744
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Text, { display: layout.plans.name.fontStyle, children: [
19091
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
19092
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
19093
+ layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
19094
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Text, { display: layout.plans.name.fontStyle, children: [
18745
19095
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
18746
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("sub", { children: [
19096
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
18747
19097
  "/",
18748
19098
  selectedPeriod
18749
19099
  ] })
18750
19100
  ] }) }),
18751
- isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19101
+ isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18752
19102
  Flex,
18753
19103
  {
18754
19104
  $position: "absolute",
@@ -18757,7 +19107,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18757
19107
  $backgroundColor: settings.theme.primary,
18758
19108
  $borderRadius: "9999px",
18759
19109
  $padding: "0.125rem 0.85rem",
18760
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19110
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18761
19111
  Text,
18762
19112
  {
18763
19113
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -18768,7 +19118,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18768
19118
  }
18769
19119
  )
18770
19120
  ] }),
18771
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
19121
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
18772
19122
  Flex,
18773
19123
  {
18774
19124
  $flexDirection: "column",
@@ -18776,7 +19126,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18776
19126
  $gap: `${cardPadding}rem`,
18777
19127
  $flexGrow: 1,
18778
19128
  children: [
18779
- layout.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19129
+ layout.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18780
19130
  Flex,
18781
19131
  {
18782
19132
  $flexDirection: "column",
@@ -18785,15 +19135,15 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18785
19135
  $flexGrow: 1,
18786
19136
  children: addOn.entitlements.map((entitlement, entitlementIndex) => {
18787
19137
  const metricPeriodName = getMetricPeriodName(entitlement);
18788
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19138
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18789
19139
  Flex,
18790
19140
  {
18791
19141
  $flexWrap: "wrap",
18792
19142
  $justifyContent: "space-between",
18793
19143
  $alignItems: "center",
18794
19144
  $gap: "1rem",
18795
- children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $gap: "1rem", children: [
18796
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19145
+ children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $gap: "1rem", children: [
19146
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18797
19147
  Icon3,
18798
19148
  {
18799
19149
  name: entitlement.feature.icon,
@@ -18802,11 +19152,11 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18802
19152
  rounded: true
18803
19153
  }
18804
19154
  ),
18805
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18806
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
19155
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
19156
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
18807
19157
  entitlement.valueType === "unlimited" /* Unlimited */ ? t2("Unlimited", {
18808
19158
  item: getFeatureName(entitlement.feature)
18809
- }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
19159
+ }) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
18810
19160
  formatNumber(entitlement.valueNumeric),
18811
19161
  " ",
18812
19162
  getFeatureName(
@@ -18814,14 +19164,14 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18814
19164
  entitlement.valueNumeric
18815
19165
  )
18816
19166
  ] }),
18817
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
19167
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
18818
19168
  " ",
18819
19169
  t2("per"),
18820
19170
  " ",
18821
19171
  t2(metricPeriodName)
18822
19172
  ] })
18823
19173
  ] }) : entitlement.feature.name }) }),
18824
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19174
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18825
19175
  Text,
18826
19176
  {
18827
19177
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -18837,7 +19187,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18837
19187
  })
18838
19188
  }
18839
19189
  ),
18840
- showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
19190
+ showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
18841
19191
  Button,
18842
19192
  {
18843
19193
  type: "button",
@@ -18878,11 +19228,13 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
18878
19228
  var import_react51 = require("react");
18879
19229
 
18880
19230
  // src/components/elements/pricing-table/Entitlement.tsx
18881
- var import_jsx_runtime46 = require("react/jsx-runtime");
19231
+ var import_jsx_runtime47 = require("react/jsx-runtime");
18882
19232
  var Entitlement = ({
18883
19233
  entitlement,
18884
- sharedProps,
18885
- selectedPeriod
19234
+ credits = [],
19235
+ selectedPeriod,
19236
+ showCredits,
19237
+ sharedProps
18886
19238
  }) => {
18887
19239
  const { layout } = sharedProps;
18888
19240
  const { t: t2 } = useTranslation();
@@ -18894,13 +19246,14 @@ var Entitlement = ({
18894
19246
  currency: entitlementCurrency,
18895
19247
  packageSize: entitlementPackageSize = 1
18896
19248
  } = getEntitlementPrice(entitlement, selectedPeriod) || {};
18897
- if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
18898
- return null;
18899
- }
18900
19249
  const limit = entitlement.softLimit ?? entitlement.valueNumeric;
18901
19250
  const metricPeriodName = getMetricPeriodName(entitlement);
18902
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $gap: "1rem", children: [
18903
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19251
+ const creditBasedEntitlementLimit = getCreditBasedEntitlementLimit(
19252
+ entitlement,
19253
+ credits
19254
+ );
19255
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $gap: "1rem", children: [
19256
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18904
19257
  Icon3,
18905
19258
  {
18906
19259
  name: entitlement.feature.icon,
@@ -18909,47 +19262,71 @@ var Entitlement = ({
18909
19262
  rounded: true
18910
19263
  }
18911
19264
  ),
18912
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
18913
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
18914
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19265
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
19266
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
19267
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18915
19268
  formatCurrency(entitlementPrice, entitlementCurrency),
18916
19269
  " ",
18917
19270
  t2("per"),
18918
19271
  " ",
18919
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19272
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18920
19273
  entitlementPackageSize,
18921
19274
  " "
18922
19275
  ] }),
18923
19276
  getFeatureName(entitlement.feature, entitlementPackageSize),
18924
- entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19277
+ entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18925
19278
  " ",
18926
19279
  t2("per"),
18927
19280
  " ",
18928
19281
  selectedPeriod
18929
19282
  ] })
18930
- ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19283
+ ] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18931
19284
  TieredPricingDetails,
18932
19285
  {
18933
19286
  entitlement,
18934
19287
  period: selectedPeriod
18935
19288
  }
18936
- ) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19289
+ ) : showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
19290
+ entitlement.consumptionRate,
19291
+ " ",
19292
+ getFeatureName(
19293
+ entitlement.valueCredit,
19294
+ entitlement.consumptionRate || void 0
19295
+ ),
19296
+ " ",
19297
+ t2("per"),
19298
+ " ",
19299
+ getFeatureName(entitlement.feature, 1)
19300
+ ] }) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_jsx_runtime47.Fragment, { children: creditBasedEntitlementLimit?.period ? t2("Up to X units per period", {
19301
+ amount: creditBasedEntitlementLimit.limit,
19302
+ units: getFeatureName(
19303
+ entitlement.feature,
19304
+ creditBasedEntitlementLimit.limit
19305
+ ),
19306
+ period: creditBasedEntitlementLimit.period
19307
+ }) : t2("Up to X units", {
19308
+ amount: creditBasedEntitlementLimit.limit,
19309
+ units: getFeatureName(
19310
+ entitlement.feature,
19311
+ creditBasedEntitlementLimit.limit
19312
+ )
19313
+ }) }) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18937
19314
  entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
18938
19315
  item: getFeatureName(entitlement.feature)
18939
- }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19316
+ }) : typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18940
19317
  formatNumber(limit),
18941
19318
  " ",
18942
19319
  getFeatureName(entitlement.feature, limit)
18943
19320
  ] }),
18944
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19321
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18945
19322
  " ",
18946
19323
  t2("per"),
18947
19324
  " ",
18948
19325
  t2(metricPeriodName)
18949
19326
  ] })
18950
19327
  ] }) : entitlement.feature.name }),
18951
- /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $alignItems: "end", children: [
18952
- entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
19328
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $alignItems: "end", children: [
19329
+ entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
18953
19330
  Text,
18954
19331
  {
18955
19332
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -18959,19 +19336,19 @@ var Entitlement = ({
18959
19336
  " ",
18960
19337
  formatCurrency(entitlementPrice, entitlementCurrency),
18961
19338
  "/",
18962
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19339
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18963
19340
  entitlementPackageSize,
18964
19341
  " "
18965
19342
  ] }),
18966
19343
  getFeatureName(entitlement.feature, entitlementPackageSize),
18967
- entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
19344
+ entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
18968
19345
  "/",
18969
19346
  shortenPeriod(selectedPeriod)
18970
19347
  ] })
18971
19348
  ]
18972
19349
  }
18973
- ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(Flex, { $alignItems: "end", children: [
18974
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19350
+ ) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $alignItems: "end", children: [
19351
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18975
19352
  Text,
18976
19353
  {
18977
19354
  style: { opacity: 0.54 },
@@ -18980,7 +19357,7 @@ var Entitlement = ({
18980
19357
  children: t2("Tier-based")
18981
19358
  }
18982
19359
  ),
18983
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19360
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18984
19361
  PricingTiersTooltip,
18985
19362
  {
18986
19363
  feature: entitlement.feature,
@@ -18990,7 +19367,7 @@ var Entitlement = ({
18990
19367
  }
18991
19368
  )
18992
19369
  ] }),
18993
- entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19370
+ entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18994
19371
  BillingThresholdTooltip,
18995
19372
  {
18996
19373
  billingThreshold: entitlement.billingThreshold
@@ -18998,7 +19375,7 @@ var Entitlement = ({
18998
19375
  )
18999
19376
  ] })
19000
19377
  ] }),
19001
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
19378
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19002
19379
  Text,
19003
19380
  {
19004
19381
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -19011,7 +19388,7 @@ var Entitlement = ({
19011
19388
  };
19012
19389
 
19013
19390
  // src/components/elements/pricing-table/Plan.tsx
19014
- var import_jsx_runtime47 = require("react/jsx-runtime");
19391
+ var import_jsx_runtime48 = require("react/jsx-runtime");
19015
19392
  var Plan2 = ({
19016
19393
  plan,
19017
19394
  index,
@@ -19026,15 +19403,20 @@ var Plan2 = ({
19026
19403
  const { data, settings, setCheckoutState } = useEmbed();
19027
19404
  const isLightBackground = useIsLightBackground();
19028
19405
  const trialEnd = useTrialEnd();
19406
+ const showCallToAction = (0, import_react51.useMemo)(() => {
19407
+ return typeof sharedProps.callToActionUrl === "string" || typeof sharedProps.onCallToAction === "function";
19408
+ }, [sharedProps.callToActionUrl, sharedProps.onCallToAction]);
19029
19409
  const {
19030
19410
  currentPeriod,
19031
19411
  canCheckout,
19032
19412
  isTrialSubscription,
19033
19413
  willSubscriptionCancel,
19034
19414
  isStandalone,
19035
- showCallToAction,
19415
+ showCredits,
19036
19416
  showZeroPriceAsFree
19037
19417
  } = (0, import_react51.useMemo)(() => {
19418
+ const showCredits2 = data?.showCredits ?? true;
19419
+ const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
19038
19420
  if (isCheckoutData(data)) {
19039
19421
  const billingSubscription = data.company?.billingSubscription;
19040
19422
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -19045,8 +19427,8 @@ var Plan2 = ({
19045
19427
  isTrialSubscription: isTrialSubscription2,
19046
19428
  willSubscriptionCancel: willSubscriptionCancel2,
19047
19429
  isStandalone: false,
19048
- showCallToAction: true,
19049
- showZeroPriceAsFree: data.showZeroPriceAsFree
19430
+ showCredits: showCredits2,
19431
+ showZeroPriceAsFree: showZeroPriceAsFree2
19050
19432
  };
19051
19433
  }
19052
19434
  return {
@@ -19055,10 +19437,10 @@ var Plan2 = ({
19055
19437
  isTrialSubscription: false,
19056
19438
  willSubscriptionCancel: false,
19057
19439
  isStandalone: true,
19058
- showCallToAction: typeof sharedProps.callToActionUrl === "string" || typeof sharedProps.onCallToAction === "function",
19059
- showZeroPriceAsFree: false
19440
+ showCredits: showCredits2,
19441
+ showZeroPriceAsFree: showZeroPriceAsFree2
19060
19442
  };
19061
- }, [data, sharedProps.callToActionUrl, sharedProps.onCallToAction]);
19443
+ }, [data]);
19062
19444
  const callToActionTarget = (0, import_react51.useMemo)(() => {
19063
19445
  if (sharedProps.callToActionTarget) {
19064
19446
  return sharedProps.callToActionTarget;
@@ -19089,7 +19471,7 @@ var Plan2 = ({
19089
19471
  const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
19090
19472
  const count = entitlementCounts[plan.id];
19091
19473
  const isExpanded = count && count.limit > VISIBLE_ENTITLEMENT_COUNT;
19092
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19474
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19093
19475
  Flex,
19094
19476
  {
19095
19477
  className: "sch-PricingTable_Plan",
@@ -19106,7 +19488,7 @@ var Plan2 = ({
19106
19488
  $boxShadow: cardBoxShadow
19107
19489
  },
19108
19490
  children: [
19109
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19491
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19110
19492
  Flex,
19111
19493
  {
19112
19494
  $flexDirection: "column",
@@ -19117,9 +19499,9 @@ var Plan2 = ({
19117
19499
  $borderStyle: "solid",
19118
19500
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
19119
19501
  children: [
19120
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
19121
- layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
19122
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19502
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
19503
+ layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
19504
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19123
19505
  Text,
19124
19506
  {
19125
19507
  $font: headerPriceFontStyle.fontFamily,
@@ -19128,14 +19510,14 @@ var Plan2 = ({
19128
19510
  $color: headerPriceFontStyle.color,
19129
19511
  children: [
19130
19512
  plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig.priceText : t2("Custom price") : isUsageBasedPlan ? t2("Usage-based") : isFreePlan && showZeroPriceAsFree ? t2("Free") : formatCurrency(planPrice ?? 0, planCurrency),
19131
- !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("sub", { children: [
19513
+ !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("sub", { children: [
19132
19514
  "/",
19133
19515
  selectedPeriod
19134
19516
  ] })
19135
19517
  ]
19136
19518
  }
19137
19519
  ) }),
19138
- credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19520
+ showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19139
19521
  Flex,
19140
19522
  {
19141
19523
  $flexDirection: "column",
@@ -19143,8 +19525,8 @@ var Plan2 = ({
19143
19525
  $flexGrow: 1,
19144
19526
  $marginTop: "0.5rem",
19145
19527
  children: credits.map((credit, idx) => {
19146
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $gap: "1rem", children: [
19147
- layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19528
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Flex, { $gap: "1rem", children: [
19529
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19148
19530
  Icon3,
19149
19531
  {
19150
19532
  name: credit.icon,
@@ -19153,17 +19535,17 @@ var Plan2 = ({
19153
19535
  rounded: true
19154
19536
  }
19155
19537
  ),
19156
- credit.name && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19538
+ credit.name && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19157
19539
  Flex,
19158
19540
  {
19159
19541
  $flexDirection: "column",
19160
19542
  $justifyContent: "center",
19161
19543
  $gap: "0.5rem",
19162
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Text, { children: [
19544
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Text, { children: [
19163
19545
  credit.quantity,
19164
19546
  " ",
19165
19547
  getFeatureName(credit, credit.quantity),
19166
- credit.period && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
19548
+ credit.period && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
19167
19549
  " ",
19168
19550
  t2("per"),
19169
19551
  " ",
@@ -19176,7 +19558,7 @@ var Plan2 = ({
19176
19558
  })
19177
19559
  }
19178
19560
  ),
19179
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19561
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19180
19562
  Flex,
19181
19563
  {
19182
19564
  $position: "absolute",
@@ -19185,7 +19567,7 @@ var Plan2 = ({
19185
19567
  $backgroundColor: settings.theme.primary,
19186
19568
  $borderRadius: "9999px",
19187
19569
  $padding: "0.125rem 0.85rem",
19188
- children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19570
+ children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19189
19571
  Text,
19190
19572
  {
19191
19573
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -19198,7 +19580,7 @@ var Plan2 = ({
19198
19580
  ]
19199
19581
  }
19200
19582
  ),
19201
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19583
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19202
19584
  Flex,
19203
19585
  {
19204
19586
  $flexDirection: "column",
@@ -19207,20 +19589,22 @@ var Plan2 = ({
19207
19589
  $gap: `${cardPadding}rem`,
19208
19590
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
19209
19591
  children: [
19210
- layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
19211
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { children: t2("Everything in", {
19592
+ layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
19593
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { children: t2("Everything in", {
19212
19594
  plan: plans[index - 1].name
19213
19595
  }) }) }),
19214
- plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19596
+ plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19215
19597
  Entitlement,
19216
19598
  {
19217
19599
  entitlement,
19218
- sharedProps: { layout },
19219
- selectedPeriod
19600
+ credits,
19601
+ selectedPeriod,
19602
+ showCredits,
19603
+ sharedProps: { layout }
19220
19604
  },
19221
19605
  idx
19222
19606
  )).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
19223
- (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19607
+ (count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19224
19608
  Flex,
19225
19609
  {
19226
19610
  $justifyContent: "start",
@@ -19228,14 +19612,14 @@ var Plan2 = ({
19228
19612
  $gap: "0.5rem",
19229
19613
  $marginTop: "1rem",
19230
19614
  children: [
19231
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19615
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19232
19616
  Icon3,
19233
19617
  {
19234
19618
  name: isExpanded ? "chevron-up" : "chevron-down",
19235
19619
  color: "#D0D0D0"
19236
19620
  }
19237
19621
  ),
19238
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19622
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19239
19623
  Text,
19240
19624
  {
19241
19625
  onClick: () => handleToggleShowAll(plan.id),
@@ -19255,7 +19639,7 @@ var Plan2 = ({
19255
19639
  }
19256
19640
  )
19257
19641
  ] }),
19258
- isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
19642
+ isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19259
19643
  Flex,
19260
19644
  {
19261
19645
  $justifyContent: "center",
@@ -19263,7 +19647,7 @@ var Plan2 = ({
19263
19647
  $gap: "0.25rem",
19264
19648
  $padding: "0.625rem 0",
19265
19649
  children: [
19266
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19650
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19267
19651
  Icon3,
19268
19652
  {
19269
19653
  name: "check-rounded",
@@ -19271,55 +19655,52 @@ var Plan2 = ({
19271
19655
  color: settings.theme.primary
19272
19656
  }
19273
19657
  ),
19274
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
19658
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
19275
19659
  ]
19276
19660
  }
19277
- ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19278
- Button,
19279
- {
19280
- type: "button",
19281
- disabled: (isHydratedPlan(plan) && !plan.valid || !canCheckout) && !plan.custom,
19282
- ...index > currentPlanIndex ? {
19283
- $size: layout.upgrade.buttonSize,
19284
- $color: layout.upgrade.buttonStyle,
19285
- $variant: "filled"
19286
- } : {
19287
- $size: layout.downgrade.buttonSize,
19288
- $color: layout.downgrade.buttonStyle,
19289
- $variant: "outline"
19290
- },
19291
- ...plan.custom ? {
19292
- as: "a",
19293
- href: plan.customPlanConfig?.ctaWebSite ?? "#",
19294
- target: "_blank",
19295
- rel: "noreferrer"
19296
- } : sharedProps.callToActionUrl ? {
19297
- as: "a",
19298
- href: sharedProps.callToActionUrl,
19299
- target: callToActionTarget,
19300
- rel: "noreferrer"
19301
- } : {
19302
- onClick: () => {
19303
- sharedProps.onCallToAction?.(plan);
19304
- if (!isStandalone && isHydratedPlan(plan) && !plan.custom) {
19305
- setCheckoutState({
19306
- period: selectedPeriod,
19307
- planId: isActivePlan ? null : plan.id,
19308
- usage: false
19309
- });
19661
+ ) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
19662
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19663
+ Button,
19664
+ {
19665
+ type: "button",
19666
+ disabled: (isHydratedPlan(plan) && !plan.valid || !canCheckout) && !plan.custom,
19667
+ ...index > currentPlanIndex ? {
19668
+ $size: layout.upgrade.buttonSize,
19669
+ $color: layout.upgrade.buttonStyle,
19670
+ $variant: "filled"
19671
+ } : {
19672
+ $size: layout.downgrade.buttonSize,
19673
+ $color: layout.downgrade.buttonStyle,
19674
+ $variant: "outline"
19675
+ },
19676
+ ...plan.custom ? {
19677
+ as: "a",
19678
+ href: plan.customPlanConfig?.ctaWebSite ?? "#",
19679
+ target: "_blank",
19680
+ rel: "noreferrer"
19681
+ } : sharedProps.callToActionUrl ? {
19682
+ as: "a",
19683
+ href: sharedProps.callToActionUrl,
19684
+ target: callToActionTarget,
19685
+ rel: "noreferrer"
19686
+ } : {
19687
+ onClick: () => {
19688
+ sharedProps.onCallToAction?.(plan);
19689
+ if (!isStandalone && isHydratedPlan(plan) && !plan.custom) {
19690
+ setCheckoutState({
19691
+ period: selectedPeriod,
19692
+ planId: isActivePlan ? null : plan.id,
19693
+ usage: false
19694
+ });
19695
+ }
19310
19696
  }
19311
- }
19312
- },
19313
- $fullWidth: true,
19314
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
19315
- Tooltip,
19316
- {
19317
- trigger: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
19318
- content: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Text, { children: t2("Current usage exceeds the limit of this plan.") })
19319
- }
19320
- ) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
19321
- }
19322
- )
19697
+ },
19698
+ $fullWidth: true,
19699
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
19700
+ }
19701
+ ),
19702
+ isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(UsageViolationText, { violations: plan.usageViolations })
19703
+ ] })
19323
19704
  ]
19324
19705
  }
19325
19706
  )
@@ -19329,7 +19710,7 @@ var Plan2 = ({
19329
19710
  };
19330
19711
 
19331
19712
  // src/components/elements/pricing-table/PricingTable.tsx
19332
- var import_jsx_runtime48 = require("react/jsx-runtime");
19713
+ var import_jsx_runtime49 = require("react/jsx-runtime");
19333
19714
  var resolveDesignProps8 = (props) => {
19334
19715
  return {
19335
19716
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -19433,7 +19814,7 @@ var PricingTable = (0, import_react52.forwardRef)(
19433
19814
  setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
19434
19815
  }, [plans]);
19435
19816
  if (isPending) {
19436
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19817
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19437
19818
  Flex,
19438
19819
  {
19439
19820
  $width: "100%",
@@ -19441,12 +19822,12 @@ var PricingTable = (0, import_react52.forwardRef)(
19441
19822
  $alignItems: "center",
19442
19823
  $justifyContent: "center",
19443
19824
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
19444
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Loader, { $size: "2xl" })
19825
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Loader, { $size: "2xl" })
19445
19826
  }
19446
19827
  );
19447
19828
  }
19448
19829
  const Wrapper = isStandalone ? Container : import_react52.Fragment;
19449
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19830
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
19450
19831
  FussyChild,
19451
19832
  {
19452
19833
  ref,
@@ -19455,8 +19836,8 @@ var PricingTable = (0, import_react52.forwardRef)(
19455
19836
  $flexDirection: "column",
19456
19837
  $gap: "2rem",
19457
19838
  children: [
19458
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Box, { children: [
19459
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
19839
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(Box, { children: [
19840
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
19460
19841
  Flex,
19461
19842
  {
19462
19843
  $flexDirection: "column",
@@ -19471,8 +19852,8 @@ var PricingTable = (0, import_react52.forwardRef)(
19471
19852
  }
19472
19853
  },
19473
19854
  children: [
19474
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { display: props.header.fontStyle, children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans") }),
19475
- showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19855
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { display: props.header.fontStyle, children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans") }),
19856
+ showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19476
19857
  PeriodToggle,
19477
19858
  {
19478
19859
  options: periods,
@@ -19487,7 +19868,7 @@ var PricingTable = (0, import_react52.forwardRef)(
19487
19868
  ]
19488
19869
  }
19489
19870
  ),
19490
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19871
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19491
19872
  Box,
19492
19873
  {
19493
19874
  $display: "grid",
@@ -19495,7 +19876,7 @@ var PricingTable = (0, import_react52.forwardRef)(
19495
19876
  $gap: "1rem",
19496
19877
  children: plans.map((plan, index, self2) => {
19497
19878
  const planPeriod = showPeriodToggle ? selectedPeriod : plan.yearlyPrice && !plan.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
19498
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19879
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19499
19880
  Plan2,
19500
19881
  {
19501
19882
  plan,
@@ -19517,17 +19898,17 @@ var PricingTable = (0, import_react52.forwardRef)(
19517
19898
  }
19518
19899
  )
19519
19900
  ] }),
19520
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
19521
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19901
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
19902
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19522
19903
  Flex,
19523
19904
  {
19524
19905
  $justifyContent: "space-between",
19525
19906
  $alignItems: "center",
19526
19907
  $marginBottom: "1rem",
19527
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Text, { display: props.header.fontStyle, children: t2("Add-ons") })
19908
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Text, { display: props.header.fontStyle, children: t2("Add-ons") })
19528
19909
  }
19529
19910
  ),
19530
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19911
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19531
19912
  Box,
19532
19913
  {
19533
19914
  $display: "grid",
@@ -19535,7 +19916,7 @@ var PricingTable = (0, import_react52.forwardRef)(
19535
19916
  $gap: "1rem",
19536
19917
  children: addOns.map((addOn, index) => {
19537
19918
  const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.yearlyPrice && !addOn.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
19538
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
19919
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19539
19920
  AddOn2,
19540
19921
  {
19541
19922
  addOn,
@@ -19562,7 +19943,7 @@ PricingTable.displayName = "PricingTable";
19562
19943
 
19563
19944
  // src/components/elements/text/Text.tsx
19564
19945
  var import_react53 = require("react");
19565
- var import_jsx_runtime49 = require("react/jsx-runtime");
19946
+ var import_jsx_runtime50 = require("react/jsx-runtime");
19566
19947
  var resolveDesignProps9 = (props) => {
19567
19948
  return {
19568
19949
  text: {
@@ -19574,7 +19955,7 @@ var resolveDesignProps9 = (props) => {
19574
19955
  };
19575
19956
  var TextElement = (0, import_react53.forwardRef)(({ children, className, ...rest }, ref) => {
19576
19957
  const props = resolveDesignProps9(rest);
19577
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
19958
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
19578
19959
  Text,
19579
19960
  {
19580
19961
  display: props.text.fontStyle,
@@ -19588,7 +19969,7 @@ TextElement.displayName = "Text";
19588
19969
 
19589
19970
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
19590
19971
  var import_react54 = require("react");
19591
- var import_jsx_runtime50 = require("react/jsx-runtime");
19972
+ var import_jsx_runtime51 = require("react/jsx-runtime");
19592
19973
  var buttonStyles = {
19593
19974
  primary: {
19594
19975
  color: "primary",
@@ -19624,7 +20005,7 @@ var UnsubscribeButton = (0, import_react54.forwardRef)(({ children, className, .
19624
20005
  if (!hasActiveSubscription) {
19625
20006
  return null;
19626
20007
  }
19627
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
20008
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
19628
20009
  Element,
19629
20010
  {
19630
20011
  as: Flex,
@@ -19632,7 +20013,7 @@ var UnsubscribeButton = (0, import_react54.forwardRef)(({ children, className, .
19632
20013
  className,
19633
20014
  $flexDirection: "column",
19634
20015
  $gap: "2rem",
19635
- children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
20016
+ children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
19636
20017
  Button,
19637
20018
  {
19638
20019
  type: "button",
@@ -19654,7 +20035,7 @@ UnsubscribeButton.displayName = "UnsubscribeButton";
19654
20035
 
19655
20036
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
19656
20037
  var import_react55 = require("react");
19657
- var import_jsx_runtime51 = require("react/jsx-runtime");
20038
+ var import_jsx_runtime52 = require("react/jsx-runtime");
19658
20039
  function resolveDesignProps11(props) {
19659
20040
  return {
19660
20041
  header: {
@@ -19729,9 +20110,9 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19729
20110
  if (!isCheckoutData(data) || !data.subscription || data.subscription.cancelAt) {
19730
20111
  return null;
19731
20112
  }
19732
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Element, { ref, className, children: [
19733
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
19734
- error ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
20113
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Element, { ref, className, children: [
20114
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
20115
+ error ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
19735
20116
  Flex,
19736
20117
  {
19737
20118
  as: TransitionBox,
@@ -19740,8 +20121,8 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19740
20121
  $alignItems: "center",
19741
20122
  $gap: "1rem",
19742
20123
  children: [
19743
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
19744
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
20124
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
20125
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
19745
20126
  Button,
19746
20127
  {
19747
20128
  type: "button",
@@ -19754,28 +20135,28 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19754
20135
  )
19755
20136
  ]
19756
20137
  }
19757
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
19758
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(Text, { display: props.header.fontStyle, children: [
20138
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
20139
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(Text, { display: props.header.fontStyle, children: [
19759
20140
  props.header.prefix,
19760
20141
  " ",
19761
20142
  toPrettyDate(upcomingInvoice.dueDate)
19762
20143
  ] }),
19763
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
20144
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
19764
20145
  Flex,
19765
20146
  {
19766
20147
  $justifyContent: "space-between",
19767
20148
  $alignItems: "start",
19768
20149
  $gap: "1rem",
19769
20150
  children: [
19770
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
20151
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
19771
20152
  upcomingInvoice.amountDue,
19772
20153
  upcomingInvoice.currency
19773
20154
  ) }),
19774
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill") }) })
20155
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill") }) })
19775
20156
  ]
19776
20157
  }
19777
20158
  ),
19778
- balances.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
20159
+ balances.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
19779
20160
  Flex,
19780
20161
  {
19781
20162
  as: TransitionBox,
@@ -19783,20 +20164,20 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19783
20164
  $alignItems: "start",
19784
20165
  $gap: "1rem",
19785
20166
  children: [
19786
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { $weight: 600, children: t2("Remaining balance") }),
19787
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: balances.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { children: formatCurrency(item.balance, item.currency) }, idx)) })
20167
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { $weight: 600, children: t2("Remaining balance") }),
20168
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: balances.map((item, idx) => /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { children: formatCurrency(item.balance, item.currency) }, idx)) })
19788
20169
  ]
19789
20170
  }
19790
20171
  ),
19791
- discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
20172
+ discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
19792
20173
  Flex,
19793
20174
  {
19794
20175
  $justifyContent: "space-between",
19795
20176
  $alignItems: "start",
19796
20177
  $gap: "1rem",
19797
20178
  children: [
19798
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { $weight: 600, children: t2("Discount") }),
19799
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
20179
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { $weight: 600, children: t2("Discount") }),
20180
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
19800
20181
  Flex,
19801
20182
  {
19802
20183
  $flexDirection: "column",
@@ -19806,13 +20187,13 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19806
20187
  (acc, discount) => {
19807
20188
  if (typeof discount.percentOff === "number" || typeof discount.amountOff === "number") {
19808
20189
  acc.push(
19809
- /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(
20190
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
19810
20191
  Flex,
19811
20192
  {
19812
20193
  $alignItems: "center",
19813
20194
  $gap: "0.5rem",
19814
20195
  children: [
19815
- discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
20196
+ discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
19816
20197
  Flex,
19817
20198
  {
19818
20199
  $alignItems: "center",
@@ -19821,7 +20202,7 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19821
20202
  $borderStyle: "solid",
19822
20203
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
19823
20204
  $borderRadius: "0.3125rem",
19824
- children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
20205
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
19825
20206
  Text,
19826
20207
  {
19827
20208
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -19831,7 +20212,7 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19831
20212
  )
19832
20213
  }
19833
20214
  ),
19834
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
20215
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
19835
20216
  percent: discount.percentOff
19836
20217
  }) : t2("Amount off", {
19837
20218
  amount: formatCurrency(
@@ -19855,7 +20236,7 @@ var UpcomingBill = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
19855
20236
  ]
19856
20237
  }
19857
20238
  )
19858
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
20239
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
19859
20240
  ] });
19860
20241
  });
19861
20242
  UpcomingBill.displayName = "UpcomingBill";
@@ -24115,10 +24496,10 @@ function createRenderer(options) {
24115
24496
  }
24116
24497
 
24117
24498
  // src/components/embed/Embed.tsx
24118
- var import_jsx_runtime52 = require("react/jsx-runtime");
24499
+ var import_jsx_runtime53 = require("react/jsx-runtime");
24119
24500
  var Loading = () => {
24120
24501
  const { settings } = useEmbed();
24121
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
24502
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
24122
24503
  Flex,
24123
24504
  {
24124
24505
  $width: "100%",
@@ -24126,13 +24507,13 @@ var Loading = () => {
24126
24507
  $alignItems: "center",
24127
24508
  $justifyContent: "center",
24128
24509
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
24129
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
24510
+ children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Loader, { $color: "#194BFB", $size: "2xl" })
24130
24511
  }
24131
24512
  );
24132
24513
  };
24133
24514
  var Error2 = ({ message }) => {
24134
24515
  const { settings } = useEmbed();
24135
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
24516
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
24136
24517
  Flex,
24137
24518
  {
24138
24519
  $flexDirection: "column",
@@ -24143,14 +24524,14 @@ var Error2 = ({ message }) => {
24143
24524
  $alignItems: "center",
24144
24525
  $justifyContent: "center",
24145
24526
  children: [
24146
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { display: "heading1", children: "Error" }) }),
24147
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Text, { children: message }) })
24527
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Text, { display: "heading1", children: "Error" }) }),
24528
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Text, { children: message }) })
24148
24529
  ]
24149
24530
  }
24150
24531
  );
24151
24532
  };
24152
24533
  var SchematicEmbed = ({ id, accessToken }) => {
24153
- const [children, setChildren] = (0, import_react57.useState)(/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loading, {}));
24534
+ const [children, setChildren] = (0, import_react57.useState)(/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Loading, {}));
24154
24535
  const theme = (0, import_react57.useContext)(et);
24155
24536
  const {
24156
24537
  data,
@@ -24200,13 +24581,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
24200
24581
  return stub();
24201
24582
  }
24202
24583
  if (error) {
24203
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Error2, { message: error.message });
24584
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Error2, { message: error.message });
24204
24585
  }
24205
24586
  if (accessToken?.length === 0) {
24206
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Error2, { message: "Please provide an access token." });
24587
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Error2, { message: "Please provide an access token." });
24207
24588
  }
24208
24589
  if (!accessToken?.startsWith("token_")) {
24209
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
24590
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
24210
24591
  Error2,
24211
24592
  {
24212
24593
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -24214,9 +24595,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
24214
24595
  );
24215
24596
  }
24216
24597
  if (isPending) {
24217
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Loading, {});
24598
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Loading, {});
24218
24599
  }
24219
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_jsx_runtime52.Fragment, { children });
24600
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_jsx_runtime53.Fragment, { children });
24220
24601
  };
24221
24602
  /*! Bundled license information:
24222
24603