@schematichq/schematic-components 2.38.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 +1198 -459
- package/dist/schematic-components-elements.d.ts +169 -0
- package/dist/schematic-components-elements.esm.js +1152 -412
- package/dist/schematic-components.browser.cjs.js +576 -125
- package/dist/schematic-components.browser.esm.js +576 -125
- package/dist/schematic-components.cjs.js +576 -125
- package/dist/schematic-components.d.ts +100 -1
- package/dist/schematic-components.esm.js +576 -125
- package/package.json +12 -12
|
@@ -4746,6 +4746,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
4746
4746
|
quantity: json["quantity"],
|
|
4747
4747
|
subscriptionId: json["subscription_id"],
|
|
4748
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"]),
|
|
4749
4750
|
updatedAt: new Date(json["updated_at"]),
|
|
4750
4751
|
usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
|
|
4751
4752
|
};
|
|
@@ -6223,6 +6224,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
|
|
|
6223
6224
|
};
|
|
6224
6225
|
}
|
|
6225
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
|
+
|
|
6226
6340
|
// src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
|
|
6227
6341
|
function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
|
|
6228
6342
|
return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
|
|
@@ -6456,7 +6570,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
6456
6570
|
fromSubscriptionPrice: json["from_subscription_price"],
|
|
6457
6571
|
id: json["id"],
|
|
6458
6572
|
interval: json["interval"],
|
|
6573
|
+
intervalCount: json["interval_count"],
|
|
6459
6574
|
scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
|
|
6575
|
+
scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
|
|
6460
6576
|
scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
|
|
6461
6577
|
toPlanId: json["to_plan_id"],
|
|
6462
6578
|
toPlanName: json["to_plan_name"]
|
|
@@ -7612,6 +7728,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7612
7728
|
};
|
|
7613
7729
|
}
|
|
7614
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
|
+
|
|
7615
7745
|
// src/api/checkoutexternal/models/RenewalPolicy.ts
|
|
7616
7746
|
function RenewalPolicyFromJSON(json) {
|
|
7617
7747
|
return RenewalPolicyFromJSONTyped(json, false);
|
|
@@ -7637,6 +7767,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7637
7767
|
name: json["name"],
|
|
7638
7768
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
7639
7769
|
planType: PlanTypeFromJSON(json["plan_type"]),
|
|
7770
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
|
|
7640
7771
|
renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
|
|
7641
7772
|
status: PlanVersionStatusFromJSON(json["status"]),
|
|
7642
7773
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -7840,6 +7971,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7840
7971
|
),
|
|
7841
7972
|
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
7842
7973
|
interval: json["interval"],
|
|
7974
|
+
intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
|
|
7843
7975
|
isInitial: json["is_initial"],
|
|
7844
7976
|
latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
|
|
7845
7977
|
pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
|
|
@@ -8673,6 +8805,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
|
|
|
8673
8805
|
};
|
|
8674
8806
|
}
|
|
8675
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
|
+
|
|
8676
8838
|
// src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
|
|
8677
8839
|
function GetCompanyCreditUserUsageParamsFromJSON(json) {
|
|
8678
8840
|
return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
|
|
@@ -9212,6 +9374,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
|
|
|
9212
9374
|
proration: json["proration"],
|
|
9213
9375
|
scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
|
|
9214
9376
|
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
9377
|
+
unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
|
|
9215
9378
|
usageViolations: json["usage_violations"].map(
|
|
9216
9379
|
FeatureUsageResponseDataFromJSON
|
|
9217
9380
|
)
|
|
@@ -10047,6 +10210,55 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10047
10210
|
const response = await this.getCompanyCreditBalancesRaw(initOverrides);
|
|
10048
10211
|
return await response.value();
|
|
10049
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
|
+
}
|
|
10050
10262
|
/**
|
|
10051
10263
|
* Who in the company consumed the credit, and how much each.
|
|
10052
10264
|
* List credit usage by user
|
|
@@ -11523,9 +11735,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
11523
11735
|
|
|
11524
11736
|
// src/api/componentspublic/models/BillingTiersMode.ts
|
|
11525
11737
|
function BillingTiersModeFromJSON2(json) {
|
|
11526
|
-
return
|
|
11738
|
+
return BillingTiersModeFromJSONTyped7(json, false);
|
|
11527
11739
|
}
|
|
11528
|
-
function
|
|
11740
|
+
function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
11529
11741
|
return json;
|
|
11530
11742
|
}
|
|
11531
11743
|
|
|
@@ -11801,9 +12013,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
|
11801
12013
|
|
|
11802
12014
|
// src/api/componentspublic/models/PlanPriceCadence.ts
|
|
11803
12015
|
function PlanPriceCadenceFromJSON2(json) {
|
|
11804
|
-
return
|
|
12016
|
+
return PlanPriceCadenceFromJSONTyped8(json, false);
|
|
11805
12017
|
}
|
|
11806
|
-
function
|
|
12018
|
+
function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
|
|
11807
12019
|
return json;
|
|
11808
12020
|
}
|
|
11809
12021
|
|
|
@@ -12432,6 +12644,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
|
|
|
12432
12644
|
};
|
|
12433
12645
|
}
|
|
12434
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
|
+
|
|
12435
12661
|
// src/api/componentspublic/models/RenewalPolicy.ts
|
|
12436
12662
|
function RenewalPolicyFromJSON2(json) {
|
|
12437
12663
|
return RenewalPolicyFromJSONTyped3(json, false);
|
|
@@ -12457,6 +12683,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
12457
12683
|
name: json["name"],
|
|
12458
12684
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
12459
12685
|
planType: PlanTypeFromJSON2(json["plan_type"]),
|
|
12686
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
|
|
12460
12687
|
renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
|
|
12461
12688
|
status: PlanVersionStatusFromJSON2(json["status"]),
|
|
12462
12689
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -13032,7 +13259,7 @@ function resolveLocale(locale) {
|
|
|
13032
13259
|
return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
|
|
13033
13260
|
}
|
|
13034
13261
|
|
|
13035
|
-
// node_modules/.pnpm/i18next@27.
|
|
13262
|
+
// node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
|
|
13036
13263
|
var isString = (obj) => typeof obj === "string";
|
|
13037
13264
|
var defer = () => {
|
|
13038
13265
|
let res;
|
|
@@ -13628,7 +13855,8 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13628
13855
|
ordinal: false
|
|
13629
13856
|
}) : "";
|
|
13630
13857
|
const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
|
|
13631
|
-
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));
|
|
13632
13860
|
let resForObjHndl = res;
|
|
13633
13861
|
if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
|
|
13634
13862
|
resForObjHndl = defaultValue;
|
|
@@ -13782,7 +14010,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13782
14010
|
const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
13783
14011
|
let nestBef;
|
|
13784
14012
|
if (skipOnVariables) {
|
|
13785
|
-
const nb = res.match(this.interpolator.nestingRegexp);
|
|
14013
|
+
const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
13786
14014
|
nestBef = nb && nb.length;
|
|
13787
14015
|
}
|
|
13788
14016
|
let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
|
|
@@ -13792,7 +14020,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13792
14020
|
};
|
|
13793
14021
|
res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
|
|
13794
14022
|
if (skipOnVariables) {
|
|
13795
|
-
const na = res.match(this.interpolator.nestingRegexp);
|
|
14023
|
+
const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
13796
14024
|
const nestAft = na && na.length;
|
|
13797
14025
|
if (nestBef < nestAft) opt.nest = false;
|
|
13798
14026
|
}
|
|
@@ -13889,6 +14117,15 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13889
14117
|
}
|
|
13890
14118
|
}
|
|
13891
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
|
+
}
|
|
13892
14129
|
}
|
|
13893
14130
|
let possibleKey;
|
|
13894
14131
|
while (possibleKey = finalKeys.pop()) {
|
|
@@ -14091,6 +14328,7 @@ var LanguageUtil = class {
|
|
|
14091
14328
|
if (!codes.includes(formattedFc)) addCode(formattedFc);
|
|
14092
14329
|
});
|
|
14093
14330
|
if (cacheKey !== null) {
|
|
14331
|
+
if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
|
|
14094
14332
|
this.resolveHierarchyCache[cacheKey] = codes;
|
|
14095
14333
|
return codes.slice();
|
|
14096
14334
|
}
|
|
@@ -14145,6 +14383,7 @@ var PluralResolver = class {
|
|
|
14145
14383
|
const lngPart = this.languageUtils.getLanguagePartFromCode(code);
|
|
14146
14384
|
rule = this.getRule(lngPart, options);
|
|
14147
14385
|
}
|
|
14386
|
+
if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
|
|
14148
14387
|
this.pluralRulesCache[cacheKey] = rule;
|
|
14149
14388
|
return rule;
|
|
14150
14389
|
}
|
|
@@ -14213,6 +14452,8 @@ var Interpolator = class {
|
|
|
14213
14452
|
this.formatSeparator = formatSeparator || ",";
|
|
14214
14453
|
this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
|
|
14215
14454
|
this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
|
|
14455
|
+
this.prefixText = prefix2 || "{{";
|
|
14456
|
+
this.nestingPrefixText = nestingPrefix || "$t(";
|
|
14216
14457
|
this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
|
|
14217
14458
|
this.nestingSuffix = regexEscape(nestingSuffix || ")");
|
|
14218
14459
|
this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
|
|
@@ -14265,6 +14506,7 @@ var Interpolator = class {
|
|
|
14265
14506
|
}
|
|
14266
14507
|
const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
14267
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;
|
|
14268
14510
|
const todos = [{
|
|
14269
14511
|
regex: this.regexpUnescape,
|
|
14270
14512
|
safeValue: (val) => val
|
|
@@ -14354,6 +14596,7 @@ var Interpolator = class {
|
|
|
14354
14596
|
if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
|
|
14355
14597
|
return key;
|
|
14356
14598
|
};
|
|
14599
|
+
if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
|
|
14357
14600
|
const nestingRegexp = new RegExp(this.nestingRegexp);
|
|
14358
14601
|
let out = "";
|
|
14359
14602
|
let lastEnd = 0;
|
|
@@ -14421,8 +14664,9 @@ var parseFormatStr = (formatStr) => {
|
|
|
14421
14664
|
formatOptions
|
|
14422
14665
|
};
|
|
14423
14666
|
};
|
|
14667
|
+
var cachedFormattersLimit = 1e3;
|
|
14424
14668
|
var createCachedFormatter = (fn) => {
|
|
14425
|
-
const cache =
|
|
14669
|
+
const cache = /* @__PURE__ */ new Map();
|
|
14426
14670
|
return (v2, l2, o) => {
|
|
14427
14671
|
let optForCache = o;
|
|
14428
14672
|
if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
|
|
@@ -14437,10 +14681,11 @@ var createCachedFormatter = (fn) => {
|
|
|
14437
14681
|
} catch (e) {
|
|
14438
14682
|
return fn(getCleanedCode(l2), o)(v2);
|
|
14439
14683
|
}
|
|
14440
|
-
let frm = cache
|
|
14684
|
+
let frm = cache.get(key);
|
|
14441
14685
|
if (!frm) {
|
|
14442
14686
|
frm = fn(getCleanedCode(l2), o);
|
|
14443
|
-
cache
|
|
14687
|
+
if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
|
|
14688
|
+
cache.set(key, frm);
|
|
14444
14689
|
}
|
|
14445
14690
|
return frm(v2);
|
|
14446
14691
|
};
|
|
@@ -14537,6 +14782,7 @@ var Formatter = class {
|
|
|
14537
14782
|
return result;
|
|
14538
14783
|
}
|
|
14539
14784
|
};
|
|
14785
|
+
var maxFailedLoads = 1e3;
|
|
14540
14786
|
var removePending = (q2, name) => {
|
|
14541
14787
|
if (q2.pending[name] !== void 0) {
|
|
14542
14788
|
delete q2.pending[name];
|
|
@@ -14558,6 +14804,7 @@ var Connector = class extends EventEmitter {
|
|
|
14558
14804
|
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
14559
14805
|
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
14560
14806
|
this.state = {};
|
|
14807
|
+
this.failed = /* @__PURE__ */ new Set();
|
|
14561
14808
|
this.queue = [];
|
|
14562
14809
|
this.backend?.init?.(services, options.backend, options);
|
|
14563
14810
|
this.callbackApi = callbackApiOf(this.backend);
|
|
@@ -14617,6 +14864,15 @@ var Connector = class extends EventEmitter {
|
|
|
14617
14864
|
}
|
|
14618
14865
|
this.state[name] = err ? -1 : 2;
|
|
14619
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
|
+
}
|
|
14620
14876
|
const loaded = {};
|
|
14621
14877
|
this.queue.forEach((q2) => {
|
|
14622
14878
|
pushPath(q2.loaded, [lng], ns);
|
|
@@ -15707,6 +15963,19 @@ var en = {
|
|
|
15707
15963
|
"mo": "mo",
|
|
15708
15964
|
"qtr": "qtr",
|
|
15709
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",
|
|
15710
15979
|
"one time": "one time",
|
|
15711
15980
|
"billing period": "billing period",
|
|
15712
15981
|
"billing period_one": "billing period",
|
|
@@ -15716,6 +15985,7 @@ var en = {
|
|
|
15716
15985
|
"monthly": "monthly",
|
|
15717
15986
|
"quarterly": "quarterly",
|
|
15718
15987
|
"yearly": "yearly",
|
|
15988
|
+
"every period": "every {{period}}",
|
|
15719
15989
|
"expires after purchase": "expires {{amount}} {{unit}} after purchase",
|
|
15720
15990
|
"expires at the end of the billing period": "expires at the end of the billing period",
|
|
15721
15991
|
"expires at the end of the next billing period": "expires at the end of the next billing period",
|
|
@@ -16018,6 +16288,23 @@ var it2 = {
|
|
|
16018
16288
|
"mo": "mese",
|
|
16019
16289
|
"qtr": "trim.",
|
|
16020
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",
|
|
16021
16308
|
"one time": "una tantum",
|
|
16022
16309
|
"billing period": "periodo di fatturazione",
|
|
16023
16310
|
"billing period_one": "periodo di fatturazione",
|
|
@@ -16051,6 +16338,7 @@ var it2 = {
|
|
|
16051
16338
|
"monthly": "mensile",
|
|
16052
16339
|
"quarterly": "trimestrale",
|
|
16053
16340
|
"yearly": "annuale",
|
|
16341
|
+
"every period": "ogni {{period}}",
|
|
16054
16342
|
"Usage by user": "Utilizzo per utente",
|
|
16055
16343
|
"X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
|
|
16056
16344
|
"Show all X users_one": "Mostra {{count, number}} utente",
|
|
@@ -16244,14 +16532,24 @@ function derivePeriod(interval, intervalCount) {
|
|
|
16244
16532
|
}
|
|
16245
16533
|
return interval;
|
|
16246
16534
|
}
|
|
16247
|
-
function
|
|
16535
|
+
function getSubscriptionInterval(billingSubscription) {
|
|
16248
16536
|
if (!billingSubscription) {
|
|
16249
16537
|
return void 0;
|
|
16250
16538
|
}
|
|
16251
16539
|
const product = billingSubscription.products?.find(
|
|
16252
16540
|
(p2) => p2.interval && p2.interval !== "one-time"
|
|
16253
16541
|
);
|
|
16254
|
-
|
|
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
|
+
);
|
|
16255
16553
|
}
|
|
16256
16554
|
function getDefaultPlanPeriod(plans = []) {
|
|
16257
16555
|
if (plans.some((plan) => plan.monthlyPrice)) return "month";
|
|
@@ -16524,6 +16822,8 @@ function getResetCadencePeriod(cadence) {
|
|
|
16524
16822
|
switch (cadence) {
|
|
16525
16823
|
case BillingPlanCreditGrantResetCadence.Yearly:
|
|
16526
16824
|
return "year";
|
|
16825
|
+
case BillingPlanCreditGrantResetCadence.Quarterly:
|
|
16826
|
+
return "quarter";
|
|
16527
16827
|
case BillingPlanCreditGrantResetCadence.Monthly:
|
|
16528
16828
|
return "month";
|
|
16529
16829
|
case BillingPlanCreditGrantResetCadence.Weekly:
|
|
@@ -17013,6 +17313,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
|
|
|
17013
17313
|
function entitlementHasCost(entitlement) {
|
|
17014
17314
|
return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
|
|
17015
17315
|
}
|
|
17316
|
+
function hasMeteredCosts(entitlements) {
|
|
17317
|
+
return entitlements.some(
|
|
17318
|
+
({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
|
|
17319
|
+
);
|
|
17320
|
+
}
|
|
17016
17321
|
function entitlementHasHardLimit(entitlement) {
|
|
17017
17322
|
return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
|
|
17018
17323
|
}
|
|
@@ -17162,8 +17467,38 @@ function getMonthName(date, { locale, ...format }) {
|
|
|
17162
17467
|
...format
|
|
17163
17468
|
}).format(new Date(date));
|
|
17164
17469
|
}
|
|
17165
|
-
|
|
17166
|
-
|
|
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");
|
|
17167
17502
|
case "month":
|
|
17168
17503
|
return t3("mo");
|
|
17169
17504
|
case "quarter":
|
|
@@ -17172,6 +17507,31 @@ function shortenPeriod(period, t3) {
|
|
|
17172
17507
|
return t3("yr");
|
|
17173
17508
|
}
|
|
17174
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
|
+
}
|
|
17175
17535
|
function modifyDate(date, days) {
|
|
17176
17536
|
const copy3 = new Date(date);
|
|
17177
17537
|
copy3.setDate(copy3.getDate() + days);
|
|
@@ -17254,8 +17614,14 @@ function formatCurrency(amount, {
|
|
|
17254
17614
|
function formatOrdinal(n2, t3) {
|
|
17255
17615
|
return t3("Ordinal", { count: n2, ordinal: true });
|
|
17256
17616
|
}
|
|
17257
|
-
function adjectify(period, t3) {
|
|
17258
|
-
|
|
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) {
|
|
17259
17625
|
case "day":
|
|
17260
17626
|
return t3("daily");
|
|
17261
17627
|
case "week":
|
|
@@ -18209,7 +18575,7 @@ var reducer = (state, action) => {
|
|
|
18209
18575
|
// src/context/EmbedProvider.tsx
|
|
18210
18576
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
18211
18577
|
var getCustomHeaders = (sessionId) => ({
|
|
18212
|
-
"X-Schematic-Components-Version": "2.
|
|
18578
|
+
"X-Schematic-Components-Version": "2.39.0",
|
|
18213
18579
|
"X-Schematic-Session-ID": sessionId
|
|
18214
18580
|
});
|
|
18215
18581
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -18936,10 +19302,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
18936
19302
|
return periods;
|
|
18937
19303
|
}, [data?.activePlans, data?.activeAddOns]);
|
|
18938
19304
|
const getActivePlans = useCallback3(
|
|
18939
|
-
(plans) => {
|
|
19305
|
+
(plans, period = activePeriod) => {
|
|
18940
19306
|
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
|
|
18941
19307
|
if (options.useSelectedPeriod) {
|
|
18942
|
-
return
|
|
19308
|
+
return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
18943
19309
|
}
|
|
18944
19310
|
return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
18945
19311
|
});
|
|
@@ -18951,7 +19317,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
18951
19317
|
return {
|
|
18952
19318
|
plans: getActivePlans(data?.activePlans || []),
|
|
18953
19319
|
addOns: getActivePlans(data?.activeAddOns || []),
|
|
18954
|
-
periods: getAvailablePeriods()
|
|
19320
|
+
periods: getAvailablePeriods(),
|
|
19321
|
+
plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
|
|
18955
19322
|
};
|
|
18956
19323
|
}, [
|
|
18957
19324
|
data?.activePlans,
|
|
@@ -22669,28 +23036,49 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22669
23036
|
}
|
|
22670
23037
|
}, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
|
|
22671
23038
|
const {
|
|
22672
|
-
plans:
|
|
23039
|
+
plans: periodPlans,
|
|
22673
23040
|
addOns: availableAddOns,
|
|
22674
|
-
periods: availablePeriods
|
|
23041
|
+
periods: availablePeriods,
|
|
23042
|
+
plansForPeriod
|
|
22675
23043
|
} = useAvailablePlans(planPeriod, {
|
|
22676
23044
|
useSelectedPeriod: showPeriodToggle
|
|
22677
23045
|
});
|
|
22678
|
-
const
|
|
22679
|
-
const
|
|
22680
|
-
|
|
22681
|
-
|
|
22682
|
-
|
|
22683
|
-
|
|
22684
|
-
|
|
22685
|
-
|
|
22686
|
-
|
|
22687
|
-
|
|
22688
|
-
|
|
22689
|
-
|
|
22690
|
-
|
|
22691
|
-
|
|
22692
|
-
|
|
22693
|
-
|
|
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
|
+
);
|
|
22694
23082
|
const [shouldTrial, setShouldTrial] = useState8(false);
|
|
22695
23083
|
const displayedPlanCreditGrants = useMemo16(
|
|
22696
23084
|
() => getDisplayedPlanCreditGrants(selectedPlan),
|
|
@@ -23056,7 +23444,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23056
23444
|
}, [currencies, selectedPlan, planPeriod]);
|
|
23057
23445
|
const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
|
|
23058
23446
|
const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
|
|
23059
|
-
const currencyPeriodMismatch = hasCurrency && !
|
|
23447
|
+
const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
|
|
23060
23448
|
useEffect3(() => {
|
|
23061
23449
|
if (currencyPeriodMismatch) {
|
|
23062
23450
|
console.error(
|
|
@@ -23108,7 +23496,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23108
23496
|
if (isBypassLoading) {
|
|
23109
23497
|
setIsBypassLoading(false);
|
|
23110
23498
|
}
|
|
23111
|
-
setSelectedPlanId(null);
|
|
23112
23499
|
return;
|
|
23113
23500
|
}
|
|
23114
23501
|
const requestId = ++previewRequestIdRef.current;
|
|
@@ -23347,7 +23734,8 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23347
23734
|
}
|
|
23348
23735
|
const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
|
|
23349
23736
|
setShouldTrial(updatedShouldTrial);
|
|
23350
|
-
|
|
23737
|
+
const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
|
|
23738
|
+
if (updatedWillTrialWithoutPaymentMethod) {
|
|
23351
23739
|
setSelectedAddOnIds(/* @__PURE__ */ new Set());
|
|
23352
23740
|
}
|
|
23353
23741
|
const resolvedCreditBundles = (data?.creditBundles ?? []).map(
|
|
@@ -23360,14 +23748,10 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23360
23748
|
period,
|
|
23361
23749
|
plan,
|
|
23362
23750
|
shouldTrial: updatedShouldTrial,
|
|
23363
|
-
...
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23368
|
-
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23369
|
-
)
|
|
23370
|
-
},
|
|
23751
|
+
...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
|
|
23752
|
+
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23753
|
+
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23754
|
+
),
|
|
23371
23755
|
creditBundles: resolvedCreditBundles
|
|
23372
23756
|
});
|
|
23373
23757
|
},
|
|
@@ -23379,7 +23763,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23379
23763
|
featureUsage,
|
|
23380
23764
|
bundleCounts,
|
|
23381
23765
|
shouldTrial,
|
|
23382
|
-
|
|
23766
|
+
trialPaymentMethodRequired,
|
|
23383
23767
|
handlePreviewCheckout,
|
|
23384
23768
|
checkoutState?.payInAdvanceQuantities
|
|
23385
23769
|
]
|
|
@@ -23390,40 +23774,42 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23390
23774
|
return;
|
|
23391
23775
|
}
|
|
23392
23776
|
setPlanPeriod(period);
|
|
23393
|
-
const
|
|
23394
|
-
|
|
23395
|
-
[...[]]
|
|
23396
|
-
);
|
|
23397
|
-
setUsageBasedEntitlements(
|
|
23398
|
-
(prev2) => updatedUsageBasedEntitlements.map((updated) => {
|
|
23399
|
-
const current = prev2.find(
|
|
23400
|
-
({ featureId }) => featureId === updated.featureId
|
|
23401
|
-
);
|
|
23402
|
-
if (typeof current?.quantity === "number") {
|
|
23403
|
-
return { ...updated, quantity: current.quantity };
|
|
23404
|
-
}
|
|
23405
|
-
return updated;
|
|
23406
|
-
})
|
|
23777
|
+
const plan = findSelectedPlan(
|
|
23778
|
+
plansForPeriod(period).filter(supportsCheckoutCurrency)
|
|
23407
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
|
+
}
|
|
23408
23795
|
const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
|
|
23409
23796
|
(addOn) => (addOn.entitlements ?? []).reduce(
|
|
23410
23797
|
createActiveUsageBasedEntitlementsReducer(featureUsage, period),
|
|
23411
23798
|
[]
|
|
23412
23799
|
)
|
|
23413
|
-
)
|
|
23414
|
-
|
|
23415
|
-
|
|
23416
|
-
|
|
23417
|
-
|
|
23418
|
-
|
|
23419
|
-
|
|
23420
|
-
|
|
23421
|
-
|
|
23422
|
-
|
|
23423
|
-
})
|
|
23424
|
-
);
|
|
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);
|
|
23425
23810
|
handlePreviewCheckout({
|
|
23426
23811
|
period,
|
|
23812
|
+
plan,
|
|
23427
23813
|
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23428
23814
|
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23429
23815
|
),
|
|
@@ -23434,9 +23820,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23434
23820
|
},
|
|
23435
23821
|
[
|
|
23436
23822
|
planPeriod,
|
|
23437
|
-
|
|
23823
|
+
plansForPeriod,
|
|
23824
|
+
findSelectedPlan,
|
|
23825
|
+
supportsCheckoutCurrency,
|
|
23438
23826
|
featureUsage,
|
|
23827
|
+
usageBasedEntitlements,
|
|
23439
23828
|
addOns,
|
|
23829
|
+
addOnUsageBasedEntitlements,
|
|
23440
23830
|
setPlanPeriod,
|
|
23441
23831
|
handlePreviewCheckout
|
|
23442
23832
|
]
|
|
@@ -23580,12 +23970,12 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23580
23970
|
}, [setLayout, clearCheckoutState]);
|
|
23581
23971
|
const hasInitializedPlan = useRef6(false);
|
|
23582
23972
|
useEffect3(() => {
|
|
23583
|
-
if (!hasInitializedPlan.current && selectedPlan) {
|
|
23973
|
+
if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
|
|
23584
23974
|
hasInitializedPlan.current = true;
|
|
23585
|
-
const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
23975
|
+
const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
23586
23976
|
selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
|
|
23587
23977
|
}
|
|
23588
|
-
}, [selectedPlan, planPeriod, selectPlan]);
|
|
23978
|
+
}, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
|
|
23589
23979
|
useLayoutEffect4(() => {
|
|
23590
23980
|
const element = dialogRef.current;
|
|
23591
23981
|
if (layout !== "checkout" || !element) {
|
|
@@ -23833,6 +24223,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23833
24223
|
options: availablePeriods,
|
|
23834
24224
|
selectedOption: planPeriod,
|
|
23835
24225
|
selectedPlan,
|
|
24226
|
+
currency: hasCurrency ? effectiveCurrency : void 0,
|
|
23836
24227
|
onSelect: changePlanPeriod
|
|
23837
24228
|
}
|
|
23838
24229
|
)
|
|
@@ -24644,6 +25035,7 @@ var PeriodToggle = ({
|
|
|
24644
25035
|
options,
|
|
24645
25036
|
selectedOption,
|
|
24646
25037
|
selectedPlan,
|
|
25038
|
+
currency,
|
|
24647
25039
|
onSelect
|
|
24648
25040
|
}) => {
|
|
24649
25041
|
const { t: t3 } = useTranslation();
|
|
@@ -24654,19 +25046,19 @@ var PeriodToggle = ({
|
|
|
24654
25046
|
if (!selectedPlan) {
|
|
24655
25047
|
return result;
|
|
24656
25048
|
}
|
|
24657
|
-
const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
|
|
25049
|
+
const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
|
|
24658
25050
|
if (monthlyPrice <= 0) {
|
|
24659
25051
|
return result;
|
|
24660
25052
|
}
|
|
24661
25053
|
for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
|
|
24662
|
-
const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
|
|
25054
|
+
const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
|
|
24663
25055
|
if (periodPrice > 0) {
|
|
24664
25056
|
const baseline = monthlyPrice * months;
|
|
24665
25057
|
result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
|
|
24666
25058
|
}
|
|
24667
25059
|
}
|
|
24668
25060
|
return result;
|
|
24669
|
-
}, [selectedPlan]);
|
|
25061
|
+
}, [selectedPlan, currency]);
|
|
24670
25062
|
return /* @__PURE__ */ jsx37(
|
|
24671
25063
|
Flex,
|
|
24672
25064
|
{
|
|
@@ -25061,10 +25453,12 @@ var CheckoutStageButton = ({
|
|
|
25061
25453
|
willScheduleDowngrade,
|
|
25062
25454
|
hasIncompleteRequiredCustomFields = false,
|
|
25063
25455
|
isCreditOnlyPurchase = false,
|
|
25064
|
-
isOneTimeOnlyPurchase = false
|
|
25456
|
+
isOneTimeOnlyPurchase = false,
|
|
25457
|
+
isUnchangedTrial = false
|
|
25065
25458
|
}) => {
|
|
25066
25459
|
const { t: t3 } = useTranslation();
|
|
25067
25460
|
const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
|
|
25461
|
+
const isCheckoutDisabled = isDisabled || isUnchangedTrial;
|
|
25068
25462
|
const optInUnmet = optInRequired && !optInAccepted;
|
|
25069
25463
|
const getNextStageId = (currentStageId) => {
|
|
25070
25464
|
if (!checkoutStages) return void 0;
|
|
@@ -25126,7 +25520,7 @@ var CheckoutStageButton = ({
|
|
|
25126
25520
|
return /* @__PURE__ */ jsx42(
|
|
25127
25521
|
NoPaymentRequired,
|
|
25128
25522
|
{
|
|
25129
|
-
isDisabled,
|
|
25523
|
+
isDisabled: isCheckoutDisabled,
|
|
25130
25524
|
isLoading,
|
|
25131
25525
|
onClick: checkout,
|
|
25132
25526
|
isSticky,
|
|
@@ -25161,7 +25555,7 @@ var CheckoutStageButton = ({
|
|
|
25161
25555
|
return /* @__PURE__ */ jsx42(
|
|
25162
25556
|
NoPaymentRequired,
|
|
25163
25557
|
{
|
|
25164
|
-
isDisabled,
|
|
25558
|
+
isDisabled: isCheckoutDisabled,
|
|
25165
25559
|
isLoading,
|
|
25166
25560
|
onClick: checkout,
|
|
25167
25561
|
isSticky,
|
|
@@ -25205,7 +25599,7 @@ var CheckoutStageButton = ({
|
|
|
25205
25599
|
return /* @__PURE__ */ jsx42(
|
|
25206
25600
|
NoPaymentRequired,
|
|
25207
25601
|
{
|
|
25208
|
-
isDisabled,
|
|
25602
|
+
isDisabled: isCheckoutDisabled,
|
|
25209
25603
|
isLoading,
|
|
25210
25604
|
onClick: checkout,
|
|
25211
25605
|
isSticky,
|
|
@@ -25249,7 +25643,7 @@ var CheckoutStageButton = ({
|
|
|
25249
25643
|
return /* @__PURE__ */ jsx42(
|
|
25250
25644
|
NoPaymentRequired,
|
|
25251
25645
|
{
|
|
25252
|
-
isDisabled,
|
|
25646
|
+
isDisabled: isCheckoutDisabled,
|
|
25253
25647
|
isLoading,
|
|
25254
25648
|
onClick: checkout,
|
|
25255
25649
|
isSticky,
|
|
@@ -25292,7 +25686,7 @@ var CheckoutStageButton = ({
|
|
|
25292
25686
|
return /* @__PURE__ */ jsx42(
|
|
25293
25687
|
NoPaymentRequired,
|
|
25294
25688
|
{
|
|
25295
|
-
isDisabled,
|
|
25689
|
+
isDisabled: isCheckoutDisabled,
|
|
25296
25690
|
isLoading,
|
|
25297
25691
|
onClick: checkout,
|
|
25298
25692
|
isSticky,
|
|
@@ -25336,7 +25730,7 @@ var CheckoutStageButton = ({
|
|
|
25336
25730
|
return /* @__PURE__ */ jsx42(
|
|
25337
25731
|
NoPaymentRequired,
|
|
25338
25732
|
{
|
|
25339
|
-
isDisabled,
|
|
25733
|
+
isDisabled: isCheckoutDisabled,
|
|
25340
25734
|
isLoading,
|
|
25341
25735
|
onClick: checkout,
|
|
25342
25736
|
isSticky,
|
|
@@ -25380,7 +25774,7 @@ var CheckoutStageButton = ({
|
|
|
25380
25774
|
/* @__PURE__ */ jsx42(
|
|
25381
25775
|
NoPaymentRequired,
|
|
25382
25776
|
{
|
|
25383
|
-
isDisabled:
|
|
25777
|
+
isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
25384
25778
|
isLoading,
|
|
25385
25779
|
onClick: checkout,
|
|
25386
25780
|
isSticky,
|
|
@@ -25396,7 +25790,7 @@ var CheckoutStageButton = ({
|
|
|
25396
25790
|
Button,
|
|
25397
25791
|
{
|
|
25398
25792
|
type: "button",
|
|
25399
|
-
disabled:
|
|
25793
|
+
disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
25400
25794
|
onClick: checkout,
|
|
25401
25795
|
$fullWidth: true,
|
|
25402
25796
|
$isLoading: isLoading,
|
|
@@ -25878,9 +26272,9 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25878
26272
|
]);
|
|
25879
26273
|
const selectedAddOnsWithPrice = useMemo22(
|
|
25880
26274
|
() => addOns.filter(
|
|
25881
|
-
(addOn) => addOn.isSelected && getPlanPrice(addOn,
|
|
26275
|
+
(addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
|
|
25882
26276
|
),
|
|
25883
|
-
[addOns, currency]
|
|
26277
|
+
[addOns, planPeriod, currency]
|
|
25884
26278
|
);
|
|
25885
26279
|
const selectedOneTimeAddOns = useMemo22(
|
|
25886
26280
|
() => addOns.filter(
|
|
@@ -25890,7 +26284,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25890
26284
|
);
|
|
25891
26285
|
const { removedAddOns, willAddOnsChange } = useMemo22(() => {
|
|
25892
26286
|
const addedAddOns = selectedAddOnsWithPrice.filter(
|
|
25893
|
-
(selected) =>
|
|
26287
|
+
(selected) => !currentAddOns.some((current) => selected.id === current.id)
|
|
25894
26288
|
);
|
|
25895
26289
|
const removedAddOns2 = currentAddOns.filter(
|
|
25896
26290
|
(current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
|
|
@@ -25903,7 +26297,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25903
26297
|
removedAddOns: removedAddOns2,
|
|
25904
26298
|
willAddOnsChange: willAddOnsChange2
|
|
25905
26299
|
};
|
|
25906
|
-
}, [currentAddOns, selectedAddOnsWithPrice
|
|
26300
|
+
}, [currentAddOns, selectedAddOnsWithPrice]);
|
|
25907
26301
|
const addedCreditBundles = useMemo22(
|
|
25908
26302
|
() => creditBundles.filter((bundle) => bundle.count > 0),
|
|
25909
26303
|
[creditBundles]
|
|
@@ -25929,6 +26323,24 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
25929
26323
|
selectedOneTimeAddOns.length,
|
|
25930
26324
|
addedCreditBundles.length
|
|
25931
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
|
+
]);
|
|
25932
26344
|
const discountApplied = useMemo22(
|
|
25933
26345
|
() => promoCode && (amountOff > 0 || percentOff > 0),
|
|
25934
26346
|
[promoCode, amountOff, percentOff]
|
|
@@ -26122,6 +26534,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26122
26534
|
hasIncompleteRequiredCustomFields,
|
|
26123
26535
|
isCreditOnlyPurchase,
|
|
26124
26536
|
isOneTimeOnlyPurchase,
|
|
26537
|
+
isUnchangedTrial,
|
|
26125
26538
|
checkout: handleCheckout
|
|
26126
26539
|
}
|
|
26127
26540
|
);
|
|
@@ -26167,6 +26580,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26167
26580
|
addOnPayInAdvanceEntitlements,
|
|
26168
26581
|
isCreditOnlyPurchase,
|
|
26169
26582
|
isOneTimeOnlyPurchase,
|
|
26583
|
+
isUnchangedTrial,
|
|
26170
26584
|
hasIncompleteRequiredCustomFields
|
|
26171
26585
|
]);
|
|
26172
26586
|
useLayoutEffect6(() => {
|
|
@@ -26201,7 +26615,10 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26201
26615
|
subscriptionPrice,
|
|
26202
26616
|
planPeriod,
|
|
26203
26617
|
periodStart: renewDate,
|
|
26204
|
-
hasUsageBasedCosts:
|
|
26618
|
+
hasUsageBasedCosts: hasMeteredCosts([
|
|
26619
|
+
...usageBasedEntitlements,
|
|
26620
|
+
...addOnUsageBasedEntitlements
|
|
26621
|
+
]),
|
|
26205
26622
|
discount: subscriptionDiscount,
|
|
26206
26623
|
locale
|
|
26207
26624
|
},
|
|
@@ -26213,6 +26630,14 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26213
26630
|
locale
|
|
26214
26631
|
})
|
|
26215
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
|
+
);
|
|
26216
26641
|
return /* @__PURE__ */ jsxs32(
|
|
26217
26642
|
Flex,
|
|
26218
26643
|
{
|
|
@@ -26281,10 +26706,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26281
26706
|
}),
|
|
26282
26707
|
/* @__PURE__ */ jsxs32("sub", { children: [
|
|
26283
26708
|
"/",
|
|
26284
|
-
|
|
26285
|
-
getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
|
|
26286
|
-
t3
|
|
26287
|
-
)
|
|
26709
|
+
currentPriceSuffix
|
|
26288
26710
|
] })
|
|
26289
26711
|
] }) })
|
|
26290
26712
|
]
|
|
@@ -26494,7 +26916,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
26494
26916
|
}),
|
|
26495
26917
|
addOn.planPeriod !== "one-time" && /* @__PURE__ */ jsxs32("sub", { children: [
|
|
26496
26918
|
"/",
|
|
26497
|
-
|
|
26919
|
+
currentPriceSuffix
|
|
26498
26920
|
] })
|
|
26499
26921
|
] }) })
|
|
26500
26922
|
]
|
|
@@ -29659,9 +30081,14 @@ import { forwardRef as forwardRef14, useMemo as useMemo34 } from "react";
|
|
|
29659
30081
|
|
|
29660
30082
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
29661
30083
|
import { jsx as jsx62, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
29662
|
-
var AddOn = ({
|
|
30084
|
+
var AddOn = ({
|
|
30085
|
+
addOn,
|
|
30086
|
+
currency,
|
|
30087
|
+
priceInterval,
|
|
30088
|
+
layout
|
|
30089
|
+
}) => {
|
|
29663
30090
|
const { t: t3, locale } = useTranslation();
|
|
29664
|
-
const
|
|
30091
|
+
const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
|
|
29665
30092
|
return /* @__PURE__ */ jsxs45(
|
|
29666
30093
|
Flex,
|
|
29667
30094
|
{
|
|
@@ -29671,9 +30098,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
29671
30098
|
$gap: "1rem",
|
|
29672
30099
|
children: [
|
|
29673
30100
|
/* @__PURE__ */ jsx62(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
29674
|
-
typeof addOn.planPrice === "number" &&
|
|
30101
|
+
typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ jsxs45(Text, { children: [
|
|
29675
30102
|
formatCurrency(addOn.planPrice, { locale, currency }),
|
|
29676
|
-
/* @__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
|
+
)}` })
|
|
29677
30108
|
] })
|
|
29678
30109
|
]
|
|
29679
30110
|
}
|
|
@@ -29974,7 +30405,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29974
30405
|
willSubscriptionCancel,
|
|
29975
30406
|
isTrialSubscription
|
|
29976
30407
|
} = useMemo34(() => {
|
|
29977
|
-
const subscriptionInterval2 =
|
|
30408
|
+
const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
|
|
29978
30409
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
29979
30410
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
29980
30411
|
const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
|
|
@@ -29986,6 +30417,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
29986
30417
|
};
|
|
29987
30418
|
}, [billingSubscription]);
|
|
29988
30419
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
30420
|
+
const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
|
|
29989
30421
|
const { isFreePlan, isUsageBasedPlan } = useMemo34(() => {
|
|
29990
30422
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
29991
30423
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
@@ -30144,9 +30576,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30144
30576
|
})
|
|
30145
30577
|
}
|
|
30146
30578
|
),
|
|
30147
|
-
!isFreePlan &&
|
|
30579
|
+
!isFreePlan && currentPriceInterval && /* @__PURE__ */ jsx64(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
|
|
30148
30580
|
"/",
|
|
30149
|
-
shortenPeriod(
|
|
30581
|
+
shortenPeriod(
|
|
30582
|
+
currentPriceInterval.interval,
|
|
30583
|
+
t3,
|
|
30584
|
+
currentPriceInterval.intervalCount
|
|
30585
|
+
)
|
|
30150
30586
|
] }) })
|
|
30151
30587
|
] })
|
|
30152
30588
|
]
|
|
@@ -30166,7 +30602,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30166
30602
|
{
|
|
30167
30603
|
addOn,
|
|
30168
30604
|
currency: subscriptionCurrency,
|
|
30169
|
-
|
|
30605
|
+
priceInterval: currentPriceInterval,
|
|
30170
30606
|
layout: props
|
|
30171
30607
|
},
|
|
30172
30608
|
addOnIndex
|
|
@@ -30225,7 +30661,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30225
30661
|
resolveLicenseQuantity
|
|
30226
30662
|
);
|
|
30227
30663
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
30228
|
-
const
|
|
30664
|
+
const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
|
|
30229
30665
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
30230
30666
|
return /* @__PURE__ */ jsxs47(
|
|
30231
30667
|
Flex,
|
|
@@ -30255,7 +30691,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30255
30691
|
1
|
|
30256
30692
|
)
|
|
30257
30693
|
}),
|
|
30258
|
-
composition.fixedQuantity > 0 &&
|
|
30694
|
+
composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
30259
30695
|
" ",
|
|
30260
30696
|
t3("Plus X credits per period", {
|
|
30261
30697
|
amount: composition.fixedQuantity,
|
|
@@ -30264,8 +30700,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30264
30700
|
locale,
|
|
30265
30701
|
composition.fixedQuantity
|
|
30266
30702
|
),
|
|
30267
|
-
period:
|
|
30268
|
-
|
|
30703
|
+
period: nameInterval(
|
|
30704
|
+
creditInterval.interval,
|
|
30705
|
+
t3,
|
|
30706
|
+
creditInterval.intervalCount
|
|
30269
30707
|
)
|
|
30270
30708
|
})
|
|
30271
30709
|
] })
|
|
@@ -30274,11 +30712,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30274
30712
|
" ",
|
|
30275
30713
|
getFeatureName(group, locale, group.total.value),
|
|
30276
30714
|
" ",
|
|
30277
|
-
|
|
30715
|
+
creditInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
30278
30716
|
t3("per"),
|
|
30279
30717
|
" ",
|
|
30280
|
-
|
|
30281
|
-
|
|
30718
|
+
nameInterval(
|
|
30719
|
+
creditInterval.interval,
|
|
30720
|
+
t3,
|
|
30721
|
+
creditInterval.intervalCount
|
|
30282
30722
|
)
|
|
30283
30723
|
] })
|
|
30284
30724
|
] }) }),
|
|
@@ -30305,7 +30745,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30305
30745
|
]
|
|
30306
30746
|
}
|
|
30307
30747
|
),
|
|
30308
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" &&
|
|
30748
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ jsx64(
|
|
30309
30749
|
Text,
|
|
30310
30750
|
{
|
|
30311
30751
|
style: { opacity: 0.54 },
|
|
@@ -30326,7 +30766,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30326
30766
|
locale,
|
|
30327
30767
|
resolvedTotal
|
|
30328
30768
|
),
|
|
30329
|
-
period: shortenPeriod(
|
|
30769
|
+
period: shortenPeriod(
|
|
30770
|
+
creditInterval.interval,
|
|
30771
|
+
t3,
|
|
30772
|
+
creditInterval.intervalCount
|
|
30773
|
+
)
|
|
30330
30774
|
}) : t3("X licenses times Y credits", {
|
|
30331
30775
|
quantity: licenseQuantity,
|
|
30332
30776
|
licenseName: getFeatureName(
|
|
@@ -30341,7 +30785,11 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
30341
30785
|
locale,
|
|
30342
30786
|
resolvedTotal
|
|
30343
30787
|
),
|
|
30344
|
-
period: shortenPeriod(
|
|
30788
|
+
period: shortenPeriod(
|
|
30789
|
+
creditInterval.interval,
|
|
30790
|
+
t3,
|
|
30791
|
+
creditInterval.intervalCount
|
|
30792
|
+
)
|
|
30345
30793
|
})
|
|
30346
30794
|
}
|
|
30347
30795
|
)
|
|
@@ -31564,16 +32012,18 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
31564
32012
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
|
|
31565
32013
|
);
|
|
31566
32014
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
31567
|
-
const [
|
|
32015
|
+
const [chosenCurrency, setSelectedCurrency] = useState21(
|
|
31568
32016
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
31569
32017
|
);
|
|
31570
|
-
if (currencies.length > 0 && !currencies.includes(
|
|
32018
|
+
if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
|
|
31571
32019
|
setSelectedCurrency(currencies[0]);
|
|
31572
32020
|
}
|
|
32021
|
+
const lockedCurrency = useSubscriptionCurrency();
|
|
32022
|
+
const selectedCurrency = lockedCurrency ?? chosenCurrency;
|
|
31573
32023
|
const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
|
|
31574
32024
|
const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
|
|
31575
|
-
const showCurrencySelector = currencies.length > 1;
|
|
31576
|
-
const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
|
|
32025
|
+
const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
|
|
32026
|
+
const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
|
|
31577
32027
|
const hasNoUsableCurrency = currencies.length === 0;
|
|
31578
32028
|
const {
|
|
31579
32029
|
plans: allPlans,
|
|
@@ -31672,6 +32122,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
31672
32122
|
options: periods,
|
|
31673
32123
|
selectedOption: selectedPeriod,
|
|
31674
32124
|
selectedPlan: currentPlan,
|
|
32125
|
+
currency: hasCurrency ? selectedCurrency : void 0,
|
|
31675
32126
|
onSelect: (period) => {
|
|
31676
32127
|
if (period !== selectedPeriod) {
|
|
31677
32128
|
setSelectedPeriod(period);
|