@schematichq/schematic-components 2.25.0 → 2.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.browser.cjs.js +973 -516
- package/dist/schematic-components.browser.esm.js +953 -496
- package/dist/schematic-components.cjs.js +973 -516
- package/dist/schematic-components.d.ts +588 -0
- package/dist/schematic-components.esm.js +953 -496
- package/package.json +8 -11
|
@@ -1717,7 +1717,7 @@ var require_debounce = __commonJS({
|
|
|
1717
1717
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
1718
1718
|
var nativeMax = Math.max;
|
|
1719
1719
|
var nativeMin = Math.min;
|
|
1720
|
-
function
|
|
1720
|
+
function debounce6(func, wait, options) {
|
|
1721
1721
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
1722
1722
|
if (typeof func != "function") {
|
|
1723
1723
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
@@ -1798,7 +1798,7 @@ var require_debounce = __commonJS({
|
|
|
1798
1798
|
debounced.flush = flush;
|
|
1799
1799
|
return debounced;
|
|
1800
1800
|
}
|
|
1801
|
-
module.exports =
|
|
1801
|
+
module.exports = debounce6;
|
|
1802
1802
|
}
|
|
1803
1803
|
});
|
|
1804
1804
|
|
|
@@ -1957,6 +1957,8 @@ var initialContext = {
|
|
|
1957
1957
|
getUpcomingInvoice: stub,
|
|
1958
1958
|
getCustomerBalance: stub,
|
|
1959
1959
|
listInvoices: stub,
|
|
1960
|
+
getCreditUsageByUser: stub,
|
|
1961
|
+
getFeatureUsageByUser: stub,
|
|
1960
1962
|
createSetupIntent: stub,
|
|
1961
1963
|
updatePaymentMethod: stub,
|
|
1962
1964
|
deletePaymentMethod: stub,
|
|
@@ -5248,6 +5250,18 @@ var en_default = {
|
|
|
5248
5250
|
"month, billed yearly": "month, billed yearly",
|
|
5249
5251
|
"month, billed quarterly": "month, billed quarterly",
|
|
5250
5252
|
purchased: "purchased {{date}}",
|
|
5253
|
+
"Usage by user": "Usage by user",
|
|
5254
|
+
"X used by your team this period": "{{amount}} used by your team this period",
|
|
5255
|
+
"Show all X users_one": "Show all {{count}} user",
|
|
5256
|
+
"Show all X users_other": "Show all {{count}} users",
|
|
5257
|
+
"Show top X users_one": "Show top {{count}} user",
|
|
5258
|
+
"Show top X users_other": "Show top {{count}} users",
|
|
5259
|
+
"Show all": "Show all",
|
|
5260
|
+
"Show fewer": "Show fewer",
|
|
5261
|
+
Unattributed: "Unattributed",
|
|
5262
|
+
"There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
|
|
5263
|
+
"plus X more_one": "plus {{count}} more",
|
|
5264
|
+
"plus X more_other": "plus {{count}} more",
|
|
5251
5265
|
usage: {
|
|
5252
5266
|
limited: "{{amount}} of {{allocation}} used",
|
|
5253
5267
|
unlimited: "{{amount}} used"
|
|
@@ -6853,7 +6867,7 @@ var Icon = ({ name, className = "", ...rest }) => {
|
|
|
6853
6867
|
};
|
|
6854
6868
|
|
|
6855
6869
|
// src/context/EmbedProvider.tsx
|
|
6856
|
-
var
|
|
6870
|
+
var import_debounce2 = __toESM(require_debounce());
|
|
6857
6871
|
var import_merge3 = __toESM(require_merge());
|
|
6858
6872
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useReducer, useRef as useRef2 } from "react";
|
|
6859
6873
|
|
|
@@ -7165,6 +7179,22 @@ var JSONApiResponse = class {
|
|
|
7165
7179
|
}
|
|
7166
7180
|
};
|
|
7167
7181
|
|
|
7182
|
+
// src/api/checkoutexternal/models/BillingArrearsAnchor.ts
|
|
7183
|
+
function BillingArrearsAnchorFromJSON(json) {
|
|
7184
|
+
return BillingArrearsAnchorFromJSONTyped(json, false);
|
|
7185
|
+
}
|
|
7186
|
+
function BillingArrearsAnchorFromJSONTyped(json, ignoreDiscriminator) {
|
|
7187
|
+
return json;
|
|
7188
|
+
}
|
|
7189
|
+
|
|
7190
|
+
// src/api/checkoutexternal/models/BillingArrearsCadence.ts
|
|
7191
|
+
function BillingArrearsCadenceFromJSON(json) {
|
|
7192
|
+
return BillingArrearsCadenceFromJSONTyped(json, false);
|
|
7193
|
+
}
|
|
7194
|
+
function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
|
|
7195
|
+
return json;
|
|
7196
|
+
}
|
|
7197
|
+
|
|
7168
7198
|
// src/api/checkoutexternal/models/BillingCollectionMethod.ts
|
|
7169
7199
|
function BillingCollectionMethodFromJSON(json) {
|
|
7170
7200
|
return BillingCollectionMethodFromJSONTyped(json, false);
|
|
@@ -7715,6 +7745,8 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7715
7745
|
return json;
|
|
7716
7746
|
}
|
|
7717
7747
|
return {
|
|
7748
|
+
arrearsAnchor: json["arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["arrears_anchor"]),
|
|
7749
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
7718
7750
|
autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
|
|
7719
7751
|
autoTopupAmountType: json["auto_topup_amount_type"] == null ? void 0 : json["auto_topup_amount_type"],
|
|
7720
7752
|
autoTopupAvailability: BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -7741,10 +7773,14 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7741
7773
|
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
7742
7774
|
id: json["id"],
|
|
7743
7775
|
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
7776
|
+
overdraftLimit: json["overdraft_limit"] == null ? void 0 : json["overdraft_limit"],
|
|
7744
7777
|
plan: json["plan"] == null ? void 0 : PreviewObjectResponseDataFromJSON(json["plan"]),
|
|
7745
7778
|
planId: json["plan_id"],
|
|
7746
7779
|
planName: json["plan_name"],
|
|
7747
7780
|
planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
|
|
7781
|
+
postpaidEnabled: json["postpaid_enabled"],
|
|
7782
|
+
postpaidRatePerUnit: json["postpaid_rate_per_unit"] == null ? void 0 : json["postpaid_rate_per_unit"],
|
|
7783
|
+
postpaidRatePerUnitDecimal: json["postpaid_rate_per_unit_decimal"] == null ? void 0 : json["postpaid_rate_per_unit_decimal"],
|
|
7748
7784
|
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON(json["reset_cadence"]),
|
|
7749
7785
|
resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON(json["reset_start"]),
|
|
7750
7786
|
resetType: json["reset_type"] == null ? void 0 : BillingPlanCreditGrantResetTypeFromJSON(json["reset_type"]),
|
|
@@ -8322,6 +8358,8 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8322
8358
|
return json;
|
|
8323
8359
|
}
|
|
8324
8360
|
return {
|
|
8361
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
8362
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
8325
8363
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
8326
8364
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
8327
8365
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -8339,6 +8377,10 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8339
8377
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
8340
8378
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
8341
8379
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
8380
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
8381
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
8382
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
8383
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
8342
8384
|
companyAutoTopupAmount: json["company_auto_topup_amount"] == null ? void 0 : json["company_auto_topup_amount"],
|
|
8343
8385
|
companyAutoTopupEnabled: json["company_auto_topup_enabled"] == null ? void 0 : json["company_auto_topup_enabled"],
|
|
8344
8386
|
companyAutoTopupThresholdCredits: json["company_auto_topup_threshold_credits"] == null ? void 0 : json["company_auto_topup_threshold_credits"],
|
|
@@ -8850,6 +8892,41 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8850
8892
|
};
|
|
8851
8893
|
}
|
|
8852
8894
|
|
|
8895
|
+
// src/api/checkoutexternal/models/CompanyInvoiceResponseData.ts
|
|
8896
|
+
function CompanyInvoiceResponseDataFromJSON(json) {
|
|
8897
|
+
return CompanyInvoiceResponseDataFromJSONTyped(json, false);
|
|
8898
|
+
}
|
|
8899
|
+
function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8900
|
+
if (json == null) {
|
|
8901
|
+
return json;
|
|
8902
|
+
}
|
|
8903
|
+
return {
|
|
8904
|
+
amountDue: json["amount_due"],
|
|
8905
|
+
createdAt: new Date(json["created_at"]),
|
|
8906
|
+
currency: json["currency"],
|
|
8907
|
+
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
8908
|
+
id: json["id"],
|
|
8909
|
+
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
8910
|
+
url: json["url"] == null ? void 0 : json["url"]
|
|
8911
|
+
};
|
|
8912
|
+
}
|
|
8913
|
+
|
|
8914
|
+
// src/api/checkoutexternal/models/CompanyInvoicesResponseData.ts
|
|
8915
|
+
function CompanyInvoicesResponseDataFromJSON(json) {
|
|
8916
|
+
return CompanyInvoicesResponseDataFromJSONTyped(json, false);
|
|
8917
|
+
}
|
|
8918
|
+
function CompanyInvoicesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8919
|
+
if (json == null) {
|
|
8920
|
+
return json;
|
|
8921
|
+
}
|
|
8922
|
+
return {
|
|
8923
|
+
count: json["count"],
|
|
8924
|
+
invoices: json["invoices"].map(
|
|
8925
|
+
CompanyInvoiceResponseDataFromJSON
|
|
8926
|
+
)
|
|
8927
|
+
};
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8853
8930
|
// src/api/checkoutexternal/models/CompanyOverrideNoteResponseData.ts
|
|
8854
8931
|
function CompanyOverrideNoteResponseDataFromJSON(json) {
|
|
8855
8932
|
return CompanyOverrideNoteResponseDataFromJSONTyped(json, false);
|
|
@@ -9340,6 +9417,8 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9340
9417
|
return json;
|
|
9341
9418
|
}
|
|
9342
9419
|
return {
|
|
9420
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
9421
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
9343
9422
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
9344
9423
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
9345
9424
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -9357,6 +9436,10 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9357
9436
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
9358
9437
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
9359
9438
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
9439
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
9440
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
9441
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
9442
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
9360
9443
|
companyCreditAmount: json["company_credit_amount"],
|
|
9361
9444
|
createdAt: new Date(json["created_at"]),
|
|
9362
9445
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
|
|
@@ -9849,6 +9932,7 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9849
9932
|
return json;
|
|
9850
9933
|
}
|
|
9851
9934
|
return {
|
|
9935
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
9852
9936
|
billingCreditBundleId: json["billing_credit_bundle_id"] == null ? void 0 : json["billing_credit_bundle_id"],
|
|
9853
9937
|
billingCreditId: json["billing_credit_id"],
|
|
9854
9938
|
companyId: json["company_id"],
|
|
@@ -9870,6 +9954,12 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9870
9954
|
planId: json["plan_id"] == null ? void 0 : json["plan_id"],
|
|
9871
9955
|
planName: json["plan_name"] == null ? void 0 : json["plan_name"],
|
|
9872
9956
|
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
9957
|
+
postpaidChargeAmount: json["postpaid_charge_amount"] == null ? void 0 : json["postpaid_charge_amount"],
|
|
9958
|
+
postpaidChargeCurrency: json["postpaid_charge_currency"] == null ? void 0 : json["postpaid_charge_currency"],
|
|
9959
|
+
postpaidChargedCredits: json["postpaid_charged_credits"] == null ? void 0 : json["postpaid_charged_credits"],
|
|
9960
|
+
postpaidPeriodEnd: json["postpaid_period_end"] == null ? void 0 : new Date(json["postpaid_period_end"]),
|
|
9961
|
+
postpaidRate: json["postpaid_rate"] == null ? void 0 : json["postpaid_rate"],
|
|
9962
|
+
postpaidRateDecimal: json["postpaid_rate_decimal"] == null ? void 0 : json["postpaid_rate_decimal"],
|
|
9873
9963
|
price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
|
|
9874
9964
|
quantity: json["quantity"],
|
|
9875
9965
|
quantityRemaining: json["quantity_remaining"],
|
|
@@ -10193,6 +10283,35 @@ function GetCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10193
10283
|
};
|
|
10194
10284
|
}
|
|
10195
10285
|
|
|
10286
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesParams.ts
|
|
10287
|
+
function GetCompanyInvoicesParamsFromJSON(json) {
|
|
10288
|
+
return GetCompanyInvoicesParamsFromJSONTyped(json, false);
|
|
10289
|
+
}
|
|
10290
|
+
function GetCompanyInvoicesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
10291
|
+
if (json == null) {
|
|
10292
|
+
return json;
|
|
10293
|
+
}
|
|
10294
|
+
return {
|
|
10295
|
+
includePending: json["include_pending"] == null ? void 0 : json["include_pending"],
|
|
10296
|
+
limit: json["limit"] == null ? void 0 : json["limit"],
|
|
10297
|
+
offset: json["offset"] == null ? void 0 : json["offset"]
|
|
10298
|
+
};
|
|
10299
|
+
}
|
|
10300
|
+
|
|
10301
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesResponse.ts
|
|
10302
|
+
function GetCompanyInvoicesResponseFromJSON(json) {
|
|
10303
|
+
return GetCompanyInvoicesResponseFromJSONTyped(json, false);
|
|
10304
|
+
}
|
|
10305
|
+
function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
10306
|
+
if (json == null) {
|
|
10307
|
+
return json;
|
|
10308
|
+
}
|
|
10309
|
+
return {
|
|
10310
|
+
data: CompanyInvoicesResponseDataFromJSON(json["data"]),
|
|
10311
|
+
params: GetCompanyInvoicesParamsFromJSON(json["params"])
|
|
10312
|
+
};
|
|
10313
|
+
}
|
|
10314
|
+
|
|
10196
10315
|
// src/api/checkoutexternal/models/GetCreditUsageByUserParams.ts
|
|
10197
10316
|
function GetCreditUsageByUserParamsFromJSON(json) {
|
|
10198
10317
|
return GetCreditUsageByUserParamsFromJSONTyped(json, false);
|
|
@@ -10803,6 +10922,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10803
10922
|
const response = await this.getCheckoutTaxIDRaw(initOverrides);
|
|
10804
10923
|
return await response.value();
|
|
10805
10924
|
}
|
|
10925
|
+
/**
|
|
10926
|
+
* Get company invoices
|
|
10927
|
+
*/
|
|
10928
|
+
async getCompanyInvoicesRaw(requestParameters, initOverrides) {
|
|
10929
|
+
const queryParameters = {};
|
|
10930
|
+
if (requestParameters["includePending"] != null) {
|
|
10931
|
+
queryParameters["include_pending"] = requestParameters["includePending"];
|
|
10932
|
+
}
|
|
10933
|
+
if (requestParameters["limit"] != null) {
|
|
10934
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
10935
|
+
}
|
|
10936
|
+
if (requestParameters["offset"] != null) {
|
|
10937
|
+
queryParameters["offset"] = requestParameters["offset"];
|
|
10938
|
+
}
|
|
10939
|
+
const headerParameters = {};
|
|
10940
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
10941
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
10942
|
+
"X-Schematic-Api-Key"
|
|
10943
|
+
);
|
|
10944
|
+
}
|
|
10945
|
+
const response = await this.request(
|
|
10946
|
+
{
|
|
10947
|
+
path: `/company/invoices`,
|
|
10948
|
+
method: "GET",
|
|
10949
|
+
headers: headerParameters,
|
|
10950
|
+
query: queryParameters
|
|
10951
|
+
},
|
|
10952
|
+
initOverrides
|
|
10953
|
+
);
|
|
10954
|
+
return new JSONApiResponse(
|
|
10955
|
+
response,
|
|
10956
|
+
(jsonValue) => GetCompanyInvoicesResponseFromJSON(jsonValue)
|
|
10957
|
+
);
|
|
10958
|
+
}
|
|
10959
|
+
/**
|
|
10960
|
+
* Get company invoices
|
|
10961
|
+
*/
|
|
10962
|
+
async getCompanyInvoices(requestParameters = {}, initOverrides) {
|
|
10963
|
+
const response = await this.getCompanyInvoicesRaw(
|
|
10964
|
+
requestParameters,
|
|
10965
|
+
initOverrides
|
|
10966
|
+
);
|
|
10967
|
+
return await response.value();
|
|
10968
|
+
}
|
|
10806
10969
|
/**
|
|
10807
10970
|
* Get credit usage by user
|
|
10808
10971
|
*/
|
|
@@ -11552,6 +11715,22 @@ var JSONApiResponse2 = class {
|
|
|
11552
11715
|
}
|
|
11553
11716
|
};
|
|
11554
11717
|
|
|
11718
|
+
// src/api/componentspublic/models/BillingArrearsAnchor.ts
|
|
11719
|
+
function BillingArrearsAnchorFromJSON2(json) {
|
|
11720
|
+
return BillingArrearsAnchorFromJSONTyped5(json, false);
|
|
11721
|
+
}
|
|
11722
|
+
function BillingArrearsAnchorFromJSONTyped5(json, ignoreDiscriminator) {
|
|
11723
|
+
return json;
|
|
11724
|
+
}
|
|
11725
|
+
|
|
11726
|
+
// src/api/componentspublic/models/BillingArrearsCadence.ts
|
|
11727
|
+
function BillingArrearsCadenceFromJSON2(json) {
|
|
11728
|
+
return BillingArrearsCadenceFromJSONTyped6(json, false);
|
|
11729
|
+
}
|
|
11730
|
+
function BillingArrearsCadenceFromJSONTyped6(json, ignoreDiscriminator) {
|
|
11731
|
+
return json;
|
|
11732
|
+
}
|
|
11733
|
+
|
|
11555
11734
|
// src/api/componentspublic/models/BillingCreditAutoTopupAvailability.ts
|
|
11556
11735
|
function BillingCreditAutoTopupAvailabilityFromJSON2(json) {
|
|
11557
11736
|
return BillingCreditAutoTopupAvailabilityFromJSONTyped5(json, false);
|
|
@@ -12529,6 +12708,8 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12529
12708
|
return json;
|
|
12530
12709
|
}
|
|
12531
12710
|
return {
|
|
12711
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON2(json["billing_credit_arrears_anchor"]),
|
|
12712
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON2(json["billing_credit_arrears_cadence"]),
|
|
12532
12713
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
12533
12714
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
12534
12715
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON2(
|
|
@@ -12546,6 +12727,10 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12546
12727
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
12547
12728
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
12548
12729
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
12730
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
12731
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
12732
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
12733
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
12549
12734
|
companyCreditAmount: json["company_credit_amount"],
|
|
12550
12735
|
createdAt: new Date(json["created_at"]),
|
|
12551
12736
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
|
|
@@ -12951,6 +13136,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
|
|
|
12951
13136
|
}
|
|
12952
13137
|
return cost;
|
|
12953
13138
|
}
|
|
13139
|
+
function calculateQuantityCost(billingPrice, quantity) {
|
|
13140
|
+
if (!billingPrice) {
|
|
13141
|
+
return 0;
|
|
13142
|
+
}
|
|
13143
|
+
if (isTieredPrice(billingPrice)) {
|
|
13144
|
+
return calculateTieredCost(
|
|
13145
|
+
quantity,
|
|
13146
|
+
billingPrice.priceTier,
|
|
13147
|
+
billingPrice.tiersMode
|
|
13148
|
+
);
|
|
13149
|
+
}
|
|
13150
|
+
return quantity * billingPrice.price;
|
|
13151
|
+
}
|
|
12954
13152
|
function getEntitlementCost(entitlement, period = "month", currency) {
|
|
12955
13153
|
const resolvedPeriod = period ?? "month";
|
|
12956
13154
|
const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
|
|
@@ -13737,6 +13935,18 @@ function buildCreditBundlesRequestBody(creditBundles) {
|
|
|
13737
13935
|
[]
|
|
13738
13936
|
);
|
|
13739
13937
|
}
|
|
13938
|
+
function isCreditOnlyCheckout(options) {
|
|
13939
|
+
const { plan, creditBundles, addOns, period, currency } = options;
|
|
13940
|
+
if (plan) {
|
|
13941
|
+
return false;
|
|
13942
|
+
}
|
|
13943
|
+
if (!creditBundles.some((bundle) => bundle.count > 0)) {
|
|
13944
|
+
return false;
|
|
13945
|
+
}
|
|
13946
|
+
return !addOns.some(
|
|
13947
|
+
(addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, currency)?.id
|
|
13948
|
+
);
|
|
13949
|
+
}
|
|
13740
13950
|
|
|
13741
13951
|
// src/utils/api/entitlement.ts
|
|
13742
13952
|
var PeriodName = {
|
|
@@ -14003,6 +14213,20 @@ function modifyDate(date, days) {
|
|
|
14003
14213
|
return copy3;
|
|
14004
14214
|
}
|
|
14005
14215
|
|
|
14216
|
+
// src/utils/debounce.ts
|
|
14217
|
+
var import_debounce = __toESM(require_debounce());
|
|
14218
|
+
function debounceByKey(fn, wait, settings) {
|
|
14219
|
+
const debouncedByKey = /* @__PURE__ */ new Map();
|
|
14220
|
+
return (key, ...args) => {
|
|
14221
|
+
let debounced = debouncedByKey.get(key);
|
|
14222
|
+
if (!debounced) {
|
|
14223
|
+
debounced = (0, import_debounce.default)(fn, wait, settings);
|
|
14224
|
+
debouncedByKey.set(key, debounced);
|
|
14225
|
+
}
|
|
14226
|
+
return debounced(key, ...args);
|
|
14227
|
+
};
|
|
14228
|
+
}
|
|
14229
|
+
|
|
14006
14230
|
// src/utils/string.ts
|
|
14007
14231
|
var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
14008
14232
|
"BIF",
|
|
@@ -15006,7 +15230,7 @@ var reducer = (state, action) => {
|
|
|
15006
15230
|
// src/context/EmbedProvider.tsx
|
|
15007
15231
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
15008
15232
|
var getCustomHeaders = (sessionId) => ({
|
|
15009
|
-
"X-Schematic-Components-Version": "2.25.
|
|
15233
|
+
"X-Schematic-Components-Version": "2.25.2",
|
|
15010
15234
|
"X-Schematic-Session-ID": sessionId
|
|
15011
15235
|
});
|
|
15012
15236
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -15117,7 +15341,7 @@ var EmbedProvider = ({
|
|
|
15117
15341
|
}
|
|
15118
15342
|
}, [publicApi]);
|
|
15119
15343
|
const debouncedHydratePublic = useMemo2(
|
|
15120
|
-
() => (0,
|
|
15344
|
+
() => (0, import_debounce2.default)(
|
|
15121
15345
|
hydratePublic,
|
|
15122
15346
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15123
15347
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15143,7 +15367,7 @@ var EmbedProvider = ({
|
|
|
15143
15367
|
}
|
|
15144
15368
|
}, [checkoutApi]);
|
|
15145
15369
|
const debouncedHydrate = useMemo2(
|
|
15146
|
-
() => (0,
|
|
15370
|
+
() => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15147
15371
|
[hydrate]
|
|
15148
15372
|
);
|
|
15149
15373
|
const hydrateComponent = useCallback2(
|
|
@@ -15170,7 +15394,7 @@ var EmbedProvider = ({
|
|
|
15170
15394
|
[checkoutApi]
|
|
15171
15395
|
);
|
|
15172
15396
|
const debouncedHydrateComponent = useMemo2(
|
|
15173
|
-
() => (0,
|
|
15397
|
+
() => (0, import_debounce2.default)(
|
|
15174
15398
|
hydrateComponent,
|
|
15175
15399
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15176
15400
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15194,7 +15418,7 @@ var EmbedProvider = ({
|
|
|
15194
15418
|
}
|
|
15195
15419
|
}, []);
|
|
15196
15420
|
const debouncedHydrateExternal = useMemo2(
|
|
15197
|
-
() => (0,
|
|
15421
|
+
() => (0, import_debounce2.default)(
|
|
15198
15422
|
hydrateExternal,
|
|
15199
15423
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15200
15424
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15205,7 +15429,7 @@ var EmbedProvider = ({
|
|
|
15205
15429
|
return checkoutApi?.createSetupIntent();
|
|
15206
15430
|
}, [checkoutApi]);
|
|
15207
15431
|
const debouncedCreateSetupIntent = useMemo2(
|
|
15208
|
-
() => (0,
|
|
15432
|
+
() => (0, import_debounce2.default)(
|
|
15209
15433
|
createSetupIntent,
|
|
15210
15434
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15211
15435
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15228,7 +15452,7 @@ var EmbedProvider = ({
|
|
|
15228
15452
|
[checkoutApi]
|
|
15229
15453
|
);
|
|
15230
15454
|
const debouncedUpdatePaymentMethod = useMemo2(
|
|
15231
|
-
() => (0,
|
|
15455
|
+
() => (0, import_debounce2.default)(
|
|
15232
15456
|
updatePaymentMethod,
|
|
15233
15457
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15234
15458
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15251,7 +15475,7 @@ var EmbedProvider = ({
|
|
|
15251
15475
|
[checkoutApi]
|
|
15252
15476
|
);
|
|
15253
15477
|
const debouncedDeletePaymentMethod = useMemo2(
|
|
15254
|
-
() => (0,
|
|
15478
|
+
() => (0, import_debounce2.default)(
|
|
15255
15479
|
deletePaymentMethod,
|
|
15256
15480
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15257
15481
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15274,7 +15498,7 @@ var EmbedProvider = ({
|
|
|
15274
15498
|
[checkoutApi]
|
|
15275
15499
|
);
|
|
15276
15500
|
const debouncedCheckout = useMemo2(
|
|
15277
|
-
() => (0,
|
|
15501
|
+
() => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15278
15502
|
[checkout]
|
|
15279
15503
|
);
|
|
15280
15504
|
const previewCheckout = useCallback2(
|
|
@@ -15294,7 +15518,7 @@ var EmbedProvider = ({
|
|
|
15294
15518
|
return response;
|
|
15295
15519
|
}, [checkoutApi]);
|
|
15296
15520
|
const debouncedUnsubscribe = useMemo2(
|
|
15297
|
-
() => (0,
|
|
15521
|
+
() => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15298
15522
|
[unsubscribe]
|
|
15299
15523
|
);
|
|
15300
15524
|
const updateCustomFieldValues = useCallback2(
|
|
@@ -15338,7 +15562,7 @@ var EmbedProvider = ({
|
|
|
15338
15562
|
[checkoutApi]
|
|
15339
15563
|
);
|
|
15340
15564
|
const debouncedGetUpcomingInvoice = useMemo2(
|
|
15341
|
-
() => (0,
|
|
15565
|
+
() => (0, import_debounce2.default)(
|
|
15342
15566
|
getUpcomingInvoice,
|
|
15343
15567
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15344
15568
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15349,7 +15573,7 @@ var EmbedProvider = ({
|
|
|
15349
15573
|
return checkoutApi?.fetchCustomerBalance();
|
|
15350
15574
|
}, [checkoutApi]);
|
|
15351
15575
|
const debouncedGetCustomerBalance = useMemo2(
|
|
15352
|
-
() => (0,
|
|
15576
|
+
() => (0, import_debounce2.default)(
|
|
15353
15577
|
getCustomerBalance,
|
|
15354
15578
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15355
15579
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15360,9 +15584,37 @@ var EmbedProvider = ({
|
|
|
15360
15584
|
return checkoutApi?.listInvoices();
|
|
15361
15585
|
}, [checkoutApi]);
|
|
15362
15586
|
const debouncedListInvoices = useMemo2(
|
|
15363
|
-
() => (0,
|
|
15587
|
+
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15364
15588
|
[listInvoices]
|
|
15365
15589
|
);
|
|
15590
|
+
const getCreditUsageByUser = useCallback2(
|
|
15591
|
+
async (billingCreditId, limit) => {
|
|
15592
|
+
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
15593
|
+
},
|
|
15594
|
+
[checkoutApi]
|
|
15595
|
+
);
|
|
15596
|
+
const debouncedGetCreditUsageByUser = useMemo2(
|
|
15597
|
+
() => debounceByKey(
|
|
15598
|
+
getCreditUsageByUser,
|
|
15599
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15600
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15601
|
+
),
|
|
15602
|
+
[getCreditUsageByUser]
|
|
15603
|
+
);
|
|
15604
|
+
const getFeatureUsageByUser = useCallback2(
|
|
15605
|
+
async (featureId, limit) => {
|
|
15606
|
+
return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
|
|
15607
|
+
},
|
|
15608
|
+
[checkoutApi]
|
|
15609
|
+
);
|
|
15610
|
+
const debouncedGetFeatureUsageByUser = useMemo2(
|
|
15611
|
+
() => debounceByKey(
|
|
15612
|
+
getFeatureUsageByUser,
|
|
15613
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15614
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15615
|
+
),
|
|
15616
|
+
[getFeatureUsageByUser]
|
|
15617
|
+
);
|
|
15366
15618
|
const setError = useCallback2(
|
|
15367
15619
|
(error) => {
|
|
15368
15620
|
debug(error.message);
|
|
@@ -15528,6 +15780,8 @@ var EmbedProvider = ({
|
|
|
15528
15780
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
15529
15781
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
15530
15782
|
listInvoices: debouncedListInvoices,
|
|
15783
|
+
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
15784
|
+
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
15531
15785
|
finishCheckout,
|
|
15532
15786
|
setError,
|
|
15533
15787
|
setAccessToken,
|
|
@@ -16926,7 +17180,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
|
|
|
16926
17180
|
`;
|
|
16927
17181
|
|
|
16928
17182
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
16929
|
-
var
|
|
17183
|
+
var import_debounce3 = __toESM(require_debounce());
|
|
16930
17184
|
import {
|
|
16931
17185
|
cloneElement as cloneElement2,
|
|
16932
17186
|
useCallback as useCallback7,
|
|
@@ -17116,7 +17370,7 @@ var Tooltip = ({
|
|
|
17116
17370
|
}, [portal, position2]);
|
|
17117
17371
|
useLayoutEffect3(() => {
|
|
17118
17372
|
updateCoords();
|
|
17119
|
-
const handleResize = (0,
|
|
17373
|
+
const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
|
|
17120
17374
|
window.addEventListener("resize", handleResize);
|
|
17121
17375
|
window.addEventListener("scroll", handleResize, true);
|
|
17122
17376
|
return () => {
|
|
@@ -17273,7 +17527,7 @@ var Root = forwardRef6(
|
|
|
17273
17527
|
Root.displayName = "Root";
|
|
17274
17528
|
|
|
17275
17529
|
// src/components/layout/viewport/Viewport.tsx
|
|
17276
|
-
var
|
|
17530
|
+
var import_debounce5 = __toESM(require_debounce());
|
|
17277
17531
|
import { forwardRef as forwardRef8, useLayoutEffect as useLayoutEffect8, useRef as useRef11, useState as useState16 } from "react";
|
|
17278
17532
|
import { createPortal as createPortal3 } from "react-dom";
|
|
17279
17533
|
|
|
@@ -18221,11 +18475,10 @@ var Quantity = ({
|
|
|
18221
18475
|
children: [
|
|
18222
18476
|
/* @__PURE__ */ jsx20(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs11(Text, { children: [
|
|
18223
18477
|
formatCurrency(
|
|
18224
|
-
|
|
18225
|
-
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
) : (price ?? 0) * entitlement.quantity,
|
|
18478
|
+
calculateQuantityCost(
|
|
18479
|
+
entitlementBillingPrice,
|
|
18480
|
+
entitlement.quantity
|
|
18481
|
+
),
|
|
18229
18482
|
currency
|
|
18230
18483
|
),
|
|
18231
18484
|
/* @__PURE__ */ jsxs11("sub", { children: [
|
|
@@ -19102,7 +19355,7 @@ var Checkout = ({
|
|
|
19102
19355
|
};
|
|
19103
19356
|
|
|
19104
19357
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
19105
|
-
var
|
|
19358
|
+
var import_debounce4 = __toESM(require_debounce());
|
|
19106
19359
|
import {
|
|
19107
19360
|
useCallback as useCallback8,
|
|
19108
19361
|
useEffect as useEffect4,
|
|
@@ -19429,48 +19682,26 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19429
19682
|
bundleCounts
|
|
19430
19683
|
);
|
|
19431
19684
|
}, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
|
|
19432
|
-
const selectedPlanPriceId = useMemo15(() => {
|
|
19433
|
-
if (!selectedPlan) {
|
|
19434
|
-
return void 0;
|
|
19435
|
-
}
|
|
19436
|
-
const currencyPrice = getPlanPrice(
|
|
19437
|
-
selectedPlan,
|
|
19438
|
-
planPeriod,
|
|
19439
|
-
{ useSelectedPeriod: true },
|
|
19440
|
-
hasCurrency ? effectiveCurrency : void 0
|
|
19441
|
-
);
|
|
19442
|
-
return currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan.yearlyPrice?.id : planPeriod === "quarter" ? selectedPlan.quarterlyPrice?.id : selectedPlan.monthlyPrice?.id);
|
|
19443
|
-
}, [selectedPlan, planPeriod, hasCurrency, effectiveCurrency]);
|
|
19444
19685
|
const [hasInitialPaymentMethod] = useState9(
|
|
19445
19686
|
() => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
|
|
19446
19687
|
);
|
|
19447
|
-
const isCreditOnlyPurchase = useMemo15(
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
|
|
19451
|
-
|
|
19452
|
-
|
|
19453
|
-
|
|
19454
|
-
|
|
19455
|
-
|
|
19456
|
-
|
|
19457
|
-
|
|
19458
|
-
|
|
19459
|
-
|
|
19460
|
-
|
|
19461
|
-
|
|
19462
|
-
|
|
19463
|
-
|
|
19464
|
-
return !hasPaidAddOn;
|
|
19465
|
-
}, [
|
|
19466
|
-
data?.company?.billingSubscription,
|
|
19467
|
-
selectedPlanPriceId,
|
|
19468
|
-
creditBundles,
|
|
19469
|
-
addOns,
|
|
19470
|
-
planPeriod,
|
|
19471
|
-
hasCurrency,
|
|
19472
|
-
effectiveCurrency
|
|
19473
|
-
]);
|
|
19688
|
+
const isCreditOnlyPurchase = useMemo15(
|
|
19689
|
+
() => isCreditOnlyCheckout({
|
|
19690
|
+
plan: selectedPlan,
|
|
19691
|
+
creditBundles,
|
|
19692
|
+
addOns,
|
|
19693
|
+
period: planPeriod,
|
|
19694
|
+
currency: hasCurrency ? effectiveCurrency : void 0
|
|
19695
|
+
}),
|
|
19696
|
+
[
|
|
19697
|
+
selectedPlan,
|
|
19698
|
+
creditBundles,
|
|
19699
|
+
addOns,
|
|
19700
|
+
planPeriod,
|
|
19701
|
+
hasCurrency,
|
|
19702
|
+
effectiveCurrency
|
|
19703
|
+
]
|
|
19704
|
+
);
|
|
19474
19705
|
const [usageBasedEntitlements, setUsageBasedEntitlements] = useState9(
|
|
19475
19706
|
() => applyPrefilledQuantities(
|
|
19476
19707
|
(selectedPlan?.entitlements || []).reduce(
|
|
@@ -19765,9 +19996,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19765
19996
|
updates.creditBundles || creditBundles,
|
|
19766
19997
|
plan?.id ?? data?.company?.plan?.id
|
|
19767
19998
|
);
|
|
19768
|
-
const isCreditOnly =
|
|
19769
|
-
|
|
19770
|
-
|
|
19999
|
+
const isCreditOnly = isCreditOnlyCheckout({
|
|
20000
|
+
plan,
|
|
20001
|
+
creditBundles: resolvedCreditBundles,
|
|
20002
|
+
addOns: updates.addOns || addOns,
|
|
20003
|
+
period,
|
|
20004
|
+
currency: resolvedCurrency
|
|
20005
|
+
});
|
|
19771
20006
|
if ((!plan || !planPriceId) && !isCreditOnly) {
|
|
19772
20007
|
++previewRequestIdRef.current;
|
|
19773
20008
|
setError(void 0);
|
|
@@ -19907,7 +20142,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19907
20142
|
addOnCompatibilityLookup,
|
|
19908
20143
|
data?.company?.plan?.id,
|
|
19909
20144
|
data?.company?.plan?.includedCreditGrants,
|
|
19910
|
-
data?.company?.billingSubscription,
|
|
19911
20145
|
previewCheckout,
|
|
19912
20146
|
planPeriod,
|
|
19913
20147
|
selectedPlan,
|
|
@@ -19930,7 +20164,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19930
20164
|
}, [handlePreviewCheckout]);
|
|
19931
20165
|
const debouncedPreviewCheckoutRef = useRef6(null);
|
|
19932
20166
|
useEffect4(() => {
|
|
19933
|
-
const debounced = (0,
|
|
20167
|
+
const debounced = (0, import_debounce4.default)(
|
|
19934
20168
|
(updates) => handlePreviewCheckoutRef.current(updates),
|
|
19935
20169
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
19936
20170
|
TRAILING_DEBOUNCE_SETTINGS
|
|
@@ -22053,6 +22287,29 @@ var EntitlementRow = (props) => {
|
|
|
22053
22287
|
tiersMode
|
|
22054
22288
|
} = entitlementPrice || {};
|
|
22055
22289
|
const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
|
|
22290
|
+
const tierLabel = /* @__PURE__ */ jsxs30(
|
|
22291
|
+
Text,
|
|
22292
|
+
{
|
|
22293
|
+
style: { opacity: 0.54 },
|
|
22294
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22295
|
+
$color: settings.theme.typography.text.color,
|
|
22296
|
+
children: [
|
|
22297
|
+
t4("Tier-based"),
|
|
22298
|
+
/* @__PURE__ */ jsx41(
|
|
22299
|
+
PricingTiersTooltip,
|
|
22300
|
+
{
|
|
22301
|
+
portal,
|
|
22302
|
+
feature,
|
|
22303
|
+
period: planPeriod,
|
|
22304
|
+
currency,
|
|
22305
|
+
priceTiers,
|
|
22306
|
+
tiersMode: tiersMode ?? void 0,
|
|
22307
|
+
position: "left"
|
|
22308
|
+
}
|
|
22309
|
+
)
|
|
22310
|
+
]
|
|
22311
|
+
}
|
|
22312
|
+
);
|
|
22056
22313
|
return /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22057
22314
|
/* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22058
22315
|
quantity,
|
|
@@ -22063,13 +22320,24 @@ var EntitlementRow = (props) => {
|
|
|
22063
22320
|
" ",
|
|
22064
22321
|
getFeatureName(feature, softLimit)
|
|
22065
22322
|
] }) : feature.name }) }),
|
|
22066
|
-
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22323
|
+
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22324
|
+
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
22325
|
+
// quantity, so the row shows it alongside the tier breakdown
|
|
22326
|
+
// rather than leaving the charge unpriced.
|
|
22327
|
+
/* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
|
|
22328
|
+
/* @__PURE__ */ jsxs30(Text, { children: [
|
|
22329
|
+
formatCurrency(
|
|
22330
|
+
calculateQuantityCost(entitlementPrice, quantity),
|
|
22331
|
+
currency
|
|
22332
|
+
),
|
|
22333
|
+
/* @__PURE__ */ jsxs30("sub", { children: [
|
|
22334
|
+
"/",
|
|
22335
|
+
shortenPeriod(planPeriod)
|
|
22336
|
+
] })
|
|
22337
|
+
] }),
|
|
22338
|
+
tiered && tierLabel
|
|
22071
22339
|
] })
|
|
22072
|
-
|
|
22340
|
+
) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs30(Text, { children: [
|
|
22073
22341
|
priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22074
22342
|
t4("then"),
|
|
22075
22343
|
" "
|
|
@@ -22087,29 +22355,7 @@ var EntitlementRow = (props) => {
|
|
|
22087
22355
|
shortenPeriod(planPeriod)
|
|
22088
22356
|
] })
|
|
22089
22357
|
] })
|
|
22090
|
-
] }) :
|
|
22091
|
-
Text,
|
|
22092
|
-
{
|
|
22093
|
-
style: { opacity: 0.54 },
|
|
22094
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22095
|
-
$color: settings.theme.typography.text.color,
|
|
22096
|
-
children: [
|
|
22097
|
-
t4("Tier-based"),
|
|
22098
|
-
/* @__PURE__ */ jsx41(
|
|
22099
|
-
PricingTiersTooltip,
|
|
22100
|
-
{
|
|
22101
|
-
portal,
|
|
22102
|
-
feature,
|
|
22103
|
-
period: planPeriod,
|
|
22104
|
-
currency,
|
|
22105
|
-
priceTiers,
|
|
22106
|
-
tiersMode: tiersMode ?? void 0,
|
|
22107
|
-
position: "left"
|
|
22108
|
-
}
|
|
22109
|
-
)
|
|
22110
|
-
]
|
|
22111
|
-
}
|
|
22112
|
-
) })
|
|
22358
|
+
] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
|
|
22113
22359
|
] });
|
|
22114
22360
|
}
|
|
22115
22361
|
};
|
|
@@ -22305,12 +22551,18 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22305
22551
|
}, 0);
|
|
22306
22552
|
total += addOnCost;
|
|
22307
22553
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
22308
|
-
(sum, entitlement) => sum +
|
|
22554
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22555
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22556
|
+
entitlement.quantity
|
|
22557
|
+
),
|
|
22309
22558
|
0
|
|
22310
22559
|
);
|
|
22311
22560
|
total += payInAdvanceCost;
|
|
22312
22561
|
const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
|
|
22313
|
-
(sum, entitlement) => sum +
|
|
22562
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22563
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22564
|
+
entitlement.quantity
|
|
22565
|
+
),
|
|
22314
22566
|
0
|
|
22315
22567
|
);
|
|
22316
22568
|
total += addOnPayInAdvanceCost;
|
|
@@ -23773,7 +24025,7 @@ var Viewport = forwardRef8(
|
|
|
23773
24025
|
const [top, setTop] = useState16(0);
|
|
23774
24026
|
useLayoutEffect8(() => {
|
|
23775
24027
|
const element = portalRef.current;
|
|
23776
|
-
const setModalY = (0,
|
|
24028
|
+
const setModalY = (0, import_debounce5.default)(() => {
|
|
23777
24029
|
const value = Math.abs(
|
|
23778
24030
|
(element === document.body ? window.scrollY : element.scrollTop) ?? 0
|
|
23779
24031
|
);
|
|
@@ -24487,7 +24739,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
24487
24739
|
Invoices.displayName = "Invoices";
|
|
24488
24740
|
|
|
24489
24741
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24490
|
-
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as
|
|
24742
|
+
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo28, useRef as useRef12, useState as useState19 } from "react";
|
|
24491
24743
|
|
|
24492
24744
|
// src/components/elements/metered-features/Meter.tsx
|
|
24493
24745
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
@@ -24615,6 +24867,190 @@ var PriceDetails = ({
|
|
|
24615
24867
|
);
|
|
24616
24868
|
};
|
|
24617
24869
|
|
|
24870
|
+
// src/components/elements/metered-features/UsageByUser.tsx
|
|
24871
|
+
import { useEffect as useEffect7, useMemo as useMemo27, useState as useState18 } from "react";
|
|
24872
|
+
import { jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
24873
|
+
var COLLAPSED_COUNT = 3;
|
|
24874
|
+
var EXPANDED_COUNT = 20;
|
|
24875
|
+
var toCreditSection = (data) => ({
|
|
24876
|
+
entries: data.entries.map((entry) => ({
|
|
24877
|
+
id: entry.userId,
|
|
24878
|
+
// An entry with no hydrated user record still has an id worth showing —
|
|
24879
|
+
// a blank row identifies nobody.
|
|
24880
|
+
label: entry.user?.name || entry.userId || "",
|
|
24881
|
+
amount: entry.creditsUsed
|
|
24882
|
+
})),
|
|
24883
|
+
total: data.total,
|
|
24884
|
+
totalUsers: data.totalUsers,
|
|
24885
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
|
|
24886
|
+
});
|
|
24887
|
+
var toFeatureSection = (data) => ({
|
|
24888
|
+
entries: data.rows.map((row) => ({
|
|
24889
|
+
id: row.userId,
|
|
24890
|
+
label: row.user?.name || row.userId || "",
|
|
24891
|
+
amount: row.value
|
|
24892
|
+
})),
|
|
24893
|
+
total: data.total,
|
|
24894
|
+
totalUsers: data.totalUsers,
|
|
24895
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
|
|
24896
|
+
});
|
|
24897
|
+
var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
|
|
24898
|
+
var InitialAvatar = ({ label }) => {
|
|
24899
|
+
const { settings } = useEmbed();
|
|
24900
|
+
const isLightBackground = useIsLightBackground();
|
|
24901
|
+
const initial = (label.trim()[0] ?? "?").toUpperCase();
|
|
24902
|
+
return /* @__PURE__ */ jsx55(
|
|
24903
|
+
Flex,
|
|
24904
|
+
{
|
|
24905
|
+
$alignItems: "center",
|
|
24906
|
+
$justifyContent: "center",
|
|
24907
|
+
$width: "1.75rem",
|
|
24908
|
+
$height: "1.75rem",
|
|
24909
|
+
$flexShrink: 0,
|
|
24910
|
+
$borderRadius: "9999px",
|
|
24911
|
+
$background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
|
|
24912
|
+
children: /* @__PURE__ */ jsx55(
|
|
24913
|
+
Text,
|
|
24914
|
+
{
|
|
24915
|
+
$size: 11,
|
|
24916
|
+
$weight: 500,
|
|
24917
|
+
$color: settings.theme.typography.text.color,
|
|
24918
|
+
children: initial
|
|
24919
|
+
}
|
|
24920
|
+
)
|
|
24921
|
+
}
|
|
24922
|
+
);
|
|
24923
|
+
};
|
|
24924
|
+
var UsageByUser = ({ source, unit }) => {
|
|
24925
|
+
const { t: t4 } = useTranslation();
|
|
24926
|
+
const isLightBackground = useIsLightBackground();
|
|
24927
|
+
const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
|
|
24928
|
+
const [expanded, setExpanded] = useState18(false);
|
|
24929
|
+
const [result, setResult] = useState18();
|
|
24930
|
+
const [attempt, setAttempt] = useState18(0);
|
|
24931
|
+
const { kind, id } = source;
|
|
24932
|
+
const sourceKey = `${kind}:${id}`;
|
|
24933
|
+
const current = result?.sourceKey === sourceKey ? result : void 0;
|
|
24934
|
+
useEffect7(() => {
|
|
24935
|
+
let active = true;
|
|
24936
|
+
const apply = (next2) => {
|
|
24937
|
+
if (active) {
|
|
24938
|
+
setResult(next2);
|
|
24939
|
+
}
|
|
24940
|
+
};
|
|
24941
|
+
const receive = (section) => {
|
|
24942
|
+
if (section) {
|
|
24943
|
+
apply({ sourceKey, section });
|
|
24944
|
+
}
|
|
24945
|
+
};
|
|
24946
|
+
const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
|
|
24947
|
+
if (kind === "credit") {
|
|
24948
|
+
getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
24949
|
+
(response) => receive(response && toCreditSection(response.data))
|
|
24950
|
+
).catch(fail);
|
|
24951
|
+
} else {
|
|
24952
|
+
getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
24953
|
+
(response) => receive(response && toFeatureSection(response.data))
|
|
24954
|
+
).catch(fail);
|
|
24955
|
+
}
|
|
24956
|
+
return () => {
|
|
24957
|
+
active = false;
|
|
24958
|
+
};
|
|
24959
|
+
}, [
|
|
24960
|
+
attempt,
|
|
24961
|
+
getCreditUsageByUser,
|
|
24962
|
+
getFeatureUsageByUser,
|
|
24963
|
+
id,
|
|
24964
|
+
kind,
|
|
24965
|
+
sourceKey
|
|
24966
|
+
]);
|
|
24967
|
+
const entries = current?.section?.entries;
|
|
24968
|
+
const attributed = useMemo27(
|
|
24969
|
+
() => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
|
|
24970
|
+
[entries]
|
|
24971
|
+
);
|
|
24972
|
+
const error = current?.error;
|
|
24973
|
+
const total = current?.section?.total ?? 0;
|
|
24974
|
+
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
24975
|
+
const unattributed = current?.section?.unattributed;
|
|
24976
|
+
const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
|
|
24977
|
+
if (error) {
|
|
24978
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
24979
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
24980
|
+
/* @__PURE__ */ jsx55(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
|
|
24981
|
+
/* @__PURE__ */ jsx55(
|
|
24982
|
+
Button,
|
|
24983
|
+
{
|
|
24984
|
+
type: "button",
|
|
24985
|
+
onClick: () => setAttempt((prev2) => prev2 + 1),
|
|
24986
|
+
$size: "sm",
|
|
24987
|
+
$variant: "ghost",
|
|
24988
|
+
$fullWidth: false,
|
|
24989
|
+
children: t4("Try again")
|
|
24990
|
+
}
|
|
24991
|
+
)
|
|
24992
|
+
] });
|
|
24993
|
+
}
|
|
24994
|
+
if (attributed.length === 0 && !unattributed) {
|
|
24995
|
+
return null;
|
|
24996
|
+
}
|
|
24997
|
+
const visible = attributed.slice(
|
|
24998
|
+
0,
|
|
24999
|
+
expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
|
|
25000
|
+
);
|
|
25001
|
+
const remaining = Math.max(totalUsers - visible.length, 0);
|
|
25002
|
+
const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
|
|
25003
|
+
const hiddenUsers = Math.max(
|
|
25004
|
+
expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
|
|
25005
|
+
0
|
|
25006
|
+
);
|
|
25007
|
+
const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
|
|
25008
|
+
const expandLabel = totalUsers > EXPANDED_COUNT ? t4("Show top X users", { count: EXPANDED_COUNT }) : hiddenUsers > 0 ? t4("Show all X users", { count: totalUsers }) : t4("Show all");
|
|
25009
|
+
const row = (key, label, amount, muted) => /* @__PURE__ */ jsxs41(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
|
|
25010
|
+
/* @__PURE__ */ jsx55(InitialAvatar, { label: muted ? "?" : label }),
|
|
25011
|
+
/* @__PURE__ */ jsx55(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ jsx55(
|
|
25012
|
+
Text,
|
|
25013
|
+
{
|
|
25014
|
+
display: "text",
|
|
25015
|
+
$color: muted ? mutedColor(isLightBackground) : void 0,
|
|
25016
|
+
children: label
|
|
25017
|
+
}
|
|
25018
|
+
) }),
|
|
25019
|
+
/* @__PURE__ */ jsx55(
|
|
25020
|
+
Text,
|
|
25021
|
+
{
|
|
25022
|
+
display: "text",
|
|
25023
|
+
$align: "right",
|
|
25024
|
+
$color: mutedColor(isLightBackground),
|
|
25025
|
+
children: formatAmount(amount)
|
|
25026
|
+
}
|
|
25027
|
+
)
|
|
25028
|
+
] }, key);
|
|
25029
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
25030
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25031
|
+
/* @__PURE__ */ jsx55(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
|
|
25032
|
+
amount: formatAmount(total)
|
|
25033
|
+
}) }) }),
|
|
25034
|
+
visible.map(
|
|
25035
|
+
(entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
|
|
25036
|
+
),
|
|
25037
|
+
expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
|
|
25038
|
+
expanded && remaining > 0 && /* @__PURE__ */ jsx55(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("plus X more", { count: remaining }) }) }),
|
|
25039
|
+
shouldShowToggle && /* @__PURE__ */ jsx55(
|
|
25040
|
+
ExpandListToggle,
|
|
25041
|
+
{
|
|
25042
|
+
isExpanded: expanded,
|
|
25043
|
+
onToggle: () => setExpanded((prev2) => !prev2),
|
|
25044
|
+
expandLabel,
|
|
25045
|
+
collapseLabel: t4("Show fewer"),
|
|
25046
|
+
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
|
|
25047
|
+
$marginTop: "0.25rem"
|
|
25048
|
+
}
|
|
25049
|
+
)
|
|
25050
|
+
] });
|
|
25051
|
+
};
|
|
25052
|
+
UsageByUser.displayName = "UsageByUser";
|
|
25053
|
+
|
|
24618
25054
|
// src/components/elements/metered-features/styles.ts
|
|
24619
25055
|
var Container2 = gt.div`
|
|
24620
25056
|
display: flex;
|
|
@@ -24633,7 +25069,7 @@ var Container2 = gt.div`
|
|
|
24633
25069
|
`;
|
|
24634
25070
|
|
|
24635
25071
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24636
|
-
import { Fragment as Fragment23, jsx as
|
|
25072
|
+
import { Fragment as Fragment23, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
24637
25073
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
24638
25074
|
const { t: t4 } = useTranslation();
|
|
24639
25075
|
const { data } = useEmbed();
|
|
@@ -24670,9 +25106,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
24670
25106
|
})
|
|
24671
25107
|
);
|
|
24672
25108
|
}
|
|
24673
|
-
return /* @__PURE__ */
|
|
25109
|
+
return /* @__PURE__ */ jsxs42(Text, { display: fontStyle, children: [
|
|
24674
25110
|
acc.join(" \u2022 "),
|
|
24675
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
25111
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx56(
|
|
24676
25112
|
HardLimitTooltip,
|
|
24677
25113
|
{
|
|
24678
25114
|
feature: entitlement.feature,
|
|
@@ -24702,6 +25138,9 @@ function resolveDesignProps4(props) {
|
|
|
24702
25138
|
isVisible: props.usage?.isVisible ?? true,
|
|
24703
25139
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
24704
25140
|
},
|
|
25141
|
+
usageByUser: {
|
|
25142
|
+
isVisible: props.usageByUser?.isVisible ?? true
|
|
25143
|
+
},
|
|
24705
25144
|
// there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
|
|
24706
25145
|
visibleFeatures: props.visibleFeatures
|
|
24707
25146
|
};
|
|
@@ -24714,7 +25153,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24714
25153
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
24715
25154
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
24716
25155
|
const isLightBackground = useIsLightBackground();
|
|
24717
|
-
const meteredFeatures =
|
|
25156
|
+
const meteredFeatures = useMemo28(() => {
|
|
24718
25157
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
24719
25158
|
(acc, id) => {
|
|
24720
25159
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -24731,7 +25170,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24731
25170
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
24732
25171
|
);
|
|
24733
25172
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
24734
|
-
const creditGroups =
|
|
25173
|
+
const creditGroups = useMemo28(
|
|
24735
25174
|
() => withEmptyPlanCreditBalances(
|
|
24736
25175
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
24737
25176
|
listPlanCredits(
|
|
@@ -24742,7 +25181,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24742
25181
|
),
|
|
24743
25182
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
24744
25183
|
);
|
|
24745
|
-
const planCreditCompositions =
|
|
25184
|
+
const planCreditCompositions = useMemo28(
|
|
24746
25185
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
24747
25186
|
[data?.company?.plan?.includedCreditGrants]
|
|
24748
25187
|
);
|
|
@@ -24756,14 +25195,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24756
25195
|
},
|
|
24757
25196
|
[data?.featureUsage?.features]
|
|
24758
25197
|
);
|
|
24759
|
-
const purchasableCreditIds =
|
|
25198
|
+
const purchasableCreditIds = useMemo28(
|
|
24760
25199
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
24761
25200
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
24762
25201
|
);
|
|
24763
|
-
const [expandedCreditIds, setExpandedCreditIds] =
|
|
25202
|
+
const [expandedCreditIds, setExpandedCreditIds] = useState19(
|
|
24764
25203
|
() => /* @__PURE__ */ new Set()
|
|
24765
25204
|
);
|
|
24766
|
-
const [fullLedgerCreditIds, setFullLedgerCreditIds] =
|
|
25205
|
+
const [fullLedgerCreditIds, setFullLedgerCreditIds] = useState19(
|
|
24767
25206
|
() => /* @__PURE__ */ new Set()
|
|
24768
25207
|
);
|
|
24769
25208
|
const toggleFullLedger = useCallback14((id) => {
|
|
@@ -24803,7 +25242,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24803
25242
|
const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
|
|
24804
25243
|
const canCheckout = data?.capabilities?.checkout ?? false;
|
|
24805
25244
|
const showCredits = data?.displaySettings?.showCredits ?? true;
|
|
24806
|
-
return /* @__PURE__ */
|
|
25245
|
+
return /* @__PURE__ */ jsxs42(Container2, { ref, className, children: [
|
|
24807
25246
|
meteredFeatures.reduce((acc, entitlement, index) => {
|
|
24808
25247
|
if (!entitlement.feature) {
|
|
24809
25248
|
return acc;
|
|
@@ -24814,9 +25253,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24814
25253
|
});
|
|
24815
25254
|
const { limit } = usageDetails;
|
|
24816
25255
|
acc.push(
|
|
24817
|
-
/* @__PURE__ */
|
|
24818
|
-
/* @__PURE__ */
|
|
24819
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25256
|
+
/* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
25257
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25258
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
24820
25259
|
Icon3,
|
|
24821
25260
|
{
|
|
24822
25261
|
name: feature.icon,
|
|
@@ -24825,8 +25264,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24825
25264
|
rounded: true
|
|
24826
25265
|
}
|
|
24827
25266
|
),
|
|
24828
|
-
/* @__PURE__ */
|
|
24829
|
-
/* @__PURE__ */
|
|
25267
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25268
|
+
/* @__PURE__ */ jsxs42(
|
|
24830
25269
|
Flex,
|
|
24831
25270
|
{
|
|
24832
25271
|
ref: (el) => {
|
|
@@ -24837,31 +25276,31 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24837
25276
|
$flexWrap: "wrap",
|
|
24838
25277
|
$gap: "1rem",
|
|
24839
25278
|
children: [
|
|
24840
|
-
/* @__PURE__ */
|
|
24841
|
-
/* @__PURE__ */
|
|
24842
|
-
props.description.isVisible && feature.description && /* @__PURE__ */
|
|
25279
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25280
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
25281
|
+
props.description.isVisible && feature.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
24843
25282
|
] }),
|
|
24844
|
-
/* @__PURE__ */
|
|
25283
|
+
/* @__PURE__ */ jsxs42(
|
|
24845
25284
|
Box,
|
|
24846
25285
|
{
|
|
24847
25286
|
$flexBasis: "min-content",
|
|
24848
25287
|
$flexGrow: 1,
|
|
24849
25288
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
24850
25289
|
children: [
|
|
24851
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
24852
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
25290
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25291
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
24853
25292
|
formatNumber(limit),
|
|
24854
25293
|
" "
|
|
24855
25294
|
] }),
|
|
24856
25295
|
getFeatureName(feature, limit)
|
|
24857
|
-
] }) : typeof usage === "number" && /* @__PURE__ */
|
|
25296
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
24858
25297
|
formatNumber(usage),
|
|
24859
25298
|
" ",
|
|
24860
25299
|
getFeatureName(feature, usage),
|
|
24861
25300
|
" ",
|
|
24862
25301
|
t4("used")
|
|
24863
25302
|
] }) }) }),
|
|
24864
|
-
props.allocation.isVisible && /* @__PURE__ */
|
|
25303
|
+
props.allocation.isVisible && /* @__PURE__ */ jsx56(
|
|
24865
25304
|
Limit,
|
|
24866
25305
|
{
|
|
24867
25306
|
entitlement,
|
|
@@ -24875,8 +25314,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24875
25314
|
]
|
|
24876
25315
|
}
|
|
24877
25316
|
),
|
|
24878
|
-
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */
|
|
24879
|
-
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
25317
|
+
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ jsx56(Meter, { entitlement }),
|
|
25318
|
+
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsx56(
|
|
24880
25319
|
Button,
|
|
24881
25320
|
{
|
|
24882
25321
|
type: "button",
|
|
@@ -24889,13 +25328,24 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24889
25328
|
)
|
|
24890
25329
|
] })
|
|
24891
25330
|
] }),
|
|
24892
|
-
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */
|
|
25331
|
+
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ jsx56(
|
|
24893
25332
|
PriceDetails,
|
|
24894
25333
|
{
|
|
24895
25334
|
entitlement,
|
|
24896
25335
|
usageDetails,
|
|
24897
25336
|
period
|
|
24898
25337
|
}
|
|
25338
|
+
),
|
|
25339
|
+
props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
|
|
25340
|
+
// they are denominated in the feature's own unit — the same one
|
|
25341
|
+
// the usage line above uses. A credit-burndown feature's credit
|
|
25342
|
+
// spend is broken down separately, under its credit.
|
|
25343
|
+
/* @__PURE__ */ jsx56(
|
|
25344
|
+
UsageByUser,
|
|
25345
|
+
{
|
|
25346
|
+
source: { kind: "feature", id: feature.id },
|
|
25347
|
+
unit: feature
|
|
25348
|
+
}
|
|
24899
25349
|
)
|
|
24900
25350
|
] }, index)
|
|
24901
25351
|
);
|
|
@@ -24909,9 +25359,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24909
25359
|
const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
|
|
24910
25360
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
24911
25361
|
const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
|
|
24912
|
-
return /* @__PURE__ */
|
|
24913
|
-
/* @__PURE__ */
|
|
24914
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25362
|
+
return /* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
25363
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25364
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
24915
25365
|
Icon3,
|
|
24916
25366
|
{
|
|
24917
25367
|
name: credit.icon,
|
|
@@ -24920,13 +25370,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24920
25370
|
rounded: true
|
|
24921
25371
|
}
|
|
24922
25372
|
),
|
|
24923
|
-
/* @__PURE__ */
|
|
24924
|
-
/* @__PURE__ */
|
|
24925
|
-
/* @__PURE__ */
|
|
24926
|
-
props.description.isVisible && credit.description && /* @__PURE__ */
|
|
25373
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25374
|
+
/* @__PURE__ */ jsx56(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25375
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
25376
|
+
props.description.isVisible && credit.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
24927
25377
|
] }) }),
|
|
24928
|
-
/* @__PURE__ */
|
|
24929
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
25378
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1rem", $alignItems: "center", children: [
|
|
25379
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
|
|
24930
25380
|
// Balances burn at rates with up to 10 decimal
|
|
24931
25381
|
// places, so a small remainder must not round to 0.
|
|
24932
25382
|
amount: formatNumber(credit.total.remaining, {
|
|
@@ -24937,7 +25387,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24937
25387
|
credit.total.remaining
|
|
24938
25388
|
)
|
|
24939
25389
|
}) }) }),
|
|
24940
|
-
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */
|
|
25390
|
+
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx56(
|
|
24941
25391
|
Button,
|
|
24942
25392
|
{
|
|
24943
25393
|
type: "button",
|
|
@@ -24990,7 +25440,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24990
25440
|
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
24991
25441
|
return (
|
|
24992
25442
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
24993
|
-
/* @__PURE__ */
|
|
25443
|
+
/* @__PURE__ */ jsx56(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
|
|
24994
25444
|
Text,
|
|
24995
25445
|
{
|
|
24996
25446
|
style: { opacity: 0.54 },
|
|
@@ -25003,7 +25453,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25003
25453
|
period: shortenPeriod(composition.period),
|
|
25004
25454
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25005
25455
|
}),
|
|
25006
|
-
renewalDate && /* @__PURE__ */
|
|
25456
|
+
renewalDate && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25007
25457
|
" ",
|
|
25008
25458
|
t4("Renews on the day", {
|
|
25009
25459
|
day: formatOrdinal(renewalDate.getDate())
|
|
@@ -25016,12 +25466,12 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25016
25466
|
})()
|
|
25017
25467
|
] })
|
|
25018
25468
|
] }),
|
|
25019
|
-
hasGrants && /* @__PURE__ */
|
|
25469
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25020
25470
|
Box,
|
|
25021
25471
|
{
|
|
25022
25472
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
25023
25473
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
25024
|
-
children: /* @__PURE__ */
|
|
25474
|
+
children: /* @__PURE__ */ jsxs42(
|
|
25025
25475
|
TransitionBox,
|
|
25026
25476
|
{
|
|
25027
25477
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -25029,22 +25479,22 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25029
25479
|
children: [
|
|
25030
25480
|
visibleGrants.map((grant, index2) => {
|
|
25031
25481
|
const padding = getRowPadding(index2);
|
|
25032
|
-
return /* @__PURE__ */
|
|
25033
|
-
/* @__PURE__ */
|
|
25482
|
+
return /* @__PURE__ */ jsx56(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25483
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: t4("X items included in plan", {
|
|
25034
25484
|
amount: grant.quantity,
|
|
25035
25485
|
item: getFeatureName(
|
|
25036
25486
|
credit,
|
|
25037
25487
|
grant.quantity
|
|
25038
25488
|
)
|
|
25039
25489
|
}) }) }),
|
|
25040
|
-
/* @__PURE__ */
|
|
25490
|
+
/* @__PURE__ */ jsx56(
|
|
25041
25491
|
Box,
|
|
25042
25492
|
{
|
|
25043
25493
|
$display: "table-cell",
|
|
25044
25494
|
$padding: padding,
|
|
25045
25495
|
$textAlign: "right",
|
|
25046
25496
|
$whiteSpace: "nowrap",
|
|
25047
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25497
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Resets", {
|
|
25048
25498
|
date: toPrettyDate(
|
|
25049
25499
|
modifyDate(grant.expiresAt, 1),
|
|
25050
25500
|
{ month: "short" }
|
|
@@ -25052,15 +25502,15 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25052
25502
|
}) })
|
|
25053
25503
|
}
|
|
25054
25504
|
)
|
|
25055
|
-
] }) : /* @__PURE__ */
|
|
25056
|
-
/* @__PURE__ */
|
|
25505
|
+
] }) : /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25506
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item bundle", {
|
|
25057
25507
|
amount: grant.quantity,
|
|
25058
25508
|
item: getFeatureName(credit, 1),
|
|
25059
25509
|
createdAt: toPrettyDate(
|
|
25060
25510
|
grant.createdAt,
|
|
25061
25511
|
{ month: "short" }
|
|
25062
25512
|
)
|
|
25063
|
-
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */
|
|
25513
|
+
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item auto-topup", {
|
|
25064
25514
|
amount: grant.quantity,
|
|
25065
25515
|
item: getFeatureName(
|
|
25066
25516
|
credit,
|
|
@@ -25070,7 +25520,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25070
25520
|
grant.createdAt,
|
|
25071
25521
|
{ month: "short" }
|
|
25072
25522
|
)
|
|
25073
|
-
}) }) : /* @__PURE__ */
|
|
25523
|
+
}) }) : /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item grant", {
|
|
25074
25524
|
amount: grant.quantity,
|
|
25075
25525
|
item: getFeatureName(
|
|
25076
25526
|
credit,
|
|
@@ -25081,14 +25531,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25081
25531
|
{ month: "short" }
|
|
25082
25532
|
)
|
|
25083
25533
|
}) }) }) }),
|
|
25084
|
-
/* @__PURE__ */
|
|
25534
|
+
/* @__PURE__ */ jsx56(
|
|
25085
25535
|
Box,
|
|
25086
25536
|
{
|
|
25087
25537
|
$display: "table-cell",
|
|
25088
25538
|
$padding: padding,
|
|
25089
25539
|
$textAlign: "right",
|
|
25090
25540
|
$whiteSpace: "nowrap",
|
|
25091
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25541
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Expires", {
|
|
25092
25542
|
date: toPrettyDate(
|
|
25093
25543
|
modifyDate(grant.expiresAt, 1),
|
|
25094
25544
|
{ month: "short" }
|
|
@@ -25098,8 +25548,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25098
25548
|
)
|
|
25099
25549
|
] }) }, grant.id);
|
|
25100
25550
|
}),
|
|
25101
|
-
canExpandLedger && /* @__PURE__ */
|
|
25102
|
-
/* @__PURE__ */
|
|
25551
|
+
canExpandLedger && /* @__PURE__ */ jsxs42(Box, { $display: "table-row", children: [
|
|
25552
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ jsx56(
|
|
25103
25553
|
ExpandListToggle,
|
|
25104
25554
|
{
|
|
25105
25555
|
isExpanded: showAllGrants,
|
|
@@ -25108,7 +25558,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25108
25558
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25109
25559
|
}
|
|
25110
25560
|
) }),
|
|
25111
|
-
/* @__PURE__ */
|
|
25561
|
+
/* @__PURE__ */ jsx56(
|
|
25112
25562
|
Box,
|
|
25113
25563
|
{
|
|
25114
25564
|
$display: "table-cell",
|
|
@@ -25121,7 +25571,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25121
25571
|
)
|
|
25122
25572
|
}
|
|
25123
25573
|
),
|
|
25124
|
-
hasGrants && /* @__PURE__ */
|
|
25574
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25125
25575
|
ExpandListToggle,
|
|
25126
25576
|
{
|
|
25127
25577
|
isExpanded,
|
|
@@ -25130,6 +25580,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25130
25580
|
collapseLabel: t4("Hide balance details"),
|
|
25131
25581
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25132
25582
|
}
|
|
25583
|
+
),
|
|
25584
|
+
props.usageByUser.isVisible && /* @__PURE__ */ jsx56(
|
|
25585
|
+
UsageByUser,
|
|
25586
|
+
{
|
|
25587
|
+
source: { kind: "credit", id: credit.id },
|
|
25588
|
+
unit: credit
|
|
25589
|
+
}
|
|
25133
25590
|
)
|
|
25134
25591
|
] }, index);
|
|
25135
25592
|
})
|
|
@@ -25138,11 +25595,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25138
25595
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
25139
25596
|
|
|
25140
25597
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25141
|
-
import { forwardRef as forwardRef13, useMemo as
|
|
25598
|
+
import { forwardRef as forwardRef13, useMemo as useMemo30 } from "react";
|
|
25142
25599
|
|
|
25143
25600
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
25144
|
-
import { useMemo as
|
|
25145
|
-
import { jsx as
|
|
25601
|
+
import { useMemo as useMemo29 } from "react";
|
|
25602
|
+
import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
25146
25603
|
var PaymentElement2 = ({
|
|
25147
25604
|
iconName,
|
|
25148
25605
|
iconTitle,
|
|
@@ -25150,8 +25607,8 @@ var PaymentElement2 = ({
|
|
|
25150
25607
|
paymentLast4
|
|
25151
25608
|
}) => {
|
|
25152
25609
|
const { settings } = useEmbed();
|
|
25153
|
-
return /* @__PURE__ */
|
|
25154
|
-
iconName && /* @__PURE__ */
|
|
25610
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
25611
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25155
25612
|
Icon3,
|
|
25156
25613
|
{
|
|
25157
25614
|
name: iconName,
|
|
@@ -25159,15 +25616,15 @@ var PaymentElement2 = ({
|
|
|
25159
25616
|
color: settings.theme.typography.text.color
|
|
25160
25617
|
}
|
|
25161
25618
|
),
|
|
25162
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25163
|
-
label && /* @__PURE__ */
|
|
25619
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25620
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25164
25621
|
" ",
|
|
25165
|
-
paymentLast4 && /* @__PURE__ */
|
|
25622
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25166
25623
|
] })
|
|
25167
25624
|
] });
|
|
25168
25625
|
};
|
|
25169
25626
|
var EmptyPaymentElement = () => {
|
|
25170
|
-
return /* @__PURE__ */
|
|
25627
|
+
return /* @__PURE__ */ jsx57(Text, { children: /* @__PURE__ */ jsx57(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx57(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx57(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
|
|
25171
25628
|
};
|
|
25172
25629
|
var getPaymentMethodData = ({
|
|
25173
25630
|
accountLast4,
|
|
@@ -25247,12 +25704,12 @@ var PaymentMethodElement = ({
|
|
|
25247
25704
|
const isLightBackground = useIsLightBackground();
|
|
25248
25705
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
25249
25706
|
const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
|
|
25250
|
-
return /* @__PURE__ */
|
|
25251
|
-
props.header.isVisible && /* @__PURE__ */
|
|
25252
|
-
/* @__PURE__ */
|
|
25253
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */
|
|
25707
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
25708
|
+
props.header.isVisible && /* @__PURE__ */ jsxs43(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
25709
|
+
/* @__PURE__ */ jsx57(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
|
|
25710
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx57(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
|
|
25254
25711
|
] }),
|
|
25255
|
-
/* @__PURE__ */
|
|
25712
|
+
/* @__PURE__ */ jsxs43(
|
|
25256
25713
|
Flex,
|
|
25257
25714
|
{
|
|
25258
25715
|
$justifyContent: "space-between",
|
|
@@ -25261,8 +25718,8 @@ var PaymentMethodElement = ({
|
|
|
25261
25718
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
25262
25719
|
$borderRadius: "9999px",
|
|
25263
25720
|
children: [
|
|
25264
|
-
paymentMethod ? /* @__PURE__ */
|
|
25265
|
-
onRemove && /* @__PURE__ */
|
|
25721
|
+
paymentMethod ? /* @__PURE__ */ jsx57(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx57(EmptyPaymentElement, {}),
|
|
25722
|
+
onRemove && /* @__PURE__ */ jsx57(
|
|
25266
25723
|
Text,
|
|
25267
25724
|
{
|
|
25268
25725
|
onClick: onRemove,
|
|
@@ -25272,7 +25729,7 @@ var PaymentMethodElement = ({
|
|
|
25272
25729
|
children: t4("Remove")
|
|
25273
25730
|
}
|
|
25274
25731
|
),
|
|
25275
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */
|
|
25732
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx57(
|
|
25276
25733
|
Text,
|
|
25277
25734
|
{
|
|
25278
25735
|
onClick: onEdit,
|
|
@@ -25285,8 +25742,8 @@ var PaymentMethodElement = ({
|
|
|
25285
25742
|
]
|
|
25286
25743
|
}
|
|
25287
25744
|
),
|
|
25288
|
-
hasCustomFields && /* @__PURE__ */
|
|
25289
|
-
/* @__PURE__ */
|
|
25745
|
+
hasCustomFields && /* @__PURE__ */ jsx57(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
|
|
25746
|
+
/* @__PURE__ */ jsx57(
|
|
25290
25747
|
Text,
|
|
25291
25748
|
{
|
|
25292
25749
|
$size: 12,
|
|
@@ -25294,7 +25751,7 @@ var PaymentMethodElement = ({
|
|
|
25294
25751
|
children: field.name
|
|
25295
25752
|
}
|
|
25296
25753
|
),
|
|
25297
|
-
/* @__PURE__ */
|
|
25754
|
+
/* @__PURE__ */ jsx57(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ jsx57(
|
|
25298
25755
|
"span",
|
|
25299
25756
|
{
|
|
25300
25757
|
style: {
|
|
@@ -25315,7 +25772,7 @@ var PaymentListElement = ({
|
|
|
25315
25772
|
const { settings } = useEmbed();
|
|
25316
25773
|
const isLightBackground = useIsLightBackground();
|
|
25317
25774
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
25318
|
-
const expirationDate =
|
|
25775
|
+
const expirationDate = useMemo29(() => {
|
|
25319
25776
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
25320
25777
|
if (!cardExpMonth || !cardExpYear) {
|
|
25321
25778
|
return;
|
|
@@ -25326,7 +25783,7 @@ var PaymentListElement = ({
|
|
|
25326
25783
|
}
|
|
25327
25784
|
return `${cardExpMonth}/${formatedYear}`;
|
|
25328
25785
|
}, [paymentMethod]);
|
|
25329
|
-
return /* @__PURE__ */
|
|
25786
|
+
return /* @__PURE__ */ jsxs43(
|
|
25330
25787
|
Flex,
|
|
25331
25788
|
{
|
|
25332
25789
|
$flexDirection: "row",
|
|
@@ -25338,7 +25795,7 @@ var PaymentListElement = ({
|
|
|
25338
25795
|
$borderStyle: "solid",
|
|
25339
25796
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
25340
25797
|
children: [
|
|
25341
|
-
iconName && /* @__PURE__ */
|
|
25798
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25342
25799
|
Icon3,
|
|
25343
25800
|
{
|
|
25344
25801
|
name: iconName,
|
|
@@ -25346,20 +25803,20 @@ var PaymentListElement = ({
|
|
|
25346
25803
|
color: settings.theme.typography.text.color
|
|
25347
25804
|
}
|
|
25348
25805
|
),
|
|
25349
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25350
|
-
label && /* @__PURE__ */
|
|
25806
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25807
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25351
25808
|
" ",
|
|
25352
|
-
paymentLast4 && /* @__PURE__ */
|
|
25809
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25353
25810
|
] }),
|
|
25354
|
-
expirationDate && /* @__PURE__ */
|
|
25811
|
+
expirationDate && /* @__PURE__ */ jsx57(
|
|
25355
25812
|
Box,
|
|
25356
25813
|
{
|
|
25357
25814
|
$flexGrow: 1,
|
|
25358
25815
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
25359
|
-
children: /* @__PURE__ */
|
|
25816
|
+
children: /* @__PURE__ */ jsx57(Text, { children: t("Expires", { date: expirationDate }) })
|
|
25360
25817
|
}
|
|
25361
25818
|
),
|
|
25362
|
-
/* @__PURE__ */
|
|
25819
|
+
/* @__PURE__ */ jsx57(Box, { children: /* @__PURE__ */ jsx57(
|
|
25363
25820
|
Text,
|
|
25364
25821
|
{
|
|
25365
25822
|
onClick: () => {
|
|
@@ -25372,7 +25829,7 @@ var PaymentListElement = ({
|
|
|
25372
25829
|
children: t("Set default")
|
|
25373
25830
|
}
|
|
25374
25831
|
) }),
|
|
25375
|
-
/* @__PURE__ */
|
|
25832
|
+
/* @__PURE__ */ jsx57(
|
|
25376
25833
|
Icon3,
|
|
25377
25834
|
{
|
|
25378
25835
|
tabIndex: 0,
|
|
@@ -25394,7 +25851,7 @@ var PaymentListElement = ({
|
|
|
25394
25851
|
};
|
|
25395
25852
|
|
|
25396
25853
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25397
|
-
import { jsx as
|
|
25854
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
25398
25855
|
var resolveDesignProps5 = (props) => {
|
|
25399
25856
|
return {
|
|
25400
25857
|
header: {
|
|
@@ -25410,7 +25867,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
25410
25867
|
var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
25411
25868
|
const props = resolveDesignProps5(rest);
|
|
25412
25869
|
const { data, setLayout } = useEmbed();
|
|
25413
|
-
const { paymentMethod, monthsToExpiration } =
|
|
25870
|
+
const { paymentMethod, monthsToExpiration } = useMemo30(() => {
|
|
25414
25871
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
25415
25872
|
let monthsToExpiration2;
|
|
25416
25873
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -25429,7 +25886,7 @@ var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = tru
|
|
|
25429
25886
|
monthsToExpiration: monthsToExpiration2
|
|
25430
25887
|
};
|
|
25431
25888
|
}, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
|
|
25432
|
-
return /* @__PURE__ */
|
|
25889
|
+
return /* @__PURE__ */ jsx58(Element, { ref, className, children: /* @__PURE__ */ jsx58(
|
|
25433
25890
|
PaymentMethodElement,
|
|
25434
25891
|
{
|
|
25435
25892
|
customCheckoutFields: data?.customCheckoutFields,
|
|
@@ -25445,7 +25902,7 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
25445
25902
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25446
25903
|
import { Elements } from "@stripe/react-stripe-js";
|
|
25447
25904
|
|
|
25448
|
-
// node_modules/.pnpm/@stripe+stripe-js@9.
|
|
25905
|
+
// node_modules/.pnpm/@stripe+stripe-js@9.15.0/node_modules/@stripe/stripe-js/dist/index.mjs
|
|
25449
25906
|
function _typeof(obj) {
|
|
25450
25907
|
"@babel/helpers - typeof";
|
|
25451
25908
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -25499,7 +25956,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
25499
25956
|
}
|
|
25500
25957
|
stripe._registerWrapper({
|
|
25501
25958
|
name: "stripe-js",
|
|
25502
|
-
version: "9.
|
|
25959
|
+
version: "9.15.0",
|
|
25503
25960
|
startTime
|
|
25504
25961
|
});
|
|
25505
25962
|
};
|
|
@@ -25577,7 +26034,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
25577
26034
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
25578
26035
|
var expectedVersion = RELEASE_TRAIN;
|
|
25579
26036
|
if (isTestKey && version !== expectedVersion) {
|
|
25580
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.
|
|
26037
|
+
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.15.0", " expected Stripe.js@").concat(expectedVersion, ". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));
|
|
25581
26038
|
}
|
|
25582
26039
|
var stripe = maybeStripe.apply(void 0, args);
|
|
25583
26040
|
registerWrapper(stripe, startTime);
|
|
@@ -25614,8 +26071,8 @@ var loadStripe = function loadStripe2() {
|
|
|
25614
26071
|
};
|
|
25615
26072
|
|
|
25616
26073
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25617
|
-
import { useCallback as useCallback15, useEffect as
|
|
25618
|
-
import { jsx as
|
|
26074
|
+
import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo31, useState as useState20 } from "react";
|
|
26075
|
+
import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
25619
26076
|
var resolveDesignProps6 = () => {
|
|
25620
26077
|
return {
|
|
25621
26078
|
header: {
|
|
@@ -25643,7 +26100,7 @@ var PaymentMethodDetails = ({
|
|
|
25643
26100
|
updatePaymentMethod,
|
|
25644
26101
|
deletePaymentMethod
|
|
25645
26102
|
} = useEmbed();
|
|
25646
|
-
const { defaultPaymentMethod, paymentMethods, subscription } =
|
|
26103
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = useMemo31(() => {
|
|
25647
26104
|
return {
|
|
25648
26105
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
25649
26106
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -25656,13 +26113,13 @@ var PaymentMethodDetails = ({
|
|
|
25656
26113
|
]);
|
|
25657
26114
|
const isLightBackground = useIsLightBackground();
|
|
25658
26115
|
const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
|
|
25659
|
-
const [isLoading, setIsLoading] =
|
|
25660
|
-
const [error, setError] =
|
|
25661
|
-
const [showPaymentForm, setShowPaymentForm] =
|
|
25662
|
-
const [stripe, setStripe] =
|
|
25663
|
-
const [setupIntent, setSetupIntent] =
|
|
25664
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] =
|
|
25665
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] =
|
|
26116
|
+
const [isLoading, setIsLoading] = useState20(!initialPaymentMethod);
|
|
26117
|
+
const [error, setError] = useState20();
|
|
26118
|
+
const [showPaymentForm, setShowPaymentForm] = useState20(false);
|
|
26119
|
+
const [stripe, setStripe] = useState20(null);
|
|
26120
|
+
const [setupIntent, setSetupIntent] = useState20();
|
|
26121
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState20(false);
|
|
26122
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = useState20(initialPaymentMethod);
|
|
25666
26123
|
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
25667
26124
|
stripe,
|
|
25668
26125
|
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
@@ -25675,7 +26132,7 @@ var PaymentMethodDetails = ({
|
|
|
25675
26132
|
},
|
|
25676
26133
|
autoConfirm: true
|
|
25677
26134
|
});
|
|
25678
|
-
const monthsToExpiration =
|
|
26135
|
+
const monthsToExpiration = useMemo31(() => {
|
|
25679
26136
|
let expiration;
|
|
25680
26137
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
25681
26138
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -25698,7 +26155,7 @@ var PaymentMethodDetails = ({
|
|
|
25698
26155
|
const toggleShowPaymentMethods = () => {
|
|
25699
26156
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
25700
26157
|
};
|
|
25701
|
-
const locale =
|
|
26158
|
+
const locale = useMemo31(() => stripeLocale(i18n.language), [i18n.language]);
|
|
25702
26159
|
const initializeStripe = useCallback15(() => {
|
|
25703
26160
|
if (stripe || !setupIntent) {
|
|
25704
26161
|
return;
|
|
@@ -25775,10 +26232,10 @@ var PaymentMethodDetails = ({
|
|
|
25775
26232
|
},
|
|
25776
26233
|
[t4, deletePaymentMethod]
|
|
25777
26234
|
);
|
|
25778
|
-
|
|
26235
|
+
useEffect8(() => {
|
|
25779
26236
|
initializeStripe();
|
|
25780
26237
|
}, [initializeStripe]);
|
|
25781
|
-
|
|
26238
|
+
useEffect8(() => {
|
|
25782
26239
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
25783
26240
|
initializePaymentMethod();
|
|
25784
26241
|
}
|
|
@@ -25788,7 +26245,7 @@ var PaymentMethodDetails = ({
|
|
|
25788
26245
|
showPaymentForm,
|
|
25789
26246
|
initializePaymentMethod
|
|
25790
26247
|
]);
|
|
25791
|
-
return /* @__PURE__ */
|
|
26248
|
+
return /* @__PURE__ */ jsxs44(
|
|
25792
26249
|
Flex,
|
|
25793
26250
|
{
|
|
25794
26251
|
$position: "relative",
|
|
@@ -25796,7 +26253,7 @@ var PaymentMethodDetails = ({
|
|
|
25796
26253
|
$flexGrow: 1,
|
|
25797
26254
|
$gap: "1.5rem",
|
|
25798
26255
|
children: [
|
|
25799
|
-
/* @__PURE__ */
|
|
26256
|
+
/* @__PURE__ */ jsx59(
|
|
25800
26257
|
Flex,
|
|
25801
26258
|
{
|
|
25802
26259
|
$position: "absolute",
|
|
@@ -25805,7 +26262,7 @@ var PaymentMethodDetails = ({
|
|
|
25805
26262
|
$alignItems: "center",
|
|
25806
26263
|
$width: "100%",
|
|
25807
26264
|
$height: "100%",
|
|
25808
|
-
children: /* @__PURE__ */
|
|
26265
|
+
children: /* @__PURE__ */ jsx59(
|
|
25809
26266
|
Loader,
|
|
25810
26267
|
{
|
|
25811
26268
|
$color: settings.theme.primary,
|
|
@@ -25815,7 +26272,7 @@ var PaymentMethodDetails = ({
|
|
|
25815
26272
|
)
|
|
25816
26273
|
}
|
|
25817
26274
|
),
|
|
25818
|
-
/* @__PURE__ */
|
|
26275
|
+
/* @__PURE__ */ jsxs44(
|
|
25819
26276
|
Flex,
|
|
25820
26277
|
{
|
|
25821
26278
|
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
@@ -25832,7 +26289,7 @@ var PaymentMethodDetails = ({
|
|
|
25832
26289
|
}
|
|
25833
26290
|
},
|
|
25834
26291
|
children: [
|
|
25835
|
-
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */
|
|
26292
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs44(
|
|
25836
26293
|
Elements,
|
|
25837
26294
|
{
|
|
25838
26295
|
stripe,
|
|
@@ -25863,7 +26320,7 @@ var PaymentMethodDetails = ({
|
|
|
25863
26320
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
25864
26321
|
},
|
|
25865
26322
|
children: [
|
|
25866
|
-
/* @__PURE__ */
|
|
26323
|
+
/* @__PURE__ */ jsx59(
|
|
25867
26324
|
PaymentForm,
|
|
25868
26325
|
{
|
|
25869
26326
|
financeData,
|
|
@@ -25874,7 +26331,7 @@ var PaymentMethodDetails = ({
|
|
|
25874
26331
|
}
|
|
25875
26332
|
}
|
|
25876
26333
|
),
|
|
25877
|
-
currentPaymentMethod && /* @__PURE__ */
|
|
26334
|
+
currentPaymentMethod && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(
|
|
25878
26335
|
Text,
|
|
25879
26336
|
{
|
|
25880
26337
|
onClick: focusExistingPaymentMethods,
|
|
@@ -25887,8 +26344,8 @@ var PaymentMethodDetails = ({
|
|
|
25887
26344
|
) })
|
|
25888
26345
|
]
|
|
25889
26346
|
}
|
|
25890
|
-
) : /* @__PURE__ */
|
|
25891
|
-
/* @__PURE__ */
|
|
26347
|
+
) : /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
26348
|
+
/* @__PURE__ */ jsx59(
|
|
25892
26349
|
PaymentMethodElement,
|
|
25893
26350
|
{
|
|
25894
26351
|
paymentMethod: currentPaymentMethod,
|
|
@@ -25901,8 +26358,8 @@ var PaymentMethodDetails = ({
|
|
|
25901
26358
|
...props
|
|
25902
26359
|
}
|
|
25903
26360
|
),
|
|
25904
|
-
paymentMethods.length > 0 && /* @__PURE__ */
|
|
25905
|
-
/* @__PURE__ */
|
|
26361
|
+
paymentMethods.length > 0 && /* @__PURE__ */ jsxs44(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
26362
|
+
/* @__PURE__ */ jsx59(
|
|
25906
26363
|
Text,
|
|
25907
26364
|
{
|
|
25908
26365
|
onClick: toggleShowPaymentMethods,
|
|
@@ -25913,7 +26370,7 @@ var PaymentMethodDetails = ({
|
|
|
25913
26370
|
children: t4("Choose different payment method")
|
|
25914
26371
|
}
|
|
25915
26372
|
),
|
|
25916
|
-
/* @__PURE__ */
|
|
26373
|
+
/* @__PURE__ */ jsx59(
|
|
25917
26374
|
Icon3,
|
|
25918
26375
|
{
|
|
25919
26376
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
|
|
@@ -25921,10 +26378,10 @@ var PaymentMethodDetails = ({
|
|
|
25921
26378
|
}
|
|
25922
26379
|
)
|
|
25923
26380
|
] }),
|
|
25924
|
-
showDifferentPaymentMethods && /* @__PURE__ */
|
|
25925
|
-
paymentMethods.length > 1 && /* @__PURE__ */
|
|
26381
|
+
showDifferentPaymentMethods && /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
26382
|
+
paymentMethods.length > 1 && /* @__PURE__ */ jsx59(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
25926
26383
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
25927
|
-
) || []).map((paymentMethod) => /* @__PURE__ */
|
|
26384
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ jsx59(
|
|
25928
26385
|
PaymentListElement,
|
|
25929
26386
|
{
|
|
25930
26387
|
paymentMethod,
|
|
@@ -25933,7 +26390,7 @@ var PaymentMethodDetails = ({
|
|
|
25933
26390
|
},
|
|
25934
26391
|
paymentMethod.id
|
|
25935
26392
|
)) }),
|
|
25936
|
-
/* @__PURE__ */
|
|
26393
|
+
/* @__PURE__ */ jsx59(
|
|
25937
26394
|
Button,
|
|
25938
26395
|
{
|
|
25939
26396
|
type: "button",
|
|
@@ -25948,7 +26405,7 @@ var PaymentMethodDetails = ({
|
|
|
25948
26405
|
)
|
|
25949
26406
|
] })
|
|
25950
26407
|
] }),
|
|
25951
|
-
!isLoading && error && /* @__PURE__ */
|
|
26408
|
+
!isLoading && error && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
25952
26409
|
]
|
|
25953
26410
|
}
|
|
25954
26411
|
)
|
|
@@ -25958,13 +26415,13 @@ var PaymentMethodDetails = ({
|
|
|
25958
26415
|
};
|
|
25959
26416
|
|
|
25960
26417
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
25961
|
-
import { forwardRef as forwardRef14, useMemo as
|
|
26418
|
+
import { forwardRef as forwardRef14, useMemo as useMemo33 } from "react";
|
|
25962
26419
|
|
|
25963
26420
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
25964
|
-
import { jsx as
|
|
26421
|
+
import { jsx as jsx60, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
25965
26422
|
var AddOn = ({ addOn, currency, period, layout }) => {
|
|
25966
26423
|
const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
|
|
25967
|
-
return /* @__PURE__ */
|
|
26424
|
+
return /* @__PURE__ */ jsxs45(
|
|
25968
26425
|
Flex,
|
|
25969
26426
|
{
|
|
25970
26427
|
$justifyContent: "space-between",
|
|
@@ -25972,10 +26429,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
25972
26429
|
$flexWrap: "wrap",
|
|
25973
26430
|
$gap: "1rem",
|
|
25974
26431
|
children: [
|
|
25975
|
-
/* @__PURE__ */
|
|
25976
|
-
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */
|
|
26432
|
+
/* @__PURE__ */ jsx60(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
26433
|
+
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs45(Text, { children: [
|
|
25977
26434
|
formatCurrency(addOn.planPrice, currency),
|
|
25978
|
-
/* @__PURE__ */
|
|
26435
|
+
/* @__PURE__ */ jsx60("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
|
|
25979
26436
|
] })
|
|
25980
26437
|
]
|
|
25981
26438
|
}
|
|
@@ -25983,8 +26440,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
25983
26440
|
};
|
|
25984
26441
|
|
|
25985
26442
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
25986
|
-
import { Fragment as Fragment24, useMemo as
|
|
25987
|
-
import { Fragment as Fragment25, jsx as
|
|
26443
|
+
import { Fragment as Fragment24, useMemo as useMemo32 } from "react";
|
|
26444
|
+
import { Fragment as Fragment25, jsx as jsx61, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
25988
26445
|
var UsageDetails2 = ({
|
|
25989
26446
|
entitlement,
|
|
25990
26447
|
period,
|
|
@@ -25999,40 +26456,40 @@ var UsageDetails2 = ({
|
|
|
25999
26456
|
billingPrice,
|
|
26000
26457
|
limit,
|
|
26001
26458
|
cost = 0
|
|
26002
|
-
} =
|
|
26459
|
+
} = useMemo32(
|
|
26003
26460
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26004
26461
|
showWarningThresholdAsLimit
|
|
26005
26462
|
}),
|
|
26006
26463
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26007
26464
|
);
|
|
26008
|
-
const description =
|
|
26465
|
+
const description = useMemo32(() => {
|
|
26009
26466
|
const acc = [];
|
|
26010
26467
|
let index = 0;
|
|
26011
26468
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
26012
|
-
acc.push(/* @__PURE__ */
|
|
26469
|
+
acc.push(/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26013
26470
|
t4("Additional"),
|
|
26014
26471
|
": "
|
|
26015
26472
|
] }, index));
|
|
26016
26473
|
index += 1;
|
|
26017
26474
|
}
|
|
26018
26475
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
26019
|
-
acc.push(/* @__PURE__ */
|
|
26476
|
+
acc.push(/* @__PURE__ */ jsx61(Fragment24, { children: t4("Tier-based") }, index));
|
|
26020
26477
|
index += 1;
|
|
26021
26478
|
}
|
|
26022
26479
|
const { price } = getEntitlementPrice(entitlement, period, currency) || {};
|
|
26023
26480
|
if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
|
|
26024
26481
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
26025
26482
|
acc.push(
|
|
26026
|
-
/* @__PURE__ */
|
|
26483
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26027
26484
|
formatCurrency(price, billingPrice?.currency),
|
|
26028
|
-
/* @__PURE__ */
|
|
26485
|
+
/* @__PURE__ */ jsxs46("sub", { children: [
|
|
26029
26486
|
"/",
|
|
26030
|
-
packageSize > 1 && /* @__PURE__ */
|
|
26487
|
+
packageSize > 1 && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26031
26488
|
packageSize,
|
|
26032
26489
|
" "
|
|
26033
26490
|
] }),
|
|
26034
26491
|
getFeatureName(entitlement.feature, packageSize),
|
|
26035
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26492
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26036
26493
|
"/",
|
|
26037
26494
|
shortenPeriod(period)
|
|
26038
26495
|
] })
|
|
@@ -26043,7 +26500,7 @@ var UsageDetails2 = ({
|
|
|
26043
26500
|
}
|
|
26044
26501
|
if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
26045
26502
|
acc.push(
|
|
26046
|
-
/* @__PURE__ */
|
|
26503
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26047
26504
|
formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
|
|
26048
26505
|
" ",
|
|
26049
26506
|
getFeatureName(
|
|
@@ -26071,7 +26528,7 @@ var UsageDetails2 = ({
|
|
|
26071
26528
|
return null;
|
|
26072
26529
|
}
|
|
26073
26530
|
const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
|
|
26074
|
-
return /* @__PURE__ */
|
|
26531
|
+
return /* @__PURE__ */ jsxs46(
|
|
26075
26532
|
Flex,
|
|
26076
26533
|
{
|
|
26077
26534
|
$justifyContent: "space-between",
|
|
@@ -26079,13 +26536,13 @@ var UsageDetails2 = ({
|
|
|
26079
26536
|
$flexWrap: "wrap",
|
|
26080
26537
|
$gap: "0.5rem",
|
|
26081
26538
|
children: [
|
|
26082
|
-
/* @__PURE__ */
|
|
26539
|
+
/* @__PURE__ */ jsx61(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26083
26540
|
quantity,
|
|
26084
26541
|
" ",
|
|
26085
26542
|
getFeatureName(entitlement.feature, quantity, true)
|
|
26086
26543
|
] }) : entitlement.feature.name }),
|
|
26087
|
-
/* @__PURE__ */
|
|
26088
|
-
description.length > 0 && /* @__PURE__ */
|
|
26544
|
+
/* @__PURE__ */ jsxs46(Text, { children: [
|
|
26545
|
+
description.length > 0 && /* @__PURE__ */ jsx61(
|
|
26089
26546
|
Text,
|
|
26090
26547
|
{
|
|
26091
26548
|
style: { opacity: 0.54 },
|
|
@@ -26096,15 +26553,15 @@ var UsageDetails2 = ({
|
|
|
26096
26553
|
),
|
|
26097
26554
|
// only show cost for pay-in-advance entitlements
|
|
26098
26555
|
// `description` will include price for other price behaviors
|
|
26099
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
26556
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26100
26557
|
" ",
|
|
26101
26558
|
formatCurrency(cost, billingPrice?.currency),
|
|
26102
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26559
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46("sub", { children: [
|
|
26103
26560
|
"/",
|
|
26104
26561
|
shortenPeriod(period)
|
|
26105
26562
|
] })
|
|
26106
26563
|
] }),
|
|
26107
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */
|
|
26564
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ jsx61(
|
|
26108
26565
|
PricingTiersTooltip,
|
|
26109
26566
|
{
|
|
26110
26567
|
feature: entitlement.feature,
|
|
@@ -26114,7 +26571,7 @@ var UsageDetails2 = ({
|
|
|
26114
26571
|
tiersMode: billingPrice?.tiersMode ?? void 0
|
|
26115
26572
|
}
|
|
26116
26573
|
),
|
|
26117
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
26574
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx61(
|
|
26118
26575
|
HardLimitTooltip,
|
|
26119
26576
|
{
|
|
26120
26577
|
feature: entitlement.feature,
|
|
@@ -26128,7 +26585,7 @@ var UsageDetails2 = ({
|
|
|
26128
26585
|
};
|
|
26129
26586
|
|
|
26130
26587
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26131
|
-
import { Fragment as Fragment26, jsx as
|
|
26588
|
+
import { Fragment as Fragment26, jsx as jsx62, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
26132
26589
|
var resolveDesignProps7 = (props) => {
|
|
26133
26590
|
return {
|
|
26134
26591
|
header: {
|
|
@@ -26176,7 +26633,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26176
26633
|
showCredits,
|
|
26177
26634
|
showZeroPriceAsFree,
|
|
26178
26635
|
trialPaymentMethodRequired
|
|
26179
|
-
} =
|
|
26636
|
+
} = useMemo33(() => {
|
|
26180
26637
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
26181
26638
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
26182
26639
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -26236,15 +26693,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26236
26693
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
26237
26694
|
data?.trialPaymentMethodRequired
|
|
26238
26695
|
]);
|
|
26239
|
-
const usageBasedEntitlements =
|
|
26696
|
+
const usageBasedEntitlements = useMemo33(
|
|
26240
26697
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
26241
26698
|
[featureUsage]
|
|
26242
26699
|
);
|
|
26243
|
-
const planCreditCompositions =
|
|
26700
|
+
const planCreditCompositions = useMemo33(
|
|
26244
26701
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
26245
26702
|
[currentPlan?.includedCreditGrants]
|
|
26246
26703
|
);
|
|
26247
|
-
const resolveLicenseQuantity =
|
|
26704
|
+
const resolveLicenseQuantity = useMemo33(() => {
|
|
26248
26705
|
return (licenseId) => {
|
|
26249
26706
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
26250
26707
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -26267,7 +26724,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26267
26724
|
subscriptionCurrency,
|
|
26268
26725
|
willSubscriptionCancel,
|
|
26269
26726
|
isTrialSubscription
|
|
26270
|
-
} =
|
|
26727
|
+
} = useMemo33(() => {
|
|
26271
26728
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
26272
26729
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
26273
26730
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -26280,7 +26737,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26280
26737
|
};
|
|
26281
26738
|
}, [billingSubscription]);
|
|
26282
26739
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
26283
|
-
const { isFreePlan, isUsageBasedPlan } =
|
|
26740
|
+
const { isFreePlan, isUsageBasedPlan } = useMemo33(() => {
|
|
26284
26741
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
26285
26742
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
26286
26743
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -26288,8 +26745,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26288
26745
|
const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
|
|
26289
26746
|
(grant) => isSelfServiceAutoTopupAvailable(grant)
|
|
26290
26747
|
) ?? false;
|
|
26291
|
-
return /* @__PURE__ */
|
|
26292
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */
|
|
26748
|
+
return /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26749
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26293
26750
|
Notice,
|
|
26294
26751
|
{
|
|
26295
26752
|
as: Flex,
|
|
@@ -26299,8 +26756,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26299
26756
|
$textAlign: "center",
|
|
26300
26757
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26301
26758
|
children: [
|
|
26302
|
-
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */
|
|
26303
|
-
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */
|
|
26759
|
+
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
|
|
26760
|
+
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ jsx62(
|
|
26304
26761
|
Text,
|
|
26305
26762
|
{
|
|
26306
26763
|
as: "p",
|
|
@@ -26314,7 +26771,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26314
26771
|
)
|
|
26315
26772
|
]
|
|
26316
26773
|
}
|
|
26317
|
-
) : willSubscriptionCancel ? /* @__PURE__ */
|
|
26774
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26318
26775
|
Notice,
|
|
26319
26776
|
{
|
|
26320
26777
|
as: Flex,
|
|
@@ -26324,8 +26781,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26324
26781
|
$textAlign: "center",
|
|
26325
26782
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26326
26783
|
children: [
|
|
26327
|
-
/* @__PURE__ */
|
|
26328
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */
|
|
26784
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
|
|
26785
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx62(
|
|
26329
26786
|
Text,
|
|
26330
26787
|
{
|
|
26331
26788
|
as: "p",
|
|
@@ -26340,7 +26797,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26340
26797
|
)
|
|
26341
26798
|
]
|
|
26342
26799
|
}
|
|
26343
|
-
) : customPlanBilling ? /* @__PURE__ */
|
|
26800
|
+
) : customPlanBilling ? /* @__PURE__ */ jsxs47(
|
|
26344
26801
|
Notice,
|
|
26345
26802
|
{
|
|
26346
26803
|
as: Flex,
|
|
@@ -26350,19 +26807,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26350
26807
|
$textAlign: "center",
|
|
26351
26808
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26352
26809
|
children: [
|
|
26353
|
-
/* @__PURE__ */
|
|
26810
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
|
|
26354
26811
|
plan: customPlanBilling.planName ?? t4("your plan")
|
|
26355
26812
|
}) : t4("Custom plan payment due", {
|
|
26356
26813
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26357
26814
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26358
26815
|
}) }),
|
|
26359
|
-
/* @__PURE__ */
|
|
26816
|
+
/* @__PURE__ */ jsx62(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
|
|
26360
26817
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26361
26818
|
}) : t4("Custom plan payment due description", {
|
|
26362
26819
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26363
26820
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26364
26821
|
}) }),
|
|
26365
|
-
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */
|
|
26822
|
+
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ jsx62(
|
|
26366
26823
|
Button,
|
|
26367
26824
|
{
|
|
26368
26825
|
as: "a",
|
|
@@ -26376,7 +26833,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26376
26833
|
)
|
|
26377
26834
|
]
|
|
26378
26835
|
}
|
|
26379
|
-
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */
|
|
26836
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs47(
|
|
26380
26837
|
Notice,
|
|
26381
26838
|
{
|
|
26382
26839
|
as: Flex,
|
|
@@ -26386,10 +26843,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26386
26843
|
$textAlign: "center",
|
|
26387
26844
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26388
26845
|
children: [
|
|
26389
|
-
/* @__PURE__ */
|
|
26846
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
|
|
26390
26847
|
plan: data.company.scheduledDowngrade.toPlanName
|
|
26391
26848
|
}) }),
|
|
26392
|
-
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */
|
|
26849
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx62(
|
|
26393
26850
|
Text,
|
|
26394
26851
|
{
|
|
26395
26852
|
as: "p",
|
|
@@ -26405,7 +26862,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26405
26862
|
]
|
|
26406
26863
|
}
|
|
26407
26864
|
),
|
|
26408
|
-
/* @__PURE__ */
|
|
26865
|
+
/* @__PURE__ */ jsxs47(
|
|
26409
26866
|
Element,
|
|
26410
26867
|
{
|
|
26411
26868
|
as: Flex,
|
|
@@ -26414,19 +26871,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26414
26871
|
$flexDirection: "column",
|
|
26415
26872
|
$gap: "2rem",
|
|
26416
26873
|
children: [
|
|
26417
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */
|
|
26874
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs47(
|
|
26418
26875
|
Flex,
|
|
26419
26876
|
{
|
|
26420
26877
|
$justifyContent: "space-between",
|
|
26421
26878
|
$alignItems: "center",
|
|
26422
26879
|
$gap: "1rem",
|
|
26423
26880
|
children: [
|
|
26424
|
-
/* @__PURE__ */
|
|
26425
|
-
/* @__PURE__ */
|
|
26426
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */
|
|
26881
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
26882
|
+
/* @__PURE__ */ jsx62(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
|
|
26883
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx62(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
26427
26884
|
] }),
|
|
26428
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */
|
|
26429
|
-
/* @__PURE__ */
|
|
26885
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsxs47(Box, { children: [
|
|
26886
|
+
/* @__PURE__ */ jsx62(
|
|
26430
26887
|
Text,
|
|
26431
26888
|
{
|
|
26432
26889
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -26436,7 +26893,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26436
26893
|
)
|
|
26437
26894
|
}
|
|
26438
26895
|
),
|
|
26439
|
-
!isFreePlan && currentPlanPeriod && /* @__PURE__ */
|
|
26896
|
+
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx62(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
|
|
26440
26897
|
"/",
|
|
26441
26898
|
shortenPeriod(currentPlanPeriod)
|
|
26442
26899
|
] }) })
|
|
@@ -26444,8 +26901,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26444
26901
|
]
|
|
26445
26902
|
}
|
|
26446
26903
|
),
|
|
26447
|
-
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */
|
|
26448
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
26904
|
+
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
26905
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26449
26906
|
Text,
|
|
26450
26907
|
{
|
|
26451
26908
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26453,7 +26910,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26453
26910
|
children: t4("Add-ons")
|
|
26454
26911
|
}
|
|
26455
26912
|
),
|
|
26456
|
-
/* @__PURE__ */
|
|
26913
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx62(
|
|
26457
26914
|
AddOn,
|
|
26458
26915
|
{
|
|
26459
26916
|
addOn,
|
|
@@ -26464,8 +26921,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26464
26921
|
addOnIndex
|
|
26465
26922
|
)) })
|
|
26466
26923
|
] }),
|
|
26467
|
-
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */
|
|
26468
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
26924
|
+
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
26925
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26469
26926
|
Text,
|
|
26470
26927
|
{
|
|
26471
26928
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26473,8 +26930,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26473
26930
|
children: t4("Usage-based")
|
|
26474
26931
|
}
|
|
26475
26932
|
),
|
|
26476
|
-
/* @__PURE__ */
|
|
26477
|
-
return /* @__PURE__ */
|
|
26933
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
26934
|
+
return /* @__PURE__ */ jsx62(
|
|
26478
26935
|
UsageDetails2,
|
|
26479
26936
|
{
|
|
26480
26937
|
entitlement,
|
|
@@ -26487,8 +26944,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26487
26944
|
);
|
|
26488
26945
|
}) })
|
|
26489
26946
|
] }),
|
|
26490
|
-
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */
|
|
26491
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
26947
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
26948
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26492
26949
|
Text,
|
|
26493
26950
|
{
|
|
26494
26951
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26496,7 +26953,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26496
26953
|
children: t4("Credits in plan")
|
|
26497
26954
|
}
|
|
26498
26955
|
),
|
|
26499
|
-
/* @__PURE__ */
|
|
26956
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
|
|
26500
26957
|
const planCreditGrant = currentPlan?.includedCreditGrants.find(
|
|
26501
26958
|
(grant) => grant.creditId === group.id
|
|
26502
26959
|
);
|
|
@@ -26519,13 +26976,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26519
26976
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
26520
26977
|
const creditPeriod = composition.period ?? subscriptionInterval;
|
|
26521
26978
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
26522
|
-
return /* @__PURE__ */
|
|
26979
|
+
return /* @__PURE__ */ jsxs47(
|
|
26523
26980
|
Flex,
|
|
26524
26981
|
{
|
|
26525
26982
|
$flexDirection: "column",
|
|
26526
26983
|
$gap: "0.25rem",
|
|
26527
26984
|
children: [
|
|
26528
|
-
/* @__PURE__ */
|
|
26985
|
+
/* @__PURE__ */ jsxs47(
|
|
26529
26986
|
Flex,
|
|
26530
26987
|
{
|
|
26531
26988
|
$justifyContent: "space-between",
|
|
@@ -26533,7 +26990,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26533
26990
|
$flexWrap: "wrap",
|
|
26534
26991
|
$gap: "0.5rem",
|
|
26535
26992
|
children: [
|
|
26536
|
-
/* @__PURE__ */
|
|
26993
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26537
26994
|
t4("X credits per license", {
|
|
26538
26995
|
amount: perLicenseGrant.amount,
|
|
26539
26996
|
creditName: getFeatureName(
|
|
@@ -26542,7 +26999,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26542
26999
|
),
|
|
26543
27000
|
licenseName: getFeatureName(licenseFeature, 1)
|
|
26544
27001
|
}),
|
|
26545
|
-
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */
|
|
27002
|
+
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26546
27003
|
" ",
|
|
26547
27004
|
t4("Plus X credits per period", {
|
|
26548
27005
|
amount: composition.fixedQuantity,
|
|
@@ -26553,18 +27010,18 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26553
27010
|
period: t4(creditPeriod)
|
|
26554
27011
|
})
|
|
26555
27012
|
] })
|
|
26556
|
-
] }) : /* @__PURE__ */
|
|
27013
|
+
] }) : /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26557
27014
|
group.total.value,
|
|
26558
27015
|
" ",
|
|
26559
27016
|
getFeatureName(group, group.total.value),
|
|
26560
27017
|
" ",
|
|
26561
|
-
subscriptionInterval && /* @__PURE__ */
|
|
27018
|
+
subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26562
27019
|
t4("per"),
|
|
26563
27020
|
" ",
|
|
26564
27021
|
t4(subscriptionInterval)
|
|
26565
27022
|
] })
|
|
26566
27023
|
] }) }),
|
|
26567
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27024
|
+
group.total.used > 0 && /* @__PURE__ */ jsx62(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ jsxs47(
|
|
26568
27025
|
Text,
|
|
26569
27026
|
{
|
|
26570
27027
|
style: { opacity: 0.54 },
|
|
@@ -26574,7 +27031,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26574
27031
|
group.total.used,
|
|
26575
27032
|
" ",
|
|
26576
27033
|
t4("used"),
|
|
26577
|
-
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */
|
|
27034
|
+
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ jsx62(
|
|
26578
27035
|
AutoTopupNotice,
|
|
26579
27036
|
{
|
|
26580
27037
|
thresholdCredits,
|
|
@@ -26587,7 +27044,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26587
27044
|
]
|
|
26588
27045
|
}
|
|
26589
27046
|
),
|
|
26590
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */
|
|
27047
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx62(
|
|
26591
27048
|
Text,
|
|
26592
27049
|
{
|
|
26593
27050
|
style: { opacity: 0.54 },
|
|
@@ -26628,7 +27085,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26628
27085
|
groupIndex
|
|
26629
27086
|
);
|
|
26630
27087
|
}) }),
|
|
26631
|
-
planCredits.canExpand && /* @__PURE__ */
|
|
27088
|
+
planCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26632
27089
|
ExpandListToggle,
|
|
26633
27090
|
{
|
|
26634
27091
|
isExpanded: planCredits.isExpanded,
|
|
@@ -26637,7 +27094,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26637
27094
|
$marginTop: "0.5rem"
|
|
26638
27095
|
}
|
|
26639
27096
|
),
|
|
26640
|
-
hasAutoTopupSelfService && /* @__PURE__ */
|
|
27097
|
+
hasAutoTopupSelfService && /* @__PURE__ */ jsxs47(
|
|
26641
27098
|
Flex,
|
|
26642
27099
|
{
|
|
26643
27100
|
$justifyContent: "space-between",
|
|
@@ -26647,8 +27104,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26647
27104
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26648
27105
|
$borderRadius: "0.5rem",
|
|
26649
27106
|
children: [
|
|
26650
|
-
/* @__PURE__ */
|
|
26651
|
-
/* @__PURE__ */
|
|
27107
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27108
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
|
|
26652
27109
|
currentPlan?.includedCreditGrants.reduce(
|
|
26653
27110
|
(acc, grant) => {
|
|
26654
27111
|
if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -26657,7 +27114,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26657
27114
|
const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
|
|
26658
27115
|
if (!autoTopupEnabled) {
|
|
26659
27116
|
acc.push(
|
|
26660
|
-
/* @__PURE__ */
|
|
27117
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
|
|
26661
27118
|
unit: getFeatureName(grant.credit, 1)
|
|
26662
27119
|
}) }, grant.id)
|
|
26663
27120
|
);
|
|
@@ -26667,7 +27124,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26667
27124
|
const autoTopupAmount = getAutoTopupAmount(grant);
|
|
26668
27125
|
if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
|
|
26669
27126
|
acc.push(
|
|
26670
|
-
/* @__PURE__ */
|
|
27127
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
|
|
26671
27128
|
unit: getFeatureName(
|
|
26672
27129
|
grant.credit,
|
|
26673
27130
|
autoTopupAmount
|
|
@@ -26682,7 +27139,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26682
27139
|
[]
|
|
26683
27140
|
)
|
|
26684
27141
|
] }),
|
|
26685
|
-
/* @__PURE__ */
|
|
27142
|
+
/* @__PURE__ */ jsx62(
|
|
26686
27143
|
Button,
|
|
26687
27144
|
{
|
|
26688
27145
|
type: "button",
|
|
@@ -26699,8 +27156,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26699
27156
|
}
|
|
26700
27157
|
)
|
|
26701
27158
|
] }),
|
|
26702
|
-
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */
|
|
26703
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27159
|
+
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27160
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26704
27161
|
Text,
|
|
26705
27162
|
{
|
|
26706
27163
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26708,9 +27165,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26708
27165
|
children: t4("Top-ups")
|
|
26709
27166
|
}
|
|
26710
27167
|
),
|
|
26711
|
-
/* @__PURE__ */
|
|
27168
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
|
|
26712
27169
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26713
|
-
return /* @__PURE__ */
|
|
27170
|
+
return /* @__PURE__ */ jsxs47(
|
|
26714
27171
|
Flex,
|
|
26715
27172
|
{
|
|
26716
27173
|
$justifyContent: "space-between",
|
|
@@ -26718,8 +27175,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26718
27175
|
$flexWrap: "wrap",
|
|
26719
27176
|
$gap: "0.5rem",
|
|
26720
27177
|
children: [
|
|
26721
|
-
bundle ? /* @__PURE__ */
|
|
26722
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27178
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27179
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26723
27180
|
"(",
|
|
26724
27181
|
group.grants.length,
|
|
26725
27182
|
")",
|
|
@@ -26731,8 +27188,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26731
27188
|
" ",
|
|
26732
27189
|
getFeatureName(group, group.quantity),
|
|
26733
27190
|
")"
|
|
26734
|
-
] }) : /* @__PURE__ */
|
|
26735
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27191
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27192
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26736
27193
|
"(",
|
|
26737
27194
|
group.grants.length,
|
|
26738
27195
|
")",
|
|
@@ -26742,7 +27199,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26742
27199
|
" ",
|
|
26743
27200
|
getFeatureName(group, group.quantity)
|
|
26744
27201
|
] }),
|
|
26745
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27202
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26746
27203
|
Text,
|
|
26747
27204
|
{
|
|
26748
27205
|
style: { opacity: 0.54 },
|
|
@@ -26760,7 +27217,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26760
27217
|
groupIndex
|
|
26761
27218
|
);
|
|
26762
27219
|
}) }),
|
|
26763
|
-
autoTopupCredits.canExpand && /* @__PURE__ */
|
|
27220
|
+
autoTopupCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26764
27221
|
ExpandListToggle,
|
|
26765
27222
|
{
|
|
26766
27223
|
isExpanded: autoTopupCredits.isExpanded,
|
|
@@ -26770,8 +27227,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26770
27227
|
}
|
|
26771
27228
|
)
|
|
26772
27229
|
] }),
|
|
26773
|
-
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */
|
|
26774
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27230
|
+
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27231
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26775
27232
|
Text,
|
|
26776
27233
|
{
|
|
26777
27234
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26779,9 +27236,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26779
27236
|
children: t4("Credit bundles")
|
|
26780
27237
|
}
|
|
26781
27238
|
),
|
|
26782
|
-
/* @__PURE__ */
|
|
27239
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
|
|
26783
27240
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26784
|
-
return /* @__PURE__ */
|
|
27241
|
+
return /* @__PURE__ */ jsxs47(
|
|
26785
27242
|
Flex,
|
|
26786
27243
|
{
|
|
26787
27244
|
$justifyContent: "space-between",
|
|
@@ -26789,8 +27246,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26789
27246
|
$flexWrap: "wrap",
|
|
26790
27247
|
$gap: "0.5rem",
|
|
26791
27248
|
children: [
|
|
26792
|
-
bundle ? /* @__PURE__ */
|
|
26793
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27249
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27250
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26794
27251
|
"(",
|
|
26795
27252
|
group.grants.length,
|
|
26796
27253
|
")",
|
|
@@ -26802,12 +27259,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26802
27259
|
" ",
|
|
26803
27260
|
getFeatureName(group, group.quantity),
|
|
26804
27261
|
")"
|
|
26805
|
-
] }) : /* @__PURE__ */
|
|
27262
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
26806
27263
|
group.quantity,
|
|
26807
27264
|
" ",
|
|
26808
27265
|
getFeatureName(group, group.quantity)
|
|
26809
27266
|
] }),
|
|
26810
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27267
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26811
27268
|
Text,
|
|
26812
27269
|
{
|
|
26813
27270
|
style: { opacity: 0.54 },
|
|
@@ -26825,7 +27282,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26825
27282
|
groupIndex
|
|
26826
27283
|
);
|
|
26827
27284
|
}) }),
|
|
26828
|
-
bundleCredits.canExpand && /* @__PURE__ */
|
|
27285
|
+
bundleCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26829
27286
|
ExpandListToggle,
|
|
26830
27287
|
{
|
|
26831
27288
|
isExpanded: bundleCredits.isExpanded,
|
|
@@ -26835,8 +27292,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26835
27292
|
}
|
|
26836
27293
|
)
|
|
26837
27294
|
] }),
|
|
26838
|
-
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */
|
|
26839
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27295
|
+
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27296
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26840
27297
|
Text,
|
|
26841
27298
|
{
|
|
26842
27299
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26844,8 +27301,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26844
27301
|
children: t4("Promotional credits")
|
|
26845
27302
|
}
|
|
26846
27303
|
),
|
|
26847
|
-
/* @__PURE__ */
|
|
26848
|
-
return /* @__PURE__ */
|
|
27304
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
|
|
27305
|
+
return /* @__PURE__ */ jsxs47(
|
|
26849
27306
|
Flex,
|
|
26850
27307
|
{
|
|
26851
27308
|
$justifyContent: "space-between",
|
|
@@ -26853,12 +27310,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26853
27310
|
$flexWrap: "wrap",
|
|
26854
27311
|
$gap: "0.5rem",
|
|
26855
27312
|
children: [
|
|
26856
|
-
/* @__PURE__ */
|
|
27313
|
+
/* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
26857
27314
|
group.quantity,
|
|
26858
27315
|
" ",
|
|
26859
27316
|
getFeatureName(group, group.quantity)
|
|
26860
27317
|
] }),
|
|
26861
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27318
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26862
27319
|
Text,
|
|
26863
27320
|
{
|
|
26864
27321
|
style: { opacity: 0.54 },
|
|
@@ -26876,7 +27333,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26876
27333
|
groupIndex
|
|
26877
27334
|
);
|
|
26878
27335
|
}) }),
|
|
26879
|
-
promotionalCredits.canExpand && /* @__PURE__ */
|
|
27336
|
+
promotionalCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26880
27337
|
ExpandListToggle,
|
|
26881
27338
|
{
|
|
26882
27339
|
isExpanded: promotionalCredits.isExpanded,
|
|
@@ -26886,7 +27343,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26886
27343
|
}
|
|
26887
27344
|
)
|
|
26888
27345
|
] }),
|
|
26889
|
-
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */
|
|
27346
|
+
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ jsx62(
|
|
26890
27347
|
Button,
|
|
26891
27348
|
{
|
|
26892
27349
|
type: "button",
|
|
@@ -26911,14 +27368,14 @@ import {
|
|
|
26911
27368
|
Fragment as Fragment29,
|
|
26912
27369
|
forwardRef as forwardRef15,
|
|
26913
27370
|
useCallback as useCallback16,
|
|
26914
|
-
useEffect as
|
|
26915
|
-
useMemo as
|
|
26916
|
-
useState as
|
|
27371
|
+
useEffect as useEffect9,
|
|
27372
|
+
useMemo as useMemo35,
|
|
27373
|
+
useState as useState22
|
|
26917
27374
|
} from "react";
|
|
26918
27375
|
|
|
26919
27376
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
26920
|
-
import { useMemo as
|
|
26921
|
-
import { Fragment as Fragment27, jsx as
|
|
27377
|
+
import { useMemo as useMemo34 } from "react";
|
|
27378
|
+
import { Fragment as Fragment27, jsx as jsx63, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
26922
27379
|
function renderMeteredEntitlementPricing2({
|
|
26923
27380
|
priceBehavior,
|
|
26924
27381
|
softLimit,
|
|
@@ -26930,7 +27387,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
26930
27387
|
isTiered
|
|
26931
27388
|
}) {
|
|
26932
27389
|
if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
|
|
26933
|
-
return /* @__PURE__ */
|
|
27390
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
26934
27391
|
"Additional: ",
|
|
26935
27392
|
formatCurrency(price, currency),
|
|
26936
27393
|
"/",
|
|
@@ -26941,13 +27398,13 @@ function renderMeteredEntitlementPricing2({
|
|
|
26941
27398
|
] });
|
|
26942
27399
|
}
|
|
26943
27400
|
if (isTiered) {
|
|
26944
|
-
return /* @__PURE__ */
|
|
27401
|
+
return /* @__PURE__ */ jsx63(Fragment27, { children: "Tier-based pricing" });
|
|
26945
27402
|
}
|
|
26946
27403
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
|
|
26947
|
-
return /* @__PURE__ */
|
|
27404
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
26948
27405
|
formatCurrency(price, currency),
|
|
26949
27406
|
"/",
|
|
26950
|
-
packageSize > 1 && /* @__PURE__ */
|
|
27407
|
+
packageSize > 1 && /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
26951
27408
|
packageSize,
|
|
26952
27409
|
" "
|
|
26953
27410
|
] }),
|
|
@@ -26973,7 +27430,7 @@ var AddOn2 = ({
|
|
|
26973
27430
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
26974
27431
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
26975
27432
|
const isLightBackground = useIsLightBackground();
|
|
26976
|
-
const { currentAddOns, canCheckout, isStandalone } =
|
|
27433
|
+
const { currentAddOns, canCheckout, isStandalone } = useMemo34(() => {
|
|
26977
27434
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
26978
27435
|
return {
|
|
26979
27436
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -27016,7 +27473,7 @@ var AddOn2 = ({
|
|
|
27016
27473
|
isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
|
|
27017
27474
|
};
|
|
27018
27475
|
}) || [];
|
|
27019
|
-
return /* @__PURE__ */
|
|
27476
|
+
return /* @__PURE__ */ jsxs48(
|
|
27020
27477
|
Flex,
|
|
27021
27478
|
{
|
|
27022
27479
|
as: "li",
|
|
@@ -27036,7 +27493,7 @@ var AddOn2 = ({
|
|
|
27036
27493
|
$boxShadow: cardBoxShadow
|
|
27037
27494
|
},
|
|
27038
27495
|
children: [
|
|
27039
|
-
/* @__PURE__ */
|
|
27496
|
+
/* @__PURE__ */ jsxs48(
|
|
27040
27497
|
Flex,
|
|
27041
27498
|
{
|
|
27042
27499
|
$flexDirection: "column",
|
|
@@ -27047,7 +27504,7 @@ var AddOn2 = ({
|
|
|
27047
27504
|
$borderStyle: "solid",
|
|
27048
27505
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27049
27506
|
children: [
|
|
27050
|
-
/* @__PURE__ */
|
|
27507
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27051
27508
|
Text,
|
|
27052
27509
|
{
|
|
27053
27510
|
as: "h3",
|
|
@@ -27056,22 +27513,22 @@ var AddOn2 = ({
|
|
|
27056
27513
|
children: addOn.name
|
|
27057
27514
|
}
|
|
27058
27515
|
) }),
|
|
27059
|
-
layout.addOns.showDescription && /* @__PURE__ */
|
|
27060
|
-
/* @__PURE__ */
|
|
27516
|
+
layout.addOns.showDescription && /* @__PURE__ */ jsx63(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx63(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
27517
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27061
27518
|
Text,
|
|
27062
27519
|
{
|
|
27063
27520
|
"data-testid": "sch-addon-price",
|
|
27064
27521
|
display: layout.plans.name.fontStyle,
|
|
27065
|
-
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */
|
|
27522
|
+
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27066
27523
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
27067
|
-
/* @__PURE__ */
|
|
27524
|
+
/* @__PURE__ */ jsxs48("sub", { children: [
|
|
27068
27525
|
"/",
|
|
27069
27526
|
selectedPeriod
|
|
27070
27527
|
] })
|
|
27071
27528
|
] })
|
|
27072
27529
|
}
|
|
27073
27530
|
) }),
|
|
27074
|
-
isActiveAddOn && /* @__PURE__ */
|
|
27531
|
+
isActiveAddOn && /* @__PURE__ */ jsx63(
|
|
27075
27532
|
Flex,
|
|
27076
27533
|
{
|
|
27077
27534
|
"data-testid": "sch-addon-active",
|
|
@@ -27081,7 +27538,7 @@ var AddOn2 = ({
|
|
|
27081
27538
|
$backgroundColor: settings.theme.primary,
|
|
27082
27539
|
$borderRadius: "9999px",
|
|
27083
27540
|
$padding: "0.125rem 0.85rem",
|
|
27084
|
-
children: /* @__PURE__ */
|
|
27541
|
+
children: /* @__PURE__ */ jsx63(
|
|
27085
27542
|
Text,
|
|
27086
27543
|
{
|
|
27087
27544
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27094,7 +27551,7 @@ var AddOn2 = ({
|
|
|
27094
27551
|
]
|
|
27095
27552
|
}
|
|
27096
27553
|
),
|
|
27097
|
-
/* @__PURE__ */
|
|
27554
|
+
/* @__PURE__ */ jsxs48(
|
|
27098
27555
|
Flex,
|
|
27099
27556
|
{
|
|
27100
27557
|
$flexDirection: "column",
|
|
@@ -27103,7 +27560,7 @@ var AddOn2 = ({
|
|
|
27103
27560
|
$flexGrow: 1,
|
|
27104
27561
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27105
27562
|
children: [
|
|
27106
|
-
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */
|
|
27563
|
+
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ jsx63(
|
|
27107
27564
|
Flex,
|
|
27108
27565
|
{
|
|
27109
27566
|
as: "ul",
|
|
@@ -27115,7 +27572,7 @@ var AddOn2 = ({
|
|
|
27115
27572
|
$listStyle: "none",
|
|
27116
27573
|
children: displayableEntitlements.map((entitlement, idx) => {
|
|
27117
27574
|
if (entitlement.isUnlimited) {
|
|
27118
|
-
return /* @__PURE__ */
|
|
27575
|
+
return /* @__PURE__ */ jsxs48(
|
|
27119
27576
|
Flex,
|
|
27120
27577
|
{
|
|
27121
27578
|
as: "li",
|
|
@@ -27124,8 +27581,8 @@ var AddOn2 = ({
|
|
|
27124
27581
|
$alignItems: "center",
|
|
27125
27582
|
$gap: "1rem",
|
|
27126
27583
|
children: [
|
|
27127
|
-
/* @__PURE__ */
|
|
27128
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27584
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27585
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27129
27586
|
Icon3,
|
|
27130
27587
|
{
|
|
27131
27588
|
name: entitlement.feature.icon,
|
|
@@ -27134,16 +27591,16 @@ var AddOn2 = ({
|
|
|
27134
27591
|
rounded: true
|
|
27135
27592
|
}
|
|
27136
27593
|
),
|
|
27137
|
-
entitlement.feature && /* @__PURE__ */
|
|
27594
|
+
entitlement.feature && /* @__PURE__ */ jsx63(
|
|
27138
27595
|
Flex,
|
|
27139
27596
|
{
|
|
27140
27597
|
$flexDirection: "column",
|
|
27141
27598
|
$justifyContent: "center",
|
|
27142
|
-
children: /* @__PURE__ */
|
|
27599
|
+
children: /* @__PURE__ */ jsx63(Text, { children: getFeatureName(entitlement.feature) })
|
|
27143
27600
|
}
|
|
27144
27601
|
)
|
|
27145
27602
|
] }),
|
|
27146
|
-
/* @__PURE__ */
|
|
27603
|
+
/* @__PURE__ */ jsx63(
|
|
27147
27604
|
Text,
|
|
27148
27605
|
{
|
|
27149
27606
|
style: { opacity: 0.54 },
|
|
@@ -27158,7 +27615,7 @@ var AddOn2 = ({
|
|
|
27158
27615
|
);
|
|
27159
27616
|
}
|
|
27160
27617
|
const meteredEntitlement = entitlement;
|
|
27161
|
-
return /* @__PURE__ */
|
|
27618
|
+
return /* @__PURE__ */ jsxs48(
|
|
27162
27619
|
Flex,
|
|
27163
27620
|
{
|
|
27164
27621
|
as: "li",
|
|
@@ -27168,8 +27625,8 @@ var AddOn2 = ({
|
|
|
27168
27625
|
$gap: "1rem",
|
|
27169
27626
|
$listStyle: "none",
|
|
27170
27627
|
children: [
|
|
27171
|
-
/* @__PURE__ */
|
|
27172
|
-
meteredEntitlement.feature?.icon && /* @__PURE__ */
|
|
27628
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27629
|
+
meteredEntitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27173
27630
|
Icon3,
|
|
27174
27631
|
{
|
|
27175
27632
|
"data-testid": "sch-feature-icon",
|
|
@@ -27179,9 +27636,9 @@ var AddOn2 = ({
|
|
|
27179
27636
|
rounded: true
|
|
27180
27637
|
}
|
|
27181
27638
|
),
|
|
27182
|
-
/* @__PURE__ */
|
|
27639
|
+
/* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ jsx63(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
|
|
27183
27640
|
] }),
|
|
27184
|
-
/* @__PURE__ */
|
|
27641
|
+
/* @__PURE__ */ jsx63(
|
|
27185
27642
|
Text,
|
|
27186
27643
|
{
|
|
27187
27644
|
style: { opacity: 0.54 },
|
|
@@ -27197,7 +27654,7 @@ var AddOn2 = ({
|
|
|
27197
27654
|
})
|
|
27198
27655
|
}
|
|
27199
27656
|
),
|
|
27200
|
-
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27657
|
+
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ jsx63(
|
|
27201
27658
|
Button,
|
|
27202
27659
|
{
|
|
27203
27660
|
type: "button",
|
|
@@ -27236,10 +27693,10 @@ var AddOn2 = ({
|
|
|
27236
27693
|
};
|
|
27237
27694
|
|
|
27238
27695
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27239
|
-
import { useState as
|
|
27696
|
+
import { useState as useState21 } from "react";
|
|
27240
27697
|
|
|
27241
27698
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
27242
|
-
import { Fragment as Fragment28, jsx as
|
|
27699
|
+
import { Fragment as Fragment28, jsx as jsx64, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
27243
27700
|
var Entitlement2 = ({
|
|
27244
27701
|
entitlement,
|
|
27245
27702
|
sharedProps,
|
|
@@ -27273,8 +27730,8 @@ var Entitlement2 = ({
|
|
|
27273
27730
|
entitlement,
|
|
27274
27731
|
credits
|
|
27275
27732
|
);
|
|
27276
|
-
return /* @__PURE__ */
|
|
27277
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27733
|
+
return /* @__PURE__ */ jsxs49(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
|
|
27734
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx64(
|
|
27278
27735
|
Icon3,
|
|
27279
27736
|
{
|
|
27280
27737
|
"data-testid": "sch-feature-icon",
|
|
@@ -27284,31 +27741,31 @@ var Entitlement2 = ({
|
|
|
27284
27741
|
rounded: true
|
|
27285
27742
|
}
|
|
27286
27743
|
),
|
|
27287
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
27288
|
-
/* @__PURE__ */
|
|
27289
|
-
/* @__PURE__ */
|
|
27744
|
+
entitlement.feature?.name && /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27745
|
+
/* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
27746
|
+
/* @__PURE__ */ jsx64(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27290
27747
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27291
27748
|
" ",
|
|
27292
27749
|
t4("per"),
|
|
27293
27750
|
" ",
|
|
27294
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27751
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27295
27752
|
formatNumber(entitlementPackageSize),
|
|
27296
27753
|
" "
|
|
27297
27754
|
] }),
|
|
27298
27755
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
27299
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
27756
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27300
27757
|
" ",
|
|
27301
27758
|
t4("per"),
|
|
27302
27759
|
" ",
|
|
27303
27760
|
selectedPeriod
|
|
27304
27761
|
] })
|
|
27305
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */
|
|
27762
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ jsx64(
|
|
27306
27763
|
TieredPricingDetails,
|
|
27307
27764
|
{
|
|
27308
27765
|
entitlement,
|
|
27309
27766
|
period: selectedPeriod
|
|
27310
27767
|
}
|
|
27311
|
-
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */
|
|
27768
|
+
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27312
27769
|
formatConsumptionRate(entitlement.consumptionRate),
|
|
27313
27770
|
" ",
|
|
27314
27771
|
getFeatureName(
|
|
@@ -27319,7 +27776,7 @@ var Entitlement2 = ({
|
|
|
27319
27776
|
t4("per"),
|
|
27320
27777
|
" ",
|
|
27321
27778
|
getFeatureName(entitlement.feature, 1)
|
|
27322
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */
|
|
27779
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx64(Fragment28, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
|
|
27323
27780
|
amount: formatNumber(creditBasedEntitlementLimit.limit),
|
|
27324
27781
|
units: getFeatureName(
|
|
27325
27782
|
entitlement.feature,
|
|
@@ -27332,25 +27789,25 @@ var Entitlement2 = ({
|
|
|
27332
27789
|
entitlement.feature,
|
|
27333
27790
|
creditBasedEntitlementLimit.limit
|
|
27334
27791
|
)
|
|
27335
|
-
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */
|
|
27792
|
+
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27336
27793
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
|
|
27337
27794
|
item: getFeatureName(entitlement.feature)
|
|
27338
|
-
}) : /* @__PURE__ */
|
|
27339
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
27795
|
+
}) : /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27796
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27340
27797
|
formatNumber(limit),
|
|
27341
27798
|
" "
|
|
27342
27799
|
] }),
|
|
27343
27800
|
getFeatureName(entitlement.feature, limit)
|
|
27344
27801
|
] }),
|
|
27345
|
-
metricPeriodName && /* @__PURE__ */
|
|
27802
|
+
metricPeriodName && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27346
27803
|
" ",
|
|
27347
27804
|
t4("per"),
|
|
27348
27805
|
" ",
|
|
27349
27806
|
t4(metricPeriodName)
|
|
27350
27807
|
] })
|
|
27351
27808
|
] }) : entitlement.feature.name }),
|
|
27352
|
-
/* @__PURE__ */
|
|
27353
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */
|
|
27809
|
+
/* @__PURE__ */ jsxs49(Text, { children: [
|
|
27810
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsx64(Fragment28, { children: /* @__PURE__ */ jsxs49(
|
|
27354
27811
|
Text,
|
|
27355
27812
|
{
|
|
27356
27813
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27360,7 +27817,7 @@ var Entitlement2 = ({
|
|
|
27360
27817
|
" ",
|
|
27361
27818
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27362
27819
|
"/",
|
|
27363
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27820
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27364
27821
|
formatNumber(entitlementPackageSize),
|
|
27365
27822
|
" "
|
|
27366
27823
|
] }),
|
|
@@ -27368,14 +27825,14 @@ var Entitlement2 = ({
|
|
|
27368
27825
|
entitlement.feature,
|
|
27369
27826
|
entitlementPackageSize
|
|
27370
27827
|
),
|
|
27371
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
27828
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27372
27829
|
"/",
|
|
27373
27830
|
shortenPeriod(selectedPeriod)
|
|
27374
27831
|
] })
|
|
27375
27832
|
]
|
|
27376
27833
|
}
|
|
27377
|
-
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */
|
|
27378
|
-
/* @__PURE__ */
|
|
27834
|
+
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27835
|
+
/* @__PURE__ */ jsx64(
|
|
27379
27836
|
Text,
|
|
27380
27837
|
{
|
|
27381
27838
|
style: { opacity: 0.54 },
|
|
@@ -27384,7 +27841,7 @@ var Entitlement2 = ({
|
|
|
27384
27841
|
children: t4("Tier-based")
|
|
27385
27842
|
}
|
|
27386
27843
|
),
|
|
27387
|
-
/* @__PURE__ */
|
|
27844
|
+
/* @__PURE__ */ jsx64(
|
|
27388
27845
|
PricingTiersTooltip,
|
|
27389
27846
|
{
|
|
27390
27847
|
feature: entitlement.feature,
|
|
@@ -27395,14 +27852,14 @@ var Entitlement2 = ({
|
|
|
27395
27852
|
}
|
|
27396
27853
|
)
|
|
27397
27854
|
] }),
|
|
27398
|
-
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
27855
|
+
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx64(
|
|
27399
27856
|
HardLimitTooltip,
|
|
27400
27857
|
{
|
|
27401
27858
|
feature: entitlement.feature,
|
|
27402
27859
|
limit: entitlement.valueNumeric
|
|
27403
27860
|
}
|
|
27404
27861
|
),
|
|
27405
|
-
entitlement.billingThreshold && /* @__PURE__ */
|
|
27862
|
+
entitlement.billingThreshold && /* @__PURE__ */ jsx64(
|
|
27406
27863
|
BillingThresholdTooltip,
|
|
27407
27864
|
{
|
|
27408
27865
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -27410,7 +27867,7 @@ var Entitlement2 = ({
|
|
|
27410
27867
|
)
|
|
27411
27868
|
] })
|
|
27412
27869
|
] }),
|
|
27413
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */
|
|
27870
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx64(
|
|
27414
27871
|
Text,
|
|
27415
27872
|
{
|
|
27416
27873
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27423,7 +27880,7 @@ var Entitlement2 = ({
|
|
|
27423
27880
|
};
|
|
27424
27881
|
|
|
27425
27882
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27426
|
-
import { jsx as
|
|
27883
|
+
import { jsx as jsx65, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
27427
27884
|
var Plan2 = ({
|
|
27428
27885
|
plan,
|
|
27429
27886
|
index,
|
|
@@ -27437,7 +27894,7 @@ var Plan2 = ({
|
|
|
27437
27894
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
27438
27895
|
const isLightBackground = useIsLightBackground();
|
|
27439
27896
|
const trialEnd = useTrialEnd();
|
|
27440
|
-
const [entitlementVisibility, setEntitlementVisibility] =
|
|
27897
|
+
const [entitlementVisibility, setEntitlementVisibility] = useState21({});
|
|
27441
27898
|
const handleToggleShowAll = (id) => {
|
|
27442
27899
|
setEntitlementVisibility((prev2) => {
|
|
27443
27900
|
const updated = !(prev2[id] ?? false);
|
|
@@ -27466,7 +27923,7 @@ var Plan2 = ({
|
|
|
27466
27923
|
const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
|
|
27467
27924
|
const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
|
|
27468
27925
|
const isExpanded = entitlementVisibility[plan.id] ?? false;
|
|
27469
|
-
return /* @__PURE__ */
|
|
27926
|
+
return /* @__PURE__ */ jsxs50(
|
|
27470
27927
|
Flex,
|
|
27471
27928
|
{
|
|
27472
27929
|
as: "li",
|
|
@@ -27486,7 +27943,7 @@ var Plan2 = ({
|
|
|
27486
27943
|
$boxShadow: cardBoxShadow
|
|
27487
27944
|
},
|
|
27488
27945
|
children: [
|
|
27489
|
-
/* @__PURE__ */
|
|
27946
|
+
/* @__PURE__ */ jsxs50(
|
|
27490
27947
|
Flex,
|
|
27491
27948
|
{
|
|
27492
27949
|
$flexDirection: "column",
|
|
@@ -27497,7 +27954,7 @@ var Plan2 = ({
|
|
|
27497
27954
|
$borderStyle: "solid",
|
|
27498
27955
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27499
27956
|
children: [
|
|
27500
|
-
/* @__PURE__ */
|
|
27957
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsx65(
|
|
27501
27958
|
Text,
|
|
27502
27959
|
{
|
|
27503
27960
|
as: "h3",
|
|
@@ -27506,8 +27963,8 @@ var Plan2 = ({
|
|
|
27506
27963
|
children: plan.name
|
|
27507
27964
|
}
|
|
27508
27965
|
) }),
|
|
27509
|
-
layout.plans.description.isVisible && /* @__PURE__ */
|
|
27510
|
-
/* @__PURE__ */
|
|
27966
|
+
layout.plans.description.isVisible && /* @__PURE__ */ jsx65(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx65(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
27967
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsxs50(
|
|
27511
27968
|
Text,
|
|
27512
27969
|
{
|
|
27513
27970
|
"data-testid": "sch-plan-price",
|
|
@@ -27523,14 +27980,14 @@ var Plan2 = ({
|
|
|
27523
27980
|
currency: planCurrency,
|
|
27524
27981
|
testSignificantDigits: false
|
|
27525
27982
|
}) : formatCurrency(planPrice ?? 0, planCurrency),
|
|
27526
|
-
!plan.custom && !isFreePlan && /* @__PURE__ */
|
|
27983
|
+
!plan.custom && !isFreePlan && /* @__PURE__ */ jsxs50("sub", { children: [
|
|
27527
27984
|
"/",
|
|
27528
27985
|
showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
|
|
27529
27986
|
] })
|
|
27530
27987
|
]
|
|
27531
27988
|
}
|
|
27532
27989
|
) }),
|
|
27533
|
-
showCredits && credits.length > 0 && /* @__PURE__ */
|
|
27990
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ jsx65(
|
|
27534
27991
|
Flex,
|
|
27535
27992
|
{
|
|
27536
27993
|
as: "ul",
|
|
@@ -27542,8 +27999,8 @@ var Plan2 = ({
|
|
|
27542
27999
|
$margin: 0,
|
|
27543
28000
|
$listStyle: "none",
|
|
27544
28001
|
children: credits.map((credit, idx) => {
|
|
27545
|
-
return /* @__PURE__ */
|
|
27546
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */
|
|
28002
|
+
return /* @__PURE__ */ jsxs50(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
|
|
28003
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx65(
|
|
27547
28004
|
Icon3,
|
|
27548
28005
|
{
|
|
27549
28006
|
"data-testid": "sch-feature-icon",
|
|
@@ -27553,13 +28010,13 @@ var Plan2 = ({
|
|
|
27553
28010
|
rounded: true
|
|
27554
28011
|
}
|
|
27555
28012
|
),
|
|
27556
|
-
credit.name && /* @__PURE__ */
|
|
28013
|
+
credit.name && /* @__PURE__ */ jsx65(
|
|
27557
28014
|
Flex,
|
|
27558
28015
|
{
|
|
27559
28016
|
$flexDirection: "column",
|
|
27560
28017
|
$justifyContent: "center",
|
|
27561
28018
|
$gap: "0.5rem",
|
|
27562
|
-
children: /* @__PURE__ */
|
|
28019
|
+
children: /* @__PURE__ */ jsx65(
|
|
27563
28020
|
PlanCreditText,
|
|
27564
28021
|
{
|
|
27565
28022
|
credit,
|
|
@@ -27572,7 +28029,7 @@ var Plan2 = ({
|
|
|
27572
28029
|
})
|
|
27573
28030
|
}
|
|
27574
28031
|
),
|
|
27575
|
-
isActivePlan && /* @__PURE__ */
|
|
28032
|
+
isActivePlan && /* @__PURE__ */ jsx65(
|
|
27576
28033
|
Flex,
|
|
27577
28034
|
{
|
|
27578
28035
|
"data-testid": "sch-plan-active",
|
|
@@ -27582,7 +28039,7 @@ var Plan2 = ({
|
|
|
27582
28039
|
$backgroundColor: settings.theme.primary,
|
|
27583
28040
|
$borderRadius: "9999px",
|
|
27584
28041
|
$padding: "0.125rem 0.85rem",
|
|
27585
|
-
children: /* @__PURE__ */
|
|
28042
|
+
children: /* @__PURE__ */ jsx65(
|
|
27586
28043
|
Text,
|
|
27587
28044
|
{
|
|
27588
28045
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27595,7 +28052,7 @@ var Plan2 = ({
|
|
|
27595
28052
|
]
|
|
27596
28053
|
}
|
|
27597
28054
|
),
|
|
27598
|
-
/* @__PURE__ */
|
|
28055
|
+
/* @__PURE__ */ jsxs50(
|
|
27599
28056
|
Flex,
|
|
27600
28057
|
{
|
|
27601
28058
|
$flexDirection: "column",
|
|
@@ -27604,7 +28061,7 @@ var Plan2 = ({
|
|
|
27604
28061
|
$gap: `${cardPadding}rem`,
|
|
27605
28062
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27606
28063
|
children: [
|
|
27607
|
-
layout.plans.showEntitlements && /* @__PURE__ */
|
|
28064
|
+
layout.plans.showEntitlements && /* @__PURE__ */ jsxs50(
|
|
27608
28065
|
Flex,
|
|
27609
28066
|
{
|
|
27610
28067
|
as: "ul",
|
|
@@ -27615,14 +28072,14 @@ var Plan2 = ({
|
|
|
27615
28072
|
$margin: 0,
|
|
27616
28073
|
$listStyle: "none",
|
|
27617
28074
|
children: [
|
|
27618
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */
|
|
28075
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx65(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx65(Text, { children: t4("Everything in", {
|
|
27619
28076
|
plan: plans[index - 1].name
|
|
27620
28077
|
}) }) }),
|
|
27621
28078
|
(plan.entitlements ?? []).reduce(
|
|
27622
28079
|
(acc, entitlement, idx) => {
|
|
27623
28080
|
if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
|
|
27624
28081
|
acc.push(
|
|
27625
|
-
/* @__PURE__ */
|
|
28082
|
+
/* @__PURE__ */ jsx65(
|
|
27626
28083
|
Entitlement2,
|
|
27627
28084
|
{
|
|
27628
28085
|
entitlement,
|
|
@@ -27640,7 +28097,7 @@ var Plan2 = ({
|
|
|
27640
28097
|
},
|
|
27641
28098
|
[]
|
|
27642
28099
|
),
|
|
27643
|
-
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */
|
|
28100
|
+
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsx65(
|
|
27644
28101
|
ExpandListToggle,
|
|
27645
28102
|
{
|
|
27646
28103
|
as: "li",
|
|
@@ -27655,7 +28112,7 @@ var Plan2 = ({
|
|
|
27655
28112
|
]
|
|
27656
28113
|
}
|
|
27657
28114
|
),
|
|
27658
|
-
isActivePlan ? /* @__PURE__ */
|
|
28115
|
+
isActivePlan ? /* @__PURE__ */ jsxs50(
|
|
27659
28116
|
Flex,
|
|
27660
28117
|
{
|
|
27661
28118
|
$justifyContent: "center",
|
|
@@ -27663,7 +28120,7 @@ var Plan2 = ({
|
|
|
27663
28120
|
$gap: "0.25rem",
|
|
27664
28121
|
$padding: "0.625rem 0",
|
|
27665
28122
|
children: [
|
|
27666
|
-
/* @__PURE__ */
|
|
28123
|
+
/* @__PURE__ */ jsx65(
|
|
27667
28124
|
Icon3,
|
|
27668
28125
|
{
|
|
27669
28126
|
name: "check-rounded",
|
|
@@ -27671,11 +28128,11 @@ var Plan2 = ({
|
|
|
27671
28128
|
color: settings.theme.primary
|
|
27672
28129
|
}
|
|
27673
28130
|
),
|
|
27674
|
-
/* @__PURE__ */
|
|
28131
|
+
/* @__PURE__ */ jsx65(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
|
|
27675
28132
|
]
|
|
27676
28133
|
}
|
|
27677
|
-
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27678
|
-
/* @__PURE__ */
|
|
28134
|
+
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs50(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28135
|
+
/* @__PURE__ */ jsx65(
|
|
27679
28136
|
Button,
|
|
27680
28137
|
{
|
|
27681
28138
|
type: "button",
|
|
@@ -27713,10 +28170,10 @@ var Plan2 = ({
|
|
|
27713
28170
|
}
|
|
27714
28171
|
},
|
|
27715
28172
|
$fullWidth: true,
|
|
27716
|
-
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */
|
|
28173
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ jsx65(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
|
|
27717
28174
|
}
|
|
27718
28175
|
),
|
|
27719
|
-
!plan.valid && /* @__PURE__ */
|
|
28176
|
+
!plan.valid && /* @__PURE__ */ jsx65(UsageViolationText, { violations: plan.usageViolations })
|
|
27720
28177
|
] })
|
|
27721
28178
|
]
|
|
27722
28179
|
}
|
|
@@ -27727,7 +28184,7 @@ var Plan2 = ({
|
|
|
27727
28184
|
};
|
|
27728
28185
|
|
|
27729
28186
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
27730
|
-
import { Fragment as Fragment30, jsx as
|
|
28187
|
+
import { Fragment as Fragment30, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
27731
28188
|
var resolveDesignProps8 = (props) => {
|
|
27732
28189
|
return {
|
|
27733
28190
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -27792,11 +28249,11 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27792
28249
|
},
|
|
27793
28250
|
[]
|
|
27794
28251
|
);
|
|
27795
|
-
const [selectedPeriod, setSelectedPeriod] =
|
|
28252
|
+
const [selectedPeriod, setSelectedPeriod] = useState22(
|
|
27796
28253
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
|
|
27797
28254
|
);
|
|
27798
28255
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
27799
|
-
const [selectedCurrency, setSelectedCurrency] =
|
|
28256
|
+
const [selectedCurrency, setSelectedCurrency] = useState22(
|
|
27800
28257
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
27801
28258
|
);
|
|
27802
28259
|
if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
|
|
@@ -27814,25 +28271,25 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27814
28271
|
} = useAvailablePlans(selectedPeriod, {
|
|
27815
28272
|
useSelectedPeriod: showPeriodToggle
|
|
27816
28273
|
});
|
|
27817
|
-
const plans =
|
|
28274
|
+
const plans = useMemo35(
|
|
27818
28275
|
() => hasCurrency ? allPlans.filter(
|
|
27819
28276
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
27820
28277
|
) : allPlans,
|
|
27821
28278
|
[allPlans, hasCurrency, selectedCurrency]
|
|
27822
28279
|
);
|
|
27823
|
-
const addOns =
|
|
28280
|
+
const addOns = useMemo35(
|
|
27824
28281
|
() => hasCurrency ? allAddOns.filter(
|
|
27825
28282
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
27826
28283
|
) : allAddOns,
|
|
27827
28284
|
[allAddOns, hasCurrency, selectedCurrency]
|
|
27828
28285
|
);
|
|
27829
|
-
|
|
28286
|
+
useEffect9(() => {
|
|
27830
28287
|
if (typeof data?.component === "undefined") {
|
|
27831
28288
|
hydratePublic();
|
|
27832
28289
|
}
|
|
27833
28290
|
}, [data?.component, hydratePublic]);
|
|
27834
28291
|
if (isPending) {
|
|
27835
|
-
return /* @__PURE__ */
|
|
28292
|
+
return /* @__PURE__ */ jsx66(
|
|
27836
28293
|
Flex,
|
|
27837
28294
|
{
|
|
27838
28295
|
$width: "100%",
|
|
@@ -27840,12 +28297,12 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27840
28297
|
$alignItems: "center",
|
|
27841
28298
|
$justifyContent: "center",
|
|
27842
28299
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
27843
|
-
children: /* @__PURE__ */
|
|
28300
|
+
children: /* @__PURE__ */ jsx66(Loader, { "aria-label": "loading", $size: "2xl" })
|
|
27844
28301
|
}
|
|
27845
28302
|
);
|
|
27846
28303
|
}
|
|
27847
28304
|
if (hasNoUsableCurrency) {
|
|
27848
|
-
return /* @__PURE__ */
|
|
28305
|
+
return /* @__PURE__ */ jsx66(Container, { children: /* @__PURE__ */ jsx66(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ jsx66(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
|
|
27849
28306
|
}
|
|
27850
28307
|
const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
|
|
27851
28308
|
const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
|
|
@@ -27854,7 +28311,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27854
28311
|
rest.callToActionTarget
|
|
27855
28312
|
);
|
|
27856
28313
|
const Wrapper = typeof data?.component === "undefined" ? Container : Fragment29;
|
|
27857
|
-
return /* @__PURE__ */
|
|
28314
|
+
return /* @__PURE__ */ jsx66(Wrapper, { children: /* @__PURE__ */ jsxs51(
|
|
27858
28315
|
FussyChild,
|
|
27859
28316
|
{
|
|
27860
28317
|
ref,
|
|
@@ -27864,8 +28321,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27864
28321
|
$flexDirection: "column",
|
|
27865
28322
|
$gap: "2rem",
|
|
27866
28323
|
children: [
|
|
27867
|
-
/* @__PURE__ */
|
|
27868
|
-
/* @__PURE__ */
|
|
28324
|
+
/* @__PURE__ */ jsxs51(Box, { children: [
|
|
28325
|
+
/* @__PURE__ */ jsxs51(
|
|
27869
28326
|
Flex,
|
|
27870
28327
|
{
|
|
27871
28328
|
$flexDirection: "column",
|
|
@@ -27880,7 +28337,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27880
28337
|
}
|
|
27881
28338
|
},
|
|
27882
28339
|
children: [
|
|
27883
|
-
/* @__PURE__ */
|
|
28340
|
+
/* @__PURE__ */ jsx66(
|
|
27884
28341
|
Text,
|
|
27885
28342
|
{
|
|
27886
28343
|
as: "h2",
|
|
@@ -27889,8 +28346,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27889
28346
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
|
|
27890
28347
|
}
|
|
27891
28348
|
),
|
|
27892
|
-
/* @__PURE__ */
|
|
27893
|
-
showCurrencySelector && /* @__PURE__ */
|
|
28349
|
+
/* @__PURE__ */ jsxs51(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
|
|
28350
|
+
showCurrencySelector && /* @__PURE__ */ jsx66(
|
|
27894
28351
|
CurrencyToggle,
|
|
27895
28352
|
{
|
|
27896
28353
|
currencies,
|
|
@@ -27898,7 +28355,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27898
28355
|
onSelect: setSelectedCurrency
|
|
27899
28356
|
}
|
|
27900
28357
|
),
|
|
27901
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */
|
|
28358
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx66(
|
|
27902
28359
|
PeriodToggle,
|
|
27903
28360
|
{
|
|
27904
28361
|
options: periods,
|
|
@@ -27915,7 +28372,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27915
28372
|
]
|
|
27916
28373
|
}
|
|
27917
28374
|
),
|
|
27918
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */
|
|
28375
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx66(
|
|
27919
28376
|
Box,
|
|
27920
28377
|
{
|
|
27921
28378
|
as: "ul",
|
|
@@ -27928,7 +28385,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27928
28385
|
$listStyle: "none",
|
|
27929
28386
|
children: plans.map((plan, index, self2) => {
|
|
27930
28387
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
27931
|
-
return /* @__PURE__ */
|
|
28388
|
+
return /* @__PURE__ */ jsx66(
|
|
27932
28389
|
Plan2,
|
|
27933
28390
|
{
|
|
27934
28391
|
plan,
|
|
@@ -27950,14 +28407,14 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27950
28407
|
}
|
|
27951
28408
|
)
|
|
27952
28409
|
] }),
|
|
27953
|
-
/* @__PURE__ */
|
|
27954
|
-
props.header.isVisible && /* @__PURE__ */
|
|
28410
|
+
/* @__PURE__ */ jsx66(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs51(Fragment30, { children: [
|
|
28411
|
+
props.header.isVisible && /* @__PURE__ */ jsx66(
|
|
27955
28412
|
Flex,
|
|
27956
28413
|
{
|
|
27957
28414
|
$justifyContent: "space-between",
|
|
27958
28415
|
$alignItems: "center",
|
|
27959
28416
|
$marginBottom: "1rem",
|
|
27960
|
-
children: /* @__PURE__ */
|
|
28417
|
+
children: /* @__PURE__ */ jsx66(
|
|
27961
28418
|
Text,
|
|
27962
28419
|
{
|
|
27963
28420
|
as: "h2",
|
|
@@ -27968,7 +28425,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27968
28425
|
)
|
|
27969
28426
|
}
|
|
27970
28427
|
),
|
|
27971
|
-
/* @__PURE__ */
|
|
28428
|
+
/* @__PURE__ */ jsx66(
|
|
27972
28429
|
Box,
|
|
27973
28430
|
{
|
|
27974
28431
|
as: "ul",
|
|
@@ -27980,7 +28437,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27980
28437
|
$listStyle: "none",
|
|
27981
28438
|
children: addOns.map((addOn, index) => {
|
|
27982
28439
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
27983
|
-
return /* @__PURE__ */
|
|
28440
|
+
return /* @__PURE__ */ jsx66(
|
|
27984
28441
|
AddOn2,
|
|
27985
28442
|
{
|
|
27986
28443
|
addOn,
|
|
@@ -28008,7 +28465,7 @@ PricingTable.displayName = "PricingTable";
|
|
|
28008
28465
|
|
|
28009
28466
|
// src/components/elements/text/Text.tsx
|
|
28010
28467
|
import { forwardRef as forwardRef16 } from "react";
|
|
28011
|
-
import { jsx as
|
|
28468
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
28012
28469
|
var resolveDesignProps9 = (props) => {
|
|
28013
28470
|
return {
|
|
28014
28471
|
text: {
|
|
@@ -28020,7 +28477,7 @@ var resolveDesignProps9 = (props) => {
|
|
|
28020
28477
|
};
|
|
28021
28478
|
var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
28022
28479
|
const props = resolveDesignProps9(rest);
|
|
28023
|
-
return /* @__PURE__ */
|
|
28480
|
+
return /* @__PURE__ */ jsx67(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx67(
|
|
28024
28481
|
Text,
|
|
28025
28482
|
{
|
|
28026
28483
|
display: props.text.fontStyle,
|
|
@@ -28033,8 +28490,8 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
|
28033
28490
|
TextElement.displayName = "Text";
|
|
28034
28491
|
|
|
28035
28492
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28036
|
-
import { forwardRef as forwardRef17, useMemo as
|
|
28037
|
-
import { jsx as
|
|
28493
|
+
import { forwardRef as forwardRef17, useMemo as useMemo36 } from "react";
|
|
28494
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
28038
28495
|
var buttonStyles = {
|
|
28039
28496
|
primary: {
|
|
28040
28497
|
color: "primary",
|
|
@@ -28064,13 +28521,13 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28064
28521
|
const props = resolveDesignProps10(rest);
|
|
28065
28522
|
const { t: t4 } = useTranslation();
|
|
28066
28523
|
const { data, setLayout } = useEmbed();
|
|
28067
|
-
const hasActiveSubscription =
|
|
28524
|
+
const hasActiveSubscription = useMemo36(() => {
|
|
28068
28525
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28069
28526
|
}, [data?.subscription]);
|
|
28070
28527
|
if (!hasActiveSubscription) {
|
|
28071
28528
|
return null;
|
|
28072
28529
|
}
|
|
28073
|
-
return /* @__PURE__ */
|
|
28530
|
+
return /* @__PURE__ */ jsx68(
|
|
28074
28531
|
Element,
|
|
28075
28532
|
{
|
|
28076
28533
|
as: Flex,
|
|
@@ -28078,7 +28535,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28078
28535
|
className,
|
|
28079
28536
|
$flexDirection: "column",
|
|
28080
28537
|
$gap: "2rem",
|
|
28081
|
-
children: /* @__PURE__ */
|
|
28538
|
+
children: /* @__PURE__ */ jsx68(
|
|
28082
28539
|
Button,
|
|
28083
28540
|
{
|
|
28084
28541
|
type: "button",
|
|
@@ -28099,8 +28556,8 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28099
28556
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
28100
28557
|
|
|
28101
28558
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
28102
|
-
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as
|
|
28103
|
-
import { jsx as
|
|
28559
|
+
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo37, useState as useState23 } from "react";
|
|
28560
|
+
import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
28104
28561
|
function resolveDesignProps11(props) {
|
|
28105
28562
|
return {
|
|
28106
28563
|
header: {
|
|
@@ -28124,10 +28581,10 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28124
28581
|
const { t: t4 } = useTranslation();
|
|
28125
28582
|
const { data, settings, getUpcomingInvoice } = useEmbed();
|
|
28126
28583
|
const isLightBackground = useIsLightBackground();
|
|
28127
|
-
const [isLoading, setIsLoading] =
|
|
28128
|
-
const [error, setError] =
|
|
28129
|
-
const [upcomingInvoice, setUpcomingInvoice] =
|
|
28130
|
-
const discounts =
|
|
28584
|
+
const [isLoading, setIsLoading] = useState23(false);
|
|
28585
|
+
const [error, setError] = useState23();
|
|
28586
|
+
const [upcomingInvoice, setUpcomingInvoice] = useState23(data?.upcomingInvoice);
|
|
28587
|
+
const discounts = useMemo37(() => {
|
|
28131
28588
|
return (data?.subscription?.discounts || []).filter(
|
|
28132
28589
|
(discount) => (
|
|
28133
28590
|
// Only surface discounts that are currently active and actually
|
|
@@ -28161,15 +28618,15 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28161
28618
|
}
|
|
28162
28619
|
}
|
|
28163
28620
|
}, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
|
|
28164
|
-
|
|
28621
|
+
useEffect10(() => {
|
|
28165
28622
|
getInvoice();
|
|
28166
28623
|
}, [getInvoice]);
|
|
28167
|
-
|
|
28624
|
+
useEffect10(() => {
|
|
28168
28625
|
if (data?.upcomingInvoice) {
|
|
28169
28626
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
28170
28627
|
}
|
|
28171
28628
|
}, [data?.upcomingInvoice]);
|
|
28172
|
-
const { currency, applied, remaining } =
|
|
28629
|
+
const { currency, applied, remaining } = useMemo37(() => {
|
|
28173
28630
|
const currency2 = upcomingInvoice?.currency;
|
|
28174
28631
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
28175
28632
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -28188,9 +28645,9 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28188
28645
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
28189
28646
|
return null;
|
|
28190
28647
|
}
|
|
28191
|
-
return /* @__PURE__ */
|
|
28192
|
-
/* @__PURE__ */
|
|
28193
|
-
error ? /* @__PURE__ */
|
|
28648
|
+
return /* @__PURE__ */ jsxs52(Element, { ref, className, children: [
|
|
28649
|
+
/* @__PURE__ */ jsx69(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx69(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
28650
|
+
error ? /* @__PURE__ */ jsxs52(
|
|
28194
28651
|
Flex,
|
|
28195
28652
|
{
|
|
28196
28653
|
as: TransitionBox,
|
|
@@ -28199,8 +28656,8 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28199
28656
|
$alignItems: "center",
|
|
28200
28657
|
$gap: "1rem",
|
|
28201
28658
|
children: [
|
|
28202
|
-
/* @__PURE__ */
|
|
28203
|
-
/* @__PURE__ */
|
|
28659
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
|
|
28660
|
+
/* @__PURE__ */ jsx69(
|
|
28204
28661
|
Button,
|
|
28205
28662
|
{
|
|
28206
28663
|
type: "button",
|
|
@@ -28213,28 +28670,28 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28213
28670
|
)
|
|
28214
28671
|
]
|
|
28215
28672
|
}
|
|
28216
|
-
) : !isLoading && /* @__PURE__ */
|
|
28217
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */
|
|
28673
|
+
) : !isLoading && /* @__PURE__ */ jsx69(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
28674
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
|
|
28218
28675
|
props.header.prefix,
|
|
28219
28676
|
" ",
|
|
28220
28677
|
toPrettyDate(upcomingInvoice.dueDate)
|
|
28221
28678
|
] }),
|
|
28222
|
-
/* @__PURE__ */
|
|
28679
|
+
/* @__PURE__ */ jsxs52(
|
|
28223
28680
|
Flex,
|
|
28224
28681
|
{
|
|
28225
28682
|
$justifyContent: "space-between",
|
|
28226
28683
|
$alignItems: "start",
|
|
28227
28684
|
$gap: "1rem",
|
|
28228
28685
|
children: [
|
|
28229
|
-
props.price.isVisible && /* @__PURE__ */
|
|
28686
|
+
props.price.isVisible && /* @__PURE__ */ jsx69(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
|
|
28230
28687
|
upcomingInvoice.amountDue,
|
|
28231
28688
|
upcomingInvoice.currency
|
|
28232
28689
|
) }),
|
|
28233
|
-
/* @__PURE__ */
|
|
28690
|
+
/* @__PURE__ */ jsx69(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx69(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
|
|
28234
28691
|
]
|
|
28235
28692
|
}
|
|
28236
28693
|
),
|
|
28237
|
-
hasApplied && /* @__PURE__ */
|
|
28694
|
+
hasApplied && /* @__PURE__ */ jsxs52(
|
|
28238
28695
|
Flex,
|
|
28239
28696
|
{
|
|
28240
28697
|
as: TransitionBox,
|
|
@@ -28242,12 +28699,12 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28242
28699
|
$alignItems: "start",
|
|
28243
28700
|
$gap: "1rem",
|
|
28244
28701
|
children: [
|
|
28245
|
-
/* @__PURE__ */
|
|
28246
|
-
/* @__PURE__ */
|
|
28702
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
|
|
28703
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(-applied, currency) })
|
|
28247
28704
|
]
|
|
28248
28705
|
}
|
|
28249
28706
|
),
|
|
28250
|
-
hasBalance && /* @__PURE__ */
|
|
28707
|
+
hasBalance && /* @__PURE__ */ jsxs52(
|
|
28251
28708
|
Flex,
|
|
28252
28709
|
{
|
|
28253
28710
|
as: TransitionBox,
|
|
@@ -28255,20 +28712,20 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28255
28712
|
$alignItems: "start",
|
|
28256
28713
|
$gap: "1rem",
|
|
28257
28714
|
children: [
|
|
28258
|
-
/* @__PURE__ */
|
|
28259
|
-
/* @__PURE__ */
|
|
28715
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
|
|
28716
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(remaining, currency) })
|
|
28260
28717
|
]
|
|
28261
28718
|
}
|
|
28262
28719
|
),
|
|
28263
|
-
discounts.length > 0 && /* @__PURE__ */
|
|
28720
|
+
discounts.length > 0 && /* @__PURE__ */ jsxs52(
|
|
28264
28721
|
Flex,
|
|
28265
28722
|
{
|
|
28266
28723
|
$justifyContent: "space-between",
|
|
28267
28724
|
$alignItems: "start",
|
|
28268
28725
|
$gap: "1rem",
|
|
28269
28726
|
children: [
|
|
28270
|
-
/* @__PURE__ */
|
|
28271
|
-
/* @__PURE__ */
|
|
28727
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Discount") }),
|
|
28728
|
+
/* @__PURE__ */ jsx69(
|
|
28272
28729
|
Flex,
|
|
28273
28730
|
{
|
|
28274
28731
|
$flexDirection: "column",
|
|
@@ -28284,13 +28741,13 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28284
28741
|
discount?.currency
|
|
28285
28742
|
)
|
|
28286
28743
|
});
|
|
28287
|
-
return /* @__PURE__ */
|
|
28744
|
+
return /* @__PURE__ */ jsxs52(
|
|
28288
28745
|
Flex,
|
|
28289
28746
|
{
|
|
28290
28747
|
$alignItems: "center",
|
|
28291
28748
|
$gap: "0.5rem",
|
|
28292
28749
|
children: [
|
|
28293
|
-
discount.customerFacingCode && /* @__PURE__ */
|
|
28750
|
+
discount.customerFacingCode && /* @__PURE__ */ jsx69(
|
|
28294
28751
|
Flex,
|
|
28295
28752
|
{
|
|
28296
28753
|
$alignItems: "center",
|
|
@@ -28299,7 +28756,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28299
28756
|
$borderStyle: "solid",
|
|
28300
28757
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
28301
28758
|
$borderRadius: "0.3125rem",
|
|
28302
|
-
children: /* @__PURE__ */
|
|
28759
|
+
children: /* @__PURE__ */ jsx69(
|
|
28303
28760
|
Text,
|
|
28304
28761
|
{
|
|
28305
28762
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28309,7 +28766,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28309
28766
|
)
|
|
28310
28767
|
}
|
|
28311
28768
|
),
|
|
28312
|
-
/* @__PURE__ */
|
|
28769
|
+
/* @__PURE__ */ jsx69(Box, { children: /* @__PURE__ */ jsx69(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
|
|
28313
28770
|
discount: label,
|
|
28314
28771
|
count: discount.durationInMonths
|
|
28315
28772
|
}) : label }) })
|
|
@@ -28323,7 +28780,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28323
28780
|
]
|
|
28324
28781
|
}
|
|
28325
28782
|
)
|
|
28326
|
-
] }) : /* @__PURE__ */
|
|
28783
|
+
] }) : /* @__PURE__ */ jsx69(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
|
|
28327
28784
|
] });
|
|
28328
28785
|
});
|
|
28329
28786
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -30959,7 +31416,7 @@ function inflate(input, options = {}) {
|
|
|
30959
31416
|
}
|
|
30960
31417
|
|
|
30961
31418
|
// src/components/embed/Embed.tsx
|
|
30962
|
-
import { useContext as useContext6, useEffect as
|
|
31419
|
+
import { useContext as useContext6, useEffect as useEffect11, useMemo as useMemo38 } from "react";
|
|
30963
31420
|
|
|
30964
31421
|
// src/components/embed/renderer.ts
|
|
30965
31422
|
import { createElement as createElement5 } from "react";
|
|
@@ -31039,11 +31496,11 @@ function createRenderer(options) {
|
|
|
31039
31496
|
}
|
|
31040
31497
|
|
|
31041
31498
|
// src/components/embed/Embed.tsx
|
|
31042
|
-
import { jsx as
|
|
31499
|
+
import { jsx as jsx70, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
31043
31500
|
var renderer = createRenderer();
|
|
31044
31501
|
var Loading = () => {
|
|
31045
31502
|
const { settings } = useEmbed();
|
|
31046
|
-
return /* @__PURE__ */
|
|
31503
|
+
return /* @__PURE__ */ jsx70(
|
|
31047
31504
|
Flex,
|
|
31048
31505
|
{
|
|
31049
31506
|
$width: "100%",
|
|
@@ -31051,13 +31508,13 @@ var Loading = () => {
|
|
|
31051
31508
|
$alignItems: "center",
|
|
31052
31509
|
$justifyContent: "center",
|
|
31053
31510
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
31054
|
-
children: /* @__PURE__ */
|
|
31511
|
+
children: /* @__PURE__ */ jsx70(Loader, { $color: settings.theme.primary, $size: "2xl" })
|
|
31055
31512
|
}
|
|
31056
31513
|
);
|
|
31057
31514
|
};
|
|
31058
31515
|
var Error2 = ({ message }) => {
|
|
31059
31516
|
const { settings } = useEmbed();
|
|
31060
|
-
return /* @__PURE__ */
|
|
31517
|
+
return /* @__PURE__ */ jsxs53(
|
|
31061
31518
|
Flex,
|
|
31062
31519
|
{
|
|
31063
31520
|
$flexDirection: "column",
|
|
@@ -31068,8 +31525,8 @@ var Error2 = ({ message }) => {
|
|
|
31068
31525
|
$alignItems: "center",
|
|
31069
31526
|
$justifyContent: "center",
|
|
31070
31527
|
children: [
|
|
31071
|
-
/* @__PURE__ */
|
|
31072
|
-
/* @__PURE__ */
|
|
31528
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { display: "heading1", children: "Error" }) }),
|
|
31529
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { children: message }) })
|
|
31073
31530
|
]
|
|
31074
31531
|
}
|
|
31075
31532
|
);
|
|
@@ -31087,7 +31544,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31087
31544
|
setBuilderSettings
|
|
31088
31545
|
} = useEmbed();
|
|
31089
31546
|
const compressedAst = data?.component?.ast;
|
|
31090
|
-
const { children, parsedSettings, parseError } =
|
|
31547
|
+
const { children, parsedSettings, parseError } = useMemo38(() => {
|
|
31091
31548
|
let children2 = null;
|
|
31092
31549
|
let parsedSettings2 = null;
|
|
31093
31550
|
let parseError2 = null;
|
|
@@ -31119,22 +31576,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31119
31576
|
parseError: parseError2
|
|
31120
31577
|
};
|
|
31121
31578
|
}, [compressedAst]);
|
|
31122
|
-
|
|
31579
|
+
useEffect11(() => {
|
|
31123
31580
|
if (accessToken) {
|
|
31124
31581
|
setAccessToken(accessToken);
|
|
31125
31582
|
}
|
|
31126
31583
|
}, [accessToken, setAccessToken]);
|
|
31127
|
-
|
|
31584
|
+
useEffect11(() => {
|
|
31128
31585
|
if (id && stale) {
|
|
31129
31586
|
hydrateComponent(id);
|
|
31130
31587
|
}
|
|
31131
31588
|
}, [id, hydrateComponent, stale]);
|
|
31132
|
-
|
|
31589
|
+
useEffect11(() => {
|
|
31133
31590
|
if (parsedSettings) {
|
|
31134
31591
|
setBuilderSettings(parsedSettings);
|
|
31135
31592
|
}
|
|
31136
31593
|
}, [parsedSettings, setBuilderSettings]);
|
|
31137
|
-
|
|
31594
|
+
useEffect11(() => {
|
|
31138
31595
|
if (parseError) {
|
|
31139
31596
|
setError(parseError);
|
|
31140
31597
|
}
|
|
@@ -31143,13 +31600,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31143
31600
|
return stub();
|
|
31144
31601
|
}
|
|
31145
31602
|
if (error) {
|
|
31146
|
-
return /* @__PURE__ */
|
|
31603
|
+
return /* @__PURE__ */ jsx70(Error2, { message: error.message });
|
|
31147
31604
|
}
|
|
31148
31605
|
if (accessToken?.length === 0) {
|
|
31149
|
-
return /* @__PURE__ */
|
|
31606
|
+
return /* @__PURE__ */ jsx70(Error2, { message: "Please provide an access token." });
|
|
31150
31607
|
}
|
|
31151
31608
|
if (!accessToken?.startsWith("token_")) {
|
|
31152
|
-
return /* @__PURE__ */
|
|
31609
|
+
return /* @__PURE__ */ jsx70(
|
|
31153
31610
|
Error2,
|
|
31154
31611
|
{
|
|
31155
31612
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -31157,9 +31614,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31157
31614
|
);
|
|
31158
31615
|
}
|
|
31159
31616
|
if (isPending) {
|
|
31160
|
-
return /* @__PURE__ */
|
|
31617
|
+
return /* @__PURE__ */ jsx70(Loading, {});
|
|
31161
31618
|
}
|
|
31162
|
-
return /* @__PURE__ */
|
|
31619
|
+
return /* @__PURE__ */ jsx70(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ jsx70(Loading, {}) });
|
|
31163
31620
|
};
|
|
31164
31621
|
export {
|
|
31165
31622
|
AddOns,
|