@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
|
@@ -5075,6 +5075,7 @@ function BillingProductForSubscriptionResponseDataFromJSONTyped(json, ignoreDisc
|
|
|
5075
5075
|
quantity: json["quantity"],
|
|
5076
5076
|
subscriptionId: json["subscription_id"],
|
|
5077
5077
|
subscriptionItemExternalId: json["subscription_item_external_id"] == null ? void 0 : json["subscription_item_external_id"],
|
|
5078
|
+
tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON(json["tiers_mode"]),
|
|
5078
5079
|
updatedAt: new Date(json["updated_at"]),
|
|
5079
5080
|
usageType: BillingPriceUsageTypeFromJSON(json["usage_type"])
|
|
5080
5081
|
};
|
|
@@ -6552,6 +6553,119 @@ function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminato
|
|
|
6552
6553
|
};
|
|
6553
6554
|
}
|
|
6554
6555
|
|
|
6556
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerBundleResponseData.ts
|
|
6557
|
+
function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
|
|
6558
|
+
return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
|
|
6559
|
+
}
|
|
6560
|
+
function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6561
|
+
if (json == null) {
|
|
6562
|
+
return json;
|
|
6563
|
+
}
|
|
6564
|
+
return {
|
|
6565
|
+
id: json["id"],
|
|
6566
|
+
name: json["name"]
|
|
6567
|
+
};
|
|
6568
|
+
}
|
|
6569
|
+
|
|
6570
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerCreditResponseData.ts
|
|
6571
|
+
function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
|
|
6572
|
+
return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
|
|
6573
|
+
}
|
|
6574
|
+
function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6575
|
+
if (json == null) {
|
|
6576
|
+
return json;
|
|
6577
|
+
}
|
|
6578
|
+
return {
|
|
6579
|
+
id: json["id"],
|
|
6580
|
+
name: json["name"],
|
|
6581
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
6582
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
|
|
6583
|
+
};
|
|
6584
|
+
}
|
|
6585
|
+
|
|
6586
|
+
// src/api/checkoutexternal/models/CreditUsageReason.ts
|
|
6587
|
+
function CreditUsageReasonFromJSON(json) {
|
|
6588
|
+
return CreditUsageReasonFromJSONTyped(json, false);
|
|
6589
|
+
}
|
|
6590
|
+
function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
6591
|
+
return json;
|
|
6592
|
+
}
|
|
6593
|
+
|
|
6594
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerUserResponseData.ts
|
|
6595
|
+
function CompanyCreditLedgerUserResponseDataFromJSON(json) {
|
|
6596
|
+
return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
|
|
6597
|
+
}
|
|
6598
|
+
function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6599
|
+
if (json == null) {
|
|
6600
|
+
return json;
|
|
6601
|
+
}
|
|
6602
|
+
return {
|
|
6603
|
+
id: json["id"],
|
|
6604
|
+
name: json["name"]
|
|
6605
|
+
};
|
|
6606
|
+
}
|
|
6607
|
+
|
|
6608
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerFeatureResponseData.ts
|
|
6609
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
|
|
6610
|
+
return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
|
|
6611
|
+
}
|
|
6612
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6613
|
+
if (json == null) {
|
|
6614
|
+
return json;
|
|
6615
|
+
}
|
|
6616
|
+
return {
|
|
6617
|
+
id: json["id"],
|
|
6618
|
+
name: json["name"]
|
|
6619
|
+
};
|
|
6620
|
+
}
|
|
6621
|
+
|
|
6622
|
+
// src/api/checkoutexternal/models/CreditLedgerEntryKind.ts
|
|
6623
|
+
function CreditLedgerEntryKindFromJSON(json) {
|
|
6624
|
+
return CreditLedgerEntryKindFromJSONTyped(json, false);
|
|
6625
|
+
}
|
|
6626
|
+
function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
|
|
6627
|
+
return json;
|
|
6628
|
+
}
|
|
6629
|
+
|
|
6630
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerEntryResponseData.ts
|
|
6631
|
+
function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
|
|
6632
|
+
return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
|
|
6633
|
+
}
|
|
6634
|
+
function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6635
|
+
if (json == null) {
|
|
6636
|
+
return json;
|
|
6637
|
+
}
|
|
6638
|
+
return {
|
|
6639
|
+
amount: json["amount"],
|
|
6640
|
+
bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
|
|
6641
|
+
credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
|
|
6642
|
+
eventAt: new Date(json["event_at"]),
|
|
6643
|
+
feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
|
|
6644
|
+
grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
|
|
6645
|
+
id: json["id"],
|
|
6646
|
+
kind: CreditLedgerEntryKindFromJSON(json["kind"]),
|
|
6647
|
+
usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
|
|
6648
|
+
user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
|
|
6649
|
+
zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
|
|
6650
|
+
};
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6653
|
+
// src/api/checkoutexternal/models/CompanyCreditLedgerResponseData.ts
|
|
6654
|
+
function CompanyCreditLedgerResponseDataFromJSON(json) {
|
|
6655
|
+
return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
|
|
6656
|
+
}
|
|
6657
|
+
function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6658
|
+
if (json == null) {
|
|
6659
|
+
return json;
|
|
6660
|
+
}
|
|
6661
|
+
return {
|
|
6662
|
+
entries: json["entries"].map(
|
|
6663
|
+
CompanyCreditLedgerEntryResponseDataFromJSON
|
|
6664
|
+
),
|
|
6665
|
+
nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
|
|
6666
|
+
};
|
|
6667
|
+
}
|
|
6668
|
+
|
|
6555
6669
|
// src/api/checkoutexternal/models/CompanyCreditUserUsageRowResponseData.ts
|
|
6556
6670
|
function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
|
|
6557
6671
|
return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
|
|
@@ -6785,7 +6899,9 @@ function ScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
6785
6899
|
fromSubscriptionPrice: json["from_subscription_price"],
|
|
6786
6900
|
id: json["id"],
|
|
6787
6901
|
interval: json["interval"],
|
|
6902
|
+
intervalCount: json["interval_count"],
|
|
6788
6903
|
scheduledInterval: json["scheduled_interval"] == null ? void 0 : json["scheduled_interval"],
|
|
6904
|
+
scheduledIntervalCount: json["scheduled_interval_count"] == null ? void 0 : json["scheduled_interval_count"],
|
|
6789
6905
|
scheduledPrice: json["scheduled_price"] == null ? void 0 : json["scheduled_price"],
|
|
6790
6906
|
toPlanId: json["to_plan_id"],
|
|
6791
6907
|
toPlanName: json["to_plan_name"]
|
|
@@ -7941,6 +8057,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
7941
8057
|
};
|
|
7942
8058
|
}
|
|
7943
8059
|
|
|
8060
|
+
// src/api/checkoutexternal/models/RenewalDestinationResponseData.ts
|
|
8061
|
+
function RenewalDestinationResponseDataFromJSON(json) {
|
|
8062
|
+
return RenewalDestinationResponseDataFromJSONTyped(json, false);
|
|
8063
|
+
}
|
|
8064
|
+
function RenewalDestinationResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8065
|
+
if (json == null) {
|
|
8066
|
+
return json;
|
|
8067
|
+
}
|
|
8068
|
+
return {
|
|
8069
|
+
billingPeriod: PlanPriceCadenceFromJSON(json["billing_period"]),
|
|
8070
|
+
planId: json["plan_id"]
|
|
8071
|
+
};
|
|
8072
|
+
}
|
|
8073
|
+
|
|
7944
8074
|
// src/api/checkoutexternal/models/RenewalPolicy.ts
|
|
7945
8075
|
function RenewalPolicyFromJSON(json) {
|
|
7946
8076
|
return RenewalPolicyFromJSONTyped(json, false);
|
|
@@ -7966,6 +8096,7 @@ function PlanVersionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7966
8096
|
name: json["name"],
|
|
7967
8097
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
7968
8098
|
planType: PlanTypeFromJSON(json["plan_type"]),
|
|
8099
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON(json["renewal_destination"]),
|
|
7969
8100
|
renewalPolicy: RenewalPolicyFromJSON(json["renewal_policy"]),
|
|
7970
8101
|
status: PlanVersionStatusFromJSON(json["status"]),
|
|
7971
8102
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -8169,6 +8300,7 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
8169
8300
|
),
|
|
8170
8301
|
expiredAt: json["expired_at"] == null ? void 0 : new Date(json["expired_at"]),
|
|
8171
8302
|
interval: json["interval"],
|
|
8303
|
+
intervalCount: json["interval_count"] == null ? void 0 : json["interval_count"],
|
|
8172
8304
|
isInitial: json["is_initial"],
|
|
8173
8305
|
latestInvoice: json["latest_invoice"] == null ? void 0 : InvoiceResponseDataFromJSON(json["latest_invoice"]),
|
|
8174
8306
|
pauseBehavior: json["pause_behavior"] == null ? void 0 : BillingSubscriptionPauseBehaviorFromJSON(json["pause_behavior"]),
|
|
@@ -9002,6 +9134,36 @@ function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator
|
|
|
9002
9134
|
};
|
|
9003
9135
|
}
|
|
9004
9136
|
|
|
9137
|
+
// src/api/checkoutexternal/models/GetCompanyCreditLedgerParams.ts
|
|
9138
|
+
function GetCompanyCreditLedgerParamsFromJSON(json) {
|
|
9139
|
+
return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
|
|
9140
|
+
}
|
|
9141
|
+
function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
9142
|
+
if (json == null) {
|
|
9143
|
+
return json;
|
|
9144
|
+
}
|
|
9145
|
+
return {
|
|
9146
|
+
creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
|
|
9147
|
+
cursor: json["cursor"] == null ? void 0 : json["cursor"],
|
|
9148
|
+
includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
|
|
9149
|
+
limit: json["limit"] == null ? void 0 : json["limit"]
|
|
9150
|
+
};
|
|
9151
|
+
}
|
|
9152
|
+
|
|
9153
|
+
// src/api/checkoutexternal/models/GetCompanyCreditLedgerResponse.ts
|
|
9154
|
+
function GetCompanyCreditLedgerResponseFromJSON(json) {
|
|
9155
|
+
return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
|
|
9156
|
+
}
|
|
9157
|
+
function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
9158
|
+
if (json == null) {
|
|
9159
|
+
return json;
|
|
9160
|
+
}
|
|
9161
|
+
return {
|
|
9162
|
+
data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
|
|
9163
|
+
params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
|
|
9164
|
+
};
|
|
9165
|
+
}
|
|
9166
|
+
|
|
9005
9167
|
// src/api/checkoutexternal/models/GetCompanyCreditUserUsageParams.ts
|
|
9006
9168
|
function GetCompanyCreditUserUsageParamsFromJSON(json) {
|
|
9007
9169
|
return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
|
|
@@ -9541,6 +9703,7 @@ function PreviewSubscriptionChangeResponseDataFromJSONTyped(json, ignoreDiscrimi
|
|
|
9541
9703
|
proration: json["proration"],
|
|
9542
9704
|
scheduledChangeTime: json["scheduled_change_time"] == null ? void 0 : new Date(json["scheduled_change_time"]),
|
|
9543
9705
|
trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"]),
|
|
9706
|
+
unbilledUsageFeatureIds: json["unbilled_usage_feature_ids"],
|
|
9544
9707
|
usageViolations: json["usage_violations"].map(
|
|
9545
9708
|
FeatureUsageResponseDataFromJSON
|
|
9546
9709
|
)
|
|
@@ -10376,6 +10539,55 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10376
10539
|
const response = await this.getCompanyCreditBalancesRaw(initOverrides);
|
|
10377
10540
|
return await response.value();
|
|
10378
10541
|
}
|
|
10542
|
+
/**
|
|
10543
|
+
* 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.
|
|
10544
|
+
* List credit activity
|
|
10545
|
+
*/
|
|
10546
|
+
async getCompanyCreditLedgerRaw(requestParameters, initOverrides) {
|
|
10547
|
+
const queryParameters = {};
|
|
10548
|
+
if (requestParameters["creditIds"] != null) {
|
|
10549
|
+
queryParameters["credit_ids"] = requestParameters["creditIds"];
|
|
10550
|
+
}
|
|
10551
|
+
if (requestParameters["cursor"] != null) {
|
|
10552
|
+
queryParameters["cursor"] = requestParameters["cursor"];
|
|
10553
|
+
}
|
|
10554
|
+
if (requestParameters["includeGrants"] != null) {
|
|
10555
|
+
queryParameters["include_grants"] = requestParameters["includeGrants"];
|
|
10556
|
+
}
|
|
10557
|
+
if (requestParameters["limit"] != null) {
|
|
10558
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
10559
|
+
}
|
|
10560
|
+
const headerParameters = {};
|
|
10561
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
10562
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
10563
|
+
"X-Schematic-Api-Key"
|
|
10564
|
+
);
|
|
10565
|
+
}
|
|
10566
|
+
const response = await this.request(
|
|
10567
|
+
{
|
|
10568
|
+
path: `/company/credits/ledger`,
|
|
10569
|
+
method: "GET",
|
|
10570
|
+
headers: headerParameters,
|
|
10571
|
+
query: queryParameters
|
|
10572
|
+
},
|
|
10573
|
+
initOverrides
|
|
10574
|
+
);
|
|
10575
|
+
return new JSONApiResponse(
|
|
10576
|
+
response,
|
|
10577
|
+
(jsonValue) => GetCompanyCreditLedgerResponseFromJSON(jsonValue)
|
|
10578
|
+
);
|
|
10579
|
+
}
|
|
10580
|
+
/**
|
|
10581
|
+
* 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.
|
|
10582
|
+
* List credit activity
|
|
10583
|
+
*/
|
|
10584
|
+
async getCompanyCreditLedger(requestParameters = {}, initOverrides) {
|
|
10585
|
+
const response = await this.getCompanyCreditLedgerRaw(
|
|
10586
|
+
requestParameters,
|
|
10587
|
+
initOverrides
|
|
10588
|
+
);
|
|
10589
|
+
return await response.value();
|
|
10590
|
+
}
|
|
10379
10591
|
/**
|
|
10380
10592
|
* Who in the company consumed the credit, and how much each.
|
|
10381
10593
|
* List credit usage by user
|
|
@@ -11852,9 +12064,9 @@ function BillingPriceUsageTypeFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
11852
12064
|
|
|
11853
12065
|
// src/api/componentspublic/models/BillingTiersMode.ts
|
|
11854
12066
|
function BillingTiersModeFromJSON2(json) {
|
|
11855
|
-
return
|
|
12067
|
+
return BillingTiersModeFromJSONTyped7(json, false);
|
|
11856
12068
|
}
|
|
11857
|
-
function
|
|
12069
|
+
function BillingTiersModeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
11858
12070
|
return json;
|
|
11859
12071
|
}
|
|
11860
12072
|
|
|
@@ -12130,9 +12342,9 @@ function ChargeTypeFromJSONTyped7(json, ignoreDiscriminator) {
|
|
|
12130
12342
|
|
|
12131
12343
|
// src/api/componentspublic/models/PlanPriceCadence.ts
|
|
12132
12344
|
function PlanPriceCadenceFromJSON2(json) {
|
|
12133
|
-
return
|
|
12345
|
+
return PlanPriceCadenceFromJSONTyped8(json, false);
|
|
12134
12346
|
}
|
|
12135
|
-
function
|
|
12347
|
+
function PlanPriceCadenceFromJSONTyped8(json, ignoreDiscriminator) {
|
|
12136
12348
|
return json;
|
|
12137
12349
|
}
|
|
12138
12350
|
|
|
@@ -12761,6 +12973,20 @@ function PlanCurrencyPricesResponseDataFromJSONTyped5(json, ignoreDiscriminator)
|
|
|
12761
12973
|
};
|
|
12762
12974
|
}
|
|
12763
12975
|
|
|
12976
|
+
// src/api/componentspublic/models/RenewalDestinationResponseData.ts
|
|
12977
|
+
function RenewalDestinationResponseDataFromJSON2(json) {
|
|
12978
|
+
return RenewalDestinationResponseDataFromJSONTyped3(json, false);
|
|
12979
|
+
}
|
|
12980
|
+
function RenewalDestinationResponseDataFromJSONTyped3(json, ignoreDiscriminator) {
|
|
12981
|
+
if (json == null) {
|
|
12982
|
+
return json;
|
|
12983
|
+
}
|
|
12984
|
+
return {
|
|
12985
|
+
billingPeriod: PlanPriceCadenceFromJSON2(json["billing_period"]),
|
|
12986
|
+
planId: json["plan_id"]
|
|
12987
|
+
};
|
|
12988
|
+
}
|
|
12989
|
+
|
|
12764
12990
|
// src/api/componentspublic/models/RenewalPolicy.ts
|
|
12765
12991
|
function RenewalPolicyFromJSON2(json) {
|
|
12766
12992
|
return RenewalPolicyFromJSONTyped3(json, false);
|
|
@@ -12786,6 +13012,7 @@ function PlanVersionResponseDataFromJSONTyped5(json, ignoreDiscriminator) {
|
|
|
12786
13012
|
name: json["name"],
|
|
12787
13013
|
originalPlanId: json["original_plan_id"] == null ? void 0 : json["original_plan_id"],
|
|
12788
13014
|
planType: PlanTypeFromJSON2(json["plan_type"]),
|
|
13015
|
+
renewalDestination: json["renewal_destination"] == null ? void 0 : RenewalDestinationResponseDataFromJSON2(json["renewal_destination"]),
|
|
12789
13016
|
renewalPolicy: RenewalPolicyFromJSON2(json["renewal_policy"]),
|
|
12790
13017
|
status: PlanVersionStatusFromJSON2(json["status"]),
|
|
12791
13018
|
updatedAt: new Date(json["updated_at"]),
|
|
@@ -13354,7 +13581,7 @@ function resolveLocale(locale) {
|
|
|
13354
13581
|
return locale !== void 0 && locale !== "" && isUsableLocale(locale) ? locale : DEFAULT_LOCALE;
|
|
13355
13582
|
}
|
|
13356
13583
|
|
|
13357
|
-
// node_modules/.pnpm/i18next@27.
|
|
13584
|
+
// node_modules/.pnpm/i18next@27.1.2_typescript@6.0.3/node_modules/i18next/dist/esm/i18next.js
|
|
13358
13585
|
var isString = (obj) => typeof obj === "string";
|
|
13359
13586
|
var defer = () => {
|
|
13360
13587
|
let res;
|
|
@@ -13950,7 +14177,8 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
13950
14177
|
ordinal: false
|
|
13951
14178
|
}) : "";
|
|
13952
14179
|
const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
|
|
13953
|
-
const
|
|
14180
|
+
const sep = this.options.pluralSeparator;
|
|
14181
|
+
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));
|
|
13954
14182
|
let resForObjHndl = res;
|
|
13955
14183
|
if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
|
|
13956
14184
|
resForObjHndl = defaultValue;
|
|
@@ -14104,7 +14332,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
14104
14332
|
const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
|
|
14105
14333
|
let nestBef;
|
|
14106
14334
|
if (skipOnVariables) {
|
|
14107
|
-
const nb = res.match(this.interpolator.nestingRegexp);
|
|
14335
|
+
const nb = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
14108
14336
|
nestBef = nb && nb.length;
|
|
14109
14337
|
}
|
|
14110
14338
|
let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
|
|
@@ -14114,7 +14342,7 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
14114
14342
|
};
|
|
14115
14343
|
res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
|
|
14116
14344
|
if (skipOnVariables) {
|
|
14117
|
-
const na = res.match(this.interpolator.nestingRegexp);
|
|
14345
|
+
const na = res.includes(this.interpolator.nestingPrefixText) ? res.match(this.interpolator.nestingRegexp) : null;
|
|
14118
14346
|
const nestAft = na && na.length;
|
|
14119
14347
|
if (nestBef < nestAft) opt.nest = false;
|
|
14120
14348
|
}
|
|
@@ -14211,6 +14439,15 @@ var Translator = class _Translator extends EventEmitter {
|
|
|
14211
14439
|
}
|
|
14212
14440
|
}
|
|
14213
14441
|
}
|
|
14442
|
+
if (needsPluralHandling) {
|
|
14443
|
+
const otherSuffix = `${opt.ordinal ? ordinalPrefix : this.options.pluralSeparator}other`;
|
|
14444
|
+
if (pluralSuffix !== otherSuffix) {
|
|
14445
|
+
if (needsContextHandling) {
|
|
14446
|
+
finalKeys.unshift(`${key}${this.options.contextSeparator || "_"}${opt.context}${otherSuffix}`);
|
|
14447
|
+
}
|
|
14448
|
+
finalKeys.unshift(key + otherSuffix);
|
|
14449
|
+
}
|
|
14450
|
+
}
|
|
14214
14451
|
}
|
|
14215
14452
|
let possibleKey;
|
|
14216
14453
|
while (possibleKey = finalKeys.pop()) {
|
|
@@ -14413,6 +14650,7 @@ var LanguageUtil = class {
|
|
|
14413
14650
|
if (!codes.includes(formattedFc)) addCode(formattedFc);
|
|
14414
14651
|
});
|
|
14415
14652
|
if (cacheKey !== null) {
|
|
14653
|
+
if (Object.keys(this.resolveHierarchyCache).length >= 1e3) this.resolveHierarchyCache = {};
|
|
14416
14654
|
this.resolveHierarchyCache[cacheKey] = codes;
|
|
14417
14655
|
return codes.slice();
|
|
14418
14656
|
}
|
|
@@ -14467,6 +14705,7 @@ var PluralResolver = class {
|
|
|
14467
14705
|
const lngPart = this.languageUtils.getLanguagePartFromCode(code);
|
|
14468
14706
|
rule = this.getRule(lngPart, options);
|
|
14469
14707
|
}
|
|
14708
|
+
if (Object.keys(this.pluralRulesCache).length >= 1e3) this.pluralRulesCache = {};
|
|
14470
14709
|
this.pluralRulesCache[cacheKey] = rule;
|
|
14471
14710
|
return rule;
|
|
14472
14711
|
}
|
|
@@ -14535,6 +14774,8 @@ var Interpolator = class {
|
|
|
14535
14774
|
this.formatSeparator = formatSeparator || ",";
|
|
14536
14775
|
this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix ? regexEscape(unescapePrefix) : "-";
|
|
14537
14776
|
this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix ? regexEscape(unescapeSuffix) : "";
|
|
14777
|
+
this.prefixText = prefix || "{{";
|
|
14778
|
+
this.nestingPrefixText = nestingPrefix || "$t(";
|
|
14538
14779
|
this.nestingPrefix = regexEscape(nestingPrefix || "$t(");
|
|
14539
14780
|
this.nestingSuffix = regexEscape(nestingSuffix || ")");
|
|
14540
14781
|
this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
|
|
@@ -14587,6 +14828,7 @@ var Interpolator = class {
|
|
|
14587
14828
|
}
|
|
14588
14829
|
const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
|
|
14589
14830
|
const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
14831
|
+
if (isString(str) && !str.includes(this.prefixText)) return str;
|
|
14590
14832
|
const todos = [{
|
|
14591
14833
|
regex: this.regexpUnescape,
|
|
14592
14834
|
safeValue: (val) => val
|
|
@@ -14676,6 +14918,7 @@ var Interpolator = class {
|
|
|
14676
14918
|
if (clonedOptions.defaultValue && clonedOptions.defaultValue.includes(this.prefix)) delete clonedOptions.defaultValue;
|
|
14677
14919
|
return key;
|
|
14678
14920
|
};
|
|
14921
|
+
if (isString(str) && !str.includes(this.nestingPrefixText)) return str;
|
|
14679
14922
|
const nestingRegexp = new RegExp(this.nestingRegexp);
|
|
14680
14923
|
let out = "";
|
|
14681
14924
|
let lastEnd = 0;
|
|
@@ -14743,8 +14986,9 @@ var parseFormatStr = (formatStr) => {
|
|
|
14743
14986
|
formatOptions
|
|
14744
14987
|
};
|
|
14745
14988
|
};
|
|
14989
|
+
var cachedFormattersLimit = 1e3;
|
|
14746
14990
|
var createCachedFormatter = (fn) => {
|
|
14747
|
-
const cache =
|
|
14991
|
+
const cache = /* @__PURE__ */ new Map();
|
|
14748
14992
|
return (v, l, o) => {
|
|
14749
14993
|
let optForCache = o;
|
|
14750
14994
|
if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
|
|
@@ -14759,10 +15003,11 @@ var createCachedFormatter = (fn) => {
|
|
|
14759
15003
|
} catch (e) {
|
|
14760
15004
|
return fn(getCleanedCode(l), o)(v);
|
|
14761
15005
|
}
|
|
14762
|
-
let frm = cache
|
|
15006
|
+
let frm = cache.get(key);
|
|
14763
15007
|
if (!frm) {
|
|
14764
15008
|
frm = fn(getCleanedCode(l), o);
|
|
14765
|
-
cache
|
|
15009
|
+
if (cache.size >= cachedFormattersLimit) cache.delete(cache.keys().next().value);
|
|
15010
|
+
cache.set(key, frm);
|
|
14766
15011
|
}
|
|
14767
15012
|
return frm(v);
|
|
14768
15013
|
};
|
|
@@ -14859,6 +15104,7 @@ var Formatter = class {
|
|
|
14859
15104
|
return result;
|
|
14860
15105
|
}
|
|
14861
15106
|
};
|
|
15107
|
+
var maxFailedLoads = 1e3;
|
|
14862
15108
|
var removePending = (q, name) => {
|
|
14863
15109
|
if (q.pending[name] !== void 0) {
|
|
14864
15110
|
delete q.pending[name];
|
|
@@ -14880,6 +15126,7 @@ var Connector = class extends EventEmitter {
|
|
|
14880
15126
|
this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
|
|
14881
15127
|
this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
|
|
14882
15128
|
this.state = {};
|
|
15129
|
+
this.failed = /* @__PURE__ */ new Set();
|
|
14883
15130
|
this.queue = [];
|
|
14884
15131
|
this.backend?.init?.(services, options.backend, options);
|
|
14885
15132
|
this.callbackApi = callbackApiOf(this.backend);
|
|
@@ -14939,6 +15186,15 @@ var Connector = class extends EventEmitter {
|
|
|
14939
15186
|
}
|
|
14940
15187
|
this.state[name] = err ? -1 : 2;
|
|
14941
15188
|
if (err && data) this.state[name] = 0;
|
|
15189
|
+
this.failed.delete(name);
|
|
15190
|
+
if (err) {
|
|
15191
|
+
this.failed.add(name);
|
|
15192
|
+
if (this.failed.size > maxFailedLoads) {
|
|
15193
|
+
const oldest = this.failed.values().next().value;
|
|
15194
|
+
this.failed.delete(oldest);
|
|
15195
|
+
if (this.state[oldest] < 1) delete this.state[oldest];
|
|
15196
|
+
}
|
|
15197
|
+
}
|
|
14942
15198
|
const loaded = {};
|
|
14943
15199
|
this.queue.forEach((q) => {
|
|
14944
15200
|
pushPath(q.loaded, [lng], ns);
|
|
@@ -16029,6 +16285,19 @@ var en = {
|
|
|
16029
16285
|
"mo": "mo",
|
|
16030
16286
|
"qtr": "qtr",
|
|
16031
16287
|
"yr": "yr",
|
|
16288
|
+
"wk": "wk",
|
|
16289
|
+
"X days short": "{{amount, number}}d",
|
|
16290
|
+
"X weeks short": "{{amount, number}}wk",
|
|
16291
|
+
"X months short": "{{amount, number}}mo",
|
|
16292
|
+
"X years short": "{{amount, number}}yr",
|
|
16293
|
+
"X days_one": "{{count, number}} day",
|
|
16294
|
+
"X days_other": "{{count, number}} days",
|
|
16295
|
+
"X weeks_one": "{{count, number}} week",
|
|
16296
|
+
"X weeks_other": "{{count, number}} weeks",
|
|
16297
|
+
"X months_one": "{{count, number}} month",
|
|
16298
|
+
"X months_other": "{{count, number}} months",
|
|
16299
|
+
"X years_one": "{{count, number}} year",
|
|
16300
|
+
"X years_other": "{{count, number}} years",
|
|
16032
16301
|
"one time": "one time",
|
|
16033
16302
|
"billing period": "billing period",
|
|
16034
16303
|
"billing period_one": "billing period",
|
|
@@ -16038,6 +16307,7 @@ var en = {
|
|
|
16038
16307
|
"monthly": "monthly",
|
|
16039
16308
|
"quarterly": "quarterly",
|
|
16040
16309
|
"yearly": "yearly",
|
|
16310
|
+
"every period": "every {{period}}",
|
|
16041
16311
|
"expires after purchase": "expires {{amount}} {{unit}} after purchase",
|
|
16042
16312
|
"expires at the end of the billing period": "expires at the end of the billing period",
|
|
16043
16313
|
"expires at the end of the next billing period": "expires at the end of the next billing period",
|
|
@@ -16340,6 +16610,23 @@ var it = {
|
|
|
16340
16610
|
"mo": "mese",
|
|
16341
16611
|
"qtr": "trim.",
|
|
16342
16612
|
"yr": "anno",
|
|
16613
|
+
"wk": "sett.",
|
|
16614
|
+
"X days short": "{{amount, number}} gg",
|
|
16615
|
+
"X weeks short": "{{amount, number}} sett.",
|
|
16616
|
+
"X months short": "{{amount, number}} mesi",
|
|
16617
|
+
"X years short": "{{amount, number}} anni",
|
|
16618
|
+
"X days_one": "{{count, number}} giorno",
|
|
16619
|
+
"X days_many": "{{count, number}} giorni",
|
|
16620
|
+
"X days_other": "{{count, number}} giorni",
|
|
16621
|
+
"X weeks_one": "{{count, number}} settimana",
|
|
16622
|
+
"X weeks_many": "{{count, number}} settimane",
|
|
16623
|
+
"X weeks_other": "{{count, number}} settimane",
|
|
16624
|
+
"X months_one": "{{count, number}} mese",
|
|
16625
|
+
"X months_many": "{{count, number}} mesi",
|
|
16626
|
+
"X months_other": "{{count, number}} mesi",
|
|
16627
|
+
"X years_one": "{{count, number}} anno",
|
|
16628
|
+
"X years_many": "{{count, number}} anni",
|
|
16629
|
+
"X years_other": "{{count, number}} anni",
|
|
16343
16630
|
"one time": "una tantum",
|
|
16344
16631
|
"billing period": "periodo di fatturazione",
|
|
16345
16632
|
"billing period_one": "periodo di fatturazione",
|
|
@@ -16373,6 +16660,7 @@ var it = {
|
|
|
16373
16660
|
"monthly": "mensile",
|
|
16374
16661
|
"quarterly": "trimestrale",
|
|
16375
16662
|
"yearly": "annuale",
|
|
16663
|
+
"every period": "ogni {{period}}",
|
|
16376
16664
|
"Usage by user": "Utilizzo per utente",
|
|
16377
16665
|
"X used by your team this period": "{{amount}} utilizzati dal tuo team in questo periodo",
|
|
16378
16666
|
"Show all X users_one": "Mostra {{count, number}} utente",
|
|
@@ -16566,14 +16854,24 @@ function derivePeriod(interval, intervalCount) {
|
|
|
16566
16854
|
}
|
|
16567
16855
|
return interval;
|
|
16568
16856
|
}
|
|
16569
|
-
function
|
|
16857
|
+
function getSubscriptionInterval(billingSubscription) {
|
|
16570
16858
|
if (!billingSubscription) {
|
|
16571
16859
|
return void 0;
|
|
16572
16860
|
}
|
|
16573
16861
|
const product = billingSubscription.products?.find(
|
|
16574
16862
|
(p) => p.interval && p.interval !== "one-time"
|
|
16575
16863
|
);
|
|
16576
|
-
|
|
16864
|
+
if (product?.interval) {
|
|
16865
|
+
return { interval: product.interval, intervalCount: product.intervalCount };
|
|
16866
|
+
}
|
|
16867
|
+
return billingSubscription.interval ? { interval: billingSubscription.interval } : void 0;
|
|
16868
|
+
}
|
|
16869
|
+
function getSubscriptionPeriod(billingSubscription) {
|
|
16870
|
+
const subscriptionInterval = getSubscriptionInterval(billingSubscription);
|
|
16871
|
+
return derivePeriod(
|
|
16872
|
+
subscriptionInterval?.interval,
|
|
16873
|
+
subscriptionInterval?.intervalCount
|
|
16874
|
+
);
|
|
16577
16875
|
}
|
|
16578
16876
|
function getDefaultPlanPeriod(plans = []) {
|
|
16579
16877
|
if (plans.some((plan) => plan.monthlyPrice)) return "month";
|
|
@@ -16846,6 +17144,8 @@ function getResetCadencePeriod(cadence) {
|
|
|
16846
17144
|
switch (cadence) {
|
|
16847
17145
|
case BillingPlanCreditGrantResetCadence.Yearly:
|
|
16848
17146
|
return "year";
|
|
17147
|
+
case BillingPlanCreditGrantResetCadence.Quarterly:
|
|
17148
|
+
return "quarter";
|
|
16849
17149
|
case BillingPlanCreditGrantResetCadence.Monthly:
|
|
16850
17150
|
return "month";
|
|
16851
17151
|
case BillingPlanCreditGrantResetCadence.Weekly:
|
|
@@ -17335,6 +17635,11 @@ function getEntitlementFeatureName(entitlement, defaultValue) {
|
|
|
17335
17635
|
function entitlementHasCost(entitlement) {
|
|
17336
17636
|
return entitlement.priceBehavior && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && entitlement.quantity > 0 || entitlement.priceBehavior !== EntitlementPriceBehavior.PayInAdvance);
|
|
17337
17637
|
}
|
|
17638
|
+
function hasMeteredCosts(entitlements) {
|
|
17639
|
+
return entitlements.some(
|
|
17640
|
+
({ priceBehavior }) => !!priceBehavior && priceBehavior !== EntitlementPriceBehavior.PayInAdvance && priceBehavior !== EntitlementPriceBehavior.CreditBurndown
|
|
17641
|
+
);
|
|
17642
|
+
}
|
|
17338
17643
|
function entitlementHasHardLimit(entitlement) {
|
|
17339
17644
|
return entitlement.priceBehavior && entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown;
|
|
17340
17645
|
}
|
|
@@ -17484,8 +17789,38 @@ function getMonthName(date, { locale, ...format }) {
|
|
|
17484
17789
|
...format
|
|
17485
17790
|
}).format(new Date(date));
|
|
17486
17791
|
}
|
|
17487
|
-
|
|
17488
|
-
|
|
17792
|
+
var QUARTERLY_INTERVAL_COUNT = 3;
|
|
17793
|
+
var YEARLY_INTERVAL_COUNT = 12;
|
|
17794
|
+
function normalizeInterval(interval, intervalCount) {
|
|
17795
|
+
const count = intervalCount && intervalCount > 1 ? intervalCount : 1;
|
|
17796
|
+
if (interval === "month" && count === QUARTERLY_INTERVAL_COUNT) {
|
|
17797
|
+
return { period: "quarter", count: 1 };
|
|
17798
|
+
}
|
|
17799
|
+
if (interval === "month" && count === YEARLY_INTERVAL_COUNT) {
|
|
17800
|
+
return { period: "year", count: 1 };
|
|
17801
|
+
}
|
|
17802
|
+
return { period: interval, count };
|
|
17803
|
+
}
|
|
17804
|
+
function shortenPeriod(period, t2, intervalCount) {
|
|
17805
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17806
|
+
if (count > 1) {
|
|
17807
|
+
switch (unit) {
|
|
17808
|
+
case "day":
|
|
17809
|
+
return t2("X days short", { amount: count });
|
|
17810
|
+
case "week":
|
|
17811
|
+
return t2("X weeks short", { amount: count });
|
|
17812
|
+
case "month":
|
|
17813
|
+
return t2("X months short", { amount: count });
|
|
17814
|
+
case "year":
|
|
17815
|
+
return t2("X years short", { amount: count });
|
|
17816
|
+
}
|
|
17817
|
+
return;
|
|
17818
|
+
}
|
|
17819
|
+
switch (unit) {
|
|
17820
|
+
case "day":
|
|
17821
|
+
return t2("day");
|
|
17822
|
+
case "week":
|
|
17823
|
+
return t2("wk");
|
|
17489
17824
|
case "month":
|
|
17490
17825
|
return t2("mo");
|
|
17491
17826
|
case "quarter":
|
|
@@ -17494,6 +17829,31 @@ function shortenPeriod(period, t2) {
|
|
|
17494
17829
|
return t2("yr");
|
|
17495
17830
|
}
|
|
17496
17831
|
}
|
|
17832
|
+
function nameInterval(period, t2, intervalCount) {
|
|
17833
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17834
|
+
if (count > 1) {
|
|
17835
|
+
switch (unit) {
|
|
17836
|
+
case "day":
|
|
17837
|
+
return t2("X days", { count });
|
|
17838
|
+
case "week":
|
|
17839
|
+
return t2("X weeks", { count });
|
|
17840
|
+
case "month":
|
|
17841
|
+
return t2("X months", { count });
|
|
17842
|
+
case "year":
|
|
17843
|
+
return t2("X years", { count });
|
|
17844
|
+
}
|
|
17845
|
+
return period;
|
|
17846
|
+
}
|
|
17847
|
+
switch (unit) {
|
|
17848
|
+
case "day":
|
|
17849
|
+
case "week":
|
|
17850
|
+
case "month":
|
|
17851
|
+
case "quarter":
|
|
17852
|
+
case "year":
|
|
17853
|
+
return t2(unit);
|
|
17854
|
+
}
|
|
17855
|
+
return period;
|
|
17856
|
+
}
|
|
17497
17857
|
function modifyDate(date, days) {
|
|
17498
17858
|
const copy2 = new Date(date);
|
|
17499
17859
|
copy2.setDate(copy2.getDate() + days);
|
|
@@ -17576,8 +17936,14 @@ function formatCurrency(amount, {
|
|
|
17576
17936
|
function formatOrdinal(n, t2) {
|
|
17577
17937
|
return t2("Ordinal", { count: n, ordinal: true });
|
|
17578
17938
|
}
|
|
17579
|
-
function adjectify(period, t2) {
|
|
17580
|
-
|
|
17939
|
+
function adjectify(period, t2, intervalCount) {
|
|
17940
|
+
const { period: unit, count } = normalizeInterval(period, intervalCount);
|
|
17941
|
+
if (count > 1) {
|
|
17942
|
+
return t2("every period", {
|
|
17943
|
+
period: nameInterval(period, t2, intervalCount)
|
|
17944
|
+
});
|
|
17945
|
+
}
|
|
17946
|
+
switch (unit) {
|
|
17581
17947
|
case "day":
|
|
17582
17948
|
return t2("daily");
|
|
17583
17949
|
case "week":
|
|
@@ -18532,7 +18898,7 @@ var reducer = (state, action) => {
|
|
|
18532
18898
|
// src/context/EmbedProvider.tsx
|
|
18533
18899
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
18534
18900
|
var getCustomHeaders = (sessionId) => ({
|
|
18535
|
-
"X-Schematic-Components-Version": "2.
|
|
18901
|
+
"X-Schematic-Components-Version": "2.39.0",
|
|
18536
18902
|
"X-Schematic-Session-ID": sessionId
|
|
18537
18903
|
});
|
|
18538
18904
|
var normalizeCurrencyFilter = (filter) => {
|
|
@@ -19259,10 +19625,10 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
19259
19625
|
return periods;
|
|
19260
19626
|
}, [data?.activePlans, data?.activeAddOns]);
|
|
19261
19627
|
const getActivePlans = (0, import_react7.useCallback)(
|
|
19262
|
-
(plans) => {
|
|
19628
|
+
(plans, period = activePeriod) => {
|
|
19263
19629
|
const activePlans = settings.mode === "edit" ? plans.slice() : plans.filter((plan) => {
|
|
19264
19630
|
if (options.useSelectedPeriod) {
|
|
19265
|
-
return
|
|
19631
|
+
return period === "month" && plan.monthlyPrice || period === "quarter" && plan.quarterlyPrice || period === "year" && plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
19266
19632
|
}
|
|
19267
19633
|
return plan.monthlyPrice || plan.quarterlyPrice || plan.yearlyPrice || plan.chargeType === ChargeType.oneTime;
|
|
19268
19634
|
});
|
|
@@ -19274,7 +19640,8 @@ function useAvailablePlans(activePeriod, options = { useSelectedPeriod: true })
|
|
|
19274
19640
|
return {
|
|
19275
19641
|
plans: getActivePlans(data?.activePlans || []),
|
|
19276
19642
|
addOns: getActivePlans(data?.activeAddOns || []),
|
|
19277
|
-
periods: getAvailablePeriods()
|
|
19643
|
+
periods: getAvailablePeriods(),
|
|
19644
|
+
plansForPeriod: (period) => getActivePlans(data?.activePlans || [], period)
|
|
19278
19645
|
};
|
|
19279
19646
|
}, [
|
|
19280
19647
|
data?.activePlans,
|
|
@@ -22992,28 +23359,49 @@ var CheckoutDialog = ({ top }) => {
|
|
|
22992
23359
|
}
|
|
22993
23360
|
}, [filterBlocksSubscriptionCurrency, lockedCurrency, debug]);
|
|
22994
23361
|
const {
|
|
22995
|
-
plans:
|
|
23362
|
+
plans: periodPlans,
|
|
22996
23363
|
addOns: availableAddOns,
|
|
22997
|
-
periods: availablePeriods
|
|
23364
|
+
periods: availablePeriods,
|
|
23365
|
+
plansForPeriod
|
|
22998
23366
|
} = useAvailablePlans(planPeriod, {
|
|
22999
23367
|
useSelectedPeriod: showPeriodToggle
|
|
23000
23368
|
});
|
|
23001
|
-
const
|
|
23002
|
-
const
|
|
23003
|
-
|
|
23004
|
-
|
|
23005
|
-
|
|
23006
|
-
|
|
23007
|
-
|
|
23008
|
-
|
|
23009
|
-
|
|
23010
|
-
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
|
|
23014
|
-
|
|
23015
|
-
|
|
23016
|
-
|
|
23369
|
+
const requestedPlanId = checkoutState?.planId;
|
|
23370
|
+
const bypassPlanSelection = checkoutState?.bypassPlanSelection;
|
|
23371
|
+
const supportsCheckoutCurrency = (0, import_react29.useCallback)(
|
|
23372
|
+
(plan) => !hasCurrency || planSupportsCurrency(plan, effectiveCurrency) || // A plan the host picks and skips past is kept so the currency/period
|
|
23373
|
+
// mismatch notice can say it is unavailable.
|
|
23374
|
+
!!bypassPlanSelection && plan.id === requestedPlanId,
|
|
23375
|
+
[hasCurrency, effectiveCurrency, bypassPlanSelection, requestedPlanId]
|
|
23376
|
+
);
|
|
23377
|
+
const availablePlans = (0, import_react29.useMemo)(
|
|
23378
|
+
() => periodPlans.filter(supportsCheckoutCurrency),
|
|
23379
|
+
[periodPlans, supportsCheckoutCurrency]
|
|
23380
|
+
);
|
|
23381
|
+
const [selectedPlanId, setSelectedPlanId] = (0, import_react29.useState)(
|
|
23382
|
+
void 0
|
|
23383
|
+
);
|
|
23384
|
+
const isTrialing = data?.company?.billingSubscription?.status === "trialing";
|
|
23385
|
+
const findSelectedPlan = (0, import_react29.useCallback)(
|
|
23386
|
+
(plans) => {
|
|
23387
|
+
if (selectedPlanId) {
|
|
23388
|
+
return plans.find((p) => p.id === selectedPlanId);
|
|
23389
|
+
}
|
|
23390
|
+
if (requestedPlanId) {
|
|
23391
|
+
return plans.find((plan) => plan.id === requestedPlanId);
|
|
23392
|
+
}
|
|
23393
|
+
return plans.find(
|
|
23394
|
+
(plan) => plan.current && // A company that could trial its current plan chooses for itself,
|
|
23395
|
+
// unless it is already trialing it.
|
|
23396
|
+
(isTrialing || !plan.isTrialable || !plan.companyCanTrial)
|
|
23397
|
+
);
|
|
23398
|
+
},
|
|
23399
|
+
[requestedPlanId, selectedPlanId, isTrialing]
|
|
23400
|
+
);
|
|
23401
|
+
const selectedPlan = (0, import_react29.useMemo)(
|
|
23402
|
+
() => findSelectedPlan(availablePlans),
|
|
23403
|
+
[availablePlans, findSelectedPlan]
|
|
23404
|
+
);
|
|
23017
23405
|
const [shouldTrial, setShouldTrial] = (0, import_react29.useState)(false);
|
|
23018
23406
|
const displayedPlanCreditGrants = (0, import_react29.useMemo)(
|
|
23019
23407
|
() => getDisplayedPlanCreditGrants(selectedPlan),
|
|
@@ -23379,7 +23767,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23379
23767
|
}, [currencies, selectedPlan, planPeriod]);
|
|
23380
23768
|
const showPlanCurrencySelector = canSelectCurrency && planStageVisible;
|
|
23381
23769
|
const showCheckoutCurrencySelector = canSelectCurrency && !planStageVisible && checkoutStageCurrencies.length > 1;
|
|
23382
|
-
const currencyPeriodMismatch = hasCurrency && !
|
|
23770
|
+
const currencyPeriodMismatch = hasCurrency && !planStageVisible && !!selectedPlan && !planOffersCurrencyForPeriod(selectedPlan, planPeriod, effectiveCurrency);
|
|
23383
23771
|
(0, import_react29.useEffect)(() => {
|
|
23384
23772
|
if (currencyPeriodMismatch) {
|
|
23385
23773
|
console.error(
|
|
@@ -23431,7 +23819,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23431
23819
|
if (isBypassLoading) {
|
|
23432
23820
|
setIsBypassLoading(false);
|
|
23433
23821
|
}
|
|
23434
|
-
setSelectedPlanId(null);
|
|
23435
23822
|
return;
|
|
23436
23823
|
}
|
|
23437
23824
|
const requestId = ++previewRequestIdRef.current;
|
|
@@ -23670,7 +24057,8 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23670
24057
|
}
|
|
23671
24058
|
const updatedShouldTrial = updates.shouldTrial ?? shouldTrial;
|
|
23672
24059
|
setShouldTrial(updatedShouldTrial);
|
|
23673
|
-
|
|
24060
|
+
const updatedWillTrialWithoutPaymentMethod = updatedShouldTrial && !trialPaymentMethodRequired;
|
|
24061
|
+
if (updatedWillTrialWithoutPaymentMethod) {
|
|
23674
24062
|
setSelectedAddOnIds(/* @__PURE__ */ new Set());
|
|
23675
24063
|
}
|
|
23676
24064
|
const resolvedCreditBundles = (data?.creditBundles ?? []).map(
|
|
@@ -23683,14 +24071,10 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23683
24071
|
period,
|
|
23684
24072
|
plan,
|
|
23685
24073
|
shouldTrial: updatedShouldTrial,
|
|
23686
|
-
...
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23691
|
-
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23692
|
-
)
|
|
23693
|
-
},
|
|
24074
|
+
...updatedWillTrialWithoutPaymentMethod && { addOns: [] },
|
|
24075
|
+
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
24076
|
+
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
24077
|
+
),
|
|
23694
24078
|
creditBundles: resolvedCreditBundles
|
|
23695
24079
|
});
|
|
23696
24080
|
},
|
|
@@ -23702,7 +24086,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23702
24086
|
featureUsage,
|
|
23703
24087
|
bundleCounts,
|
|
23704
24088
|
shouldTrial,
|
|
23705
|
-
|
|
24089
|
+
trialPaymentMethodRequired,
|
|
23706
24090
|
handlePreviewCheckout,
|
|
23707
24091
|
checkoutState?.payInAdvanceQuantities
|
|
23708
24092
|
]
|
|
@@ -23713,40 +24097,42 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23713
24097
|
return;
|
|
23714
24098
|
}
|
|
23715
24099
|
setPlanPeriod(period);
|
|
23716
|
-
const
|
|
23717
|
-
|
|
23718
|
-
[...[]]
|
|
23719
|
-
);
|
|
23720
|
-
setUsageBasedEntitlements(
|
|
23721
|
-
(prev) => updatedUsageBasedEntitlements.map((updated) => {
|
|
23722
|
-
const current = prev.find(
|
|
23723
|
-
({ featureId }) => featureId === updated.featureId
|
|
23724
|
-
);
|
|
23725
|
-
if (typeof current?.quantity === "number") {
|
|
23726
|
-
return { ...updated, quantity: current.quantity };
|
|
23727
|
-
}
|
|
23728
|
-
return updated;
|
|
23729
|
-
})
|
|
24100
|
+
const plan = findSelectedPlan(
|
|
24101
|
+
plansForPeriod(period).filter(supportsCheckoutCurrency)
|
|
23730
24102
|
);
|
|
24103
|
+
const updatedUsageBasedEntitlements = plan ? (plan.entitlements || []).reduce(
|
|
24104
|
+
createActiveUsageBasedEntitlementsReducer(featureUsage, period),
|
|
24105
|
+
[]
|
|
24106
|
+
).map((updated) => {
|
|
24107
|
+
const current = usageBasedEntitlements.find(
|
|
24108
|
+
({ featureId }) => featureId === updated.featureId
|
|
24109
|
+
);
|
|
24110
|
+
if (typeof current?.quantity === "number") {
|
|
24111
|
+
return { ...updated, quantity: current.quantity };
|
|
24112
|
+
}
|
|
24113
|
+
return updated;
|
|
24114
|
+
}) : usageBasedEntitlements;
|
|
24115
|
+
if (plan) {
|
|
24116
|
+
setUsageBasedEntitlements(updatedUsageBasedEntitlements);
|
|
24117
|
+
}
|
|
23731
24118
|
const updatedAddOnUsageBasedEntitlements = addOns.filter((addOn) => addOn.isSelected).flatMap(
|
|
23732
24119
|
(addOn) => (addOn.entitlements ?? []).reduce(
|
|
23733
24120
|
createActiveUsageBasedEntitlementsReducer(featureUsage, period),
|
|
23734
24121
|
[]
|
|
23735
24122
|
)
|
|
23736
|
-
)
|
|
23737
|
-
|
|
23738
|
-
|
|
23739
|
-
|
|
23740
|
-
|
|
23741
|
-
|
|
23742
|
-
|
|
23743
|
-
|
|
23744
|
-
|
|
23745
|
-
|
|
23746
|
-
})
|
|
23747
|
-
);
|
|
24123
|
+
).map((updated) => {
|
|
24124
|
+
const current = addOnUsageBasedEntitlements.find(
|
|
24125
|
+
({ featureId }) => featureId === updated.featureId
|
|
24126
|
+
);
|
|
24127
|
+
if (typeof current?.quantity === "number") {
|
|
24128
|
+
return { ...updated, quantity: current.quantity };
|
|
24129
|
+
}
|
|
24130
|
+
return updated;
|
|
24131
|
+
});
|
|
24132
|
+
setAddOnUsageBasedEntitlements(updatedAddOnUsageBasedEntitlements);
|
|
23748
24133
|
handlePreviewCheckout({
|
|
23749
24134
|
period,
|
|
24135
|
+
plan,
|
|
23750
24136
|
payInAdvanceEntitlements: updatedUsageBasedEntitlements.filter(
|
|
23751
24137
|
({ priceBehavior }) => priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
23752
24138
|
),
|
|
@@ -23757,9 +24143,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23757
24143
|
},
|
|
23758
24144
|
[
|
|
23759
24145
|
planPeriod,
|
|
23760
|
-
|
|
24146
|
+
plansForPeriod,
|
|
24147
|
+
findSelectedPlan,
|
|
24148
|
+
supportsCheckoutCurrency,
|
|
23761
24149
|
featureUsage,
|
|
24150
|
+
usageBasedEntitlements,
|
|
23762
24151
|
addOns,
|
|
24152
|
+
addOnUsageBasedEntitlements,
|
|
23763
24153
|
setPlanPeriod,
|
|
23764
24154
|
handlePreviewCheckout
|
|
23765
24155
|
]
|
|
@@ -23903,12 +24293,12 @@ var CheckoutDialog = ({ top }) => {
|
|
|
23903
24293
|
}, [setLayout, clearCheckoutState]);
|
|
23904
24294
|
const hasInitializedPlan = (0, import_react29.useRef)(false);
|
|
23905
24295
|
(0, import_react29.useEffect)(() => {
|
|
23906
|
-
if (!hasInitializedPlan.current && selectedPlan) {
|
|
24296
|
+
if (!hasInitializedPlan.current && selectedPlan && selectedPlanId === void 0) {
|
|
23907
24297
|
hasInitializedPlan.current = true;
|
|
23908
|
-
const shouldTrial2 = checkoutState?.startTrialIfAvailable && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
24298
|
+
const shouldTrial2 = checkoutState?.startTrialIfAvailable && !(isTrialing && selectedPlan.current) && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
23909
24299
|
selectPlan({ plan: selectedPlan, period: planPeriod, shouldTrial: shouldTrial2 });
|
|
23910
24300
|
}
|
|
23911
|
-
}, [selectedPlan, planPeriod, selectPlan]);
|
|
24301
|
+
}, [selectedPlan, selectedPlanId, planPeriod, selectPlan]);
|
|
23912
24302
|
(0, import_react29.useLayoutEffect)(() => {
|
|
23913
24303
|
const element = dialogRef.current;
|
|
23914
24304
|
if (layout !== "checkout" || !element) {
|
|
@@ -24156,6 +24546,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
24156
24546
|
options: availablePeriods,
|
|
24157
24547
|
selectedOption: planPeriod,
|
|
24158
24548
|
selectedPlan,
|
|
24549
|
+
currency: hasCurrency ? effectiveCurrency : void 0,
|
|
24159
24550
|
onSelect: changePlanPeriod
|
|
24160
24551
|
}
|
|
24161
24552
|
)
|
|
@@ -24962,6 +25353,7 @@ var PeriodToggle = ({
|
|
|
24962
25353
|
options,
|
|
24963
25354
|
selectedOption,
|
|
24964
25355
|
selectedPlan,
|
|
25356
|
+
currency,
|
|
24965
25357
|
onSelect
|
|
24966
25358
|
}) => {
|
|
24967
25359
|
const { t: t2 } = useTranslation();
|
|
@@ -24972,19 +25364,19 @@ var PeriodToggle = ({
|
|
|
24972
25364
|
if (!selectedPlan) {
|
|
24973
25365
|
return result;
|
|
24974
25366
|
}
|
|
24975
|
-
const monthlyPrice = getPlanPrice(selectedPlan, "month")?.price ?? 0;
|
|
25367
|
+
const monthlyPrice = getPlanPrice(selectedPlan, "month", void 0, currency)?.price ?? 0;
|
|
24976
25368
|
if (monthlyPrice <= 0) {
|
|
24977
25369
|
return result;
|
|
24978
25370
|
}
|
|
24979
25371
|
for (const [period, months] of Object.entries(PERIOD_MONTH_COUNT)) {
|
|
24980
|
-
const periodPrice = getPlanPrice(selectedPlan, period)?.price ?? 0;
|
|
25372
|
+
const periodPrice = getPlanPrice(selectedPlan, period, void 0, currency)?.price ?? 0;
|
|
24981
25373
|
if (periodPrice > 0) {
|
|
24982
25374
|
const baseline = monthlyPrice * months;
|
|
24983
25375
|
result[period] = Math.round((baseline - periodPrice) / baseline * 1e4) / 100;
|
|
24984
25376
|
}
|
|
24985
25377
|
}
|
|
24986
25378
|
return result;
|
|
24987
|
-
}, [selectedPlan]);
|
|
25379
|
+
}, [selectedPlan, currency]);
|
|
24988
25380
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
24989
25381
|
Flex,
|
|
24990
25382
|
{
|
|
@@ -25372,10 +25764,12 @@ var CheckoutStageButton = ({
|
|
|
25372
25764
|
willScheduleDowngrade,
|
|
25373
25765
|
hasIncompleteRequiredCustomFields = false,
|
|
25374
25766
|
isCreditOnlyPurchase = false,
|
|
25375
|
-
isOneTimeOnlyPurchase = false
|
|
25767
|
+
isOneTimeOnlyPurchase = false,
|
|
25768
|
+
isUnchangedTrial = false
|
|
25376
25769
|
}) => {
|
|
25377
25770
|
const { t: t2 } = useTranslation();
|
|
25378
25771
|
const isDisabled = isLoading || !hasPlan && !isCreditOnlyPurchase || inEditMode || !canCheckout;
|
|
25772
|
+
const isCheckoutDisabled = isDisabled || isUnchangedTrial;
|
|
25379
25773
|
const optInUnmet = optInRequired && !optInAccepted;
|
|
25380
25774
|
const getNextStageId = (currentStageId) => {
|
|
25381
25775
|
if (!checkoutStages) return void 0;
|
|
@@ -25437,7 +25831,7 @@ var CheckoutStageButton = ({
|
|
|
25437
25831
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25438
25832
|
NoPaymentRequired,
|
|
25439
25833
|
{
|
|
25440
|
-
isDisabled,
|
|
25834
|
+
isDisabled: isCheckoutDisabled,
|
|
25441
25835
|
isLoading,
|
|
25442
25836
|
onClick: checkout,
|
|
25443
25837
|
isSticky,
|
|
@@ -25472,7 +25866,7 @@ var CheckoutStageButton = ({
|
|
|
25472
25866
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25473
25867
|
NoPaymentRequired,
|
|
25474
25868
|
{
|
|
25475
|
-
isDisabled,
|
|
25869
|
+
isDisabled: isCheckoutDisabled,
|
|
25476
25870
|
isLoading,
|
|
25477
25871
|
onClick: checkout,
|
|
25478
25872
|
isSticky,
|
|
@@ -25516,7 +25910,7 @@ var CheckoutStageButton = ({
|
|
|
25516
25910
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25517
25911
|
NoPaymentRequired,
|
|
25518
25912
|
{
|
|
25519
|
-
isDisabled,
|
|
25913
|
+
isDisabled: isCheckoutDisabled,
|
|
25520
25914
|
isLoading,
|
|
25521
25915
|
onClick: checkout,
|
|
25522
25916
|
isSticky,
|
|
@@ -25560,7 +25954,7 @@ var CheckoutStageButton = ({
|
|
|
25560
25954
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25561
25955
|
NoPaymentRequired,
|
|
25562
25956
|
{
|
|
25563
|
-
isDisabled,
|
|
25957
|
+
isDisabled: isCheckoutDisabled,
|
|
25564
25958
|
isLoading,
|
|
25565
25959
|
onClick: checkout,
|
|
25566
25960
|
isSticky,
|
|
@@ -25603,7 +25997,7 @@ var CheckoutStageButton = ({
|
|
|
25603
25997
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25604
25998
|
NoPaymentRequired,
|
|
25605
25999
|
{
|
|
25606
|
-
isDisabled,
|
|
26000
|
+
isDisabled: isCheckoutDisabled,
|
|
25607
26001
|
isLoading,
|
|
25608
26002
|
onClick: checkout,
|
|
25609
26003
|
isSticky,
|
|
@@ -25647,7 +26041,7 @@ var CheckoutStageButton = ({
|
|
|
25647
26041
|
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25648
26042
|
NoPaymentRequired,
|
|
25649
26043
|
{
|
|
25650
|
-
isDisabled,
|
|
26044
|
+
isDisabled: isCheckoutDisabled,
|
|
25651
26045
|
isLoading,
|
|
25652
26046
|
onClick: checkout,
|
|
25653
26047
|
isSticky,
|
|
@@ -25691,7 +26085,7 @@ var CheckoutStageButton = ({
|
|
|
25691
26085
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
25692
26086
|
NoPaymentRequired,
|
|
25693
26087
|
{
|
|
25694
|
-
isDisabled:
|
|
26088
|
+
isDisabled: isCheckoutDisabled || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
25695
26089
|
isLoading,
|
|
25696
26090
|
onClick: checkout,
|
|
25697
26091
|
isSticky,
|
|
@@ -25707,7 +26101,7 @@ var CheckoutStageButton = ({
|
|
|
25707
26101
|
Button,
|
|
25708
26102
|
{
|
|
25709
26103
|
type: "button",
|
|
25710
|
-
disabled:
|
|
26104
|
+
disabled: isCheckoutDisabled || !hasPaymentMethod || hasIncompleteRequiredCustomFields || optInUnmet,
|
|
25711
26105
|
onClick: checkout,
|
|
25712
26106
|
$fullWidth: true,
|
|
25713
26107
|
$isLoading: isLoading,
|
|
@@ -26189,9 +26583,9 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26189
26583
|
]);
|
|
26190
26584
|
const selectedAddOnsWithPrice = (0, import_react37.useMemo)(
|
|
26191
26585
|
() => addOns.filter(
|
|
26192
|
-
(addOn) => addOn.isSelected && getPlanPrice(addOn,
|
|
26586
|
+
(addOn) => addOn.isSelected && getPlanPrice(addOn, planPeriod, void 0, currency)?.price
|
|
26193
26587
|
),
|
|
26194
|
-
[addOns, currency]
|
|
26588
|
+
[addOns, planPeriod, currency]
|
|
26195
26589
|
);
|
|
26196
26590
|
const selectedOneTimeAddOns = (0, import_react37.useMemo)(
|
|
26197
26591
|
() => addOns.filter(
|
|
@@ -26201,7 +26595,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26201
26595
|
);
|
|
26202
26596
|
const { removedAddOns, willAddOnsChange } = (0, import_react37.useMemo)(() => {
|
|
26203
26597
|
const addedAddOns = selectedAddOnsWithPrice.filter(
|
|
26204
|
-
(selected) =>
|
|
26598
|
+
(selected) => !currentAddOns.some((current) => selected.id === current.id)
|
|
26205
26599
|
);
|
|
26206
26600
|
const removedAddOns2 = currentAddOns.filter(
|
|
26207
26601
|
(current) => current.planPrice && current.planPeriod !== "one-time" && !selectedAddOnsWithPrice.some(
|
|
@@ -26214,7 +26608,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26214
26608
|
removedAddOns: removedAddOns2,
|
|
26215
26609
|
willAddOnsChange: willAddOnsChange2
|
|
26216
26610
|
};
|
|
26217
|
-
}, [currentAddOns, selectedAddOnsWithPrice
|
|
26611
|
+
}, [currentAddOns, selectedAddOnsWithPrice]);
|
|
26218
26612
|
const addedCreditBundles = (0, import_react37.useMemo)(
|
|
26219
26613
|
() => creditBundles.filter((bundle) => bundle.count > 0),
|
|
26220
26614
|
[creditBundles]
|
|
@@ -26240,6 +26634,24 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26240
26634
|
selectedOneTimeAddOns.length,
|
|
26241
26635
|
addedCreditBundles.length
|
|
26242
26636
|
]);
|
|
26637
|
+
const isUnchangedTrial = (0, import_react37.useMemo)(() => {
|
|
26638
|
+
if (billingSubscription?.status !== "trialing" || !selectedPlan?.current) {
|
|
26639
|
+
return false;
|
|
26640
|
+
}
|
|
26641
|
+
const currentPeriod = getSubscriptionPeriod(billingSubscription);
|
|
26642
|
+
if (currentPeriod && currentPeriod !== planPeriod) {
|
|
26643
|
+
return false;
|
|
26644
|
+
}
|
|
26645
|
+
return !willAddOnsChange && updatedUsageBasedEntitlements.changed.length === 0 && selectedOneTimeAddOns.length === 0 && addedCreditBundles.length === 0;
|
|
26646
|
+
}, [
|
|
26647
|
+
selectedPlan,
|
|
26648
|
+
billingSubscription,
|
|
26649
|
+
planPeriod,
|
|
26650
|
+
willAddOnsChange,
|
|
26651
|
+
updatedUsageBasedEntitlements.changed.length,
|
|
26652
|
+
selectedOneTimeAddOns.length,
|
|
26653
|
+
addedCreditBundles.length
|
|
26654
|
+
]);
|
|
26243
26655
|
const discountApplied = (0, import_react37.useMemo)(
|
|
26244
26656
|
() => promoCode && (amountOff > 0 || percentOff > 0),
|
|
26245
26657
|
[promoCode, amountOff, percentOff]
|
|
@@ -26433,6 +26845,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26433
26845
|
hasIncompleteRequiredCustomFields,
|
|
26434
26846
|
isCreditOnlyPurchase,
|
|
26435
26847
|
isOneTimeOnlyPurchase,
|
|
26848
|
+
isUnchangedTrial,
|
|
26436
26849
|
checkout: handleCheckout
|
|
26437
26850
|
}
|
|
26438
26851
|
);
|
|
@@ -26478,6 +26891,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26478
26891
|
addOnPayInAdvanceEntitlements,
|
|
26479
26892
|
isCreditOnlyPurchase,
|
|
26480
26893
|
isOneTimeOnlyPurchase,
|
|
26894
|
+
isUnchangedTrial,
|
|
26481
26895
|
hasIncompleteRequiredCustomFields
|
|
26482
26896
|
]);
|
|
26483
26897
|
(0, import_react37.useLayoutEffect)(() => {
|
|
@@ -26512,7 +26926,10 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26512
26926
|
subscriptionPrice,
|
|
26513
26927
|
planPeriod,
|
|
26514
26928
|
periodStart: renewDate,
|
|
26515
|
-
hasUsageBasedCosts:
|
|
26929
|
+
hasUsageBasedCosts: hasMeteredCosts([
|
|
26930
|
+
...usageBasedEntitlements,
|
|
26931
|
+
...addOnUsageBasedEntitlements
|
|
26932
|
+
]),
|
|
26516
26933
|
discount: subscriptionDiscount,
|
|
26517
26934
|
locale
|
|
26518
26935
|
},
|
|
@@ -26524,6 +26941,14 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26524
26941
|
locale
|
|
26525
26942
|
})
|
|
26526
26943
|
}) : billingPreviewText;
|
|
26944
|
+
const currentPriceInterval = getSubscriptionInterval(
|
|
26945
|
+
billingSubscription
|
|
26946
|
+
) ?? { interval: currentPlan?.planPeriod || planPeriod };
|
|
26947
|
+
const currentPriceSuffix = shortenPeriod(
|
|
26948
|
+
currentPriceInterval.interval,
|
|
26949
|
+
t2,
|
|
26950
|
+
currentPriceInterval.intervalCount
|
|
26951
|
+
);
|
|
26527
26952
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
26528
26953
|
Flex,
|
|
26529
26954
|
{
|
|
@@ -26592,10 +27017,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26592
27017
|
}),
|
|
26593
27018
|
/* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
|
|
26594
27019
|
"/",
|
|
26595
|
-
|
|
26596
|
-
getSubscriptionPeriod(billingSubscription) || currentPlan.planPeriod || planPeriod,
|
|
26597
|
-
t2
|
|
26598
|
-
)
|
|
27020
|
+
currentPriceSuffix
|
|
26599
27021
|
] })
|
|
26600
27022
|
] }) })
|
|
26601
27023
|
]
|
|
@@ -26805,7 +27227,7 @@ var SubscriptionSidebar = (0, import_react37.forwardRef)(
|
|
|
26805
27227
|
}),
|
|
26806
27228
|
addOn.planPeriod !== "one-time" && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("sub", { children: [
|
|
26807
27229
|
"/",
|
|
26808
|
-
|
|
27230
|
+
currentPriceSuffix
|
|
26809
27231
|
] })
|
|
26810
27232
|
] }) })
|
|
26811
27233
|
]
|
|
@@ -29972,9 +30394,14 @@ var import_react51 = require("react");
|
|
|
29972
30394
|
|
|
29973
30395
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
29974
30396
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
29975
|
-
var AddOn = ({
|
|
30397
|
+
var AddOn = ({
|
|
30398
|
+
addOn,
|
|
30399
|
+
currency,
|
|
30400
|
+
priceInterval,
|
|
30401
|
+
layout
|
|
30402
|
+
}) => {
|
|
29976
30403
|
const { t: t2, locale } = useTranslation();
|
|
29977
|
-
const
|
|
30404
|
+
const resolvedInterval = addOn.planPeriod === "one-time" ? { interval: addOn.planPeriod } : priceInterval ?? (addOn.planPeriod ? { interval: addOn.planPeriod } : void 0);
|
|
29978
30405
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
29979
30406
|
Flex,
|
|
29980
30407
|
{
|
|
@@ -29984,9 +30411,13 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
29984
30411
|
$gap: "1rem",
|
|
29985
30412
|
children: [
|
|
29986
30413
|
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
29987
|
-
typeof addOn.planPrice === "number" &&
|
|
30414
|
+
typeof addOn.planPrice === "number" && resolvedInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { children: [
|
|
29988
30415
|
formatCurrency(addOn.planPrice, { locale, currency }),
|
|
29989
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children:
|
|
30416
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("sub", { children: resolvedInterval.interval === "one-time" ? shortenPeriod(resolvedInterval.interval, t2) : `/${shortenPeriod(
|
|
30417
|
+
resolvedInterval.interval,
|
|
30418
|
+
t2,
|
|
30419
|
+
resolvedInterval.intervalCount
|
|
30420
|
+
)}` })
|
|
29990
30421
|
] })
|
|
29991
30422
|
]
|
|
29992
30423
|
}
|
|
@@ -30287,7 +30718,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30287
30718
|
willSubscriptionCancel,
|
|
30288
30719
|
isTrialSubscription
|
|
30289
30720
|
} = (0, import_react51.useMemo)(() => {
|
|
30290
|
-
const subscriptionInterval2 =
|
|
30721
|
+
const subscriptionInterval2 = getSubscriptionInterval(billingSubscription);
|
|
30291
30722
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
30292
30723
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
30293
30724
|
const willSubscriptionCancel2 = typeof billingSubscription?.cancelAt === "number" && billingSubscription?.cancelAtPeriodEnd === true;
|
|
@@ -30299,6 +30730,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30299
30730
|
};
|
|
30300
30731
|
}, [billingSubscription]);
|
|
30301
30732
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
30733
|
+
const currentPriceInterval = subscriptionInterval ?? (currentPlanPeriod ? { interval: currentPlanPeriod } : void 0);
|
|
30302
30734
|
const { isFreePlan, isUsageBasedPlan } = (0, import_react51.useMemo)(() => {
|
|
30303
30735
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
30304
30736
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
@@ -30457,9 +30889,13 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30457
30889
|
})
|
|
30458
30890
|
}
|
|
30459
30891
|
),
|
|
30460
|
-
!isFreePlan &&
|
|
30892
|
+
!isFreePlan && currentPriceInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
|
|
30461
30893
|
"/",
|
|
30462
|
-
shortenPeriod(
|
|
30894
|
+
shortenPeriod(
|
|
30895
|
+
currentPriceInterval.interval,
|
|
30896
|
+
t2,
|
|
30897
|
+
currentPriceInterval.intervalCount
|
|
30898
|
+
)
|
|
30463
30899
|
] }) })
|
|
30464
30900
|
] })
|
|
30465
30901
|
]
|
|
@@ -30479,7 +30915,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30479
30915
|
{
|
|
30480
30916
|
addOn,
|
|
30481
30917
|
currency: subscriptionCurrency,
|
|
30482
|
-
|
|
30918
|
+
priceInterval: currentPriceInterval,
|
|
30483
30919
|
layout: props
|
|
30484
30920
|
},
|
|
30485
30921
|
addOnIndex
|
|
@@ -30538,7 +30974,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30538
30974
|
resolveLicenseQuantity
|
|
30539
30975
|
);
|
|
30540
30976
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
30541
|
-
const
|
|
30977
|
+
const creditInterval = composition.period ? { interval: composition.period } : subscriptionInterval;
|
|
30542
30978
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
30543
30979
|
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
30544
30980
|
Flex,
|
|
@@ -30568,7 +31004,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30568
31004
|
1
|
|
30569
31005
|
)
|
|
30570
31006
|
}),
|
|
30571
|
-
composition.fixedQuantity > 0 &&
|
|
31007
|
+
composition.fixedQuantity > 0 && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
30572
31008
|
" ",
|
|
30573
31009
|
t2("Plus X credits per period", {
|
|
30574
31010
|
amount: composition.fixedQuantity,
|
|
@@ -30577,8 +31013,10 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30577
31013
|
locale,
|
|
30578
31014
|
composition.fixedQuantity
|
|
30579
31015
|
),
|
|
30580
|
-
period:
|
|
30581
|
-
|
|
31016
|
+
period: nameInterval(
|
|
31017
|
+
creditInterval.interval,
|
|
31018
|
+
t2,
|
|
31019
|
+
creditInterval.intervalCount
|
|
30582
31020
|
)
|
|
30583
31021
|
})
|
|
30584
31022
|
] })
|
|
@@ -30587,11 +31025,13 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30587
31025
|
" ",
|
|
30588
31026
|
getFeatureName(group, locale, group.total.value),
|
|
30589
31027
|
" ",
|
|
30590
|
-
|
|
31028
|
+
creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
30591
31029
|
t2("per"),
|
|
30592
31030
|
" ",
|
|
30593
|
-
|
|
30594
|
-
|
|
31031
|
+
nameInterval(
|
|
31032
|
+
creditInterval.interval,
|
|
31033
|
+
t2,
|
|
31034
|
+
creditInterval.intervalCount
|
|
30595
31035
|
)
|
|
30596
31036
|
] })
|
|
30597
31037
|
] }) }),
|
|
@@ -30618,7 +31058,7 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30618
31058
|
]
|
|
30619
31059
|
}
|
|
30620
31060
|
),
|
|
30621
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" &&
|
|
31061
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditInterval && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
30622
31062
|
Text,
|
|
30623
31063
|
{
|
|
30624
31064
|
style: { opacity: 0.54 },
|
|
@@ -30639,7 +31079,11 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30639
31079
|
locale,
|
|
30640
31080
|
resolvedTotal
|
|
30641
31081
|
),
|
|
30642
|
-
period: shortenPeriod(
|
|
31082
|
+
period: shortenPeriod(
|
|
31083
|
+
creditInterval.interval,
|
|
31084
|
+
t2,
|
|
31085
|
+
creditInterval.intervalCount
|
|
31086
|
+
)
|
|
30643
31087
|
}) : t2("X licenses times Y credits", {
|
|
30644
31088
|
quantity: licenseQuantity,
|
|
30645
31089
|
licenseName: getFeatureName(
|
|
@@ -30654,7 +31098,11 @@ var PlanManager = (0, import_react51.forwardRef)(({ children, className, portal,
|
|
|
30654
31098
|
locale,
|
|
30655
31099
|
resolvedTotal
|
|
30656
31100
|
),
|
|
30657
|
-
period: shortenPeriod(
|
|
31101
|
+
period: shortenPeriod(
|
|
31102
|
+
creditInterval.interval,
|
|
31103
|
+
t2,
|
|
31104
|
+
creditInterval.intervalCount
|
|
31105
|
+
)
|
|
30658
31106
|
})
|
|
30659
31107
|
}
|
|
30660
31108
|
)
|
|
@@ -31870,16 +32318,18 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
|
|
|
31870
32318
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || getDefaultPlanPeriod(data?.activePlans)
|
|
31871
32319
|
);
|
|
31872
32320
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
31873
|
-
const [
|
|
32321
|
+
const [chosenCurrency, setSelectedCurrency] = (0, import_react54.useState)(
|
|
31874
32322
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
31875
32323
|
);
|
|
31876
|
-
if (currencies.length > 0 && !currencies.includes(
|
|
32324
|
+
if (currencies.length > 0 && !currencies.includes(chosenCurrency)) {
|
|
31877
32325
|
setSelectedCurrency(currencies[0]);
|
|
31878
32326
|
}
|
|
32327
|
+
const lockedCurrency = useSubscriptionCurrency();
|
|
32328
|
+
const selectedCurrency = lockedCurrency ?? chosenCurrency;
|
|
31879
32329
|
const showPeriodToggle = rest.showPeriodToggle ?? data?.displaySettings?.showPeriodToggle ?? true;
|
|
31880
32330
|
const hasCurrencyFilter = !!currencyFilter && currencyFilter.length > 0;
|
|
31881
|
-
const showCurrencySelector = currencies.length > 1;
|
|
31882
|
-
const hasCurrency = currencies.length > 1 || hasCurrencyFilter;
|
|
32331
|
+
const showCurrencySelector = currencies.length > 1 && !lockedCurrency;
|
|
32332
|
+
const hasCurrency = !!lockedCurrency || currencies.length > 1 || hasCurrencyFilter;
|
|
31883
32333
|
const hasNoUsableCurrency = currencies.length === 0;
|
|
31884
32334
|
const {
|
|
31885
32335
|
plans: allPlans,
|
|
@@ -31978,6 +32428,7 @@ var PricingTable = (0, import_react54.forwardRef)(({ className, ...rest }, ref)
|
|
|
31978
32428
|
options: periods,
|
|
31979
32429
|
selectedOption: selectedPeriod,
|
|
31980
32430
|
selectedPlan: currentPlan,
|
|
32431
|
+
currency: hasCurrency ? selectedCurrency : void 0,
|
|
31981
32432
|
onSelect: (period) => {
|
|
31982
32433
|
if (period !== selectedPeriod) {
|
|
31983
32434
|
setSelectedPeriod(period);
|