@schematichq/schematic-components 2.37.0 → 2.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2034,6 +2034,7 @@ var initialContext = {
2034
2034
  getUpcomingInvoice: stub,
2035
2035
  getCustomerBalance: stub,
2036
2036
  listInvoices: stub,
2037
+ getInvoiceLink: stub,
2037
2038
  getCreditUsageByUser: stub,
2038
2039
  getFeatureUsageByUser: stub,
2039
2040
  createSetupIntent: stub,
@@ -4706,6 +4707,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
4706
4707
  quantity: json["quantity"],
4707
4708
  subscriptionId: json["subscription_id"],
4708
4709
  subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
4710
+ tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
4709
4711
  updatedAt: new Date(json["updated_at"]),
4710
4712
  usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
4711
4713
  };
@@ -6183,6 +6185,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
6183
6185
  };
6184
6186
  }
6185
6187
 
6188
+ // src/api/checkoutexternal/models/CompanyCreditLedgerBundleResponseData.ts
6189
+ function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
6190
+ return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
6191
+ }
6192
+ function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6193
+ if (json == null) {
6194
+ return json;
6195
+ }
6196
+ return {
6197
+ id: json["id"],
6198
+ name: json["name"]
6199
+ };
6200
+ }
6201
+
6202
+ // src/api/checkoutexternal/models/CompanyCreditLedgerCreditResponseData.ts
6203
+ function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
6204
+ return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
6205
+ }
6206
+ function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6207
+ if (json == null) {
6208
+ return json;
6209
+ }
6210
+ return {
6211
+ id: json["id"],
6212
+ name: json["name"],
6213
+ pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
6214
+ singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
6215
+ };
6216
+ }
6217
+
6218
+ // src/api/checkoutexternal/models/CreditUsageReason.ts
6219
+ function CreditUsageReasonFromJSON(json) {
6220
+ return CreditUsageReasonFromJSONTyped(json, false);
6221
+ }
6222
+ function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
6223
+ return json;
6224
+ }
6225
+
6226
+ // src/api/checkoutexternal/models/CompanyCreditLedgerUserResponseData.ts
6227
+ function CompanyCreditLedgerUserResponseDataFromJSON(json) {
6228
+ return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
6229
+ }
6230
+ function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6231
+ if (json == null) {
6232
+ return json;
6233
+ }
6234
+ return {
6235
+ id: json["id"],
6236
+ name: json["name"]
6237
+ };
6238
+ }
6239
+
6240
+ // src/api/checkoutexternal/models/CompanyCreditLedgerFeatureResponseData.ts
6241
+ function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
6242
+ return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
6243
+ }
6244
+ function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6245
+ if (json == null) {
6246
+ return json;
6247
+ }
6248
+ return {
6249
+ id: json["id"],
6250
+ name: json["name"]
6251
+ };
6252
+ }
6253
+
6254
+ // src/api/checkoutexternal/models/CreditLedgerEntryKind.ts
6255
+ function CreditLedgerEntryKindFromJSON(json) {
6256
+ return CreditLedgerEntryKindFromJSONTyped(json, false);
6257
+ }
6258
+ function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
6259
+ return json;
6260
+ }
6261
+
6262
+ // src/api/checkoutexternal/models/CompanyCreditLedgerEntryResponseData.ts
6263
+ function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
6264
+ return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
6265
+ }
6266
+ function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6267
+ if (json == null) {
6268
+ return json;
6269
+ }
6270
+ return {
6271
+ amount: json["amount"],
6272
+ bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
6273
+ credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
6274
+ eventAt: new Date(json["event_at"]),
6275
+ feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
6276
+ grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
6277
+ id: json["id"],
6278
+ kind: CreditLedgerEntryKindFromJSON(json["kind"]),
6279
+ usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
6280
+ user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
6281
+ zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
6282
+ };
6283
+ }
6284
+
6285
+ // src/api/checkoutexternal/models/CompanyCreditLedgerResponseData.ts
6286
+ function CompanyCreditLedgerResponseDataFromJSON(json) {
6287
+ return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
6288
+ }
6289
+ function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
6290
+ if (json == null) {
6291
+ return json;
6292
+ }
6293
+ return {
6294
+ entries: json["entries"].map(
6295
+ CompanyCreditLedgerEntryResponseDataFromJSON
6296
+ ),
6297
+ nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
6298
+ };
6299
+ }
6300
+
6186
6301
  // src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
6187
6302
  function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
6188
6303
  return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
@@ -6416,7 +6531,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
6416
6531
  fromSubscriptionPrice: json["from_subscription_price"],
6417
6532
  id: json["id"],
6418
6533
  interval: json["interval"],
6534
+ intervalCount: json["interval_count"],
6419
6535
  scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
6536
+ scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
6420
6537
  scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
6421
6538
  toPlanId: json["to_plan_id"],
6422
6539
  toPlanName: json["to_plan_name"]
@@ -7572,6 +7689,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
7572
7689
  };
7573
7690
  }
7574
7691
 
7692
+ // src/api/checkoutexternal/models/RenewalDestinationResponseData.ts
7693
+ function RenewalDestinationResponseDataFromJSON(json) {
7694
+ return RenewalDestinationResponseDataFromJSONTyped(json, false);
7695
+ }
7696
+ function RenewalDestinationResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7697
+ if (json == null) {
7698
+ return json;
7699
+ }
7700
+ return {
7701
+ billingPeriod: PlanPriceCadenceFromJSON(json["billing_period"]),
7702
+ planId: json["plan_id"]
7703
+ };
7704
+ }
7705
+
7575
7706
  // src/api/checkoutexternal/models/RenewalPolicy.ts
7576
7707
  function RenewalPolicyFromJSON(json) {
7577
7708
  return RenewalPolicyFromJSONTyped(json, false);
@@ -7597,6 +7728,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
7597
7728
  name: json["name"],
7598
7729
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
7599
7730
  planType: PlanTypeFromJSON(json["plan_type"]),
7731
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
7600
7732
  renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
7601
7733
  status: PlanVersionStatusFromJSON(json["status"]),
7602
7734
  updatedAt: new Date(json["updated_at"]),
@@ -7800,6 +7932,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
7800
7932
  ),
7801
7933
  expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
7802
7934
  interval: json["interval"],
7935
+ intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
7803
7936
  isInitial: json["is_initial"],
7804
7937
  latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
7805
7938
  pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
@@ -8276,6 +8409,84 @@ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
8276
8409
  };
8277
8410
  }
8278
8411
 
8412
+ // src/api/checkoutexternal/models/CreditSpendWindowUnit.ts
8413
+ function CreditSpendWindowUnitFromJSON(json) {
8414
+ return CreditSpendWindowUnitFromJSONTyped(json, false);
8415
+ }
8416
+ function CreditSpendWindowUnitFromJSONTyped(json, ignoreDiscriminator) {
8417
+ return json;
8418
+ }
8419
+ function CreditSpendWindowUnitToJSON(value) {
8420
+ return value;
8421
+ }
8422
+
8423
+ // src/api/checkoutexternal/models/CreateCompanySpendPolicyRequestBody.ts
8424
+ function CreateCompanySpendPolicyRequestBodyToJSON(json) {
8425
+ return CreateCompanySpendPolicyRequestBodyToJSONTyped(json, false);
8426
+ }
8427
+ function CreateCompanySpendPolicyRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
8428
+ if (value == null) {
8429
+ return value;
8430
+ }
8431
+ return {
8432
+ billing_credit_id: value["billingCreditId"],
8433
+ label: value["label"],
8434
+ max_per_draw: value["maxPerDraw"],
8435
+ user_id: value["userId"],
8436
+ window_amount: value["windowAmount"],
8437
+ window_unit: CreditSpendWindowUnitToJSON(value["windowUnit"])
8438
+ };
8439
+ }
8440
+
8441
+ // src/api/checkoutexternal/models/CreditSpendPolicyScope.ts
8442
+ function CreditSpendPolicyScopeFromJSON(json) {
8443
+ return CreditSpendPolicyScopeFromJSONTyped(json, false);
8444
+ }
8445
+ function CreditSpendPolicyScopeFromJSONTyped(json, ignoreDiscriminator) {
8446
+ return json;
8447
+ }
8448
+
8449
+ // src/api/checkoutexternal/models/CreditSpendPolicyResponseData.ts
8450
+ function CreditSpendPolicyResponseDataFromJSON(json) {
8451
+ return CreditSpendPolicyResponseDataFromJSONTyped(json, false);
8452
+ }
8453
+ function CreditSpendPolicyResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8454
+ if (json == null) {
8455
+ return json;
8456
+ }
8457
+ return {
8458
+ billingCreditId: json["billing_credit_id"],
8459
+ companyId: json["company_id"] == null ? void 0 : json["company_id"],
8460
+ consumed: json["consumed"] == null ? void 0 : json["consumed"],
8461
+ createdAt: new Date(json["created_at"]),
8462
+ headroom: json["headroom"] == null ? void 0 : json["headroom"],
8463
+ id: json["id"],
8464
+ label: json["label"] == null ? void 0 : json["label"],
8465
+ maxPerDraw: json["max_per_draw"] == null ? void 0 : json["max_per_draw"],
8466
+ resetsAt: json["resets_at"] == null ? void 0 : new Date(json["resets_at"]),
8467
+ scopeType: CreditSpendPolicyScopeFromJSON(json["scope_type"]),
8468
+ updatedAt: new Date(json["updated_at"]),
8469
+ userId: json["user_id"] == null ? void 0 : json["user_id"],
8470
+ windowAmount: json["window_amount"] == null ? void 0 : json["window_amount"],
8471
+ windowCount: json["window_count"],
8472
+ windowUnit: json["window_unit"] == null ? void 0 : CreditSpendWindowUnitFromJSON(json["window_unit"])
8473
+ };
8474
+ }
8475
+
8476
+ // src/api/checkoutexternal/models/CreateCompanySpendPolicyResponse.ts
8477
+ function CreateCompanySpendPolicyResponseFromJSON(json) {
8478
+ return CreateCompanySpendPolicyResponseFromJSONTyped(json, false);
8479
+ }
8480
+ function CreateCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
8481
+ if (json == null) {
8482
+ return json;
8483
+ }
8484
+ return {
8485
+ data: CreditSpendPolicyResponseDataFromJSON(json["data"]),
8486
+ params: json["params"]
8487
+ };
8488
+ }
8489
+
8279
8490
  // src/api/checkoutexternal/models/SetupIntentResponseData.ts
8280
8491
  function SetupIntentResponseDataFromJSON(json) {
8281
8492
  return SetupIntentResponseDataFromJSONTyped(json, false);
@@ -8364,6 +8575,20 @@ function CreditUserUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
8364
8575
  };
8365
8576
  }
8366
8577
 
8578
+ // src/api/checkoutexternal/models/DeleteCompanySpendPolicyResponse.ts
8579
+ function DeleteCompanySpendPolicyResponseFromJSON(json) {
8580
+ return DeleteCompanySpendPolicyResponseFromJSONTyped(json, false);
8581
+ }
8582
+ function DeleteCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
8583
+ if (json == null) {
8584
+ return json;
8585
+ }
8586
+ return {
8587
+ data: DeleteResponseFromJSON(json["data"]),
8588
+ params: json["params"]
8589
+ };
8590
+ }
8591
+
8367
8592
  // src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
8368
8593
  function DeletePaymentMethodResponseFromJSON(json) {
8369
8594
  return DeletePaymentMethodResponseFromJSONTyped(json, false);
@@ -8541,6 +8766,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
8541
8766
  };
8542
8767
  }
8543
8768
 
8769
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerParams.ts
8770
+ function GetCompanyCreditLedgerParamsFromJSON(json) {
8771
+ return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
8772
+ }
8773
+ function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
8774
+ if (json == null) {
8775
+ return json;
8776
+ }
8777
+ return {
8778
+ creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
8779
+ cursor: json["cursor"] == null ? void 0 : json["cursor"],
8780
+ includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
8781
+ limit: json["limit"] == null ? void 0 : json["limit"]
8782
+ };
8783
+ }
8784
+
8785
+ // src/api/checkoutexternal/models/GetCompanyCreditLedgerResponse.ts
8786
+ function GetCompanyCreditLedgerResponseFromJSON(json) {
8787
+ return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
8788
+ }
8789
+ function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
8790
+ if (json == null) {
8791
+ return json;
8792
+ }
8793
+ return {
8794
+ data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
8795
+ params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
8796
+ };
8797
+ }
8798
+
8544
8799
  // src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
8545
8800
  function GetCompanyCreditUserUsageParamsFromJSON(json) {
8546
8801
  return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
@@ -8738,6 +8993,34 @@ function GetFeatureUsageByUserResponseFromJSONTyped(json, ignoreDiscriminator) {
8738
8993
  };
8739
8994
  }
8740
8995
 
8996
+ // src/api/checkoutexternal/models/InvoiceLink.ts
8997
+ function InvoiceLinkFromJSON(json) {
8998
+ return InvoiceLinkFromJSONTyped(json, false);
8999
+ }
9000
+ function InvoiceLinkFromJSONTyped(json, ignoreDiscriminator) {
9001
+ if (json == null) {
9002
+ return json;
9003
+ }
9004
+ return {
9005
+ id: json["id"],
9006
+ url: json["url"]
9007
+ };
9008
+ }
9009
+
9010
+ // src/api/checkoutexternal/models/GetInvoiceLinkResponse.ts
9011
+ function GetInvoiceLinkResponseFromJSON(json) {
9012
+ return GetInvoiceLinkResponseFromJSONTyped(json, false);
9013
+ }
9014
+ function GetInvoiceLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
9015
+ if (json == null) {
9016
+ return json;
9017
+ }
9018
+ return {
9019
+ data: InvoiceLinkFromJSON(json["data"]),
9020
+ params: json["params"]
9021
+ };
9022
+ }
9023
+
8741
9024
  // src/api/checkoutexternal/models/GetSetupIntentResponse.ts
8742
9025
  function GetSetupIntentResponseFromJSON(json) {
8743
9026
  return GetSetupIntentResponseFromJSONTyped(json, false);
@@ -8851,6 +9134,35 @@ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
8851
9134
  };
8852
9135
  }
8853
9136
 
9137
+ // src/api/checkoutexternal/models/ListCompanySpendPoliciesParams.ts
9138
+ function ListCompanySpendPoliciesParamsFromJSON(json) {
9139
+ return ListCompanySpendPoliciesParamsFromJSONTyped(json, false);
9140
+ }
9141
+ function ListCompanySpendPoliciesParamsFromJSONTyped(json, ignoreDiscriminator) {
9142
+ if (json == null) {
9143
+ return json;
9144
+ }
9145
+ return {
9146
+ billingCreditId: json["billing_credit_id"] == null ? void 0 : json["billing_credit_id"]
9147
+ };
9148
+ }
9149
+
9150
+ // src/api/checkoutexternal/models/ListCompanySpendPoliciesResponse.ts
9151
+ function ListCompanySpendPoliciesResponseFromJSON(json) {
9152
+ return ListCompanySpendPoliciesResponseFromJSONTyped(json, false);
9153
+ }
9154
+ function ListCompanySpendPoliciesResponseFromJSONTyped(json, ignoreDiscriminator) {
9155
+ if (json == null) {
9156
+ return json;
9157
+ }
9158
+ return {
9159
+ data: json["data"].map(
9160
+ CreditSpendPolicyResponseDataFromJSON
9161
+ ),
9162
+ params: ListCompanySpendPoliciesParamsFromJSON(json["params"])
9163
+ };
9164
+ }
9165
+
8854
9166
  // src/api/checkoutexternal/models/ListInvoicesParams.ts
8855
9167
  function ListInvoicesParamsFromJSON(json) {
8856
9168
  return ListInvoicesParamsFromJSONTyped(json, false);
@@ -9023,6 +9335,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
9023
9335
  proration: json["proration"],
9024
9336
  scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
9025
9337
  trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
9338
+ unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
9026
9339
  usageViolations: json["usage_violations"].map(
9027
9340
  FeatureUsageResponseDataFromJSON
9028
9341
  )
@@ -9181,6 +9494,36 @@ function UpdateCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
9181
9494
  };
9182
9495
  }
9183
9496
 
9497
+ // src/api/checkoutexternal/models/UpdateCompanySpendPolicyResponse.ts
9498
+ function UpdateCompanySpendPolicyResponseFromJSON(json) {
9499
+ return UpdateCompanySpendPolicyResponseFromJSONTyped(json, false);
9500
+ }
9501
+ function UpdateCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
9502
+ if (json == null) {
9503
+ return json;
9504
+ }
9505
+ return {
9506
+ data: CreditSpendPolicyResponseDataFromJSON(json["data"]),
9507
+ params: json["params"]
9508
+ };
9509
+ }
9510
+
9511
+ // src/api/checkoutexternal/models/UpdateCreditSpendPolicyRequestBody.ts
9512
+ function UpdateCreditSpendPolicyRequestBodyToJSON(json) {
9513
+ return UpdateCreditSpendPolicyRequestBodyToJSONTyped(json, false);
9514
+ }
9515
+ function UpdateCreditSpendPolicyRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
9516
+ if (value == null) {
9517
+ return value;
9518
+ }
9519
+ return {
9520
+ label: value["label"],
9521
+ max_per_draw: value["maxPerDraw"],
9522
+ window_amount: value["windowAmount"],
9523
+ window_unit: CreditSpendWindowUnitToJSON(value["windowUnit"])
9524
+ };
9525
+ }
9526
+
9184
9527
  // src/api/checkoutexternal/models/UpdatePaymentMethodRequestBody.ts
9185
9528
  function UpdatePaymentMethodRequestBodyToJSON(json) {
9186
9529
  return UpdatePaymentMethodRequestBodyToJSONTyped(json, false);
@@ -9338,6 +9681,51 @@ var CheckoutexternalApi = class extends BaseAPI {
9338
9681
  );
9339
9682
  return await response.value();
9340
9683
  }
9684
+ /**
9685
+ * Create company spend policy
9686
+ */
9687
+ async createCompanySpendPolicyRaw(requestParameters, initOverrides) {
9688
+ if (requestParameters["createCompanySpendPolicyRequestBody"] == null) {
9689
+ throw new RequiredError(
9690
+ "createCompanySpendPolicyRequestBody",
9691
+ 'Required parameter "createCompanySpendPolicyRequestBody" was null or undefined when calling createCompanySpendPolicy().'
9692
+ );
9693
+ }
9694
+ const queryParameters = {};
9695
+ const headerParameters = {};
9696
+ headerParameters["Content-Type"] = "application/json";
9697
+ if (this.configuration && this.configuration.apiKey) {
9698
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
9699
+ "X-Schematic-Api-Key"
9700
+ );
9701
+ }
9702
+ const response = await this.request(
9703
+ {
9704
+ path: `/company/credits/spend-policies`,
9705
+ method: "POST",
9706
+ headers: headerParameters,
9707
+ query: queryParameters,
9708
+ body: CreateCompanySpendPolicyRequestBodyToJSON(
9709
+ requestParameters["createCompanySpendPolicyRequestBody"]
9710
+ )
9711
+ },
9712
+ initOverrides
9713
+ );
9714
+ return new JSONApiResponse(
9715
+ response,
9716
+ (jsonValue) => CreateCompanySpendPolicyResponseFromJSON(jsonValue)
9717
+ );
9718
+ }
9719
+ /**
9720
+ * Create company spend policy
9721
+ */
9722
+ async createCompanySpendPolicy(requestParameters, initOverrides) {
9723
+ const response = await this.createCompanySpendPolicyRaw(
9724
+ requestParameters,
9725
+ initOverrides
9726
+ );
9727
+ return await response.value();
9728
+ }
9341
9729
  /**
9342
9730
  * A Stripe SetupIntent for collecting a new payment method with Stripe\'s Payment Element. Confirm it with `stripe.confirmSetup`; the method it saves joins the company\'s methods on file.
9343
9731
  * Create a setup intent
@@ -9372,6 +9760,50 @@ var CheckoutexternalApi = class extends BaseAPI {
9372
9760
  const response = await this.createSetupIntentRaw(initOverrides);
9373
9761
  return await response.value();
9374
9762
  }
9763
+ /**
9764
+ * Delete company spend policy
9765
+ */
9766
+ async deleteCompanySpendPolicyRaw(requestParameters, initOverrides) {
9767
+ if (requestParameters["spendPolicyId"] == null) {
9768
+ throw new RequiredError(
9769
+ "spendPolicyId",
9770
+ 'Required parameter "spendPolicyId" was null or undefined when calling deleteCompanySpendPolicy().'
9771
+ );
9772
+ }
9773
+ const queryParameters = {};
9774
+ const headerParameters = {};
9775
+ if (this.configuration && this.configuration.apiKey) {
9776
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
9777
+ "X-Schematic-Api-Key"
9778
+ );
9779
+ }
9780
+ const response = await this.request(
9781
+ {
9782
+ path: `/company/credits/spend-policies/{spend_policy_id}`.replace(
9783
+ `{${"spend_policy_id"}}`,
9784
+ encodeURIComponent(String(requestParameters["spendPolicyId"]))
9785
+ ),
9786
+ method: "DELETE",
9787
+ headers: headerParameters,
9788
+ query: queryParameters
9789
+ },
9790
+ initOverrides
9791
+ );
9792
+ return new JSONApiResponse(
9793
+ response,
9794
+ (jsonValue) => DeleteCompanySpendPolicyResponseFromJSON(jsonValue)
9795
+ );
9796
+ }
9797
+ /**
9798
+ * Delete company spend policy
9799
+ */
9800
+ async deleteCompanySpendPolicy(requestParameters, initOverrides) {
9801
+ const response = await this.deleteCompanySpendPolicyRaw(
9802
+ requestParameters,
9803
+ initOverrides
9804
+ );
9805
+ return await response.value();
9806
+ }
9375
9807
  /**
9376
9808
  * Detaches a payment method from the company\'s billing customer. The path parameter is the payment method\'s `id` from the list, not a checkout\'s; `usePaymentMethods().remove` calls this and reloads the list. The list says whether each method can be removed.
9377
9809
  * Remove a payment method
@@ -9739,6 +10171,55 @@ var CheckoutexternalApi = class extends BaseAPI {
9739
10171
  const response = await this.getCompanyCreditBalancesRaw(initOverrides);
9740
10172
  return await response.value();
9741
10173
  }
10174
+ /**
10175
+ * The company\'s credit activity, newest first: draws by feature and user, grants, and credits removed when they expired or reset. A draw written against several grants is one entry. Pass the response\'s `next_cursor` as `cursor` to read the next page.
10176
+ * List credit activity
10177
+ */
10178
+ async getCompanyCreditLedgerRaw(requestParameters, initOverrides) {
10179
+ const queryParameters = {};
10180
+ if (requestParameters["creditIds"] != null) {
10181
+ queryParameters["credit_ids"] = requestParameters["creditIds"];
10182
+ }
10183
+ if (requestParameters["cursor"] != null) {
10184
+ queryParameters["cursor"] = requestParameters["cursor"];
10185
+ }
10186
+ if (requestParameters["includeGrants"] != null) {
10187
+ queryParameters["include_grants"] = requestParameters["includeGrants"];
10188
+ }
10189
+ if (requestParameters["limit"] != null) {
10190
+ queryParameters["limit"] = requestParameters["limit"];
10191
+ }
10192
+ const headerParameters = {};
10193
+ if (this.configuration && this.configuration.apiKey) {
10194
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
10195
+ "X-Schematic-Api-Key"
10196
+ );
10197
+ }
10198
+ const response = await this.request(
10199
+ {
10200
+ path: `/company/credits/ledger`,
10201
+ method: "GET",
10202
+ headers: headerParameters,
10203
+ query: queryParameters
10204
+ },
10205
+ initOverrides
10206
+ );
10207
+ return new JSONApiResponse(
10208
+ response,
10209
+ (jsonValue) => GetCompanyCreditLedgerResponseFromJSON(jsonValue)
10210
+ );
10211
+ }
10212
+ /**
10213
+ * The company\'s credit activity, newest first: draws by feature and user, grants, and credits removed when they expired or reset. A draw written against several grants is one entry. Pass the response\'s `next_cursor` as `cursor` to read the next page.
10214
+ * List credit activity
10215
+ */
10216
+ async getCompanyCreditLedger(requestParameters = {}, initOverrides) {
10217
+ const response = await this.getCompanyCreditLedgerRaw(
10218
+ requestParameters,
10219
+ initOverrides
10220
+ );
10221
+ return await response.value();
10222
+ }
9742
10223
  /**
9743
10224
  * Who in the company consumed the credit, and how much each.
9744
10225
  * List credit usage by user
@@ -10098,6 +10579,50 @@ var CheckoutexternalApi = class extends BaseAPI {
10098
10579
  );
10099
10580
  return await response.value();
10100
10581
  }
10582
+ /**
10583
+ * Get invoice link
10584
+ */
10585
+ async getInvoiceLinkRaw(requestParameters, initOverrides) {
10586
+ if (requestParameters["billingInvoiceId"] == null) {
10587
+ throw new RequiredError(
10588
+ "billingInvoiceId",
10589
+ 'Required parameter "billingInvoiceId" was null or undefined when calling getInvoiceLink().'
10590
+ );
10591
+ }
10592
+ const queryParameters = {};
10593
+ const headerParameters = {};
10594
+ if (this.configuration && this.configuration.apiKey) {
10595
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
10596
+ "X-Schematic-Api-Key"
10597
+ );
10598
+ }
10599
+ const response = await this.request(
10600
+ {
10601
+ path: `/components/invoices/{billing_invoice_id}/link`.replace(
10602
+ `{${"billing_invoice_id"}}`,
10603
+ encodeURIComponent(String(requestParameters["billingInvoiceId"]))
10604
+ ),
10605
+ method: "GET",
10606
+ headers: headerParameters,
10607
+ query: queryParameters
10608
+ },
10609
+ initOverrides
10610
+ );
10611
+ return new JSONApiResponse(
10612
+ response,
10613
+ (jsonValue) => GetInvoiceLinkResponseFromJSON(jsonValue)
10614
+ );
10615
+ }
10616
+ /**
10617
+ * Get invoice link
10618
+ */
10619
+ async getInvoiceLink(requestParameters, initOverrides) {
10620
+ const response = await this.getInvoiceLinkRaw(
10621
+ requestParameters,
10622
+ initOverrides
10623
+ );
10624
+ return await response.value();
10625
+ }
10101
10626
  /**
10102
10627
  * Get setup intent
10103
10628
  */
@@ -10275,19 +10800,58 @@ var CheckoutexternalApi = class extends BaseAPI {
10275
10800
  * The checkouts this session opened for the token\'s company. Filter by `statuses`.
10276
10801
  * List checkouts
10277
10802
  */
10278
- async listCheckoutsRaw(requestParameters, initOverrides) {
10803
+ async listCheckoutsRaw(requestParameters, initOverrides) {
10804
+ const queryParameters = {};
10805
+ if (requestParameters["companyId"] != null) {
10806
+ queryParameters["company_id"] = requestParameters["companyId"];
10807
+ }
10808
+ if (requestParameters["statuses"] != null) {
10809
+ queryParameters["statuses"] = requestParameters["statuses"];
10810
+ }
10811
+ if (requestParameters["limit"] != null) {
10812
+ queryParameters["limit"] = requestParameters["limit"];
10813
+ }
10814
+ if (requestParameters["offset"] != null) {
10815
+ queryParameters["offset"] = requestParameters["offset"];
10816
+ }
10817
+ const headerParameters = {};
10818
+ if (this.configuration && this.configuration.apiKey) {
10819
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
10820
+ "X-Schematic-Api-Key"
10821
+ );
10822
+ }
10823
+ const response = await this.request(
10824
+ {
10825
+ path: `/checkouts`,
10826
+ method: "GET",
10827
+ headers: headerParameters,
10828
+ query: queryParameters
10829
+ },
10830
+ initOverrides
10831
+ );
10832
+ return new JSONApiResponse(
10833
+ response,
10834
+ (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
10835
+ );
10836
+ }
10837
+ /**
10838
+ * The checkouts this session opened for the token\'s company. Filter by `statuses`.
10839
+ * List checkouts
10840
+ */
10841
+ async listCheckouts(requestParameters = {}, initOverrides) {
10842
+ const response = await this.listCheckoutsRaw(
10843
+ requestParameters,
10844
+ initOverrides
10845
+ );
10846
+ return await response.value();
10847
+ }
10848
+ /**
10849
+ * List company spend policies
10850
+ */
10851
+ async listCompanySpendPoliciesRaw(requestParameters, initOverrides) {
10279
10852
  const queryParameters = {};
10280
- if (requestParameters["companyId"] != null) {
10281
- queryParameters["company_id"] = requestParameters["companyId"];
10282
- }
10283
- if (requestParameters["statuses"] != null) {
10284
- queryParameters["statuses"] = requestParameters["statuses"];
10285
- }
10286
- if (requestParameters["limit"] != null) {
10287
- queryParameters["limit"] = requestParameters["limit"];
10288
- }
10289
- if (requestParameters["offset"] != null) {
10290
- queryParameters["offset"] = requestParameters["offset"];
10853
+ if (requestParameters["billingCreditId"] != null) {
10854
+ queryParameters["billing_credit_id"] = requestParameters["billingCreditId"];
10291
10855
  }
10292
10856
  const headerParameters = {};
10293
10857
  if (this.configuration && this.configuration.apiKey) {
@@ -10297,7 +10861,7 @@ var CheckoutexternalApi = class extends BaseAPI {
10297
10861
  }
10298
10862
  const response = await this.request(
10299
10863
  {
10300
- path: `/checkouts`,
10864
+ path: `/company/credits/spend-policies`,
10301
10865
  method: "GET",
10302
10866
  headers: headerParameters,
10303
10867
  query: queryParameters
@@ -10306,15 +10870,14 @@ var CheckoutexternalApi = class extends BaseAPI {
10306
10870
  );
10307
10871
  return new JSONApiResponse(
10308
10872
  response,
10309
- (jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
10873
+ (jsonValue) => ListCompanySpendPoliciesResponseFromJSON(jsonValue)
10310
10874
  );
10311
10875
  }
10312
10876
  /**
10313
- * The checkouts this session opened for the token\'s company. Filter by `statuses`.
10314
- * List checkouts
10877
+ * List company spend policies
10315
10878
  */
10316
- async listCheckouts(requestParameters = {}, initOverrides) {
10317
- const response = await this.listCheckoutsRaw(
10879
+ async listCompanySpendPolicies(requestParameters = {}, initOverrides) {
10880
+ const response = await this.listCompanySpendPoliciesRaw(
10318
10881
  requestParameters,
10319
10882
  initOverrides
10320
10883
  );
@@ -10554,6 +11117,60 @@ var CheckoutexternalApi = class extends BaseAPI {
10554
11117
  );
10555
11118
  return await response.value();
10556
11119
  }
11120
+ /**
11121
+ * Update company spend policy
11122
+ */
11123
+ async updateCompanySpendPolicyRaw(requestParameters, initOverrides) {
11124
+ if (requestParameters["spendPolicyId"] == null) {
11125
+ throw new RequiredError(
11126
+ "spendPolicyId",
11127
+ 'Required parameter "spendPolicyId" was null or undefined when calling updateCompanySpendPolicy().'
11128
+ );
11129
+ }
11130
+ if (requestParameters["updateCreditSpendPolicyRequestBody"] == null) {
11131
+ throw new RequiredError(
11132
+ "updateCreditSpendPolicyRequestBody",
11133
+ 'Required parameter "updateCreditSpendPolicyRequestBody" was null or undefined when calling updateCompanySpendPolicy().'
11134
+ );
11135
+ }
11136
+ const queryParameters = {};
11137
+ const headerParameters = {};
11138
+ headerParameters["Content-Type"] = "application/json";
11139
+ if (this.configuration && this.configuration.apiKey) {
11140
+ headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
11141
+ "X-Schematic-Api-Key"
11142
+ );
11143
+ }
11144
+ const response = await this.request(
11145
+ {
11146
+ path: `/company/credits/spend-policies/{spend_policy_id}`.replace(
11147
+ `{${"spend_policy_id"}}`,
11148
+ encodeURIComponent(String(requestParameters["spendPolicyId"]))
11149
+ ),
11150
+ method: "PUT",
11151
+ headers: headerParameters,
11152
+ query: queryParameters,
11153
+ body: UpdateCreditSpendPolicyRequestBodyToJSON(
11154
+ requestParameters["updateCreditSpendPolicyRequestBody"]
11155
+ )
11156
+ },
11157
+ initOverrides
11158
+ );
11159
+ return new JSONApiResponse(
11160
+ response,
11161
+ (jsonValue) => UpdateCompanySpendPolicyResponseFromJSON(jsonValue)
11162
+ );
11163
+ }
11164
+ /**
11165
+ * Update company spend policy
11166
+ */
11167
+ async updateCompanySpendPolicy(requestParameters, initOverrides) {
11168
+ const response = await this.updateCompanySpendPolicyRaw(
11169
+ requestParameters,
11170
+ initOverrides
11171
+ );
11172
+ return await response.value();
11173
+ }
10557
11174
  /**
10558
11175
  * Makes a method on file the one the company\'s charges use. The body\'s `payment_method_id` is the provider\'s id of the method, the `external_id` the list returns; `usePaymentMethods().setDefault` calls this and reloads the list. A card saved during a checkout joins the methods on file and becomes the default the same way.
10559
11176
  * Make a payment method the default
@@ -11079,9 +11696,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
11079
11696
 
11080
11697
  // src/api/componentspublic/models/BillingTiersMode.ts
11081
11698
  function BillingTiersModeFromJSON2(json) {
11082
- return BillingTiersModeFromJSONTyped6(json, false);
11699
+ return BillingTiersModeFromJSONTyped7(json, false);
11083
11700
  }
11084
- function BillingTiersModeFromJSONTyped6(json, ignoreDiscriminator) {
11701
+ function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
11085
11702
  return json;
11086
11703
  }
11087
11704
 
@@ -11357,9 +11974,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
11357
11974
 
11358
11975
  // src/api/componentspublic/models/PlanPriceCadence.ts
11359
11976
  function PlanPriceCadenceFromJSON2(json) {
11360
- return PlanPriceCadenceFromJSONTyped7(json, false);
11977
+ return PlanPriceCadenceFromJSONTyped8(json, false);
11361
11978
  }
11362
- function PlanPriceCadenceFromJSONTyped7(json, ignoreDiscriminator) {
11979
+ function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
11363
11980
  return json;
11364
11981
  }
11365
11982
 
@@ -11988,6 +12605,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
11988
12605
  };
11989
12606
  }
11990
12607
 
12608
+ // src/api/componentspublic/models/RenewalDestinationResponseData.ts
12609
+ function RenewalDestinationResponseDataFromJSON2(json) {
12610
+ return RenewalDestinationResponseDataFromJSONTyped3(json, false);
12611
+ }
12612
+ function RenewalDestinationResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
12613
+ if (json == null) {
12614
+ return json;
12615
+ }
12616
+ return {
12617
+ billingPeriod: PlanPriceCadenceFromJSON2(json["billing_period"]),
12618
+ planId: json["plan_id"]
12619
+ };
12620
+ }
12621
+
11991
12622
  // src/api/componentspublic/models/RenewalPolicy.ts
11992
12623
  function RenewalPolicyFromJSON2(json) {
11993
12624
  return RenewalPolicyFromJSONTyped3(json, false);
@@ -12013,6 +12644,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
12013
12644
  name: json["name"],
12014
12645
  originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
12015
12646
  planType: PlanTypeFromJSON2(json["plan_type"]),
12647
+ renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
12016
12648
  renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
12017
12649
  status: PlanVersionStatusFromJSON2(json["status"]),
12018
12650
  updatedAt: new Date(json["updated_at"]),
@@ -12581,7 +13213,7 @@ function resolveLocale(locale) {
12581
13213
  return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
12582
13214
  }
12583
13215
 
12584
- // node_modules/.pnpm/i18next@26.7.1_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
13216
+ // node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
12585
13217
  var isString = (obj) => typeof obj === "string";
12586
13218
  var defer = () => {
12587
13219
  let res;
@@ -12696,12 +13328,11 @@ var _entityMap = {
12696
13328
  "<": "&lt;",
12697
13329
  ">": "&gt;",
12698
13330
  '"': "&quot;",
12699
- "'": "&#39;",
12700
- "/": "&#x2F;"
13331
+ "'": "&#39;"
12701
13332
  };
12702
13333
  var escape = (data) => {
12703
13334
  if (isString(data)) {
12704
- return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
13335
+ return data.replace(/[&<>"']/g, (s) => _entityMap[s]);
12705
13336
  }
12706
13337
  return data;
12707
13338
  };
@@ -12748,6 +13379,9 @@ var deepFind = (obj, path, keySeparator = ".") => {
12748
13379
  if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
12749
13380
  return obj[path];
12750
13381
  }
13382
+ if (!keySeparator) {
13383
+ return Object.prototype.hasOwnProperty.call(obj, path) ? obj[path] : void 0;
13384
+ }
12751
13385
  const tokens = path.split(keySeparator);
12752
13386
  let current = obj;
12753
13387
  for (let i2 = 0; i2 < tokens.length; ) {
@@ -12892,15 +13526,20 @@ var EventEmitter = class {
12892
13526
  }
12893
13527
  };
12894
13528
  var nonEmptyBundles = /* @__PURE__ */ new WeakSet();
13529
+ var assertSeparateArguments = (method, ...args) => {
13530
+ if (args.some((a2) => !isString(a2))) {
13531
+ throw new TypeError(`${method}: pass language, namespace${method === "addResource" ? " and key" : ""} as separate strings; the dotted form ('en.translation.key') was removed in i18next v27`);
13532
+ }
13533
+ };
12895
13534
  var ResourceStore = class extends EventEmitter {
12896
13535
  constructor(data, options = {
12897
13536
  ns: ["translation"],
12898
13537
  defaultNS: "translation"
12899
- }) {
13538
+ }, logger = baseLogger) {
12900
13539
  super();
12901
13540
  this.data = data || {};
12902
13541
  this.options = options;
12903
- this.logger = baseLogger.create("resourceStore");
13542
+ this.logger = logger.create("resourceStore");
12904
13543
  if (this.options.keySeparator === void 0) {
12905
13544
  this.options.keySeparator = ".";
12906
13545
  }
@@ -12919,49 +13558,30 @@ var ResourceStore = class extends EventEmitter {
12919
13558
  this.options.ns.splice(index, 1);
12920
13559
  }
12921
13560
  }
12922
- deprecateDottedLng(method) {
12923
- this.logger.once(method, "deprecate", `${method}: a dotted language ('en.translation.key') that carries the namespace and key is removed in v27; pass language, namespace and key as separate arguments`);
12924
- }
12925
13561
  getResource(lng, ns, key, options = {}) {
12926
13562
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
12927
13563
  const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
12928
- let path;
12929
- if (lng.includes(".")) {
12930
- this.deprecateDottedLng("getResource");
12931
- path = lng.split(".");
12932
- } else {
12933
- path = [lng, ns];
12934
- if (key) {
12935
- if (Array.isArray(key)) {
12936
- path.push(...key);
12937
- } else if (isString(key) && keySeparator) {
12938
- path.push(...key.split(keySeparator));
12939
- } else {
12940
- path.push(key);
12941
- }
13564
+ const path = [lng, ns];
13565
+ if (key) {
13566
+ if (Array.isArray(key)) {
13567
+ path.push(...key);
13568
+ } else if (isString(key) && keySeparator) {
13569
+ path.push(...key.split(keySeparator));
13570
+ } else {
13571
+ path.push(key);
12942
13572
  }
12943
13573
  }
12944
13574
  const result = getPath(this.data, path);
12945
- if (result == null && !ns && !key && lng.includes(".")) {
12946
- lng = path[0];
12947
- ns = path[1];
12948
- key = path.slice(2).join(".");
12949
- }
12950
13575
  if (result != null || !ignoreJSONStructure || !isString(key)) return result;
12951
13576
  return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
12952
13577
  }
12953
13578
  addResource(lng, ns, key, value, options = {
12954
13579
  silent: false
12955
13580
  }) {
13581
+ assertSeparateArguments("addResource", lng, ns, key);
12956
13582
  const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
12957
13583
  let path = [lng, ns];
12958
13584
  if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
12959
- if (lng.includes(".")) {
12960
- this.deprecateDottedLng("addResource");
12961
- path = lng.split(".");
12962
- value = ns;
12963
- ns = path[1];
12964
- }
12965
13585
  this.addNamespaces(ns);
12966
13586
  setPath(this.data, path, value);
12967
13587
  if (!options.silent) this.emit("added", lng, ns, key, value);
@@ -12969,25 +13589,21 @@ var ResourceStore = class extends EventEmitter {
12969
13589
  addResources(lng, ns, resources, options = {
12970
13590
  silent: false
12971
13591
  }) {
12972
- for (const m2 in resources) {
12973
- if (isString(resources[m2]) || Array.isArray(resources[m2])) this.addResource(lng, ns, m2, resources[m2], {
13592
+ assertSeparateArguments("addResources", lng, ns);
13593
+ Object.keys(resources || {}).forEach((m2) => {
13594
+ if (m2 === "__proto__" || m2 === "constructor") return;
13595
+ this.addResource(lng, ns, m2, resources[m2], {
12974
13596
  silent: true
12975
13597
  });
12976
- }
13598
+ });
12977
13599
  if (!options.silent) this.emit("added", lng, ns, resources);
12978
13600
  }
12979
13601
  addResourceBundle(lng, ns, resources, deep, overwrite, options = {
12980
13602
  silent: false,
12981
13603
  skipCopy: false
12982
13604
  }) {
12983
- let path = [lng, ns];
12984
- if (lng.includes(".")) {
12985
- this.deprecateDottedLng("addResourceBundle");
12986
- path = lng.split(".");
12987
- deep = resources;
12988
- resources = ns;
12989
- ns = path[1];
12990
- }
13605
+ assertSeparateArguments("addResourceBundle", lng, ns);
13606
+ const path = [lng, ns];
12991
13607
  this.addNamespaces(ns);
12992
13608
  let pack = getPath(this.data, path) || {};
12993
13609
  if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
@@ -13034,18 +13650,6 @@ var ResourceStore = class extends EventEmitter {
13034
13650
  return this.data;
13035
13651
  }
13036
13652
  };
13037
- var postProcessor = {
13038
- processors: {},
13039
- addPostProcessor(module2) {
13040
- this.processors[module2.name] = module2;
13041
- },
13042
- handle(processors, value, key, options, translator) {
13043
- processors.forEach((processor) => {
13044
- value = this.processors[processor]?.process(value, key, options, translator) ?? value;
13045
- });
13046
- return value;
13047
- }
13048
- };
13049
13653
  var PATH_KEY = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
13050
13654
  function createProxy() {
13051
13655
  const state = [];
@@ -13064,7 +13668,7 @@ function keysFromSelector(selector, opts) {
13064
13668
  const {
13065
13669
  [PATH_KEY]: path
13066
13670
  } = selector(createProxy());
13067
- const keySeparator = opts?.keySeparator ?? ".";
13671
+ const keySeparator = opts?.keySeparator || ".";
13068
13672
  const nsSeparator = opts?.nsSeparator ?? ":";
13069
13673
  const strict = opts?.enableSelector === "strict";
13070
13674
  if (path.length > 1 && nsSeparator) {
@@ -13083,12 +13687,12 @@ var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" &
13083
13687
  var Translator = class _Translator extends EventEmitter {
13084
13688
  constructor(services, options = {}) {
13085
13689
  super();
13086
- copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils", "ownPostProcessors"], services, this);
13690
+ copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils", "postProcessors"], services, this);
13087
13691
  this.options = options;
13088
13692
  if (this.options.keySeparator === void 0) {
13089
13693
  this.options.keySeparator = ".";
13090
13694
  }
13091
- this.logger = baseLogger.create("translator");
13695
+ this.logger = (services.logger || baseLogger).create("translator");
13092
13696
  this.checkedLoadedFor = {};
13093
13697
  }
13094
13698
  changeLanguage(lng) {
@@ -13205,30 +13809,32 @@ var Translator = class _Translator extends EventEmitter {
13205
13809
  ordinal: false
13206
13810
  }) : "";
13207
13811
  const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
13208
- const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
13812
+ const sep = this.options.pluralSeparator;
13813
+ const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${sep}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || (opt.defaultValue ?? (needsPluralHandling ? opt[`defaultValue${opt.ordinal ? `${sep}ordinal${sep}` : sep}other`] : void 0));
13209
13814
  let resForObjHndl = res;
13210
13815
  if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
13211
13816
  resForObjHndl = defaultValue;
13212
13817
  }
13213
13818
  const handleAsObject = shouldHandleAsObject(resForObjHndl);
13214
13819
  const resType = Object.prototype.toString.apply(resForObjHndl);
13215
- if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
13216
- if (!opt.returnObjects && !this.options.returnObjects) {
13217
- if (!this.options.returnedObjectHandler) {
13218
- this.logger.warn("accessing an object - but returnObjects options is not enabled!");
13219
- this.logger.once("returnedObject", "deprecate", "accessing an object without returnObjects returns a sentence about it today; from v27 t() returns the key, as for a missing key (returnedObjectHandler can keep today's text)");
13220
- }
13221
- const r2 = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
13222
- ...opt,
13223
- ns: namespaces
13224
- }) : `key '${key} (${this.language})' returned an object instead of string.`;
13225
- if (returnDetails) {
13226
- resolved.res = r2;
13227
- resolved.usedParams = this.getUsedParamsDetails(opt);
13228
- return resolved;
13229
- }
13230
- return r2;
13820
+ const isObjectHit = handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl));
13821
+ const objectNotReturned = isObjectHit && !opt.returnObjects && !this.options.returnObjects;
13822
+ if (objectNotReturned && this.options.returnedObjectHandler) {
13823
+ const r2 = this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
13824
+ ...opt,
13825
+ ns: namespaces
13826
+ });
13827
+ if (returnDetails) {
13828
+ resolved.res = r2;
13829
+ resolved.usedParams = this.getUsedParamsDetails(opt);
13830
+ return resolved;
13231
13831
  }
13832
+ return r2;
13833
+ }
13834
+ if (objectNotReturned) {
13835
+ this.logger.warn("accessing an object - but returnObjects options is not enabled!");
13836
+ }
13837
+ if (isObjectHit && !objectNotReturned) {
13232
13838
  if (keySeparator) {
13233
13839
  const resTypeIsArray = Array.isArray(resForObjHndl);
13234
13840
  const copy3 = resTypeIsArray ? [] : {};
@@ -13265,18 +13871,19 @@ var Translator = class _Translator extends EventEmitter {
13265
13871
  } else {
13266
13872
  let usedDefault = false;
13267
13873
  let usedKey = false;
13268
- if (!this.isValidLookup(res) && hasDefaultValue) {
13874
+ if (objectNotReturned) res = void 0;
13875
+ if (!this.isValidLookup(res) && hasDefaultValue && !(objectNotReturned && shouldHandleAsObject(defaultValue))) {
13269
13876
  usedDefault = true;
13270
13877
  res = defaultValue;
13271
13878
  }
13272
- if (!this.isValidLookup(res)) {
13879
+ if (!this.isValidLookup(res) && !(usedDefault && res === "")) {
13273
13880
  usedKey = true;
13274
13881
  res = key;
13275
13882
  }
13276
13883
  const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
13277
13884
  const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
13278
13885
  const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
13279
- if (usedKey || usedDefault || updateMissing) {
13886
+ if (!objectNotReturned && (usedKey || usedDefault || updateMissing)) {
13280
13887
  this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, needsPluralHandling && !updateMissing ? `${key}${this.pluralResolver.getSuffix(lng, opt.count, opt)}` : key, updateMissing ? defaultValue : res);
13281
13888
  if (keySeparator) {
13282
13889
  const fk = this.resolve(key, {
@@ -13357,7 +13964,7 @@ var Translator = class _Translator extends EventEmitter {
13357
13964
  const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
13358
13965
  let nestBef;
13359
13966
  if (skipOnVariables) {
13360
- const nb = res.match(this.interpolator.nestingRegexp);
13967
+ const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13361
13968
  nestBef = nb && nb.length;
13362
13969
  }
13363
13970
  let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
@@ -13367,7 +13974,7 @@ var Translator = class _Translator extends EventEmitter {
13367
13974
  };
13368
13975
  res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
13369
13976
  if (skipOnVariables) {
13370
- const na = res.match(this.interpolator.nestingRegexp);
13977
+ const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
13371
13978
  const nestAft = na && na.length;
13372
13979
  if (nestBef < nestAft) opt.nest = false;
13373
13980
  }
@@ -13384,18 +13991,21 @@ var Translator = class _Translator extends EventEmitter {
13384
13991
  const postProcess = opt.postProcess || this.options.postProcess;
13385
13992
  const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
13386
13993
  if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
13387
- postProcessorNames.forEach((name) => {
13388
- if (this.logger.debug && postProcessor.processors[name] && this.ownPostProcessors && !this.ownPostProcessors.has(name)) {
13389
- this.logger.once(name, "deprecate", `postProcess: '${name}' was registered with use() on another i18next instance; from v27 post-processors are per instance, so call use() with it on this instance too`);
13390
- }
13391
- });
13392
- res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
13994
+ const ppOptions = this.options?.postProcessPassResolved ? {
13393
13995
  i18nResolved: {
13394
13996
  ...resolved,
13395
13997
  usedParams: this.getUsedParamsDetails(opt)
13396
13998
  },
13397
13999
  ...opt
13398
- } : opt, this);
14000
+ } : opt;
14001
+ postProcessorNames.forEach((name) => {
14002
+ const processor = this.postProcessors?.[name];
14003
+ if (!processor) {
14004
+ this.logger.once(`postProcess:${name}`, "warn", `postProcess: '${name}' is not registered on this i18next instance; call use() with it on this instance`);
14005
+ return;
14006
+ }
14007
+ res = processor.process(res, key, ppOptions, this) ?? res;
14008
+ });
13399
14009
  }
13400
14010
  return res;
13401
14011
  }
@@ -13461,6 +14071,15 @@ var Translator = class _Translator extends EventEmitter {
13461
14071
  }
13462
14072
  }
13463
14073
  }
14074
+ if (needsPluralHandling) {
14075
+ const otherSuffix = `${opt.ordinal ? ordinalPrefix : this.options.pluralSeparator}other`;
14076
+ if (pluralSuffix !== otherSuffix) {
14077
+ if (needsContextHandling) {
14078
+ finalKeys.unshift(`${key}${this.options.contextSeparator || "_"}${opt.context}${otherSuffix}`);
14079
+ }
14080
+ finalKeys.unshift(key + otherSuffix);
14081
+ }
14082
+ }
13464
14083
  }
13465
14084
  let possibleKey;
13466
14085
  while (possibleKey = finalKeys.pop()) {
@@ -13524,14 +14143,16 @@ var Translator = class _Translator extends EventEmitter {
13524
14143
  }
13525
14144
  };
13526
14145
  var LanguageUtil = class {
13527
- constructor(options) {
14146
+ constructor(options, logger = baseLogger) {
13528
14147
  this.options = options;
13529
14148
  this.supportedLngs = this.options.supportedLngs || false;
13530
- this.logger = baseLogger.create("languageUtils");
14149
+ this.logger = logger.create("languageUtils");
13531
14150
  this.resolveHierarchyCache = {};
14151
+ this.formattedCodes = /* @__PURE__ */ new Map();
13532
14152
  }
13533
14153
  clearCache() {
13534
14154
  this.resolveHierarchyCache = {};
14155
+ this.formattedCodes.clear();
13535
14156
  }
13536
14157
  getScriptPartFromCode(code) {
13537
14158
  code = getCleanedCode(code);
@@ -13549,35 +14170,28 @@ var LanguageUtil = class {
13549
14170
  return this.formatLanguageCode(p2[0]);
13550
14171
  }
13551
14172
  formatLanguageCode(code) {
13552
- if (isString(code) && code.includes("-")) {
13553
- let formattedCode;
14173
+ if (!isString(code)) return code;
14174
+ let formatted = this.formattedCodes.get(code);
14175
+ if (formatted !== void 0) return formatted;
14176
+ formatted = this.formatUncached(code);
14177
+ if (this.formattedCodes.size >= 1e3) this.formattedCodes.clear();
14178
+ this.formattedCodes.set(code, formatted);
14179
+ return formatted;
14180
+ }
14181
+ formatUncached(code) {
14182
+ const hasSubtags = code.includes("-");
14183
+ if (hasSubtags || this.options.cleanCode !== false) {
14184
+ let canonical;
13554
14185
  try {
13555
- formattedCode = Intl.getCanonicalLocales(code)[0];
14186
+ canonical = Intl.getCanonicalLocales(code)[0];
13556
14187
  } catch (e) {
13557
14188
  }
13558
- if (formattedCode && this.options.lowerCaseLng) {
13559
- formattedCode = formattedCode.toLowerCase();
13560
- }
13561
- if (formattedCode) return formattedCode;
13562
- if (this.options.lowerCaseLng) {
13563
- return code.toLowerCase();
14189
+ if (canonical && (hasSubtags || canonical.toLowerCase() === code.toLowerCase())) {
14190
+ return this.options.lowerCaseLng ? canonical.toLowerCase() : canonical;
13564
14191
  }
13565
- return code;
13566
- }
13567
- const formatted = this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
13568
- if (this.logger.debug && isString(code)) this.deprecateBareCode(code, formatted);
13569
- return formatted;
13570
- }
13571
- deprecateBareCode(code, formatted) {
13572
- let v27;
13573
- try {
13574
- v27 = Intl.getCanonicalLocales(code)[0];
13575
- } catch (e) {
13576
- return;
14192
+ if (canonical) return code.toLowerCase();
13577
14193
  }
13578
- if (this.options.lowerCaseLng) v27 = v27.toLowerCase();
13579
- if (v27 === formatted) return;
13580
- this.logger.once(code, "deprecate", `language code '${code}' is used as '${formatted}'; i18next v27 canonicalizes it to '${v27}', use '${v27}' in lng, fallbackLng, supportedLngs and the resources`);
14194
+ return this.options.lowerCaseLng || this.options.cleanCode && !hasSubtags ? code.toLowerCase() : code;
13581
14195
  }
13582
14196
  isSupportedCode(code) {
13583
14197
  if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
@@ -13668,6 +14282,7 @@ var LanguageUtil = class {
13668
14282
  if (!codes.includes(formattedFc)) addCode(formattedFc);
13669
14283
  });
13670
14284
  if (cacheKey !== null) {
14285
+ if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
13671
14286
  this.resolveHierarchyCache[cacheKey] = codes;
13672
14287
  return codes.slice();
13673
14288
  }
@@ -13689,10 +14304,10 @@ var dummyRule = {
13689
14304
  })
13690
14305
  };
13691
14306
  var PluralResolver = class {
13692
- constructor(languageUtils, options = {}) {
14307
+ constructor(languageUtils, options = {}, logger = baseLogger) {
13693
14308
  this.languageUtils = languageUtils;
13694
14309
  this.options = options;
13695
- this.logger = baseLogger.create("pluralResolver");
14310
+ this.logger = logger.create("pluralResolver");
13696
14311
  this.pluralRulesCache = {};
13697
14312
  }
13698
14313
  clearCache() {
@@ -13722,6 +14337,7 @@ var PluralResolver = class {
13722
14337
  const lngPart = this.languageUtils.getLanguagePartFromCode(code);
13723
14338
  rule = this.getRule(lngPart, options);
13724
14339
  }
14340
+ if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
13725
14341
  this.pluralRulesCache[cacheKey] = rule;
13726
14342
  return rule;
13727
14343
  }
@@ -13757,8 +14373,8 @@ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJS
13757
14373
  return path;
13758
14374
  };
13759
14375
  var Interpolator = class {
13760
- constructor(options = {}) {
13761
- this.logger = baseLogger.create("interpolator");
14376
+ constructor(options = {}, logger = baseLogger) {
14377
+ this.logger = logger.create("interpolator");
13762
14378
  this.options = options;
13763
14379
  this.format = options?.interpolation?.format || ((value) => value);
13764
14380
  this.init(options);
@@ -13772,39 +14388,28 @@ var Interpolator = class {
13772
14388
  escapeValue,
13773
14389
  useRawValueToEscape,
13774
14390
  prefix: prefix2,
13775
- prefixEscaped,
13776
14391
  suffix,
13777
- suffixEscaped,
13778
14392
  formatSeparator,
13779
14393
  unescapeSuffix,
13780
14394
  unescapePrefix,
13781
14395
  nestingPrefix,
13782
- nestingPrefixEscaped,
13783
14396
  nestingSuffix,
13784
- nestingSuffixEscaped,
13785
14397
  nestingOptionsSeparator,
13786
14398
  maxReplaces,
13787
14399
  alwaysFormat
13788
14400
  } = options.interpolation;
13789
- if (prefixEscaped || suffixEscaped || nestingPrefixEscaped || nestingSuffixEscaped) {
13790
- const names = Object.entries({
13791
- prefixEscaped,
13792
- suffixEscaped,
13793
- nestingPrefixEscaped,
13794
- nestingSuffixEscaped
13795
- }).filter(([, v2]) => v2).map(([k2]) => k2);
13796
- this.logger.once(names.join(), "deprecate", `interpolation.${names.join(", interpolation.")}: the regex-escaped delimiter options are removed in v27; pass the literal delimiters as prefix, suffix, nestingPrefix and nestingSuffix`);
13797
- }
13798
14401
  this.escape = escape$1 !== void 0 ? escape$1 : escape;
13799
14402
  this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
13800
14403
  this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
13801
- this.prefix = prefix2 ? regexEscape(prefix2) : prefixEscaped || "{{";
13802
- this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
14404
+ this.prefix = prefix2 ? regexEscape(prefix2) : "{{";
14405
+ this.suffix = suffix ? regexEscape(suffix) : "}}";
13803
14406
  this.formatSeparator = formatSeparator || ",";
13804
14407
  this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
13805
14408
  this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
13806
- this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
13807
- this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
14409
+ this.prefixText = prefix2 || "{{";
14410
+ this.nestingPrefixText = nestingPrefix || "$t(";
14411
+ this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
14412
+ this.nestingSuffix = regexEscape(nestingSuffix || ")");
13808
14413
  this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
13809
14414
  this.maxReplaces = maxReplaces || 1e3;
13810
14415
  this.alwaysFormat = alwaysFormat !== void 0 ? alwaysFormat : false;
@@ -13855,18 +14460,13 @@ var Interpolator = class {
13855
14460
  }
13856
14461
  const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
13857
14462
  const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
14463
+ if (isString(str) && !str.includes(this.prefixText)) return str;
13858
14464
  const todos = [{
13859
14465
  regex: this.regexpUnescape,
13860
14466
  safeValue: (val) => val
13861
14467
  }, {
13862
14468
  regex: this.regexp,
13863
- safeValue: (val) => {
13864
- if (!this.escapeValue) return val;
13865
- if (this.escape === escape && this.options?.interpolation?.escapeValue !== false && isString(val) && val.includes("/")) {
13866
- this.logger.once("/", "deprecate", "escapeValue renders '/' in a value as '&#x2F;' today; from v27 the default escape leaves '/' as it is");
13867
- }
13868
- return this.escape(val);
13869
- }
14469
+ safeValue: (val) => this.escapeValue ? this.escape(val) : val
13870
14470
  }];
13871
14471
  const unescapedValues = [];
13872
14472
  let shift = 0;
@@ -13950,6 +14550,7 @@ var Interpolator = class {
13950
14550
  if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
13951
14551
  return key;
13952
14552
  };
14553
+ if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
13953
14554
  const nestingRegexp = new RegExp(this.nestingRegexp);
13954
14555
  let out = "";
13955
14556
  let lastEnd = 0;
@@ -14017,8 +14618,9 @@ var parseFormatStr = (formatStr) => {
14017
14618
  formatOptions
14018
14619
  };
14019
14620
  };
14621
+ var cachedFormattersLimit = 1e3;
14020
14622
  var createCachedFormatter = (fn) => {
14021
- const cache = {};
14623
+ const cache = /* @__PURE__ */ new Map();
14022
14624
  return (v2, l2, o) => {
14023
14625
  let optForCache = o;
14024
14626
  if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
@@ -14033,10 +14635,11 @@ var createCachedFormatter = (fn) => {
14033
14635
  } catch (e) {
14034
14636
  return fn(getCleanedCode(l2), o)(v2);
14035
14637
  }
14036
- let frm = cache[key];
14638
+ let frm = cache.get(key);
14037
14639
  if (!frm) {
14038
14640
  frm = fn(getCleanedCode(l2), o);
14039
- cache[key] = frm;
14641
+ if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
14642
+ cache.set(key, frm);
14040
14643
  }
14041
14644
  return frm(v2);
14042
14645
  };
@@ -14051,6 +14654,7 @@ var Formatter = class {
14051
14654
  init(services, options = {
14052
14655
  interpolation: {}
14053
14656
  }) {
14657
+ if (services?.logger?.create) this.logger = services.logger.create("formatter");
14054
14658
  this.formatSeparator = options.interpolation.formatSeparator || ",";
14055
14659
  const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
14056
14660
  this.formats = {
@@ -14132,6 +14736,7 @@ var Formatter = class {
14132
14736
  return result;
14133
14737
  }
14134
14738
  };
14739
+ var maxFailedLoads = 1e3;
14135
14740
  var removePending = (q2, name) => {
14136
14741
  if (q2.pending[name] !== void 0) {
14137
14742
  delete q2.pending[name];
@@ -14146,13 +14751,14 @@ var Connector = class extends EventEmitter {
14146
14751
  this.services = services;
14147
14752
  this.languageUtils = services.languageUtils;
14148
14753
  this.options = options;
14149
- this.logger = baseLogger.create("backendConnector");
14754
+ this.logger = (services.logger || baseLogger).create("backendConnector");
14150
14755
  this.waitingReads = [];
14151
14756
  this.maxParallelReads = options.maxParallelReads || 10;
14152
14757
  this.readingCalls = 0;
14153
14758
  this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
14154
14759
  this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
14155
14760
  this.state = {};
14761
+ this.failed = /* @__PURE__ */ new Set();
14156
14762
  this.queue = [];
14157
14763
  this.backend?.init?.(services, options.backend, options);
14158
14764
  this.callbackApi = callbackApiOf(this.backend);
@@ -14212,6 +14818,15 @@ var Connector = class extends EventEmitter {
14212
14818
  }
14213
14819
  this.state[name] = err ? -1 : 2;
14214
14820
  if (err && data) this.state[name] = 0;
14821
+ this.failed.delete(name);
14822
+ if (err) {
14823
+ this.failed.add(name);
14824
+ if (this.failed.size > maxFailedLoads) {
14825
+ const oldest = this.failed.values().next().value;
14826
+ this.failed.delete(oldest);
14827
+ if (this.state[oldest] < 1) delete this.state[oldest];
14828
+ }
14829
+ }
14215
14830
  const loaded = {};
14216
14831
  this.queue.forEach((q2) => {
14217
14832
  pushPath(q2.loaded, [lng], ns);
@@ -14306,15 +14921,10 @@ var Connector = class extends EventEmitter {
14306
14921
  reload: true
14307
14922
  }, callback);
14308
14923
  }
14309
- noticeDevFallback(lng) {
14310
- if (lng !== "dev" || !this.devIsDefaultFallback) return;
14311
- this.logger.once("dev", "warn", "language 'dev' is requested because fallbackLng is not set (its default is ['dev']); i18next v27 defaults to fallbackLng: false and loads and saves missing keys in the requested language instead. Set fallbackLng to your source language, or to 'dev' to keep this behavior");
14312
- }
14313
14924
  loadOne(name, prefix2 = "") {
14314
14925
  const s = name.split("|");
14315
14926
  const lng = s[0];
14316
14927
  const ns = s[1];
14317
- this.noticeDevFallback(lng);
14318
14928
  this.read(lng, ns, "read", void 0, void 0, (err, data) => {
14319
14929
  if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
14320
14930
  if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
@@ -14329,7 +14939,6 @@ var Connector = class extends EventEmitter {
14329
14939
  }
14330
14940
  if (key === void 0 || key === null || key === "") return;
14331
14941
  if (this.backend?.create) {
14332
- languages?.forEach?.((l2) => this.noticeDevFallback(l2));
14333
14942
  const opts = {
14334
14943
  ...options,
14335
14944
  isUpdate
@@ -14364,7 +14973,7 @@ var get = () => ({
14364
14973
  initAsync: true,
14365
14974
  ns: ["translation"],
14366
14975
  defaultNS: ["translation"],
14367
- fallbackLng: ["dev"],
14976
+ fallbackLng: false,
14368
14977
  fallbackNS: false,
14369
14978
  supportedLngs: false,
14370
14979
  nonExplicitSupportedLngs: false,
@@ -14385,7 +14994,7 @@ var get = () => ({
14385
14994
  postProcess: false,
14386
14995
  postProcessPassResolved: false,
14387
14996
  returnNull: false,
14388
- returnEmptyString: true,
14997
+ returnEmptyString: false,
14389
14998
  returnObjects: false,
14390
14999
  joinArrays: false,
14391
15000
  returnedObjectHandler: false,
@@ -14430,7 +15039,39 @@ var transformOptions = (options) => {
14430
15039
  };
14431
15040
  var noop = () => {
14432
15041
  };
14433
- var loggerOwner;
15042
+ var withDefaults = (options) => {
15043
+ const defOpts = get();
15044
+ const merged = {
15045
+ ...defOpts,
15046
+ ...options
15047
+ };
15048
+ merged.interpolation = {
15049
+ ...defOpts.interpolation,
15050
+ ...options.interpolation
15051
+ };
15052
+ if (typeof merged.overloadTranslationOptionHandler !== "function") {
15053
+ merged.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
15054
+ }
15055
+ return merged;
15056
+ };
15057
+ var configuredLanguageCodes = (options) => {
15058
+ const codes = [].concat(options.supportedLngs || [], options.preload || []);
15059
+ codes.push(...Object.keys(options.resources || {}));
15060
+ const fallbackLng = options.fallbackLng;
15061
+ if (isString(fallbackLng) || Array.isArray(fallbackLng)) codes.push(...[].concat(fallbackLng));
15062
+ else if (fallbackLng && typeof fallbackLng === "object") {
15063
+ Object.keys(fallbackLng).forEach((code) => {
15064
+ if (code !== "default") codes.push(code);
15065
+ codes.push(...[].concat(fallbackLng[code]));
15066
+ });
15067
+ }
15068
+ return codes;
15069
+ };
15070
+ var isRefusedLanguageCode = (i18n2, code) => {
15071
+ if (!isString(code) || isSafeLanguageCode(code) || i18n2.configuredLngs?.has(code)) return false;
15072
+ i18n2.logger.once(`lng:${code}`, "warn", `refused the language code '${code.slice(0, 64)}' from lng, changeLanguage(), the language detector or loadLanguages(): it is not configured and has other characters than letters, digits, '-', '_', '@' and '.' (or '..', or more than 128). List it in supportedLngs to use it`);
15073
+ return true;
15074
+ };
14434
15075
  var bindMemberFunctions = (inst) => {
14435
15076
  const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
14436
15077
  mems.forEach((mem) => {
@@ -14442,17 +15083,18 @@ var bindMemberFunctions = (inst) => {
14442
15083
  var I18n = class _I18n extends EventEmitter {
14443
15084
  constructor(options = {}, callback) {
14444
15085
  super();
14445
- this.options = transformOptions(options);
15086
+ this.userOptions = transformOptions(options);
15087
+ this.options = withDefaults(this.userOptions);
14446
15088
  this.services = {
14447
- ownPostProcessors: /* @__PURE__ */ new Set()
15089
+ postProcessors: /* @__PURE__ */ Object.create(null)
14448
15090
  };
14449
- this.logger = baseLogger;
15091
+ this.logger = new Logger(null, this.options);
14450
15092
  this.modules = {
14451
15093
  external: []
14452
15094
  };
14453
15095
  bindMemberFunctions(this);
14454
15096
  if (callback && !this.isInitialized && !options.isClone) {
14455
- if (!this.options.initAsync) {
15097
+ if (!this.userOptions.initAsync) {
14456
15098
  this.init(options, callback);
14457
15099
  return this;
14458
15100
  }
@@ -14474,25 +15116,23 @@ var I18n = class _I18n extends EventEmitter {
14474
15116
  options.defaultNS = options.ns[0];
14475
15117
  }
14476
15118
  }
14477
- const fallbackLngIsDefault = options.fallbackLng === void 0 && this.options.fallbackLng === void 0;
14478
- const defOpts = get();
14479
- this.options = {
14480
- ...defOpts,
14481
- ...this.options,
14482
- ...transformOptions(options)
15119
+ transformOptions(options);
15120
+ const userOptions = {
15121
+ ...this.userOptions,
15122
+ ...options
14483
15123
  };
14484
- this.options.interpolation = {
14485
- ...defOpts.interpolation,
14486
- ...this.options.interpolation
14487
- };
14488
- if (options.keySeparator !== void 0) {
14489
- this.options.userDefinedKeySeparator = options.keySeparator;
15124
+ this.options = withDefaults({
15125
+ ...this.options,
15126
+ ...options
15127
+ });
15128
+ if (userOptions.keySeparator !== void 0) {
15129
+ this.options.userDefinedKeySeparator = userOptions.keySeparator;
14490
15130
  }
14491
- if (options.nsSeparator !== void 0) {
14492
- this.options.userDefinedNsSeparator = options.nsSeparator;
15131
+ if (userOptions.nsSeparator !== void 0) {
15132
+ this.options.userDefinedNsSeparator = userOptions.nsSeparator;
14493
15133
  }
14494
- if (typeof this.options.overloadTranslationOptionHandler !== "function") {
14495
- this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
15134
+ if (!this.options.isClone) {
15135
+ this.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...configuredLanguageCodes(userOptions)]);
14496
15136
  }
14497
15137
  const createClassOnDemand = (ClassOrObject) => {
14498
15138
  if (!ClassOrObject) return null;
@@ -14500,15 +15140,10 @@ var I18n = class _I18n extends EventEmitter {
14500
15140
  return ClassOrObject;
14501
15141
  };
14502
15142
  if (!this.options.isClone) {
14503
- if (loggerOwner && loggerOwner !== this && loggerOwner.modules.logger !== this.modules.logger) {
14504
- baseLogger.deprecate("init: this init() replaces the logger another i18next instance set with use(), as the logger is shared in v26; from v27 each instance keeps its own logger");
14505
- }
14506
- loggerOwner = this.modules.logger ? this : void 0;
14507
- if (this.modules.logger) {
14508
- baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
14509
- } else {
14510
- baseLogger.init(null, this.options);
14511
- }
15143
+ this.logger.init(createClassOnDemand(this.modules.logger), this.options);
15144
+ const {
15145
+ logger
15146
+ } = this;
14512
15147
  this.pendingWarnings?.forEach((msg) => this.logger.warn(msg));
14513
15148
  this.pendingWarnings = void 0;
14514
15149
  let formatter;
@@ -14517,27 +15152,26 @@ var I18n = class _I18n extends EventEmitter {
14517
15152
  } else {
14518
15153
  formatter = Formatter;
14519
15154
  }
14520
- const lu = new LanguageUtil(this.options);
14521
- this.store = new ResourceStore(this.options.resources, this.options);
15155
+ const lu = new LanguageUtil(this.options, logger);
15156
+ this.store = new ResourceStore(this.options.resources, this.options, logger);
14522
15157
  const s = this.services;
14523
- s.logger = baseLogger;
15158
+ s.logger = logger;
14524
15159
  s.resourceStore = this.store;
14525
15160
  s.languageUtils = lu;
14526
15161
  s.pluralResolver = new PluralResolver(lu, {
14527
15162
  prepend: this.options.pluralSeparator
14528
- });
15163
+ }, logger);
14529
15164
  if (formatter) {
14530
15165
  s.formatter = createClassOnDemand(formatter);
14531
15166
  if (s.formatter.init) s.formatter.init(s, this.options);
14532
15167
  this.options.interpolation.format = s.formatter.format.bind(s.formatter);
14533
15168
  }
14534
- s.interpolator = new Interpolator(this.options);
15169
+ s.interpolator = new Interpolator(this.options, logger);
14535
15170
  s.utils = {
14536
15171
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this),
14537
15172
  reloadResources: this.reloadResources.bind(this)
14538
15173
  };
14539
15174
  s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
14540
- s.backendConnector.devIsDefaultFallback = fallbackLngIsDefault;
14541
15175
  s.backendConnector.on("*", (event, ...args) => {
14542
15176
  this.emit(event, ...args);
14543
15177
  });
@@ -14678,8 +15312,7 @@ var I18n = class _I18n extends EventEmitter {
14678
15312
  setModule("i18nFormat");
14679
15313
  }
14680
15314
  if (module2.type === "postProcessor") {
14681
- postProcessor.addPostProcessor(module2);
14682
- this.services.ownPostProcessors?.add(module2.name);
15315
+ this.services.postProcessors[module2.name] = module2;
14683
15316
  }
14684
15317
  if (module2.type === "formatter") {
14685
15318
  setModule("formatter");
@@ -14754,14 +15387,16 @@ var I18n = class _I18n extends EventEmitter {
14754
15387
  };
14755
15388
  const setLng = (lngs) => {
14756
15389
  if (!lng && !lngs && this.services.languageDetector) lngs = [];
14757
- const fl = isString(lngs) ? lngs : lngs && lngs[0];
14758
- const l2 = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
14759
- if (l2 && this.logger.debug && !isSafeLanguageCode(l2)) {
14760
- const configured = [].concat(this.options.supportedLngs || [], this.services.languageUtils.getFallbackCodes(this.options.fallbackLng, l2), this.options.preload || []);
14761
- if (!configured.includes(l2) && !Object.prototype.hasOwnProperty.call(this.store.data, l2)) {
14762
- this.logger.once(`lng:${l2}`, "deprecate", `changeLanguage: the language code '${l2.slice(0, 64)}' comes from lng, changeLanguage() or the language detector and is not configured; from v27 such a code is refused unless it has only letters, digits, '-', '_', '@' and '.' (no '..'), at most 128 characters. Set supportedLngs, or check the code before passing it on`);
14763
- }
15390
+ const {
15391
+ supportedLngs
15392
+ } = this.options;
15393
+ if (lngs && !supportedLngs) {
15394
+ const accepted = [].concat(lngs).filter((c2) => !isRefusedLanguageCode(this, c2));
15395
+ if (accepted.length < [].concat(lngs).length) lngs = accepted;
14764
15396
  }
15397
+ const fl = isString(lngs) ? lngs : lngs && lngs[0];
15398
+ let l2 = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
15399
+ if (supportedLngs && isRefusedLanguageCode(this, l2)) l2 = this.services.languageUtils.getBestMatchFromCodes([]);
14765
15400
  if (l2) {
14766
15401
  if (!this.language) {
14767
15402
  setLngProps(l2);
@@ -14876,7 +15511,7 @@ var I18n = class _I18n extends EventEmitter {
14876
15511
  }
14877
15512
  loadNamespaces(ns, callback) {
14878
15513
  const deferred = defer();
14879
- if (!this.options.ns) {
15514
+ if (!this.options.ns || !this.services.backendConnector) {
14880
15515
  if (callback) callback();
14881
15516
  return Promise.resolve();
14882
15517
  }
@@ -14894,7 +15529,7 @@ var I18n = class _I18n extends EventEmitter {
14894
15529
  const deferred = defer();
14895
15530
  if (isString(lngs)) lngs = [lngs];
14896
15531
  const preloaded = this.options.preload || [];
14897
- const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
15532
+ const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && !isRefusedLanguageCode(this, lng) && this.services.languageUtils.isSupportedCode(lng));
14898
15533
  if (!newLngs.length) {
14899
15534
  if (callback) callback();
14900
15535
  return Promise.resolve();
@@ -14944,16 +15579,15 @@ var I18n = class _I18n extends EventEmitter {
14944
15579
  }
14945
15580
  };
14946
15581
  const clone = new _I18n(mergedOptions);
14947
- if (options.debug !== void 0 || options.prefix !== void 0) {
14948
- clone.logger = clone.logger.clone(options);
14949
- }
14950
- const membersToCopy = ["store", "services", "language"];
15582
+ clone.logger = options.debug !== void 0 || options.prefix !== void 0 ? this.logger.clone(options) : this.logger;
15583
+ const membersToCopy = ["store", "language"];
14951
15584
  membersToCopy.forEach((m2) => {
14952
15585
  clone[m2] = this[m2];
14953
15586
  });
14954
15587
  clone.services = {
14955
15588
  ...this.services
14956
15589
  };
15590
+ clone.services.postProcessors = Object.create(this.services.postProcessors);
14957
15591
  clone.services.utils = {
14958
15592
  ...clone.services.utils,
14959
15593
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone),
@@ -14970,7 +15604,7 @@ var I18n = class _I18n extends EventEmitter {
14970
15604
  return copied;
14971
15605
  };
14972
15606
  const clonedData = copyData(this.store.data);
14973
- clone.store = new ResourceStore(clonedData, mergedOptions);
15607
+ clone.store = new ResourceStore(clonedData, mergedOptions, this.logger);
14974
15608
  clone.services.resourceStore = clone.store;
14975
15609
  }
14976
15610
  if (options.interpolation) {
@@ -14984,8 +15618,9 @@ var I18n = class _I18n extends EventEmitter {
14984
15618
  ...mergedOptions,
14985
15619
  interpolation: mergedInterpolation
14986
15620
  };
14987
- clone.services.interpolator = new Interpolator(mergedForInterpolator);
15621
+ clone.services.interpolator = new Interpolator(mergedForInterpolator, this.logger);
14988
15622
  }
15623
+ clone.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...configuredLanguageCodes(options)]);
14989
15624
  clone.translator = new Translator(clone.services, mergedOptions);
14990
15625
  clone.translator.on("*", (event, ...args) => {
14991
15626
  clone.emit(event, ...args);
@@ -15282,6 +15917,19 @@ var en = {
15282
15917
  "mo": "mo",
15283
15918
  "qtr": "qtr",
15284
15919
  "yr": "yr",
15920
+ "wk": "wk",
15921
+ "X days short": "{{amount, number}}d",
15922
+ "X weeks short": "{{amount, number}}wk",
15923
+ "X months short": "{{amount, number}}mo",
15924
+ "X years short": "{{amount, number}}yr",
15925
+ "X days_one": "{{count, number}} day",
15926
+ "X days_other": "{{count, number}} days",
15927
+ "X weeks_one": "{{count, number}} week",
15928
+ "X weeks_other": "{{count, number}} weeks",
15929
+ "X months_one": "{{count, number}} month",
15930
+ "X months_other": "{{count, number}} months",
15931
+ "X years_one": "{{count, number}} year",
15932
+ "X years_other": "{{count, number}} years",
15285
15933
  "one time": "one time",
15286
15934
  "billing period": "billing period",
15287
15935
  "billing period_one": "billing period",
@@ -15291,6 +15939,7 @@ var en = {
15291
15939
  "monthly": "monthly",
15292
15940
  "quarterly": "quarterly",
15293
15941
  "yearly": "yearly",
15942
+ "every period": "every {{period}}",
15294
15943
  "expires after purchase": "expires {{amount}} {{unit}} after purchase",
15295
15944
  "expires at the end of the billing period": "expires at the end of the billing period",
15296
15945
  "expires at the end of the next billing period": "expires at the end of the next billing period",
@@ -15593,6 +16242,23 @@ var it2 = {
15593
16242
  "mo": "mese",
15594
16243
  "qtr": "trim.",
15595
16244
  "yr": "anno",
16245
+ "wk": "sett.",
16246
+ "X days short": "{{amount, number}} gg",
16247
+ "X weeks short": "{{amount, number}} sett.",
16248
+ "X months short": "{{amount, number}} mesi",
16249
+ "X years short": "{{amount, number}} anni",
16250
+ "X days_one": "{{count, number}} giorno",
16251
+ "X days_many": "{{count, number}} giorni",
16252
+ "X days_other": "{{count, number}} giorni",
16253
+ "X weeks_one": "{{count, number}} settimana",
16254
+ "X weeks_many": "{{count, number}} settimane",
16255
+ "X weeks_other": "{{count, number}} settimane",
16256
+ "X months_one": "{{count, number}} mese",
16257
+ "X months_many": "{{count, number}} mesi",
16258
+ "X months_other": "{{count, number}} mesi",
16259
+ "X years_one": "{{count, number}} anno",
16260
+ "X years_many": "{{count, number}} anni",
16261
+ "X years_other": "{{count, number}} anni",
15596
16262
  "one time": "una tantum",
15597
16263
  "billing period": "periodo di fatturazione",
15598
16264
  "billing period_one": "periodo di fatturazione",
@@ -15626,6 +16292,7 @@ var it2 = {
15626
16292
  "monthly": "mensile",
15627
16293
  "quarterly": "trimestrale",
15628
16294
  "yearly": "annuale",
16295
+ "every period": "ogni {{period}}",
15629
16296
  "Usage by user": "Utilizzo per utente",
15630
16297
  "X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
15631
16298
  "Show all X users_one": "Mostra {{count, number}} utente",
@@ -15819,14 +16486,24 @@ function derivePeriod(interval, intervalCount) {
15819
16486
  }
15820
16487
  return interval;
15821
16488
  }
15822
- function getSubscriptionPeriod(billingSubscription) {
16489
+ function getSubscriptionInterval(billingSubscription) {
15823
16490
  if (!billingSubscription) {
15824
16491
  return void 0;
15825
16492
  }
15826
16493
  const product = billingSubscription.products?.find(
15827
16494
  (p2) => p2.interval && p2.interval !== "one-time"
15828
16495
  );
15829
- return derivePeriod(product?.interval, product?.intervalCount) ?? derivePeriod(billingSubscription.interval);
16496
+ if (product?.interval) {
16497
+ return { interval: product.interval, intervalCount: product.intervalCount };
16498
+ }
16499
+ return billingSubscription.interval ? { interval: billingSubscription.interval } : void 0;
16500
+ }
16501
+ function getSubscriptionPeriod(billingSubscription) {
16502
+ const subscriptionInterval = getSubscriptionInterval(billingSubscription);
16503
+ return derivePeriod(
16504
+ subscriptionInterval?.interval,
16505
+ subscriptionInterval?.intervalCount
16506
+ );
15830
16507
  }
15831
16508
  function getDefaultPlanPeriod(plans = []) {
15832
16509
  if (plans.some((plan) => plan.monthlyPrice)) return "month";
@@ -16099,6 +16776,8 @@ function getResetCadencePeriod(cadence) {
16099
16776
  switch (cadence) {
16100
16777
  case BillingPlanCreditGrantResetCadence.Yearly:
16101
16778
  return "year";
16779
+ case BillingPlanCreditGrantResetCadence.Quarterly:
16780
+ return "quarter";
16102
16781
  case BillingPlanCreditGrantResetCadence.Monthly:
16103
16782
  return "month";
16104
16783
  case BillingPlanCreditGrantResetCadence.Weekly:
@@ -16588,6 +17267,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
16588
17267
  function entitlementHasCost(entitlement) {
16589
17268
  return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
16590
17269
  }
17270
+ function hasMeteredCosts(entitlements) {
17271
+ return entitlements.some(
17272
+ ({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
17273
+ );
17274
+ }
16591
17275
  function entitlementHasHardLimit(entitlement) {
16592
17276
  return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
16593
17277
  }
@@ -16737,8 +17421,38 @@ function getMonthName(date, { locale, ...format }) {
16737
17421
  ...format
16738
17422
  }).format(new Date(date));
16739
17423
  }
16740
- function shortenPeriod(period, t3) {
16741
- switch (period) {
17424
+ var QUARTERLY_INTERVAL_COUNT = 3;
17425
+ var YEARLY_INTERVAL_COUNT = 12;
17426
+ function normalizeInterval(interval, intervalCount) {
17427
+ const count = intervalCount && intervalCount > 1 ? intervalCount : 1;
17428
+ if (interval === "month" && count === QUARTERLY_INTERVAL_COUNT) {
17429
+ return { period: "quarter", count: 1 };
17430
+ }
17431
+ if (interval === "month" && count === YEARLY_INTERVAL_COUNT) {
17432
+ return { period: "year", count: 1 };
17433
+ }
17434
+ return { period: interval, count };
17435
+ }
17436
+ function shortenPeriod(period, t3, intervalCount) {
17437
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17438
+ if (count > 1) {
17439
+ switch (unit) {
17440
+ case "day":
17441
+ return t3("X days short", { amount: count });
17442
+ case "week":
17443
+ return t3("X weeks short", { amount: count });
17444
+ case "month":
17445
+ return t3("X months short", { amount: count });
17446
+ case "year":
17447
+ return t3("X years short", { amount: count });
17448
+ }
17449
+ return;
17450
+ }
17451
+ switch (unit) {
17452
+ case "day":
17453
+ return t3("day");
17454
+ case "week":
17455
+ return t3("wk");
16742
17456
  case "month":
16743
17457
  return t3("mo");
16744
17458
  case "quarter":
@@ -16747,6 +17461,31 @@ function shortenPeriod(period, t3) {
16747
17461
  return t3("yr");
16748
17462
  }
16749
17463
  }
17464
+ function nameInterval(period, t3, intervalCount) {
17465
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17466
+ if (count > 1) {
17467
+ switch (unit) {
17468
+ case "day":
17469
+ return t3("X days", { count });
17470
+ case "week":
17471
+ return t3("X weeks", { count });
17472
+ case "month":
17473
+ return t3("X months", { count });
17474
+ case "year":
17475
+ return t3("X years", { count });
17476
+ }
17477
+ return period;
17478
+ }
17479
+ switch (unit) {
17480
+ case "day":
17481
+ case "week":
17482
+ case "month":
17483
+ case "quarter":
17484
+ case "year":
17485
+ return t3(unit);
17486
+ }
17487
+ return period;
17488
+ }
16750
17489
  function modifyDate(date, days) {
16751
17490
  const copy3 = new Date(date);
16752
17491
  copy3.setDate(copy3.getDate() + days);
@@ -16829,8 +17568,14 @@ function formatCurrency(amount, {
16829
17568
  function formatOrdinal(n2, t3) {
16830
17569
  return t3("Ordinal", { count: n2, ordinal: true });
16831
17570
  }
16832
- function adjectify(period, t3) {
16833
- switch (period) {
17571
+ function adjectify(period, t3, intervalCount) {
17572
+ const { period: unit, count } = normalizeInterval(period, intervalCount);
17573
+ if (count > 1) {
17574
+ return t3("every period", {
17575
+ period: nameInterval(period, t3, intervalCount)
17576
+ });
17577
+ }
17578
+ switch (unit) {
16834
17579
  case "day":
16835
17580
  return t3("daily");
16836
17581
  case "week":
@@ -17013,6 +17758,25 @@ var createKeyboardExecutionHandler = (fn) => {
17013
17758
  return handler;
17014
17759
  };
17015
17760
 
17761
+ // src/utils/invoiceLink.ts
17762
+ function openInvoiceLink(event, storedUrl, fetchUrl) {
17763
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
17764
+ return Promise.resolve();
17765
+ }
17766
+ const tab = window.open("", "_blank");
17767
+ if (tab === null) {
17768
+ return Promise.resolve();
17769
+ }
17770
+ event.preventDefault();
17771
+ tab.opener = null;
17772
+ return fetchUrl().then(
17773
+ (url) => url || storedUrl,
17774
+ () => storedUrl
17775
+ ).then((url) => {
17776
+ tab.location.href = url;
17777
+ });
17778
+ }
17779
+
17016
17780
  // src/utils/markdown.tsx
17017
17781
  var import_react4 = require("react");
17018
17782
  var import_jsx_runtime3 = require("react/jsx-runtime");
@@ -17765,7 +18529,7 @@ var reducer = (state, action) => {
17765
18529
  // src/context/EmbedProvider.tsx
17766
18530
  var import_jsx_runtime4 = require("react/jsx-runtime");
17767
18531
  var getCustomHeaders = (sessionId) => ({
17768
- "X-Schematic-Components-Version": "2.37.0",
18532
+ "X-Schematic-Components-Version": "2.39.0",
17769
18533
  "X-Schematic-Session-ID": sessionId
17770
18534
  });
17771
18535
  var normalizeCurrencyFilter = (filter2) => {
@@ -18153,6 +18917,12 @@ var EmbedProvider = ({
18153
18917
  () => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
18154
18918
  [listInvoices]
18155
18919
  );
18920
+ const getInvoiceLink = (0, import_react5.useCallback)(
18921
+ async (billingInvoiceId) => {
18922
+ return checkoutApi?.getInvoiceLink({ billingInvoiceId });
18923
+ },
18924
+ [checkoutApi]
18925
+ );
18156
18926
  const getCreditUsageByUser = (0, import_react5.useCallback)(
18157
18927
  async (billingCreditId, limit) => {
18158
18928
  return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
@@ -18347,6 +19117,7 @@ var EmbedProvider = ({
18347
19117
  getUpcomingInvoice: debouncedGetUpcomingInvoice,
18348
19118
  getCustomerBalance: debouncedGetCustomerBalance,
18349
19119
  listInvoices: debouncedListInvoices,
19120
+ getInvoiceLink,
18350
19121
  getCreditUsageByUser: debouncedGetCreditUsageByUser,
18351
19122
  getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
18352
19123
  finishCheckout,
@@ -18485,10 +19256,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18485
19256
  return periods;
18486
19257
  }, [data?.activePlans, data?.activeAddOns]);
18487
19258
  const getActivePlans = (0, import_react8.useCallback)(
18488
- (plans) => {
19259
+ (plans, period = activePeriod) => {
18489
19260
  const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
18490
19261
  if (options.useSelectedPeriod) {
18491
- return activePeriod === "month" && plan.monthlyPrice || activePeriod === "quarter" && plan.quarterlyPrice || activePeriod === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
19262
+ return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18492
19263
  }
18493
19264
  return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
18494
19265
  });
@@ -18500,7 +19271,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
18500
19271
  return {
18501
19272
  plans: getActivePlans(data?.activePlans || []),
18502
19273
  addOns: getActivePlans(data?.activeAddOns || []),
18503
- periods: getAvailablePeriods()
19274
+ periods: getAvailablePeriods(),
19275
+ plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
18504
19276
  };
18505
19277
  }, [
18506
19278
  data?.activePlans,
@@ -22199,28 +22971,49 @@ var CheckoutDialog = ({ top }) => {
22199
22971
  }
22200
22972
  }, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
22201
22973
  const {
22202
- plans: availablePlans,
22974
+ plans: periodPlans,
22203
22975
  addOns: availableAddOns,
22204
- periods: availablePeriods
22976
+ periods: availablePeriods,
22977
+ plansForPeriod
22205
22978
  } = useAvailablePlans(planPeriod, {
22206
22979
  useSelectedPeriod: showPeriodToggle
22207
22980
  });
22208
- const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(void 0);
22209
- const selectedPlan = (0, import_react30.useMemo)(() => {
22210
- if (selectedPlanId === null) {
22211
- return void 0;
22212
- }
22213
- if (selectedPlanId) {
22214
- return availablePlans.find((p2) => p2.id === selectedPlanId);
22215
- }
22216
- if (checkoutState?.planId) {
22217
- return availablePlans.find((plan) => plan.id === checkoutState.planId);
22218
- }
22219
- return availablePlans.find(
22220
- (plan) => plan.current && // do not initially set the current plan for a trial
22221
- (!plan.isTrialable || !plan.companyCanTrial)
22222
- );
22223
- }, [availablePlans, checkoutState, selectedPlanId]);
22981
+ const requestedPlanId = checkoutState?.planId;
22982
+ const bypassPlanSelection = checkoutState?.bypassPlanSelection;
22983
+ const supportsCheckoutCurrency = (0, import_react30.useCallback)(
22984
+ (plan) => !hasCurrency || planSupportsCurrency(plan, effectiveCurrency) || // A plan the host picks and skips past is kept so the currency/period
22985
+ // mismatch notice can say it is unavailable.
22986
+ !!bypassPlanSelection && plan.id === requestedPlanId,
22987
+ [hasCurrency, effectiveCurrency, bypassPlanSelection, requestedPlanId]
22988
+ );
22989
+ const availablePlans = (0, import_react30.useMemo)(
22990
+ () => periodPlans.filter(supportsCheckoutCurrency),
22991
+ [periodPlans, supportsCheckoutCurrency]
22992
+ );
22993
+ const [selectedPlanId, setSelectedPlanId] = (0, import_react30.useState)(
22994
+ void 0
22995
+ );
22996
+ const isTrialing = data?.company?.billingSubscription?.status === "trialing";
22997
+ const findSelectedPlan = (0, import_react30.useCallback)(
22998
+ (plans) => {
22999
+ if (selectedPlanId) {
23000
+ return plans.find((p2) => p2.id === selectedPlanId);
23001
+ }
23002
+ if (requestedPlanId) {
23003
+ return plans.find((plan) => plan.id === requestedPlanId);
23004
+ }
23005
+ return plans.find(
23006
+ (plan) => plan.current && // A company that could trial its current plan chooses for itself,
23007
+ // unless it is already trialing it.
23008
+ (isTrialing || !plan.isTrialable || !plan.companyCanTrial)
23009
+ );
23010
+ },
23011
+ [requestedPlanId, selectedPlanId, isTrialing]
23012
+ );
23013
+ const selectedPlan = (0, import_react30.useMemo)(
23014
+ () => findSelectedPlan(availablePlans),
23015
+ [availablePlans, findSelectedPlan]
23016
+ );
22224
23017
  const [shouldTrial, setShouldTrial] = (0, import_react30.useState)(false);
22225
23018
  const displayedPlanCreditGrants = (0, import_react30.useMemo)(
22226
23019
  () => getDisplayedPlanCreditGrants(selectedPlan),
@@ -22586,7 +23379,7 @@ var CheckoutDialog = ({ top }) => {
22586
23379
  }, [currencies, selectedPlan, planPeriod]);
22587
23380
  const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
22588
23381
  const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
22589
- const currencyPeriodMismatch = hasCurrency && !lockedCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
23382
+ const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
22590
23383
  (0, import_react30.useEffect)(() => {
22591
23384
  if (currencyPeriodMismatch) {
22592
23385
  console.error(
@@ -22638,7 +23431,6 @@ var CheckoutDialog = ({ top }) => {
22638
23431
  if (isBypassLoading) {
22639
23432
  setIsBypassLoading(false);
22640
23433
  }
22641
- setSelectedPlanId(null);
22642
23434
  return;
22643
23435
  }
22644
23436
  const requestId = ++previewRequestIdRef.current;
@@ -22877,7 +23669,8 @@ var CheckoutDialog = ({ top }) => {
22877
23669
  }
22878
23670
  const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
22879
23671
  setShouldTrial(updatedShouldTrial);
22880
- if (willTrialWithoutPaymentMethod) {
23672
+ const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
23673
+ if (updatedWillTrialWithoutPaymentMethod) {
22881
23674
  setSelectedAddOnIds(/* @__PURE__ */ new Set());
22882
23675
  }
22883
23676
  const resolvedCreditBundles = (data?.creditBundles ?? []).map(
@@ -22890,14 +23683,10 @@ var CheckoutDialog = ({ top }) => {
22890
23683
  period,
22891
23684
  plan,
22892
23685
  shouldTrial: updatedShouldTrial,
22893
- ...willTrialWithoutPaymentMethod ? {
22894
- addOns: [],
22895
- payInAdvanceEntitlements: []
22896
- } : {
22897
- payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
22898
- ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
22899
- )
22900
- },
23686
+ ...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
23687
+ payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
23688
+ ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
23689
+ ),
22901
23690
  creditBundles: resolvedCreditBundles
22902
23691
  });
22903
23692
  },
@@ -22909,7 +23698,7 @@ var CheckoutDialog = ({ top }) => {
22909
23698
  featureUsage,
22910
23699
  bundleCounts,
22911
23700
  shouldTrial,
22912
- willTrialWithoutPaymentMethod,
23701
+ trialPaymentMethodRequired,
22913
23702
  handlePreviewCheckout,
22914
23703
  checkoutState?.payInAdvanceQuantities
22915
23704
  ]
@@ -22920,40 +23709,42 @@ var CheckoutDialog = ({ top }) => {
22920
23709
  return;
22921
23710
  }
22922
23711
  setPlanPeriod(period);
22923
- const updatedUsageBasedEntitlements = (selectedPlan?.entitlements || []).reduce(
22924
- createActiveUsageBasedEntitlementsReducer(featureUsage, period),
22925
- [...[]]
22926
- );
22927
- setUsageBasedEntitlements(
22928
- (prev2) => updatedUsageBasedEntitlements.map((updated) => {
22929
- const current = prev2.find(
22930
- ({ featureId }) => featureId === updated.featureId
22931
- );
22932
- if (typeof current?.quantity === "number") {
22933
- return { ...updated, quantity: current.quantity };
22934
- }
22935
- return updated;
22936
- })
23712
+ const plan = findSelectedPlan(
23713
+ plansForPeriod(period).filter(supportsCheckoutCurrency)
22937
23714
  );
23715
+ const updatedUsageBasedEntitlements = plan ? (plan.entitlements || []).reduce(
23716
+ createActiveUsageBasedEntitlementsReducer(featureUsage, period),
23717
+ []
23718
+ ).map((updated) => {
23719
+ const current = usageBasedEntitlements.find(
23720
+ ({ featureId }) => featureId === updated.featureId
23721
+ );
23722
+ if (typeof current?.quantity === "number") {
23723
+ return { ...updated, quantity: current.quantity };
23724
+ }
23725
+ return updated;
23726
+ }) : usageBasedEntitlements;
23727
+ if (plan) {
23728
+ setUsageBasedEntitlements(updatedUsageBasedEntitlements);
23729
+ }
22938
23730
  const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
22939
23731
  (addOn) => (addOn.entitlements ?? []).reduce(
22940
23732
  createActiveUsageBasedEntitlementsReducer(featureUsage, period),
22941
23733
  []
22942
23734
  )
22943
- );
22944
- setAddOnUsageBasedEntitlements(
22945
- (prev2) => updatedAddOnUsageBasedEntitlements.map((updated) => {
22946
- const current = prev2.find(
22947
- ({ featureId }) => featureId === updated.featureId
22948
- );
22949
- if (typeof current?.quantity === "number") {
22950
- return { ...updated, quantity: current.quantity };
22951
- }
22952
- return updated;
22953
- })
22954
- );
23735
+ ).map((updated) => {
23736
+ const current = addOnUsageBasedEntitlements.find(
23737
+ ({ featureId }) => featureId === updated.featureId
23738
+ );
23739
+ if (typeof current?.quantity === "number") {
23740
+ return { ...updated, quantity: current.quantity };
23741
+ }
23742
+ return updated;
23743
+ });
23744
+ setAddOnUsageBasedEntitlements(updatedAddOnUsageBasedEntitlements);
22955
23745
  handlePreviewCheckout({
22956
23746
  period,
23747
+ plan,
22957
23748
  payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
22958
23749
  ({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
22959
23750
  ),
@@ -22964,9 +23755,13 @@ var CheckoutDialog = ({ top }) => {
22964
23755
  },
22965
23756
  [
22966
23757
  planPeriod,
22967
- selectedPlan?.entitlements,
23758
+ plansForPeriod,
23759
+ findSelectedPlan,
23760
+ supportsCheckoutCurrency,
22968
23761
  featureUsage,
23762
+ usageBasedEntitlements,
22969
23763
  addOns,
23764
+ addOnUsageBasedEntitlements,
22970
23765
  setPlanPeriod,
22971
23766
  handlePreviewCheckout
22972
23767
  ]
@@ -23110,12 +23905,12 @@ var CheckoutDialog = ({ top }) => {
23110
23905
  }, [setLayout, clearCheckoutState]);
23111
23906
  const hasInitializedPlan = (0, import_react30.useRef)(false);
23112
23907
  (0, import_react30.useEffect)(() => {
23113
- if (!hasInitializedPlan.current && selectedPlan) {
23908
+ if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
23114
23909
  hasInitializedPlan.current = true;
23115
- const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23910
+ const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
23116
23911
  selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
23117
23912
  }
23118
- }, [selectedPlan, planPeriod, selectPlan]);
23913
+ }, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
23119
23914
  (0, import_react30.useLayoutEffect)(() => {
23120
23915
  const element = dialogRef.current;
23121
23916
  if (layout !== "checkout" || !element) {
@@ -23363,6 +24158,7 @@ var CheckoutDialog = ({ top }) => {
23363
24158
  options: availablePeriods,
23364
24159
  selectedOption: planPeriod,
23365
24160
  selectedPlan,
24161
+ currency: hasCurrency ? effectiveCurrency : void 0,
23366
24162
  onSelect: changePlanPeriod
23367
24163
  }
23368
24164
  )
@@ -24169,6 +24965,7 @@ var PeriodToggle = ({
24169
24965
  options,
24170
24966
  selectedOption,
24171
24967
  selectedPlan,
24968
+ currency,
24172
24969
  onSelect
24173
24970
  }) => {
24174
24971
  const { t: t3 } = useTranslation();
@@ -24179,19 +24976,19 @@ var PeriodToggle = ({
24179
24976
  if (!selectedPlan) {
24180
24977
  return result;
24181
24978
  }
24182
- const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
24979
+ const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
24183
24980
  if (monthlyPrice <= 0) {
24184
24981
  return result;
24185
24982
  }
24186
24983
  for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
24187
- const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
24984
+ const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
24188
24985
  if (periodPrice > 0) {
24189
24986
  const baseline = monthlyPrice * months;
24190
24987
  result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
24191
24988
  }
24192
24989
  }
24193
24990
  return result;
24194
- }, [selectedPlan]);
24991
+ }, [selectedPlan, currency]);
24195
24992
  return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
24196
24993
  Flex,
24197
24994
  {
@@ -24579,10 +25376,12 @@ var CheckoutStageButton = ({
24579
25376
  willScheduleDowngrade,
24580
25377
  hasIncompleteRequiredCustomFields = false,
24581
25378
  isCreditOnlyPurchase = false,
24582
- isOneTimeOnlyPurchase = false
25379
+ isOneTimeOnlyPurchase = false,
25380
+ isUnchangedTrial = false
24583
25381
  }) => {
24584
25382
  const { t: t3 } = useTranslation();
24585
25383
  const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
25384
+ const isCheckoutDisabled = isDisabled || isUnchangedTrial;
24586
25385
  const optInUnmet = optInRequired && !optInAccepted;
24587
25386
  const getNextStageId = (currentStageId) => {
24588
25387
  if (!checkoutStages) return void 0;
@@ -24644,7 +25443,7 @@ var CheckoutStageButton = ({
24644
25443
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24645
25444
  NoPaymentRequired,
24646
25445
  {
24647
- isDisabled,
25446
+ isDisabled: isCheckoutDisabled,
24648
25447
  isLoading,
24649
25448
  onClick: checkout,
24650
25449
  isSticky,
@@ -24679,7 +25478,7 @@ var CheckoutStageButton = ({
24679
25478
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24680
25479
  NoPaymentRequired,
24681
25480
  {
24682
- isDisabled,
25481
+ isDisabled: isCheckoutDisabled,
24683
25482
  isLoading,
24684
25483
  onClick: checkout,
24685
25484
  isSticky,
@@ -24723,7 +25522,7 @@ var CheckoutStageButton = ({
24723
25522
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24724
25523
  NoPaymentRequired,
24725
25524
  {
24726
- isDisabled,
25525
+ isDisabled: isCheckoutDisabled,
24727
25526
  isLoading,
24728
25527
  onClick: checkout,
24729
25528
  isSticky,
@@ -24767,7 +25566,7 @@ var CheckoutStageButton = ({
24767
25566
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24768
25567
  NoPaymentRequired,
24769
25568
  {
24770
- isDisabled,
25569
+ isDisabled: isCheckoutDisabled,
24771
25570
  isLoading,
24772
25571
  onClick: checkout,
24773
25572
  isSticky,
@@ -24810,7 +25609,7 @@ var CheckoutStageButton = ({
24810
25609
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24811
25610
  NoPaymentRequired,
24812
25611
  {
24813
- isDisabled,
25612
+ isDisabled: isCheckoutDisabled,
24814
25613
  isLoading,
24815
25614
  onClick: checkout,
24816
25615
  isSticky,
@@ -24854,7 +25653,7 @@ var CheckoutStageButton = ({
24854
25653
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24855
25654
  NoPaymentRequired,
24856
25655
  {
24857
- isDisabled,
25656
+ isDisabled: isCheckoutDisabled,
24858
25657
  isLoading,
24859
25658
  onClick: checkout,
24860
25659
  isSticky,
@@ -24898,7 +25697,7 @@ var CheckoutStageButton = ({
24898
25697
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
24899
25698
  NoPaymentRequired,
24900
25699
  {
24901
- isDisabled: isDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
25700
+ isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
24902
25701
  isLoading,
24903
25702
  onClick: checkout,
24904
25703
  isSticky,
@@ -24914,7 +25713,7 @@ var CheckoutStageButton = ({
24914
25713
  Button,
24915
25714
  {
24916
25715
  type: "button",
24917
- disabled: isDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
25716
+ disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
24918
25717
  onClick: checkout,
24919
25718
  $fullWidth: true,
24920
25719
  $isLoading: isLoading,
@@ -25396,9 +26195,9 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25396
26195
  ]);
25397
26196
  const selectedAddOnsWithPrice = (0, import_react38.useMemo)(
25398
26197
  () => addOns.filter(
25399
- (addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
26198
+ (addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
25400
26199
  ),
25401
- [addOns, currency]
26200
+ [addOns, planPeriod, currency]
25402
26201
  );
25403
26202
  const selectedOneTimeAddOns = (0, import_react38.useMemo)(
25404
26203
  () => addOns.filter(
@@ -25408,7 +26207,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25408
26207
  );
25409
26208
  const { removedAddOns, willAddOnsChange } = (0, import_react38.useMemo)(() => {
25410
26209
  const addedAddOns = selectedAddOnsWithPrice.filter(
25411
- (selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
26210
+ (selected) => !currentAddOns.some((current) => selected.id === current.id)
25412
26211
  );
25413
26212
  const removedAddOns2 = currentAddOns.filter(
25414
26213
  (current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
@@ -25421,7 +26220,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25421
26220
  removedAddOns: removedAddOns2,
25422
26221
  willAddOnsChange: willAddOnsChange2
25423
26222
  };
25424
- }, [currentAddOns, selectedAddOnsWithPrice, currency]);
26223
+ }, [currentAddOns, selectedAddOnsWithPrice]);
25425
26224
  const addedCreditBundles = (0, import_react38.useMemo)(
25426
26225
  () => creditBundles.filter((bundle) => bundle.count > 0),
25427
26226
  [creditBundles]
@@ -25447,6 +26246,24 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25447
26246
  selectedOneTimeAddOns.length,
25448
26247
  addedCreditBundles.length
25449
26248
  ]);
26249
+ const isUnchangedTrial = (0, import_react38.useMemo)(() => {
26250
+ if (billingSubscription?.status !== "trialing" || !selectedPlan?.current) {
26251
+ return false;
26252
+ }
26253
+ const currentPeriod = getSubscriptionPeriod(billingSubscription);
26254
+ if (currentPeriod && currentPeriod !== planPeriod) {
26255
+ return false;
26256
+ }
26257
+ return !willAddOnsChange && updatedUsageBasedEntitlements.changed.length === 0 && selectedOneTimeAddOns.length === 0 && addedCreditBundles.length === 0;
26258
+ }, [
26259
+ selectedPlan,
26260
+ billingSubscription,
26261
+ planPeriod,
26262
+ willAddOnsChange,
26263
+ updatedUsageBasedEntitlements.changed.length,
26264
+ selectedOneTimeAddOns.length,
26265
+ addedCreditBundles.length
26266
+ ]);
25450
26267
  const discountApplied = (0, import_react38.useMemo)(
25451
26268
  () => promoCode && (amountOff > 0 || percentOff > 0),
25452
26269
  [promoCode, amountOff, percentOff]
@@ -25640,6 +26457,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25640
26457
  hasIncompleteRequiredCustomFields,
25641
26458
  isCreditOnlyPurchase,
25642
26459
  isOneTimeOnlyPurchase,
26460
+ isUnchangedTrial,
25643
26461
  checkout: handleCheckout
25644
26462
  }
25645
26463
  );
@@ -25685,6 +26503,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25685
26503
  addOnPayInAdvanceEntitlements,
25686
26504
  isCreditOnlyPurchase,
25687
26505
  isOneTimeOnlyPurchase,
26506
+ isUnchangedTrial,
25688
26507
  hasIncompleteRequiredCustomFields
25689
26508
  ]);
25690
26509
  (0, import_react38.useLayoutEffect)(() => {
@@ -25719,7 +26538,10 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25719
26538
  subscriptionPrice,
25720
26539
  planPeriod,
25721
26540
  periodStart: renewDate,
25722
- hasUsageBasedCosts: usageBasedEntitlements.length > 0,
26541
+ hasUsageBasedCosts: hasMeteredCosts([
26542
+ ...usageBasedEntitlements,
26543
+ ...addOnUsageBasedEntitlements
26544
+ ]),
25723
26545
  discount: subscriptionDiscount,
25724
26546
  locale
25725
26547
  },
@@ -25731,6 +26553,14 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25731
26553
  locale
25732
26554
  })
25733
26555
  }) : billingPreviewText;
26556
+ const currentPriceInterval = getSubscriptionInterval(
26557
+ billingSubscription
26558
+ ) ?? { interval: currentPlan?.planPeriod || planPeriod };
26559
+ const currentPriceSuffix = shortenPeriod(
26560
+ currentPriceInterval.interval,
26561
+ t3,
26562
+ currentPriceInterval.intervalCount
26563
+ );
25734
26564
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
25735
26565
  Flex,
25736
26566
  {
@@ -25799,10 +26629,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
25799
26629
  }),
25800
26630
  /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
25801
26631
  "/",
25802
- shortenPeriod(
25803
- getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
25804
- t3
25805
- )
26632
+ currentPriceSuffix
25806
26633
  ] })
25807
26634
  ] }) })
25808
26635
  ]
@@ -26012,7 +26839,7 @@ var SubscriptionSidebar = (0, import_react38.forwardRef)(
26012
26839
  }),
26013
26840
  addOn.planPeriod !== "one-time" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
26014
26841
  "/",
26015
- shortenPeriod(planPeriod, t3)
26842
+ currentPriceSuffix
26016
26843
  ] })
26017
26844
  ] }) })
26018
26845
  ]
@@ -27326,12 +28153,13 @@ function formatInvoices(invoices, locale, options) {
27326
28153
  const dateA = a2.dueDate ?? a2.createdAt;
27327
28154
  const dateB = b2.dueDate ?? b2.createdAt;
27328
28155
  return +dateB - +dateA;
27329
- }).map(({ amountDue, dueDate, createdAt, url, currency }) => {
28156
+ }).map(({ amountDue, dueDate, createdAt, id, url, currency }) => {
27330
28157
  const formatted = formatCurrency(Math.abs(amountDue), {
27331
28158
  locale,
27332
28159
  currency
27333
28160
  });
27334
28161
  return {
28162
+ id,
27335
28163
  amount: amountDue < 0 ? `(${formatted})` : formatted,
27336
28164
  amountDue,
27337
28165
  date: toPrettyDate(dueDate ?? createdAt, { locale }),
@@ -27342,7 +28170,7 @@ function formatInvoices(invoices, locale, options) {
27342
28170
  var Invoices = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
27343
28171
  const props = resolveDesignProps3(rest);
27344
28172
  const { t: t3, locale } = useTranslation();
27345
- const { data, listInvoices, settings } = useEmbed();
28173
+ const { data, getInvoiceLink, listInvoices, settings } = useEmbed();
27346
28174
  const [isLoading, setIsLoading] = (0, import_react45.useState)(false);
27347
28175
  const [error, setError] = (0, import_react45.useState)();
27348
28176
  const [rawInvoices, setInvoices] = (0, import_react45.useState)(
@@ -27419,7 +28247,7 @@ var Invoices = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
27419
28247
  props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Text, { display: props.header.fontStyle, children: t3("Invoices") }) }),
27420
28248
  invoices.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
27421
28249
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: visibleInvoices.items.map(
27422
- ({ date, amount, amountDue, url }, index) => {
28250
+ ({ id, date, amount, amountDue, url }, index) => {
27423
28251
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
27424
28252
  Flex,
27425
28253
  {
@@ -27430,11 +28258,18 @@ var Invoices = (0, import_react45.forwardRef)(({ className, ...rest }, ref) => {
27430
28258
  Text,
27431
28259
  {
27432
28260
  display: props.date.fontStyle,
27433
- ...url && {
28261
+ ...id && url && {
27434
28262
  as: "a",
27435
28263
  href: url,
27436
28264
  target: "_blank",
27437
- rel: "noreferrer"
28265
+ rel: "noreferrer",
28266
+ onClick: (event) => {
28267
+ void openInvoiceLink(
28268
+ event,
28269
+ url,
28270
+ async () => (await getInvoiceLink(id))?.data.url
28271
+ );
28272
+ }
27438
28273
  },
27439
28274
  $color: url ? settings.theme.typography.link.color : settings.theme.typography.text.color,
27440
28275
  children: date
@@ -29169,9 +30004,14 @@ var import_react52 = require("react");
29169
30004
 
29170
30005
  // src/components/elements/plan-manager/AddOn.tsx
29171
30006
  var import_jsx_runtime63 = require("react/jsx-runtime");
29172
- var AddOn = ({ addOn, currency, period, layout }) => {
30007
+ var AddOn = ({
30008
+ addOn,
30009
+ currency,
30010
+ priceInterval,
30011
+ layout
30012
+ }) => {
29173
30013
  const { t: t3, locale } = useTranslation();
29174
- const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
30014
+ const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
29175
30015
  return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
29176
30016
  Flex,
29177
30017
  {
@@ -29181,9 +30021,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
29181
30021
  $gap: "1rem",
29182
30022
  children: [
29183
30023
  /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
29184
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
30024
+ typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
29185
30025
  formatCurrency(addOn.planPrice, { locale, currency }),
29186
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod, t3) : `/${shortenPeriod(resolvedPeriod, t3)}` })
30026
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children: resolvedInterval.interval === "one-time" ? shortenPeriod(resolvedInterval.interval, t3) : `/${shortenPeriod(
30027
+ resolvedInterval.interval,
30028
+ t3,
30029
+ resolvedInterval.intervalCount
30030
+ )}` })
29187
30031
  ] })
29188
30032
  ]
29189
30033
  }
@@ -29484,7 +30328,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29484
30328
  willSubscriptionCancel,
29485
30329
  isTrialSubscription
29486
30330
  } = (0, import_react52.useMemo)(() => {
29487
- const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
30331
+ const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
29488
30332
  const subscriptionCurrency2 = billingSubscription?.currency;
29489
30333
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
29490
30334
  const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
@@ -29496,6 +30340,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29496
30340
  };
29497
30341
  }, [billingSubscription]);
29498
30342
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
30343
+ const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
29499
30344
  const { isFreePlan, isUsageBasedPlan } = (0, import_react52.useMemo)(() => {
29500
30345
  const isFreePlan2 = currentPlan?.planPrice === 0;
29501
30346
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
@@ -29654,9 +30499,13 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29654
30499
  })
29655
30500
  }
29656
30501
  ),
29657
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
30502
+ !isFreePlan && currentPriceInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
29658
30503
  "/",
29659
- shortenPeriod(currentPlanPeriod, t3)
30504
+ shortenPeriod(
30505
+ currentPriceInterval.interval,
30506
+ t3,
30507
+ currentPriceInterval.intervalCount
30508
+ )
29660
30509
  ] }) })
29661
30510
  ] })
29662
30511
  ]
@@ -29676,7 +30525,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29676
30525
  {
29677
30526
  addOn,
29678
30527
  currency: subscriptionCurrency,
29679
- period: currentPlanPeriod,
30528
+ priceInterval: currentPriceInterval,
29680
30529
  layout: props
29681
30530
  },
29682
30531
  addOnIndex
@@ -29735,7 +30584,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29735
30584
  resolveLicenseQuantity
29736
30585
  );
29737
30586
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
29738
- const creditPeriod = composition.period ?? subscriptionInterval;
30587
+ const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
29739
30588
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
29740
30589
  return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
29741
30590
  Flex,
@@ -29765,7 +30614,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29765
30614
  1
29766
30615
  )
29767
30616
  }),
29768
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30617
+ composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
29769
30618
  " ",
29770
30619
  t3("Plus X credits per period", {
29771
30620
  amount: composition.fixedQuantity,
@@ -29774,8 +30623,10 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29774
30623
  locale,
29775
30624
  composition.fixedQuantity
29776
30625
  ),
29777
- period: t3(
29778
- creditPeriod
30626
+ period: nameInterval(
30627
+ creditInterval.interval,
30628
+ t3,
30629
+ creditInterval.intervalCount
29779
30630
  )
29780
30631
  })
29781
30632
  ] })
@@ -29784,11 +30635,13 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29784
30635
  " ",
29785
30636
  getFeatureName(group, locale, group.total.value),
29786
30637
  " ",
29787
- subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
30638
+ creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
29788
30639
  t3("per"),
29789
30640
  " ",
29790
- t3(
29791
- subscriptionInterval
30641
+ nameInterval(
30642
+ creditInterval.interval,
30643
+ t3,
30644
+ creditInterval.intervalCount
29792
30645
  )
29793
30646
  ] })
29794
30647
  ] }) }),
@@ -29815,7 +30668,7 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29815
30668
  ]
29816
30669
  }
29817
30670
  ),
29818
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
30671
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
29819
30672
  Text,
29820
30673
  {
29821
30674
  style: { opacity: 0.54 },
@@ -29836,7 +30689,11 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29836
30689
  locale,
29837
30690
  resolvedTotal
29838
30691
  ),
29839
- period: shortenPeriod(creditPeriod, t3)
30692
+ period: shortenPeriod(
30693
+ creditInterval.interval,
30694
+ t3,
30695
+ creditInterval.intervalCount
30696
+ )
29840
30697
  }) : t3("X licenses times Y credits", {
29841
30698
  quantity: licenseQuantity,
29842
30699
  licenseName: getFeatureName(
@@ -29851,7 +30708,11 @@ var PlanManager = (0, import_react52.forwardRef)(({ children, className, portal,
29851
30708
  locale,
29852
30709
  resolvedTotal
29853
30710
  ),
29854
- period: shortenPeriod(creditPeriod, t3)
30711
+ period: shortenPeriod(
30712
+ creditInterval.interval,
30713
+ t3,
30714
+ creditInterval.intervalCount
30715
+ )
29855
30716
  })
29856
30717
  }
29857
30718
  )
@@ -31067,16 +31928,18 @@ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
31067
31928
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
31068
31929
  );
31069
31930
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
31070
- const [selectedCurrency, setSelectedCurrency] = (0, import_react55.useState)(
31931
+ const [chosenCurrency, setSelectedCurrency] = (0, import_react55.useState)(
31071
31932
  () => currencies[0] ?? DEFAULT_CURRENCY
31072
31933
  );
31073
- if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
31934
+ if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
31074
31935
  setSelectedCurrency(currencies[0]);
31075
31936
  }
31937
+ const lockedCurrency = useSubscriptionCurrency();
31938
+ const selectedCurrency = lockedCurrency ?? chosenCurrency;
31076
31939
  const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
31077
31940
  const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
31078
- const showCurrencySelector = currencies.length > 1;
31079
- const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
31941
+ const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
31942
+ const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
31080
31943
  const hasNoUsableCurrency = currencies.length === 0;
31081
31944
  const {
31082
31945
  plans: allPlans,
@@ -31175,6 +32038,7 @@ var PricingTable = (0, import_react55.forwardRef)(({ className, ...rest }, ref)
31175
32038
  options: periods,
31176
32039
  selectedOption: selectedPeriod,
31177
32040
  selectedPlan: currentPlan,
32041
+ currency: hasCurrency ? selectedCurrency : void 0,
31178
32042
  onSelect: (period) => {
31179
32043
  if (period !== selectedPeriod) {
31180
32044
  setSelectedPeriod(period);