@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.
- package/dist/schematic-components-elements.cjs.js +1244 -474
- package/dist/schematic-components-elements.d.ts +172 -3
- package/dist/schematic-components-elements.esm.js +1198 -427
- package/dist/schematic-components.browser.cjs.js +1213 -349
- package/dist/schematic-components.browser.esm.js +1213 -349
- package/dist/schematic-components.cjs.js +1201 -337
- package/dist/schematic-components.d.ts +155 -2
- package/dist/schematic-components.esm.js +1213 -349
- package/package.json +13 -13
|
@@ -1936,6 +1936,7 @@ var initialContext = {
|
|
|
1936
1936
|
getUpcomingInvoice: stub,
|
|
1937
1937
|
getCustomerBalance: stub,
|
|
1938
1938
|
listInvoices: stub,
|
|
1939
|
+
getInvoiceLink: stub,
|
|
1939
1940
|
getCreditUsageByUser: stub,
|
|
1940
1941
|
getFeatureUsageByUser: stub,
|
|
1941
1942
|
createSetupIntent: stub,
|
|
@@ -4745,6 +4746,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
4745
4746
|
quantity: json["quantity"],
|
|
4746
4747
|
subscriptionId: json["subscription_id"],
|
|
4747
4748
|
subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
|
|
4749
|
+
tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
|
|
4748
4750
|
updatedAt: new Date(json["updated_at"]),
|
|
4749
4751
|
usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
|
|
4750
4752
|
};
|
|
@@ -6222,6 +6224,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
|
|
|
6222
6224
|
};
|
|
6223
6225
|
}
|
|
6224
6226
|
|
|
6227
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerBundleResponseData.ts
|
|
6228
|
+
function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
|
|
6229
|
+
return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
|
|
6230
|
+
}
|
|
6231
|
+
function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6232
|
+
if (json == null) {
|
|
6233
|
+
return json;
|
|
6234
|
+
}
|
|
6235
|
+
return {
|
|
6236
|
+
id: json["id"],
|
|
6237
|
+
name: json["name"]
|
|
6238
|
+
};
|
|
6239
|
+
}
|
|
6240
|
+
|
|
6241
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerCreditResponseData.ts
|
|
6242
|
+
function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
|
|
6243
|
+
return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
|
|
6244
|
+
}
|
|
6245
|
+
function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6246
|
+
if (json == null) {
|
|
6247
|
+
return json;
|
|
6248
|
+
}
|
|
6249
|
+
return {
|
|
6250
|
+
id: json["id"],
|
|
6251
|
+
name: json["name"],
|
|
6252
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
6253
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
|
|
6254
|
+
};
|
|
6255
|
+
}
|
|
6256
|
+
|
|
6257
|
+
// src/api/checkoutexternal/models/CreditUsageReason.ts
|
|
6258
|
+
function CreditUsageReasonFromJSON(json) {
|
|
6259
|
+
return CreditUsageReasonFromJSONTyped(json, false);
|
|
6260
|
+
}
|
|
6261
|
+
function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
6262
|
+
return json;
|
|
6263
|
+
}
|
|
6264
|
+
|
|
6265
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerUserResponseData.ts
|
|
6266
|
+
function CompanyCreditLedgerUserResponseDataFromJSON(json) {
|
|
6267
|
+
return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
|
|
6268
|
+
}
|
|
6269
|
+
function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6270
|
+
if (json == null) {
|
|
6271
|
+
return json;
|
|
6272
|
+
}
|
|
6273
|
+
return {
|
|
6274
|
+
id: json["id"],
|
|
6275
|
+
name: json["name"]
|
|
6276
|
+
};
|
|
6277
|
+
}
|
|
6278
|
+
|
|
6279
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerFeatureResponseData.ts
|
|
6280
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
|
|
6281
|
+
return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
|
|
6282
|
+
}
|
|
6283
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6284
|
+
if (json == null) {
|
|
6285
|
+
return json;
|
|
6286
|
+
}
|
|
6287
|
+
return {
|
|
6288
|
+
id: json["id"],
|
|
6289
|
+
name: json["name"]
|
|
6290
|
+
};
|
|
6291
|
+
}
|
|
6292
|
+
|
|
6293
|
+
// src/api/checkoutexternal/models/CreditLedgerEntryKind.ts
|
|
6294
|
+
function CreditLedgerEntryKindFromJSON(json) {
|
|
6295
|
+
return CreditLedgerEntryKindFromJSONTyped(json, false);
|
|
6296
|
+
}
|
|
6297
|
+
function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
|
|
6298
|
+
return json;
|
|
6299
|
+
}
|
|
6300
|
+
|
|
6301
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerEntryResponseData.ts
|
|
6302
|
+
function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
|
|
6303
|
+
return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
|
|
6304
|
+
}
|
|
6305
|
+
function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6306
|
+
if (json == null) {
|
|
6307
|
+
return json;
|
|
6308
|
+
}
|
|
6309
|
+
return {
|
|
6310
|
+
amount: json["amount"],
|
|
6311
|
+
bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
|
|
6312
|
+
credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
|
|
6313
|
+
eventAt: new Date(json["event_at"]),
|
|
6314
|
+
feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
|
|
6315
|
+
grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
|
|
6316
|
+
id: json["id"],
|
|
6317
|
+
kind: CreditLedgerEntryKindFromJSON(json["kind"]),
|
|
6318
|
+
usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
|
|
6319
|
+
user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
|
|
6320
|
+
zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
|
|
6321
|
+
};
|
|
6322
|
+
}
|
|
6323
|
+
|
|
6324
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerResponseData.ts
|
|
6325
|
+
function CompanyCreditLedgerResponseDataFromJSON(json) {
|
|
6326
|
+
return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
|
|
6327
|
+
}
|
|
6328
|
+
function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6329
|
+
if (json == null) {
|
|
6330
|
+
return json;
|
|
6331
|
+
}
|
|
6332
|
+
return {
|
|
6333
|
+
entries: json["entries"].map(
|
|
6334
|
+
CompanyCreditLedgerEntryResponseDataFromJSON
|
|
6335
|
+
),
|
|
6336
|
+
nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
|
|
6337
|
+
};
|
|
6338
|
+
}
|
|
6339
|
+
|
|
6225
6340
|
// src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
|
|
6226
6341
|
function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
|
|
6227
6342
|
return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
|
|
@@ -6455,7 +6570,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
6455
6570
|
fromSubscriptionPrice: json["from_subscription_price"],
|
|
6456
6571
|
id: json["id"],
|
|
6457
6572
|
interval: json["interval"],
|
|
6573
|
+
intervalCount: json["interval_count"],
|
|
6458
6574
|
scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
|
|
6575
|
+
scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
|
|
6459
6576
|
scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
|
|
6460
6577
|
toPlanId: json["to_plan_id"],
|
|
6461
6578
|
toPlanName: json["to_plan_name"]
|
|
@@ -7611,6 +7728,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7611
7728
|
};
|
|
7612
7729
|
}
|
|
7613
7730
|
|
|
7731
|
+
// src/api/checkoutexternal/models/RenewalDestinationResponseData.ts
|
|
7732
|
+
function RenewalDestinationResponseDataFromJSON(json) {
|
|
7733
|
+
return RenewalDestinationResponseDataFromJSONTyped(json, false);
|
|
7734
|
+
}
|
|
7735
|
+
function RenewalDestinationResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
7736
|
+
if (json == null) {
|
|
7737
|
+
return json;
|
|
7738
|
+
}
|
|
7739
|
+
return {
|
|
7740
|
+
billingPeriod: PlanPriceCadenceFromJSON(json["billing_period"]),
|
|
7741
|
+
planId: json["plan_id"]
|
|
7742
|
+
};
|
|
7743
|
+
}
|
|
7744
|
+
|
|
7614
7745
|
// src/api/checkoutexternal/models/RenewalPolicy.ts
|
|
7615
7746
|
function RenewalPolicyFromJSON(json) {
|
|
7616
7747
|
return RenewalPolicyFromJSONTyped(json, false);
|
|
@@ -7636,6 +7767,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7636
7767
|
name: json["name"],
|
|
7637
7768
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
7638
7769
|
planType: PlanTypeFromJSON(json["plan_type"]),
|
|
7770
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
|
|
7639
7771
|
renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
|
|
7640
7772
|
status: PlanVersionStatusFromJSON(json["status"]),
|
|
7641
7773
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -7839,6 +7971,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7839
7971
|
),
|
|
7840
7972
|
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7841
7973
|
interval: json["interval"],
|
|
7974
|
+
intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
|
|
7842
7975
|
isInitial: json["is_initial"],
|
|
7843
7976
|
latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
|
|
7844
7977
|
pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
|
|
@@ -8315,6 +8448,84 @@ function CreateCheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8315
8448
|
};
|
|
8316
8449
|
}
|
|
8317
8450
|
|
|
8451
|
+
// src/api/checkoutexternal/models/CreditSpendWindowUnit.ts
|
|
8452
|
+
function CreditSpendWindowUnitFromJSON(json) {
|
|
8453
|
+
return CreditSpendWindowUnitFromJSONTyped(json, false);
|
|
8454
|
+
}
|
|
8455
|
+
function CreditSpendWindowUnitFromJSONTyped(json, ignoreDiscriminator) {
|
|
8456
|
+
return json;
|
|
8457
|
+
}
|
|
8458
|
+
function CreditSpendWindowUnitToJSON(value) {
|
|
8459
|
+
return value;
|
|
8460
|
+
}
|
|
8461
|
+
|
|
8462
|
+
// src/api/checkoutexternal/models/CreateCompanySpendPolicyRequestBody.ts
|
|
8463
|
+
function CreateCompanySpendPolicyRequestBodyToJSON(json) {
|
|
8464
|
+
return CreateCompanySpendPolicyRequestBodyToJSONTyped(json, false);
|
|
8465
|
+
}
|
|
8466
|
+
function CreateCompanySpendPolicyRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
|
|
8467
|
+
if (value == null) {
|
|
8468
|
+
return value;
|
|
8469
|
+
}
|
|
8470
|
+
return {
|
|
8471
|
+
billing_credit_id: value["billingCreditId"],
|
|
8472
|
+
label: value["label"],
|
|
8473
|
+
max_per_draw: value["maxPerDraw"],
|
|
8474
|
+
user_id: value["userId"],
|
|
8475
|
+
window_amount: value["windowAmount"],
|
|
8476
|
+
window_unit: CreditSpendWindowUnitToJSON(value["windowUnit"])
|
|
8477
|
+
};
|
|
8478
|
+
}
|
|
8479
|
+
|
|
8480
|
+
// src/api/checkoutexternal/models/CreditSpendPolicyScope.ts
|
|
8481
|
+
function CreditSpendPolicyScopeFromJSON(json) {
|
|
8482
|
+
return CreditSpendPolicyScopeFromJSONTyped(json, false);
|
|
8483
|
+
}
|
|
8484
|
+
function CreditSpendPolicyScopeFromJSONTyped(json, ignoreDiscriminator) {
|
|
8485
|
+
return json;
|
|
8486
|
+
}
|
|
8487
|
+
|
|
8488
|
+
// src/api/checkoutexternal/models/CreditSpendPolicyResponseData.ts
|
|
8489
|
+
function CreditSpendPolicyResponseDataFromJSON(json) {
|
|
8490
|
+
return CreditSpendPolicyResponseDataFromJSONTyped(json, false);
|
|
8491
|
+
}
|
|
8492
|
+
function CreditSpendPolicyResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8493
|
+
if (json == null) {
|
|
8494
|
+
return json;
|
|
8495
|
+
}
|
|
8496
|
+
return {
|
|
8497
|
+
billingCreditId: json["billing_credit_id"],
|
|
8498
|
+
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
8499
|
+
consumed: json["consumed"] == null ? void 0 : json["consumed"],
|
|
8500
|
+
createdAt: new Date(json["created_at"]),
|
|
8501
|
+
headroom: json["headroom"] == null ? void 0 : json["headroom"],
|
|
8502
|
+
id: json["id"],
|
|
8503
|
+
label: json["label"] == null ? void 0 : json["label"],
|
|
8504
|
+
maxPerDraw: json["max_per_draw"] == null ? void 0 : json["max_per_draw"],
|
|
8505
|
+
resetsAt: json["resets_at"] == null ? void 0 : new Date(json["resets_at"]),
|
|
8506
|
+
scopeType: CreditSpendPolicyScopeFromJSON(json["scope_type"]),
|
|
8507
|
+
updatedAt: new Date(json["updated_at"]),
|
|
8508
|
+
userId: json["user_id"] == null ? void 0 : json["user_id"],
|
|
8509
|
+
windowAmount: json["window_amount"] == null ? void 0 : json["window_amount"],
|
|
8510
|
+
windowCount: json["window_count"],
|
|
8511
|
+
windowUnit: json["window_unit"] == null ? void 0 : CreditSpendWindowUnitFromJSON(json["window_unit"])
|
|
8512
|
+
};
|
|
8513
|
+
}
|
|
8514
|
+
|
|
8515
|
+
// src/api/checkoutexternal/models/CreateCompanySpendPolicyResponse.ts
|
|
8516
|
+
function CreateCompanySpendPolicyResponseFromJSON(json) {
|
|
8517
|
+
return CreateCompanySpendPolicyResponseFromJSONTyped(json, false);
|
|
8518
|
+
}
|
|
8519
|
+
function CreateCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8520
|
+
if (json == null) {
|
|
8521
|
+
return json;
|
|
8522
|
+
}
|
|
8523
|
+
return {
|
|
8524
|
+
data: CreditSpendPolicyResponseDataFromJSON(json["data"]),
|
|
8525
|
+
params: json["params"]
|
|
8526
|
+
};
|
|
8527
|
+
}
|
|
8528
|
+
|
|
8318
8529
|
// src/api/checkoutexternal/models/SetupIntentResponseData.ts
|
|
8319
8530
|
function SetupIntentResponseDataFromJSON(json) {
|
|
8320
8531
|
return SetupIntentResponseDataFromJSONTyped(json, false);
|
|
@@ -8403,6 +8614,20 @@ function CreditUserUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8403
8614
|
};
|
|
8404
8615
|
}
|
|
8405
8616
|
|
|
8617
|
+
// src/api/checkoutexternal/models/DeleteCompanySpendPolicyResponse.ts
|
|
8618
|
+
function DeleteCompanySpendPolicyResponseFromJSON(json) {
|
|
8619
|
+
return DeleteCompanySpendPolicyResponseFromJSONTyped(json, false);
|
|
8620
|
+
}
|
|
8621
|
+
function DeleteCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8622
|
+
if (json == null) {
|
|
8623
|
+
return json;
|
|
8624
|
+
}
|
|
8625
|
+
return {
|
|
8626
|
+
data: DeleteResponseFromJSON(json["data"]),
|
|
8627
|
+
params: json["params"]
|
|
8628
|
+
};
|
|
8629
|
+
}
|
|
8630
|
+
|
|
8406
8631
|
// src/api/checkoutexternal/models/DeletePaymentMethodResponse.ts
|
|
8407
8632
|
function DeletePaymentMethodResponseFromJSON(json) {
|
|
8408
8633
|
return DeletePaymentMethodResponseFromJSONTyped(json, false);
|
|
@@ -8580,6 +8805,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
|
|
|
8580
8805
|
};
|
|
8581
8806
|
}
|
|
8582
8807
|
|
|
8808
|
+
// src/api/checkoutexternal/models/GetCompanyCreditLedgerParams.ts
|
|
8809
|
+
function GetCompanyCreditLedgerParamsFromJSON(json) {
|
|
8810
|
+
return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
|
|
8811
|
+
}
|
|
8812
|
+
function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
8813
|
+
if (json == null) {
|
|
8814
|
+
return json;
|
|
8815
|
+
}
|
|
8816
|
+
return {
|
|
8817
|
+
creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
|
|
8818
|
+
cursor: json["cursor"] == null ? void 0 : json["cursor"],
|
|
8819
|
+
includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
|
|
8820
|
+
limit: json["limit"] == null ? void 0 : json["limit"]
|
|
8821
|
+
};
|
|
8822
|
+
}
|
|
8823
|
+
|
|
8824
|
+
// src/api/checkoutexternal/models/GetCompanyCreditLedgerResponse.ts
|
|
8825
|
+
function GetCompanyCreditLedgerResponseFromJSON(json) {
|
|
8826
|
+
return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
|
|
8827
|
+
}
|
|
8828
|
+
function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
8829
|
+
if (json == null) {
|
|
8830
|
+
return json;
|
|
8831
|
+
}
|
|
8832
|
+
return {
|
|
8833
|
+
data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
|
|
8834
|
+
params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
|
|
8835
|
+
};
|
|
8836
|
+
}
|
|
8837
|
+
|
|
8583
8838
|
// src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
|
|
8584
8839
|
function GetCompanyCreditUserUsageParamsFromJSON(json) {
|
|
8585
8840
|
return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
|
|
@@ -8777,6 +9032,34 @@ function GetFeatureUsageByUserResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8777
9032
|
};
|
|
8778
9033
|
}
|
|
8779
9034
|
|
|
9035
|
+
// src/api/checkoutexternal/models/InvoiceLink.ts
|
|
9036
|
+
function InvoiceLinkFromJSON(json) {
|
|
9037
|
+
return InvoiceLinkFromJSONTyped(json, false);
|
|
9038
|
+
}
|
|
9039
|
+
function InvoiceLinkFromJSONTyped(json, ignoreDiscriminator) {
|
|
9040
|
+
if (json == null) {
|
|
9041
|
+
return json;
|
|
9042
|
+
}
|
|
9043
|
+
return {
|
|
9044
|
+
id: json["id"],
|
|
9045
|
+
url: json["url"]
|
|
9046
|
+
};
|
|
9047
|
+
}
|
|
9048
|
+
|
|
9049
|
+
// src/api/checkoutexternal/models/GetInvoiceLinkResponse.ts
|
|
9050
|
+
function GetInvoiceLinkResponseFromJSON(json) {
|
|
9051
|
+
return GetInvoiceLinkResponseFromJSONTyped(json, false);
|
|
9052
|
+
}
|
|
9053
|
+
function GetInvoiceLinkResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
9054
|
+
if (json == null) {
|
|
9055
|
+
return json;
|
|
9056
|
+
}
|
|
9057
|
+
return {
|
|
9058
|
+
data: InvoiceLinkFromJSON(json["data"]),
|
|
9059
|
+
params: json["params"]
|
|
9060
|
+
};
|
|
9061
|
+
}
|
|
9062
|
+
|
|
8780
9063
|
// src/api/checkoutexternal/models/GetSetupIntentResponse.ts
|
|
8781
9064
|
function GetSetupIntentResponseFromJSON(json) {
|
|
8782
9065
|
return GetSetupIntentResponseFromJSONTyped(json, false);
|
|
@@ -8890,6 +9173,35 @@ function ListCheckoutsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8890
9173
|
};
|
|
8891
9174
|
}
|
|
8892
9175
|
|
|
9176
|
+
// src/api/checkoutexternal/models/ListCompanySpendPoliciesParams.ts
|
|
9177
|
+
function ListCompanySpendPoliciesParamsFromJSON(json) {
|
|
9178
|
+
return ListCompanySpendPoliciesParamsFromJSONTyped(json, false);
|
|
9179
|
+
}
|
|
9180
|
+
function ListCompanySpendPoliciesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
9181
|
+
if (json == null) {
|
|
9182
|
+
return json;
|
|
9183
|
+
}
|
|
9184
|
+
return {
|
|
9185
|
+
billingCreditId: json["billing_credit_id"] == null ? void 0 : json["billing_credit_id"]
|
|
9186
|
+
};
|
|
9187
|
+
}
|
|
9188
|
+
|
|
9189
|
+
// src/api/checkoutexternal/models/ListCompanySpendPoliciesResponse.ts
|
|
9190
|
+
function ListCompanySpendPoliciesResponseFromJSON(json) {
|
|
9191
|
+
return ListCompanySpendPoliciesResponseFromJSONTyped(json, false);
|
|
9192
|
+
}
|
|
9193
|
+
function ListCompanySpendPoliciesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
9194
|
+
if (json == null) {
|
|
9195
|
+
return json;
|
|
9196
|
+
}
|
|
9197
|
+
return {
|
|
9198
|
+
data: json["data"].map(
|
|
9199
|
+
CreditSpendPolicyResponseDataFromJSON
|
|
9200
|
+
),
|
|
9201
|
+
params: ListCompanySpendPoliciesParamsFromJSON(json["params"])
|
|
9202
|
+
};
|
|
9203
|
+
}
|
|
9204
|
+
|
|
8893
9205
|
// src/api/checkoutexternal/models/ListInvoicesParams.ts
|
|
8894
9206
|
function ListInvoicesParamsFromJSON(json) {
|
|
8895
9207
|
return ListInvoicesParamsFromJSONTyped(json, false);
|
|
@@ -9062,6 +9374,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
|
|
|
9062
9374
|
proration: json["proration"],
|
|
9063
9375
|
scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
|
|
9064
9376
|
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
9377
|
+
unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
|
|
9065
9378
|
usageViolations: json["usage_violations"].map(
|
|
9066
9379
|
FeatureUsageResponseDataFromJSON
|
|
9067
9380
|
)
|
|
@@ -9220,6 +9533,36 @@ function UpdateCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9220
9533
|
};
|
|
9221
9534
|
}
|
|
9222
9535
|
|
|
9536
|
+
// src/api/checkoutexternal/models/UpdateCompanySpendPolicyResponse.ts
|
|
9537
|
+
function UpdateCompanySpendPolicyResponseFromJSON(json) {
|
|
9538
|
+
return UpdateCompanySpendPolicyResponseFromJSONTyped(json, false);
|
|
9539
|
+
}
|
|
9540
|
+
function UpdateCompanySpendPolicyResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
9541
|
+
if (json == null) {
|
|
9542
|
+
return json;
|
|
9543
|
+
}
|
|
9544
|
+
return {
|
|
9545
|
+
data: CreditSpendPolicyResponseDataFromJSON(json["data"]),
|
|
9546
|
+
params: json["params"]
|
|
9547
|
+
};
|
|
9548
|
+
}
|
|
9549
|
+
|
|
9550
|
+
// src/api/checkoutexternal/models/UpdateCreditSpendPolicyRequestBody.ts
|
|
9551
|
+
function UpdateCreditSpendPolicyRequestBodyToJSON(json) {
|
|
9552
|
+
return UpdateCreditSpendPolicyRequestBodyToJSONTyped(json, false);
|
|
9553
|
+
}
|
|
9554
|
+
function UpdateCreditSpendPolicyRequestBodyToJSONTyped(value, ignoreDiscriminator = false) {
|
|
9555
|
+
if (value == null) {
|
|
9556
|
+
return value;
|
|
9557
|
+
}
|
|
9558
|
+
return {
|
|
9559
|
+
label: value["label"],
|
|
9560
|
+
max_per_draw: value["maxPerDraw"],
|
|
9561
|
+
window_amount: value["windowAmount"],
|
|
9562
|
+
window_unit: CreditSpendWindowUnitToJSON(value["windowUnit"])
|
|
9563
|
+
};
|
|
9564
|
+
}
|
|
9565
|
+
|
|
9223
9566
|
// src/api/checkoutexternal/models/UpdatePaymentMethodRequestBody.ts
|
|
9224
9567
|
function UpdatePaymentMethodRequestBodyToJSON(json) {
|
|
9225
9568
|
return UpdatePaymentMethodRequestBodyToJSONTyped(json, false);
|
|
@@ -9377,6 +9720,51 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
9377
9720
|
);
|
|
9378
9721
|
return await response.value();
|
|
9379
9722
|
}
|
|
9723
|
+
/**
|
|
9724
|
+
* Create company spend policy
|
|
9725
|
+
*/
|
|
9726
|
+
async createCompanySpendPolicyRaw(requestParameters, initOverrides) {
|
|
9727
|
+
if (requestParameters["createCompanySpendPolicyRequestBody"] == null) {
|
|
9728
|
+
throw new RequiredError(
|
|
9729
|
+
"createCompanySpendPolicyRequestBody",
|
|
9730
|
+
'Required parameter "createCompanySpendPolicyRequestBody" was null or undefined when calling createCompanySpendPolicy().'
|
|
9731
|
+
);
|
|
9732
|
+
}
|
|
9733
|
+
const queryParameters = {};
|
|
9734
|
+
const headerParameters = {};
|
|
9735
|
+
headerParameters["Content-Type"] = "application/json";
|
|
9736
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
9737
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
9738
|
+
"X-Schematic-Api-Key"
|
|
9739
|
+
);
|
|
9740
|
+
}
|
|
9741
|
+
const response = await this.request(
|
|
9742
|
+
{
|
|
9743
|
+
path: `/company/credits/spend-policies`,
|
|
9744
|
+
method: "POST",
|
|
9745
|
+
headers: headerParameters,
|
|
9746
|
+
query: queryParameters,
|
|
9747
|
+
body: CreateCompanySpendPolicyRequestBodyToJSON(
|
|
9748
|
+
requestParameters["createCompanySpendPolicyRequestBody"]
|
|
9749
|
+
)
|
|
9750
|
+
},
|
|
9751
|
+
initOverrides
|
|
9752
|
+
);
|
|
9753
|
+
return new JSONApiResponse(
|
|
9754
|
+
response,
|
|
9755
|
+
(jsonValue) => CreateCompanySpendPolicyResponseFromJSON(jsonValue)
|
|
9756
|
+
);
|
|
9757
|
+
}
|
|
9758
|
+
/**
|
|
9759
|
+
* Create company spend policy
|
|
9760
|
+
*/
|
|
9761
|
+
async createCompanySpendPolicy(requestParameters, initOverrides) {
|
|
9762
|
+
const response = await this.createCompanySpendPolicyRaw(
|
|
9763
|
+
requestParameters,
|
|
9764
|
+
initOverrides
|
|
9765
|
+
);
|
|
9766
|
+
return await response.value();
|
|
9767
|
+
}
|
|
9380
9768
|
/**
|
|
9381
9769
|
* 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.
|
|
9382
9770
|
* Create a setup intent
|
|
@@ -9411,6 +9799,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
9411
9799
|
const response = await this.createSetupIntentRaw(initOverrides);
|
|
9412
9800
|
return await response.value();
|
|
9413
9801
|
}
|
|
9802
|
+
/**
|
|
9803
|
+
* Delete company spend policy
|
|
9804
|
+
*/
|
|
9805
|
+
async deleteCompanySpendPolicyRaw(requestParameters, initOverrides) {
|
|
9806
|
+
if (requestParameters["spendPolicyId"] == null) {
|
|
9807
|
+
throw new RequiredError(
|
|
9808
|
+
"spendPolicyId",
|
|
9809
|
+
'Required parameter "spendPolicyId" was null or undefined when calling deleteCompanySpendPolicy().'
|
|
9810
|
+
);
|
|
9811
|
+
}
|
|
9812
|
+
const queryParameters = {};
|
|
9813
|
+
const headerParameters = {};
|
|
9814
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
9815
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
9816
|
+
"X-Schematic-Api-Key"
|
|
9817
|
+
);
|
|
9818
|
+
}
|
|
9819
|
+
const response = await this.request(
|
|
9820
|
+
{
|
|
9821
|
+
path: `/company/credits/spend-policies/{spend_policy_id}`.replace(
|
|
9822
|
+
`{${"spend_policy_id"}}`,
|
|
9823
|
+
encodeURIComponent(String(requestParameters["spendPolicyId"]))
|
|
9824
|
+
),
|
|
9825
|
+
method: "DELETE",
|
|
9826
|
+
headers: headerParameters,
|
|
9827
|
+
query: queryParameters
|
|
9828
|
+
},
|
|
9829
|
+
initOverrides
|
|
9830
|
+
);
|
|
9831
|
+
return new JSONApiResponse(
|
|
9832
|
+
response,
|
|
9833
|
+
(jsonValue) => DeleteCompanySpendPolicyResponseFromJSON(jsonValue)
|
|
9834
|
+
);
|
|
9835
|
+
}
|
|
9836
|
+
/**
|
|
9837
|
+
* Delete company spend policy
|
|
9838
|
+
*/
|
|
9839
|
+
async deleteCompanySpendPolicy(requestParameters, initOverrides) {
|
|
9840
|
+
const response = await this.deleteCompanySpendPolicyRaw(
|
|
9841
|
+
requestParameters,
|
|
9842
|
+
initOverrides
|
|
9843
|
+
);
|
|
9844
|
+
return await response.value();
|
|
9845
|
+
}
|
|
9414
9846
|
/**
|
|
9415
9847
|
* 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.
|
|
9416
9848
|
* Remove a payment method
|
|
@@ -9778,6 +10210,55 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
9778
10210
|
const response = await this.getCompanyCreditBalancesRaw(initOverrides);
|
|
9779
10211
|
return await response.value();
|
|
9780
10212
|
}
|
|
10213
|
+
/**
|
|
10214
|
+
* 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.
|
|
10215
|
+
* List credit activity
|
|
10216
|
+
*/
|
|
10217
|
+
async getCompanyCreditLedgerRaw(requestParameters, initOverrides) {
|
|
10218
|
+
const queryParameters = {};
|
|
10219
|
+
if (requestParameters["creditIds"] != null) {
|
|
10220
|
+
queryParameters["credit_ids"] = requestParameters["creditIds"];
|
|
10221
|
+
}
|
|
10222
|
+
if (requestParameters["cursor"] != null) {
|
|
10223
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
10224
|
+
}
|
|
10225
|
+
if (requestParameters["includeGrants"] != null) {
|
|
10226
|
+
queryParameters["include_grants"] = requestParameters["includeGrants"];
|
|
10227
|
+
}
|
|
10228
|
+
if (requestParameters["limit"] != null) {
|
|
10229
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
10230
|
+
}
|
|
10231
|
+
const headerParameters = {};
|
|
10232
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
10233
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
10234
|
+
"X-Schematic-Api-Key"
|
|
10235
|
+
);
|
|
10236
|
+
}
|
|
10237
|
+
const response = await this.request(
|
|
10238
|
+
{
|
|
10239
|
+
path: `/company/credits/ledger`,
|
|
10240
|
+
method: "GET",
|
|
10241
|
+
headers: headerParameters,
|
|
10242
|
+
query: queryParameters
|
|
10243
|
+
},
|
|
10244
|
+
initOverrides
|
|
10245
|
+
);
|
|
10246
|
+
return new JSONApiResponse(
|
|
10247
|
+
response,
|
|
10248
|
+
(jsonValue) => GetCompanyCreditLedgerResponseFromJSON(jsonValue)
|
|
10249
|
+
);
|
|
10250
|
+
}
|
|
10251
|
+
/**
|
|
10252
|
+
* 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.
|
|
10253
|
+
* List credit activity
|
|
10254
|
+
*/
|
|
10255
|
+
async getCompanyCreditLedger(requestParameters = {}, initOverrides) {
|
|
10256
|
+
const response = await this.getCompanyCreditLedgerRaw(
|
|
10257
|
+
requestParameters,
|
|
10258
|
+
initOverrides
|
|
10259
|
+
);
|
|
10260
|
+
return await response.value();
|
|
10261
|
+
}
|
|
9781
10262
|
/**
|
|
9782
10263
|
* Who in the company consumed the credit, and how much each.
|
|
9783
10264
|
* List credit usage by user
|
|
@@ -10137,6 +10618,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10137
10618
|
);
|
|
10138
10619
|
return await response.value();
|
|
10139
10620
|
}
|
|
10621
|
+
/**
|
|
10622
|
+
* Get invoice link
|
|
10623
|
+
*/
|
|
10624
|
+
async getInvoiceLinkRaw(requestParameters, initOverrides) {
|
|
10625
|
+
if (requestParameters["billingInvoiceId"] == null) {
|
|
10626
|
+
throw new RequiredError(
|
|
10627
|
+
"billingInvoiceId",
|
|
10628
|
+
'Required parameter "billingInvoiceId" was null or undefined when calling getInvoiceLink().'
|
|
10629
|
+
);
|
|
10630
|
+
}
|
|
10631
|
+
const queryParameters = {};
|
|
10632
|
+
const headerParameters = {};
|
|
10633
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
10634
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
10635
|
+
"X-Schematic-Api-Key"
|
|
10636
|
+
);
|
|
10637
|
+
}
|
|
10638
|
+
const response = await this.request(
|
|
10639
|
+
{
|
|
10640
|
+
path: `/components/invoices/{billing_invoice_id}/link`.replace(
|
|
10641
|
+
`{${"billing_invoice_id"}}`,
|
|
10642
|
+
encodeURIComponent(String(requestParameters["billingInvoiceId"]))
|
|
10643
|
+
),
|
|
10644
|
+
method: "GET",
|
|
10645
|
+
headers: headerParameters,
|
|
10646
|
+
query: queryParameters
|
|
10647
|
+
},
|
|
10648
|
+
initOverrides
|
|
10649
|
+
);
|
|
10650
|
+
return new JSONApiResponse(
|
|
10651
|
+
response,
|
|
10652
|
+
(jsonValue) => GetInvoiceLinkResponseFromJSON(jsonValue)
|
|
10653
|
+
);
|
|
10654
|
+
}
|
|
10655
|
+
/**
|
|
10656
|
+
* Get invoice link
|
|
10657
|
+
*/
|
|
10658
|
+
async getInvoiceLink(requestParameters, initOverrides) {
|
|
10659
|
+
const response = await this.getInvoiceLinkRaw(
|
|
10660
|
+
requestParameters,
|
|
10661
|
+
initOverrides
|
|
10662
|
+
);
|
|
10663
|
+
return await response.value();
|
|
10664
|
+
}
|
|
10140
10665
|
/**
|
|
10141
10666
|
* Get setup intent
|
|
10142
10667
|
*/
|
|
@@ -10314,19 +10839,58 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10314
10839
|
* The checkouts this session opened for the token\'s company. Filter by `statuses`.
|
|
10315
10840
|
* List checkouts
|
|
10316
10841
|
*/
|
|
10317
|
-
async listCheckoutsRaw(requestParameters, initOverrides) {
|
|
10842
|
+
async listCheckoutsRaw(requestParameters, initOverrides) {
|
|
10843
|
+
const queryParameters = {};
|
|
10844
|
+
if (requestParameters["companyId"] != null) {
|
|
10845
|
+
queryParameters["company_id"] = requestParameters["companyId"];
|
|
10846
|
+
}
|
|
10847
|
+
if (requestParameters["statuses"] != null) {
|
|
10848
|
+
queryParameters["statuses"] = requestParameters["statuses"];
|
|
10849
|
+
}
|
|
10850
|
+
if (requestParameters["limit"] != null) {
|
|
10851
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
10852
|
+
}
|
|
10853
|
+
if (requestParameters["offset"] != null) {
|
|
10854
|
+
queryParameters["offset"] = requestParameters["offset"];
|
|
10855
|
+
}
|
|
10856
|
+
const headerParameters = {};
|
|
10857
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
10858
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
10859
|
+
"X-Schematic-Api-Key"
|
|
10860
|
+
);
|
|
10861
|
+
}
|
|
10862
|
+
const response = await this.request(
|
|
10863
|
+
{
|
|
10864
|
+
path: `/checkouts`,
|
|
10865
|
+
method: "GET",
|
|
10866
|
+
headers: headerParameters,
|
|
10867
|
+
query: queryParameters
|
|
10868
|
+
},
|
|
10869
|
+
initOverrides
|
|
10870
|
+
);
|
|
10871
|
+
return new JSONApiResponse(
|
|
10872
|
+
response,
|
|
10873
|
+
(jsonValue) => ListCheckoutsResponseFromJSON(jsonValue)
|
|
10874
|
+
);
|
|
10875
|
+
}
|
|
10876
|
+
/**
|
|
10877
|
+
* The checkouts this session opened for the token\'s company. Filter by `statuses`.
|
|
10878
|
+
* List checkouts
|
|
10879
|
+
*/
|
|
10880
|
+
async listCheckouts(requestParameters = {}, initOverrides) {
|
|
10881
|
+
const response = await this.listCheckoutsRaw(
|
|
10882
|
+
requestParameters,
|
|
10883
|
+
initOverrides
|
|
10884
|
+
);
|
|
10885
|
+
return await response.value();
|
|
10886
|
+
}
|
|
10887
|
+
/**
|
|
10888
|
+
* List company spend policies
|
|
10889
|
+
*/
|
|
10890
|
+
async listCompanySpendPoliciesRaw(requestParameters, initOverrides) {
|
|
10318
10891
|
const queryParameters = {};
|
|
10319
|
-
if (requestParameters["
|
|
10320
|
-
queryParameters["
|
|
10321
|
-
}
|
|
10322
|
-
if (requestParameters["statuses"] != null) {
|
|
10323
|
-
queryParameters["statuses"] = requestParameters["statuses"];
|
|
10324
|
-
}
|
|
10325
|
-
if (requestParameters["limit"] != null) {
|
|
10326
|
-
queryParameters["limit"] = requestParameters["limit"];
|
|
10327
|
-
}
|
|
10328
|
-
if (requestParameters["offset"] != null) {
|
|
10329
|
-
queryParameters["offset"] = requestParameters["offset"];
|
|
10892
|
+
if (requestParameters["billingCreditId"] != null) {
|
|
10893
|
+
queryParameters["billing_credit_id"] = requestParameters["billingCreditId"];
|
|
10330
10894
|
}
|
|
10331
10895
|
const headerParameters = {};
|
|
10332
10896
|
if (this.configuration && this.configuration.apiKey) {
|
|
@@ -10336,7 +10900,7 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10336
10900
|
}
|
|
10337
10901
|
const response = await this.request(
|
|
10338
10902
|
{
|
|
10339
|
-
path: `/
|
|
10903
|
+
path: `/company/credits/spend-policies`,
|
|
10340
10904
|
method: "GET",
|
|
10341
10905
|
headers: headerParameters,
|
|
10342
10906
|
query: queryParameters
|
|
@@ -10345,15 +10909,14 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10345
10909
|
);
|
|
10346
10910
|
return new JSONApiResponse(
|
|
10347
10911
|
response,
|
|
10348
|
-
(jsonValue) =>
|
|
10912
|
+
(jsonValue) => ListCompanySpendPoliciesResponseFromJSON(jsonValue)
|
|
10349
10913
|
);
|
|
10350
10914
|
}
|
|
10351
10915
|
/**
|
|
10352
|
-
*
|
|
10353
|
-
* List checkouts
|
|
10916
|
+
* List company spend policies
|
|
10354
10917
|
*/
|
|
10355
|
-
async
|
|
10356
|
-
const response = await this.
|
|
10918
|
+
async listCompanySpendPolicies(requestParameters = {}, initOverrides) {
|
|
10919
|
+
const response = await this.listCompanySpendPoliciesRaw(
|
|
10357
10920
|
requestParameters,
|
|
10358
10921
|
initOverrides
|
|
10359
10922
|
);
|
|
@@ -10593,6 +11156,60 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10593
11156
|
);
|
|
10594
11157
|
return await response.value();
|
|
10595
11158
|
}
|
|
11159
|
+
/**
|
|
11160
|
+
* Update company spend policy
|
|
11161
|
+
*/
|
|
11162
|
+
async updateCompanySpendPolicyRaw(requestParameters, initOverrides) {
|
|
11163
|
+
if (requestParameters["spendPolicyId"] == null) {
|
|
11164
|
+
throw new RequiredError(
|
|
11165
|
+
"spendPolicyId",
|
|
11166
|
+
'Required parameter "spendPolicyId" was null or undefined when calling updateCompanySpendPolicy().'
|
|
11167
|
+
);
|
|
11168
|
+
}
|
|
11169
|
+
if (requestParameters["updateCreditSpendPolicyRequestBody"] == null) {
|
|
11170
|
+
throw new RequiredError(
|
|
11171
|
+
"updateCreditSpendPolicyRequestBody",
|
|
11172
|
+
'Required parameter "updateCreditSpendPolicyRequestBody" was null or undefined when calling updateCompanySpendPolicy().'
|
|
11173
|
+
);
|
|
11174
|
+
}
|
|
11175
|
+
const queryParameters = {};
|
|
11176
|
+
const headerParameters = {};
|
|
11177
|
+
headerParameters["Content-Type"] = "application/json";
|
|
11178
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
11179
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
11180
|
+
"X-Schematic-Api-Key"
|
|
11181
|
+
);
|
|
11182
|
+
}
|
|
11183
|
+
const response = await this.request(
|
|
11184
|
+
{
|
|
11185
|
+
path: `/company/credits/spend-policies/{spend_policy_id}`.replace(
|
|
11186
|
+
`{${"spend_policy_id"}}`,
|
|
11187
|
+
encodeURIComponent(String(requestParameters["spendPolicyId"]))
|
|
11188
|
+
),
|
|
11189
|
+
method: "PUT",
|
|
11190
|
+
headers: headerParameters,
|
|
11191
|
+
query: queryParameters,
|
|
11192
|
+
body: UpdateCreditSpendPolicyRequestBodyToJSON(
|
|
11193
|
+
requestParameters["updateCreditSpendPolicyRequestBody"]
|
|
11194
|
+
)
|
|
11195
|
+
},
|
|
11196
|
+
initOverrides
|
|
11197
|
+
);
|
|
11198
|
+
return new JSONApiResponse(
|
|
11199
|
+
response,
|
|
11200
|
+
(jsonValue) => UpdateCompanySpendPolicyResponseFromJSON(jsonValue)
|
|
11201
|
+
);
|
|
11202
|
+
}
|
|
11203
|
+
/**
|
|
11204
|
+
* Update company spend policy
|
|
11205
|
+
*/
|
|
11206
|
+
async updateCompanySpendPolicy(requestParameters, initOverrides) {
|
|
11207
|
+
const response = await this.updateCompanySpendPolicyRaw(
|
|
11208
|
+
requestParameters,
|
|
11209
|
+
initOverrides
|
|
11210
|
+
);
|
|
11211
|
+
return await response.value();
|
|
11212
|
+
}
|
|
10596
11213
|
/**
|
|
10597
11214
|
* 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.
|
|
10598
11215
|
* Make a payment method the default
|
|
@@ -11118,9 +11735,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
11118
11735
|
|
|
11119
11736
|
// src/api/componentspublic/models/BillingTiersMode.ts
|
|
11120
11737
|
function BillingTiersModeFromJSON2(json) {
|
|
11121
|
-
return
|
|
11738
|
+
return BillingTiersModeFromJSONTyped7(json, false);
|
|
11122
11739
|
}
|
|
11123
|
-
function
|
|
11740
|
+
function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
11124
11741
|
return json;
|
|
11125
11742
|
}
|
|
11126
11743
|
|
|
@@ -11396,9 +12013,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
|
11396
12013
|
|
|
11397
12014
|
// src/api/componentspublic/models/PlanPriceCadence.ts
|
|
11398
12015
|
function PlanPriceCadenceFromJSON2(json) {
|
|
11399
|
-
return
|
|
12016
|
+
return PlanPriceCadenceFromJSONTyped8(json, false);
|
|
11400
12017
|
}
|
|
11401
|
-
function
|
|
12018
|
+
function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
|
|
11402
12019
|
return json;
|
|
11403
12020
|
}
|
|
11404
12021
|
|
|
@@ -12027,6 +12644,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
|
|
|
12027
12644
|
};
|
|
12028
12645
|
}
|
|
12029
12646
|
|
|
12647
|
+
// src/api/componentspublic/models/RenewalDestinationResponseData.ts
|
|
12648
|
+
function RenewalDestinationResponseDataFromJSON2(json) {
|
|
12649
|
+
return RenewalDestinationResponseDataFromJSONTyped3(json, false);
|
|
12650
|
+
}
|
|
12651
|
+
function RenewalDestinationResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
12652
|
+
if (json == null) {
|
|
12653
|
+
return json;
|
|
12654
|
+
}
|
|
12655
|
+
return {
|
|
12656
|
+
billingPeriod: PlanPriceCadenceFromJSON2(json["billing_period"]),
|
|
12657
|
+
planId: json["plan_id"]
|
|
12658
|
+
};
|
|
12659
|
+
}
|
|
12660
|
+
|
|
12030
12661
|
// src/api/componentspublic/models/RenewalPolicy.ts
|
|
12031
12662
|
function RenewalPolicyFromJSON2(json) {
|
|
12032
12663
|
return RenewalPolicyFromJSONTyped3(json, false);
|
|
@@ -12052,6 +12683,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
12052
12683
|
name: json["name"],
|
|
12053
12684
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
12054
12685
|
planType: PlanTypeFromJSON2(json["plan_type"]),
|
|
12686
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
|
|
12055
12687
|
renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
|
|
12056
12688
|
status: PlanVersionStatusFromJSON2(json["status"]),
|
|
12057
12689
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -12627,7 +13259,7 @@ function resolveLocale(locale) {
|
|
|
12627
13259
|
return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
|
|
12628
13260
|
}
|
|
12629
13261
|
|
|
12630
|
-
// node_modules/.pnpm/i18next@
|
|
13262
|
+
// node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
|
|
12631
13263
|
var isString = (obj) => typeof obj === "string";
|
|
12632
13264
|
var defer = () => {
|
|
12633
13265
|
let res;
|
|
@@ -12742,12 +13374,11 @@ var _entityMap = {
|
|
|
12742
13374
|
"<": "<",
|
|
12743
13375
|
">": ">",
|
|
12744
13376
|
'"': """,
|
|
12745
|
-
"'": "'"
|
|
12746
|
-
"/": "/"
|
|
13377
|
+
"'": "'"
|
|
12747
13378
|
};
|
|
12748
13379
|
var escape = (data) => {
|
|
12749
13380
|
if (isString(data)) {
|
|
12750
|
-
return data.replace(/[&<>"'
|
|
13381
|
+
return data.replace(/[&<>"']/g, (s) => _entityMap[s]);
|
|
12751
13382
|
}
|
|
12752
13383
|
return data;
|
|
12753
13384
|
};
|
|
@@ -12794,6 +13425,9 @@ var deepFind = (obj, path, keySeparator = ".") => {
|
|
|
12794
13425
|
if (!Object.prototype.hasOwnProperty.call(obj, path)) return void 0;
|
|
12795
13426
|
return obj[path];
|
|
12796
13427
|
}
|
|
13428
|
+
if (!keySeparator) {
|
|
13429
|
+
return Object.prototype.hasOwnProperty.call(obj, path) ? obj[path] : void 0;
|
|
13430
|
+
}
|
|
12797
13431
|
const tokens = path.split(keySeparator);
|
|
12798
13432
|
let current = obj;
|
|
12799
13433
|
for (let i2 = 0; i2 < tokens.length; ) {
|
|
@@ -12938,15 +13572,20 @@ var EventEmitter = class {
|
|
|
12938
13572
|
}
|
|
12939
13573
|
};
|
|
12940
13574
|
var nonEmptyBundles = /* @__PURE__ */ new WeakSet();
|
|
13575
|
+
var assertSeparateArguments = (method, ...args) => {
|
|
13576
|
+
if (args.some((a2) => !isString(a2))) {
|
|
13577
|
+
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`);
|
|
13578
|
+
}
|
|
13579
|
+
};
|
|
12941
13580
|
var ResourceStore = class extends EventEmitter {
|
|
12942
13581
|
constructor(data, options = {
|
|
12943
13582
|
ns: ["translation"],
|
|
12944
13583
|
defaultNS: "translation"
|
|
12945
|
-
}) {
|
|
13584
|
+
}, logger = baseLogger) {
|
|
12946
13585
|
super();
|
|
12947
13586
|
this.data = data || {};
|
|
12948
13587
|
this.options = options;
|
|
12949
|
-
this.logger =
|
|
13588
|
+
this.logger = logger.create("resourceStore");
|
|
12950
13589
|
if (this.options.keySeparator === void 0) {
|
|
12951
13590
|
this.options.keySeparator = ".";
|
|
12952
13591
|
}
|
|
@@ -12965,49 +13604,30 @@ var ResourceStore = class extends EventEmitter {
|
|
|
12965
13604
|
this.options.ns.splice(index, 1);
|
|
12966
13605
|
}
|
|
12967
13606
|
}
|
|
12968
|
-
deprecateDottedLng(method) {
|
|
12969
|
-
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`);
|
|
12970
|
-
}
|
|
12971
13607
|
getResource(lng, ns, key, options = {}) {
|
|
12972
13608
|
const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
|
|
12973
13609
|
const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
12974
|
-
|
|
12975
|
-
if (
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
path.push(...key);
|
|
12983
|
-
} else if (isString(key) && keySeparator) {
|
|
12984
|
-
path.push(...key.split(keySeparator));
|
|
12985
|
-
} else {
|
|
12986
|
-
path.push(key);
|
|
12987
|
-
}
|
|
13610
|
+
const path = [lng, ns];
|
|
13611
|
+
if (key) {
|
|
13612
|
+
if (Array.isArray(key)) {
|
|
13613
|
+
path.push(...key);
|
|
13614
|
+
} else if (isString(key) && keySeparator) {
|
|
13615
|
+
path.push(...key.split(keySeparator));
|
|
13616
|
+
} else {
|
|
13617
|
+
path.push(key);
|
|
12988
13618
|
}
|
|
12989
13619
|
}
|
|
12990
13620
|
const result = getPath(this.data, path);
|
|
12991
|
-
if (result == null && !ns && !key && lng.includes(".")) {
|
|
12992
|
-
lng = path[0];
|
|
12993
|
-
ns = path[1];
|
|
12994
|
-
key = path.slice(2).join(".");
|
|
12995
|
-
}
|
|
12996
13621
|
if (result != null || !ignoreJSONStructure || !isString(key)) return result;
|
|
12997
13622
|
return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
|
|
12998
13623
|
}
|
|
12999
13624
|
addResource(lng, ns, key, value, options = {
|
|
13000
13625
|
silent: false
|
|
13001
13626
|
}) {
|
|
13627
|
+
assertSeparateArguments("addResource", lng, ns, key);
|
|
13002
13628
|
const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
|
|
13003
13629
|
let path = [lng, ns];
|
|
13004
13630
|
if (key) path = path.concat(keySeparator ? key.split(keySeparator) : key);
|
|
13005
|
-
if (lng.includes(".")) {
|
|
13006
|
-
this.deprecateDottedLng("addResource");
|
|
13007
|
-
path = lng.split(".");
|
|
13008
|
-
value = ns;
|
|
13009
|
-
ns = path[1];
|
|
13010
|
-
}
|
|
13011
13631
|
this.addNamespaces(ns);
|
|
13012
13632
|
setPath(this.data, path, value);
|
|
13013
13633
|
if (!options.silent) this.emit("added", lng, ns, key, value);
|
|
@@ -13015,25 +13635,21 @@ var ResourceStore = class extends EventEmitter {
|
|
|
13015
13635
|
addResources(lng, ns, resources, options = {
|
|
13016
13636
|
silent: false
|
|
13017
13637
|
}) {
|
|
13018
|
-
|
|
13019
|
-
|
|
13638
|
+
assertSeparateArguments("addResources", lng, ns);
|
|
13639
|
+
Object.keys(resources || {}).forEach((m2) => {
|
|
13640
|
+
if (m2 === "__proto__" || m2 === "constructor") return;
|
|
13641
|
+
this.addResource(lng, ns, m2, resources[m2], {
|
|
13020
13642
|
silent: true
|
|
13021
13643
|
});
|
|
13022
|
-
}
|
|
13644
|
+
});
|
|
13023
13645
|
if (!options.silent) this.emit("added", lng, ns, resources);
|
|
13024
13646
|
}
|
|
13025
13647
|
addResourceBundle(lng, ns, resources, deep, overwrite, options = {
|
|
13026
13648
|
silent: false,
|
|
13027
13649
|
skipCopy: false
|
|
13028
13650
|
}) {
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
this.deprecateDottedLng("addResourceBundle");
|
|
13032
|
-
path = lng.split(".");
|
|
13033
|
-
deep = resources;
|
|
13034
|
-
resources = ns;
|
|
13035
|
-
ns = path[1];
|
|
13036
|
-
}
|
|
13651
|
+
assertSeparateArguments("addResourceBundle", lng, ns);
|
|
13652
|
+
const path = [lng, ns];
|
|
13037
13653
|
this.addNamespaces(ns);
|
|
13038
13654
|
let pack = getPath(this.data, path) || {};
|
|
13039
13655
|
if (!options.skipCopy) resources = JSON.parse(JSON.stringify(resources));
|
|
@@ -13080,18 +13696,6 @@ var ResourceStore = class extends EventEmitter {
|
|
|
13080
13696
|
return this.data;
|
|
13081
13697
|
}
|
|
13082
13698
|
};
|
|
13083
|
-
var postProcessor = {
|
|
13084
|
-
processors: {},
|
|
13085
|
-
addPostProcessor(module) {
|
|
13086
|
-
this.processors[module.name] = module;
|
|
13087
|
-
},
|
|
13088
|
-
handle(processors, value, key, options, translator) {
|
|
13089
|
-
processors.forEach((processor) => {
|
|
13090
|
-
value = this.processors[processor]?.process(value, key, options, translator) ?? value;
|
|
13091
|
-
});
|
|
13092
|
-
return value;
|
|
13093
|
-
}
|
|
13094
|
-
};
|
|
13095
13699
|
var PATH_KEY = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
|
|
13096
13700
|
function createProxy() {
|
|
13097
13701
|
const state = [];
|
|
@@ -13110,7 +13714,7 @@ function keysFromSelector(selector, opts) {
|
|
|
13110
13714
|
const {
|
|
13111
13715
|
[PATH_KEY]: path
|
|
13112
13716
|
} = selector(createProxy());
|
|
13113
|
-
const keySeparator = opts?.keySeparator
|
|
13717
|
+
const keySeparator = opts?.keySeparator || ".";
|
|
13114
13718
|
const nsSeparator = opts?.nsSeparator ?? ":";
|
|
13115
13719
|
const strict = opts?.enableSelector === "strict";
|
|
13116
13720
|
if (path.length > 1 && nsSeparator) {
|
|
@@ -13129,12 +13733,12 @@ var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" &
|
|
|
13129
13733
|
var Translator = class _Translator extends EventEmitter {
|
|
13130
13734
|
constructor(services, options = {}) {
|
|
13131
13735
|
super();
|
|
13132
|
-
copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils", "
|
|
13736
|
+
copy2(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils", "postProcessors"], services, this);
|
|
13133
13737
|
this.options = options;
|
|
13134
13738
|
if (this.options.keySeparator === void 0) {
|
|
13135
13739
|
this.options.keySeparator = ".";
|
|
13136
13740
|
}
|
|
13137
|
-
this.logger = baseLogger.create("translator");
|
|
13741
|
+
this.logger = (services.logger || baseLogger).create("translator");
|
|
13138
13742
|
this.checkedLoadedFor = {};
|
|
13139
13743
|
}
|
|
13140
13744
|
changeLanguage(lng) {
|
|
@@ -13251,30 +13855,32 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13251
13855
|
ordinal: false
|
|
13252
13856
|
}) : "";
|
|
13253
13857
|
const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
|
|
13254
|
-
const
|
|
13858
|
+
const sep = this.options.pluralSeparator;
|
|
13859
|
+
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));
|
|
13255
13860
|
let resForObjHndl = res;
|
|
13256
13861
|
if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
|
|
13257
13862
|
resForObjHndl = defaultValue;
|
|
13258
13863
|
}
|
|
13259
13864
|
const handleAsObject = shouldHandleAsObject(resForObjHndl);
|
|
13260
13865
|
const resType = Object.prototype.toString.apply(resForObjHndl);
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
resolved.res = r2;
|
|
13273
|
-
resolved.usedParams = this.getUsedParamsDetails(opt);
|
|
13274
|
-
return resolved;
|
|
13275
|
-
}
|
|
13276
|
-
return r2;
|
|
13866
|
+
const isObjectHit = handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && !noObject.includes(resType) && !(isString(joinArrays) && Array.isArray(resForObjHndl));
|
|
13867
|
+
const objectNotReturned = isObjectHit && !opt.returnObjects && !this.options.returnObjects;
|
|
13868
|
+
if (objectNotReturned && this.options.returnedObjectHandler) {
|
|
13869
|
+
const r2 = this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
|
|
13870
|
+
...opt,
|
|
13871
|
+
ns: namespaces
|
|
13872
|
+
});
|
|
13873
|
+
if (returnDetails) {
|
|
13874
|
+
resolved.res = r2;
|
|
13875
|
+
resolved.usedParams = this.getUsedParamsDetails(opt);
|
|
13876
|
+
return resolved;
|
|
13277
13877
|
}
|
|
13878
|
+
return r2;
|
|
13879
|
+
}
|
|
13880
|
+
if (objectNotReturned) {
|
|
13881
|
+
this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
13882
|
+
}
|
|
13883
|
+
if (isObjectHit && !objectNotReturned) {
|
|
13278
13884
|
if (keySeparator) {
|
|
13279
13885
|
const resTypeIsArray = Array.isArray(resForObjHndl);
|
|
13280
13886
|
const copy3 = resTypeIsArray ? [] : {};
|
|
@@ -13311,18 +13917,19 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13311
13917
|
} else {
|
|
13312
13918
|
let usedDefault = false;
|
|
13313
13919
|
let usedKey = false;
|
|
13314
|
-
if (
|
|
13920
|
+
if (objectNotReturned) res = void 0;
|
|
13921
|
+
if (!this.isValidLookup(res) && hasDefaultValue && !(objectNotReturned && shouldHandleAsObject(defaultValue))) {
|
|
13315
13922
|
usedDefault = true;
|
|
13316
13923
|
res = defaultValue;
|
|
13317
13924
|
}
|
|
13318
|
-
if (!this.isValidLookup(res)) {
|
|
13925
|
+
if (!this.isValidLookup(res) && !(usedDefault && res === "")) {
|
|
13319
13926
|
usedKey = true;
|
|
13320
13927
|
res = key;
|
|
13321
13928
|
}
|
|
13322
13929
|
const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
|
|
13323
13930
|
const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
|
|
13324
13931
|
const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
|
|
13325
|
-
if (usedKey || usedDefault || updateMissing) {
|
|
13932
|
+
if (!objectNotReturned && (usedKey || usedDefault || updateMissing)) {
|
|
13326
13933
|
this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, needsPluralHandling && !updateMissing ? `${key}${this.pluralResolver.getSuffix(lng, opt.count, opt)}` : key, updateMissing ? defaultValue : res);
|
|
13327
13934
|
if (keySeparator) {
|
|
13328
13935
|
const fk = this.resolve(key, {
|
|
@@ -13403,7 +14010,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13403
14010
|
const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
13404
14011
|
let nestBef;
|
|
13405
14012
|
if (skipOnVariables) {
|
|
13406
|
-
const nb = res.match(this.interpolator.nestingRegexp);
|
|
14013
|
+
const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
13407
14014
|
nestBef = nb && nb.length;
|
|
13408
14015
|
}
|
|
13409
14016
|
let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
|
|
@@ -13413,7 +14020,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13413
14020
|
};
|
|
13414
14021
|
res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
|
|
13415
14022
|
if (skipOnVariables) {
|
|
13416
|
-
const na = res.match(this.interpolator.nestingRegexp);
|
|
14023
|
+
const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
13417
14024
|
const nestAft = na && na.length;
|
|
13418
14025
|
if (nestBef < nestAft) opt.nest = false;
|
|
13419
14026
|
}
|
|
@@ -13430,18 +14037,21 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13430
14037
|
const postProcess = opt.postProcess || this.options.postProcess;
|
|
13431
14038
|
const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
|
|
13432
14039
|
if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
|
|
13433
|
-
|
|
13434
|
-
if (this.logger.debug && postProcessor.processors[name] && this.ownPostProcessors && !this.ownPostProcessors.has(name)) {
|
|
13435
|
-
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`);
|
|
13436
|
-
}
|
|
13437
|
-
});
|
|
13438
|
-
res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
|
|
14040
|
+
const ppOptions = this.options?.postProcessPassResolved ? {
|
|
13439
14041
|
i18nResolved: {
|
|
13440
14042
|
...resolved,
|
|
13441
14043
|
usedParams: this.getUsedParamsDetails(opt)
|
|
13442
14044
|
},
|
|
13443
14045
|
...opt
|
|
13444
|
-
} : opt
|
|
14046
|
+
} : opt;
|
|
14047
|
+
postProcessorNames.forEach((name) => {
|
|
14048
|
+
const processor = this.postProcessors?.[name];
|
|
14049
|
+
if (!processor) {
|
|
14050
|
+
this.logger.once(`postProcess:${name}`, "warn", `postProcess: '${name}' is not registered on this i18next instance; call use() with it on this instance`);
|
|
14051
|
+
return;
|
|
14052
|
+
}
|
|
14053
|
+
res = processor.process(res, key, ppOptions, this) ?? res;
|
|
14054
|
+
});
|
|
13445
14055
|
}
|
|
13446
14056
|
return res;
|
|
13447
14057
|
}
|
|
@@ -13507,6 +14117,15 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13507
14117
|
}
|
|
13508
14118
|
}
|
|
13509
14119
|
}
|
|
14120
|
+
if (needsPluralHandling) {
|
|
14121
|
+
const otherSuffix = `${opt.ordinal ? ordinalPrefix : this.options.pluralSeparator}other`;
|
|
14122
|
+
if (pluralSuffix !== otherSuffix) {
|
|
14123
|
+
if (needsContextHandling) {
|
|
14124
|
+
finalKeys.unshift(`${key}${this.options.contextSeparator || "_"}${opt.context}${otherSuffix}`);
|
|
14125
|
+
}
|
|
14126
|
+
finalKeys.unshift(key + otherSuffix);
|
|
14127
|
+
}
|
|
14128
|
+
}
|
|
13510
14129
|
}
|
|
13511
14130
|
let possibleKey;
|
|
13512
14131
|
while (possibleKey = finalKeys.pop()) {
|
|
@@ -13570,14 +14189,16 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13570
14189
|
}
|
|
13571
14190
|
};
|
|
13572
14191
|
var LanguageUtil = class {
|
|
13573
|
-
constructor(options) {
|
|
14192
|
+
constructor(options, logger = baseLogger) {
|
|
13574
14193
|
this.options = options;
|
|
13575
14194
|
this.supportedLngs = this.options.supportedLngs || false;
|
|
13576
|
-
this.logger =
|
|
14195
|
+
this.logger = logger.create("languageUtils");
|
|
13577
14196
|
this.resolveHierarchyCache = {};
|
|
14197
|
+
this.formattedCodes = /* @__PURE__ */ new Map();
|
|
13578
14198
|
}
|
|
13579
14199
|
clearCache() {
|
|
13580
14200
|
this.resolveHierarchyCache = {};
|
|
14201
|
+
this.formattedCodes.clear();
|
|
13581
14202
|
}
|
|
13582
14203
|
getScriptPartFromCode(code) {
|
|
13583
14204
|
code = getCleanedCode(code);
|
|
@@ -13595,35 +14216,28 @@ var LanguageUtil = class {
|
|
|
13595
14216
|
return this.formatLanguageCode(p2[0]);
|
|
13596
14217
|
}
|
|
13597
14218
|
formatLanguageCode(code) {
|
|
13598
|
-
if (isString(code)
|
|
13599
|
-
|
|
14219
|
+
if (!isString(code)) return code;
|
|
14220
|
+
let formatted = this.formattedCodes.get(code);
|
|
14221
|
+
if (formatted !== void 0) return formatted;
|
|
14222
|
+
formatted = this.formatUncached(code);
|
|
14223
|
+
if (this.formattedCodes.size >= 1e3) this.formattedCodes.clear();
|
|
14224
|
+
this.formattedCodes.set(code, formatted);
|
|
14225
|
+
return formatted;
|
|
14226
|
+
}
|
|
14227
|
+
formatUncached(code) {
|
|
14228
|
+
const hasSubtags = code.includes("-");
|
|
14229
|
+
if (hasSubtags || this.options.cleanCode !== false) {
|
|
14230
|
+
let canonical;
|
|
13600
14231
|
try {
|
|
13601
|
-
|
|
14232
|
+
canonical = Intl.getCanonicalLocales(code)[0];
|
|
13602
14233
|
} catch (e) {
|
|
13603
14234
|
}
|
|
13604
|
-
if (
|
|
13605
|
-
|
|
13606
|
-
}
|
|
13607
|
-
if (formattedCode) return formattedCode;
|
|
13608
|
-
if (this.options.lowerCaseLng) {
|
|
13609
|
-
return code.toLowerCase();
|
|
14235
|
+
if (canonical && (hasSubtags || canonical.toLowerCase() === code.toLowerCase())) {
|
|
14236
|
+
return this.options.lowerCaseLng ? canonical.toLowerCase() : canonical;
|
|
13610
14237
|
}
|
|
13611
|
-
return code;
|
|
13612
|
-
}
|
|
13613
|
-
const formatted = this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
|
|
13614
|
-
if (this.logger.debug && isString(code)) this.deprecateBareCode(code, formatted);
|
|
13615
|
-
return formatted;
|
|
13616
|
-
}
|
|
13617
|
-
deprecateBareCode(code, formatted) {
|
|
13618
|
-
let v27;
|
|
13619
|
-
try {
|
|
13620
|
-
v27 = Intl.getCanonicalLocales(code)[0];
|
|
13621
|
-
} catch (e) {
|
|
13622
|
-
return;
|
|
14238
|
+
if (canonical) return code.toLowerCase();
|
|
13623
14239
|
}
|
|
13624
|
-
|
|
13625
|
-
if (v27 === formatted) return;
|
|
13626
|
-
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`);
|
|
14240
|
+
return this.options.lowerCaseLng || this.options.cleanCode && !hasSubtags ? code.toLowerCase() : code;
|
|
13627
14241
|
}
|
|
13628
14242
|
isSupportedCode(code) {
|
|
13629
14243
|
if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
|
|
@@ -13714,6 +14328,7 @@ var LanguageUtil = class {
|
|
|
13714
14328
|
if (!codes.includes(formattedFc)) addCode(formattedFc);
|
|
13715
14329
|
});
|
|
13716
14330
|
if (cacheKey !== null) {
|
|
14331
|
+
if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
|
|
13717
14332
|
this.resolveHierarchyCache[cacheKey] = codes;
|
|
13718
14333
|
return codes.slice();
|
|
13719
14334
|
}
|
|
@@ -13735,10 +14350,10 @@ var dummyRule = {
|
|
|
13735
14350
|
})
|
|
13736
14351
|
};
|
|
13737
14352
|
var PluralResolver = class {
|
|
13738
|
-
constructor(languageUtils, options = {}) {
|
|
14353
|
+
constructor(languageUtils, options = {}, logger = baseLogger) {
|
|
13739
14354
|
this.languageUtils = languageUtils;
|
|
13740
14355
|
this.options = options;
|
|
13741
|
-
this.logger =
|
|
14356
|
+
this.logger = logger.create("pluralResolver");
|
|
13742
14357
|
this.pluralRulesCache = {};
|
|
13743
14358
|
}
|
|
13744
14359
|
clearCache() {
|
|
@@ -13768,6 +14383,7 @@ var PluralResolver = class {
|
|
|
13768
14383
|
const lngPart = this.languageUtils.getLanguagePartFromCode(code);
|
|
13769
14384
|
rule = this.getRule(lngPart, options);
|
|
13770
14385
|
}
|
|
14386
|
+
if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
|
|
13771
14387
|
this.pluralRulesCache[cacheKey] = rule;
|
|
13772
14388
|
return rule;
|
|
13773
14389
|
}
|
|
@@ -13803,8 +14419,8 @@ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJS
|
|
|
13803
14419
|
return path;
|
|
13804
14420
|
};
|
|
13805
14421
|
var Interpolator = class {
|
|
13806
|
-
constructor(options = {}) {
|
|
13807
|
-
this.logger =
|
|
14422
|
+
constructor(options = {}, logger = baseLogger) {
|
|
14423
|
+
this.logger = logger.create("interpolator");
|
|
13808
14424
|
this.options = options;
|
|
13809
14425
|
this.format = options?.interpolation?.format || ((value) => value);
|
|
13810
14426
|
this.init(options);
|
|
@@ -13818,39 +14434,28 @@ var Interpolator = class {
|
|
|
13818
14434
|
escapeValue,
|
|
13819
14435
|
useRawValueToEscape,
|
|
13820
14436
|
prefix: prefix2,
|
|
13821
|
-
prefixEscaped,
|
|
13822
14437
|
suffix,
|
|
13823
|
-
suffixEscaped,
|
|
13824
14438
|
formatSeparator,
|
|
13825
14439
|
unescapeSuffix,
|
|
13826
14440
|
unescapePrefix,
|
|
13827
14441
|
nestingPrefix,
|
|
13828
|
-
nestingPrefixEscaped,
|
|
13829
14442
|
nestingSuffix,
|
|
13830
|
-
nestingSuffixEscaped,
|
|
13831
14443
|
nestingOptionsSeparator,
|
|
13832
14444
|
maxReplaces,
|
|
13833
14445
|
alwaysFormat
|
|
13834
14446
|
} = options.interpolation;
|
|
13835
|
-
if (prefixEscaped || suffixEscaped || nestingPrefixEscaped || nestingSuffixEscaped) {
|
|
13836
|
-
const names = Object.entries({
|
|
13837
|
-
prefixEscaped,
|
|
13838
|
-
suffixEscaped,
|
|
13839
|
-
nestingPrefixEscaped,
|
|
13840
|
-
nestingSuffixEscaped
|
|
13841
|
-
}).filter(([, v2]) => v2).map(([k2]) => k2);
|
|
13842
|
-
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`);
|
|
13843
|
-
}
|
|
13844
14447
|
this.escape = escape$1 !== void 0 ? escape$1 : escape;
|
|
13845
14448
|
this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
|
|
13846
14449
|
this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
|
|
13847
|
-
this.prefix = prefix2 ? regexEscape(prefix2) :
|
|
13848
|
-
this.suffix = suffix ? regexEscape(suffix) :
|
|
14450
|
+
this.prefix = prefix2 ? regexEscape(prefix2) : "{{";
|
|
14451
|
+
this.suffix = suffix ? regexEscape(suffix) : "}}";
|
|
13849
14452
|
this.formatSeparator = formatSeparator || ",";
|
|
13850
14453
|
this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
|
|
13851
14454
|
this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
|
|
13852
|
-
this.
|
|
13853
|
-
this.
|
|
14455
|
+
this.prefixText = prefix2 || "{{";
|
|
14456
|
+
this.nestingPrefixText = nestingPrefix || "$t(";
|
|
14457
|
+
this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
|
|
14458
|
+
this.nestingSuffix = regexEscape(nestingSuffix || ")");
|
|
13854
14459
|
this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
|
|
13855
14460
|
this.maxReplaces = maxReplaces || 1e3;
|
|
13856
14461
|
this.alwaysFormat = alwaysFormat !== void 0 ? alwaysFormat : false;
|
|
@@ -13901,18 +14506,13 @@ var Interpolator = class {
|
|
|
13901
14506
|
}
|
|
13902
14507
|
const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
13903
14508
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
14509
|
+
if (isString(str) && !str.includes(this.prefixText)) return str;
|
|
13904
14510
|
const todos = [{
|
|
13905
14511
|
regex: this.regexpUnescape,
|
|
13906
14512
|
safeValue: (val) => val
|
|
13907
14513
|
}, {
|
|
13908
14514
|
regex: this.regexp,
|
|
13909
|
-
safeValue: (val) =>
|
|
13910
|
-
if (!this.escapeValue) return val;
|
|
13911
|
-
if (this.escape === escape && this.options?.interpolation?.escapeValue !== false && isString(val) && val.includes("/")) {
|
|
13912
|
-
this.logger.once("/", "deprecate", "escapeValue renders '/' in a value as '/' today; from v27 the default escape leaves '/' as it is");
|
|
13913
|
-
}
|
|
13914
|
-
return this.escape(val);
|
|
13915
|
-
}
|
|
14515
|
+
safeValue: (val) => this.escapeValue ? this.escape(val) : val
|
|
13916
14516
|
}];
|
|
13917
14517
|
const unescapedValues = [];
|
|
13918
14518
|
let shift = 0;
|
|
@@ -13996,6 +14596,7 @@ var Interpolator = class {
|
|
|
13996
14596
|
if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
|
|
13997
14597
|
return key;
|
|
13998
14598
|
};
|
|
14599
|
+
if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
|
|
13999
14600
|
const nestingRegexp = new RegExp(this.nestingRegexp);
|
|
14000
14601
|
let out = "";
|
|
14001
14602
|
let lastEnd = 0;
|
|
@@ -14063,8 +14664,9 @@ var parseFormatStr = (formatStr) => {
|
|
|
14063
14664
|
formatOptions
|
|
14064
14665
|
};
|
|
14065
14666
|
};
|
|
14667
|
+
var cachedFormattersLimit = 1e3;
|
|
14066
14668
|
var createCachedFormatter = (fn) => {
|
|
14067
|
-
const cache =
|
|
14669
|
+
const cache = /* @__PURE__ */ new Map();
|
|
14068
14670
|
return (v2, l2, o) => {
|
|
14069
14671
|
let optForCache = o;
|
|
14070
14672
|
if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
|
|
@@ -14079,10 +14681,11 @@ var createCachedFormatter = (fn) => {
|
|
|
14079
14681
|
} catch (e) {
|
|
14080
14682
|
return fn(getCleanedCode(l2), o)(v2);
|
|
14081
14683
|
}
|
|
14082
|
-
let frm = cache
|
|
14684
|
+
let frm = cache.get(key);
|
|
14083
14685
|
if (!frm) {
|
|
14084
14686
|
frm = fn(getCleanedCode(l2), o);
|
|
14085
|
-
cache
|
|
14687
|
+
if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
|
|
14688
|
+
cache.set(key, frm);
|
|
14086
14689
|
}
|
|
14087
14690
|
return frm(v2);
|
|
14088
14691
|
};
|
|
@@ -14097,6 +14700,7 @@ var Formatter = class {
|
|
|
14097
14700
|
init(services, options = {
|
|
14098
14701
|
interpolation: {}
|
|
14099
14702
|
}) {
|
|
14703
|
+
if (services?.logger?.create) this.logger = services.logger.create("formatter");
|
|
14100
14704
|
this.formatSeparator = options.interpolation.formatSeparator || ",";
|
|
14101
14705
|
const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
|
|
14102
14706
|
this.formats = {
|
|
@@ -14178,6 +14782,7 @@ var Formatter = class {
|
|
|
14178
14782
|
return result;
|
|
14179
14783
|
}
|
|
14180
14784
|
};
|
|
14785
|
+
var maxFailedLoads = 1e3;
|
|
14181
14786
|
var removePending = (q2, name) => {
|
|
14182
14787
|
if (q2.pending[name] !== void 0) {
|
|
14183
14788
|
delete q2.pending[name];
|
|
@@ -14192,13 +14797,14 @@ var Connector = class extends EventEmitter {
|
|
|
14192
14797
|
this.services = services;
|
|
14193
14798
|
this.languageUtils = services.languageUtils;
|
|
14194
14799
|
this.options = options;
|
|
14195
|
-
this.logger = baseLogger.create("backendConnector");
|
|
14800
|
+
this.logger = (services.logger || baseLogger).create("backendConnector");
|
|
14196
14801
|
this.waitingReads = [];
|
|
14197
14802
|
this.maxParallelReads = options.maxParallelReads || 10;
|
|
14198
14803
|
this.readingCalls = 0;
|
|
14199
14804
|
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
14200
14805
|
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
14201
14806
|
this.state = {};
|
|
14807
|
+
this.failed = /* @__PURE__ */ new Set();
|
|
14202
14808
|
this.queue = [];
|
|
14203
14809
|
this.backend?.init?.(services, options.backend, options);
|
|
14204
14810
|
this.callbackApi = callbackApiOf(this.backend);
|
|
@@ -14258,6 +14864,15 @@ var Connector = class extends EventEmitter {
|
|
|
14258
14864
|
}
|
|
14259
14865
|
this.state[name] = err ? -1 : 2;
|
|
14260
14866
|
if (err && data) this.state[name] = 0;
|
|
14867
|
+
this.failed.delete(name);
|
|
14868
|
+
if (err) {
|
|
14869
|
+
this.failed.add(name);
|
|
14870
|
+
if (this.failed.size > maxFailedLoads) {
|
|
14871
|
+
const oldest = this.failed.values().next().value;
|
|
14872
|
+
this.failed.delete(oldest);
|
|
14873
|
+
if (this.state[oldest] < 1) delete this.state[oldest];
|
|
14874
|
+
}
|
|
14875
|
+
}
|
|
14261
14876
|
const loaded = {};
|
|
14262
14877
|
this.queue.forEach((q2) => {
|
|
14263
14878
|
pushPath(q2.loaded, [lng], ns);
|
|
@@ -14352,15 +14967,10 @@ var Connector = class extends EventEmitter {
|
|
|
14352
14967
|
reload: true
|
|
14353
14968
|
}, callback);
|
|
14354
14969
|
}
|
|
14355
|
-
noticeDevFallback(lng) {
|
|
14356
|
-
if (lng !== "dev" || !this.devIsDefaultFallback) return;
|
|
14357
|
-
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");
|
|
14358
|
-
}
|
|
14359
14970
|
loadOne(name, prefix2 = "") {
|
|
14360
14971
|
const s = name.split("|");
|
|
14361
14972
|
const lng = s[0];
|
|
14362
14973
|
const ns = s[1];
|
|
14363
|
-
this.noticeDevFallback(lng);
|
|
14364
14974
|
this.read(lng, ns, "read", void 0, void 0, (err, data) => {
|
|
14365
14975
|
if (err) this.logger.warn(`${prefix2}loading namespace ${ns} for language ${lng} failed`, err);
|
|
14366
14976
|
if (!err && data) this.logger.log(`${prefix2}loaded namespace ${ns} for language ${lng}`, data);
|
|
@@ -14375,7 +14985,6 @@ var Connector = class extends EventEmitter {
|
|
|
14375
14985
|
}
|
|
14376
14986
|
if (key === void 0 || key === null || key === "") return;
|
|
14377
14987
|
if (this.backend?.create) {
|
|
14378
|
-
languages?.forEach?.((l2) => this.noticeDevFallback(l2));
|
|
14379
14988
|
const opts = {
|
|
14380
14989
|
...options,
|
|
14381
14990
|
isUpdate
|
|
@@ -14410,7 +15019,7 @@ var get = () => ({
|
|
|
14410
15019
|
initAsync: true,
|
|
14411
15020
|
ns: ["translation"],
|
|
14412
15021
|
defaultNS: ["translation"],
|
|
14413
|
-
fallbackLng:
|
|
15022
|
+
fallbackLng: false,
|
|
14414
15023
|
fallbackNS: false,
|
|
14415
15024
|
supportedLngs: false,
|
|
14416
15025
|
nonExplicitSupportedLngs: false,
|
|
@@ -14431,7 +15040,7 @@ var get = () => ({
|
|
|
14431
15040
|
postProcess: false,
|
|
14432
15041
|
postProcessPassResolved: false,
|
|
14433
15042
|
returnNull: false,
|
|
14434
|
-
returnEmptyString:
|
|
15043
|
+
returnEmptyString: false,
|
|
14435
15044
|
returnObjects: false,
|
|
14436
15045
|
joinArrays: false,
|
|
14437
15046
|
returnedObjectHandler: false,
|
|
@@ -14476,7 +15085,39 @@ var transformOptions = (options) => {
|
|
|
14476
15085
|
};
|
|
14477
15086
|
var noop = () => {
|
|
14478
15087
|
};
|
|
14479
|
-
var
|
|
15088
|
+
var withDefaults = (options) => {
|
|
15089
|
+
const defOpts = get();
|
|
15090
|
+
const merged = {
|
|
15091
|
+
...defOpts,
|
|
15092
|
+
...options
|
|
15093
|
+
};
|
|
15094
|
+
merged.interpolation = {
|
|
15095
|
+
...defOpts.interpolation,
|
|
15096
|
+
...options.interpolation
|
|
15097
|
+
};
|
|
15098
|
+
if (typeof merged.overloadTranslationOptionHandler !== "function") {
|
|
15099
|
+
merged.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
|
|
15100
|
+
}
|
|
15101
|
+
return merged;
|
|
15102
|
+
};
|
|
15103
|
+
var configuredLanguageCodes = (options) => {
|
|
15104
|
+
const codes = [].concat(options.supportedLngs || [], options.preload || []);
|
|
15105
|
+
codes.push(...Object.keys(options.resources || {}));
|
|
15106
|
+
const fallbackLng = options.fallbackLng;
|
|
15107
|
+
if (isString(fallbackLng) || Array.isArray(fallbackLng)) codes.push(...[].concat(fallbackLng));
|
|
15108
|
+
else if (fallbackLng && typeof fallbackLng === "object") {
|
|
15109
|
+
Object.keys(fallbackLng).forEach((code) => {
|
|
15110
|
+
if (code !== "default") codes.push(code);
|
|
15111
|
+
codes.push(...[].concat(fallbackLng[code]));
|
|
15112
|
+
});
|
|
15113
|
+
}
|
|
15114
|
+
return codes;
|
|
15115
|
+
};
|
|
15116
|
+
var isRefusedLanguageCode = (i18n2, code) => {
|
|
15117
|
+
if (!isString(code) || isSafeLanguageCode(code) || i18n2.configuredLngs?.has(code)) return false;
|
|
15118
|
+
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`);
|
|
15119
|
+
return true;
|
|
15120
|
+
};
|
|
14480
15121
|
var bindMemberFunctions = (inst) => {
|
|
14481
15122
|
const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
|
|
14482
15123
|
mems.forEach((mem) => {
|
|
@@ -14488,17 +15129,18 @@ var bindMemberFunctions = (inst) => {
|
|
|
14488
15129
|
var I18n = class _I18n extends EventEmitter {
|
|
14489
15130
|
constructor(options = {}, callback) {
|
|
14490
15131
|
super();
|
|
14491
|
-
this.
|
|
15132
|
+
this.userOptions = transformOptions(options);
|
|
15133
|
+
this.options = withDefaults(this.userOptions);
|
|
14492
15134
|
this.services = {
|
|
14493
|
-
|
|
15135
|
+
postProcessors: /* @__PURE__ */ Object.create(null)
|
|
14494
15136
|
};
|
|
14495
|
-
this.logger =
|
|
15137
|
+
this.logger = new Logger(null, this.options);
|
|
14496
15138
|
this.modules = {
|
|
14497
15139
|
external: []
|
|
14498
15140
|
};
|
|
14499
15141
|
bindMemberFunctions(this);
|
|
14500
15142
|
if (callback && !this.isInitialized && !options.isClone) {
|
|
14501
|
-
if (!this.
|
|
15143
|
+
if (!this.userOptions.initAsync) {
|
|
14502
15144
|
this.init(options, callback);
|
|
14503
15145
|
return this;
|
|
14504
15146
|
}
|
|
@@ -14520,25 +15162,23 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14520
15162
|
options.defaultNS = options.ns[0];
|
|
14521
15163
|
}
|
|
14522
15164
|
}
|
|
14523
|
-
|
|
14524
|
-
const
|
|
14525
|
-
|
|
14526
|
-
...
|
|
14527
|
-
...this.options,
|
|
14528
|
-
...transformOptions(options)
|
|
15165
|
+
transformOptions(options);
|
|
15166
|
+
const userOptions = {
|
|
15167
|
+
...this.userOptions,
|
|
15168
|
+
...options
|
|
14529
15169
|
};
|
|
14530
|
-
this.options
|
|
14531
|
-
...
|
|
14532
|
-
...
|
|
14533
|
-
};
|
|
14534
|
-
if (
|
|
14535
|
-
this.options.userDefinedKeySeparator =
|
|
15170
|
+
this.options = withDefaults({
|
|
15171
|
+
...this.options,
|
|
15172
|
+
...options
|
|
15173
|
+
});
|
|
15174
|
+
if (userOptions.keySeparator !== void 0) {
|
|
15175
|
+
this.options.userDefinedKeySeparator = userOptions.keySeparator;
|
|
14536
15176
|
}
|
|
14537
|
-
if (
|
|
14538
|
-
this.options.userDefinedNsSeparator =
|
|
15177
|
+
if (userOptions.nsSeparator !== void 0) {
|
|
15178
|
+
this.options.userDefinedNsSeparator = userOptions.nsSeparator;
|
|
14539
15179
|
}
|
|
14540
|
-
if (
|
|
14541
|
-
this.
|
|
15180
|
+
if (!this.options.isClone) {
|
|
15181
|
+
this.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...configuredLanguageCodes(userOptions)]);
|
|
14542
15182
|
}
|
|
14543
15183
|
const createClassOnDemand = (ClassOrObject) => {
|
|
14544
15184
|
if (!ClassOrObject) return null;
|
|
@@ -14546,15 +15186,10 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14546
15186
|
return ClassOrObject;
|
|
14547
15187
|
};
|
|
14548
15188
|
if (!this.options.isClone) {
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
if (this.modules.logger) {
|
|
14554
|
-
baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
14555
|
-
} else {
|
|
14556
|
-
baseLogger.init(null, this.options);
|
|
14557
|
-
}
|
|
15189
|
+
this.logger.init(createClassOnDemand(this.modules.logger), this.options);
|
|
15190
|
+
const {
|
|
15191
|
+
logger
|
|
15192
|
+
} = this;
|
|
14558
15193
|
this.pendingWarnings?.forEach((msg) => this.logger.warn(msg));
|
|
14559
15194
|
this.pendingWarnings = void 0;
|
|
14560
15195
|
let formatter;
|
|
@@ -14563,27 +15198,26 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14563
15198
|
} else {
|
|
14564
15199
|
formatter = Formatter;
|
|
14565
15200
|
}
|
|
14566
|
-
const lu = new LanguageUtil(this.options);
|
|
14567
|
-
this.store = new ResourceStore(this.options.resources, this.options);
|
|
15201
|
+
const lu = new LanguageUtil(this.options, logger);
|
|
15202
|
+
this.store = new ResourceStore(this.options.resources, this.options, logger);
|
|
14568
15203
|
const s = this.services;
|
|
14569
|
-
s.logger =
|
|
15204
|
+
s.logger = logger;
|
|
14570
15205
|
s.resourceStore = this.store;
|
|
14571
15206
|
s.languageUtils = lu;
|
|
14572
15207
|
s.pluralResolver = new PluralResolver(lu, {
|
|
14573
15208
|
prepend: this.options.pluralSeparator
|
|
14574
|
-
});
|
|
15209
|
+
}, logger);
|
|
14575
15210
|
if (formatter) {
|
|
14576
15211
|
s.formatter = createClassOnDemand(formatter);
|
|
14577
15212
|
if (s.formatter.init) s.formatter.init(s, this.options);
|
|
14578
15213
|
this.options.interpolation.format = s.formatter.format.bind(s.formatter);
|
|
14579
15214
|
}
|
|
14580
|
-
s.interpolator = new Interpolator(this.options);
|
|
15215
|
+
s.interpolator = new Interpolator(this.options, logger);
|
|
14581
15216
|
s.utils = {
|
|
14582
15217
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this),
|
|
14583
15218
|
reloadResources: this.reloadResources.bind(this)
|
|
14584
15219
|
};
|
|
14585
15220
|
s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
|
|
14586
|
-
s.backendConnector.devIsDefaultFallback = fallbackLngIsDefault;
|
|
14587
15221
|
s.backendConnector.on("*", (event, ...args) => {
|
|
14588
15222
|
this.emit(event, ...args);
|
|
14589
15223
|
});
|
|
@@ -14724,8 +15358,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14724
15358
|
setModule("i18nFormat");
|
|
14725
15359
|
}
|
|
14726
15360
|
if (module.type === "postProcessor") {
|
|
14727
|
-
|
|
14728
|
-
this.services.ownPostProcessors?.add(module.name);
|
|
15361
|
+
this.services.postProcessors[module.name] = module;
|
|
14729
15362
|
}
|
|
14730
15363
|
if (module.type === "formatter") {
|
|
14731
15364
|
setModule("formatter");
|
|
@@ -14800,14 +15433,16 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14800
15433
|
};
|
|
14801
15434
|
const setLng = (lngs) => {
|
|
14802
15435
|
if (!lng && !lngs && this.services.languageDetector) lngs = [];
|
|
14803
|
-
const
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
}
|
|
15436
|
+
const {
|
|
15437
|
+
supportedLngs
|
|
15438
|
+
} = this.options;
|
|
15439
|
+
if (lngs && !supportedLngs) {
|
|
15440
|
+
const accepted = [].concat(lngs).filter((c2) => !isRefusedLanguageCode(this, c2));
|
|
15441
|
+
if (accepted.length < [].concat(lngs).length) lngs = accepted;
|
|
14810
15442
|
}
|
|
15443
|
+
const fl = isString(lngs) ? lngs : lngs && lngs[0];
|
|
15444
|
+
let l2 = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
|
|
15445
|
+
if (supportedLngs && isRefusedLanguageCode(this, l2)) l2 = this.services.languageUtils.getBestMatchFromCodes([]);
|
|
14811
15446
|
if (l2) {
|
|
14812
15447
|
if (!this.language) {
|
|
14813
15448
|
setLngProps(l2);
|
|
@@ -14922,7 +15557,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14922
15557
|
}
|
|
14923
15558
|
loadNamespaces(ns, callback) {
|
|
14924
15559
|
const deferred = defer();
|
|
14925
|
-
if (!this.options.ns) {
|
|
15560
|
+
if (!this.options.ns || !this.services.backendConnector) {
|
|
14926
15561
|
if (callback) callback();
|
|
14927
15562
|
return Promise.resolve();
|
|
14928
15563
|
}
|
|
@@ -14940,7 +15575,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14940
15575
|
const deferred = defer();
|
|
14941
15576
|
if (isString(lngs)) lngs = [lngs];
|
|
14942
15577
|
const preloaded = this.options.preload || [];
|
|
14943
|
-
const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && this.services.languageUtils.isSupportedCode(lng));
|
|
15578
|
+
const newLngs = lngs.filter((lng) => !preloaded.includes(lng) && !isRefusedLanguageCode(this, lng) && this.services.languageUtils.isSupportedCode(lng));
|
|
14944
15579
|
if (!newLngs.length) {
|
|
14945
15580
|
if (callback) callback();
|
|
14946
15581
|
return Promise.resolve();
|
|
@@ -14990,16 +15625,15 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
14990
15625
|
}
|
|
14991
15626
|
};
|
|
14992
15627
|
const clone = new _I18n(mergedOptions);
|
|
14993
|
-
|
|
14994
|
-
|
|
14995
|
-
}
|
|
14996
|
-
const membersToCopy = ["store", "services", "language"];
|
|
15628
|
+
clone.logger = options.debug !== void 0 || options.prefix !== void 0 ? this.logger.clone(options) : this.logger;
|
|
15629
|
+
const membersToCopy = ["store", "language"];
|
|
14997
15630
|
membersToCopy.forEach((m2) => {
|
|
14998
15631
|
clone[m2] = this[m2];
|
|
14999
15632
|
});
|
|
15000
15633
|
clone.services = {
|
|
15001
15634
|
...this.services
|
|
15002
15635
|
};
|
|
15636
|
+
clone.services.postProcessors = Object.create(this.services.postProcessors);
|
|
15003
15637
|
clone.services.utils = {
|
|
15004
15638
|
...clone.services.utils,
|
|
15005
15639
|
hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone),
|
|
@@ -15016,7 +15650,7 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
15016
15650
|
return copied;
|
|
15017
15651
|
};
|
|
15018
15652
|
const clonedData = copyData(this.store.data);
|
|
15019
|
-
clone.store = new ResourceStore(clonedData, mergedOptions);
|
|
15653
|
+
clone.store = new ResourceStore(clonedData, mergedOptions, this.logger);
|
|
15020
15654
|
clone.services.resourceStore = clone.store;
|
|
15021
15655
|
}
|
|
15022
15656
|
if (options.interpolation) {
|
|
@@ -15030,8 +15664,9 @@ var I18n = class _I18n extends EventEmitter {
|
|
|
15030
15664
|
...mergedOptions,
|
|
15031
15665
|
interpolation: mergedInterpolation
|
|
15032
15666
|
};
|
|
15033
|
-
clone.services.interpolator = new Interpolator(mergedForInterpolator);
|
|
15667
|
+
clone.services.interpolator = new Interpolator(mergedForInterpolator, this.logger);
|
|
15034
15668
|
}
|
|
15669
|
+
clone.configuredLngs = /* @__PURE__ */ new Set([...this.configuredLngs || [], ...configuredLanguageCodes(options)]);
|
|
15035
15670
|
clone.translator = new Translator(clone.services, mergedOptions);
|
|
15036
15671
|
clone.translator.on("*", (event, ...args) => {
|
|
15037
15672
|
clone.emit(event, ...args);
|
|
@@ -15328,6 +15963,19 @@ var en = {
|
|
|
15328
15963
|
"mo": "mo",
|
|
15329
15964
|
"qtr": "qtr",
|
|
15330
15965
|
"yr": "yr",
|
|
15966
|
+
"wk": "wk",
|
|
15967
|
+
"X days short": "{{amount, number}}d",
|
|
15968
|
+
"X weeks short": "{{amount, number}}wk",
|
|
15969
|
+
"X months short": "{{amount, number}}mo",
|
|
15970
|
+
"X years short": "{{amount, number}}yr",
|
|
15971
|
+
"X days_one": "{{count, number}} day",
|
|
15972
|
+
"X days_other": "{{count, number}} days",
|
|
15973
|
+
"X weeks_one": "{{count, number}} week",
|
|
15974
|
+
"X weeks_other": "{{count, number}} weeks",
|
|
15975
|
+
"X months_one": "{{count, number}} month",
|
|
15976
|
+
"X months_other": "{{count, number}} months",
|
|
15977
|
+
"X years_one": "{{count, number}} year",
|
|
15978
|
+
"X years_other": "{{count, number}} years",
|
|
15331
15979
|
"one time": "one time",
|
|
15332
15980
|
"billing period": "billing period",
|
|
15333
15981
|
"billing period_one": "billing period",
|
|
@@ -15337,6 +15985,7 @@ var en = {
|
|
|
15337
15985
|
"monthly": "monthly",
|
|
15338
15986
|
"quarterly": "quarterly",
|
|
15339
15987
|
"yearly": "yearly",
|
|
15988
|
+
"every period": "every {{period}}",
|
|
15340
15989
|
"expires after purchase": "expires {{amount}} {{unit}} after purchase",
|
|
15341
15990
|
"expires at the end of the billing period": "expires at the end of the billing period",
|
|
15342
15991
|
"expires at the end of the next billing period": "expires at the end of the next billing period",
|
|
@@ -15639,6 +16288,23 @@ var it2 = {
|
|
|
15639
16288
|
"mo": "mese",
|
|
15640
16289
|
"qtr": "trim.",
|
|
15641
16290
|
"yr": "anno",
|
|
16291
|
+
"wk": "sett.",
|
|
16292
|
+
"X days short": "{{amount, number}} gg",
|
|
16293
|
+
"X weeks short": "{{amount, number}} sett.",
|
|
16294
|
+
"X months short": "{{amount, number}} mesi",
|
|
16295
|
+
"X years short": "{{amount, number}} anni",
|
|
16296
|
+
"X days_one": "{{count, number}} giorno",
|
|
16297
|
+
"X days_many": "{{count, number}} giorni",
|
|
16298
|
+
"X days_other": "{{count, number}} giorni",
|
|
16299
|
+
"X weeks_one": "{{count, number}} settimana",
|
|
16300
|
+
"X weeks_many": "{{count, number}} settimane",
|
|
16301
|
+
"X weeks_other": "{{count, number}} settimane",
|
|
16302
|
+
"X months_one": "{{count, number}} mese",
|
|
16303
|
+
"X months_many": "{{count, number}} mesi",
|
|
16304
|
+
"X months_other": "{{count, number}} mesi",
|
|
16305
|
+
"X years_one": "{{count, number}} anno",
|
|
16306
|
+
"X years_many": "{{count, number}} anni",
|
|
16307
|
+
"X years_other": "{{count, number}} anni",
|
|
15642
16308
|
"one time": "una tantum",
|
|
15643
16309
|
"billing period": "periodo di fatturazione",
|
|
15644
16310
|
"billing period_one": "periodo di fatturazione",
|
|
@@ -15672,6 +16338,7 @@ var it2 = {
|
|
|
15672
16338
|
"monthly": "mensile",
|
|
15673
16339
|
"quarterly": "trimestrale",
|
|
15674
16340
|
"yearly": "annuale",
|
|
16341
|
+
"every period": "ogni {{period}}",
|
|
15675
16342
|
"Usage by user": "Utilizzo per utente",
|
|
15676
16343
|
"X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
|
|
15677
16344
|
"Show all X users_one": "Mostra {{count, number}} utente",
|
|
@@ -15865,14 +16532,24 @@ function derivePeriod(interval, intervalCount) {
|
|
|
15865
16532
|
}
|
|
15866
16533
|
return interval;
|
|
15867
16534
|
}
|
|
15868
|
-
function
|
|
16535
|
+
function getSubscriptionInterval(billingSubscription) {
|
|
15869
16536
|
if (!billingSubscription) {
|
|
15870
16537
|
return void 0;
|
|
15871
16538
|
}
|
|
15872
16539
|
const product = billingSubscription.products?.find(
|
|
15873
16540
|
(p2) => p2.interval && p2.interval !== "one-time"
|
|
15874
16541
|
);
|
|
15875
|
-
|
|
16542
|
+
if (product?.interval) {
|
|
16543
|
+
return { interval: product.interval, intervalCount: product.intervalCount };
|
|
16544
|
+
}
|
|
16545
|
+
return billingSubscription.interval ? { interval: billingSubscription.interval } : void 0;
|
|
16546
|
+
}
|
|
16547
|
+
function getSubscriptionPeriod(billingSubscription) {
|
|
16548
|
+
const subscriptionInterval = getSubscriptionInterval(billingSubscription);
|
|
16549
|
+
return derivePeriod(
|
|
16550
|
+
subscriptionInterval?.interval,
|
|
16551
|
+
subscriptionInterval?.intervalCount
|
|
16552
|
+
);
|
|
15876
16553
|
}
|
|
15877
16554
|
function getDefaultPlanPeriod(plans = []) {
|
|
15878
16555
|
if (plans.some((plan) => plan.monthlyPrice)) return "month";
|
|
@@ -16145,6 +16822,8 @@ function getResetCadencePeriod(cadence) {
|
|
|
16145
16822
|
switch (cadence) {
|
|
16146
16823
|
case BillingPlanCreditGrantResetCadence.Yearly:
|
|
16147
16824
|
return "year";
|
|
16825
|
+
case BillingPlanCreditGrantResetCadence.Quarterly:
|
|
16826
|
+
return "quarter";
|
|
16148
16827
|
case BillingPlanCreditGrantResetCadence.Monthly:
|
|
16149
16828
|
return "month";
|
|
16150
16829
|
case BillingPlanCreditGrantResetCadence.Weekly:
|
|
@@ -16634,6 +17313,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
|
|
|
16634
17313
|
function entitlementHasCost(entitlement) {
|
|
16635
17314
|
return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
|
|
16636
17315
|
}
|
|
17316
|
+
function hasMeteredCosts(entitlements) {
|
|
17317
|
+
return entitlements.some(
|
|
17318
|
+
({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
|
|
17319
|
+
);
|
|
17320
|
+
}
|
|
16637
17321
|
function entitlementHasHardLimit(entitlement) {
|
|
16638
17322
|
return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
|
|
16639
17323
|
}
|
|
@@ -16783,8 +17467,38 @@ function getMonthName(date, { locale, ...format }) {
|
|
|
16783
17467
|
...format
|
|
16784
17468
|
}).format(new Date(date));
|
|
16785
17469
|
}
|
|
16786
|
-
|
|
16787
|
-
|
|
17470
|
+
var QUARTERLY_INTERVAL_COUNT = 3;
|
|
17471
|
+
var YEARLY_INTERVAL_COUNT = 12;
|
|
17472
|
+
function normalizeInterval(interval, intervalCount) {
|
|
17473
|
+
const count = intervalCount && intervalCount > 1 ? intervalCount : 1;
|
|
17474
|
+
if (interval === "month" && count === QUARTERLY_INTERVAL_COUNT) {
|
|
17475
|
+
return { period: "quarter", count: 1 };
|
|
17476
|
+
}
|
|
17477
|
+
if (interval === "month" && count === YEARLY_INTERVAL_COUNT) {
|
|
17478
|
+
return { period: "year", count: 1 };
|
|
17479
|
+
}
|
|
17480
|
+
return { period: interval, count };
|
|
17481
|
+
}
|
|
17482
|
+
function shortenPeriod(period, t3, intervalCount) {
|
|
17483
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17484
|
+
if (count > 1) {
|
|
17485
|
+
switch (unit) {
|
|
17486
|
+
case "day":
|
|
17487
|
+
return t3("X days short", { amount: count });
|
|
17488
|
+
case "week":
|
|
17489
|
+
return t3("X weeks short", { amount: count });
|
|
17490
|
+
case "month":
|
|
17491
|
+
return t3("X months short", { amount: count });
|
|
17492
|
+
case "year":
|
|
17493
|
+
return t3("X years short", { amount: count });
|
|
17494
|
+
}
|
|
17495
|
+
return;
|
|
17496
|
+
}
|
|
17497
|
+
switch (unit) {
|
|
17498
|
+
case "day":
|
|
17499
|
+
return t3("day");
|
|
17500
|
+
case "week":
|
|
17501
|
+
return t3("wk");
|
|
16788
17502
|
case "month":
|
|
16789
17503
|
return t3("mo");
|
|
16790
17504
|
case "quarter":
|
|
@@ -16793,6 +17507,31 @@ function shortenPeriod(period, t3) {
|
|
|
16793
17507
|
return t3("yr");
|
|
16794
17508
|
}
|
|
16795
17509
|
}
|
|
17510
|
+
function nameInterval(period, t3, intervalCount) {
|
|
17511
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17512
|
+
if (count > 1) {
|
|
17513
|
+
switch (unit) {
|
|
17514
|
+
case "day":
|
|
17515
|
+
return t3("X days", { count });
|
|
17516
|
+
case "week":
|
|
17517
|
+
return t3("X weeks", { count });
|
|
17518
|
+
case "month":
|
|
17519
|
+
return t3("X months", { count });
|
|
17520
|
+
case "year":
|
|
17521
|
+
return t3("X years", { count });
|
|
17522
|
+
}
|
|
17523
|
+
return period;
|
|
17524
|
+
}
|
|
17525
|
+
switch (unit) {
|
|
17526
|
+
case "day":
|
|
17527
|
+
case "week":
|
|
17528
|
+
case "month":
|
|
17529
|
+
case "quarter":
|
|
17530
|
+
case "year":
|
|
17531
|
+
return t3(unit);
|
|
17532
|
+
}
|
|
17533
|
+
return period;
|
|
17534
|
+
}
|
|
16796
17535
|
function modifyDate(date, days) {
|
|
16797
17536
|
const copy3 = new Date(date);
|
|
16798
17537
|
copy3.setDate(copy3.getDate() + days);
|
|
@@ -16875,8 +17614,14 @@ function formatCurrency(amount, {
|
|
|
16875
17614
|
function formatOrdinal(n2, t3) {
|
|
16876
17615
|
return t3("Ordinal", { count: n2, ordinal: true });
|
|
16877
17616
|
}
|
|
16878
|
-
function adjectify(period, t3) {
|
|
16879
|
-
|
|
17617
|
+
function adjectify(period, t3, intervalCount) {
|
|
17618
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17619
|
+
if (count > 1) {
|
|
17620
|
+
return t3("every period", {
|
|
17621
|
+
period: nameInterval(period, t3, intervalCount)
|
|
17622
|
+
});
|
|
17623
|
+
}
|
|
17624
|
+
switch (unit) {
|
|
16880
17625
|
case "day":
|
|
16881
17626
|
return t3("daily");
|
|
16882
17627
|
case "week":
|
|
@@ -17059,6 +17804,25 @@ var createKeyboardExecutionHandler = (fn) => {
|
|
|
17059
17804
|
return handler;
|
|
17060
17805
|
};
|
|
17061
17806
|
|
|
17807
|
+
// src/utils/invoiceLink.ts
|
|
17808
|
+
function openInvoiceLink(event, storedUrl, fetchUrl) {
|
|
17809
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
|
|
17810
|
+
return Promise.resolve();
|
|
17811
|
+
}
|
|
17812
|
+
const tab = window.open("", "_blank");
|
|
17813
|
+
if (tab === null) {
|
|
17814
|
+
return Promise.resolve();
|
|
17815
|
+
}
|
|
17816
|
+
event.preventDefault();
|
|
17817
|
+
tab.opener = null;
|
|
17818
|
+
return fetchUrl().then(
|
|
17819
|
+
(url) => url || storedUrl,
|
|
17820
|
+
() => storedUrl
|
|
17821
|
+
).then((url) => {
|
|
17822
|
+
tab.location.href = url;
|
|
17823
|
+
});
|
|
17824
|
+
}
|
|
17825
|
+
|
|
17062
17826
|
// src/utils/markdown.tsx
|
|
17063
17827
|
import { Fragment } from "react";
|
|
17064
17828
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
@@ -17811,7 +18575,7 @@ var reducer = (state, action) => {
|
|
|
17811
18575
|
// src/context/EmbedProvider.tsx
|
|
17812
18576
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
17813
18577
|
var getCustomHeaders = (sessionId) => ({
|
|
17814
|
-
"X-Schematic-Components-Version": "2.
|
|
18578
|
+
"X-Schematic-Components-Version": "2.39.0",
|
|
17815
18579
|
"X-Schematic-Session-ID": sessionId
|
|
17816
18580
|
});
|
|
17817
18581
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -18199,6 +18963,12 @@ var EmbedProvider = ({
|
|
|
18199
18963
|
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
18200
18964
|
[listInvoices]
|
|
18201
18965
|
);
|
|
18966
|
+
const getInvoiceLink = useCallback2(
|
|
18967
|
+
async (billingInvoiceId) => {
|
|
18968
|
+
return checkoutApi?.getInvoiceLink({ billingInvoiceId });
|
|
18969
|
+
},
|
|
18970
|
+
[checkoutApi]
|
|
18971
|
+
);
|
|
18202
18972
|
const getCreditUsageByUser = useCallback2(
|
|
18203
18973
|
async (billingCreditId, limit) => {
|
|
18204
18974
|
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
@@ -18393,6 +19163,7 @@ var EmbedProvider = ({
|
|
|
18393
19163
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
18394
19164
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
18395
19165
|
listInvoices: debouncedListInvoices,
|
|
19166
|
+
getInvoiceLink,
|
|
18396
19167
|
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
18397
19168
|
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
18398
19169
|
finishCheckout,
|
|
@@ -18531,10 +19302,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
18531
19302
|
return periods;
|
|
18532
19303
|
}, [data?.activePlans, data?.activeAddOns]);
|
|
18533
19304
|
const getActivePlans = useCallback3(
|
|
18534
|
-
(plans) => {
|
|
19305
|
+
(plans, period = activePeriod) => {
|
|
18535
19306
|
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
|
|
18536
19307
|
if (options.useSelectedPeriod) {
|
|
18537
|
-
return
|
|
19308
|
+
return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
18538
19309
|
}
|
|
18539
19310
|
return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
18540
19311
|
});
|
|
@@ -18546,7 +19317,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
18546
19317
|
return {
|
|
18547
19318
|
plans: getActivePlans(data?.activePlans || []),
|
|
18548
19319
|
addOns: getActivePlans(data?.activeAddOns || []),
|
|
18549
|
-
periods: getAvailablePeriods()
|
|
19320
|
+
periods: getAvailablePeriods(),
|
|
19321
|
+
plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
|
|
18550
19322
|
};
|
|
18551
19323
|
}, [
|
|
18552
19324
|
data?.activePlans,
|
|
@@ -22264,28 +23036,49 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22264
23036
|
}
|
|
22265
23037
|
}, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
|
|
22266
23038
|
const {
|
|
22267
|
-
plans:
|
|
23039
|
+
plans: periodPlans,
|
|
22268
23040
|
addOns: availableAddOns,
|
|
22269
|
-
periods: availablePeriods
|
|
23041
|
+
periods: availablePeriods,
|
|
23042
|
+
plansForPeriod
|
|
22270
23043
|
} = useAvailablePlans(planPeriod, {
|
|
22271
23044
|
useSelectedPeriod: showPeriodToggle
|
|
22272
23045
|
});
|
|
22273
|
-
const
|
|
22274
|
-
const
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
23046
|
+
const requestedPlanId = checkoutState?.planId;
|
|
23047
|
+
const bypassPlanSelection = checkoutState?.bypassPlanSelection;
|
|
23048
|
+
const supportsCheckoutCurrency = useCallback8(
|
|
23049
|
+
(plan) => !hasCurrency || planSupportsCurrency(plan, effectiveCurrency) || // A plan the host picks and skips past is kept so the currency/period
|
|
23050
|
+
// mismatch notice can say it is unavailable.
|
|
23051
|
+
!!bypassPlanSelection && plan.id === requestedPlanId,
|
|
23052
|
+
[hasCurrency, effectiveCurrency, bypassPlanSelection, requestedPlanId]
|
|
23053
|
+
);
|
|
23054
|
+
const availablePlans = useMemo16(
|
|
23055
|
+
() => periodPlans.filter(supportsCheckoutCurrency),
|
|
23056
|
+
[periodPlans, supportsCheckoutCurrency]
|
|
23057
|
+
);
|
|
23058
|
+
const [selectedPlanId, setSelectedPlanId] = useState8(
|
|
23059
|
+
void 0
|
|
23060
|
+
);
|
|
23061
|
+
const isTrialing = data?.company?.billingSubscription?.status === "trialing";
|
|
23062
|
+
const findSelectedPlan = useCallback8(
|
|
23063
|
+
(plans) => {
|
|
23064
|
+
if (selectedPlanId) {
|
|
23065
|
+
return plans.find((p2) => p2.id === selectedPlanId);
|
|
23066
|
+
}
|
|
23067
|
+
if (requestedPlanId) {
|
|
23068
|
+
return plans.find((plan) => plan.id === requestedPlanId);
|
|
23069
|
+
}
|
|
23070
|
+
return plans.find(
|
|
23071
|
+
(plan) => plan.current && // A company that could trial its current plan chooses for itself,
|
|
23072
|
+
// unless it is already trialing it.
|
|
23073
|
+
(isTrialing || !plan.isTrialable || !plan.companyCanTrial)
|
|
23074
|
+
);
|
|
23075
|
+
},
|
|
23076
|
+
[requestedPlanId, selectedPlanId, isTrialing]
|
|
23077
|
+
);
|
|
23078
|
+
const selectedPlan = useMemo16(
|
|
23079
|
+
() => findSelectedPlan(availablePlans),
|
|
23080
|
+
[availablePlans, findSelectedPlan]
|
|
23081
|
+
);
|
|
22289
23082
|
const [shouldTrial, setShouldTrial] = useState8(false);
|
|
22290
23083
|
const displayedPlanCreditGrants = useMemo16(
|
|
22291
23084
|
() => getDisplayedPlanCreditGrants(selectedPlan),
|
|
@@ -22651,7 +23444,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22651
23444
|
}, [currencies, selectedPlan, planPeriod]);
|
|
22652
23445
|
const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
|
|
22653
23446
|
const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
|
|
22654
|
-
const currencyPeriodMismatch = hasCurrency && !
|
|
23447
|
+
const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
|
|
22655
23448
|
useEffect3(() => {
|
|
22656
23449
|
if (currencyPeriodMismatch) {
|
|
22657
23450
|
console.error(
|
|
@@ -22703,7 +23496,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22703
23496
|
if (isBypassLoading) {
|
|
22704
23497
|
setIsBypassLoading(false);
|
|
22705
23498
|
}
|
|
22706
|
-
setSelectedPlanId(null);
|
|
22707
23499
|
return;
|
|
22708
23500
|
}
|
|
22709
23501
|
const requestId = ++previewRequestIdRef.current;
|
|
@@ -22942,7 +23734,8 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22942
23734
|
}
|
|
22943
23735
|
const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
|
|
22944
23736
|
setShouldTrial(updatedShouldTrial);
|
|
22945
|
-
|
|
23737
|
+
const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
|
|
23738
|
+
if (updatedWillTrialWithoutPaymentMethod) {
|
|
22946
23739
|
setSelectedAddOnIds(/* @__PURE__ */ new Set());
|
|
22947
23740
|
}
|
|
22948
23741
|
const resolvedCreditBundles = (data?.creditBundles ?? []).map(
|
|
@@ -22955,14 +23748,10 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22955
23748
|
period,
|
|
22956
23749
|
plan,
|
|
22957
23750
|
shouldTrial: updatedShouldTrial,
|
|
22958
|
-
...
|
|
22959
|
-
|
|
22960
|
-
|
|
22961
|
-
|
|
22962
|
-
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
22963
|
-
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22964
|
-
)
|
|
22965
|
-
},
|
|
23751
|
+
...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
|
|
23752
|
+
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23753
|
+
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23754
|
+
),
|
|
22966
23755
|
creditBundles: resolvedCreditBundles
|
|
22967
23756
|
});
|
|
22968
23757
|
},
|
|
@@ -22974,7 +23763,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22974
23763
|
featureUsage,
|
|
22975
23764
|
bundleCounts,
|
|
22976
23765
|
shouldTrial,
|
|
22977
|
-
|
|
23766
|
+
trialPaymentMethodRequired,
|
|
22978
23767
|
handlePreviewCheckout,
|
|
22979
23768
|
checkoutState?.payInAdvanceQuantities
|
|
22980
23769
|
]
|
|
@@ -22985,40 +23774,42 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22985
23774
|
return;
|
|
22986
23775
|
}
|
|
22987
23776
|
setPlanPeriod(period);
|
|
22988
|
-
const
|
|
22989
|
-
|
|
22990
|
-
[...[]]
|
|
22991
|
-
);
|
|
22992
|
-
setUsageBasedEntitlements(
|
|
22993
|
-
(prev2) => updatedUsageBasedEntitlements.map((updated) => {
|
|
22994
|
-
const current = prev2.find(
|
|
22995
|
-
({ featureId }) => featureId === updated.featureId
|
|
22996
|
-
);
|
|
22997
|
-
if (typeof current?.quantity === "number") {
|
|
22998
|
-
return { ...updated, quantity: current.quantity };
|
|
22999
|
-
}
|
|
23000
|
-
return updated;
|
|
23001
|
-
})
|
|
23777
|
+
const plan = findSelectedPlan(
|
|
23778
|
+
plansForPeriod(period).filter(supportsCheckoutCurrency)
|
|
23002
23779
|
);
|
|
23780
|
+
const updatedUsageBasedEntitlements = plan ? (plan.entitlements || []).reduce(
|
|
23781
|
+
createActiveUsageBasedEntitlementsReducer(featureUsage, period),
|
|
23782
|
+
[]
|
|
23783
|
+
).map((updated) => {
|
|
23784
|
+
const current = usageBasedEntitlements.find(
|
|
23785
|
+
({ featureId }) => featureId === updated.featureId
|
|
23786
|
+
);
|
|
23787
|
+
if (typeof current?.quantity === "number") {
|
|
23788
|
+
return { ...updated, quantity: current.quantity };
|
|
23789
|
+
}
|
|
23790
|
+
return updated;
|
|
23791
|
+
}) : usageBasedEntitlements;
|
|
23792
|
+
if (plan) {
|
|
23793
|
+
setUsageBasedEntitlements(updatedUsageBasedEntitlements);
|
|
23794
|
+
}
|
|
23003
23795
|
const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
|
|
23004
23796
|
(addOn) => (addOn.entitlements ?? []).reduce(
|
|
23005
23797
|
createActiveUsageBasedEntitlementsReducer(featureUsage, period),
|
|
23006
23798
|
[]
|
|
23007
23799
|
)
|
|
23008
|
-
)
|
|
23009
|
-
|
|
23010
|
-
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23017
|
-
|
|
23018
|
-
})
|
|
23019
|
-
);
|
|
23800
|
+
).map((updated) => {
|
|
23801
|
+
const current = addOnUsageBasedEntitlements.find(
|
|
23802
|
+
({ featureId }) => featureId === updated.featureId
|
|
23803
|
+
);
|
|
23804
|
+
if (typeof current?.quantity === "number") {
|
|
23805
|
+
return { ...updated, quantity: current.quantity };
|
|
23806
|
+
}
|
|
23807
|
+
return updated;
|
|
23808
|
+
});
|
|
23809
|
+
setAddOnUsageBasedEntitlements(updatedAddOnUsageBasedEntitlements);
|
|
23020
23810
|
handlePreviewCheckout({
|
|
23021
23811
|
period,
|
|
23812
|
+
plan,
|
|
23022
23813
|
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23023
23814
|
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23024
23815
|
),
|
|
@@ -23029,9 +23820,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23029
23820
|
},
|
|
23030
23821
|
[
|
|
23031
23822
|
planPeriod,
|
|
23032
|
-
|
|
23823
|
+
plansForPeriod,
|
|
23824
|
+
findSelectedPlan,
|
|
23825
|
+
supportsCheckoutCurrency,
|
|
23033
23826
|
featureUsage,
|
|
23827
|
+
usageBasedEntitlements,
|
|
23034
23828
|
addOns,
|
|
23829
|
+
addOnUsageBasedEntitlements,
|
|
23035
23830
|
setPlanPeriod,
|
|
23036
23831
|
handlePreviewCheckout
|
|
23037
23832
|
]
|
|
@@ -23175,12 +23970,12 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23175
23970
|
}, [setLayout, clearCheckoutState]);
|
|
23176
23971
|
const hasInitializedPlan = useRef6(false);
|
|
23177
23972
|
useEffect3(() => {
|
|
23178
|
-
if (!hasInitializedPlan.current && selectedPlan) {
|
|
23973
|
+
if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
|
|
23179
23974
|
hasInitializedPlan.current = true;
|
|
23180
|
-
const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
23975
|
+
const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
23181
23976
|
selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
|
|
23182
23977
|
}
|
|
23183
|
-
}, [selectedPlan, planPeriod, selectPlan]);
|
|
23978
|
+
}, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
|
|
23184
23979
|
useLayoutEffect4(() => {
|
|
23185
23980
|
const element = dialogRef.current;
|
|
23186
23981
|
if (layout !== "checkout" || !element) {
|
|
@@ -23428,6 +24223,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23428
24223
|
options: availablePeriods,
|
|
23429
24224
|
selectedOption: planPeriod,
|
|
23430
24225
|
selectedPlan,
|
|
24226
|
+
currency: hasCurrency ? effectiveCurrency : void 0,
|
|
23431
24227
|
onSelect: changePlanPeriod
|
|
23432
24228
|
}
|
|
23433
24229
|
)
|
|
@@ -24239,6 +25035,7 @@ var PeriodToggle = ({
|
|
|
24239
25035
|
options,
|
|
24240
25036
|
selectedOption,
|
|
24241
25037
|
selectedPlan,
|
|
25038
|
+
currency,
|
|
24242
25039
|
onSelect
|
|
24243
25040
|
}) => {
|
|
24244
25041
|
const { t: t3 } = useTranslation();
|
|
@@ -24249,19 +25046,19 @@ var PeriodToggle = ({
|
|
|
24249
25046
|
if (!selectedPlan) {
|
|
24250
25047
|
return result;
|
|
24251
25048
|
}
|
|
24252
|
-
const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
|
|
25049
|
+
const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
|
|
24253
25050
|
if (monthlyPrice <= 0) {
|
|
24254
25051
|
return result;
|
|
24255
25052
|
}
|
|
24256
25053
|
for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
|
|
24257
|
-
const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
|
|
25054
|
+
const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
|
|
24258
25055
|
if (periodPrice > 0) {
|
|
24259
25056
|
const baseline = monthlyPrice * months;
|
|
24260
25057
|
result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
|
|
24261
25058
|
}
|
|
24262
25059
|
}
|
|
24263
25060
|
return result;
|
|
24264
|
-
}, [selectedPlan]);
|
|
25061
|
+
}, [selectedPlan, currency]);
|
|
24265
25062
|
return /* @__PURE__ */ jsx37(
|
|
24266
25063
|
Flex,
|
|
24267
25064
|
{
|
|
@@ -24656,10 +25453,12 @@ var CheckoutStageButton = ({
|
|
|
24656
25453
|
willScheduleDowngrade,
|
|
24657
25454
|
hasIncompleteRequiredCustomFields = false,
|
|
24658
25455
|
isCreditOnlyPurchase = false,
|
|
24659
|
-
isOneTimeOnlyPurchase = false
|
|
25456
|
+
isOneTimeOnlyPurchase = false,
|
|
25457
|
+
isUnchangedTrial = false
|
|
24660
25458
|
}) => {
|
|
24661
25459
|
const { t: t3 } = useTranslation();
|
|
24662
25460
|
const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
|
|
25461
|
+
const isCheckoutDisabled = isDisabled || isUnchangedTrial;
|
|
24663
25462
|
const optInUnmet = optInRequired && !optInAccepted;
|
|
24664
25463
|
const getNextStageId = (currentStageId) => {
|
|
24665
25464
|
if (!checkoutStages) return void 0;
|
|
@@ -24721,7 +25520,7 @@ var CheckoutStageButton = ({
|
|
|
24721
25520
|
return /* @__PURE__ */ jsx42(
|
|
24722
25521
|
NoPaymentRequired,
|
|
24723
25522
|
{
|
|
24724
|
-
isDisabled,
|
|
25523
|
+
isDisabled: isCheckoutDisabled,
|
|
24725
25524
|
isLoading,
|
|
24726
25525
|
onClick: checkout,
|
|
24727
25526
|
isSticky,
|
|
@@ -24756,7 +25555,7 @@ var CheckoutStageButton = ({
|
|
|
24756
25555
|
return /* @__PURE__ */ jsx42(
|
|
24757
25556
|
NoPaymentRequired,
|
|
24758
25557
|
{
|
|
24759
|
-
isDisabled,
|
|
25558
|
+
isDisabled: isCheckoutDisabled,
|
|
24760
25559
|
isLoading,
|
|
24761
25560
|
onClick: checkout,
|
|
24762
25561
|
isSticky,
|
|
@@ -24800,7 +25599,7 @@ var CheckoutStageButton = ({
|
|
|
24800
25599
|
return /* @__PURE__ */ jsx42(
|
|
24801
25600
|
NoPaymentRequired,
|
|
24802
25601
|
{
|
|
24803
|
-
isDisabled,
|
|
25602
|
+
isDisabled: isCheckoutDisabled,
|
|
24804
25603
|
isLoading,
|
|
24805
25604
|
onClick: checkout,
|
|
24806
25605
|
isSticky,
|
|
@@ -24844,7 +25643,7 @@ var CheckoutStageButton = ({
|
|
|
24844
25643
|
return /* @__PURE__ */ jsx42(
|
|
24845
25644
|
NoPaymentRequired,
|
|
24846
25645
|
{
|
|
24847
|
-
isDisabled,
|
|
25646
|
+
isDisabled: isCheckoutDisabled,
|
|
24848
25647
|
isLoading,
|
|
24849
25648
|
onClick: checkout,
|
|
24850
25649
|
isSticky,
|
|
@@ -24887,7 +25686,7 @@ var CheckoutStageButton = ({
|
|
|
24887
25686
|
return /* @__PURE__ */ jsx42(
|
|
24888
25687
|
NoPaymentRequired,
|
|
24889
25688
|
{
|
|
24890
|
-
isDisabled,
|
|
25689
|
+
isDisabled: isCheckoutDisabled,
|
|
24891
25690
|
isLoading,
|
|
24892
25691
|
onClick: checkout,
|
|
24893
25692
|
isSticky,
|
|
@@ -24931,7 +25730,7 @@ var CheckoutStageButton = ({
|
|
|
24931
25730
|
return /* @__PURE__ */ jsx42(
|
|
24932
25731
|
NoPaymentRequired,
|
|
24933
25732
|
{
|
|
24934
|
-
isDisabled,
|
|
25733
|
+
isDisabled: isCheckoutDisabled,
|
|
24935
25734
|
isLoading,
|
|
24936
25735
|
onClick: checkout,
|
|
24937
25736
|
isSticky,
|
|
@@ -24975,7 +25774,7 @@ var CheckoutStageButton = ({
|
|
|
24975
25774
|
/* @__PURE__ */ jsx42(
|
|
24976
25775
|
NoPaymentRequired,
|
|
24977
25776
|
{
|
|
24978
|
-
isDisabled:
|
|
25777
|
+
isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
24979
25778
|
isLoading,
|
|
24980
25779
|
onClick: checkout,
|
|
24981
25780
|
isSticky,
|
|
@@ -24991,7 +25790,7 @@ var CheckoutStageButton = ({
|
|
|
24991
25790
|
Button,
|
|
24992
25791
|
{
|
|
24993
25792
|
type: "button",
|
|
24994
|
-
disabled:
|
|
25793
|
+
disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
24995
25794
|
onClick: checkout,
|
|
24996
25795
|
$fullWidth: true,
|
|
24997
25796
|
$isLoading: isLoading,
|
|
@@ -25473,9 +26272,9 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25473
26272
|
]);
|
|
25474
26273
|
const selectedAddOnsWithPrice = useMemo22(
|
|
25475
26274
|
() => addOns.filter(
|
|
25476
|
-
(addOn) => addOn.isSelected && getPlanPrice(addOn,
|
|
26275
|
+
(addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
|
|
25477
26276
|
),
|
|
25478
|
-
[addOns, currency]
|
|
26277
|
+
[addOns, planPeriod, currency]
|
|
25479
26278
|
);
|
|
25480
26279
|
const selectedOneTimeAddOns = useMemo22(
|
|
25481
26280
|
() => addOns.filter(
|
|
@@ -25485,7 +26284,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25485
26284
|
);
|
|
25486
26285
|
const { removedAddOns, willAddOnsChange } = useMemo22(() => {
|
|
25487
26286
|
const addedAddOns = selectedAddOnsWithPrice.filter(
|
|
25488
|
-
(selected) =>
|
|
26287
|
+
(selected) => !currentAddOns.some((current) => selected.id === current.id)
|
|
25489
26288
|
);
|
|
25490
26289
|
const removedAddOns2 = currentAddOns.filter(
|
|
25491
26290
|
(current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
|
|
@@ -25498,7 +26297,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25498
26297
|
removedAddOns: removedAddOns2,
|
|
25499
26298
|
willAddOnsChange: willAddOnsChange2
|
|
25500
26299
|
};
|
|
25501
|
-
}, [currentAddOns, selectedAddOnsWithPrice
|
|
26300
|
+
}, [currentAddOns, selectedAddOnsWithPrice]);
|
|
25502
26301
|
const addedCreditBundles = useMemo22(
|
|
25503
26302
|
() => creditBundles.filter((bundle) => bundle.count > 0),
|
|
25504
26303
|
[creditBundles]
|
|
@@ -25524,6 +26323,24 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25524
26323
|
selectedOneTimeAddOns.length,
|
|
25525
26324
|
addedCreditBundles.length
|
|
25526
26325
|
]);
|
|
26326
|
+
const isUnchangedTrial = useMemo22(() => {
|
|
26327
|
+
if (billingSubscription?.status !== "trialing" || !selectedPlan?.current) {
|
|
26328
|
+
return false;
|
|
26329
|
+
}
|
|
26330
|
+
const currentPeriod = getSubscriptionPeriod(billingSubscription);
|
|
26331
|
+
if (currentPeriod && currentPeriod !== planPeriod) {
|
|
26332
|
+
return false;
|
|
26333
|
+
}
|
|
26334
|
+
return !willAddOnsChange && updatedUsageBasedEntitlements.changed.length === 0 && selectedOneTimeAddOns.length === 0 && addedCreditBundles.length === 0;
|
|
26335
|
+
}, [
|
|
26336
|
+
selectedPlan,
|
|
26337
|
+
billingSubscription,
|
|
26338
|
+
planPeriod,
|
|
26339
|
+
willAddOnsChange,
|
|
26340
|
+
updatedUsageBasedEntitlements.changed.length,
|
|
26341
|
+
selectedOneTimeAddOns.length,
|
|
26342
|
+
addedCreditBundles.length
|
|
26343
|
+
]);
|
|
25527
26344
|
const discountApplied = useMemo22(
|
|
25528
26345
|
() => promoCode && (amountOff > 0 || percentOff > 0),
|
|
25529
26346
|
[promoCode, amountOff, percentOff]
|
|
@@ -25717,6 +26534,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25717
26534
|
hasIncompleteRequiredCustomFields,
|
|
25718
26535
|
isCreditOnlyPurchase,
|
|
25719
26536
|
isOneTimeOnlyPurchase,
|
|
26537
|
+
isUnchangedTrial,
|
|
25720
26538
|
checkout: handleCheckout
|
|
25721
26539
|
}
|
|
25722
26540
|
);
|
|
@@ -25762,6 +26580,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25762
26580
|
addOnPayInAdvanceEntitlements,
|
|
25763
26581
|
isCreditOnlyPurchase,
|
|
25764
26582
|
isOneTimeOnlyPurchase,
|
|
26583
|
+
isUnchangedTrial,
|
|
25765
26584
|
hasIncompleteRequiredCustomFields
|
|
25766
26585
|
]);
|
|
25767
26586
|
useLayoutEffect6(() => {
|
|
@@ -25796,7 +26615,10 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25796
26615
|
subscriptionPrice,
|
|
25797
26616
|
planPeriod,
|
|
25798
26617
|
periodStart: renewDate,
|
|
25799
|
-
hasUsageBasedCosts:
|
|
26618
|
+
hasUsageBasedCosts: hasMeteredCosts([
|
|
26619
|
+
...usageBasedEntitlements,
|
|
26620
|
+
...addOnUsageBasedEntitlements
|
|
26621
|
+
]),
|
|
25800
26622
|
discount: subscriptionDiscount,
|
|
25801
26623
|
locale
|
|
25802
26624
|
},
|
|
@@ -25808,6 +26630,14 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25808
26630
|
locale
|
|
25809
26631
|
})
|
|
25810
26632
|
}) : billingPreviewText;
|
|
26633
|
+
const currentPriceInterval = getSubscriptionInterval(
|
|
26634
|
+
billingSubscription
|
|
26635
|
+
) ?? { interval: currentPlan?.planPeriod || planPeriod };
|
|
26636
|
+
const currentPriceSuffix = shortenPeriod(
|
|
26637
|
+
currentPriceInterval.interval,
|
|
26638
|
+
t3,
|
|
26639
|
+
currentPriceInterval.intervalCount
|
|
26640
|
+
);
|
|
25811
26641
|
return /* @__PURE__ */ jsxs32(
|
|
25812
26642
|
Flex,
|
|
25813
26643
|
{
|
|
@@ -25876,10 +26706,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25876
26706
|
}),
|
|
25877
26707
|
/* @__PURE__ */ jsxs32("sub", { children: [
|
|
25878
26708
|
"/",
|
|
25879
|
-
|
|
25880
|
-
getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
|
|
25881
|
-
t3
|
|
25882
|
-
)
|
|
26709
|
+
currentPriceSuffix
|
|
25883
26710
|
] })
|
|
25884
26711
|
] }) })
|
|
25885
26712
|
]
|
|
@@ -26089,7 +26916,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26089
26916
|
}),
|
|
26090
26917
|
addOn.planPeriod !== "one-time" && /* @__PURE__ */ jsxs32("sub", { children: [
|
|
26091
26918
|
"/",
|
|
26092
|
-
|
|
26919
|
+
currentPriceSuffix
|
|
26093
26920
|
] })
|
|
26094
26921
|
] }) })
|
|
26095
26922
|
]
|
|
@@ -27403,12 +28230,13 @@ function formatInvoices(invoices, locale, options) {
|
|
|
27403
28230
|
const dateA = a2.dueDate ?? a2.createdAt;
|
|
27404
28231
|
const dateB = b2.dueDate ?? b2.createdAt;
|
|
27405
28232
|
return +dateB - +dateA;
|
|
27406
|
-
}).map(({ amountDue, dueDate, createdAt, url, currency }) => {
|
|
28233
|
+
}).map(({ amountDue, dueDate, createdAt, id, url, currency }) => {
|
|
27407
28234
|
const formatted = formatCurrency(Math.abs(amountDue), {
|
|
27408
28235
|
locale,
|
|
27409
28236
|
currency
|
|
27410
28237
|
});
|
|
27411
28238
|
return {
|
|
28239
|
+
id,
|
|
27412
28240
|
amount: amountDue < 0 ? `(${formatted})` : formatted,
|
|
27413
28241
|
amountDue,
|
|
27414
28242
|
date: toPrettyDate(dueDate ?? createdAt, { locale }),
|
|
@@ -27419,7 +28247,7 @@ function formatInvoices(invoices, locale, options) {
|
|
|
27419
28247
|
var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
27420
28248
|
const props = resolveDesignProps3(rest);
|
|
27421
28249
|
const { t: t3, locale } = useTranslation();
|
|
27422
|
-
const { data, listInvoices, settings } = useEmbed();
|
|
28250
|
+
const { data, getInvoiceLink, listInvoices, settings } = useEmbed();
|
|
27423
28251
|
const [isLoading, setIsLoading] = useState16(false);
|
|
27424
28252
|
const [error, setError] = useState16();
|
|
27425
28253
|
const [rawInvoices, setInvoices] = useState16(
|
|
@@ -27496,7 +28324,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
27496
28324
|
props.header.isVisible && /* @__PURE__ */ jsx54(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx54(Text, { display: props.header.fontStyle, children: t3("Invoices") }) }),
|
|
27497
28325
|
invoices.length > 0 ? /* @__PURE__ */ jsxs39(Fragment20, { children: [
|
|
27498
28326
|
/* @__PURE__ */ jsx54(Flex, { $flexDirection: "column", $gap: "0.5rem", children: visibleInvoices.items.map(
|
|
27499
|
-
({ date, amount, amountDue, url }, index) => {
|
|
28327
|
+
({ id, date, amount, amountDue, url }, index) => {
|
|
27500
28328
|
return /* @__PURE__ */ jsxs39(
|
|
27501
28329
|
Flex,
|
|
27502
28330
|
{
|
|
@@ -27507,11 +28335,18 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
27507
28335
|
Text,
|
|
27508
28336
|
{
|
|
27509
28337
|
display: props.date.fontStyle,
|
|
27510
|
-
...url && {
|
|
28338
|
+
...id && url && {
|
|
27511
28339
|
as: "a",
|
|
27512
28340
|
href: url,
|
|
27513
28341
|
target: "_blank",
|
|
27514
|
-
rel: "noreferrer"
|
|
28342
|
+
rel: "noreferrer",
|
|
28343
|
+
onClick: (event) => {
|
|
28344
|
+
void openInvoiceLink(
|
|
28345
|
+
event,
|
|
28346
|
+
url,
|
|
28347
|
+
async () => (await getInvoiceLink(id))?.data.url
|
|
28348
|
+
);
|
|
28349
|
+
}
|
|
27515
28350
|
},
|
|
27516
28351
|
$color: url ? settings.theme.typography.link.color : settings.theme.typography.text.color,
|
|
27517
28352
|
children: date
|
|
@@ -29246,9 +30081,14 @@ import { forwardRef as forwardRef14, useMemo as useMemo34 } from "react";
|
|
|
29246
30081
|
|
|
29247
30082
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
29248
30083
|
import { jsx as jsx62, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
29249
|
-
var AddOn = ({
|
|
30084
|
+
var AddOn = ({
|
|
30085
|
+
addOn,
|
|
30086
|
+
currency,
|
|
30087
|
+
priceInterval,
|
|
30088
|
+
layout
|
|
30089
|
+
}) => {
|
|
29250
30090
|
const { t: t3, locale } = useTranslation();
|
|
29251
|
-
const
|
|
30091
|
+
const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
|
|
29252
30092
|
return /* @__PURE__ */ jsxs45(
|
|
29253
30093
|
Flex,
|
|
29254
30094
|
{
|
|
@@ -29258,9 +30098,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
29258
30098
|
$gap: "1rem",
|
|
29259
30099
|
children: [
|
|
29260
30100
|
/* @__PURE__ */ jsx62(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
29261
|
-
typeof addOn.planPrice === "number" &&
|
|
30101
|
+
typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ jsxs45(Text, { children: [
|
|
29262
30102
|
formatCurrency(addOn.planPrice, { locale, currency }),
|
|
29263
|
-
/* @__PURE__ */ jsx62("sub", { children:
|
|
30103
|
+
/* @__PURE__ */ jsx62("sub", { children: resolvedInterval.interval === "one-time" ? shortenPeriod(resolvedInterval.interval, t3) : `/${shortenPeriod(
|
|
30104
|
+
resolvedInterval.interval,
|
|
30105
|
+
t3,
|
|
30106
|
+
resolvedInterval.intervalCount
|
|
30107
|
+
)}` })
|
|
29264
30108
|
] })
|
|
29265
30109
|
]
|
|
29266
30110
|
}
|
|
@@ -29561,7 +30405,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29561
30405
|
willSubscriptionCancel,
|
|
29562
30406
|
isTrialSubscription
|
|
29563
30407
|
} = useMemo34(() => {
|
|
29564
|
-
const subscriptionInterval2 =
|
|
30408
|
+
const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
|
|
29565
30409
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
29566
30410
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
29567
30411
|
const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
|
|
@@ -29573,6 +30417,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29573
30417
|
};
|
|
29574
30418
|
}, [billingSubscription]);
|
|
29575
30419
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
30420
|
+
const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
|
|
29576
30421
|
const { isFreePlan, isUsageBasedPlan } = useMemo34(() => {
|
|
29577
30422
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
29578
30423
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
@@ -29731,9 +30576,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29731
30576
|
})
|
|
29732
30577
|
}
|
|
29733
30578
|
),
|
|
29734
|
-
!isFreePlan &&
|
|
30579
|
+
!isFreePlan && currentPriceInterval && /* @__PURE__ */ jsx64(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
|
|
29735
30580
|
"/",
|
|
29736
|
-
shortenPeriod(
|
|
30581
|
+
shortenPeriod(
|
|
30582
|
+
currentPriceInterval.interval,
|
|
30583
|
+
t3,
|
|
30584
|
+
currentPriceInterval.intervalCount
|
|
30585
|
+
)
|
|
29737
30586
|
] }) })
|
|
29738
30587
|
] })
|
|
29739
30588
|
]
|
|
@@ -29753,7 +30602,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29753
30602
|
{
|
|
29754
30603
|
addOn,
|
|
29755
30604
|
currency: subscriptionCurrency,
|
|
29756
|
-
|
|
30605
|
+
priceInterval: currentPriceInterval,
|
|
29757
30606
|
layout: props
|
|
29758
30607
|
},
|
|
29759
30608
|
addOnIndex
|
|
@@ -29812,7 +30661,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29812
30661
|
resolveLicenseQuantity
|
|
29813
30662
|
);
|
|
29814
30663
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
29815
|
-
const
|
|
30664
|
+
const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
|
|
29816
30665
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
29817
30666
|
return /* @__PURE__ */ jsxs47(
|
|
29818
30667
|
Flex,
|
|
@@ -29842,7 +30691,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29842
30691
|
1
|
|
29843
30692
|
)
|
|
29844
30693
|
}),
|
|
29845
|
-
composition.fixedQuantity > 0 &&
|
|
30694
|
+
composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
29846
30695
|
" ",
|
|
29847
30696
|
t3("Plus X credits per period", {
|
|
29848
30697
|
amount: composition.fixedQuantity,
|
|
@@ -29851,8 +30700,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29851
30700
|
locale,
|
|
29852
30701
|
composition.fixedQuantity
|
|
29853
30702
|
),
|
|
29854
|
-
period:
|
|
29855
|
-
|
|
30703
|
+
period: nameInterval(
|
|
30704
|
+
creditInterval.interval,
|
|
30705
|
+
t3,
|
|
30706
|
+
creditInterval.intervalCount
|
|
29856
30707
|
)
|
|
29857
30708
|
})
|
|
29858
30709
|
] })
|
|
@@ -29861,11 +30712,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29861
30712
|
" ",
|
|
29862
30713
|
getFeatureName(group, locale, group.total.value),
|
|
29863
30714
|
" ",
|
|
29864
|
-
|
|
30715
|
+
creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
29865
30716
|
t3("per"),
|
|
29866
30717
|
" ",
|
|
29867
|
-
|
|
29868
|
-
|
|
30718
|
+
nameInterval(
|
|
30719
|
+
creditInterval.interval,
|
|
30720
|
+
t3,
|
|
30721
|
+
creditInterval.intervalCount
|
|
29869
30722
|
)
|
|
29870
30723
|
] })
|
|
29871
30724
|
] }) }),
|
|
@@ -29892,7 +30745,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29892
30745
|
]
|
|
29893
30746
|
}
|
|
29894
30747
|
),
|
|
29895
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" &&
|
|
30748
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ jsx64(
|
|
29896
30749
|
Text,
|
|
29897
30750
|
{
|
|
29898
30751
|
style: { opacity: 0.54 },
|
|
@@ -29913,7 +30766,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29913
30766
|
locale,
|
|
29914
30767
|
resolvedTotal
|
|
29915
30768
|
),
|
|
29916
|
-
period: shortenPeriod(
|
|
30769
|
+
period: shortenPeriod(
|
|
30770
|
+
creditInterval.interval,
|
|
30771
|
+
t3,
|
|
30772
|
+
creditInterval.intervalCount
|
|
30773
|
+
)
|
|
29917
30774
|
}) : t3("X licenses times Y credits", {
|
|
29918
30775
|
quantity: licenseQuantity,
|
|
29919
30776
|
licenseName: getFeatureName(
|
|
@@ -29928,7 +30785,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29928
30785
|
locale,
|
|
29929
30786
|
resolvedTotal
|
|
29930
30787
|
),
|
|
29931
|
-
period: shortenPeriod(
|
|
30788
|
+
period: shortenPeriod(
|
|
30789
|
+
creditInterval.interval,
|
|
30790
|
+
t3,
|
|
30791
|
+
creditInterval.intervalCount
|
|
30792
|
+
)
|
|
29932
30793
|
})
|
|
29933
30794
|
}
|
|
29934
30795
|
)
|
|
@@ -31151,16 +32012,18 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
31151
32012
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
|
|
31152
32013
|
);
|
|
31153
32014
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
31154
|
-
const [
|
|
32015
|
+
const [chosenCurrency, setSelectedCurrency] = useState21(
|
|
31155
32016
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
31156
32017
|
);
|
|
31157
|
-
if (currencies.length > 0 && !currencies.includes(
|
|
32018
|
+
if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
|
|
31158
32019
|
setSelectedCurrency(currencies[0]);
|
|
31159
32020
|
}
|
|
32021
|
+
const lockedCurrency = useSubscriptionCurrency();
|
|
32022
|
+
const selectedCurrency = lockedCurrency ?? chosenCurrency;
|
|
31160
32023
|
const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
|
|
31161
32024
|
const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
|
|
31162
|
-
const showCurrencySelector = currencies.length > 1;
|
|
31163
|
-
const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
|
|
32025
|
+
const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
|
|
32026
|
+
const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
|
|
31164
32027
|
const hasNoUsableCurrency = currencies.length === 0;
|
|
31165
32028
|
const {
|
|
31166
32029
|
plans: allPlans,
|
|
@@ -31259,6 +32122,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
31259
32122
|
options: periods,
|
|
31260
32123
|
selectedOption: selectedPeriod,
|
|
31261
32124
|
selectedPlan: currentPlan,
|
|
32125
|
+
currency: hasCurrency ? selectedCurrency : void 0,
|
|
31262
32126
|
onSelect: (period) => {
|
|
31263
32127
|
if (period !== selectedPeriod) {
|
|
31264
32128
|
setSelectedPeriod(period);
|