@schematichq/schematic-components 2.25.0 → 2.25.2

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.
@@ -3491,7 +3491,7 @@ var require_debounce = __commonJS({
3491
3491
  var FUNC_ERROR_TEXT = "Expected a function";
3492
3492
  var nativeMax = Math.max;
3493
3493
  var nativeMin = Math.min;
3494
- function debounce5(func, wait, options) {
3494
+ function debounce6(func, wait, options) {
3495
3495
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
3496
3496
  if (typeof func != "function") {
3497
3497
  throw new TypeError(FUNC_ERROR_TEXT);
@@ -3572,7 +3572,7 @@ var require_debounce = __commonJS({
3572
3572
  debounced.flush = flush;
3573
3573
  return debounced;
3574
3574
  }
3575
- module2.exports = debounce5;
3575
+ module2.exports = debounce6;
3576
3576
  }
3577
3577
  });
3578
3578
 
@@ -3819,6 +3819,8 @@ var initialContext = {
3819
3819
  getUpcomingInvoice: stub,
3820
3820
  getCustomerBalance: stub,
3821
3821
  listInvoices: stub,
3822
+ getCreditUsageByUser: stub,
3823
+ getFeatureUsageByUser: stub,
3822
3824
  createSetupIntent: stub,
3823
3825
  updatePaymentMethod: stub,
3824
3826
  deletePaymentMethod: stub,
@@ -7110,6 +7112,18 @@ var en_default = {
7110
7112
  "month, billed yearly": "month, billed yearly",
7111
7113
  "month, billed quarterly": "month, billed quarterly",
7112
7114
  purchased: "purchased {{date}}",
7115
+ "Usage by user": "Usage by user",
7116
+ "X used by your team this period": "{{amount}} used by your team this period",
7117
+ "Show all X users_one": "Show all {{count}} user",
7118
+ "Show all X users_other": "Show all {{count}} users",
7119
+ "Show top X users_one": "Show top {{count}} user",
7120
+ "Show top X users_other": "Show top {{count}} users",
7121
+ "Show all": "Show all",
7122
+ "Show fewer": "Show fewer",
7123
+ Unattributed: "Unattributed",
7124
+ "There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
7125
+ "plus X more_one": "plus {{count}} more",
7126
+ "plus X more_other": "plus {{count}} more",
7113
7127
  usage: {
7114
7128
  limited: "{{amount}} of {{allocation}} used",
7115
7129
  unlimited: "{{amount}} used"
@@ -7302,7 +7316,7 @@ var Icon = ({ name, className = "", ...rest }) => {
7302
7316
  };
7303
7317
 
7304
7318
  // src/context/EmbedProvider.tsx
7305
- var import_debounce = __toESM(require_debounce());
7319
+ var import_debounce2 = __toESM(require_debounce());
7306
7320
  var import_merge3 = __toESM(require_merge());
7307
7321
  var import_react14 = require("react");
7308
7322
  var import_styled_components3 = __toESM(require_styled_components_cjs());
@@ -7615,6 +7629,22 @@ var JSONApiResponse = class {
7615
7629
  }
7616
7630
  };
7617
7631
 
7632
+ // src/api/checkoutexternal/models/BillingArrearsAnchor.ts
7633
+ function BillingArrearsAnchorFromJSON(json) {
7634
+ return BillingArrearsAnchorFromJSONTyped(json, false);
7635
+ }
7636
+ function BillingArrearsAnchorFromJSONTyped(json, ignoreDiscriminator) {
7637
+ return json;
7638
+ }
7639
+
7640
+ // src/api/checkoutexternal/models/BillingArrearsCadence.ts
7641
+ function BillingArrearsCadenceFromJSON(json) {
7642
+ return BillingArrearsCadenceFromJSONTyped(json, false);
7643
+ }
7644
+ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
7645
+ return json;
7646
+ }
7647
+
7618
7648
  // src/api/checkoutexternal/models/BillingCollectionMethod.ts
7619
7649
  function BillingCollectionMethodFromJSON(json) {
7620
7650
  return BillingCollectionMethodFromJSONTyped(json, false);
@@ -8165,6 +8195,8 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
8165
8195
  return json;
8166
8196
  }
8167
8197
  return {
8198
+ arrearsAnchor: json["arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["arrears_anchor"]),
8199
+ arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
8168
8200
  autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
8169
8201
  autoTopupAmountType: json["auto_topup_amount_type"] == null ? void 0 : json["auto_topup_amount_type"],
8170
8202
  autoTopupAvailability: BillingCreditAutoTopupAvailabilityFromJSON(
@@ -8191,10 +8223,14 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
8191
8223
  expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
8192
8224
  id: json["id"],
8193
8225
  licenseId: json["license_id"] == null ? void 0 : json["license_id"],
8226
+ overdraftLimit: json["overdraft_limit"] == null ? void 0 : json["overdraft_limit"],
8194
8227
  plan: json["plan"] == null ? void 0 : PreviewObjectResponseDataFromJSON(json["plan"]),
8195
8228
  planId: json["plan_id"],
8196
8229
  planName: json["plan_name"],
8197
8230
  planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
8231
+ postpaidEnabled: json["postpaid_enabled"],
8232
+ postpaidRatePerUnit: json["postpaid_rate_per_unit"] == null ? void 0 : json["postpaid_rate_per_unit"],
8233
+ postpaidRatePerUnitDecimal: json["postpaid_rate_per_unit_decimal"] == null ? void 0 : json["postpaid_rate_per_unit_decimal"],
8198
8234
  resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON(json["reset_cadence"]),
8199
8235
  resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON(json["reset_start"]),
8200
8236
  resetType: json["reset_type"] == null ? void 0 : BillingPlanCreditGrantResetTypeFromJSON(json["reset_type"]),
@@ -8772,6 +8808,8 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
8772
8808
  return json;
8773
8809
  }
8774
8810
  return {
8811
+ billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
8812
+ billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
8775
8813
  billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
8776
8814
  billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
8777
8815
  billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
@@ -8789,6 +8827,10 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
8789
8827
  billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
8790
8828
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
8791
8829
  billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
8830
+ billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
8831
+ billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
8832
+ billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
8833
+ billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
8792
8834
  companyAutoTopupAmount: json["company_auto_topup_amount"] == null ? void 0 : json["company_auto_topup_amount"],
8793
8835
  companyAutoTopupEnabled: json["company_auto_topup_enabled"] == null ? void 0 : json["company_auto_topup_enabled"],
8794
8836
  companyAutoTopupThresholdCredits: json["company_auto_topup_threshold_credits"] == null ? void 0 : json["company_auto_topup_threshold_credits"],
@@ -9300,6 +9342,41 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9300
9342
  };
9301
9343
  }
9302
9344
 
9345
+ // src/api/checkoutexternal/models/CompanyInvoiceResponseData.ts
9346
+ function CompanyInvoiceResponseDataFromJSON(json) {
9347
+ return CompanyInvoiceResponseDataFromJSONTyped(json, false);
9348
+ }
9349
+ function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9350
+ if (json == null) {
9351
+ return json;
9352
+ }
9353
+ return {
9354
+ amountDue: json["amount_due"],
9355
+ createdAt: new Date(json["created_at"]),
9356
+ currency: json["currency"],
9357
+ dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
9358
+ id: json["id"],
9359
+ status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
9360
+ url: json["url"] == null ? void 0 : json["url"]
9361
+ };
9362
+ }
9363
+
9364
+ // src/api/checkoutexternal/models/CompanyInvoicesResponseData.ts
9365
+ function CompanyInvoicesResponseDataFromJSON(json) {
9366
+ return CompanyInvoicesResponseDataFromJSONTyped(json, false);
9367
+ }
9368
+ function CompanyInvoicesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
9369
+ if (json == null) {
9370
+ return json;
9371
+ }
9372
+ return {
9373
+ count: json["count"],
9374
+ invoices: json["invoices"].map(
9375
+ CompanyInvoiceResponseDataFromJSON
9376
+ )
9377
+ };
9378
+ }
9379
+
9303
9380
  // src/api/checkoutexternal/models/CompanyOverrideNoteResponseData.ts
9304
9381
  function CompanyOverrideNoteResponseDataFromJSON(json) {
9305
9382
  return CompanyOverrideNoteResponseDataFromJSONTyped(json, false);
@@ -9790,6 +9867,8 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
9790
9867
  return json;
9791
9868
  }
9792
9869
  return {
9870
+ billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
9871
+ billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
9793
9872
  billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
9794
9873
  billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
9795
9874
  billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
@@ -9807,6 +9886,10 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
9807
9886
  billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
9808
9887
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
9809
9888
  billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
9889
+ billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
9890
+ billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
9891
+ billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
9892
+ billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
9810
9893
  companyCreditAmount: json["company_credit_amount"],
9811
9894
  createdAt: new Date(json["created_at"]),
9812
9895
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
@@ -10299,6 +10382,7 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
10299
10382
  return json;
10300
10383
  }
10301
10384
  return {
10385
+ arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
10302
10386
  billingCreditBundleId: json["billing_credit_bundle_id"] == null ? void 0 : json["billing_credit_bundle_id"],
10303
10387
  billingCreditId: json["billing_credit_id"],
10304
10388
  companyId: json["company_id"],
@@ -10320,6 +10404,12 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
10320
10404
  planId: json["plan_id"] == null ? void 0 : json["plan_id"],
10321
10405
  planName: json["plan_name"] == null ? void 0 : json["plan_name"],
10322
10406
  pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
10407
+ postpaidChargeAmount: json["postpaid_charge_amount"] == null ? void 0 : json["postpaid_charge_amount"],
10408
+ postpaidChargeCurrency: json["postpaid_charge_currency"] == null ? void 0 : json["postpaid_charge_currency"],
10409
+ postpaidChargedCredits: json["postpaid_charged_credits"] == null ? void 0 : json["postpaid_charged_credits"],
10410
+ postpaidPeriodEnd: json["postpaid_period_end"] == null ? void 0 : new Date(json["postpaid_period_end"]),
10411
+ postpaidRate: json["postpaid_rate"] == null ? void 0 : json["postpaid_rate"],
10412
+ postpaidRateDecimal: json["postpaid_rate_decimal"] == null ? void 0 : json["postpaid_rate_decimal"],
10323
10413
  price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
10324
10414
  quantity: json["quantity"],
10325
10415
  quantityRemaining: json["quantity_remaining"],
@@ -10643,6 +10733,35 @@ function GetCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
10643
10733
  };
10644
10734
  }
10645
10735
 
10736
+ // src/api/checkoutexternal/models/GetCompanyInvoicesParams.ts
10737
+ function GetCompanyInvoicesParamsFromJSON(json) {
10738
+ return GetCompanyInvoicesParamsFromJSONTyped(json, false);
10739
+ }
10740
+ function GetCompanyInvoicesParamsFromJSONTyped(json, ignoreDiscriminator) {
10741
+ if (json == null) {
10742
+ return json;
10743
+ }
10744
+ return {
10745
+ includePending: json["include_pending"] == null ? void 0 : json["include_pending"],
10746
+ limit: json["limit"] == null ? void 0 : json["limit"],
10747
+ offset: json["offset"] == null ? void 0 : json["offset"]
10748
+ };
10749
+ }
10750
+
10751
+ // src/api/checkoutexternal/models/GetCompanyInvoicesResponse.ts
10752
+ function GetCompanyInvoicesResponseFromJSON(json) {
10753
+ return GetCompanyInvoicesResponseFromJSONTyped(json, false);
10754
+ }
10755
+ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
10756
+ if (json == null) {
10757
+ return json;
10758
+ }
10759
+ return {
10760
+ data: CompanyInvoicesResponseDataFromJSON(json["data"]),
10761
+ params: GetCompanyInvoicesParamsFromJSON(json["params"])
10762
+ };
10763
+ }
10764
+
10646
10765
  // src/api/checkoutexternal/models/GetCreditUsageByUserParams.ts
10647
10766
  function GetCreditUsageByUserParamsFromJSON(json) {
10648
10767
  return GetCreditUsageByUserParamsFromJSONTyped(json, false);
@@ -11253,6 +11372,50 @@ var CheckoutexternalApi = class extends BaseAPI {
11253
11372
  const response = await this.getCheckoutTaxIDRaw(initOverrides);
11254
11373
  return await response.value();
11255
11374
  }
11375
+ /**
11376
+ * Get company invoices
11377
+ */
11378
+ async getCompanyInvoicesRaw(requestParameters, initOverrides) {
11379
+ const queryParameters = {};
11380
+ if (requestParameters["includePending"] != null) {
11381
+ queryParameters["include_pending"] = requestParameters["includePending"];
11382
+ }
11383
+ if (requestParameters["limit"] != null) {
11384
+ queryParameters["limit"] = requestParameters["limit"];
11385
+ }
11386
+ if (requestParameters["offset"] != null) {
11387
+ queryParameters["offset"] = requestParameters["offset"];
11388
+ }
11389
+ const headerParameters = {};
11390
+ if (this.configuration && this.configuration.apiKey) {
11391
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
11392
+ "X-Schematic-Api-Key"
11393
+ );
11394
+ }
11395
+ const response = await this.request(
11396
+ {
11397
+ path: `/company/invoices`,
11398
+ method: "GET",
11399
+ headers: headerParameters,
11400
+ query: queryParameters
11401
+ },
11402
+ initOverrides
11403
+ );
11404
+ return new JSONApiResponse(
11405
+ response,
11406
+ (jsonValue) => GetCompanyInvoicesResponseFromJSON(jsonValue)
11407
+ );
11408
+ }
11409
+ /**
11410
+ * Get company invoices
11411
+ */
11412
+ async getCompanyInvoices(requestParameters = {}, initOverrides) {
11413
+ const response = await this.getCompanyInvoicesRaw(
11414
+ requestParameters,
11415
+ initOverrides
11416
+ );
11417
+ return await response.value();
11418
+ }
11256
11419
  /**
11257
11420
  * Get credit usage by user
11258
11421
  */
@@ -12002,6 +12165,22 @@ var JSONApiResponse2 = class {
12002
12165
  }
12003
12166
  };
12004
12167
 
12168
+ // src/api/componentspublic/models/BillingArrearsAnchor.ts
12169
+ function BillingArrearsAnchorFromJSON2(json) {
12170
+ return BillingArrearsAnchorFromJSONTyped5(json, false);
12171
+ }
12172
+ function BillingArrearsAnchorFromJSONTyped5(json, ignoreDiscriminator) {
12173
+ return json;
12174
+ }
12175
+
12176
+ // src/api/componentspublic/models/BillingArrearsCadence.ts
12177
+ function BillingArrearsCadenceFromJSON2(json) {
12178
+ return BillingArrearsCadenceFromJSONTyped6(json, false);
12179
+ }
12180
+ function BillingArrearsCadenceFromJSONTyped6(json, ignoreDiscriminator) {
12181
+ return json;
12182
+ }
12183
+
12005
12184
  // src/api/componentspublic/models/BillingCreditAutoTopupAvailability.ts
12006
12185
  function BillingCreditAutoTopupAvailabilityFromJSON2(json) {
12007
12186
  return BillingCreditAutoTopupAvailabilityFromJSONTyped5(json, false);
@@ -12979,6 +13158,8 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
12979
13158
  return json;
12980
13159
  }
12981
13160
  return {
13161
+ billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON2(json["billing_credit_arrears_anchor"]),
13162
+ billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON2(json["billing_credit_arrears_cadence"]),
12982
13163
  billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
12983
13164
  billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
12984
13165
  billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON2(
@@ -12996,6 +13177,10 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
12996
13177
  billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
12997
13178
  billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
12998
13179
  billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
13180
+ billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
13181
+ billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
13182
+ billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
13183
+ billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
12999
13184
  companyCreditAmount: json["company_credit_amount"],
13000
13185
  createdAt: new Date(json["created_at"]),
13001
13186
  credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
@@ -13401,6 +13586,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
13401
13586
  }
13402
13587
  return cost;
13403
13588
  }
13589
+ function calculateQuantityCost(billingPrice, quantity) {
13590
+ if (!billingPrice) {
13591
+ return 0;
13592
+ }
13593
+ if (isTieredPrice(billingPrice)) {
13594
+ return calculateTieredCost(
13595
+ quantity,
13596
+ billingPrice.priceTier,
13597
+ billingPrice.tiersMode
13598
+ );
13599
+ }
13600
+ return quantity * billingPrice.price;
13601
+ }
13404
13602
  function getEntitlementCost(entitlement, period = "month", currency) {
13405
13603
  const resolvedPeriod = period ?? "month";
13406
13604
  const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
@@ -14187,6 +14385,18 @@ function buildCreditBundlesRequestBody(creditBundles) {
14187
14385
  []
14188
14386
  );
14189
14387
  }
14388
+ function isCreditOnlyCheckout(options) {
14389
+ const { plan, creditBundles, addOns, period, currency } = options;
14390
+ if (plan) {
14391
+ return false;
14392
+ }
14393
+ if (!creditBundles.some((bundle) => bundle.count > 0)) {
14394
+ return false;
14395
+ }
14396
+ return !addOns.some(
14397
+ (addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, currency)?.id
14398
+ );
14399
+ }
14190
14400
 
14191
14401
  // src/utils/api/entitlement.ts
14192
14402
  var PeriodName = {
@@ -14453,6 +14663,20 @@ function modifyDate(date, days) {
14453
14663
  return copy2;
14454
14664
  }
14455
14665
 
14666
+ // src/utils/debounce.ts
14667
+ var import_debounce = __toESM(require_debounce());
14668
+ function debounceByKey(fn, wait, settings) {
14669
+ const debouncedByKey = /* @__PURE__ */ new Map();
14670
+ return (key, ...args) => {
14671
+ let debounced = debouncedByKey.get(key);
14672
+ if (!debounced) {
14673
+ debounced = (0, import_debounce.default)(fn, wait, settings);
14674
+ debouncedByKey.set(key, debounced);
14675
+ }
14676
+ return debounced(key, ...args);
14677
+ };
14678
+ }
14679
+
14456
14680
  // src/utils/string.ts
14457
14681
  var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
14458
14682
  "BIF",
@@ -15457,7 +15681,7 @@ var reducer = (state, action) => {
15457
15681
  // src/context/EmbedProvider.tsx
15458
15682
  var import_jsx_runtime3 = require("react/jsx-runtime");
15459
15683
  var getCustomHeaders = (sessionId) => ({
15460
- "X-Schematic-Components-Version": "2.25.0",
15684
+ "X-Schematic-Components-Version": "2.25.2",
15461
15685
  "X-Schematic-Session-ID": sessionId
15462
15686
  });
15463
15687
  var normalizeCurrencyFilter = (filter) => {
@@ -15568,7 +15792,7 @@ var EmbedProvider = ({
15568
15792
  }
15569
15793
  }, [publicApi]);
15570
15794
  const debouncedHydratePublic = (0, import_react14.useMemo)(
15571
- () => (0, import_debounce.default)(
15795
+ () => (0, import_debounce2.default)(
15572
15796
  hydratePublic,
15573
15797
  FETCH_DEBOUNCE_TIMEOUT,
15574
15798
  LEADING_DEBOUNCE_SETTINGS
@@ -15594,7 +15818,7 @@ var EmbedProvider = ({
15594
15818
  }
15595
15819
  }, [checkoutApi]);
15596
15820
  const debouncedHydrate = (0, import_react14.useMemo)(
15597
- () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15821
+ () => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15598
15822
  [hydrate]
15599
15823
  );
15600
15824
  const hydrateComponent = (0, import_react14.useCallback)(
@@ -15621,7 +15845,7 @@ var EmbedProvider = ({
15621
15845
  [checkoutApi]
15622
15846
  );
15623
15847
  const debouncedHydrateComponent = (0, import_react14.useMemo)(
15624
- () => (0, import_debounce.default)(
15848
+ () => (0, import_debounce2.default)(
15625
15849
  hydrateComponent,
15626
15850
  FETCH_DEBOUNCE_TIMEOUT,
15627
15851
  LEADING_DEBOUNCE_SETTINGS
@@ -15645,7 +15869,7 @@ var EmbedProvider = ({
15645
15869
  }
15646
15870
  }, []);
15647
15871
  const debouncedHydrateExternal = (0, import_react14.useMemo)(
15648
- () => (0, import_debounce.default)(
15872
+ () => (0, import_debounce2.default)(
15649
15873
  hydrateExternal,
15650
15874
  FETCH_DEBOUNCE_TIMEOUT,
15651
15875
  LEADING_DEBOUNCE_SETTINGS
@@ -15656,7 +15880,7 @@ var EmbedProvider = ({
15656
15880
  return checkoutApi?.createSetupIntent();
15657
15881
  }, [checkoutApi]);
15658
15882
  const debouncedCreateSetupIntent = (0, import_react14.useMemo)(
15659
- () => (0, import_debounce.default)(
15883
+ () => (0, import_debounce2.default)(
15660
15884
  createSetupIntent,
15661
15885
  FETCH_DEBOUNCE_TIMEOUT,
15662
15886
  LEADING_DEBOUNCE_SETTINGS
@@ -15679,7 +15903,7 @@ var EmbedProvider = ({
15679
15903
  [checkoutApi]
15680
15904
  );
15681
15905
  const debouncedUpdatePaymentMethod = (0, import_react14.useMemo)(
15682
- () => (0, import_debounce.default)(
15906
+ () => (0, import_debounce2.default)(
15683
15907
  updatePaymentMethod,
15684
15908
  FETCH_DEBOUNCE_TIMEOUT,
15685
15909
  LEADING_DEBOUNCE_SETTINGS
@@ -15702,7 +15926,7 @@ var EmbedProvider = ({
15702
15926
  [checkoutApi]
15703
15927
  );
15704
15928
  const debouncedDeletePaymentMethod = (0, import_react14.useMemo)(
15705
- () => (0, import_debounce.default)(
15929
+ () => (0, import_debounce2.default)(
15706
15930
  deletePaymentMethod,
15707
15931
  FETCH_DEBOUNCE_TIMEOUT,
15708
15932
  LEADING_DEBOUNCE_SETTINGS
@@ -15725,7 +15949,7 @@ var EmbedProvider = ({
15725
15949
  [checkoutApi]
15726
15950
  );
15727
15951
  const debouncedCheckout = (0, import_react14.useMemo)(
15728
- () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15952
+ () => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15729
15953
  [checkout]
15730
15954
  );
15731
15955
  const previewCheckout = (0, import_react14.useCallback)(
@@ -15745,7 +15969,7 @@ var EmbedProvider = ({
15745
15969
  return response;
15746
15970
  }, [checkoutApi]);
15747
15971
  const debouncedUnsubscribe = (0, import_react14.useMemo)(
15748
- () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15972
+ () => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15749
15973
  [unsubscribe]
15750
15974
  );
15751
15975
  const updateCustomFieldValues = (0, import_react14.useCallback)(
@@ -15789,7 +16013,7 @@ var EmbedProvider = ({
15789
16013
  [checkoutApi]
15790
16014
  );
15791
16015
  const debouncedGetUpcomingInvoice = (0, import_react14.useMemo)(
15792
- () => (0, import_debounce.default)(
16016
+ () => (0, import_debounce2.default)(
15793
16017
  getUpcomingInvoice,
15794
16018
  FETCH_DEBOUNCE_TIMEOUT,
15795
16019
  LEADING_DEBOUNCE_SETTINGS
@@ -15800,7 +16024,7 @@ var EmbedProvider = ({
15800
16024
  return checkoutApi?.fetchCustomerBalance();
15801
16025
  }, [checkoutApi]);
15802
16026
  const debouncedGetCustomerBalance = (0, import_react14.useMemo)(
15803
- () => (0, import_debounce.default)(
16027
+ () => (0, import_debounce2.default)(
15804
16028
  getCustomerBalance,
15805
16029
  FETCH_DEBOUNCE_TIMEOUT,
15806
16030
  LEADING_DEBOUNCE_SETTINGS
@@ -15811,9 +16035,37 @@ var EmbedProvider = ({
15811
16035
  return checkoutApi?.listInvoices();
15812
16036
  }, [checkoutApi]);
15813
16037
  const debouncedListInvoices = (0, import_react14.useMemo)(
15814
- () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
16038
+ () => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15815
16039
  [listInvoices]
15816
16040
  );
16041
+ const getCreditUsageByUser = (0, import_react14.useCallback)(
16042
+ async (billingCreditId, limit) => {
16043
+ return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
16044
+ },
16045
+ [checkoutApi]
16046
+ );
16047
+ const debouncedGetCreditUsageByUser = (0, import_react14.useMemo)(
16048
+ () => debounceByKey(
16049
+ getCreditUsageByUser,
16050
+ FETCH_DEBOUNCE_TIMEOUT,
16051
+ LEADING_DEBOUNCE_SETTINGS
16052
+ ),
16053
+ [getCreditUsageByUser]
16054
+ );
16055
+ const getFeatureUsageByUser = (0, import_react14.useCallback)(
16056
+ async (featureId, limit) => {
16057
+ return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
16058
+ },
16059
+ [checkoutApi]
16060
+ );
16061
+ const debouncedGetFeatureUsageByUser = (0, import_react14.useMemo)(
16062
+ () => debounceByKey(
16063
+ getFeatureUsageByUser,
16064
+ FETCH_DEBOUNCE_TIMEOUT,
16065
+ LEADING_DEBOUNCE_SETTINGS
16066
+ ),
16067
+ [getFeatureUsageByUser]
16068
+ );
15817
16069
  const setError = (0, import_react14.useCallback)(
15818
16070
  (error) => {
15819
16071
  debug(error.message);
@@ -15979,6 +16231,8 @@ var EmbedProvider = ({
15979
16231
  getUpcomingInvoice: debouncedGetUpcomingInvoice,
15980
16232
  getCustomerBalance: debouncedGetCustomerBalance,
15981
16233
  listInvoices: debouncedListInvoices,
16234
+ getCreditUsageByUser: debouncedGetCreditUsageByUser,
16235
+ getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
15982
16236
  finishCheckout,
15983
16237
  setError,
15984
16238
  setAccessToken,
@@ -17384,7 +17638,7 @@ var Toggle = import_styled_components14.styled.input.attrs({ type: "checkbox" })
17384
17638
  `;
17385
17639
 
17386
17640
  // src/components/ui/tooltip/Tooltip.tsx
17387
- var import_debounce2 = __toESM(require_debounce());
17641
+ var import_debounce3 = __toESM(require_debounce());
17388
17642
  var import_react28 = require("react");
17389
17643
  var import_react_dom = require("react-dom");
17390
17644
 
@@ -17569,7 +17823,7 @@ var Tooltip = ({
17569
17823
  }, [portal, position]);
17570
17824
  (0, import_react28.useLayoutEffect)(() => {
17571
17825
  updateCoords();
17572
- const handleResize = (0, import_debounce2.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17826
+ const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17573
17827
  window.addEventListener("resize", handleResize);
17574
17828
  window.addEventListener("scroll", handleResize, true);
17575
17829
  return () => {
@@ -17729,7 +17983,7 @@ var Root = (0, import_react31.forwardRef)(
17729
17983
  Root.displayName = "Root";
17730
17984
 
17731
17985
  // src/components/layout/viewport/Viewport.tsx
17732
- var import_debounce4 = __toESM(require_debounce());
17986
+ var import_debounce5 = __toESM(require_debounce());
17733
17987
  var import_react49 = require("react");
17734
17988
  var import_react_dom3 = require("react-dom");
17735
17989
 
@@ -18677,11 +18931,10 @@ var Quantity = ({
18677
18931
  children: [
18678
18932
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
18679
18933
  formatCurrency(
18680
- tiered && priceTiers ? calculateTieredCost(
18681
- entitlement.quantity,
18682
- priceTiers,
18683
- tiersMode
18684
- ) : (price ?? 0) * entitlement.quantity,
18934
+ calculateQuantityCost(
18935
+ entitlementBillingPrice,
18936
+ entitlement.quantity
18937
+ ),
18685
18938
  currency
18686
18939
  ),
18687
18940
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("sub", { children: [
@@ -19560,7 +19813,7 @@ var Checkout = ({
19560
19813
  };
19561
19814
 
19562
19815
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
19563
- var import_debounce3 = __toESM(require_debounce());
19816
+ var import_debounce4 = __toESM(require_debounce());
19564
19817
  var import_react38 = require("react");
19565
19818
 
19566
19819
  // src/components/shared/checkout-dialog/Navigation.tsx
@@ -19880,48 +20133,26 @@ var CheckoutDialog = ({ top }) => {
19880
20133
  bundleCounts
19881
20134
  );
19882
20135
  }, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
19883
- const selectedPlanPriceId = (0, import_react38.useMemo)(() => {
19884
- if (!selectedPlan) {
19885
- return void 0;
19886
- }
19887
- const currencyPrice = getPlanPrice(
19888
- selectedPlan,
19889
- planPeriod,
19890
- { useSelectedPeriod: true },
19891
- hasCurrency ? effectiveCurrency : void 0
19892
- );
19893
- return currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan.yearlyPrice?.id : planPeriod === "quarter" ? selectedPlan.quarterlyPrice?.id : selectedPlan.monthlyPrice?.id);
19894
- }, [selectedPlan, planPeriod, hasCurrency, effectiveCurrency]);
19895
20136
  const [hasInitialPaymentMethod] = (0, import_react38.useState)(
19896
20137
  () => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
19897
20138
  );
19898
- const isCreditOnlyPurchase = (0, import_react38.useMemo)(() => {
19899
- if (data?.company?.billingSubscription) {
19900
- return false;
19901
- }
19902
- if (selectedPlanPriceId) {
19903
- return false;
19904
- }
19905
- if (!creditBundles.some((bundle) => bundle.count > 0)) {
19906
- return false;
19907
- }
19908
- const hasPaidAddOn = addOns.some(
19909
- (addOn) => addOn.isSelected && !!getAddOnPrice(
19910
- addOn,
19911
- planPeriod,
19912
- hasCurrency ? effectiveCurrency : void 0
19913
- )?.id
19914
- );
19915
- return !hasPaidAddOn;
19916
- }, [
19917
- data?.company?.billingSubscription,
19918
- selectedPlanPriceId,
19919
- creditBundles,
19920
- addOns,
19921
- planPeriod,
19922
- hasCurrency,
19923
- effectiveCurrency
19924
- ]);
20139
+ const isCreditOnlyPurchase = (0, import_react38.useMemo)(
20140
+ () => isCreditOnlyCheckout({
20141
+ plan: selectedPlan,
20142
+ creditBundles,
20143
+ addOns,
20144
+ period: planPeriod,
20145
+ currency: hasCurrency ? effectiveCurrency : void 0
20146
+ }),
20147
+ [
20148
+ selectedPlan,
20149
+ creditBundles,
20150
+ addOns,
20151
+ planPeriod,
20152
+ hasCurrency,
20153
+ effectiveCurrency
20154
+ ]
20155
+ );
19925
20156
  const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react38.useState)(
19926
20157
  () => applyPrefilledQuantities(
19927
20158
  (selectedPlan?.entitlements || []).reduce(
@@ -20216,9 +20447,13 @@ var CheckoutDialog = ({ top }) => {
20216
20447
  updates.creditBundles || creditBundles,
20217
20448
  plan?.id ?? data?.company?.plan?.id
20218
20449
  );
20219
- const isCreditOnly = !data?.company?.billingSubscription && !planPriceId && resolvedCreditBundles.some((bundle) => bundle.count > 0) && !(updates.addOns || addOns).some(
20220
- (addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, resolvedCurrency)?.id
20221
- );
20450
+ const isCreditOnly = isCreditOnlyCheckout({
20451
+ plan,
20452
+ creditBundles: resolvedCreditBundles,
20453
+ addOns: updates.addOns || addOns,
20454
+ period,
20455
+ currency: resolvedCurrency
20456
+ });
20222
20457
  if ((!plan || !planPriceId) && !isCreditOnly) {
20223
20458
  ++previewRequestIdRef.current;
20224
20459
  setError(void 0);
@@ -20358,7 +20593,6 @@ var CheckoutDialog = ({ top }) => {
20358
20593
  addOnCompatibilityLookup,
20359
20594
  data?.company?.plan?.id,
20360
20595
  data?.company?.plan?.includedCreditGrants,
20361
- data?.company?.billingSubscription,
20362
20596
  previewCheckout,
20363
20597
  planPeriod,
20364
20598
  selectedPlan,
@@ -20381,7 +20615,7 @@ var CheckoutDialog = ({ top }) => {
20381
20615
  }, [handlePreviewCheckout]);
20382
20616
  const debouncedPreviewCheckoutRef = (0, import_react38.useRef)(null);
20383
20617
  (0, import_react38.useEffect)(() => {
20384
- const debounced = (0, import_debounce3.default)(
20618
+ const debounced = (0, import_debounce4.default)(
20385
20619
  (updates) => handlePreviewCheckoutRef.current(updates),
20386
20620
  FETCH_DEBOUNCE_TIMEOUT,
20387
20621
  TRAILING_DEBOUNCE_SETTINGS
@@ -22492,6 +22726,29 @@ var EntitlementRow = (props) => {
22492
22726
  tiersMode
22493
22727
  } = entitlementPrice || {};
22494
22728
  const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
22729
+ const tierLabel = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
22730
+ Text,
22731
+ {
22732
+ style: { opacity: 0.54 },
22733
+ $size: 0.875 * settings.theme.typography.text.fontSize,
22734
+ $color: settings.theme.typography.text.color,
22735
+ children: [
22736
+ t3("Tier-based"),
22737
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
22738
+ PricingTiersTooltip,
22739
+ {
22740
+ portal,
22741
+ feature,
22742
+ period: planPeriod,
22743
+ currency,
22744
+ priceTiers,
22745
+ tiersMode: tiersMode ?? void 0,
22746
+ position: "left"
22747
+ }
22748
+ )
22749
+ ]
22750
+ }
22751
+ );
22495
22752
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22496
22753
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22497
22754
  quantity,
@@ -22502,13 +22759,24 @@ var EntitlementRow = (props) => {
22502
22759
  " ",
22503
22760
  getFeatureName(feature, softLimit)
22504
22761
  ] }) : feature.name }) }),
22505
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22506
- formatCurrency((price ?? 0) * quantity, currency),
22507
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
22508
- "/",
22509
- shortenPeriod(planPeriod)
22762
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
22763
+ // A tiered scheme still resolves to a fixed amount at the chosen
22764
+ // quantity, so the row shows it alongside the tier breakdown
22765
+ // rather than leaving the charge unpriced.
22766
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
22767
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22768
+ formatCurrency(
22769
+ calculateQuantityCost(entitlementPrice, quantity),
22770
+ currency
22771
+ ),
22772
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
22773
+ "/",
22774
+ shortenPeriod(planPeriod)
22775
+ ] })
22776
+ ] }),
22777
+ tiered && tierLabel
22510
22778
  ] })
22511
- ] }) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22779
+ ) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22512
22780
  priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22513
22781
  t3("then"),
22514
22782
  " "
@@ -22526,29 +22794,7 @@ var EntitlementRow = (props) => {
22526
22794
  shortenPeriod(planPeriod)
22527
22795
  ] })
22528
22796
  ] })
22529
- ] }) : (priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
22530
- Text,
22531
- {
22532
- style: { opacity: 0.54 },
22533
- $size: 0.875 * settings.theme.typography.text.fontSize,
22534
- $color: settings.theme.typography.text.color,
22535
- children: [
22536
- t3("Tier-based"),
22537
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
22538
- PricingTiersTooltip,
22539
- {
22540
- portal,
22541
- feature,
22542
- period: planPeriod,
22543
- currency,
22544
- priceTiers,
22545
- tiersMode: tiersMode ?? void 0,
22546
- position: "left"
22547
- }
22548
- )
22549
- ]
22550
- }
22551
- ) })
22797
+ ] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
22552
22798
  ] });
22553
22799
  }
22554
22800
  };
@@ -22744,12 +22990,18 @@ var SubscriptionSidebar = (0, import_react46.forwardRef)(
22744
22990
  }, 0);
22745
22991
  total += addOnCost;
22746
22992
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
22747
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
22993
+ (sum, entitlement) => sum + calculateQuantityCost(
22994
+ getEntitlementPrice(entitlement, planPeriod, currency),
22995
+ entitlement.quantity
22996
+ ),
22748
22997
  0
22749
22998
  );
22750
22999
  total += payInAdvanceCost;
22751
23000
  const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
22752
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
23001
+ (sum, entitlement) => sum + calculateQuantityCost(
23002
+ getEntitlementPrice(entitlement, planPeriod, currency),
23003
+ entitlement.quantity
23004
+ ),
22753
23005
  0
22754
23006
  );
22755
23007
  total += addOnPayInAdvanceCost;
@@ -24213,7 +24465,7 @@ var Viewport = (0, import_react49.forwardRef)(
24213
24465
  const [top, setTop] = (0, import_react49.useState)(0);
24214
24466
  (0, import_react49.useLayoutEffect)(() => {
24215
24467
  const element = portalRef.current;
24216
- const setModalY = (0, import_debounce4.default)(() => {
24468
+ const setModalY = (0, import_debounce5.default)(() => {
24217
24469
  const value = Math.abs(
24218
24470
  (element === document.body ? window.scrollY : element.scrollTop) ?? 0
24219
24471
  );
@@ -24927,7 +25179,7 @@ var Invoices = (0, import_react53.forwardRef)(({ className, ...rest }, ref) => {
24927
25179
  Invoices.displayName = "Invoices";
24928
25180
 
24929
25181
  // src/components/elements/metered-features/MeteredFeatures.tsx
24930
- var import_react54 = require("react");
25182
+ var import_react55 = require("react");
24931
25183
 
24932
25184
  // src/components/elements/metered-features/Meter.tsx
24933
25185
  var import_jsx_runtime54 = require("react/jsx-runtime");
@@ -25055,6 +25307,190 @@ var PriceDetails = ({
25055
25307
  );
25056
25308
  };
25057
25309
 
25310
+ // src/components/elements/metered-features/UsageByUser.tsx
25311
+ var import_react54 = require("react");
25312
+ var import_jsx_runtime56 = require("react/jsx-runtime");
25313
+ var COLLAPSED_COUNT = 3;
25314
+ var EXPANDED_COUNT = 20;
25315
+ var toCreditSection = (data) => ({
25316
+ entries: data.entries.map((entry) => ({
25317
+ id: entry.userId,
25318
+ // An entry with no hydrated user record still has an id worth showing —
25319
+ // a blank row identifies nobody.
25320
+ label: entry.user?.name || entry.userId || "",
25321
+ amount: entry.creditsUsed
25322
+ })),
25323
+ total: data.total,
25324
+ totalUsers: data.totalUsers,
25325
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
25326
+ });
25327
+ var toFeatureSection = (data) => ({
25328
+ entries: data.rows.map((row) => ({
25329
+ id: row.userId,
25330
+ label: row.user?.name || row.userId || "",
25331
+ amount: row.value
25332
+ })),
25333
+ total: data.total,
25334
+ totalUsers: data.totalUsers,
25335
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
25336
+ });
25337
+ var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
25338
+ var InitialAvatar = ({ label }) => {
25339
+ const { settings } = useEmbed();
25340
+ const isLightBackground = useIsLightBackground();
25341
+ const initial = (label.trim()[0] ?? "?").toUpperCase();
25342
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25343
+ Flex,
25344
+ {
25345
+ $alignItems: "center",
25346
+ $justifyContent: "center",
25347
+ $width: "1.75rem",
25348
+ $height: "1.75rem",
25349
+ $flexShrink: 0,
25350
+ $borderRadius: "9999px",
25351
+ $background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
25352
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25353
+ Text,
25354
+ {
25355
+ $size: 11,
25356
+ $weight: 500,
25357
+ $color: settings.theme.typography.text.color,
25358
+ children: initial
25359
+ }
25360
+ )
25361
+ }
25362
+ );
25363
+ };
25364
+ var UsageByUser = ({ source, unit }) => {
25365
+ const { t: t3 } = useTranslation();
25366
+ const isLightBackground = useIsLightBackground();
25367
+ const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
25368
+ const [expanded, setExpanded] = (0, import_react54.useState)(false);
25369
+ const [result, setResult] = (0, import_react54.useState)();
25370
+ const [attempt, setAttempt] = (0, import_react54.useState)(0);
25371
+ const { kind, id } = source;
25372
+ const sourceKey = `${kind}:${id}`;
25373
+ const current = result?.sourceKey === sourceKey ? result : void 0;
25374
+ (0, import_react54.useEffect)(() => {
25375
+ let active = true;
25376
+ const apply = (next) => {
25377
+ if (active) {
25378
+ setResult(next);
25379
+ }
25380
+ };
25381
+ const receive = (section) => {
25382
+ if (section) {
25383
+ apply({ sourceKey, section });
25384
+ }
25385
+ };
25386
+ const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
25387
+ if (kind === "credit") {
25388
+ getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
25389
+ (response) => receive(response && toCreditSection(response.data))
25390
+ ).catch(fail);
25391
+ } else {
25392
+ getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
25393
+ (response) => receive(response && toFeatureSection(response.data))
25394
+ ).catch(fail);
25395
+ }
25396
+ return () => {
25397
+ active = false;
25398
+ };
25399
+ }, [
25400
+ attempt,
25401
+ getCreditUsageByUser,
25402
+ getFeatureUsageByUser,
25403
+ id,
25404
+ kind,
25405
+ sourceKey
25406
+ ]);
25407
+ const entries = current?.section?.entries;
25408
+ const attributed = (0, import_react54.useMemo)(
25409
+ () => [...entries ?? []].sort((a, b) => b.amount - a.amount),
25410
+ [entries]
25411
+ );
25412
+ const error = current?.error;
25413
+ const total = current?.section?.total ?? 0;
25414
+ const totalUsers = current?.section?.totalUsers ?? 0;
25415
+ const unattributed = current?.section?.unattributed;
25416
+ const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
25417
+ if (error) {
25418
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
25419
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t3("Usage by user") }),
25420
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t3("There was a problem retrieving usage by user.") }),
25421
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25422
+ Button,
25423
+ {
25424
+ type: "button",
25425
+ onClick: () => setAttempt((prev) => prev + 1),
25426
+ $size: "sm",
25427
+ $variant: "ghost",
25428
+ $fullWidth: false,
25429
+ children: t3("Try again")
25430
+ }
25431
+ )
25432
+ ] });
25433
+ }
25434
+ if (attributed.length === 0 && !unattributed) {
25435
+ return null;
25436
+ }
25437
+ const visible = attributed.slice(
25438
+ 0,
25439
+ expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
25440
+ );
25441
+ const remaining = Math.max(totalUsers - visible.length, 0);
25442
+ const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
25443
+ const hiddenUsers = Math.max(
25444
+ expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
25445
+ 0
25446
+ );
25447
+ const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
25448
+ const expandLabel = totalUsers > EXPANDED_COUNT ? t3("Show top X users", { count: EXPANDED_COUNT }) : hiddenUsers > 0 ? t3("Show all X users", { count: totalUsers }) : t3("Show all");
25449
+ const row = (key, label, amount, muted) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
25450
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(InitialAvatar, { label: muted ? "?" : label }),
25451
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25452
+ Text,
25453
+ {
25454
+ display: "text",
25455
+ $color: muted ? mutedColor(isLightBackground) : void 0,
25456
+ children: label
25457
+ }
25458
+ ) }),
25459
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25460
+ Text,
25461
+ {
25462
+ display: "text",
25463
+ $align: "right",
25464
+ $color: mutedColor(isLightBackground),
25465
+ children: formatAmount(amount)
25466
+ }
25467
+ )
25468
+ ] }, key);
25469
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
25470
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t3("Usage by user") }),
25471
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t3("X used by your team this period", {
25472
+ amount: formatAmount(total)
25473
+ }) }) }),
25474
+ visible.map(
25475
+ (entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
25476
+ ),
25477
+ expanded && unattributed && row("unattributed", t3("Unattributed"), unattributed.amount, true),
25478
+ expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t3("plus X more", { count: remaining }) }) }),
25479
+ shouldShowToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25480
+ ExpandListToggle,
25481
+ {
25482
+ isExpanded: expanded,
25483
+ onToggle: () => setExpanded((prev) => !prev),
25484
+ expandLabel,
25485
+ collapseLabel: t3("Show fewer"),
25486
+ iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
25487
+ $marginTop: "0.25rem"
25488
+ }
25489
+ )
25490
+ ] });
25491
+ };
25492
+ UsageByUser.displayName = "UsageByUser";
25493
+
25058
25494
  // src/components/elements/metered-features/styles.ts
25059
25495
  var import_styled_components22 = __toESM(require_styled_components_cjs());
25060
25496
  var Container2 = import_styled_components22.styled.div`
@@ -25074,7 +25510,7 @@ var Container2 = import_styled_components22.styled.div`
25074
25510
  `;
25075
25511
 
25076
25512
  // src/components/elements/metered-features/MeteredFeatures.tsx
25077
- var import_jsx_runtime56 = require("react/jsx-runtime");
25513
+ var import_jsx_runtime57 = require("react/jsx-runtime");
25078
25514
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25079
25515
  const { t: t3 } = useTranslation();
25080
25516
  const { data } = useEmbed();
@@ -25111,9 +25547,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
25111
25547
  })
25112
25548
  );
25113
25549
  }
25114
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Text, { display: fontStyle, children: [
25550
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { display: fontStyle, children: [
25115
25551
  acc.join(" \u2022 "),
25116
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25552
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25117
25553
  HardLimitTooltip,
25118
25554
  {
25119
25555
  feature: entitlement.feature,
@@ -25143,19 +25579,22 @@ function resolveDesignProps4(props) {
25143
25579
  isVisible: props.usage?.isVisible ?? true,
25144
25580
  fontStyle: props.usage?.fontStyle ?? "heading5"
25145
25581
  },
25582
+ usageByUser: {
25583
+ isVisible: props.usageByUser?.isVisible ?? true
25584
+ },
25146
25585
  // there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
25147
25586
  visibleFeatures: props.visibleFeatures
25148
25587
  };
25149
25588
  }
25150
- var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
25589
+ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, ref) => {
25151
25590
  const props = resolveDesignProps4(rest);
25152
- const elementsRef = (0, import_react54.useRef)([]);
25591
+ const elementsRef = (0, import_react55.useRef)([]);
25153
25592
  const shouldWrapChildren = useWrapChildren(elementsRef);
25154
25593
  const { t: t3 } = useTranslation();
25155
25594
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
25156
25595
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
25157
25596
  const isLightBackground = useIsLightBackground();
25158
- const meteredFeatures = (0, import_react54.useMemo)(() => {
25597
+ const meteredFeatures = (0, import_react55.useMemo)(() => {
25159
25598
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
25160
25599
  (acc, id) => {
25161
25600
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -25172,7 +25611,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25172
25611
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
25173
25612
  );
25174
25613
  }, [props.visibleFeatures, data?.featureUsage?.features]);
25175
- const creditGroups = (0, import_react54.useMemo)(
25614
+ const creditGroups = (0, import_react55.useMemo)(
25176
25615
  () => withEmptyPlanCreditBalances(
25177
25616
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
25178
25617
  listPlanCredits(
@@ -25183,11 +25622,11 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25183
25622
  ),
25184
25623
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
25185
25624
  );
25186
- const planCreditCompositions = (0, import_react54.useMemo)(
25625
+ const planCreditCompositions = (0, import_react55.useMemo)(
25187
25626
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
25188
25627
  [data?.company?.plan?.includedCreditGrants]
25189
25628
  );
25190
- const resolveLicenseQuantity = (0, import_react54.useCallback)(
25629
+ const resolveLicenseQuantity = (0, import_react55.useCallback)(
25191
25630
  (licenseId) => {
25192
25631
  const allocation = findLicenseSource(
25193
25632
  data?.featureUsage?.features ?? [],
@@ -25197,17 +25636,17 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25197
25636
  },
25198
25637
  [data?.featureUsage?.features]
25199
25638
  );
25200
- const purchasableCreditIds = (0, import_react54.useMemo)(
25639
+ const purchasableCreditIds = (0, import_react55.useMemo)(
25201
25640
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
25202
25641
  [data?.creditBundles, data?.company?.plan?.id]
25203
25642
  );
25204
- const [expandedCreditIds, setExpandedCreditIds] = (0, import_react54.useState)(
25643
+ const [expandedCreditIds, setExpandedCreditIds] = (0, import_react55.useState)(
25205
25644
  () => /* @__PURE__ */ new Set()
25206
25645
  );
25207
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react54.useState)(
25646
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react55.useState)(
25208
25647
  () => /* @__PURE__ */ new Set()
25209
25648
  );
25210
- const toggleFullLedger = (0, import_react54.useCallback)((id) => {
25649
+ const toggleFullLedger = (0, import_react55.useCallback)((id) => {
25211
25650
  setFullLedgerCreditIds((prev) => {
25212
25651
  const next = new Set(prev);
25213
25652
  if (next.has(id)) {
@@ -25218,7 +25657,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25218
25657
  return next;
25219
25658
  });
25220
25659
  }, []);
25221
- const toggleBalanceDetails = (0, import_react54.useCallback)((id) => {
25660
+ const toggleBalanceDetails = (0, import_react55.useCallback)((id) => {
25222
25661
  setExpandedCreditIds((prev) => {
25223
25662
  const next = new Set(prev);
25224
25663
  if (next.has(id)) {
@@ -25244,7 +25683,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25244
25683
  const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
25245
25684
  const canCheckout = data?.capabilities?.checkout ?? false;
25246
25685
  const showCredits = data?.displaySettings?.showCredits ?? true;
25247
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Container2, { ref, className, children: [
25686
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Container2, { ref, className, children: [
25248
25687
  meteredFeatures.reduce((acc, entitlement, index) => {
25249
25688
  if (!entitlement.feature) {
25250
25689
  return acc;
@@ -25255,9 +25694,9 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25255
25694
  });
25256
25695
  const { limit } = usageDetails;
25257
25696
  acc.push(
25258
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
25259
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1.5rem", children: [
25260
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25697
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
25698
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
25699
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25261
25700
  Icon3,
25262
25701
  {
25263
25702
  name: feature.icon,
@@ -25266,8 +25705,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25266
25705
  rounded: true
25267
25706
  }
25268
25707
  ),
25269
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25270
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25708
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25709
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25271
25710
  Flex,
25272
25711
  {
25273
25712
  ref: (el) => {
@@ -25278,31 +25717,31 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25278
25717
  $flexWrap: "wrap",
25279
25718
  $gap: "1rem",
25280
25719
  children: [
25281
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25282
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
25283
- props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
25720
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25721
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
25722
+ props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
25284
25723
  ] }),
25285
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25724
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25286
25725
  Box,
25287
25726
  {
25288
25727
  $flexBasis: "min-content",
25289
25728
  $flexGrow: 1,
25290
25729
  $textAlign: shouldWrapChildren ? "left" : "right",
25291
25730
  children: [
25292
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25293
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25731
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25732
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25294
25733
  formatNumber(limit),
25295
25734
  " "
25296
25735
  ] }),
25297
25736
  getFeatureName(feature, limit)
25298
- ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25737
+ ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25299
25738
  formatNumber(usage),
25300
25739
  " ",
25301
25740
  getFeatureName(feature, usage),
25302
25741
  " ",
25303
25742
  t3("used")
25304
25743
  ] }) }) }),
25305
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25744
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25306
25745
  Limit,
25307
25746
  {
25308
25747
  entitlement,
@@ -25316,8 +25755,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25316
25755
  ]
25317
25756
  }
25318
25757
  ),
25319
- props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Meter, { entitlement }),
25320
- canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25758
+ props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Meter, { entitlement }),
25759
+ canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25321
25760
  Button,
25322
25761
  {
25323
25762
  type: "button",
@@ -25330,13 +25769,24 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25330
25769
  )
25331
25770
  ] })
25332
25771
  ] }),
25333
- (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25772
+ (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25334
25773
  PriceDetails,
25335
25774
  {
25336
25775
  entitlement,
25337
25776
  usageDetails,
25338
25777
  period
25339
25778
  }
25779
+ ),
25780
+ props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
25781
+ // they are denominated in the feature's own unit — the same one
25782
+ // the usage line above uses. A credit-burndown feature's credit
25783
+ // spend is broken down separately, under its credit.
25784
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25785
+ UsageByUser,
25786
+ {
25787
+ source: { kind: "feature", id: feature.id },
25788
+ unit: feature
25789
+ }
25340
25790
  )
25341
25791
  ] }, index)
25342
25792
  );
@@ -25350,9 +25800,9 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25350
25800
  const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
25351
25801
  const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
25352
25802
  const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
25353
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25354
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1.5rem", children: [
25355
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25803
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25804
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
25805
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25356
25806
  Icon3,
25357
25807
  {
25358
25808
  name: credit.icon,
@@ -25361,13 +25811,13 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25361
25811
  rounded: true
25362
25812
  }
25363
25813
  ),
25364
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25365
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25366
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
25367
- props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
25814
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25815
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25816
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
25817
+ props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
25368
25818
  ] }) }),
25369
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
25370
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.usage.fontStyle, children: t3("X units remaining", {
25819
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
25820
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: t3("X units remaining", {
25371
25821
  // Balances burn at rates with up to 10 decimal
25372
25822
  // places, so a small remainder must not round to 0.
25373
25823
  amount: formatNumber(credit.total.remaining, {
@@ -25378,7 +25828,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25378
25828
  credit.total.remaining
25379
25829
  )
25380
25830
  }) }) }),
25381
- canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25831
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25382
25832
  Button,
25383
25833
  {
25384
25834
  type: "button",
@@ -25431,7 +25881,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25431
25881
  const renewalDate = data?.upcomingInvoice?.dueDate;
25432
25882
  return (
25433
25883
  // Pulled up against the balance line despite the column's 2rem gap
25434
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25884
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25435
25885
  Text,
25436
25886
  {
25437
25887
  style: { opacity: 0.54 },
@@ -25444,7 +25894,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25444
25894
  period: shortenPeriod(composition.period),
25445
25895
  composition: ` \u2014 ${parts.join(" + ")}`
25446
25896
  }),
25447
- renewalDate && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25897
+ renewalDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25448
25898
  " ",
25449
25899
  t3("Renews on the day", {
25450
25900
  day: formatOrdinal(renewalDate.getDate())
@@ -25457,12 +25907,12 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25457
25907
  })()
25458
25908
  ] })
25459
25909
  ] }),
25460
- hasGrants && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25910
+ hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25461
25911
  Box,
25462
25912
  {
25463
25913
  $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
25464
25914
  $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
25465
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25915
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25466
25916
  TransitionBox,
25467
25917
  {
25468
25918
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
@@ -25470,22 +25920,22 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25470
25920
  children: [
25471
25921
  visibleGrants.map((grant, index2) => {
25472
25922
  const padding = getRowPadding(index2);
25473
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25474
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t3("X items included in plan", {
25923
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25924
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("X items included in plan", {
25475
25925
  amount: grant.quantity,
25476
25926
  item: getFeatureName(
25477
25927
  credit,
25478
25928
  grant.quantity
25479
25929
  )
25480
25930
  }) }) }),
25481
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25931
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25482
25932
  Box,
25483
25933
  {
25484
25934
  $display: "table-cell",
25485
25935
  $padding: padding,
25486
25936
  $textAlign: "right",
25487
25937
  $whiteSpace: "nowrap",
25488
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t3("Resets", {
25938
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("Resets", {
25489
25939
  date: toPrettyDate(
25490
25940
  modifyDate(grant.expiresAt, 1),
25491
25941
  { month: "short" }
@@ -25493,15 +25943,15 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25493
25943
  }) })
25494
25944
  }
25495
25945
  )
25496
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25497
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t3("X item bundle", {
25946
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25947
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item bundle", {
25498
25948
  amount: grant.quantity,
25499
25949
  item: getFeatureName(credit, 1),
25500
25950
  createdAt: toPrettyDate(
25501
25951
  grant.createdAt,
25502
25952
  { month: "short" }
25503
25953
  )
25504
- }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t3("X item auto-topup", {
25954
+ }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item auto-topup", {
25505
25955
  amount: grant.quantity,
25506
25956
  item: getFeatureName(
25507
25957
  credit,
@@ -25511,7 +25961,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25511
25961
  grant.createdAt,
25512
25962
  { month: "short" }
25513
25963
  )
25514
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t3("X item grant", {
25964
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item grant", {
25515
25965
  amount: grant.quantity,
25516
25966
  item: getFeatureName(
25517
25967
  credit,
@@ -25522,14 +25972,14 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25522
25972
  { month: "short" }
25523
25973
  )
25524
25974
  }) }) }) }),
25525
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25975
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25526
25976
  Box,
25527
25977
  {
25528
25978
  $display: "table-cell",
25529
25979
  $padding: padding,
25530
25980
  $textAlign: "right",
25531
25981
  $whiteSpace: "nowrap",
25532
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t3("Expires", {
25982
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("Expires", {
25533
25983
  date: toPrettyDate(
25534
25984
  modifyDate(grant.expiresAt, 1),
25535
25985
  { month: "short" }
@@ -25539,8 +25989,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25539
25989
  )
25540
25990
  ] }) }, grant.id);
25541
25991
  }),
25542
- canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Box, { $display: "table-row", children: [
25543
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25992
+ canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $display: "table-row", children: [
25993
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25544
25994
  ExpandListToggle,
25545
25995
  {
25546
25996
  isExpanded: showAllGrants,
@@ -25549,7 +25999,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25549
25999
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25550
26000
  }
25551
26001
  ) }),
25552
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
26002
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25553
26003
  Box,
25554
26004
  {
25555
26005
  $display: "table-cell",
@@ -25562,7 +26012,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25562
26012
  )
25563
26013
  }
25564
26014
  ),
25565
- hasGrants && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
26015
+ hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25566
26016
  ExpandListToggle,
25567
26017
  {
25568
26018
  isExpanded,
@@ -25571,6 +26021,13 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25571
26021
  collapseLabel: t3("Hide balance details"),
25572
26022
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25573
26023
  }
26024
+ ),
26025
+ props.usageByUser.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26026
+ UsageByUser,
26027
+ {
26028
+ source: { kind: "credit", id: credit.id },
26029
+ unit: credit
26030
+ }
25574
26031
  )
25575
26032
  ] }, index);
25576
26033
  })
@@ -25579,11 +26036,11 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
25579
26036
  MeteredFeatures.displayName = "MeteredFeatures";
25580
26037
 
25581
26038
  // src/components/elements/payment-method/PaymentMethod.tsx
25582
- var import_react56 = require("react");
26039
+ var import_react57 = require("react");
25583
26040
 
25584
26041
  // src/components/elements/payment-method/PaymentMethodElement.tsx
25585
- var import_react55 = require("react");
25586
- var import_jsx_runtime57 = require("react/jsx-runtime");
26042
+ var import_react56 = require("react");
26043
+ var import_jsx_runtime58 = require("react/jsx-runtime");
25587
26044
  var PaymentElement2 = ({
25588
26045
  iconName,
25589
26046
  iconTitle,
@@ -25591,8 +26048,8 @@ var PaymentElement2 = ({
25591
26048
  paymentLast4
25592
26049
  }) => {
25593
26050
  const { settings } = useEmbed();
25594
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
25595
- iconName && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26051
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
26052
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25596
26053
  Icon3,
25597
26054
  {
25598
26055
  name: iconName,
@@ -25600,15 +26057,15 @@ var PaymentElement2 = ({
25600
26057
  color: settings.theme.typography.text.color
25601
26058
  }
25602
26059
  ),
25603
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $flexGrow: 1, children: [
25604
- label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: label }),
26060
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
26061
+ label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
25605
26062
  " ",
25606
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: paymentLast4 })
26063
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
25607
26064
  ] })
25608
26065
  ] });
25609
26066
  };
25610
26067
  var EmptyPaymentElement = () => {
25611
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
26068
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
25612
26069
  };
25613
26070
  var getPaymentMethodData = ({
25614
26071
  accountLast4,
@@ -25688,12 +26145,12 @@ var PaymentMethodElement = ({
25688
26145
  const isLightBackground = useIsLightBackground();
25689
26146
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
25690
26147
  const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
25691
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
25692
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
25693
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: t3("Payment Details") }),
25694
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t3("Expires in X months", { months: monthsToExpiration }) : t3("Expired") })
26148
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
26149
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
26150
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { display: props.header.fontStyle, children: t3("Payment Details") }),
26151
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t3("Expires in X months", { months: monthsToExpiration }) : t3("Expired") })
25695
26152
  ] }),
25696
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
26153
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
25697
26154
  Flex,
25698
26155
  {
25699
26156
  $justifyContent: "space-between",
@@ -25702,8 +26159,8 @@ var PaymentMethodElement = ({
25702
26159
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
25703
26160
  $borderRadius: "9999px",
25704
26161
  children: [
25705
- paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(EmptyPaymentElement, {}),
25706
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26162
+ paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EmptyPaymentElement, {}),
26163
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25707
26164
  Text,
25708
26165
  {
25709
26166
  onClick: onRemove,
@@ -25713,7 +26170,7 @@ var PaymentMethodElement = ({
25713
26170
  children: t3("Remove")
25714
26171
  }
25715
26172
  ),
25716
- props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26173
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25717
26174
  Text,
25718
26175
  {
25719
26176
  onClick: onEdit,
@@ -25726,8 +26183,8 @@ var PaymentMethodElement = ({
25726
26183
  ]
25727
26184
  }
25728
26185
  ),
25729
- hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
25730
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26186
+ hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
26187
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25731
26188
  Text,
25732
26189
  {
25733
26190
  $size: 12,
@@ -25735,7 +26192,7 @@ var PaymentMethodElement = ({
25735
26192
  children: field.name
25736
26193
  }
25737
26194
  ),
25738
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26195
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25739
26196
  "span",
25740
26197
  {
25741
26198
  style: {
@@ -25756,7 +26213,7 @@ var PaymentListElement = ({
25756
26213
  const { settings } = useEmbed();
25757
26214
  const isLightBackground = useIsLightBackground();
25758
26215
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
25759
- const expirationDate = (0, import_react55.useMemo)(() => {
26216
+ const expirationDate = (0, import_react56.useMemo)(() => {
25760
26217
  const { cardExpMonth, cardExpYear } = paymentMethod;
25761
26218
  if (!cardExpMonth || !cardExpYear) {
25762
26219
  return;
@@ -25767,7 +26224,7 @@ var PaymentListElement = ({
25767
26224
  }
25768
26225
  return `${cardExpMonth}/${formatedYear}`;
25769
26226
  }, [paymentMethod]);
25770
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
26227
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
25771
26228
  Flex,
25772
26229
  {
25773
26230
  $flexDirection: "row",
@@ -25779,7 +26236,7 @@ var PaymentListElement = ({
25779
26236
  $borderStyle: "solid",
25780
26237
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
25781
26238
  children: [
25782
- iconName && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26239
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25783
26240
  Icon3,
25784
26241
  {
25785
26242
  name: iconName,
@@ -25787,20 +26244,20 @@ var PaymentListElement = ({
25787
26244
  color: settings.theme.typography.text.color
25788
26245
  }
25789
26246
  ),
25790
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $flexGrow: 1, children: [
25791
- label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: label }),
26247
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
26248
+ label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
25792
26249
  " ",
25793
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: paymentLast4 })
26250
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
25794
26251
  ] }),
25795
- expirationDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26252
+ expirationDate && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25796
26253
  Box,
25797
26254
  {
25798
26255
  $flexGrow: 1,
25799
26256
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
25800
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
26257
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
25801
26258
  }
25802
26259
  ),
25803
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26260
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25804
26261
  Text,
25805
26262
  {
25806
26263
  onClick: () => {
@@ -25813,7 +26270,7 @@ var PaymentListElement = ({
25813
26270
  children: t("Set default")
25814
26271
  }
25815
26272
  ) }),
25816
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
26273
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25817
26274
  Icon3,
25818
26275
  {
25819
26276
  tabIndex: 0,
@@ -25835,7 +26292,7 @@ var PaymentListElement = ({
25835
26292
  };
25836
26293
 
25837
26294
  // src/components/elements/payment-method/PaymentMethod.tsx
25838
- var import_jsx_runtime58 = require("react/jsx-runtime");
26295
+ var import_jsx_runtime59 = require("react/jsx-runtime");
25839
26296
  var resolveDesignProps5 = (props) => {
25840
26297
  return {
25841
26298
  header: {
@@ -25848,10 +26305,10 @@ var resolveDesignProps5 = (props) => {
25848
26305
  }
25849
26306
  };
25850
26307
  };
25851
- var PaymentMethod = (0, import_react56.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
26308
+ var PaymentMethod = (0, import_react57.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
25852
26309
  const props = resolveDesignProps5(rest);
25853
26310
  const { data, setLayout } = useEmbed();
25854
- const { paymentMethod, monthsToExpiration } = (0, import_react56.useMemo)(() => {
26311
+ const { paymentMethod, monthsToExpiration } = (0, import_react57.useMemo)(() => {
25855
26312
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
25856
26313
  let monthsToExpiration2;
25857
26314
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -25870,7 +26327,7 @@ var PaymentMethod = (0, import_react56.forwardRef)(({ children, className, porta
25870
26327
  monthsToExpiration: monthsToExpiration2
25871
26328
  };
25872
26329
  }, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
25873
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
26330
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
25874
26331
  PaymentMethodElement,
25875
26332
  {
25876
26333
  customCheckoutFields: data?.customCheckoutFields,
@@ -25886,7 +26343,7 @@ PaymentMethod.displayName = "PaymentMethod";
25886
26343
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
25887
26344
  var import_react_stripe_js2 = require("@stripe/react-stripe-js");
25888
26345
 
25889
- // node_modules/.pnpm/@stripe+stripe-js@9.14.0/node_modules/@stripe/stripe-js/dist/index.mjs
26346
+ // node_modules/.pnpm/@stripe+stripe-js@9.15.0/node_modules/@stripe/stripe-js/dist/index.mjs
25890
26347
  function _typeof(obj) {
25891
26348
  "@babel/helpers - typeof";
25892
26349
  if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
@@ -25940,7 +26397,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
25940
26397
  }
25941
26398
  stripe._registerWrapper({
25942
26399
  name: "stripe-js",
25943
- version: "9.14.0",
26400
+ version: "9.15.0",
25944
26401
  startTime
25945
26402
  });
25946
26403
  };
@@ -26018,7 +26475,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
26018
26475
  var version = runtimeVersionToUrlVersion(maybeStripe.version);
26019
26476
  var expectedVersion = RELEASE_TRAIN;
26020
26477
  if (isTestKey && version !== expectedVersion) {
26021
- console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.14.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
26478
+ console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.15.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
26022
26479
  }
26023
26480
  var stripe = maybeStripe.apply(void 0, args);
26024
26481
  registerWrapper(stripe, startTime);
@@ -26055,8 +26512,8 @@ var loadStripe = function loadStripe2() {
26055
26512
  };
26056
26513
 
26057
26514
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
26058
- var import_react57 = require("react");
26059
- var import_jsx_runtime59 = require("react/jsx-runtime");
26515
+ var import_react58 = require("react");
26516
+ var import_jsx_runtime60 = require("react/jsx-runtime");
26060
26517
  var resolveDesignProps6 = () => {
26061
26518
  return {
26062
26519
  header: {
@@ -26084,7 +26541,7 @@ var PaymentMethodDetails = ({
26084
26541
  updatePaymentMethod,
26085
26542
  deletePaymentMethod
26086
26543
  } = useEmbed();
26087
- const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react57.useMemo)(() => {
26544
+ const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react58.useMemo)(() => {
26088
26545
  return {
26089
26546
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
26090
26547
  paymentMethods: data?.company?.paymentMethods || [],
@@ -26097,13 +26554,13 @@ var PaymentMethodDetails = ({
26097
26554
  ]);
26098
26555
  const isLightBackground = useIsLightBackground();
26099
26556
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
26100
- const [isLoading, setIsLoading] = (0, import_react57.useState)(!initialPaymentMethod);
26101
- const [error, setError] = (0, import_react57.useState)();
26102
- const [showPaymentForm, setShowPaymentForm] = (0, import_react57.useState)(false);
26103
- const [stripe, setStripe] = (0, import_react57.useState)(null);
26104
- const [setupIntent, setSetupIntent] = (0, import_react57.useState)();
26105
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react57.useState)(false);
26106
- const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react57.useState)(initialPaymentMethod);
26557
+ const [isLoading, setIsLoading] = (0, import_react58.useState)(!initialPaymentMethod);
26558
+ const [error, setError] = (0, import_react58.useState)();
26559
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react58.useState)(false);
26560
+ const [stripe, setStripe] = (0, import_react58.useState)(null);
26561
+ const [setupIntent, setSetupIntent] = (0, import_react58.useState)();
26562
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react58.useState)(false);
26563
+ const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react58.useState)(initialPaymentMethod);
26107
26564
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
26108
26565
  stripe,
26109
26566
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -26116,7 +26573,7 @@ var PaymentMethodDetails = ({
26116
26573
  },
26117
26574
  autoConfirm: true
26118
26575
  });
26119
- const monthsToExpiration = (0, import_react57.useMemo)(() => {
26576
+ const monthsToExpiration = (0, import_react58.useMemo)(() => {
26120
26577
  let expiration;
26121
26578
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
26122
26579
  const now = /* @__PURE__ */ new Date();
@@ -26139,8 +26596,8 @@ var PaymentMethodDetails = ({
26139
26596
  const toggleShowPaymentMethods = () => {
26140
26597
  setShowDifferentPaymentMethods((prev) => !prev);
26141
26598
  };
26142
- const locale = (0, import_react57.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
26143
- const initializeStripe = (0, import_react57.useCallback)(() => {
26599
+ const locale = (0, import_react58.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
26600
+ const initializeStripe = (0, import_react58.useCallback)(() => {
26144
26601
  if (stripe || !setupIntent) {
26145
26602
  return;
26146
26603
  }
@@ -26163,7 +26620,7 @@ var PaymentMethodDetails = ({
26163
26620
  setShowPaymentForm(false);
26164
26621
  });
26165
26622
  }, [t3, stripe, setupIntent, locale]);
26166
- const initializePaymentMethod = (0, import_react57.useCallback)(() => {
26623
+ const initializePaymentMethod = (0, import_react58.useCallback)(() => {
26167
26624
  const pending = createSetupIntent() ?? Promise.resolve(void 0);
26168
26625
  return pending.then((response) => {
26169
26626
  if (response) {
@@ -26178,7 +26635,7 @@ var PaymentMethodDetails = ({
26178
26635
  setIsLoading(false);
26179
26636
  });
26180
26637
  }, [t3, createSetupIntent]);
26181
- const handleUpdatePaymentMethod = (0, import_react57.useCallback)(
26638
+ const handleUpdatePaymentMethod = (0, import_react58.useCallback)(
26182
26639
  async (paymentMethodId) => {
26183
26640
  try {
26184
26641
  setIsLoading(true);
@@ -26200,7 +26657,7 @@ var PaymentMethodDetails = ({
26200
26657
  },
26201
26658
  [t3, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
26202
26659
  );
26203
- const handleDeletePaymentMethod = (0, import_react57.useCallback)(
26660
+ const handleDeletePaymentMethod = (0, import_react58.useCallback)(
26204
26661
  async (paymentMethodId) => {
26205
26662
  try {
26206
26663
  setIsLoading(true);
@@ -26216,10 +26673,10 @@ var PaymentMethodDetails = ({
26216
26673
  },
26217
26674
  [t3, deletePaymentMethod]
26218
26675
  );
26219
- (0, import_react57.useEffect)(() => {
26676
+ (0, import_react58.useEffect)(() => {
26220
26677
  initializeStripe();
26221
26678
  }, [initializeStripe]);
26222
- (0, import_react57.useEffect)(() => {
26679
+ (0, import_react58.useEffect)(() => {
26223
26680
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
26224
26681
  initializePaymentMethod();
26225
26682
  }
@@ -26229,7 +26686,7 @@ var PaymentMethodDetails = ({
26229
26686
  showPaymentForm,
26230
26687
  initializePaymentMethod
26231
26688
  ]);
26232
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26689
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26233
26690
  Flex,
26234
26691
  {
26235
26692
  $position: "relative",
@@ -26237,7 +26694,7 @@ var PaymentMethodDetails = ({
26237
26694
  $flexGrow: 1,
26238
26695
  $gap: "1.5rem",
26239
26696
  children: [
26240
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26697
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26241
26698
  Flex,
26242
26699
  {
26243
26700
  $position: "absolute",
@@ -26246,7 +26703,7 @@ var PaymentMethodDetails = ({
26246
26703
  $alignItems: "center",
26247
26704
  $width: "100%",
26248
26705
  $height: "100%",
26249
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26706
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26250
26707
  Loader,
26251
26708
  {
26252
26709
  $color: settings.theme.primary,
@@ -26256,7 +26713,7 @@ var PaymentMethodDetails = ({
26256
26713
  )
26257
26714
  }
26258
26715
  ),
26259
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26716
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26260
26717
  Flex,
26261
26718
  {
26262
26719
  $zIndex: isLoading || isConfirmingPayment ? 0 : 1,
@@ -26273,7 +26730,7 @@ var PaymentMethodDetails = ({
26273
26730
  }
26274
26731
  },
26275
26732
  children: [
26276
- setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26733
+ setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26277
26734
  import_react_stripe_js2.Elements,
26278
26735
  {
26279
26736
  stripe,
@@ -26304,7 +26761,7 @@ var PaymentMethodDetails = ({
26304
26761
  clientSecret: setupIntent?.setupIntentClientSecret
26305
26762
  },
26306
26763
  children: [
26307
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26764
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26308
26765
  PaymentForm,
26309
26766
  {
26310
26767
  financeData,
@@ -26315,7 +26772,7 @@ var PaymentMethodDetails = ({
26315
26772
  }
26316
26773
  }
26317
26774
  ),
26318
- currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26775
+ currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26319
26776
  Text,
26320
26777
  {
26321
26778
  onClick: focusExistingPaymentMethods,
@@ -26328,8 +26785,8 @@ var PaymentMethodDetails = ({
26328
26785
  ) })
26329
26786
  ]
26330
26787
  }
26331
- ) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26332
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26788
+ ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26789
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26333
26790
  PaymentMethodElement,
26334
26791
  {
26335
26792
  paymentMethod: currentPaymentMethod,
@@ -26342,8 +26799,8 @@ var PaymentMethodDetails = ({
26342
26799
  ...props
26343
26800
  }
26344
26801
  ),
26345
- paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26346
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26802
+ paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26803
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26347
26804
  Text,
26348
26805
  {
26349
26806
  onClick: toggleShowPaymentMethods,
@@ -26354,7 +26811,7 @@ var PaymentMethodDetails = ({
26354
26811
  children: t3("Choose different payment method")
26355
26812
  }
26356
26813
  ),
26357
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26814
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26358
26815
  Icon3,
26359
26816
  {
26360
26817
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
@@ -26362,10 +26819,10 @@ var PaymentMethodDetails = ({
26362
26819
  }
26363
26820
  )
26364
26821
  ] }),
26365
- showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26366
- paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26822
+ showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26823
+ paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26367
26824
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
26368
- ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26825
+ ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26369
26826
  PaymentListElement,
26370
26827
  {
26371
26828
  paymentMethod,
@@ -26374,7 +26831,7 @@ var PaymentMethodDetails = ({
26374
26831
  },
26375
26832
  paymentMethod.id
26376
26833
  )) }),
26377
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26834
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26378
26835
  Button,
26379
26836
  {
26380
26837
  type: "button",
@@ -26389,7 +26846,7 @@ var PaymentMethodDetails = ({
26389
26846
  )
26390
26847
  ] })
26391
26848
  ] }),
26392
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26849
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26393
26850
  ]
26394
26851
  }
26395
26852
  )
@@ -26399,13 +26856,13 @@ var PaymentMethodDetails = ({
26399
26856
  };
26400
26857
 
26401
26858
  // src/components/elements/plan-manager/PlanManager.tsx
26402
- var import_react59 = require("react");
26859
+ var import_react60 = require("react");
26403
26860
 
26404
26861
  // src/components/elements/plan-manager/AddOn.tsx
26405
- var import_jsx_runtime60 = require("react/jsx-runtime");
26862
+ var import_jsx_runtime61 = require("react/jsx-runtime");
26406
26863
  var AddOn = ({ addOn, currency, period, layout }) => {
26407
26864
  const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
26408
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26865
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
26409
26866
  Flex,
26410
26867
  {
26411
26868
  $justifyContent: "space-between",
@@ -26413,10 +26870,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26413
26870
  $flexWrap: "wrap",
26414
26871
  $gap: "1rem",
26415
26872
  children: [
26416
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26417
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Text, { children: [
26873
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26874
+ typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
26418
26875
  formatCurrency(addOn.planPrice, currency),
26419
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26876
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26420
26877
  ] })
26421
26878
  ]
26422
26879
  }
@@ -26424,8 +26881,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26424
26881
  };
26425
26882
 
26426
26883
  // src/components/elements/plan-manager/UsageDetails.tsx
26427
- var import_react58 = require("react");
26428
- var import_jsx_runtime61 = require("react/jsx-runtime");
26884
+ var import_react59 = require("react");
26885
+ var import_jsx_runtime62 = require("react/jsx-runtime");
26429
26886
  var UsageDetails2 = ({
26430
26887
  entitlement,
26431
26888
  period,
@@ -26440,40 +26897,40 @@ var UsageDetails2 = ({
26440
26897
  billingPrice,
26441
26898
  limit,
26442
26899
  cost = 0
26443
- } = (0, import_react58.useMemo)(
26900
+ } = (0, import_react59.useMemo)(
26444
26901
  () => getUsageDetails(entitlement, period, currency, {
26445
26902
  showWarningThresholdAsLimit
26446
26903
  }),
26447
26904
  [entitlement, period, currency, showWarningThresholdAsLimit]
26448
26905
  );
26449
- const description = (0, import_react58.useMemo)(() => {
26906
+ const description = (0, import_react59.useMemo)(() => {
26450
26907
  const acc = [];
26451
26908
  let index = 0;
26452
26909
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
26453
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react58.Fragment, { children: [
26910
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
26454
26911
  t3("Additional"),
26455
26912
  ": "
26456
26913
  ] }, index));
26457
26914
  index += 1;
26458
26915
  }
26459
26916
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
26460
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react58.Fragment, { children: t3("Tier-based") }, index));
26917
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react59.Fragment, { children: t3("Tier-based") }, index));
26461
26918
  index += 1;
26462
26919
  }
26463
26920
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
26464
26921
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
26465
26922
  const packageSize = billingPrice?.packageSize ?? 1;
26466
26923
  acc.push(
26467
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react58.Fragment, { children: [
26924
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
26468
26925
  formatCurrency(price, billingPrice?.currency),
26469
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("sub", { children: [
26926
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
26470
26927
  "/",
26471
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26928
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26472
26929
  packageSize,
26473
26930
  " "
26474
26931
  ] }),
26475
26932
  getFeatureName(entitlement.feature, packageSize),
26476
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26933
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26477
26934
  "/",
26478
26935
  shortenPeriod(period)
26479
26936
  ] })
@@ -26484,7 +26941,7 @@ var UsageDetails2 = ({
26484
26941
  }
26485
26942
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
26486
26943
  acc.push(
26487
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react58.Fragment, { children: [
26944
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
26488
26945
  formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
26489
26946
  " ",
26490
26947
  getFeatureName(
@@ -26512,7 +26969,7 @@ var UsageDetails2 = ({
26512
26969
  return null;
26513
26970
  }
26514
26971
  const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
26515
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
26972
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26516
26973
  Flex,
26517
26974
  {
26518
26975
  $justifyContent: "space-between",
@@ -26520,13 +26977,13 @@ var UsageDetails2 = ({
26520
26977
  $flexWrap: "wrap",
26521
26978
  $gap: "0.5rem",
26522
26979
  children: [
26523
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26980
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26524
26981
  quantity,
26525
26982
  " ",
26526
26983
  getFeatureName(entitlement.feature, quantity, true)
26527
26984
  ] }) : entitlement.feature.name }),
26528
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
26529
- description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
26985
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { children: [
26986
+ description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26530
26987
  Text,
26531
26988
  {
26532
26989
  style: { opacity: 0.54 },
@@ -26537,15 +26994,15 @@ var UsageDetails2 = ({
26537
26994
  ),
26538
26995
  // only show cost for pay-in-advance entitlements
26539
26996
  // `description` will include price for other price behaviors
26540
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26997
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26541
26998
  " ",
26542
26999
  formatCurrency(cost, billingPrice?.currency),
26543
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("sub", { children: [
27000
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
26544
27001
  "/",
26545
27002
  shortenPeriod(period)
26546
27003
  ] })
26547
27004
  ] }),
26548
- entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
27005
+ entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26549
27006
  PricingTiersTooltip,
26550
27007
  {
26551
27008
  feature: entitlement.feature,
@@ -26555,7 +27012,7 @@ var UsageDetails2 = ({
26555
27012
  tiersMode: billingPrice?.tiersMode ?? void 0
26556
27013
  }
26557
27014
  ),
26558
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
27015
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26559
27016
  HardLimitTooltip,
26560
27017
  {
26561
27018
  feature: entitlement.feature,
@@ -26569,7 +27026,7 @@ var UsageDetails2 = ({
26569
27026
  };
26570
27027
 
26571
27028
  // src/components/elements/plan-manager/PlanManager.tsx
26572
- var import_jsx_runtime62 = require("react/jsx-runtime");
27029
+ var import_jsx_runtime63 = require("react/jsx-runtime");
26573
27030
  var resolveDesignProps7 = (props) => {
26574
27031
  return {
26575
27032
  header: {
@@ -26598,7 +27055,7 @@ var resolveDesignProps7 = (props) => {
26598
27055
  }
26599
27056
  };
26600
27057
  };
26601
- var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal, ...rest }, ref) => {
27058
+ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal, ...rest }, ref) => {
26602
27059
  const props = resolveDesignProps7(rest);
26603
27060
  const { t: t3 } = useTranslation();
26604
27061
  const { data, settings, setCheckoutState, setLayout } = useEmbed();
@@ -26617,7 +27074,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26617
27074
  showCredits,
26618
27075
  showZeroPriceAsFree,
26619
27076
  trialPaymentMethodRequired
26620
- } = (0, import_react59.useMemo)(() => {
27077
+ } = (0, import_react60.useMemo)(() => {
26621
27078
  const planCreditOrder = /* @__PURE__ */ new Map();
26622
27079
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
26623
27080
  if (!planCreditOrder.has(grant.creditId)) {
@@ -26677,15 +27134,15 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26677
27134
  data?.displaySettings?.showZeroPriceAsFree,
26678
27135
  data?.trialPaymentMethodRequired
26679
27136
  ]);
26680
- const usageBasedEntitlements = (0, import_react59.useMemo)(
27137
+ const usageBasedEntitlements = (0, import_react60.useMemo)(
26681
27138
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
26682
27139
  [featureUsage]
26683
27140
  );
26684
- const planCreditCompositions = (0, import_react59.useMemo)(
27141
+ const planCreditCompositions = (0, import_react60.useMemo)(
26685
27142
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
26686
27143
  [currentPlan?.includedCreditGrants]
26687
27144
  );
26688
- const resolveLicenseQuantity = (0, import_react59.useMemo)(() => {
27145
+ const resolveLicenseQuantity = (0, import_react60.useMemo)(() => {
26689
27146
  return (licenseId) => {
26690
27147
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
26691
27148
  return typeof allocation === "number" ? allocation : void 0;
@@ -26708,7 +27165,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26708
27165
  subscriptionCurrency,
26709
27166
  willSubscriptionCancel,
26710
27167
  isTrialSubscription
26711
- } = (0, import_react59.useMemo)(() => {
27168
+ } = (0, import_react60.useMemo)(() => {
26712
27169
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
26713
27170
  const subscriptionCurrency2 = billingSubscription?.currency;
26714
27171
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -26721,7 +27178,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26721
27178
  };
26722
27179
  }, [billingSubscription]);
26723
27180
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
26724
- const { isFreePlan, isUsageBasedPlan } = (0, import_react59.useMemo)(() => {
27181
+ const { isFreePlan, isUsageBasedPlan } = (0, import_react60.useMemo)(() => {
26725
27182
  const isFreePlan2 = currentPlan?.planPrice === 0;
26726
27183
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
26727
27184
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -26729,8 +27186,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26729
27186
  const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
26730
27187
  (grant) => isSelfServiceAutoTopupAvailable(grant)
26731
27188
  ) ?? false;
26732
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26733
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27189
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27190
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26734
27191
  Notice,
26735
27192
  {
26736
27193
  as: Flex,
@@ -26740,8 +27197,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26740
27197
  $textAlign: "center",
26741
27198
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26742
27199
  children: [
26743
- typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t3("Trial ends in", trialEnd) }),
26744
- (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27200
+ typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Trial ends in", trialEnd) }),
27201
+ (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26745
27202
  Text,
26746
27203
  {
26747
27204
  as: "p",
@@ -26755,7 +27212,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26755
27212
  )
26756
27213
  ]
26757
27214
  }
26758
- ) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27215
+ ) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26759
27216
  Notice,
26760
27217
  {
26761
27218
  as: Flex,
@@ -26765,8 +27222,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26765
27222
  $textAlign: "center",
26766
27223
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26767
27224
  children: [
26768
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t3("Subscription canceled") }),
26769
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27225
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Subscription canceled") }),
27226
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26770
27227
  Text,
26771
27228
  {
26772
27229
  as: "p",
@@ -26781,7 +27238,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26781
27238
  )
26782
27239
  ]
26783
27240
  }
26784
- ) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27241
+ ) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26785
27242
  Notice,
26786
27243
  {
26787
27244
  as: Flex,
@@ -26791,19 +27248,19 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26791
27248
  $textAlign: "center",
26792
27249
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26793
27250
  children: [
26794
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment", {
27251
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment", {
26795
27252
  plan: customPlanBilling.planName ?? t3("your plan")
26796
27253
  }) : t3("Custom plan payment due", {
26797
27254
  plan: customPlanBilling.planName ?? t3("your plan"),
26798
27255
  date: toPrettyDate(customPlanBilling.deadline)
26799
27256
  }) }),
26800
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment description", {
27257
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment description", {
26801
27258
  date: toPrettyDate(customPlanBilling.deadline)
26802
27259
  }) : t3("Custom plan payment due description", {
26803
27260
  plan: customPlanBilling.planName ?? t3("your plan"),
26804
27261
  date: toPrettyDate(customPlanBilling.deadline)
26805
27262
  }) }),
26806
- customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27263
+ customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26807
27264
  Button,
26808
27265
  {
26809
27266
  as: "a",
@@ -26817,7 +27274,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26817
27274
  )
26818
27275
  ]
26819
27276
  }
26820
- ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27277
+ ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26821
27278
  Notice,
26822
27279
  {
26823
27280
  as: Flex,
@@ -26827,10 +27284,10 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26827
27284
  $textAlign: "center",
26828
27285
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26829
27286
  children: [
26830
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t3("Downgrade to plan scheduled", {
27287
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Downgrade to plan scheduled", {
26831
27288
  plan: data.company.scheduledDowngrade.toPlanName
26832
27289
  }) }),
26833
- typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27290
+ typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26834
27291
  Text,
26835
27292
  {
26836
27293
  as: "p",
@@ -26846,7 +27303,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26846
27303
  ]
26847
27304
  }
26848
27305
  ),
26849
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27306
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26850
27307
  Element,
26851
27308
  {
26852
27309
  as: Flex,
@@ -26855,19 +27312,19 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26855
27312
  $flexDirection: "column",
26856
27313
  $gap: "2rem",
26857
27314
  children: [
26858
- props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27315
+ props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26859
27316
  Flex,
26860
27317
  {
26861
27318
  $justifyContent: "space-between",
26862
27319
  $alignItems: "center",
26863
27320
  $gap: "1rem",
26864
27321
  children: [
26865
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
26866
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
26867
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
27322
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
27323
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
27324
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
26868
27325
  ] }),
26869
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Box, { children: [
26870
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27326
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Box, { children: [
27327
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26871
27328
  Text,
26872
27329
  {
26873
27330
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -26877,7 +27334,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26877
27334
  )
26878
27335
  }
26879
27336
  ),
26880
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
27337
+ !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
26881
27338
  "/",
26882
27339
  shortenPeriod(currentPlanPeriod)
26883
27340
  ] }) })
@@ -26885,8 +27342,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26885
27342
  ]
26886
27343
  }
26887
27344
  ),
26888
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26889
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27345
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27346
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26890
27347
  Text,
26891
27348
  {
26892
27349
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26894,7 +27351,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26894
27351
  children: t3("Add-ons")
26895
27352
  }
26896
27353
  ),
26897
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27354
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26898
27355
  AddOn,
26899
27356
  {
26900
27357
  addOn,
@@ -26905,8 +27362,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26905
27362
  addOnIndex
26906
27363
  )) })
26907
27364
  ] }),
26908
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26909
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27365
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27366
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26910
27367
  Text,
26911
27368
  {
26912
27369
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26914,8 +27371,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26914
27371
  children: t3("Usage-based")
26915
27372
  }
26916
27373
  ),
26917
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
26918
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27374
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
27375
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26919
27376
  UsageDetails2,
26920
27377
  {
26921
27378
  entitlement,
@@ -26928,8 +27385,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26928
27385
  );
26929
27386
  }) })
26930
27387
  ] }),
26931
- props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26932
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27388
+ props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27389
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26933
27390
  Text,
26934
27391
  {
26935
27392
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26937,7 +27394,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26937
27394
  children: t3("Credits in plan")
26938
27395
  }
26939
27396
  ),
26940
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
27397
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
26941
27398
  const planCreditGrant = currentPlan?.includedCreditGrants.find(
26942
27399
  (grant) => grant.creditId === group.id
26943
27400
  );
@@ -26960,13 +27417,13 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26960
27417
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
26961
27418
  const creditPeriod = composition.period ?? subscriptionInterval;
26962
27419
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
26963
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27420
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26964
27421
  Flex,
26965
27422
  {
26966
27423
  $flexDirection: "column",
26967
27424
  $gap: "0.25rem",
26968
27425
  children: [
26969
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27426
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26970
27427
  Flex,
26971
27428
  {
26972
27429
  $justifyContent: "space-between",
@@ -26974,7 +27431,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26974
27431
  $flexWrap: "wrap",
26975
27432
  $gap: "0.5rem",
26976
27433
  children: [
26977
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27434
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26978
27435
  t3("X credits per license", {
26979
27436
  amount: perLicenseGrant.amount,
26980
27437
  creditName: getFeatureName(
@@ -26983,7 +27440,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26983
27440
  ),
26984
27441
  licenseName: getFeatureName(licenseFeature, 1)
26985
27442
  }),
26986
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27443
+ composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26987
27444
  " ",
26988
27445
  t3("Plus X credits per period", {
26989
27446
  amount: composition.fixedQuantity,
@@ -26994,18 +27451,18 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
26994
27451
  period: t3(creditPeriod)
26995
27452
  })
26996
27453
  ] })
26997
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27454
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26998
27455
  group.total.value,
26999
27456
  " ",
27000
27457
  getFeatureName(group, group.total.value),
27001
27458
  " ",
27002
- subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27459
+ subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27003
27460
  t3("per"),
27004
27461
  " ",
27005
27462
  t3(subscriptionInterval)
27006
27463
  ] })
27007
27464
  ] }) }),
27008
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27465
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27009
27466
  Text,
27010
27467
  {
27011
27468
  style: { opacity: 0.54 },
@@ -27015,7 +27472,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27015
27472
  group.total.used,
27016
27473
  " ",
27017
27474
  t3("used"),
27018
- hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27475
+ hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27019
27476
  AutoTopupNotice,
27020
27477
  {
27021
27478
  thresholdCredits,
@@ -27028,7 +27485,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27028
27485
  ]
27029
27486
  }
27030
27487
  ),
27031
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27488
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27032
27489
  Text,
27033
27490
  {
27034
27491
  style: { opacity: 0.54 },
@@ -27069,7 +27526,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27069
27526
  groupIndex
27070
27527
  );
27071
27528
  }) }),
27072
- planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27529
+ planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27073
27530
  ExpandListToggle,
27074
27531
  {
27075
27532
  isExpanded: planCredits.isExpanded,
@@ -27078,7 +27535,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27078
27535
  $marginTop: "0.5rem"
27079
27536
  }
27080
27537
  ),
27081
- hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27538
+ hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27082
27539
  Flex,
27083
27540
  {
27084
27541
  $justifyContent: "space-between",
@@ -27088,8 +27545,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27088
27545
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
27089
27546
  $borderRadius: "0.5rem",
27090
27547
  children: [
27091
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27092
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.addOns.fontStyle, children: t3("Auto top-up") }),
27548
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27549
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: t3("Auto top-up") }),
27093
27550
  currentPlan?.includedCreditGrants.reduce(
27094
27551
  (acc, grant) => {
27095
27552
  if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
@@ -27098,7 +27555,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27098
27555
  const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
27099
27556
  if (!autoTopupEnabled) {
27100
27557
  acc.push(
27101
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
27558
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
27102
27559
  unit: getFeatureName(grant.credit, 1)
27103
27560
  }) }, grant.id)
27104
27561
  );
@@ -27108,7 +27565,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27108
27565
  const autoTopupAmount = getAutoTopupAmount(grant);
27109
27566
  if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
27110
27567
  acc.push(
27111
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
27568
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
27112
27569
  unit: getFeatureName(
27113
27570
  grant.credit,
27114
27571
  autoTopupAmount
@@ -27123,7 +27580,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27123
27580
  []
27124
27581
  )
27125
27582
  ] }),
27126
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27583
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27127
27584
  Button,
27128
27585
  {
27129
27586
  type: "button",
@@ -27140,8 +27597,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27140
27597
  }
27141
27598
  )
27142
27599
  ] }),
27143
- props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27144
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27600
+ props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27601
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27145
27602
  Text,
27146
27603
  {
27147
27604
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27149,9 +27606,9 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27149
27606
  children: t3("Top-ups")
27150
27607
  }
27151
27608
  ),
27152
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
27609
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
27153
27610
  const bundle = group?.bundleId ? creditBundles.find((b) => b.id === group.bundleId) : void 0;
27154
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27611
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27155
27612
  Flex,
27156
27613
  {
27157
27614
  $justifyContent: "space-between",
@@ -27159,8 +27616,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27159
27616
  $flexWrap: "wrap",
27160
27617
  $gap: "0.5rem",
27161
27618
  children: [
27162
- bundle ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27163
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27619
+ bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27620
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27164
27621
  "(",
27165
27622
  group.grants.length,
27166
27623
  ")",
@@ -27172,8 +27629,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27172
27629
  " ",
27173
27630
  getFeatureName(group, group.quantity),
27174
27631
  ")"
27175
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27176
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27632
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27633
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27177
27634
  "(",
27178
27635
  group.grants.length,
27179
27636
  ")",
@@ -27183,7 +27640,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27183
27640
  " ",
27184
27641
  getFeatureName(group, group.quantity)
27185
27642
  ] }),
27186
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27643
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27187
27644
  Text,
27188
27645
  {
27189
27646
  style: { opacity: 0.54 },
@@ -27201,7 +27658,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27201
27658
  groupIndex
27202
27659
  );
27203
27660
  }) }),
27204
- autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27661
+ autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27205
27662
  ExpandListToggle,
27206
27663
  {
27207
27664
  isExpanded: autoTopupCredits.isExpanded,
@@ -27211,8 +27668,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27211
27668
  }
27212
27669
  )
27213
27670
  ] }),
27214
- props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27215
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27671
+ props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27672
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27216
27673
  Text,
27217
27674
  {
27218
27675
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27220,9 +27677,9 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27220
27677
  children: t3("Credit bundles")
27221
27678
  }
27222
27679
  ),
27223
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
27680
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
27224
27681
  const bundle = group?.bundleId ? creditBundles.find((b) => b.id === group.bundleId) : void 0;
27225
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27682
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27226
27683
  Flex,
27227
27684
  {
27228
27685
  $justifyContent: "space-between",
@@ -27230,8 +27687,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27230
27687
  $flexWrap: "wrap",
27231
27688
  $gap: "0.5rem",
27232
27689
  children: [
27233
- bundle ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27234
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27690
+ bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27691
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27235
27692
  "(",
27236
27693
  group.grants.length,
27237
27694
  ")",
@@ -27243,12 +27700,12 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27243
27700
  " ",
27244
27701
  getFeatureName(group, group.quantity),
27245
27702
  ")"
27246
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27703
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27247
27704
  group.quantity,
27248
27705
  " ",
27249
27706
  getFeatureName(group, group.quantity)
27250
27707
  ] }),
27251
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27708
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27252
27709
  Text,
27253
27710
  {
27254
27711
  style: { opacity: 0.54 },
@@ -27266,7 +27723,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27266
27723
  groupIndex
27267
27724
  );
27268
27725
  }) }),
27269
- bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27726
+ bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27270
27727
  ExpandListToggle,
27271
27728
  {
27272
27729
  isExpanded: bundleCredits.isExpanded,
@@ -27276,8 +27733,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27276
27733
  }
27277
27734
  )
27278
27735
  ] }),
27279
- props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27280
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27736
+ props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27737
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27281
27738
  Text,
27282
27739
  {
27283
27740
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27285,8 +27742,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27285
27742
  children: t3("Promotional credits")
27286
27743
  }
27287
27744
  ),
27288
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27289
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27745
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27746
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27290
27747
  Flex,
27291
27748
  {
27292
27749
  $justifyContent: "space-between",
@@ -27294,12 +27751,12 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27294
27751
  $flexWrap: "wrap",
27295
27752
  $gap: "0.5rem",
27296
27753
  children: [
27297
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27754
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27298
27755
  group.quantity,
27299
27756
  " ",
27300
27757
  getFeatureName(group, group.quantity)
27301
27758
  ] }),
27302
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27759
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27303
27760
  Text,
27304
27761
  {
27305
27762
  style: { opacity: 0.54 },
@@ -27317,7 +27774,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27317
27774
  groupIndex
27318
27775
  );
27319
27776
  }) }),
27320
- promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27777
+ promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27321
27778
  ExpandListToggle,
27322
27779
  {
27323
27780
  isExpanded: promotionalCredits.isExpanded,
@@ -27327,7 +27784,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27327
27784
  }
27328
27785
  )
27329
27786
  ] }),
27330
- canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27787
+ canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27331
27788
  Button,
27332
27789
  {
27333
27790
  type: "button",
@@ -27348,11 +27805,11 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
27348
27805
  PlanManager.displayName = "PlanManager";
27349
27806
 
27350
27807
  // src/components/elements/pricing-table/PricingTable.tsx
27351
- var import_react62 = require("react");
27808
+ var import_react63 = require("react");
27352
27809
 
27353
27810
  // src/components/elements/pricing-table/AddOn.tsx
27354
- var import_react60 = require("react");
27355
- var import_jsx_runtime63 = require("react/jsx-runtime");
27811
+ var import_react61 = require("react");
27812
+ var import_jsx_runtime64 = require("react/jsx-runtime");
27356
27813
  function renderMeteredEntitlementPricing2({
27357
27814
  priceBehavior,
27358
27815
  softLimit,
@@ -27364,7 +27821,7 @@ function renderMeteredEntitlementPricing2({
27364
27821
  isTiered
27365
27822
  }) {
27366
27823
  if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
27367
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27824
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27368
27825
  "Additional: ",
27369
27826
  formatCurrency(price, currency),
27370
27827
  "/",
@@ -27375,13 +27832,13 @@ function renderMeteredEntitlementPricing2({
27375
27832
  ] });
27376
27833
  }
27377
27834
  if (isTiered) {
27378
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: "Tier-based pricing" });
27835
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: "Tier-based pricing" });
27379
27836
  }
27380
27837
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
27381
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27838
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27382
27839
  formatCurrency(price, currency),
27383
27840
  "/",
27384
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27841
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27385
27842
  packageSize,
27386
27843
  " "
27387
27844
  ] }),
@@ -27407,7 +27864,7 @@ var AddOn2 = ({
27407
27864
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27408
27865
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27409
27866
  const isLightBackground = useIsLightBackground();
27410
- const { currentAddOns, canCheckout, isStandalone } = (0, import_react60.useMemo)(() => {
27867
+ const { currentAddOns, canCheckout, isStandalone } = (0, import_react61.useMemo)(() => {
27411
27868
  const isStandalone2 = typeof data?.component === "undefined";
27412
27869
  return {
27413
27870
  currentAddOns: data?.company?.addOns || [],
@@ -27450,7 +27907,7 @@ var AddOn2 = ({
27450
27907
  isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
27451
27908
  };
27452
27909
  }) || [];
27453
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27910
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27454
27911
  Flex,
27455
27912
  {
27456
27913
  as: "li",
@@ -27470,7 +27927,7 @@ var AddOn2 = ({
27470
27927
  $boxShadow: cardBoxShadow
27471
27928
  },
27472
27929
  children: [
27473
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27930
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27474
27931
  Flex,
27475
27932
  {
27476
27933
  $flexDirection: "column",
@@ -27481,7 +27938,7 @@ var AddOn2 = ({
27481
27938
  $borderStyle: "solid",
27482
27939
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27483
27940
  children: [
27484
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27941
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27485
27942
  Text,
27486
27943
  {
27487
27944
  as: "h3",
@@ -27490,22 +27947,22 @@ var AddOn2 = ({
27490
27947
  children: addOn.name
27491
27948
  }
27492
27949
  ) }),
27493
- layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27494
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27950
+ layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27951
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27495
27952
  Text,
27496
27953
  {
27497
27954
  "data-testid": "sch-addon-price",
27498
27955
  display: layout.plans.name.fontStyle,
27499
- children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t3("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27956
+ children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t3("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27500
27957
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
27501
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
27958
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("sub", { children: [
27502
27959
  "/",
27503
27960
  selectedPeriod
27504
27961
  ] })
27505
27962
  ] })
27506
27963
  }
27507
27964
  ) }),
27508
- isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27965
+ isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27509
27966
  Flex,
27510
27967
  {
27511
27968
  "data-testid": "sch-addon-active",
@@ -27515,7 +27972,7 @@ var AddOn2 = ({
27515
27972
  $backgroundColor: settings.theme.primary,
27516
27973
  $borderRadius: "9999px",
27517
27974
  $padding: "0.125rem 0.85rem",
27518
- children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27975
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27519
27976
  Text,
27520
27977
  {
27521
27978
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -27528,7 +27985,7 @@ var AddOn2 = ({
27528
27985
  ]
27529
27986
  }
27530
27987
  ),
27531
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27988
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27532
27989
  Flex,
27533
27990
  {
27534
27991
  $flexDirection: "column",
@@ -27537,7 +27994,7 @@ var AddOn2 = ({
27537
27994
  $flexGrow: 1,
27538
27995
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
27539
27996
  children: [
27540
- layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27997
+ layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27541
27998
  Flex,
27542
27999
  {
27543
28000
  as: "ul",
@@ -27549,7 +28006,7 @@ var AddOn2 = ({
27549
28006
  $listStyle: "none",
27550
28007
  children: displayableEntitlements.map((entitlement, idx) => {
27551
28008
  if (entitlement.isUnlimited) {
27552
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
28009
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27553
28010
  Flex,
27554
28011
  {
27555
28012
  as: "li",
@@ -27558,8 +28015,8 @@ var AddOn2 = ({
27558
28015
  $alignItems: "center",
27559
28016
  $gap: "1rem",
27560
28017
  children: [
27561
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $gap: "1rem", children: [
27562
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28018
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
28019
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27563
28020
  Icon3,
27564
28021
  {
27565
28022
  name: entitlement.feature.icon,
@@ -27568,16 +28025,16 @@ var AddOn2 = ({
27568
28025
  rounded: true
27569
28026
  }
27570
28027
  ),
27571
- entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28028
+ entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27572
28029
  Flex,
27573
28030
  {
27574
28031
  $flexDirection: "column",
27575
28032
  $justifyContent: "center",
27576
- children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { children: getFeatureName(entitlement.feature) })
28033
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: getFeatureName(entitlement.feature) })
27577
28034
  }
27578
28035
  )
27579
28036
  ] }),
27580
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28037
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27581
28038
  Text,
27582
28039
  {
27583
28040
  style: { opacity: 0.54 },
@@ -27592,7 +28049,7 @@ var AddOn2 = ({
27592
28049
  );
27593
28050
  }
27594
28051
  const meteredEntitlement = entitlement;
27595
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
28052
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27596
28053
  Flex,
27597
28054
  {
27598
28055
  as: "li",
@@ -27602,8 +28059,8 @@ var AddOn2 = ({
27602
28059
  $gap: "1rem",
27603
28060
  $listStyle: "none",
27604
28061
  children: [
27605
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $gap: "1rem", children: [
27606
- meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28062
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
28063
+ meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27607
28064
  Icon3,
27608
28065
  {
27609
28066
  "data-testid": "sch-feature-icon",
@@ -27613,9 +28070,9 @@ var AddOn2 = ({
27613
28070
  rounded: true
27614
28071
  }
27615
28072
  ),
27616
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
28073
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
27617
28074
  ] }),
27618
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28075
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27619
28076
  Text,
27620
28077
  {
27621
28078
  style: { opacity: 0.54 },
@@ -27631,7 +28088,7 @@ var AddOn2 = ({
27631
28088
  })
27632
28089
  }
27633
28090
  ),
27634
- sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
28091
+ sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27635
28092
  Button,
27636
28093
  {
27637
28094
  type: "button",
@@ -27670,10 +28127,10 @@ var AddOn2 = ({
27670
28127
  };
27671
28128
 
27672
28129
  // src/components/elements/pricing-table/Plan.tsx
27673
- var import_react61 = require("react");
28130
+ var import_react62 = require("react");
27674
28131
 
27675
28132
  // src/components/elements/pricing-table/Entitlement.tsx
27676
- var import_jsx_runtime64 = require("react/jsx-runtime");
28133
+ var import_jsx_runtime65 = require("react/jsx-runtime");
27677
28134
  var Entitlement2 = ({
27678
28135
  entitlement,
27679
28136
  sharedProps,
@@ -27707,8 +28164,8 @@ var Entitlement2 = ({
27707
28164
  entitlement,
27708
28165
  credits
27709
28166
  );
27710
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
27711
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28167
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
28168
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27712
28169
  Icon3,
27713
28170
  {
27714
28171
  "data-testid": "sch-feature-icon",
@@ -27718,31 +28175,31 @@ var Entitlement2 = ({
27718
28175
  rounded: true
27719
28176
  }
27720
28177
  ),
27721
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27722
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
27723
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28178
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
28179
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
28180
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27724
28181
  formatCurrency(entitlementPrice, entitlementCurrency),
27725
28182
  " ",
27726
28183
  t3("per"),
27727
28184
  " ",
27728
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28185
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27729
28186
  formatNumber(entitlementPackageSize),
27730
28187
  " "
27731
28188
  ] }),
27732
28189
  getFeatureName(entitlement.feature, entitlementPackageSize),
27733
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28190
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27734
28191
  " ",
27735
28192
  t3("per"),
27736
28193
  " ",
27737
28194
  selectedPeriod
27738
28195
  ] })
27739
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28196
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27740
28197
  TieredPricingDetails,
27741
28198
  {
27742
28199
  entitlement,
27743
28200
  period: selectedPeriod
27744
28201
  }
27745
- ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28202
+ ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27746
28203
  formatConsumptionRate(entitlement.consumptionRate),
27747
28204
  " ",
27748
28205
  getFeatureName(
@@ -27753,7 +28210,7 @@ var Entitlement2 = ({
27753
28210
  t3("per"),
27754
28211
  " ",
27755
28212
  getFeatureName(entitlement.feature, 1)
27756
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
28213
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
27757
28214
  amount: formatNumber(creditBasedEntitlementLimit.limit),
27758
28215
  units: getFeatureName(
27759
28216
  entitlement.feature,
@@ -27766,25 +28223,25 @@ var Entitlement2 = ({
27766
28223
  entitlement.feature,
27767
28224
  creditBasedEntitlementLimit.limit
27768
28225
  )
27769
- }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28226
+ }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27770
28227
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
27771
28228
  item: getFeatureName(entitlement.feature)
27772
- }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27773
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28229
+ }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
28230
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27774
28231
  formatNumber(limit),
27775
28232
  " "
27776
28233
  ] }),
27777
28234
  getFeatureName(entitlement.feature, limit)
27778
28235
  ] }),
27779
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28236
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27780
28237
  " ",
27781
28238
  t3("per"),
27782
28239
  " ",
27783
28240
  t3(metricPeriodName)
27784
28241
  ] })
27785
28242
  ] }) : entitlement.feature.name }),
27786
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { children: [
27787
- entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
28243
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Text, { children: [
28244
+ entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
27788
28245
  Text,
27789
28246
  {
27790
28247
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27794,7 +28251,7 @@ var Entitlement2 = ({
27794
28251
  " ",
27795
28252
  formatCurrency(entitlementPrice, entitlementCurrency),
27796
28253
  "/",
27797
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28254
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27798
28255
  formatNumber(entitlementPackageSize),
27799
28256
  " "
27800
28257
  ] }),
@@ -27802,14 +28259,14 @@ var Entitlement2 = ({
27802
28259
  entitlement.feature,
27803
28260
  entitlementPackageSize
27804
28261
  ),
27805
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
28262
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27806
28263
  "/",
27807
28264
  shortenPeriod(selectedPeriod)
27808
28265
  ] })
27809
28266
  ]
27810
28267
  }
27811
- ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27812
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28268
+ ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
28269
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27813
28270
  Text,
27814
28271
  {
27815
28272
  style: { opacity: 0.54 },
@@ -27818,7 +28275,7 @@ var Entitlement2 = ({
27818
28275
  children: t3("Tier-based")
27819
28276
  }
27820
28277
  ),
27821
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28278
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27822
28279
  PricingTiersTooltip,
27823
28280
  {
27824
28281
  feature: entitlement.feature,
@@ -27829,14 +28286,14 @@ var Entitlement2 = ({
27829
28286
  }
27830
28287
  )
27831
28288
  ] }),
27832
- entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28289
+ entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27833
28290
  HardLimitTooltip,
27834
28291
  {
27835
28292
  feature: entitlement.feature,
27836
28293
  limit: entitlement.valueNumeric
27837
28294
  }
27838
28295
  ),
27839
- entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28296
+ entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27840
28297
  BillingThresholdTooltip,
27841
28298
  {
27842
28299
  billingThreshold: entitlement.billingThreshold
@@ -27844,7 +28301,7 @@ var Entitlement2 = ({
27844
28301
  )
27845
28302
  ] })
27846
28303
  ] }),
27847
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
28304
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27848
28305
  Text,
27849
28306
  {
27850
28307
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27857,7 +28314,7 @@ var Entitlement2 = ({
27857
28314
  };
27858
28315
 
27859
28316
  // src/components/elements/pricing-table/Plan.tsx
27860
- var import_jsx_runtime65 = require("react/jsx-runtime");
28317
+ var import_jsx_runtime66 = require("react/jsx-runtime");
27861
28318
  var Plan2 = ({
27862
28319
  plan,
27863
28320
  index,
@@ -27871,7 +28328,7 @@ var Plan2 = ({
27871
28328
  const { data, settings, setCheckoutState } = useEmbed();
27872
28329
  const isLightBackground = useIsLightBackground();
27873
28330
  const trialEnd = useTrialEnd();
27874
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react61.useState)({});
28331
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react62.useState)({});
27875
28332
  const handleToggleShowAll = (id) => {
27876
28333
  setEntitlementVisibility((prev) => {
27877
28334
  const updated = !(prev[id] ?? false);
@@ -27900,7 +28357,7 @@ var Plan2 = ({
27900
28357
  const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
27901
28358
  const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
27902
28359
  const isExpanded = entitlementVisibility[plan.id] ?? false;
27903
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28360
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27904
28361
  Flex,
27905
28362
  {
27906
28363
  as: "li",
@@ -27920,7 +28377,7 @@ var Plan2 = ({
27920
28377
  $boxShadow: cardBoxShadow
27921
28378
  },
27922
28379
  children: [
27923
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28380
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27924
28381
  Flex,
27925
28382
  {
27926
28383
  $flexDirection: "column",
@@ -27931,7 +28388,7 @@ var Plan2 = ({
27931
28388
  $borderStyle: "solid",
27932
28389
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27933
28390
  children: [
27934
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28391
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27935
28392
  Text,
27936
28393
  {
27937
28394
  as: "h3",
@@ -27940,8 +28397,8 @@ var Plan2 = ({
27940
28397
  children: plan.name
27941
28398
  }
27942
28399
  ) }),
27943
- layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
27944
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28400
+ layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
28401
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27945
28402
  Text,
27946
28403
  {
27947
28404
  "data-testid": "sch-plan-price",
@@ -27957,14 +28414,14 @@ var Plan2 = ({
27957
28414
  currency: planCurrency,
27958
28415
  testSignificantDigits: false
27959
28416
  }) : formatCurrency(planPrice ?? 0, planCurrency),
27960
- !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
28417
+ !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("sub", { children: [
27961
28418
  "/",
27962
28419
  showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t3("month, billed quarterly") : t3(selectedPeriod)
27963
28420
  ] })
27964
28421
  ]
27965
28422
  }
27966
28423
  ) }),
27967
- showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28424
+ showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27968
28425
  Flex,
27969
28426
  {
27970
28427
  as: "ul",
@@ -27976,8 +28433,8 @@ var Plan2 = ({
27976
28433
  $margin: 0,
27977
28434
  $listStyle: "none",
27978
28435
  children: credits.map((credit, idx) => {
27979
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
27980
- layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28436
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
28437
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27981
28438
  Icon3,
27982
28439
  {
27983
28440
  "data-testid": "sch-feature-icon",
@@ -27987,13 +28444,13 @@ var Plan2 = ({
27987
28444
  rounded: true
27988
28445
  }
27989
28446
  ),
27990
- credit.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28447
+ credit.name && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27991
28448
  Flex,
27992
28449
  {
27993
28450
  $flexDirection: "column",
27994
28451
  $justifyContent: "center",
27995
28452
  $gap: "0.5rem",
27996
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28453
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27997
28454
  PlanCreditText,
27998
28455
  {
27999
28456
  credit,
@@ -28006,7 +28463,7 @@ var Plan2 = ({
28006
28463
  })
28007
28464
  }
28008
28465
  ),
28009
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28466
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28010
28467
  Flex,
28011
28468
  {
28012
28469
  "data-testid": "sch-plan-active",
@@ -28016,7 +28473,7 @@ var Plan2 = ({
28016
28473
  $backgroundColor: settings.theme.primary,
28017
28474
  $borderRadius: "9999px",
28018
28475
  $padding: "0.125rem 0.85rem",
28019
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28476
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28020
28477
  Text,
28021
28478
  {
28022
28479
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -28029,7 +28486,7 @@ var Plan2 = ({
28029
28486
  ]
28030
28487
  }
28031
28488
  ),
28032
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28489
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28033
28490
  Flex,
28034
28491
  {
28035
28492
  $flexDirection: "column",
@@ -28038,7 +28495,7 @@ var Plan2 = ({
28038
28495
  $gap: `${cardPadding}rem`,
28039
28496
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
28040
28497
  children: [
28041
- layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28498
+ layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28042
28499
  Flex,
28043
28500
  {
28044
28501
  as: "ul",
@@ -28049,14 +28506,14 @@ var Plan2 = ({
28049
28506
  $margin: 0,
28050
28507
  $listStyle: "none",
28051
28508
  children: [
28052
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: t3("Everything in", {
28509
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { children: t3("Everything in", {
28053
28510
  plan: plans[index - 1].name
28054
28511
  }) }) }),
28055
28512
  (plan.entitlements ?? []).reduce(
28056
28513
  (acc, entitlement, idx) => {
28057
28514
  if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
28058
28515
  acc.push(
28059
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28516
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28060
28517
  Entitlement2,
28061
28518
  {
28062
28519
  entitlement,
@@ -28074,7 +28531,7 @@ var Plan2 = ({
28074
28531
  },
28075
28532
  []
28076
28533
  ),
28077
- (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28534
+ (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28078
28535
  ExpandListToggle,
28079
28536
  {
28080
28537
  as: "li",
@@ -28089,7 +28546,7 @@ var Plan2 = ({
28089
28546
  ]
28090
28547
  }
28091
28548
  ),
28092
- isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28549
+ isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28093
28550
  Flex,
28094
28551
  {
28095
28552
  $justifyContent: "center",
@@ -28097,7 +28554,7 @@ var Plan2 = ({
28097
28554
  $gap: "0.25rem",
28098
28555
  $padding: "0.625rem 0",
28099
28556
  children: [
28100
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28557
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28101
28558
  Icon3,
28102
28559
  {
28103
28560
  name: "check-rounded",
@@ -28105,11 +28562,11 @@ var Plan2 = ({
28105
28562
  color: settings.theme.primary
28106
28563
  }
28107
28564
  ),
28108
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { $size: 15, $leading: "none", children: t3("Current plan") })
28565
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { $size: 15, $leading: "none", children: t3("Current plan") })
28109
28566
  ]
28110
28567
  }
28111
- ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
28112
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28568
+ ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
28569
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28113
28570
  Button,
28114
28571
  {
28115
28572
  type: "button",
@@ -28147,10 +28604,10 @@ var Plan2 = ({
28147
28604
  }
28148
28605
  },
28149
28606
  $fullWidth: true,
28150
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t3("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { as: Box, $align: "center", children: t3("Over plan limit") }) : t3("Choose plan")
28607
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t3("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { as: Box, $align: "center", children: t3("Over plan limit") }) : t3("Choose plan")
28151
28608
  }
28152
28609
  ),
28153
- !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(UsageViolationText, { violations: plan.usageViolations })
28610
+ !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UsageViolationText, { violations: plan.usageViolations })
28154
28611
  ] })
28155
28612
  ]
28156
28613
  }
@@ -28161,7 +28618,7 @@ var Plan2 = ({
28161
28618
  };
28162
28619
 
28163
28620
  // src/components/elements/pricing-table/PricingTable.tsx
28164
- var import_jsx_runtime66 = require("react/jsx-runtime");
28621
+ var import_jsx_runtime67 = require("react/jsx-runtime");
28165
28622
  var resolveDesignProps8 = (props) => {
28166
28623
  return {
28167
28624
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -28204,11 +28661,11 @@ var resolveDesignProps8 = (props) => {
28204
28661
  }
28205
28662
  };
28206
28663
  };
28207
- var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref) => {
28664
+ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref) => {
28208
28665
  const props = resolveDesignProps8(rest);
28209
28666
  const { t: t3 } = useTranslation();
28210
28667
  const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
28211
- const getCallToActionTarget = (0, import_react62.useCallback)(
28668
+ const getCallToActionTarget = (0, import_react63.useCallback)(
28212
28669
  (url, target) => {
28213
28670
  if (target) {
28214
28671
  return target;
@@ -28226,11 +28683,11 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28226
28683
  },
28227
28684
  []
28228
28685
  );
28229
- const [selectedPeriod, setSelectedPeriod] = (0, import_react62.useState)(
28686
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react63.useState)(
28230
28687
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28231
28688
  );
28232
28689
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28233
- const [selectedCurrency, setSelectedCurrency] = (0, import_react62.useState)(
28690
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react63.useState)(
28234
28691
  () => currencies[0] ?? DEFAULT_CURRENCY
28235
28692
  );
28236
28693
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -28248,25 +28705,25 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28248
28705
  } = useAvailablePlans(selectedPeriod, {
28249
28706
  useSelectedPeriod: showPeriodToggle
28250
28707
  });
28251
- const plans = (0, import_react62.useMemo)(
28708
+ const plans = (0, import_react63.useMemo)(
28252
28709
  () => hasCurrency ? allPlans.filter(
28253
28710
  (plan) => planSupportsCurrency(plan, selectedCurrency)
28254
28711
  ) : allPlans,
28255
28712
  [allPlans, hasCurrency, selectedCurrency]
28256
28713
  );
28257
- const addOns = (0, import_react62.useMemo)(
28714
+ const addOns = (0, import_react63.useMemo)(
28258
28715
  () => hasCurrency ? allAddOns.filter(
28259
28716
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
28260
28717
  ) : allAddOns,
28261
28718
  [allAddOns, hasCurrency, selectedCurrency]
28262
28719
  );
28263
- (0, import_react62.useEffect)(() => {
28720
+ (0, import_react63.useEffect)(() => {
28264
28721
  if (typeof data?.component === "undefined") {
28265
28722
  hydratePublic();
28266
28723
  }
28267
28724
  }, [data?.component, hydratePublic]);
28268
28725
  if (isPending) {
28269
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28726
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28270
28727
  Flex,
28271
28728
  {
28272
28729
  $width: "100%",
@@ -28274,12 +28731,12 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28274
28731
  $alignItems: "center",
28275
28732
  $justifyContent: "center",
28276
28733
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
28277
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
28734
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
28278
28735
  }
28279
28736
  );
28280
28737
  }
28281
28738
  if (hasNoUsableCurrency) {
28282
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28739
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28283
28740
  }
28284
28741
  const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
28285
28742
  const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
@@ -28287,8 +28744,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28287
28744
  rest.callToActionUrl,
28288
28745
  rest.callToActionTarget
28289
28746
  );
28290
- const Wrapper = typeof data?.component === "undefined" ? Container : import_react62.Fragment;
28291
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28747
+ const Wrapper = typeof data?.component === "undefined" ? Container : import_react63.Fragment;
28748
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
28292
28749
  FussyChild,
28293
28750
  {
28294
28751
  ref,
@@ -28298,8 +28755,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28298
28755
  $flexDirection: "column",
28299
28756
  $gap: "2rem",
28300
28757
  children: [
28301
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Box, { children: [
28302
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28758
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Box, { children: [
28759
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
28303
28760
  Flex,
28304
28761
  {
28305
28762
  $flexDirection: "column",
@@ -28314,7 +28771,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28314
28771
  }
28315
28772
  },
28316
28773
  children: [
28317
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28774
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28318
28775
  Text,
28319
28776
  {
28320
28777
  as: "h2",
@@ -28323,8 +28780,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28323
28780
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t3("Plans")
28324
28781
  }
28325
28782
  ),
28326
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28327
- showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28783
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28784
+ showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28328
28785
  CurrencyToggle,
28329
28786
  {
28330
28787
  currencies,
@@ -28332,7 +28789,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28332
28789
  onSelect: setSelectedCurrency
28333
28790
  }
28334
28791
  ),
28335
- showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28792
+ showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28336
28793
  PeriodToggle,
28337
28794
  {
28338
28795
  options: periods,
@@ -28349,7 +28806,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28349
28806
  ]
28350
28807
  }
28351
28808
  ),
28352
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28809
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28353
28810
  Box,
28354
28811
  {
28355
28812
  as: "ul",
@@ -28362,7 +28819,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28362
28819
  $listStyle: "none",
28363
28820
  children: plans.map((plan, index, self2) => {
28364
28821
  const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28365
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28822
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28366
28823
  Plan2,
28367
28824
  {
28368
28825
  plan,
@@ -28384,14 +28841,14 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28384
28841
  }
28385
28842
  )
28386
28843
  ] }),
28387
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28388
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28844
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
28845
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28389
28846
  Flex,
28390
28847
  {
28391
28848
  $justifyContent: "space-between",
28392
28849
  $alignItems: "center",
28393
28850
  $marginBottom: "1rem",
28394
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28851
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28395
28852
  Text,
28396
28853
  {
28397
28854
  as: "h2",
@@ -28402,7 +28859,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28402
28859
  )
28403
28860
  }
28404
28861
  ),
28405
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28862
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28406
28863
  Box,
28407
28864
  {
28408
28865
  as: "ul",
@@ -28414,7 +28871,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28414
28871
  $listStyle: "none",
28415
28872
  children: addOns.map((addOn, index) => {
28416
28873
  const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28417
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28874
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28418
28875
  AddOn2,
28419
28876
  {
28420
28877
  addOn,
@@ -28441,8 +28898,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
28441
28898
  PricingTable.displayName = "PricingTable";
28442
28899
 
28443
28900
  // src/components/elements/text/Text.tsx
28444
- var import_react63 = require("react");
28445
- var import_jsx_runtime67 = require("react/jsx-runtime");
28901
+ var import_react64 = require("react");
28902
+ var import_jsx_runtime68 = require("react/jsx-runtime");
28446
28903
  var resolveDesignProps9 = (props) => {
28447
28904
  return {
28448
28905
  text: {
@@ -28452,9 +28909,9 @@ var resolveDesignProps9 = (props) => {
28452
28909
  }
28453
28910
  };
28454
28911
  };
28455
- var TextElement = (0, import_react63.forwardRef)(({ children, className, ...rest }, ref) => {
28912
+ var TextElement = (0, import_react64.forwardRef)(({ children, className, ...rest }, ref) => {
28456
28913
  const props = resolveDesignProps9(rest);
28457
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28914
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28458
28915
  Text,
28459
28916
  {
28460
28917
  display: props.text.fontStyle,
@@ -28467,8 +28924,8 @@ var TextElement = (0, import_react63.forwardRef)(({ children, className, ...rest
28467
28924
  TextElement.displayName = "Text";
28468
28925
 
28469
28926
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28470
- var import_react64 = require("react");
28471
- var import_jsx_runtime68 = require("react/jsx-runtime");
28927
+ var import_react65 = require("react");
28928
+ var import_jsx_runtime69 = require("react/jsx-runtime");
28472
28929
  var buttonStyles = {
28473
28930
  primary: {
28474
28931
  color: "primary",
@@ -28494,17 +28951,17 @@ var resolveDesignProps10 = (props) => {
28494
28951
  }
28495
28952
  };
28496
28953
  };
28497
- var UnsubscribeButton = (0, import_react64.forwardRef)(({ children, className, ...rest }, ref) => {
28954
+ var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, ...rest }, ref) => {
28498
28955
  const props = resolveDesignProps10(rest);
28499
28956
  const { t: t3 } = useTranslation();
28500
28957
  const { data, setLayout } = useEmbed();
28501
- const hasActiveSubscription = (0, import_react64.useMemo)(() => {
28958
+ const hasActiveSubscription = (0, import_react65.useMemo)(() => {
28502
28959
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
28503
28960
  }, [data?.subscription]);
28504
28961
  if (!hasActiveSubscription) {
28505
28962
  return null;
28506
28963
  }
28507
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28964
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28508
28965
  Element,
28509
28966
  {
28510
28967
  as: Flex,
@@ -28512,7 +28969,7 @@ var UnsubscribeButton = (0, import_react64.forwardRef)(({ children, className, .
28512
28969
  className,
28513
28970
  $flexDirection: "column",
28514
28971
  $gap: "2rem",
28515
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28972
+ children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28516
28973
  Button,
28517
28974
  {
28518
28975
  type: "button",
@@ -28533,8 +28990,8 @@ var UnsubscribeButton = (0, import_react64.forwardRef)(({ children, className, .
28533
28990
  UnsubscribeButton.displayName = "UnsubscribeButton";
28534
28991
 
28535
28992
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
28536
- var import_react65 = require("react");
28537
- var import_jsx_runtime69 = require("react/jsx-runtime");
28993
+ var import_react66 = require("react");
28994
+ var import_jsx_runtime70 = require("react/jsx-runtime");
28538
28995
  function resolveDesignProps11(props) {
28539
28996
  return {
28540
28997
  header: {
@@ -28553,15 +29010,15 @@ function resolveDesignProps11(props) {
28553
29010
  }
28554
29011
  };
28555
29012
  }
28556
- var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref) => {
29013
+ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref) => {
28557
29014
  const props = resolveDesignProps11(rest);
28558
29015
  const { t: t3 } = useTranslation();
28559
29016
  const { data, settings, getUpcomingInvoice } = useEmbed();
28560
29017
  const isLightBackground = useIsLightBackground();
28561
- const [isLoading, setIsLoading] = (0, import_react65.useState)(false);
28562
- const [error, setError] = (0, import_react65.useState)();
28563
- const [upcomingInvoice, setUpcomingInvoice] = (0, import_react65.useState)(data?.upcomingInvoice);
28564
- const discounts = (0, import_react65.useMemo)(() => {
29018
+ const [isLoading, setIsLoading] = (0, import_react66.useState)(false);
29019
+ const [error, setError] = (0, import_react66.useState)();
29020
+ const [upcomingInvoice, setUpcomingInvoice] = (0, import_react66.useState)(data?.upcomingInvoice);
29021
+ const discounts = (0, import_react66.useMemo)(() => {
28565
29022
  return (data?.subscription?.discounts || []).filter(
28566
29023
  (discount) => (
28567
29024
  // Only surface discounts that are currently active and actually
@@ -28579,7 +29036,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28579
29036
  durationInMonths: discount.durationInMonths ?? void 0
28580
29037
  }));
28581
29038
  }, [data?.subscription?.discounts]);
28582
- const getInvoice = (0, import_react65.useCallback)(async () => {
29039
+ const getInvoice = (0, import_react66.useCallback)(async () => {
28583
29040
  if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
28584
29041
  try {
28585
29042
  setError(void 0);
@@ -28595,15 +29052,15 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28595
29052
  }
28596
29053
  }
28597
29054
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
28598
- (0, import_react65.useEffect)(() => {
29055
+ (0, import_react66.useEffect)(() => {
28599
29056
  getInvoice();
28600
29057
  }, [getInvoice]);
28601
- (0, import_react65.useEffect)(() => {
29058
+ (0, import_react66.useEffect)(() => {
28602
29059
  if (data?.upcomingInvoice) {
28603
29060
  setUpcomingInvoice(data.upcomingInvoice);
28604
29061
  }
28605
29062
  }, [data?.upcomingInvoice]);
28606
- const { currency, applied, remaining } = (0, import_react65.useMemo)(() => {
29063
+ const { currency, applied, remaining } = (0, import_react66.useMemo)(() => {
28607
29064
  const currency2 = upcomingInvoice?.currency;
28608
29065
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
28609
29066
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -28622,9 +29079,9 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28622
29079
  if (!data?.subscription || data.subscription.cancelAt) {
28623
29080
  return null;
28624
29081
  }
28625
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Element, { ref, className, children: [
28626
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
28627
- error ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29082
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Element, { ref, className, children: [
29083
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
29084
+ error ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28628
29085
  Flex,
28629
29086
  {
28630
29087
  as: TransitionBox,
@@ -28633,8 +29090,8 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28633
29090
  $alignItems: "center",
28634
29091
  $gap: "1rem",
28635
29092
  children: [
28636
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t3("There was a problem retrieving your upcoming invoice.") }),
28637
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
29093
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t3("There was a problem retrieving your upcoming invoice.") }),
29094
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28638
29095
  Button,
28639
29096
  {
28640
29097
  type: "button",
@@ -28647,28 +29104,28 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28647
29104
  )
28648
29105
  ]
28649
29106
  }
28650
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
28651
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Text, { display: props.header.fontStyle, children: [
29107
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
29108
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Text, { display: props.header.fontStyle, children: [
28652
29109
  props.header.prefix,
28653
29110
  " ",
28654
29111
  toPrettyDate(upcomingInvoice.dueDate)
28655
29112
  ] }),
28656
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29113
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28657
29114
  Flex,
28658
29115
  {
28659
29116
  $justifyContent: "space-between",
28660
29117
  $alignItems: "start",
28661
29118
  $gap: "1rem",
28662
29119
  children: [
28663
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
29120
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
28664
29121
  upcomingInvoice.amountDue,
28665
29122
  upcomingInvoice.currency
28666
29123
  ) }),
28667
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t3("Estimated bill") }) })
29124
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t3("Estimated bill") }) })
28668
29125
  ]
28669
29126
  }
28670
29127
  ),
28671
- hasApplied && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29128
+ hasApplied && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28672
29129
  Flex,
28673
29130
  {
28674
29131
  as: TransitionBox,
@@ -28676,12 +29133,12 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28676
29133
  $alignItems: "start",
28677
29134
  $gap: "1rem",
28678
29135
  children: [
28679
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t3("Applied balance towards next invoice") }),
28680
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: formatCurrency(-applied, currency) })
29136
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Applied balance towards next invoice") }),
29137
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(-applied, currency) })
28681
29138
  ]
28682
29139
  }
28683
29140
  ),
28684
- hasBalance && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29141
+ hasBalance && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28685
29142
  Flex,
28686
29143
  {
28687
29144
  as: TransitionBox,
@@ -28689,20 +29146,20 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28689
29146
  $alignItems: "start",
28690
29147
  $gap: "1rem",
28691
29148
  children: [
28692
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t3("Remaining balance after next invoice") }),
28693
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: formatCurrency(remaining, currency) })
29149
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Remaining balance after next invoice") }),
29150
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(remaining, currency) })
28694
29151
  ]
28695
29152
  }
28696
29153
  ),
28697
- discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29154
+ discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28698
29155
  Flex,
28699
29156
  {
28700
29157
  $justifyContent: "space-between",
28701
29158
  $alignItems: "start",
28702
29159
  $gap: "1rem",
28703
29160
  children: [
28704
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t3("Discount") }),
28705
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
29161
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Discount") }),
29162
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28706
29163
  Flex,
28707
29164
  {
28708
29165
  $flexDirection: "column",
@@ -28718,13 +29175,13 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28718
29175
  discount?.currency
28719
29176
  )
28720
29177
  });
28721
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
29178
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28722
29179
  Flex,
28723
29180
  {
28724
29181
  $alignItems: "center",
28725
29182
  $gap: "0.5rem",
28726
29183
  children: [
28727
- discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
29184
+ discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28728
29185
  Flex,
28729
29186
  {
28730
29187
  $alignItems: "center",
@@ -28733,7 +29190,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28733
29190
  $borderStyle: "solid",
28734
29191
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
28735
29192
  $borderRadius: "0.3125rem",
28736
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
29193
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28737
29194
  Text,
28738
29195
  {
28739
29196
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -28743,7 +29200,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28743
29200
  )
28744
29201
  }
28745
29202
  ),
28746
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t3("Discount for months", {
29203
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t3("Discount for months", {
28747
29204
  discount: label,
28748
29205
  count: discount.durationInMonths
28749
29206
  }) : label }) })
@@ -28757,7 +29214,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
28757
29214
  ]
28758
29215
  }
28759
29216
  )
28760
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: "heading2", children: t3("No upcoming invoice") }) })
29217
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading2", children: t3("No upcoming invoice") }) })
28761
29218
  ] });
28762
29219
  });
28763
29220
  UpcomingBill.displayName = "UpcomingBill";
@@ -31393,11 +31850,11 @@ function inflate(input, options = {}) {
31393
31850
  }
31394
31851
 
31395
31852
  // src/components/embed/Embed.tsx
31396
- var import_react67 = require("react");
31853
+ var import_react68 = require("react");
31397
31854
  var import_styled_components23 = __toESM(require_styled_components_cjs());
31398
31855
 
31399
31856
  // src/components/embed/renderer.ts
31400
- var import_react66 = require("react");
31857
+ var import_react67 = require("react");
31401
31858
  var components = {
31402
31859
  Root,
31403
31860
  Viewport,
@@ -31461,7 +31918,7 @@ function createRenderer(options) {
31461
31918
  const { className, ...rest } = props;
31462
31919
  const resolvedProps = component === "div" ? rest : props;
31463
31920
  const resolvedChildren = children.map(renderNode);
31464
- return (0, import_react66.createElement)(
31921
+ return (0, import_react67.createElement)(
31465
31922
  component,
31466
31923
  {
31467
31924
  key: index,
@@ -31474,11 +31931,11 @@ function createRenderer(options) {
31474
31931
  }
31475
31932
 
31476
31933
  // src/components/embed/Embed.tsx
31477
- var import_jsx_runtime70 = require("react/jsx-runtime");
31934
+ var import_jsx_runtime71 = require("react/jsx-runtime");
31478
31935
  var renderer = createRenderer();
31479
31936
  var Loading = () => {
31480
31937
  const { settings } = useEmbed();
31481
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
31938
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
31482
31939
  Flex,
31483
31940
  {
31484
31941
  $width: "100%",
@@ -31486,13 +31943,13 @@ var Loading = () => {
31486
31943
  $alignItems: "center",
31487
31944
  $justifyContent: "center",
31488
31945
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
31489
- children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
31946
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
31490
31947
  }
31491
31948
  );
31492
31949
  };
31493
31950
  var Error2 = ({ message }) => {
31494
31951
  const { settings } = useEmbed();
31495
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
31952
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
31496
31953
  Flex,
31497
31954
  {
31498
31955
  $flexDirection: "column",
@@ -31503,14 +31960,14 @@ var Error2 = ({ message }) => {
31503
31960
  $alignItems: "center",
31504
31961
  $justifyContent: "center",
31505
31962
  children: [
31506
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading1", children: "Error" }) }),
31507
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: message }) })
31963
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { display: "heading1", children: "Error" }) }),
31964
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: message }) })
31508
31965
  ]
31509
31966
  }
31510
31967
  );
31511
31968
  };
31512
31969
  var SchematicEmbed = ({ id, accessToken }) => {
31513
- const theme = (0, import_react67.useContext)(import_styled_components23.ThemeContext);
31970
+ const theme = (0, import_react68.useContext)(import_styled_components23.ThemeContext);
31514
31971
  const {
31515
31972
  data,
31516
31973
  error,
@@ -31522,7 +31979,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31522
31979
  setBuilderSettings
31523
31980
  } = useEmbed();
31524
31981
  const compressedAst = data?.component?.ast;
31525
- const { children, parsedSettings, parseError } = (0, import_react67.useMemo)(() => {
31982
+ const { children, parsedSettings, parseError } = (0, import_react68.useMemo)(() => {
31526
31983
  let children2 = null;
31527
31984
  let parsedSettings2 = null;
31528
31985
  let parseError2 = null;
@@ -31554,22 +32011,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
31554
32011
  parseError: parseError2
31555
32012
  };
31556
32013
  }, [compressedAst]);
31557
- (0, import_react67.useEffect)(() => {
32014
+ (0, import_react68.useEffect)(() => {
31558
32015
  if (accessToken) {
31559
32016
  setAccessToken(accessToken);
31560
32017
  }
31561
32018
  }, [accessToken, setAccessToken]);
31562
- (0, import_react67.useEffect)(() => {
32019
+ (0, import_react68.useEffect)(() => {
31563
32020
  if (id && stale) {
31564
32021
  hydrateComponent(id);
31565
32022
  }
31566
32023
  }, [id, hydrateComponent, stale]);
31567
- (0, import_react67.useEffect)(() => {
32024
+ (0, import_react68.useEffect)(() => {
31568
32025
  if (parsedSettings) {
31569
32026
  setBuilderSettings(parsedSettings);
31570
32027
  }
31571
32028
  }, [parsedSettings, setBuilderSettings]);
31572
- (0, import_react67.useEffect)(() => {
32029
+ (0, import_react68.useEffect)(() => {
31573
32030
  if (parseError) {
31574
32031
  setError(parseError);
31575
32032
  }
@@ -31578,13 +32035,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
31578
32035
  return stub();
31579
32036
  }
31580
32037
  if (error) {
31581
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Error2, { message: error.message });
32038
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: error.message });
31582
32039
  }
31583
32040
  if (accessToken?.length === 0) {
31584
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Error2, { message: "Please provide an access token." });
32041
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: "Please provide an access token." });
31585
32042
  }
31586
32043
  if (!accessToken?.startsWith("token_")) {
31587
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
32044
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
31588
32045
  Error2,
31589
32046
  {
31590
32047
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -31592,7 +32049,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31592
32049
  );
31593
32050
  }
31594
32051
  if (isPending) {
31595
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loading, {});
32052
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {});
31596
32053
  }
31597
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loading, {}) });
32054
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {}) });
31598
32055
  };