@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"
|
|
@@ -6978,7 +6992,7 @@ var Icon = ({ name, className = "", ...rest }) => {
|
|
|
6978
6992
|
};
|
|
6979
6993
|
|
|
6980
6994
|
// src/context/EmbedProvider.tsx
|
|
6981
|
-
var
|
|
6995
|
+
var import_debounce2 = __toESM(require_debounce());
|
|
6982
6996
|
var import_merge3 = __toESM(require_merge());
|
|
6983
6997
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useReducer, useRef as useRef2 } from "react";
|
|
6984
6998
|
|
|
@@ -7290,6 +7304,22 @@ var JSONApiResponse = class {
|
|
|
7290
7304
|
}
|
|
7291
7305
|
};
|
|
7292
7306
|
|
|
7307
|
+
// src/api/checkoutexternal/models/BillingArrearsAnchor.ts
|
|
7308
|
+
function BillingArrearsAnchorFromJSON(json) {
|
|
7309
|
+
return BillingArrearsAnchorFromJSONTyped(json, false);
|
|
7310
|
+
}
|
|
7311
|
+
function BillingArrearsAnchorFromJSONTyped(json, ignoreDiscriminator) {
|
|
7312
|
+
return json;
|
|
7313
|
+
}
|
|
7314
|
+
|
|
7315
|
+
// src/api/checkoutexternal/models/BillingArrearsCadence.ts
|
|
7316
|
+
function BillingArrearsCadenceFromJSON(json) {
|
|
7317
|
+
return BillingArrearsCadenceFromJSONTyped(json, false);
|
|
7318
|
+
}
|
|
7319
|
+
function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
|
|
7320
|
+
return json;
|
|
7321
|
+
}
|
|
7322
|
+
|
|
7293
7323
|
// src/api/checkoutexternal/models/BillingCollectionMethod.ts
|
|
7294
7324
|
function BillingCollectionMethodFromJSON(json) {
|
|
7295
7325
|
return BillingCollectionMethodFromJSONTyped(json, false);
|
|
@@ -7840,6 +7870,8 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7840
7870
|
return json;
|
|
7841
7871
|
}
|
|
7842
7872
|
return {
|
|
7873
|
+
arrearsAnchor: json["arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["arrears_anchor"]),
|
|
7874
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
7843
7875
|
autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
|
|
7844
7876
|
autoTopupAmountType: json["auto_topup_amount_type"] == null ? void 0 : json["auto_topup_amount_type"],
|
|
7845
7877
|
autoTopupAvailability: BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -7866,10 +7898,14 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7866
7898
|
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
7867
7899
|
id: json["id"],
|
|
7868
7900
|
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
7901
|
+
overdraftLimit: json["overdraft_limit"] == null ? void 0 : json["overdraft_limit"],
|
|
7869
7902
|
plan: json["plan"] == null ? void 0 : PreviewObjectResponseDataFromJSON(json["plan"]),
|
|
7870
7903
|
planId: json["plan_id"],
|
|
7871
7904
|
planName: json["plan_name"],
|
|
7872
7905
|
planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
|
|
7906
|
+
postpaidEnabled: json["postpaid_enabled"],
|
|
7907
|
+
postpaidRatePerUnit: json["postpaid_rate_per_unit"] == null ? void 0 : json["postpaid_rate_per_unit"],
|
|
7908
|
+
postpaidRatePerUnitDecimal: json["postpaid_rate_per_unit_decimal"] == null ? void 0 : json["postpaid_rate_per_unit_decimal"],
|
|
7873
7909
|
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON(json["reset_cadence"]),
|
|
7874
7910
|
resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON(json["reset_start"]),
|
|
7875
7911
|
resetType: json["reset_type"] == null ? void 0 : BillingPlanCreditGrantResetTypeFromJSON(json["reset_type"]),
|
|
@@ -8447,6 +8483,8 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8447
8483
|
return json;
|
|
8448
8484
|
}
|
|
8449
8485
|
return {
|
|
8486
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
8487
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
8450
8488
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
8451
8489
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
8452
8490
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -8464,6 +8502,10 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8464
8502
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
8465
8503
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
8466
8504
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
8505
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
8506
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
8507
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
8508
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
8467
8509
|
companyAutoTopupAmount: json["company_auto_topup_amount"] == null ? void 0 : json["company_auto_topup_amount"],
|
|
8468
8510
|
companyAutoTopupEnabled: json["company_auto_topup_enabled"] == null ? void 0 : json["company_auto_topup_enabled"],
|
|
8469
8511
|
companyAutoTopupThresholdCredits: json["company_auto_topup_threshold_credits"] == null ? void 0 : json["company_auto_topup_threshold_credits"],
|
|
@@ -8975,6 +9017,41 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8975
9017
|
};
|
|
8976
9018
|
}
|
|
8977
9019
|
|
|
9020
|
+
// src/api/checkoutexternal/models/CompanyInvoiceResponseData.ts
|
|
9021
|
+
function CompanyInvoiceResponseDataFromJSON(json) {
|
|
9022
|
+
return CompanyInvoiceResponseDataFromJSONTyped(json, false);
|
|
9023
|
+
}
|
|
9024
|
+
function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
9025
|
+
if (json == null) {
|
|
9026
|
+
return json;
|
|
9027
|
+
}
|
|
9028
|
+
return {
|
|
9029
|
+
amountDue: json["amount_due"],
|
|
9030
|
+
createdAt: new Date(json["created_at"]),
|
|
9031
|
+
currency: json["currency"],
|
|
9032
|
+
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
9033
|
+
id: json["id"],
|
|
9034
|
+
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
9035
|
+
url: json["url"] == null ? void 0 : json["url"]
|
|
9036
|
+
};
|
|
9037
|
+
}
|
|
9038
|
+
|
|
9039
|
+
// src/api/checkoutexternal/models/CompanyInvoicesResponseData.ts
|
|
9040
|
+
function CompanyInvoicesResponseDataFromJSON(json) {
|
|
9041
|
+
return CompanyInvoicesResponseDataFromJSONTyped(json, false);
|
|
9042
|
+
}
|
|
9043
|
+
function CompanyInvoicesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
9044
|
+
if (json == null) {
|
|
9045
|
+
return json;
|
|
9046
|
+
}
|
|
9047
|
+
return {
|
|
9048
|
+
count: json["count"],
|
|
9049
|
+
invoices: json["invoices"].map(
|
|
9050
|
+
CompanyInvoiceResponseDataFromJSON
|
|
9051
|
+
)
|
|
9052
|
+
};
|
|
9053
|
+
}
|
|
9054
|
+
|
|
8978
9055
|
// src/api/checkoutexternal/models/CompanyOverrideNoteResponseData.ts
|
|
8979
9056
|
function CompanyOverrideNoteResponseDataFromJSON(json) {
|
|
8980
9057
|
return CompanyOverrideNoteResponseDataFromJSONTyped(json, false);
|
|
@@ -9465,6 +9542,8 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9465
9542
|
return json;
|
|
9466
9543
|
}
|
|
9467
9544
|
return {
|
|
9545
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
9546
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
9468
9547
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
9469
9548
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
9470
9549
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -9482,6 +9561,10 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9482
9561
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
9483
9562
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
9484
9563
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
9564
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
9565
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
9566
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
9567
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
9485
9568
|
companyCreditAmount: json["company_credit_amount"],
|
|
9486
9569
|
createdAt: new Date(json["created_at"]),
|
|
9487
9570
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
|
|
@@ -9974,6 +10057,7 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9974
10057
|
return json;
|
|
9975
10058
|
}
|
|
9976
10059
|
return {
|
|
10060
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
9977
10061
|
billingCreditBundleId: json["billing_credit_bundle_id"] == null ? void 0 : json["billing_credit_bundle_id"],
|
|
9978
10062
|
billingCreditId: json["billing_credit_id"],
|
|
9979
10063
|
companyId: json["company_id"],
|
|
@@ -9995,6 +10079,12 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9995
10079
|
planId: json["plan_id"] == null ? void 0 : json["plan_id"],
|
|
9996
10080
|
planName: json["plan_name"] == null ? void 0 : json["plan_name"],
|
|
9997
10081
|
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
10082
|
+
postpaidChargeAmount: json["postpaid_charge_amount"] == null ? void 0 : json["postpaid_charge_amount"],
|
|
10083
|
+
postpaidChargeCurrency: json["postpaid_charge_currency"] == null ? void 0 : json["postpaid_charge_currency"],
|
|
10084
|
+
postpaidChargedCredits: json["postpaid_charged_credits"] == null ? void 0 : json["postpaid_charged_credits"],
|
|
10085
|
+
postpaidPeriodEnd: json["postpaid_period_end"] == null ? void 0 : new Date(json["postpaid_period_end"]),
|
|
10086
|
+
postpaidRate: json["postpaid_rate"] == null ? void 0 : json["postpaid_rate"],
|
|
10087
|
+
postpaidRateDecimal: json["postpaid_rate_decimal"] == null ? void 0 : json["postpaid_rate_decimal"],
|
|
9998
10088
|
price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
|
|
9999
10089
|
quantity: json["quantity"],
|
|
10000
10090
|
quantityRemaining: json["quantity_remaining"],
|
|
@@ -10318,6 +10408,35 @@ function GetCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10318
10408
|
};
|
|
10319
10409
|
}
|
|
10320
10410
|
|
|
10411
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesParams.ts
|
|
10412
|
+
function GetCompanyInvoicesParamsFromJSON(json) {
|
|
10413
|
+
return GetCompanyInvoicesParamsFromJSONTyped(json, false);
|
|
10414
|
+
}
|
|
10415
|
+
function GetCompanyInvoicesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
10416
|
+
if (json == null) {
|
|
10417
|
+
return json;
|
|
10418
|
+
}
|
|
10419
|
+
return {
|
|
10420
|
+
includePending: json["include_pending"] == null ? void 0 : json["include_pending"],
|
|
10421
|
+
limit: json["limit"] == null ? void 0 : json["limit"],
|
|
10422
|
+
offset: json["offset"] == null ? void 0 : json["offset"]
|
|
10423
|
+
};
|
|
10424
|
+
}
|
|
10425
|
+
|
|
10426
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesResponse.ts
|
|
10427
|
+
function GetCompanyInvoicesResponseFromJSON(json) {
|
|
10428
|
+
return GetCompanyInvoicesResponseFromJSONTyped(json, false);
|
|
10429
|
+
}
|
|
10430
|
+
function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
10431
|
+
if (json == null) {
|
|
10432
|
+
return json;
|
|
10433
|
+
}
|
|
10434
|
+
return {
|
|
10435
|
+
data: CompanyInvoicesResponseDataFromJSON(json["data"]),
|
|
10436
|
+
params: GetCompanyInvoicesParamsFromJSON(json["params"])
|
|
10437
|
+
};
|
|
10438
|
+
}
|
|
10439
|
+
|
|
10321
10440
|
// src/api/checkoutexternal/models/GetCreditUsageByUserParams.ts
|
|
10322
10441
|
function GetCreditUsageByUserParamsFromJSON(json) {
|
|
10323
10442
|
return GetCreditUsageByUserParamsFromJSONTyped(json, false);
|
|
@@ -10928,6 +11047,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10928
11047
|
const response = await this.getCheckoutTaxIDRaw(initOverrides);
|
|
10929
11048
|
return await response.value();
|
|
10930
11049
|
}
|
|
11050
|
+
/**
|
|
11051
|
+
* Get company invoices
|
|
11052
|
+
*/
|
|
11053
|
+
async getCompanyInvoicesRaw(requestParameters, initOverrides) {
|
|
11054
|
+
const queryParameters = {};
|
|
11055
|
+
if (requestParameters["includePending"] != null) {
|
|
11056
|
+
queryParameters["include_pending"] = requestParameters["includePending"];
|
|
11057
|
+
}
|
|
11058
|
+
if (requestParameters["limit"] != null) {
|
|
11059
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
11060
|
+
}
|
|
11061
|
+
if (requestParameters["offset"] != null) {
|
|
11062
|
+
queryParameters["offset"] = requestParameters["offset"];
|
|
11063
|
+
}
|
|
11064
|
+
const headerParameters = {};
|
|
11065
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
11066
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
11067
|
+
"X-Schematic-Api-Key"
|
|
11068
|
+
);
|
|
11069
|
+
}
|
|
11070
|
+
const response = await this.request(
|
|
11071
|
+
{
|
|
11072
|
+
path: `/company/invoices`,
|
|
11073
|
+
method: "GET",
|
|
11074
|
+
headers: headerParameters,
|
|
11075
|
+
query: queryParameters
|
|
11076
|
+
},
|
|
11077
|
+
initOverrides
|
|
11078
|
+
);
|
|
11079
|
+
return new JSONApiResponse(
|
|
11080
|
+
response,
|
|
11081
|
+
(jsonValue) => GetCompanyInvoicesResponseFromJSON(jsonValue)
|
|
11082
|
+
);
|
|
11083
|
+
}
|
|
11084
|
+
/**
|
|
11085
|
+
* Get company invoices
|
|
11086
|
+
*/
|
|
11087
|
+
async getCompanyInvoices(requestParameters = {}, initOverrides) {
|
|
11088
|
+
const response = await this.getCompanyInvoicesRaw(
|
|
11089
|
+
requestParameters,
|
|
11090
|
+
initOverrides
|
|
11091
|
+
);
|
|
11092
|
+
return await response.value();
|
|
11093
|
+
}
|
|
10931
11094
|
/**
|
|
10932
11095
|
* Get credit usage by user
|
|
10933
11096
|
*/
|
|
@@ -11677,6 +11840,22 @@ var JSONApiResponse2 = class {
|
|
|
11677
11840
|
}
|
|
11678
11841
|
};
|
|
11679
11842
|
|
|
11843
|
+
// src/api/componentspublic/models/BillingArrearsAnchor.ts
|
|
11844
|
+
function BillingArrearsAnchorFromJSON2(json) {
|
|
11845
|
+
return BillingArrearsAnchorFromJSONTyped5(json, false);
|
|
11846
|
+
}
|
|
11847
|
+
function BillingArrearsAnchorFromJSONTyped5(json, ignoreDiscriminator) {
|
|
11848
|
+
return json;
|
|
11849
|
+
}
|
|
11850
|
+
|
|
11851
|
+
// src/api/componentspublic/models/BillingArrearsCadence.ts
|
|
11852
|
+
function BillingArrearsCadenceFromJSON2(json) {
|
|
11853
|
+
return BillingArrearsCadenceFromJSONTyped6(json, false);
|
|
11854
|
+
}
|
|
11855
|
+
function BillingArrearsCadenceFromJSONTyped6(json, ignoreDiscriminator) {
|
|
11856
|
+
return json;
|
|
11857
|
+
}
|
|
11858
|
+
|
|
11680
11859
|
// src/api/componentspublic/models/BillingCreditAutoTopupAvailability.ts
|
|
11681
11860
|
function BillingCreditAutoTopupAvailabilityFromJSON2(json) {
|
|
11682
11861
|
return BillingCreditAutoTopupAvailabilityFromJSONTyped5(json, false);
|
|
@@ -12654,6 +12833,8 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12654
12833
|
return json;
|
|
12655
12834
|
}
|
|
12656
12835
|
return {
|
|
12836
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON2(json["billing_credit_arrears_anchor"]),
|
|
12837
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON2(json["billing_credit_arrears_cadence"]),
|
|
12657
12838
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
12658
12839
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
12659
12840
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON2(
|
|
@@ -12671,6 +12852,10 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12671
12852
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
12672
12853
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
12673
12854
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
12855
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
12856
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
12857
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
12858
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
12674
12859
|
companyCreditAmount: json["company_credit_amount"],
|
|
12675
12860
|
createdAt: new Date(json["created_at"]),
|
|
12676
12861
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
|
|
@@ -13076,6 +13261,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
|
|
|
13076
13261
|
}
|
|
13077
13262
|
return cost;
|
|
13078
13263
|
}
|
|
13264
|
+
function calculateQuantityCost(billingPrice, quantity) {
|
|
13265
|
+
if (!billingPrice) {
|
|
13266
|
+
return 0;
|
|
13267
|
+
}
|
|
13268
|
+
if (isTieredPrice(billingPrice)) {
|
|
13269
|
+
return calculateTieredCost(
|
|
13270
|
+
quantity,
|
|
13271
|
+
billingPrice.priceTier,
|
|
13272
|
+
billingPrice.tiersMode
|
|
13273
|
+
);
|
|
13274
|
+
}
|
|
13275
|
+
return quantity * billingPrice.price;
|
|
13276
|
+
}
|
|
13079
13277
|
function getEntitlementCost(entitlement, period = "month", currency) {
|
|
13080
13278
|
const resolvedPeriod = period ?? "month";
|
|
13081
13279
|
const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
|
|
@@ -13862,6 +14060,18 @@ function buildCreditBundlesRequestBody(creditBundles) {
|
|
|
13862
14060
|
[]
|
|
13863
14061
|
);
|
|
13864
14062
|
}
|
|
14063
|
+
function isCreditOnlyCheckout(options) {
|
|
14064
|
+
const { plan, creditBundles, addOns, period, currency } = options;
|
|
14065
|
+
if (plan) {
|
|
14066
|
+
return false;
|
|
14067
|
+
}
|
|
14068
|
+
if (!creditBundles.some((bundle) => bundle.count > 0)) {
|
|
14069
|
+
return false;
|
|
14070
|
+
}
|
|
14071
|
+
return !addOns.some(
|
|
14072
|
+
(addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, currency)?.id
|
|
14073
|
+
);
|
|
14074
|
+
}
|
|
13865
14075
|
|
|
13866
14076
|
// src/utils/api/entitlement.ts
|
|
13867
14077
|
var PeriodName = {
|
|
@@ -14128,6 +14338,20 @@ function modifyDate(date, days) {
|
|
|
14128
14338
|
return copy3;
|
|
14129
14339
|
}
|
|
14130
14340
|
|
|
14341
|
+
// src/utils/debounce.ts
|
|
14342
|
+
var import_debounce = __toESM(require_debounce());
|
|
14343
|
+
function debounceByKey(fn, wait, settings) {
|
|
14344
|
+
const debouncedByKey = /* @__PURE__ */ new Map();
|
|
14345
|
+
return (key, ...args) => {
|
|
14346
|
+
let debounced = debouncedByKey.get(key);
|
|
14347
|
+
if (!debounced) {
|
|
14348
|
+
debounced = (0, import_debounce.default)(fn, wait, settings);
|
|
14349
|
+
debouncedByKey.set(key, debounced);
|
|
14350
|
+
}
|
|
14351
|
+
return debounced(key, ...args);
|
|
14352
|
+
};
|
|
14353
|
+
}
|
|
14354
|
+
|
|
14131
14355
|
// src/utils/string.ts
|
|
14132
14356
|
var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
14133
14357
|
"BIF",
|
|
@@ -15131,7 +15355,7 @@ var reducer = (state, action) => {
|
|
|
15131
15355
|
// src/context/EmbedProvider.tsx
|
|
15132
15356
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
15133
15357
|
var getCustomHeaders = (sessionId) => ({
|
|
15134
|
-
"X-Schematic-Components-Version": "2.25.
|
|
15358
|
+
"X-Schematic-Components-Version": "2.25.2",
|
|
15135
15359
|
"X-Schematic-Session-ID": sessionId
|
|
15136
15360
|
});
|
|
15137
15361
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -15242,7 +15466,7 @@ var EmbedProvider = ({
|
|
|
15242
15466
|
}
|
|
15243
15467
|
}, [publicApi]);
|
|
15244
15468
|
const debouncedHydratePublic = useMemo2(
|
|
15245
|
-
() => (0,
|
|
15469
|
+
() => (0, import_debounce2.default)(
|
|
15246
15470
|
hydratePublic,
|
|
15247
15471
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15248
15472
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15268,7 +15492,7 @@ var EmbedProvider = ({
|
|
|
15268
15492
|
}
|
|
15269
15493
|
}, [checkoutApi]);
|
|
15270
15494
|
const debouncedHydrate = useMemo2(
|
|
15271
|
-
() => (0,
|
|
15495
|
+
() => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15272
15496
|
[hydrate]
|
|
15273
15497
|
);
|
|
15274
15498
|
const hydrateComponent = useCallback2(
|
|
@@ -15295,7 +15519,7 @@ var EmbedProvider = ({
|
|
|
15295
15519
|
[checkoutApi]
|
|
15296
15520
|
);
|
|
15297
15521
|
const debouncedHydrateComponent = useMemo2(
|
|
15298
|
-
() => (0,
|
|
15522
|
+
() => (0, import_debounce2.default)(
|
|
15299
15523
|
hydrateComponent,
|
|
15300
15524
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15301
15525
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15319,7 +15543,7 @@ var EmbedProvider = ({
|
|
|
15319
15543
|
}
|
|
15320
15544
|
}, []);
|
|
15321
15545
|
const debouncedHydrateExternal = useMemo2(
|
|
15322
|
-
() => (0,
|
|
15546
|
+
() => (0, import_debounce2.default)(
|
|
15323
15547
|
hydrateExternal,
|
|
15324
15548
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15325
15549
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15330,7 +15554,7 @@ var EmbedProvider = ({
|
|
|
15330
15554
|
return checkoutApi?.createSetupIntent();
|
|
15331
15555
|
}, [checkoutApi]);
|
|
15332
15556
|
const debouncedCreateSetupIntent = useMemo2(
|
|
15333
|
-
() => (0,
|
|
15557
|
+
() => (0, import_debounce2.default)(
|
|
15334
15558
|
createSetupIntent,
|
|
15335
15559
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15336
15560
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15353,7 +15577,7 @@ var EmbedProvider = ({
|
|
|
15353
15577
|
[checkoutApi]
|
|
15354
15578
|
);
|
|
15355
15579
|
const debouncedUpdatePaymentMethod = useMemo2(
|
|
15356
|
-
() => (0,
|
|
15580
|
+
() => (0, import_debounce2.default)(
|
|
15357
15581
|
updatePaymentMethod,
|
|
15358
15582
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15359
15583
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15376,7 +15600,7 @@ var EmbedProvider = ({
|
|
|
15376
15600
|
[checkoutApi]
|
|
15377
15601
|
);
|
|
15378
15602
|
const debouncedDeletePaymentMethod = useMemo2(
|
|
15379
|
-
() => (0,
|
|
15603
|
+
() => (0, import_debounce2.default)(
|
|
15380
15604
|
deletePaymentMethod,
|
|
15381
15605
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15382
15606
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15399,7 +15623,7 @@ var EmbedProvider = ({
|
|
|
15399
15623
|
[checkoutApi]
|
|
15400
15624
|
);
|
|
15401
15625
|
const debouncedCheckout = useMemo2(
|
|
15402
|
-
() => (0,
|
|
15626
|
+
() => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15403
15627
|
[checkout]
|
|
15404
15628
|
);
|
|
15405
15629
|
const previewCheckout = useCallback2(
|
|
@@ -15419,7 +15643,7 @@ var EmbedProvider = ({
|
|
|
15419
15643
|
return response;
|
|
15420
15644
|
}, [checkoutApi]);
|
|
15421
15645
|
const debouncedUnsubscribe = useMemo2(
|
|
15422
|
-
() => (0,
|
|
15646
|
+
() => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15423
15647
|
[unsubscribe]
|
|
15424
15648
|
);
|
|
15425
15649
|
const updateCustomFieldValues = useCallback2(
|
|
@@ -15463,7 +15687,7 @@ var EmbedProvider = ({
|
|
|
15463
15687
|
[checkoutApi]
|
|
15464
15688
|
);
|
|
15465
15689
|
const debouncedGetUpcomingInvoice = useMemo2(
|
|
15466
|
-
() => (0,
|
|
15690
|
+
() => (0, import_debounce2.default)(
|
|
15467
15691
|
getUpcomingInvoice,
|
|
15468
15692
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15469
15693
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15474,7 +15698,7 @@ var EmbedProvider = ({
|
|
|
15474
15698
|
return checkoutApi?.fetchCustomerBalance();
|
|
15475
15699
|
}, [checkoutApi]);
|
|
15476
15700
|
const debouncedGetCustomerBalance = useMemo2(
|
|
15477
|
-
() => (0,
|
|
15701
|
+
() => (0, import_debounce2.default)(
|
|
15478
15702
|
getCustomerBalance,
|
|
15479
15703
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15480
15704
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15485,9 +15709,37 @@ var EmbedProvider = ({
|
|
|
15485
15709
|
return checkoutApi?.listInvoices();
|
|
15486
15710
|
}, [checkoutApi]);
|
|
15487
15711
|
const debouncedListInvoices = useMemo2(
|
|
15488
|
-
() => (0,
|
|
15712
|
+
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15489
15713
|
[listInvoices]
|
|
15490
15714
|
);
|
|
15715
|
+
const getCreditUsageByUser = useCallback2(
|
|
15716
|
+
async (billingCreditId, limit) => {
|
|
15717
|
+
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
15718
|
+
},
|
|
15719
|
+
[checkoutApi]
|
|
15720
|
+
);
|
|
15721
|
+
const debouncedGetCreditUsageByUser = useMemo2(
|
|
15722
|
+
() => debounceByKey(
|
|
15723
|
+
getCreditUsageByUser,
|
|
15724
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15725
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15726
|
+
),
|
|
15727
|
+
[getCreditUsageByUser]
|
|
15728
|
+
);
|
|
15729
|
+
const getFeatureUsageByUser = useCallback2(
|
|
15730
|
+
async (featureId, limit) => {
|
|
15731
|
+
return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
|
|
15732
|
+
},
|
|
15733
|
+
[checkoutApi]
|
|
15734
|
+
);
|
|
15735
|
+
const debouncedGetFeatureUsageByUser = useMemo2(
|
|
15736
|
+
() => debounceByKey(
|
|
15737
|
+
getFeatureUsageByUser,
|
|
15738
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15739
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15740
|
+
),
|
|
15741
|
+
[getFeatureUsageByUser]
|
|
15742
|
+
);
|
|
15491
15743
|
const setError = useCallback2(
|
|
15492
15744
|
(error) => {
|
|
15493
15745
|
debug(error.message);
|
|
@@ -15653,6 +15905,8 @@ var EmbedProvider = ({
|
|
|
15653
15905
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
15654
15906
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
15655
15907
|
listInvoices: debouncedListInvoices,
|
|
15908
|
+
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
15909
|
+
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
15656
15910
|
finishCheckout,
|
|
15657
15911
|
setError,
|
|
15658
15912
|
setAccessToken,
|
|
@@ -17051,7 +17305,7 @@ var Toggle = Tt.input.attrs({ type: "checkbox" })`
|
|
|
17051
17305
|
`;
|
|
17052
17306
|
|
|
17053
17307
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
17054
|
-
var
|
|
17308
|
+
var import_debounce3 = __toESM(require_debounce());
|
|
17055
17309
|
import {
|
|
17056
17310
|
cloneElement as cloneElement2,
|
|
17057
17311
|
useCallback as useCallback7,
|
|
@@ -17241,7 +17495,7 @@ var Tooltip = ({
|
|
|
17241
17495
|
}, [portal, position2]);
|
|
17242
17496
|
useLayoutEffect3(() => {
|
|
17243
17497
|
updateCoords();
|
|
17244
|
-
const handleResize = (0,
|
|
17498
|
+
const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
|
|
17245
17499
|
window.addEventListener("resize", handleResize);
|
|
17246
17500
|
window.addEventListener("scroll", handleResize, true);
|
|
17247
17501
|
return () => {
|
|
@@ -17398,7 +17652,7 @@ var Root = forwardRef6(
|
|
|
17398
17652
|
Root.displayName = "Root";
|
|
17399
17653
|
|
|
17400
17654
|
// src/components/layout/viewport/Viewport.tsx
|
|
17401
|
-
var
|
|
17655
|
+
var import_debounce5 = __toESM(require_debounce());
|
|
17402
17656
|
import { forwardRef as forwardRef8, useLayoutEffect as useLayoutEffect8, useRef as useRef11, useState as useState16 } from "react";
|
|
17403
17657
|
import { createPortal as createPortal3 } from "react-dom";
|
|
17404
17658
|
|
|
@@ -18346,11 +18600,10 @@ var Quantity = ({
|
|
|
18346
18600
|
children: [
|
|
18347
18601
|
/* @__PURE__ */ jsx20(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs11(Text, { children: [
|
|
18348
18602
|
formatCurrency(
|
|
18349
|
-
|
|
18350
|
-
|
|
18351
|
-
|
|
18352
|
-
|
|
18353
|
-
) : (price ?? 0) * entitlement.quantity,
|
|
18603
|
+
calculateQuantityCost(
|
|
18604
|
+
entitlementBillingPrice,
|
|
18605
|
+
entitlement.quantity
|
|
18606
|
+
),
|
|
18354
18607
|
currency
|
|
18355
18608
|
),
|
|
18356
18609
|
/* @__PURE__ */ jsxs11("sub", { children: [
|
|
@@ -19227,7 +19480,7 @@ var Checkout = ({
|
|
|
19227
19480
|
};
|
|
19228
19481
|
|
|
19229
19482
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
19230
|
-
var
|
|
19483
|
+
var import_debounce4 = __toESM(require_debounce());
|
|
19231
19484
|
import {
|
|
19232
19485
|
useCallback as useCallback8,
|
|
19233
19486
|
useEffect as useEffect4,
|
|
@@ -19554,48 +19807,26 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19554
19807
|
bundleCounts
|
|
19555
19808
|
);
|
|
19556
19809
|
}, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
|
|
19557
|
-
const selectedPlanPriceId = useMemo15(() => {
|
|
19558
|
-
if (!selectedPlan) {
|
|
19559
|
-
return void 0;
|
|
19560
|
-
}
|
|
19561
|
-
const currencyPrice = getPlanPrice(
|
|
19562
|
-
selectedPlan,
|
|
19563
|
-
planPeriod,
|
|
19564
|
-
{ useSelectedPeriod: true },
|
|
19565
|
-
hasCurrency ? effectiveCurrency : void 0
|
|
19566
|
-
);
|
|
19567
|
-
return currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan.yearlyPrice?.id : planPeriod === "quarter" ? selectedPlan.quarterlyPrice?.id : selectedPlan.monthlyPrice?.id);
|
|
19568
|
-
}, [selectedPlan, planPeriod, hasCurrency, effectiveCurrency]);
|
|
19569
19810
|
const [hasInitialPaymentMethod] = useState9(
|
|
19570
19811
|
() => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
|
|
19571
19812
|
);
|
|
19572
|
-
const isCreditOnlyPurchase = useMemo15(
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19578
|
-
|
|
19579
|
-
|
|
19580
|
-
|
|
19581
|
-
|
|
19582
|
-
|
|
19583
|
-
|
|
19584
|
-
|
|
19585
|
-
|
|
19586
|
-
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
return !hasPaidAddOn;
|
|
19590
|
-
}, [
|
|
19591
|
-
data?.company?.billingSubscription,
|
|
19592
|
-
selectedPlanPriceId,
|
|
19593
|
-
creditBundles,
|
|
19594
|
-
addOns,
|
|
19595
|
-
planPeriod,
|
|
19596
|
-
hasCurrency,
|
|
19597
|
-
effectiveCurrency
|
|
19598
|
-
]);
|
|
19813
|
+
const isCreditOnlyPurchase = useMemo15(
|
|
19814
|
+
() => isCreditOnlyCheckout({
|
|
19815
|
+
plan: selectedPlan,
|
|
19816
|
+
creditBundles,
|
|
19817
|
+
addOns,
|
|
19818
|
+
period: planPeriod,
|
|
19819
|
+
currency: hasCurrency ? effectiveCurrency : void 0
|
|
19820
|
+
}),
|
|
19821
|
+
[
|
|
19822
|
+
selectedPlan,
|
|
19823
|
+
creditBundles,
|
|
19824
|
+
addOns,
|
|
19825
|
+
planPeriod,
|
|
19826
|
+
hasCurrency,
|
|
19827
|
+
effectiveCurrency
|
|
19828
|
+
]
|
|
19829
|
+
);
|
|
19599
19830
|
const [usageBasedEntitlements, setUsageBasedEntitlements] = useState9(
|
|
19600
19831
|
() => applyPrefilledQuantities(
|
|
19601
19832
|
(selectedPlan?.entitlements || []).reduce(
|
|
@@ -19890,9 +20121,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19890
20121
|
updates.creditBundles || creditBundles,
|
|
19891
20122
|
plan?.id ?? data?.company?.plan?.id
|
|
19892
20123
|
);
|
|
19893
|
-
const isCreditOnly =
|
|
19894
|
-
|
|
19895
|
-
|
|
20124
|
+
const isCreditOnly = isCreditOnlyCheckout({
|
|
20125
|
+
plan,
|
|
20126
|
+
creditBundles: resolvedCreditBundles,
|
|
20127
|
+
addOns: updates.addOns || addOns,
|
|
20128
|
+
period,
|
|
20129
|
+
currency: resolvedCurrency
|
|
20130
|
+
});
|
|
19896
20131
|
if ((!plan || !planPriceId) && !isCreditOnly) {
|
|
19897
20132
|
++previewRequestIdRef.current;
|
|
19898
20133
|
setError(void 0);
|
|
@@ -20032,7 +20267,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20032
20267
|
addOnCompatibilityLookup,
|
|
20033
20268
|
data?.company?.plan?.id,
|
|
20034
20269
|
data?.company?.plan?.includedCreditGrants,
|
|
20035
|
-
data?.company?.billingSubscription,
|
|
20036
20270
|
previewCheckout,
|
|
20037
20271
|
planPeriod,
|
|
20038
20272
|
selectedPlan,
|
|
@@ -20055,7 +20289,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20055
20289
|
}, [handlePreviewCheckout]);
|
|
20056
20290
|
const debouncedPreviewCheckoutRef = useRef6(null);
|
|
20057
20291
|
useEffect4(() => {
|
|
20058
|
-
const debounced = (0,
|
|
20292
|
+
const debounced = (0, import_debounce4.default)(
|
|
20059
20293
|
(updates) => handlePreviewCheckoutRef.current(updates),
|
|
20060
20294
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
20061
20295
|
TRAILING_DEBOUNCE_SETTINGS
|
|
@@ -22178,6 +22412,29 @@ var EntitlementRow = (props) => {
|
|
|
22178
22412
|
tiersMode
|
|
22179
22413
|
} = entitlementPrice || {};
|
|
22180
22414
|
const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
|
|
22415
|
+
const tierLabel = /* @__PURE__ */ jsxs30(
|
|
22416
|
+
Text,
|
|
22417
|
+
{
|
|
22418
|
+
style: { opacity: 0.54 },
|
|
22419
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22420
|
+
$color: settings.theme.typography.text.color,
|
|
22421
|
+
children: [
|
|
22422
|
+
t4("Tier-based"),
|
|
22423
|
+
/* @__PURE__ */ jsx41(
|
|
22424
|
+
PricingTiersTooltip,
|
|
22425
|
+
{
|
|
22426
|
+
portal,
|
|
22427
|
+
feature,
|
|
22428
|
+
period: planPeriod,
|
|
22429
|
+
currency,
|
|
22430
|
+
priceTiers,
|
|
22431
|
+
tiersMode: tiersMode ?? void 0,
|
|
22432
|
+
position: "left"
|
|
22433
|
+
}
|
|
22434
|
+
)
|
|
22435
|
+
]
|
|
22436
|
+
}
|
|
22437
|
+
);
|
|
22181
22438
|
return /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22182
22439
|
/* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22183
22440
|
quantity,
|
|
@@ -22188,13 +22445,24 @@ var EntitlementRow = (props) => {
|
|
|
22188
22445
|
" ",
|
|
22189
22446
|
getFeatureName(feature, softLimit)
|
|
22190
22447
|
] }) : feature.name }) }),
|
|
22191
|
-
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22448
|
+
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22449
|
+
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
22450
|
+
// quantity, so the row shows it alongside the tier breakdown
|
|
22451
|
+
// rather than leaving the charge unpriced.
|
|
22452
|
+
/* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
|
|
22453
|
+
/* @__PURE__ */ jsxs30(Text, { children: [
|
|
22454
|
+
formatCurrency(
|
|
22455
|
+
calculateQuantityCost(entitlementPrice, quantity),
|
|
22456
|
+
currency
|
|
22457
|
+
),
|
|
22458
|
+
/* @__PURE__ */ jsxs30("sub", { children: [
|
|
22459
|
+
"/",
|
|
22460
|
+
shortenPeriod(planPeriod)
|
|
22461
|
+
] })
|
|
22462
|
+
] }),
|
|
22463
|
+
tiered && tierLabel
|
|
22196
22464
|
] })
|
|
22197
|
-
|
|
22465
|
+
) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs30(Text, { children: [
|
|
22198
22466
|
priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22199
22467
|
t4("then"),
|
|
22200
22468
|
" "
|
|
@@ -22212,29 +22480,7 @@ var EntitlementRow = (props) => {
|
|
|
22212
22480
|
shortenPeriod(planPeriod)
|
|
22213
22481
|
] })
|
|
22214
22482
|
] })
|
|
22215
|
-
] }) :
|
|
22216
|
-
Text,
|
|
22217
|
-
{
|
|
22218
|
-
style: { opacity: 0.54 },
|
|
22219
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22220
|
-
$color: settings.theme.typography.text.color,
|
|
22221
|
-
children: [
|
|
22222
|
-
t4("Tier-based"),
|
|
22223
|
-
/* @__PURE__ */ jsx41(
|
|
22224
|
-
PricingTiersTooltip,
|
|
22225
|
-
{
|
|
22226
|
-
portal,
|
|
22227
|
-
feature,
|
|
22228
|
-
period: planPeriod,
|
|
22229
|
-
currency,
|
|
22230
|
-
priceTiers,
|
|
22231
|
-
tiersMode: tiersMode ?? void 0,
|
|
22232
|
-
position: "left"
|
|
22233
|
-
}
|
|
22234
|
-
)
|
|
22235
|
-
]
|
|
22236
|
-
}
|
|
22237
|
-
) })
|
|
22483
|
+
] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
|
|
22238
22484
|
] });
|
|
22239
22485
|
}
|
|
22240
22486
|
};
|
|
@@ -22430,12 +22676,18 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22430
22676
|
}, 0);
|
|
22431
22677
|
total += addOnCost;
|
|
22432
22678
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
22433
|
-
(sum, entitlement) => sum +
|
|
22679
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22680
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22681
|
+
entitlement.quantity
|
|
22682
|
+
),
|
|
22434
22683
|
0
|
|
22435
22684
|
);
|
|
22436
22685
|
total += payInAdvanceCost;
|
|
22437
22686
|
const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
|
|
22438
|
-
(sum, entitlement) => sum +
|
|
22687
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22688
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22689
|
+
entitlement.quantity
|
|
22690
|
+
),
|
|
22439
22691
|
0
|
|
22440
22692
|
);
|
|
22441
22693
|
total += addOnPayInAdvanceCost;
|
|
@@ -23898,7 +24150,7 @@ var Viewport = forwardRef8(
|
|
|
23898
24150
|
const [top, setTop] = useState16(0);
|
|
23899
24151
|
useLayoutEffect8(() => {
|
|
23900
24152
|
const element = portalRef.current;
|
|
23901
|
-
const setModalY = (0,
|
|
24153
|
+
const setModalY = (0, import_debounce5.default)(() => {
|
|
23902
24154
|
const value = Math.abs(
|
|
23903
24155
|
(element === document.body ? window.scrollY : element.scrollTop) ?? 0
|
|
23904
24156
|
);
|
|
@@ -24612,7 +24864,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
24612
24864
|
Invoices.displayName = "Invoices";
|
|
24613
24865
|
|
|
24614
24866
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24615
|
-
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as
|
|
24867
|
+
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo28, useRef as useRef12, useState as useState19 } from "react";
|
|
24616
24868
|
|
|
24617
24869
|
// src/components/elements/metered-features/Meter.tsx
|
|
24618
24870
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
@@ -24740,6 +24992,190 @@ var PriceDetails = ({
|
|
|
24740
24992
|
);
|
|
24741
24993
|
};
|
|
24742
24994
|
|
|
24995
|
+
// src/components/elements/metered-features/UsageByUser.tsx
|
|
24996
|
+
import { useEffect as useEffect7, useMemo as useMemo27, useState as useState18 } from "react";
|
|
24997
|
+
import { jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
24998
|
+
var COLLAPSED_COUNT = 3;
|
|
24999
|
+
var EXPANDED_COUNT = 20;
|
|
25000
|
+
var toCreditSection = (data) => ({
|
|
25001
|
+
entries: data.entries.map((entry) => ({
|
|
25002
|
+
id: entry.userId,
|
|
25003
|
+
// An entry with no hydrated user record still has an id worth showing —
|
|
25004
|
+
// a blank row identifies nobody.
|
|
25005
|
+
label: entry.user?.name || entry.userId || "",
|
|
25006
|
+
amount: entry.creditsUsed
|
|
25007
|
+
})),
|
|
25008
|
+
total: data.total,
|
|
25009
|
+
totalUsers: data.totalUsers,
|
|
25010
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
|
|
25011
|
+
});
|
|
25012
|
+
var toFeatureSection = (data) => ({
|
|
25013
|
+
entries: data.rows.map((row) => ({
|
|
25014
|
+
id: row.userId,
|
|
25015
|
+
label: row.user?.name || row.userId || "",
|
|
25016
|
+
amount: row.value
|
|
25017
|
+
})),
|
|
25018
|
+
total: data.total,
|
|
25019
|
+
totalUsers: data.totalUsers,
|
|
25020
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
|
|
25021
|
+
});
|
|
25022
|
+
var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
|
|
25023
|
+
var InitialAvatar = ({ label }) => {
|
|
25024
|
+
const { settings } = useEmbed();
|
|
25025
|
+
const isLightBackground = useIsLightBackground();
|
|
25026
|
+
const initial = (label.trim()[0] ?? "?").toUpperCase();
|
|
25027
|
+
return /* @__PURE__ */ jsx55(
|
|
25028
|
+
Flex,
|
|
25029
|
+
{
|
|
25030
|
+
$alignItems: "center",
|
|
25031
|
+
$justifyContent: "center",
|
|
25032
|
+
$width: "1.75rem",
|
|
25033
|
+
$height: "1.75rem",
|
|
25034
|
+
$flexShrink: 0,
|
|
25035
|
+
$borderRadius: "9999px",
|
|
25036
|
+
$background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
|
|
25037
|
+
children: /* @__PURE__ */ jsx55(
|
|
25038
|
+
Text,
|
|
25039
|
+
{
|
|
25040
|
+
$size: 11,
|
|
25041
|
+
$weight: 500,
|
|
25042
|
+
$color: settings.theme.typography.text.color,
|
|
25043
|
+
children: initial
|
|
25044
|
+
}
|
|
25045
|
+
)
|
|
25046
|
+
}
|
|
25047
|
+
);
|
|
25048
|
+
};
|
|
25049
|
+
var UsageByUser = ({ source, unit }) => {
|
|
25050
|
+
const { t: t4 } = useTranslation();
|
|
25051
|
+
const isLightBackground = useIsLightBackground();
|
|
25052
|
+
const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
|
|
25053
|
+
const [expanded, setExpanded] = useState18(false);
|
|
25054
|
+
const [result, setResult] = useState18();
|
|
25055
|
+
const [attempt, setAttempt] = useState18(0);
|
|
25056
|
+
const { kind, id } = source;
|
|
25057
|
+
const sourceKey = `${kind}:${id}`;
|
|
25058
|
+
const current = result?.sourceKey === sourceKey ? result : void 0;
|
|
25059
|
+
useEffect7(() => {
|
|
25060
|
+
let active = true;
|
|
25061
|
+
const apply = (next2) => {
|
|
25062
|
+
if (active) {
|
|
25063
|
+
setResult(next2);
|
|
25064
|
+
}
|
|
25065
|
+
};
|
|
25066
|
+
const receive = (section) => {
|
|
25067
|
+
if (section) {
|
|
25068
|
+
apply({ sourceKey, section });
|
|
25069
|
+
}
|
|
25070
|
+
};
|
|
25071
|
+
const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
|
|
25072
|
+
if (kind === "credit") {
|
|
25073
|
+
getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25074
|
+
(response) => receive(response && toCreditSection(response.data))
|
|
25075
|
+
).catch(fail);
|
|
25076
|
+
} else {
|
|
25077
|
+
getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25078
|
+
(response) => receive(response && toFeatureSection(response.data))
|
|
25079
|
+
).catch(fail);
|
|
25080
|
+
}
|
|
25081
|
+
return () => {
|
|
25082
|
+
active = false;
|
|
25083
|
+
};
|
|
25084
|
+
}, [
|
|
25085
|
+
attempt,
|
|
25086
|
+
getCreditUsageByUser,
|
|
25087
|
+
getFeatureUsageByUser,
|
|
25088
|
+
id,
|
|
25089
|
+
kind,
|
|
25090
|
+
sourceKey
|
|
25091
|
+
]);
|
|
25092
|
+
const entries = current?.section?.entries;
|
|
25093
|
+
const attributed = useMemo27(
|
|
25094
|
+
() => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
|
|
25095
|
+
[entries]
|
|
25096
|
+
);
|
|
25097
|
+
const error = current?.error;
|
|
25098
|
+
const total = current?.section?.total ?? 0;
|
|
25099
|
+
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
25100
|
+
const unattributed = current?.section?.unattributed;
|
|
25101
|
+
const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
|
|
25102
|
+
if (error) {
|
|
25103
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
25104
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25105
|
+
/* @__PURE__ */ jsx55(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
|
|
25106
|
+
/* @__PURE__ */ jsx55(
|
|
25107
|
+
Button,
|
|
25108
|
+
{
|
|
25109
|
+
type: "button",
|
|
25110
|
+
onClick: () => setAttempt((prev2) => prev2 + 1),
|
|
25111
|
+
$size: "sm",
|
|
25112
|
+
$variant: "ghost",
|
|
25113
|
+
$fullWidth: false,
|
|
25114
|
+
children: t4("Try again")
|
|
25115
|
+
}
|
|
25116
|
+
)
|
|
25117
|
+
] });
|
|
25118
|
+
}
|
|
25119
|
+
if (attributed.length === 0 && !unattributed) {
|
|
25120
|
+
return null;
|
|
25121
|
+
}
|
|
25122
|
+
const visible = attributed.slice(
|
|
25123
|
+
0,
|
|
25124
|
+
expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
|
|
25125
|
+
);
|
|
25126
|
+
const remaining = Math.max(totalUsers - visible.length, 0);
|
|
25127
|
+
const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
|
|
25128
|
+
const hiddenUsers = Math.max(
|
|
25129
|
+
expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
|
|
25130
|
+
0
|
|
25131
|
+
);
|
|
25132
|
+
const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
|
|
25133
|
+
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");
|
|
25134
|
+
const row = (key, label, amount, muted) => /* @__PURE__ */ jsxs41(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
|
|
25135
|
+
/* @__PURE__ */ jsx55(InitialAvatar, { label: muted ? "?" : label }),
|
|
25136
|
+
/* @__PURE__ */ jsx55(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ jsx55(
|
|
25137
|
+
Text,
|
|
25138
|
+
{
|
|
25139
|
+
display: "text",
|
|
25140
|
+
$color: muted ? mutedColor(isLightBackground) : void 0,
|
|
25141
|
+
children: label
|
|
25142
|
+
}
|
|
25143
|
+
) }),
|
|
25144
|
+
/* @__PURE__ */ jsx55(
|
|
25145
|
+
Text,
|
|
25146
|
+
{
|
|
25147
|
+
display: "text",
|
|
25148
|
+
$align: "right",
|
|
25149
|
+
$color: mutedColor(isLightBackground),
|
|
25150
|
+
children: formatAmount(amount)
|
|
25151
|
+
}
|
|
25152
|
+
)
|
|
25153
|
+
] }, key);
|
|
25154
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
25155
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25156
|
+
/* @__PURE__ */ jsx55(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
|
|
25157
|
+
amount: formatAmount(total)
|
|
25158
|
+
}) }) }),
|
|
25159
|
+
visible.map(
|
|
25160
|
+
(entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
|
|
25161
|
+
),
|
|
25162
|
+
expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
|
|
25163
|
+
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 }) }) }),
|
|
25164
|
+
shouldShowToggle && /* @__PURE__ */ jsx55(
|
|
25165
|
+
ExpandListToggle,
|
|
25166
|
+
{
|
|
25167
|
+
isExpanded: expanded,
|
|
25168
|
+
onToggle: () => setExpanded((prev2) => !prev2),
|
|
25169
|
+
expandLabel,
|
|
25170
|
+
collapseLabel: t4("Show fewer"),
|
|
25171
|
+
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
|
|
25172
|
+
$marginTop: "0.25rem"
|
|
25173
|
+
}
|
|
25174
|
+
)
|
|
25175
|
+
] });
|
|
25176
|
+
};
|
|
25177
|
+
UsageByUser.displayName = "UsageByUser";
|
|
25178
|
+
|
|
24743
25179
|
// src/components/elements/metered-features/styles.ts
|
|
24744
25180
|
var Container2 = Tt.div`
|
|
24745
25181
|
display: flex;
|
|
@@ -24758,7 +25194,7 @@ var Container2 = Tt.div`
|
|
|
24758
25194
|
`;
|
|
24759
25195
|
|
|
24760
25196
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24761
|
-
import { Fragment as Fragment23, jsx as
|
|
25197
|
+
import { Fragment as Fragment23, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
24762
25198
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
24763
25199
|
const { t: t4 } = useTranslation();
|
|
24764
25200
|
const { data } = useEmbed();
|
|
@@ -24795,9 +25231,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
24795
25231
|
})
|
|
24796
25232
|
);
|
|
24797
25233
|
}
|
|
24798
|
-
return /* @__PURE__ */
|
|
25234
|
+
return /* @__PURE__ */ jsxs42(Text, { display: fontStyle, children: [
|
|
24799
25235
|
acc.join(" \u2022 "),
|
|
24800
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
25236
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx56(
|
|
24801
25237
|
HardLimitTooltip,
|
|
24802
25238
|
{
|
|
24803
25239
|
feature: entitlement.feature,
|
|
@@ -24827,6 +25263,9 @@ function resolveDesignProps4(props) {
|
|
|
24827
25263
|
isVisible: props.usage?.isVisible ?? true,
|
|
24828
25264
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
24829
25265
|
},
|
|
25266
|
+
usageByUser: {
|
|
25267
|
+
isVisible: props.usageByUser?.isVisible ?? true
|
|
25268
|
+
},
|
|
24830
25269
|
// there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
|
|
24831
25270
|
visibleFeatures: props.visibleFeatures
|
|
24832
25271
|
};
|
|
@@ -24839,7 +25278,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24839
25278
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
24840
25279
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
24841
25280
|
const isLightBackground = useIsLightBackground();
|
|
24842
|
-
const meteredFeatures =
|
|
25281
|
+
const meteredFeatures = useMemo28(() => {
|
|
24843
25282
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
24844
25283
|
(acc, id) => {
|
|
24845
25284
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -24856,7 +25295,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24856
25295
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
24857
25296
|
);
|
|
24858
25297
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
24859
|
-
const creditGroups =
|
|
25298
|
+
const creditGroups = useMemo28(
|
|
24860
25299
|
() => withEmptyPlanCreditBalances(
|
|
24861
25300
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
24862
25301
|
listPlanCredits(
|
|
@@ -24867,7 +25306,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24867
25306
|
),
|
|
24868
25307
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
24869
25308
|
);
|
|
24870
|
-
const planCreditCompositions =
|
|
25309
|
+
const planCreditCompositions = useMemo28(
|
|
24871
25310
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
24872
25311
|
[data?.company?.plan?.includedCreditGrants]
|
|
24873
25312
|
);
|
|
@@ -24881,14 +25320,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24881
25320
|
},
|
|
24882
25321
|
[data?.featureUsage?.features]
|
|
24883
25322
|
);
|
|
24884
|
-
const purchasableCreditIds =
|
|
25323
|
+
const purchasableCreditIds = useMemo28(
|
|
24885
25324
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
24886
25325
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
24887
25326
|
);
|
|
24888
|
-
const [expandedCreditIds, setExpandedCreditIds] =
|
|
25327
|
+
const [expandedCreditIds, setExpandedCreditIds] = useState19(
|
|
24889
25328
|
() => /* @__PURE__ */ new Set()
|
|
24890
25329
|
);
|
|
24891
|
-
const [fullLedgerCreditIds, setFullLedgerCreditIds] =
|
|
25330
|
+
const [fullLedgerCreditIds, setFullLedgerCreditIds] = useState19(
|
|
24892
25331
|
() => /* @__PURE__ */ new Set()
|
|
24893
25332
|
);
|
|
24894
25333
|
const toggleFullLedger = useCallback14((id) => {
|
|
@@ -24928,7 +25367,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24928
25367
|
const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
|
|
24929
25368
|
const canCheckout = data?.capabilities?.checkout ?? false;
|
|
24930
25369
|
const showCredits = data?.displaySettings?.showCredits ?? true;
|
|
24931
|
-
return /* @__PURE__ */
|
|
25370
|
+
return /* @__PURE__ */ jsxs42(Container2, { ref, className, children: [
|
|
24932
25371
|
meteredFeatures.reduce((acc, entitlement, index) => {
|
|
24933
25372
|
if (!entitlement.feature) {
|
|
24934
25373
|
return acc;
|
|
@@ -24939,9 +25378,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24939
25378
|
});
|
|
24940
25379
|
const { limit } = usageDetails;
|
|
24941
25380
|
acc.push(
|
|
24942
|
-
/* @__PURE__ */
|
|
24943
|
-
/* @__PURE__ */
|
|
24944
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25381
|
+
/* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
25382
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25383
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
24945
25384
|
Icon3,
|
|
24946
25385
|
{
|
|
24947
25386
|
name: feature.icon,
|
|
@@ -24950,8 +25389,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24950
25389
|
rounded: true
|
|
24951
25390
|
}
|
|
24952
25391
|
),
|
|
24953
|
-
/* @__PURE__ */
|
|
24954
|
-
/* @__PURE__ */
|
|
25392
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25393
|
+
/* @__PURE__ */ jsxs42(
|
|
24955
25394
|
Flex,
|
|
24956
25395
|
{
|
|
24957
25396
|
ref: (el) => {
|
|
@@ -24962,31 +25401,31 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
24962
25401
|
$flexWrap: "wrap",
|
|
24963
25402
|
$gap: "1rem",
|
|
24964
25403
|
children: [
|
|
24965
|
-
/* @__PURE__ */
|
|
24966
|
-
/* @__PURE__ */
|
|
24967
|
-
props.description.isVisible && feature.description && /* @__PURE__ */
|
|
25404
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25405
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
25406
|
+
props.description.isVisible && feature.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
24968
25407
|
] }),
|
|
24969
|
-
/* @__PURE__ */
|
|
25408
|
+
/* @__PURE__ */ jsxs42(
|
|
24970
25409
|
Box,
|
|
24971
25410
|
{
|
|
24972
25411
|
$flexBasis: "min-content",
|
|
24973
25412
|
$flexGrow: 1,
|
|
24974
25413
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
24975
25414
|
children: [
|
|
24976
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
24977
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
25415
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25416
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
24978
25417
|
formatNumber(limit),
|
|
24979
25418
|
" "
|
|
24980
25419
|
] }),
|
|
24981
25420
|
getFeatureName(feature, limit)
|
|
24982
|
-
] }) : typeof usage === "number" && /* @__PURE__ */
|
|
25421
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
24983
25422
|
formatNumber(usage),
|
|
24984
25423
|
" ",
|
|
24985
25424
|
getFeatureName(feature, usage),
|
|
24986
25425
|
" ",
|
|
24987
25426
|
t4("used")
|
|
24988
25427
|
] }) }) }),
|
|
24989
|
-
props.allocation.isVisible && /* @__PURE__ */
|
|
25428
|
+
props.allocation.isVisible && /* @__PURE__ */ jsx56(
|
|
24990
25429
|
Limit,
|
|
24991
25430
|
{
|
|
24992
25431
|
entitlement,
|
|
@@ -25000,8 +25439,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25000
25439
|
]
|
|
25001
25440
|
}
|
|
25002
25441
|
),
|
|
25003
|
-
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */
|
|
25004
|
-
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
25442
|
+
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ jsx56(Meter, { entitlement }),
|
|
25443
|
+
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsx56(
|
|
25005
25444
|
Button,
|
|
25006
25445
|
{
|
|
25007
25446
|
type: "button",
|
|
@@ -25014,13 +25453,24 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25014
25453
|
)
|
|
25015
25454
|
] })
|
|
25016
25455
|
] }),
|
|
25017
|
-
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */
|
|
25456
|
+
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ jsx56(
|
|
25018
25457
|
PriceDetails,
|
|
25019
25458
|
{
|
|
25020
25459
|
entitlement,
|
|
25021
25460
|
usageDetails,
|
|
25022
25461
|
period
|
|
25023
25462
|
}
|
|
25463
|
+
),
|
|
25464
|
+
props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
|
|
25465
|
+
// they are denominated in the feature's own unit — the same one
|
|
25466
|
+
// the usage line above uses. A credit-burndown feature's credit
|
|
25467
|
+
// spend is broken down separately, under its credit.
|
|
25468
|
+
/* @__PURE__ */ jsx56(
|
|
25469
|
+
UsageByUser,
|
|
25470
|
+
{
|
|
25471
|
+
source: { kind: "feature", id: feature.id },
|
|
25472
|
+
unit: feature
|
|
25473
|
+
}
|
|
25024
25474
|
)
|
|
25025
25475
|
] }, index)
|
|
25026
25476
|
);
|
|
@@ -25034,9 +25484,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25034
25484
|
const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
|
|
25035
25485
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
25036
25486
|
const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
|
|
25037
|
-
return /* @__PURE__ */
|
|
25038
|
-
/* @__PURE__ */
|
|
25039
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25487
|
+
return /* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
25488
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25489
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
25040
25490
|
Icon3,
|
|
25041
25491
|
{
|
|
25042
25492
|
name: credit.icon,
|
|
@@ -25045,13 +25495,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25045
25495
|
rounded: true
|
|
25046
25496
|
}
|
|
25047
25497
|
),
|
|
25048
|
-
/* @__PURE__ */
|
|
25049
|
-
/* @__PURE__ */
|
|
25050
|
-
/* @__PURE__ */
|
|
25051
|
-
props.description.isVisible && credit.description && /* @__PURE__ */
|
|
25498
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25499
|
+
/* @__PURE__ */ jsx56(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25500
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
25501
|
+
props.description.isVisible && credit.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
25052
25502
|
] }) }),
|
|
25053
|
-
/* @__PURE__ */
|
|
25054
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
25503
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1rem", $alignItems: "center", children: [
|
|
25504
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
|
|
25055
25505
|
// Balances burn at rates with up to 10 decimal
|
|
25056
25506
|
// places, so a small remainder must not round to 0.
|
|
25057
25507
|
amount: formatNumber(credit.total.remaining, {
|
|
@@ -25062,7 +25512,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25062
25512
|
credit.total.remaining
|
|
25063
25513
|
)
|
|
25064
25514
|
}) }) }),
|
|
25065
|
-
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */
|
|
25515
|
+
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx56(
|
|
25066
25516
|
Button,
|
|
25067
25517
|
{
|
|
25068
25518
|
type: "button",
|
|
@@ -25115,7 +25565,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25115
25565
|
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
25116
25566
|
return (
|
|
25117
25567
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
25118
|
-
/* @__PURE__ */
|
|
25568
|
+
/* @__PURE__ */ jsx56(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
|
|
25119
25569
|
Text,
|
|
25120
25570
|
{
|
|
25121
25571
|
style: { opacity: 0.54 },
|
|
@@ -25128,7 +25578,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25128
25578
|
period: shortenPeriod(composition.period),
|
|
25129
25579
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25130
25580
|
}),
|
|
25131
|
-
renewalDate && /* @__PURE__ */
|
|
25581
|
+
renewalDate && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25132
25582
|
" ",
|
|
25133
25583
|
t4("Renews on the day", {
|
|
25134
25584
|
day: formatOrdinal(renewalDate.getDate())
|
|
@@ -25141,12 +25591,12 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25141
25591
|
})()
|
|
25142
25592
|
] })
|
|
25143
25593
|
] }),
|
|
25144
|
-
hasGrants && /* @__PURE__ */
|
|
25594
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25145
25595
|
Box,
|
|
25146
25596
|
{
|
|
25147
25597
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
25148
25598
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
25149
|
-
children: /* @__PURE__ */
|
|
25599
|
+
children: /* @__PURE__ */ jsxs42(
|
|
25150
25600
|
TransitionBox,
|
|
25151
25601
|
{
|
|
25152
25602
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -25154,22 +25604,22 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25154
25604
|
children: [
|
|
25155
25605
|
visibleGrants.map((grant, index2) => {
|
|
25156
25606
|
const padding = getRowPadding(index2);
|
|
25157
|
-
return /* @__PURE__ */
|
|
25158
|
-
/* @__PURE__ */
|
|
25607
|
+
return /* @__PURE__ */ jsx56(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25608
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: t4("X items included in plan", {
|
|
25159
25609
|
amount: grant.quantity,
|
|
25160
25610
|
item: getFeatureName(
|
|
25161
25611
|
credit,
|
|
25162
25612
|
grant.quantity
|
|
25163
25613
|
)
|
|
25164
25614
|
}) }) }),
|
|
25165
|
-
/* @__PURE__ */
|
|
25615
|
+
/* @__PURE__ */ jsx56(
|
|
25166
25616
|
Box,
|
|
25167
25617
|
{
|
|
25168
25618
|
$display: "table-cell",
|
|
25169
25619
|
$padding: padding,
|
|
25170
25620
|
$textAlign: "right",
|
|
25171
25621
|
$whiteSpace: "nowrap",
|
|
25172
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25622
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Resets", {
|
|
25173
25623
|
date: toPrettyDate(
|
|
25174
25624
|
modifyDate(grant.expiresAt, 1),
|
|
25175
25625
|
{ month: "short" }
|
|
@@ -25177,15 +25627,15 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25177
25627
|
}) })
|
|
25178
25628
|
}
|
|
25179
25629
|
)
|
|
25180
|
-
] }) : /* @__PURE__ */
|
|
25181
|
-
/* @__PURE__ */
|
|
25630
|
+
] }) : /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25631
|
+
/* @__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", {
|
|
25182
25632
|
amount: grant.quantity,
|
|
25183
25633
|
item: getFeatureName(credit, 1),
|
|
25184
25634
|
createdAt: toPrettyDate(
|
|
25185
25635
|
grant.createdAt,
|
|
25186
25636
|
{ month: "short" }
|
|
25187
25637
|
)
|
|
25188
|
-
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */
|
|
25638
|
+
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item auto-topup", {
|
|
25189
25639
|
amount: grant.quantity,
|
|
25190
25640
|
item: getFeatureName(
|
|
25191
25641
|
credit,
|
|
@@ -25195,7 +25645,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25195
25645
|
grant.createdAt,
|
|
25196
25646
|
{ month: "short" }
|
|
25197
25647
|
)
|
|
25198
|
-
}) }) : /* @__PURE__ */
|
|
25648
|
+
}) }) : /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item grant", {
|
|
25199
25649
|
amount: grant.quantity,
|
|
25200
25650
|
item: getFeatureName(
|
|
25201
25651
|
credit,
|
|
@@ -25206,14 +25656,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25206
25656
|
{ month: "short" }
|
|
25207
25657
|
)
|
|
25208
25658
|
}) }) }) }),
|
|
25209
|
-
/* @__PURE__ */
|
|
25659
|
+
/* @__PURE__ */ jsx56(
|
|
25210
25660
|
Box,
|
|
25211
25661
|
{
|
|
25212
25662
|
$display: "table-cell",
|
|
25213
25663
|
$padding: padding,
|
|
25214
25664
|
$textAlign: "right",
|
|
25215
25665
|
$whiteSpace: "nowrap",
|
|
25216
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25666
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Expires", {
|
|
25217
25667
|
date: toPrettyDate(
|
|
25218
25668
|
modifyDate(grant.expiresAt, 1),
|
|
25219
25669
|
{ month: "short" }
|
|
@@ -25223,8 +25673,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25223
25673
|
)
|
|
25224
25674
|
] }) }, grant.id);
|
|
25225
25675
|
}),
|
|
25226
|
-
canExpandLedger && /* @__PURE__ */
|
|
25227
|
-
/* @__PURE__ */
|
|
25676
|
+
canExpandLedger && /* @__PURE__ */ jsxs42(Box, { $display: "table-row", children: [
|
|
25677
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ jsx56(
|
|
25228
25678
|
ExpandListToggle,
|
|
25229
25679
|
{
|
|
25230
25680
|
isExpanded: showAllGrants,
|
|
@@ -25233,7 +25683,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25233
25683
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25234
25684
|
}
|
|
25235
25685
|
) }),
|
|
25236
|
-
/* @__PURE__ */
|
|
25686
|
+
/* @__PURE__ */ jsx56(
|
|
25237
25687
|
Box,
|
|
25238
25688
|
{
|
|
25239
25689
|
$display: "table-cell",
|
|
@@ -25246,7 +25696,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25246
25696
|
)
|
|
25247
25697
|
}
|
|
25248
25698
|
),
|
|
25249
|
-
hasGrants && /* @__PURE__ */
|
|
25699
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25250
25700
|
ExpandListToggle,
|
|
25251
25701
|
{
|
|
25252
25702
|
isExpanded,
|
|
@@ -25255,6 +25705,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25255
25705
|
collapseLabel: t4("Hide balance details"),
|
|
25256
25706
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25257
25707
|
}
|
|
25708
|
+
),
|
|
25709
|
+
props.usageByUser.isVisible && /* @__PURE__ */ jsx56(
|
|
25710
|
+
UsageByUser,
|
|
25711
|
+
{
|
|
25712
|
+
source: { kind: "credit", id: credit.id },
|
|
25713
|
+
unit: credit
|
|
25714
|
+
}
|
|
25258
25715
|
)
|
|
25259
25716
|
] }, index);
|
|
25260
25717
|
})
|
|
@@ -25263,11 +25720,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25263
25720
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
25264
25721
|
|
|
25265
25722
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25266
|
-
import { forwardRef as forwardRef13, useMemo as
|
|
25723
|
+
import { forwardRef as forwardRef13, useMemo as useMemo30 } from "react";
|
|
25267
25724
|
|
|
25268
25725
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
25269
|
-
import { useMemo as
|
|
25270
|
-
import { jsx as
|
|
25726
|
+
import { useMemo as useMemo29 } from "react";
|
|
25727
|
+
import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
25271
25728
|
var PaymentElement2 = ({
|
|
25272
25729
|
iconName,
|
|
25273
25730
|
iconTitle,
|
|
@@ -25275,8 +25732,8 @@ var PaymentElement2 = ({
|
|
|
25275
25732
|
paymentLast4
|
|
25276
25733
|
}) => {
|
|
25277
25734
|
const { settings } = useEmbed();
|
|
25278
|
-
return /* @__PURE__ */
|
|
25279
|
-
iconName && /* @__PURE__ */
|
|
25735
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
25736
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25280
25737
|
Icon3,
|
|
25281
25738
|
{
|
|
25282
25739
|
name: iconName,
|
|
@@ -25284,15 +25741,15 @@ var PaymentElement2 = ({
|
|
|
25284
25741
|
color: settings.theme.typography.text.color
|
|
25285
25742
|
}
|
|
25286
25743
|
),
|
|
25287
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25288
|
-
label && /* @__PURE__ */
|
|
25744
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25745
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25289
25746
|
" ",
|
|
25290
|
-
paymentLast4 && /* @__PURE__ */
|
|
25747
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25291
25748
|
] })
|
|
25292
25749
|
] });
|
|
25293
25750
|
};
|
|
25294
25751
|
var EmptyPaymentElement = () => {
|
|
25295
|
-
return /* @__PURE__ */
|
|
25752
|
+
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") }) }) }) });
|
|
25296
25753
|
};
|
|
25297
25754
|
var getPaymentMethodData = ({
|
|
25298
25755
|
accountLast4,
|
|
@@ -25372,12 +25829,12 @@ var PaymentMethodElement = ({
|
|
|
25372
25829
|
const isLightBackground = useIsLightBackground();
|
|
25373
25830
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
25374
25831
|
const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
|
|
25375
|
-
return /* @__PURE__ */
|
|
25376
|
-
props.header.isVisible && /* @__PURE__ */
|
|
25377
|
-
/* @__PURE__ */
|
|
25378
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */
|
|
25832
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
25833
|
+
props.header.isVisible && /* @__PURE__ */ jsxs43(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
25834
|
+
/* @__PURE__ */ jsx57(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
|
|
25835
|
+
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") })
|
|
25379
25836
|
] }),
|
|
25380
|
-
/* @__PURE__ */
|
|
25837
|
+
/* @__PURE__ */ jsxs43(
|
|
25381
25838
|
Flex,
|
|
25382
25839
|
{
|
|
25383
25840
|
$justifyContent: "space-between",
|
|
@@ -25386,8 +25843,8 @@ var PaymentMethodElement = ({
|
|
|
25386
25843
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
25387
25844
|
$borderRadius: "9999px",
|
|
25388
25845
|
children: [
|
|
25389
|
-
paymentMethod ? /* @__PURE__ */
|
|
25390
|
-
onRemove && /* @__PURE__ */
|
|
25846
|
+
paymentMethod ? /* @__PURE__ */ jsx57(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx57(EmptyPaymentElement, {}),
|
|
25847
|
+
onRemove && /* @__PURE__ */ jsx57(
|
|
25391
25848
|
Text,
|
|
25392
25849
|
{
|
|
25393
25850
|
onClick: onRemove,
|
|
@@ -25397,7 +25854,7 @@ var PaymentMethodElement = ({
|
|
|
25397
25854
|
children: t4("Remove")
|
|
25398
25855
|
}
|
|
25399
25856
|
),
|
|
25400
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */
|
|
25857
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx57(
|
|
25401
25858
|
Text,
|
|
25402
25859
|
{
|
|
25403
25860
|
onClick: onEdit,
|
|
@@ -25410,8 +25867,8 @@ var PaymentMethodElement = ({
|
|
|
25410
25867
|
]
|
|
25411
25868
|
}
|
|
25412
25869
|
),
|
|
25413
|
-
hasCustomFields && /* @__PURE__ */
|
|
25414
|
-
/* @__PURE__ */
|
|
25870
|
+
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: [
|
|
25871
|
+
/* @__PURE__ */ jsx57(
|
|
25415
25872
|
Text,
|
|
25416
25873
|
{
|
|
25417
25874
|
$size: 12,
|
|
@@ -25419,7 +25876,7 @@ var PaymentMethodElement = ({
|
|
|
25419
25876
|
children: field.name
|
|
25420
25877
|
}
|
|
25421
25878
|
),
|
|
25422
|
-
/* @__PURE__ */
|
|
25879
|
+
/* @__PURE__ */ jsx57(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ jsx57(
|
|
25423
25880
|
"span",
|
|
25424
25881
|
{
|
|
25425
25882
|
style: {
|
|
@@ -25440,7 +25897,7 @@ var PaymentListElement = ({
|
|
|
25440
25897
|
const { settings } = useEmbed();
|
|
25441
25898
|
const isLightBackground = useIsLightBackground();
|
|
25442
25899
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
25443
|
-
const expirationDate =
|
|
25900
|
+
const expirationDate = useMemo29(() => {
|
|
25444
25901
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
25445
25902
|
if (!cardExpMonth || !cardExpYear) {
|
|
25446
25903
|
return;
|
|
@@ -25451,7 +25908,7 @@ var PaymentListElement = ({
|
|
|
25451
25908
|
}
|
|
25452
25909
|
return `${cardExpMonth}/${formatedYear}`;
|
|
25453
25910
|
}, [paymentMethod]);
|
|
25454
|
-
return /* @__PURE__ */
|
|
25911
|
+
return /* @__PURE__ */ jsxs43(
|
|
25455
25912
|
Flex,
|
|
25456
25913
|
{
|
|
25457
25914
|
$flexDirection: "row",
|
|
@@ -25463,7 +25920,7 @@ var PaymentListElement = ({
|
|
|
25463
25920
|
$borderStyle: "solid",
|
|
25464
25921
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
25465
25922
|
children: [
|
|
25466
|
-
iconName && /* @__PURE__ */
|
|
25923
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25467
25924
|
Icon3,
|
|
25468
25925
|
{
|
|
25469
25926
|
name: iconName,
|
|
@@ -25471,20 +25928,20 @@ var PaymentListElement = ({
|
|
|
25471
25928
|
color: settings.theme.typography.text.color
|
|
25472
25929
|
}
|
|
25473
25930
|
),
|
|
25474
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25475
|
-
label && /* @__PURE__ */
|
|
25931
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25932
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25476
25933
|
" ",
|
|
25477
|
-
paymentLast4 && /* @__PURE__ */
|
|
25934
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25478
25935
|
] }),
|
|
25479
|
-
expirationDate && /* @__PURE__ */
|
|
25936
|
+
expirationDate && /* @__PURE__ */ jsx57(
|
|
25480
25937
|
Box,
|
|
25481
25938
|
{
|
|
25482
25939
|
$flexGrow: 1,
|
|
25483
25940
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
25484
|
-
children: /* @__PURE__ */
|
|
25941
|
+
children: /* @__PURE__ */ jsx57(Text, { children: t("Expires", { date: expirationDate }) })
|
|
25485
25942
|
}
|
|
25486
25943
|
),
|
|
25487
|
-
/* @__PURE__ */
|
|
25944
|
+
/* @__PURE__ */ jsx57(Box, { children: /* @__PURE__ */ jsx57(
|
|
25488
25945
|
Text,
|
|
25489
25946
|
{
|
|
25490
25947
|
onClick: () => {
|
|
@@ -25497,7 +25954,7 @@ var PaymentListElement = ({
|
|
|
25497
25954
|
children: t("Set default")
|
|
25498
25955
|
}
|
|
25499
25956
|
) }),
|
|
25500
|
-
/* @__PURE__ */
|
|
25957
|
+
/* @__PURE__ */ jsx57(
|
|
25501
25958
|
Icon3,
|
|
25502
25959
|
{
|
|
25503
25960
|
tabIndex: 0,
|
|
@@ -25519,7 +25976,7 @@ var PaymentListElement = ({
|
|
|
25519
25976
|
};
|
|
25520
25977
|
|
|
25521
25978
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25522
|
-
import { jsx as
|
|
25979
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
25523
25980
|
var resolveDesignProps5 = (props) => {
|
|
25524
25981
|
return {
|
|
25525
25982
|
header: {
|
|
@@ -25535,7 +25992,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
25535
25992
|
var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
25536
25993
|
const props = resolveDesignProps5(rest);
|
|
25537
25994
|
const { data, setLayout } = useEmbed();
|
|
25538
|
-
const { paymentMethod, monthsToExpiration } =
|
|
25995
|
+
const { paymentMethod, monthsToExpiration } = useMemo30(() => {
|
|
25539
25996
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
25540
25997
|
let monthsToExpiration2;
|
|
25541
25998
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -25554,7 +26011,7 @@ var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = tru
|
|
|
25554
26011
|
monthsToExpiration: monthsToExpiration2
|
|
25555
26012
|
};
|
|
25556
26013
|
}, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
|
|
25557
|
-
return /* @__PURE__ */
|
|
26014
|
+
return /* @__PURE__ */ jsx58(Element, { ref, className, children: /* @__PURE__ */ jsx58(
|
|
25558
26015
|
PaymentMethodElement,
|
|
25559
26016
|
{
|
|
25560
26017
|
customCheckoutFields: data?.customCheckoutFields,
|
|
@@ -25570,7 +26027,7 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
25570
26027
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25571
26028
|
import { Elements } from "@stripe/react-stripe-js";
|
|
25572
26029
|
|
|
25573
|
-
// node_modules/.pnpm/@stripe+stripe-js@9.
|
|
26030
|
+
// node_modules/.pnpm/@stripe+stripe-js@9.15.0/node_modules/@stripe/stripe-js/dist/index.mjs
|
|
25574
26031
|
function _typeof(obj) {
|
|
25575
26032
|
"@babel/helpers - typeof";
|
|
25576
26033
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -25624,7 +26081,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
25624
26081
|
}
|
|
25625
26082
|
stripe._registerWrapper({
|
|
25626
26083
|
name: "stripe-js",
|
|
25627
|
-
version: "9.
|
|
26084
|
+
version: "9.15.0",
|
|
25628
26085
|
startTime
|
|
25629
26086
|
});
|
|
25630
26087
|
};
|
|
@@ -25702,7 +26159,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
25702
26159
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
25703
26160
|
var expectedVersion = RELEASE_TRAIN;
|
|
25704
26161
|
if (isTestKey && version !== expectedVersion) {
|
|
25705
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.
|
|
26162
|
+
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"));
|
|
25706
26163
|
}
|
|
25707
26164
|
var stripe = maybeStripe.apply(void 0, args);
|
|
25708
26165
|
registerWrapper(stripe, startTime);
|
|
@@ -25739,8 +26196,8 @@ var loadStripe = function loadStripe2() {
|
|
|
25739
26196
|
};
|
|
25740
26197
|
|
|
25741
26198
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25742
|
-
import { useCallback as useCallback15, useEffect as
|
|
25743
|
-
import { jsx as
|
|
26199
|
+
import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo31, useState as useState20 } from "react";
|
|
26200
|
+
import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
25744
26201
|
var resolveDesignProps6 = () => {
|
|
25745
26202
|
return {
|
|
25746
26203
|
header: {
|
|
@@ -25768,7 +26225,7 @@ var PaymentMethodDetails = ({
|
|
|
25768
26225
|
updatePaymentMethod,
|
|
25769
26226
|
deletePaymentMethod
|
|
25770
26227
|
} = useEmbed();
|
|
25771
|
-
const { defaultPaymentMethod, paymentMethods, subscription } =
|
|
26228
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = useMemo31(() => {
|
|
25772
26229
|
return {
|
|
25773
26230
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
25774
26231
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -25781,13 +26238,13 @@ var PaymentMethodDetails = ({
|
|
|
25781
26238
|
]);
|
|
25782
26239
|
const isLightBackground = useIsLightBackground();
|
|
25783
26240
|
const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
|
|
25784
|
-
const [isLoading, setIsLoading] =
|
|
25785
|
-
const [error, setError] =
|
|
25786
|
-
const [showPaymentForm, setShowPaymentForm] =
|
|
25787
|
-
const [stripe, setStripe] =
|
|
25788
|
-
const [setupIntent, setSetupIntent] =
|
|
25789
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] =
|
|
25790
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] =
|
|
26241
|
+
const [isLoading, setIsLoading] = useState20(!initialPaymentMethod);
|
|
26242
|
+
const [error, setError] = useState20();
|
|
26243
|
+
const [showPaymentForm, setShowPaymentForm] = useState20(false);
|
|
26244
|
+
const [stripe, setStripe] = useState20(null);
|
|
26245
|
+
const [setupIntent, setSetupIntent] = useState20();
|
|
26246
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState20(false);
|
|
26247
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = useState20(initialPaymentMethod);
|
|
25791
26248
|
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
25792
26249
|
stripe,
|
|
25793
26250
|
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
@@ -25800,7 +26257,7 @@ var PaymentMethodDetails = ({
|
|
|
25800
26257
|
},
|
|
25801
26258
|
autoConfirm: true
|
|
25802
26259
|
});
|
|
25803
|
-
const monthsToExpiration =
|
|
26260
|
+
const monthsToExpiration = useMemo31(() => {
|
|
25804
26261
|
let expiration;
|
|
25805
26262
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
25806
26263
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -25823,7 +26280,7 @@ var PaymentMethodDetails = ({
|
|
|
25823
26280
|
const toggleShowPaymentMethods = () => {
|
|
25824
26281
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
25825
26282
|
};
|
|
25826
|
-
const locale =
|
|
26283
|
+
const locale = useMemo31(() => stripeLocale(i18n.language), [i18n.language]);
|
|
25827
26284
|
const initializeStripe = useCallback15(() => {
|
|
25828
26285
|
if (stripe || !setupIntent) {
|
|
25829
26286
|
return;
|
|
@@ -25900,10 +26357,10 @@ var PaymentMethodDetails = ({
|
|
|
25900
26357
|
},
|
|
25901
26358
|
[t4, deletePaymentMethod]
|
|
25902
26359
|
);
|
|
25903
|
-
|
|
26360
|
+
useEffect8(() => {
|
|
25904
26361
|
initializeStripe();
|
|
25905
26362
|
}, [initializeStripe]);
|
|
25906
|
-
|
|
26363
|
+
useEffect8(() => {
|
|
25907
26364
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
25908
26365
|
initializePaymentMethod();
|
|
25909
26366
|
}
|
|
@@ -25913,7 +26370,7 @@ var PaymentMethodDetails = ({
|
|
|
25913
26370
|
showPaymentForm,
|
|
25914
26371
|
initializePaymentMethod
|
|
25915
26372
|
]);
|
|
25916
|
-
return /* @__PURE__ */
|
|
26373
|
+
return /* @__PURE__ */ jsxs44(
|
|
25917
26374
|
Flex,
|
|
25918
26375
|
{
|
|
25919
26376
|
$position: "relative",
|
|
@@ -25921,7 +26378,7 @@ var PaymentMethodDetails = ({
|
|
|
25921
26378
|
$flexGrow: 1,
|
|
25922
26379
|
$gap: "1.5rem",
|
|
25923
26380
|
children: [
|
|
25924
|
-
/* @__PURE__ */
|
|
26381
|
+
/* @__PURE__ */ jsx59(
|
|
25925
26382
|
Flex,
|
|
25926
26383
|
{
|
|
25927
26384
|
$position: "absolute",
|
|
@@ -25930,7 +26387,7 @@ var PaymentMethodDetails = ({
|
|
|
25930
26387
|
$alignItems: "center",
|
|
25931
26388
|
$width: "100%",
|
|
25932
26389
|
$height: "100%",
|
|
25933
|
-
children: /* @__PURE__ */
|
|
26390
|
+
children: /* @__PURE__ */ jsx59(
|
|
25934
26391
|
Loader,
|
|
25935
26392
|
{
|
|
25936
26393
|
$color: settings.theme.primary,
|
|
@@ -25940,7 +26397,7 @@ var PaymentMethodDetails = ({
|
|
|
25940
26397
|
)
|
|
25941
26398
|
}
|
|
25942
26399
|
),
|
|
25943
|
-
/* @__PURE__ */
|
|
26400
|
+
/* @__PURE__ */ jsxs44(
|
|
25944
26401
|
Flex,
|
|
25945
26402
|
{
|
|
25946
26403
|
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
@@ -25957,7 +26414,7 @@ var PaymentMethodDetails = ({
|
|
|
25957
26414
|
}
|
|
25958
26415
|
},
|
|
25959
26416
|
children: [
|
|
25960
|
-
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */
|
|
26417
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs44(
|
|
25961
26418
|
Elements,
|
|
25962
26419
|
{
|
|
25963
26420
|
stripe,
|
|
@@ -25988,7 +26445,7 @@ var PaymentMethodDetails = ({
|
|
|
25988
26445
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
25989
26446
|
},
|
|
25990
26447
|
children: [
|
|
25991
|
-
/* @__PURE__ */
|
|
26448
|
+
/* @__PURE__ */ jsx59(
|
|
25992
26449
|
PaymentForm,
|
|
25993
26450
|
{
|
|
25994
26451
|
financeData,
|
|
@@ -25999,7 +26456,7 @@ var PaymentMethodDetails = ({
|
|
|
25999
26456
|
}
|
|
26000
26457
|
}
|
|
26001
26458
|
),
|
|
26002
|
-
currentPaymentMethod && /* @__PURE__ */
|
|
26459
|
+
currentPaymentMethod && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(
|
|
26003
26460
|
Text,
|
|
26004
26461
|
{
|
|
26005
26462
|
onClick: focusExistingPaymentMethods,
|
|
@@ -26012,8 +26469,8 @@ var PaymentMethodDetails = ({
|
|
|
26012
26469
|
) })
|
|
26013
26470
|
]
|
|
26014
26471
|
}
|
|
26015
|
-
) : /* @__PURE__ */
|
|
26016
|
-
/* @__PURE__ */
|
|
26472
|
+
) : /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
26473
|
+
/* @__PURE__ */ jsx59(
|
|
26017
26474
|
PaymentMethodElement,
|
|
26018
26475
|
{
|
|
26019
26476
|
paymentMethod: currentPaymentMethod,
|
|
@@ -26026,8 +26483,8 @@ var PaymentMethodDetails = ({
|
|
|
26026
26483
|
...props
|
|
26027
26484
|
}
|
|
26028
26485
|
),
|
|
26029
|
-
paymentMethods.length > 0 && /* @__PURE__ */
|
|
26030
|
-
/* @__PURE__ */
|
|
26486
|
+
paymentMethods.length > 0 && /* @__PURE__ */ jsxs44(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
26487
|
+
/* @__PURE__ */ jsx59(
|
|
26031
26488
|
Text,
|
|
26032
26489
|
{
|
|
26033
26490
|
onClick: toggleShowPaymentMethods,
|
|
@@ -26038,7 +26495,7 @@ var PaymentMethodDetails = ({
|
|
|
26038
26495
|
children: t4("Choose different payment method")
|
|
26039
26496
|
}
|
|
26040
26497
|
),
|
|
26041
|
-
/* @__PURE__ */
|
|
26498
|
+
/* @__PURE__ */ jsx59(
|
|
26042
26499
|
Icon3,
|
|
26043
26500
|
{
|
|
26044
26501
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
|
|
@@ -26046,10 +26503,10 @@ var PaymentMethodDetails = ({
|
|
|
26046
26503
|
}
|
|
26047
26504
|
)
|
|
26048
26505
|
] }),
|
|
26049
|
-
showDifferentPaymentMethods && /* @__PURE__ */
|
|
26050
|
-
paymentMethods.length > 1 && /* @__PURE__ */
|
|
26506
|
+
showDifferentPaymentMethods && /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
26507
|
+
paymentMethods.length > 1 && /* @__PURE__ */ jsx59(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
26051
26508
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
26052
|
-
) || []).map((paymentMethod) => /* @__PURE__ */
|
|
26509
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ jsx59(
|
|
26053
26510
|
PaymentListElement,
|
|
26054
26511
|
{
|
|
26055
26512
|
paymentMethod,
|
|
@@ -26058,7 +26515,7 @@ var PaymentMethodDetails = ({
|
|
|
26058
26515
|
},
|
|
26059
26516
|
paymentMethod.id
|
|
26060
26517
|
)) }),
|
|
26061
|
-
/* @__PURE__ */
|
|
26518
|
+
/* @__PURE__ */ jsx59(
|
|
26062
26519
|
Button,
|
|
26063
26520
|
{
|
|
26064
26521
|
type: "button",
|
|
@@ -26073,7 +26530,7 @@ var PaymentMethodDetails = ({
|
|
|
26073
26530
|
)
|
|
26074
26531
|
] })
|
|
26075
26532
|
] }),
|
|
26076
|
-
!isLoading && error && /* @__PURE__ */
|
|
26533
|
+
!isLoading && error && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
26077
26534
|
]
|
|
26078
26535
|
}
|
|
26079
26536
|
)
|
|
@@ -26083,13 +26540,13 @@ var PaymentMethodDetails = ({
|
|
|
26083
26540
|
};
|
|
26084
26541
|
|
|
26085
26542
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26086
|
-
import { forwardRef as forwardRef14, useMemo as
|
|
26543
|
+
import { forwardRef as forwardRef14, useMemo as useMemo33 } from "react";
|
|
26087
26544
|
|
|
26088
26545
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
26089
|
-
import { jsx as
|
|
26546
|
+
import { jsx as jsx60, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
26090
26547
|
var AddOn = ({ addOn, currency, period, layout }) => {
|
|
26091
26548
|
const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
|
|
26092
|
-
return /* @__PURE__ */
|
|
26549
|
+
return /* @__PURE__ */ jsxs45(
|
|
26093
26550
|
Flex,
|
|
26094
26551
|
{
|
|
26095
26552
|
$justifyContent: "space-between",
|
|
@@ -26097,10 +26554,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26097
26554
|
$flexWrap: "wrap",
|
|
26098
26555
|
$gap: "1rem",
|
|
26099
26556
|
children: [
|
|
26100
|
-
/* @__PURE__ */
|
|
26101
|
-
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */
|
|
26557
|
+
/* @__PURE__ */ jsx60(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
26558
|
+
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs45(Text, { children: [
|
|
26102
26559
|
formatCurrency(addOn.planPrice, currency),
|
|
26103
|
-
/* @__PURE__ */
|
|
26560
|
+
/* @__PURE__ */ jsx60("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
|
|
26104
26561
|
] })
|
|
26105
26562
|
]
|
|
26106
26563
|
}
|
|
@@ -26108,8 +26565,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26108
26565
|
};
|
|
26109
26566
|
|
|
26110
26567
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
26111
|
-
import { Fragment as Fragment24, useMemo as
|
|
26112
|
-
import { Fragment as Fragment25, jsx as
|
|
26568
|
+
import { Fragment as Fragment24, useMemo as useMemo32 } from "react";
|
|
26569
|
+
import { Fragment as Fragment25, jsx as jsx61, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
26113
26570
|
var UsageDetails2 = ({
|
|
26114
26571
|
entitlement,
|
|
26115
26572
|
period,
|
|
@@ -26124,40 +26581,40 @@ var UsageDetails2 = ({
|
|
|
26124
26581
|
billingPrice,
|
|
26125
26582
|
limit,
|
|
26126
26583
|
cost = 0
|
|
26127
|
-
} =
|
|
26584
|
+
} = useMemo32(
|
|
26128
26585
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26129
26586
|
showWarningThresholdAsLimit
|
|
26130
26587
|
}),
|
|
26131
26588
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26132
26589
|
);
|
|
26133
|
-
const description =
|
|
26590
|
+
const description = useMemo32(() => {
|
|
26134
26591
|
const acc = [];
|
|
26135
26592
|
let index = 0;
|
|
26136
26593
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
26137
|
-
acc.push(/* @__PURE__ */
|
|
26594
|
+
acc.push(/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26138
26595
|
t4("Additional"),
|
|
26139
26596
|
": "
|
|
26140
26597
|
] }, index));
|
|
26141
26598
|
index += 1;
|
|
26142
26599
|
}
|
|
26143
26600
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
26144
|
-
acc.push(/* @__PURE__ */
|
|
26601
|
+
acc.push(/* @__PURE__ */ jsx61(Fragment24, { children: t4("Tier-based") }, index));
|
|
26145
26602
|
index += 1;
|
|
26146
26603
|
}
|
|
26147
26604
|
const { price } = getEntitlementPrice(entitlement, period, currency) || {};
|
|
26148
26605
|
if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
|
|
26149
26606
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
26150
26607
|
acc.push(
|
|
26151
|
-
/* @__PURE__ */
|
|
26608
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26152
26609
|
formatCurrency(price, billingPrice?.currency),
|
|
26153
|
-
/* @__PURE__ */
|
|
26610
|
+
/* @__PURE__ */ jsxs46("sub", { children: [
|
|
26154
26611
|
"/",
|
|
26155
|
-
packageSize > 1 && /* @__PURE__ */
|
|
26612
|
+
packageSize > 1 && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26156
26613
|
packageSize,
|
|
26157
26614
|
" "
|
|
26158
26615
|
] }),
|
|
26159
26616
|
getFeatureName(entitlement.feature, packageSize),
|
|
26160
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26617
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26161
26618
|
"/",
|
|
26162
26619
|
shortenPeriod(period)
|
|
26163
26620
|
] })
|
|
@@ -26168,7 +26625,7 @@ var UsageDetails2 = ({
|
|
|
26168
26625
|
}
|
|
26169
26626
|
if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
26170
26627
|
acc.push(
|
|
26171
|
-
/* @__PURE__ */
|
|
26628
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26172
26629
|
formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
|
|
26173
26630
|
" ",
|
|
26174
26631
|
getFeatureName(
|
|
@@ -26196,7 +26653,7 @@ var UsageDetails2 = ({
|
|
|
26196
26653
|
return null;
|
|
26197
26654
|
}
|
|
26198
26655
|
const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
|
|
26199
|
-
return /* @__PURE__ */
|
|
26656
|
+
return /* @__PURE__ */ jsxs46(
|
|
26200
26657
|
Flex,
|
|
26201
26658
|
{
|
|
26202
26659
|
$justifyContent: "space-between",
|
|
@@ -26204,13 +26661,13 @@ var UsageDetails2 = ({
|
|
|
26204
26661
|
$flexWrap: "wrap",
|
|
26205
26662
|
$gap: "0.5rem",
|
|
26206
26663
|
children: [
|
|
26207
|
-
/* @__PURE__ */
|
|
26664
|
+
/* @__PURE__ */ jsx61(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26208
26665
|
quantity,
|
|
26209
26666
|
" ",
|
|
26210
26667
|
getFeatureName(entitlement.feature, quantity, true)
|
|
26211
26668
|
] }) : entitlement.feature.name }),
|
|
26212
|
-
/* @__PURE__ */
|
|
26213
|
-
description.length > 0 && /* @__PURE__ */
|
|
26669
|
+
/* @__PURE__ */ jsxs46(Text, { children: [
|
|
26670
|
+
description.length > 0 && /* @__PURE__ */ jsx61(
|
|
26214
26671
|
Text,
|
|
26215
26672
|
{
|
|
26216
26673
|
style: { opacity: 0.54 },
|
|
@@ -26221,15 +26678,15 @@ var UsageDetails2 = ({
|
|
|
26221
26678
|
),
|
|
26222
26679
|
// only show cost for pay-in-advance entitlements
|
|
26223
26680
|
// `description` will include price for other price behaviors
|
|
26224
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
26681
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26225
26682
|
" ",
|
|
26226
26683
|
formatCurrency(cost, billingPrice?.currency),
|
|
26227
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26684
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46("sub", { children: [
|
|
26228
26685
|
"/",
|
|
26229
26686
|
shortenPeriod(period)
|
|
26230
26687
|
] })
|
|
26231
26688
|
] }),
|
|
26232
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */
|
|
26689
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ jsx61(
|
|
26233
26690
|
PricingTiersTooltip,
|
|
26234
26691
|
{
|
|
26235
26692
|
feature: entitlement.feature,
|
|
@@ -26239,7 +26696,7 @@ var UsageDetails2 = ({
|
|
|
26239
26696
|
tiersMode: billingPrice?.tiersMode ?? void 0
|
|
26240
26697
|
}
|
|
26241
26698
|
),
|
|
26242
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
26699
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx61(
|
|
26243
26700
|
HardLimitTooltip,
|
|
26244
26701
|
{
|
|
26245
26702
|
feature: entitlement.feature,
|
|
@@ -26253,7 +26710,7 @@ var UsageDetails2 = ({
|
|
|
26253
26710
|
};
|
|
26254
26711
|
|
|
26255
26712
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26256
|
-
import { Fragment as Fragment26, jsx as
|
|
26713
|
+
import { Fragment as Fragment26, jsx as jsx62, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
26257
26714
|
var resolveDesignProps7 = (props) => {
|
|
26258
26715
|
return {
|
|
26259
26716
|
header: {
|
|
@@ -26301,7 +26758,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26301
26758
|
showCredits,
|
|
26302
26759
|
showZeroPriceAsFree,
|
|
26303
26760
|
trialPaymentMethodRequired
|
|
26304
|
-
} =
|
|
26761
|
+
} = useMemo33(() => {
|
|
26305
26762
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
26306
26763
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
26307
26764
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -26361,15 +26818,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26361
26818
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
26362
26819
|
data?.trialPaymentMethodRequired
|
|
26363
26820
|
]);
|
|
26364
|
-
const usageBasedEntitlements =
|
|
26821
|
+
const usageBasedEntitlements = useMemo33(
|
|
26365
26822
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
26366
26823
|
[featureUsage]
|
|
26367
26824
|
);
|
|
26368
|
-
const planCreditCompositions =
|
|
26825
|
+
const planCreditCompositions = useMemo33(
|
|
26369
26826
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
26370
26827
|
[currentPlan?.includedCreditGrants]
|
|
26371
26828
|
);
|
|
26372
|
-
const resolveLicenseQuantity =
|
|
26829
|
+
const resolveLicenseQuantity = useMemo33(() => {
|
|
26373
26830
|
return (licenseId) => {
|
|
26374
26831
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
26375
26832
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -26392,7 +26849,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26392
26849
|
subscriptionCurrency,
|
|
26393
26850
|
willSubscriptionCancel,
|
|
26394
26851
|
isTrialSubscription
|
|
26395
|
-
} =
|
|
26852
|
+
} = useMemo33(() => {
|
|
26396
26853
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
26397
26854
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
26398
26855
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -26405,7 +26862,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26405
26862
|
};
|
|
26406
26863
|
}, [billingSubscription]);
|
|
26407
26864
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
26408
|
-
const { isFreePlan, isUsageBasedPlan } =
|
|
26865
|
+
const { isFreePlan, isUsageBasedPlan } = useMemo33(() => {
|
|
26409
26866
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
26410
26867
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
26411
26868
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -26413,8 +26870,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26413
26870
|
const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
|
|
26414
26871
|
(grant) => isSelfServiceAutoTopupAvailable(grant)
|
|
26415
26872
|
) ?? false;
|
|
26416
|
-
return /* @__PURE__ */
|
|
26417
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */
|
|
26873
|
+
return /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26874
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26418
26875
|
Notice,
|
|
26419
26876
|
{
|
|
26420
26877
|
as: Flex,
|
|
@@ -26424,8 +26881,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26424
26881
|
$textAlign: "center",
|
|
26425
26882
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26426
26883
|
children: [
|
|
26427
|
-
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */
|
|
26428
|
-
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */
|
|
26884
|
+
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
|
|
26885
|
+
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ jsx62(
|
|
26429
26886
|
Text,
|
|
26430
26887
|
{
|
|
26431
26888
|
as: "p",
|
|
@@ -26439,7 +26896,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26439
26896
|
)
|
|
26440
26897
|
]
|
|
26441
26898
|
}
|
|
26442
|
-
) : willSubscriptionCancel ? /* @__PURE__ */
|
|
26899
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26443
26900
|
Notice,
|
|
26444
26901
|
{
|
|
26445
26902
|
as: Flex,
|
|
@@ -26449,8 +26906,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26449
26906
|
$textAlign: "center",
|
|
26450
26907
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26451
26908
|
children: [
|
|
26452
|
-
/* @__PURE__ */
|
|
26453
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */
|
|
26909
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
|
|
26910
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx62(
|
|
26454
26911
|
Text,
|
|
26455
26912
|
{
|
|
26456
26913
|
as: "p",
|
|
@@ -26465,7 +26922,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26465
26922
|
)
|
|
26466
26923
|
]
|
|
26467
26924
|
}
|
|
26468
|
-
) : customPlanBilling ? /* @__PURE__ */
|
|
26925
|
+
) : customPlanBilling ? /* @__PURE__ */ jsxs47(
|
|
26469
26926
|
Notice,
|
|
26470
26927
|
{
|
|
26471
26928
|
as: Flex,
|
|
@@ -26475,19 +26932,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26475
26932
|
$textAlign: "center",
|
|
26476
26933
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26477
26934
|
children: [
|
|
26478
|
-
/* @__PURE__ */
|
|
26935
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
|
|
26479
26936
|
plan: customPlanBilling.planName ?? t4("your plan")
|
|
26480
26937
|
}) : t4("Custom plan payment due", {
|
|
26481
26938
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26482
26939
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26483
26940
|
}) }),
|
|
26484
|
-
/* @__PURE__ */
|
|
26941
|
+
/* @__PURE__ */ jsx62(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
|
|
26485
26942
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26486
26943
|
}) : t4("Custom plan payment due description", {
|
|
26487
26944
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26488
26945
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26489
26946
|
}) }),
|
|
26490
|
-
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */
|
|
26947
|
+
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ jsx62(
|
|
26491
26948
|
Button,
|
|
26492
26949
|
{
|
|
26493
26950
|
as: "a",
|
|
@@ -26501,7 +26958,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26501
26958
|
)
|
|
26502
26959
|
]
|
|
26503
26960
|
}
|
|
26504
|
-
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */
|
|
26961
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs47(
|
|
26505
26962
|
Notice,
|
|
26506
26963
|
{
|
|
26507
26964
|
as: Flex,
|
|
@@ -26511,10 +26968,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26511
26968
|
$textAlign: "center",
|
|
26512
26969
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26513
26970
|
children: [
|
|
26514
|
-
/* @__PURE__ */
|
|
26971
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
|
|
26515
26972
|
plan: data.company.scheduledDowngrade.toPlanName
|
|
26516
26973
|
}) }),
|
|
26517
|
-
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */
|
|
26974
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx62(
|
|
26518
26975
|
Text,
|
|
26519
26976
|
{
|
|
26520
26977
|
as: "p",
|
|
@@ -26530,7 +26987,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26530
26987
|
]
|
|
26531
26988
|
}
|
|
26532
26989
|
),
|
|
26533
|
-
/* @__PURE__ */
|
|
26990
|
+
/* @__PURE__ */ jsxs47(
|
|
26534
26991
|
Element,
|
|
26535
26992
|
{
|
|
26536
26993
|
as: Flex,
|
|
@@ -26539,19 +26996,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26539
26996
|
$flexDirection: "column",
|
|
26540
26997
|
$gap: "2rem",
|
|
26541
26998
|
children: [
|
|
26542
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */
|
|
26999
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs47(
|
|
26543
27000
|
Flex,
|
|
26544
27001
|
{
|
|
26545
27002
|
$justifyContent: "space-between",
|
|
26546
27003
|
$alignItems: "center",
|
|
26547
27004
|
$gap: "1rem",
|
|
26548
27005
|
children: [
|
|
26549
|
-
/* @__PURE__ */
|
|
26550
|
-
/* @__PURE__ */
|
|
26551
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */
|
|
27006
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
27007
|
+
/* @__PURE__ */ jsx62(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
|
|
27008
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx62(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
26552
27009
|
] }),
|
|
26553
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */
|
|
26554
|
-
/* @__PURE__ */
|
|
27010
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsxs47(Box, { children: [
|
|
27011
|
+
/* @__PURE__ */ jsx62(
|
|
26555
27012
|
Text,
|
|
26556
27013
|
{
|
|
26557
27014
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -26561,7 +27018,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26561
27018
|
)
|
|
26562
27019
|
}
|
|
26563
27020
|
),
|
|
26564
|
-
!isFreePlan && currentPlanPeriod && /* @__PURE__ */
|
|
27021
|
+
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx62(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
|
|
26565
27022
|
"/",
|
|
26566
27023
|
shortenPeriod(currentPlanPeriod)
|
|
26567
27024
|
] }) })
|
|
@@ -26569,8 +27026,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26569
27026
|
]
|
|
26570
27027
|
}
|
|
26571
27028
|
),
|
|
26572
|
-
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */
|
|
26573
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27029
|
+
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27030
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26574
27031
|
Text,
|
|
26575
27032
|
{
|
|
26576
27033
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26578,7 +27035,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26578
27035
|
children: t4("Add-ons")
|
|
26579
27036
|
}
|
|
26580
27037
|
),
|
|
26581
|
-
/* @__PURE__ */
|
|
27038
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx62(
|
|
26582
27039
|
AddOn,
|
|
26583
27040
|
{
|
|
26584
27041
|
addOn,
|
|
@@ -26589,8 +27046,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26589
27046
|
addOnIndex
|
|
26590
27047
|
)) })
|
|
26591
27048
|
] }),
|
|
26592
|
-
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */
|
|
26593
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27049
|
+
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27050
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26594
27051
|
Text,
|
|
26595
27052
|
{
|
|
26596
27053
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26598,8 +27055,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26598
27055
|
children: t4("Usage-based")
|
|
26599
27056
|
}
|
|
26600
27057
|
),
|
|
26601
|
-
/* @__PURE__ */
|
|
26602
|
-
return /* @__PURE__ */
|
|
27058
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
27059
|
+
return /* @__PURE__ */ jsx62(
|
|
26603
27060
|
UsageDetails2,
|
|
26604
27061
|
{
|
|
26605
27062
|
entitlement,
|
|
@@ -26612,8 +27069,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26612
27069
|
);
|
|
26613
27070
|
}) })
|
|
26614
27071
|
] }),
|
|
26615
|
-
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */
|
|
26616
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27072
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27073
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26617
27074
|
Text,
|
|
26618
27075
|
{
|
|
26619
27076
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26621,7 +27078,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26621
27078
|
children: t4("Credits in plan")
|
|
26622
27079
|
}
|
|
26623
27080
|
),
|
|
26624
|
-
/* @__PURE__ */
|
|
27081
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
|
|
26625
27082
|
const planCreditGrant = currentPlan?.includedCreditGrants.find(
|
|
26626
27083
|
(grant) => grant.creditId === group.id
|
|
26627
27084
|
);
|
|
@@ -26644,13 +27101,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26644
27101
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
26645
27102
|
const creditPeriod = composition.period ?? subscriptionInterval;
|
|
26646
27103
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
26647
|
-
return /* @__PURE__ */
|
|
27104
|
+
return /* @__PURE__ */ jsxs47(
|
|
26648
27105
|
Flex,
|
|
26649
27106
|
{
|
|
26650
27107
|
$flexDirection: "column",
|
|
26651
27108
|
$gap: "0.25rem",
|
|
26652
27109
|
children: [
|
|
26653
|
-
/* @__PURE__ */
|
|
27110
|
+
/* @__PURE__ */ jsxs47(
|
|
26654
27111
|
Flex,
|
|
26655
27112
|
{
|
|
26656
27113
|
$justifyContent: "space-between",
|
|
@@ -26658,7 +27115,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26658
27115
|
$flexWrap: "wrap",
|
|
26659
27116
|
$gap: "0.5rem",
|
|
26660
27117
|
children: [
|
|
26661
|
-
/* @__PURE__ */
|
|
27118
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26662
27119
|
t4("X credits per license", {
|
|
26663
27120
|
amount: perLicenseGrant.amount,
|
|
26664
27121
|
creditName: getFeatureName(
|
|
@@ -26667,7 +27124,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26667
27124
|
),
|
|
26668
27125
|
licenseName: getFeatureName(licenseFeature, 1)
|
|
26669
27126
|
}),
|
|
26670
|
-
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */
|
|
27127
|
+
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26671
27128
|
" ",
|
|
26672
27129
|
t4("Plus X credits per period", {
|
|
26673
27130
|
amount: composition.fixedQuantity,
|
|
@@ -26678,18 +27135,18 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26678
27135
|
period: t4(creditPeriod)
|
|
26679
27136
|
})
|
|
26680
27137
|
] })
|
|
26681
|
-
] }) : /* @__PURE__ */
|
|
27138
|
+
] }) : /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26682
27139
|
group.total.value,
|
|
26683
27140
|
" ",
|
|
26684
27141
|
getFeatureName(group, group.total.value),
|
|
26685
27142
|
" ",
|
|
26686
|
-
subscriptionInterval && /* @__PURE__ */
|
|
27143
|
+
subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26687
27144
|
t4("per"),
|
|
26688
27145
|
" ",
|
|
26689
27146
|
t4(subscriptionInterval)
|
|
26690
27147
|
] })
|
|
26691
27148
|
] }) }),
|
|
26692
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27149
|
+
group.total.used > 0 && /* @__PURE__ */ jsx62(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ jsxs47(
|
|
26693
27150
|
Text,
|
|
26694
27151
|
{
|
|
26695
27152
|
style: { opacity: 0.54 },
|
|
@@ -26699,7 +27156,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26699
27156
|
group.total.used,
|
|
26700
27157
|
" ",
|
|
26701
27158
|
t4("used"),
|
|
26702
|
-
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */
|
|
27159
|
+
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ jsx62(
|
|
26703
27160
|
AutoTopupNotice,
|
|
26704
27161
|
{
|
|
26705
27162
|
thresholdCredits,
|
|
@@ -26712,7 +27169,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26712
27169
|
]
|
|
26713
27170
|
}
|
|
26714
27171
|
),
|
|
26715
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */
|
|
27172
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx62(
|
|
26716
27173
|
Text,
|
|
26717
27174
|
{
|
|
26718
27175
|
style: { opacity: 0.54 },
|
|
@@ -26753,7 +27210,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26753
27210
|
groupIndex
|
|
26754
27211
|
);
|
|
26755
27212
|
}) }),
|
|
26756
|
-
planCredits.canExpand && /* @__PURE__ */
|
|
27213
|
+
planCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26757
27214
|
ExpandListToggle,
|
|
26758
27215
|
{
|
|
26759
27216
|
isExpanded: planCredits.isExpanded,
|
|
@@ -26762,7 +27219,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26762
27219
|
$marginTop: "0.5rem"
|
|
26763
27220
|
}
|
|
26764
27221
|
),
|
|
26765
|
-
hasAutoTopupSelfService && /* @__PURE__ */
|
|
27222
|
+
hasAutoTopupSelfService && /* @__PURE__ */ jsxs47(
|
|
26766
27223
|
Flex,
|
|
26767
27224
|
{
|
|
26768
27225
|
$justifyContent: "space-between",
|
|
@@ -26772,8 +27229,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26772
27229
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26773
27230
|
$borderRadius: "0.5rem",
|
|
26774
27231
|
children: [
|
|
26775
|
-
/* @__PURE__ */
|
|
26776
|
-
/* @__PURE__ */
|
|
27232
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27233
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
|
|
26777
27234
|
currentPlan?.includedCreditGrants.reduce(
|
|
26778
27235
|
(acc, grant) => {
|
|
26779
27236
|
if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -26782,7 +27239,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26782
27239
|
const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
|
|
26783
27240
|
if (!autoTopupEnabled) {
|
|
26784
27241
|
acc.push(
|
|
26785
|
-
/* @__PURE__ */
|
|
27242
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
|
|
26786
27243
|
unit: getFeatureName(grant.credit, 1)
|
|
26787
27244
|
}) }, grant.id)
|
|
26788
27245
|
);
|
|
@@ -26792,7 +27249,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26792
27249
|
const autoTopupAmount = getAutoTopupAmount(grant);
|
|
26793
27250
|
if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
|
|
26794
27251
|
acc.push(
|
|
26795
|
-
/* @__PURE__ */
|
|
27252
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
|
|
26796
27253
|
unit: getFeatureName(
|
|
26797
27254
|
grant.credit,
|
|
26798
27255
|
autoTopupAmount
|
|
@@ -26807,7 +27264,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26807
27264
|
[]
|
|
26808
27265
|
)
|
|
26809
27266
|
] }),
|
|
26810
|
-
/* @__PURE__ */
|
|
27267
|
+
/* @__PURE__ */ jsx62(
|
|
26811
27268
|
Button,
|
|
26812
27269
|
{
|
|
26813
27270
|
type: "button",
|
|
@@ -26824,8 +27281,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26824
27281
|
}
|
|
26825
27282
|
)
|
|
26826
27283
|
] }),
|
|
26827
|
-
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */
|
|
26828
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27284
|
+
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27285
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26829
27286
|
Text,
|
|
26830
27287
|
{
|
|
26831
27288
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26833,9 +27290,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26833
27290
|
children: t4("Top-ups")
|
|
26834
27291
|
}
|
|
26835
27292
|
),
|
|
26836
|
-
/* @__PURE__ */
|
|
27293
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
|
|
26837
27294
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26838
|
-
return /* @__PURE__ */
|
|
27295
|
+
return /* @__PURE__ */ jsxs47(
|
|
26839
27296
|
Flex,
|
|
26840
27297
|
{
|
|
26841
27298
|
$justifyContent: "space-between",
|
|
@@ -26843,8 +27300,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26843
27300
|
$flexWrap: "wrap",
|
|
26844
27301
|
$gap: "0.5rem",
|
|
26845
27302
|
children: [
|
|
26846
|
-
bundle ? /* @__PURE__ */
|
|
26847
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27303
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27304
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26848
27305
|
"(",
|
|
26849
27306
|
group.grants.length,
|
|
26850
27307
|
")",
|
|
@@ -26856,8 +27313,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26856
27313
|
" ",
|
|
26857
27314
|
getFeatureName(group, group.quantity),
|
|
26858
27315
|
")"
|
|
26859
|
-
] }) : /* @__PURE__ */
|
|
26860
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27316
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27317
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26861
27318
|
"(",
|
|
26862
27319
|
group.grants.length,
|
|
26863
27320
|
")",
|
|
@@ -26867,7 +27324,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26867
27324
|
" ",
|
|
26868
27325
|
getFeatureName(group, group.quantity)
|
|
26869
27326
|
] }),
|
|
26870
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27327
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26871
27328
|
Text,
|
|
26872
27329
|
{
|
|
26873
27330
|
style: { opacity: 0.54 },
|
|
@@ -26885,7 +27342,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26885
27342
|
groupIndex
|
|
26886
27343
|
);
|
|
26887
27344
|
}) }),
|
|
26888
|
-
autoTopupCredits.canExpand && /* @__PURE__ */
|
|
27345
|
+
autoTopupCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26889
27346
|
ExpandListToggle,
|
|
26890
27347
|
{
|
|
26891
27348
|
isExpanded: autoTopupCredits.isExpanded,
|
|
@@ -26895,8 +27352,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26895
27352
|
}
|
|
26896
27353
|
)
|
|
26897
27354
|
] }),
|
|
26898
|
-
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */
|
|
26899
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27355
|
+
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27356
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26900
27357
|
Text,
|
|
26901
27358
|
{
|
|
26902
27359
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26904,9 +27361,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26904
27361
|
children: t4("Credit bundles")
|
|
26905
27362
|
}
|
|
26906
27363
|
),
|
|
26907
|
-
/* @__PURE__ */
|
|
27364
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
|
|
26908
27365
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26909
|
-
return /* @__PURE__ */
|
|
27366
|
+
return /* @__PURE__ */ jsxs47(
|
|
26910
27367
|
Flex,
|
|
26911
27368
|
{
|
|
26912
27369
|
$justifyContent: "space-between",
|
|
@@ -26914,8 +27371,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26914
27371
|
$flexWrap: "wrap",
|
|
26915
27372
|
$gap: "0.5rem",
|
|
26916
27373
|
children: [
|
|
26917
|
-
bundle ? /* @__PURE__ */
|
|
26918
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27374
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27375
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
26919
27376
|
"(",
|
|
26920
27377
|
group.grants.length,
|
|
26921
27378
|
")",
|
|
@@ -26927,12 +27384,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26927
27384
|
" ",
|
|
26928
27385
|
getFeatureName(group, group.quantity),
|
|
26929
27386
|
")"
|
|
26930
|
-
] }) : /* @__PURE__ */
|
|
27387
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
26931
27388
|
group.quantity,
|
|
26932
27389
|
" ",
|
|
26933
27390
|
getFeatureName(group, group.quantity)
|
|
26934
27391
|
] }),
|
|
26935
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27392
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26936
27393
|
Text,
|
|
26937
27394
|
{
|
|
26938
27395
|
style: { opacity: 0.54 },
|
|
@@ -26950,7 +27407,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26950
27407
|
groupIndex
|
|
26951
27408
|
);
|
|
26952
27409
|
}) }),
|
|
26953
|
-
bundleCredits.canExpand && /* @__PURE__ */
|
|
27410
|
+
bundleCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26954
27411
|
ExpandListToggle,
|
|
26955
27412
|
{
|
|
26956
27413
|
isExpanded: bundleCredits.isExpanded,
|
|
@@ -26960,8 +27417,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26960
27417
|
}
|
|
26961
27418
|
)
|
|
26962
27419
|
] }),
|
|
26963
|
-
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */
|
|
26964
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27420
|
+
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27421
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26965
27422
|
Text,
|
|
26966
27423
|
{
|
|
26967
27424
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26969,8 +27426,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26969
27426
|
children: t4("Promotional credits")
|
|
26970
27427
|
}
|
|
26971
27428
|
),
|
|
26972
|
-
/* @__PURE__ */
|
|
26973
|
-
return /* @__PURE__ */
|
|
27429
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
|
|
27430
|
+
return /* @__PURE__ */ jsxs47(
|
|
26974
27431
|
Flex,
|
|
26975
27432
|
{
|
|
26976
27433
|
$justifyContent: "space-between",
|
|
@@ -26978,12 +27435,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26978
27435
|
$flexWrap: "wrap",
|
|
26979
27436
|
$gap: "0.5rem",
|
|
26980
27437
|
children: [
|
|
26981
|
-
/* @__PURE__ */
|
|
27438
|
+
/* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
26982
27439
|
group.quantity,
|
|
26983
27440
|
" ",
|
|
26984
27441
|
getFeatureName(group, group.quantity)
|
|
26985
27442
|
] }),
|
|
26986
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27443
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
26987
27444
|
Text,
|
|
26988
27445
|
{
|
|
26989
27446
|
style: { opacity: 0.54 },
|
|
@@ -27001,7 +27458,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27001
27458
|
groupIndex
|
|
27002
27459
|
);
|
|
27003
27460
|
}) }),
|
|
27004
|
-
promotionalCredits.canExpand && /* @__PURE__ */
|
|
27461
|
+
promotionalCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
27005
27462
|
ExpandListToggle,
|
|
27006
27463
|
{
|
|
27007
27464
|
isExpanded: promotionalCredits.isExpanded,
|
|
@@ -27011,7 +27468,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27011
27468
|
}
|
|
27012
27469
|
)
|
|
27013
27470
|
] }),
|
|
27014
|
-
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */
|
|
27471
|
+
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ jsx62(
|
|
27015
27472
|
Button,
|
|
27016
27473
|
{
|
|
27017
27474
|
type: "button",
|
|
@@ -27036,14 +27493,14 @@ import {
|
|
|
27036
27493
|
Fragment as Fragment29,
|
|
27037
27494
|
forwardRef as forwardRef15,
|
|
27038
27495
|
useCallback as useCallback16,
|
|
27039
|
-
useEffect as
|
|
27040
|
-
useMemo as
|
|
27041
|
-
useState as
|
|
27496
|
+
useEffect as useEffect9,
|
|
27497
|
+
useMemo as useMemo35,
|
|
27498
|
+
useState as useState22
|
|
27042
27499
|
} from "react";
|
|
27043
27500
|
|
|
27044
27501
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
27045
|
-
import { useMemo as
|
|
27046
|
-
import { Fragment as Fragment27, jsx as
|
|
27502
|
+
import { useMemo as useMemo34 } from "react";
|
|
27503
|
+
import { Fragment as Fragment27, jsx as jsx63, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
27047
27504
|
function renderMeteredEntitlementPricing2({
|
|
27048
27505
|
priceBehavior,
|
|
27049
27506
|
softLimit,
|
|
@@ -27055,7 +27512,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
27055
27512
|
isTiered
|
|
27056
27513
|
}) {
|
|
27057
27514
|
if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
|
|
27058
|
-
return /* @__PURE__ */
|
|
27515
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27059
27516
|
"Additional: ",
|
|
27060
27517
|
formatCurrency(price, currency),
|
|
27061
27518
|
"/",
|
|
@@ -27066,13 +27523,13 @@ function renderMeteredEntitlementPricing2({
|
|
|
27066
27523
|
] });
|
|
27067
27524
|
}
|
|
27068
27525
|
if (isTiered) {
|
|
27069
|
-
return /* @__PURE__ */
|
|
27526
|
+
return /* @__PURE__ */ jsx63(Fragment27, { children: "Tier-based pricing" });
|
|
27070
27527
|
}
|
|
27071
27528
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
|
|
27072
|
-
return /* @__PURE__ */
|
|
27529
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27073
27530
|
formatCurrency(price, currency),
|
|
27074
27531
|
"/",
|
|
27075
|
-
packageSize > 1 && /* @__PURE__ */
|
|
27532
|
+
packageSize > 1 && /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27076
27533
|
packageSize,
|
|
27077
27534
|
" "
|
|
27078
27535
|
] }),
|
|
@@ -27098,7 +27555,7 @@ var AddOn2 = ({
|
|
|
27098
27555
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
27099
27556
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
27100
27557
|
const isLightBackground = useIsLightBackground();
|
|
27101
|
-
const { currentAddOns, canCheckout, isStandalone } =
|
|
27558
|
+
const { currentAddOns, canCheckout, isStandalone } = useMemo34(() => {
|
|
27102
27559
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
27103
27560
|
return {
|
|
27104
27561
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -27141,7 +27598,7 @@ var AddOn2 = ({
|
|
|
27141
27598
|
isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
|
|
27142
27599
|
};
|
|
27143
27600
|
}) || [];
|
|
27144
|
-
return /* @__PURE__ */
|
|
27601
|
+
return /* @__PURE__ */ jsxs48(
|
|
27145
27602
|
Flex,
|
|
27146
27603
|
{
|
|
27147
27604
|
as: "li",
|
|
@@ -27161,7 +27618,7 @@ var AddOn2 = ({
|
|
|
27161
27618
|
$boxShadow: cardBoxShadow
|
|
27162
27619
|
},
|
|
27163
27620
|
children: [
|
|
27164
|
-
/* @__PURE__ */
|
|
27621
|
+
/* @__PURE__ */ jsxs48(
|
|
27165
27622
|
Flex,
|
|
27166
27623
|
{
|
|
27167
27624
|
$flexDirection: "column",
|
|
@@ -27172,7 +27629,7 @@ var AddOn2 = ({
|
|
|
27172
27629
|
$borderStyle: "solid",
|
|
27173
27630
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27174
27631
|
children: [
|
|
27175
|
-
/* @__PURE__ */
|
|
27632
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27176
27633
|
Text,
|
|
27177
27634
|
{
|
|
27178
27635
|
as: "h3",
|
|
@@ -27181,22 +27638,22 @@ var AddOn2 = ({
|
|
|
27181
27638
|
children: addOn.name
|
|
27182
27639
|
}
|
|
27183
27640
|
) }),
|
|
27184
|
-
layout.addOns.showDescription && /* @__PURE__ */
|
|
27185
|
-
/* @__PURE__ */
|
|
27641
|
+
layout.addOns.showDescription && /* @__PURE__ */ jsx63(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx63(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
27642
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27186
27643
|
Text,
|
|
27187
27644
|
{
|
|
27188
27645
|
"data-testid": "sch-addon-price",
|
|
27189
27646
|
display: layout.plans.name.fontStyle,
|
|
27190
|
-
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */
|
|
27647
|
+
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27191
27648
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
27192
|
-
/* @__PURE__ */
|
|
27649
|
+
/* @__PURE__ */ jsxs48("sub", { children: [
|
|
27193
27650
|
"/",
|
|
27194
27651
|
selectedPeriod
|
|
27195
27652
|
] })
|
|
27196
27653
|
] })
|
|
27197
27654
|
}
|
|
27198
27655
|
) }),
|
|
27199
|
-
isActiveAddOn && /* @__PURE__ */
|
|
27656
|
+
isActiveAddOn && /* @__PURE__ */ jsx63(
|
|
27200
27657
|
Flex,
|
|
27201
27658
|
{
|
|
27202
27659
|
"data-testid": "sch-addon-active",
|
|
@@ -27206,7 +27663,7 @@ var AddOn2 = ({
|
|
|
27206
27663
|
$backgroundColor: settings.theme.primary,
|
|
27207
27664
|
$borderRadius: "9999px",
|
|
27208
27665
|
$padding: "0.125rem 0.85rem",
|
|
27209
|
-
children: /* @__PURE__ */
|
|
27666
|
+
children: /* @__PURE__ */ jsx63(
|
|
27210
27667
|
Text,
|
|
27211
27668
|
{
|
|
27212
27669
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27219,7 +27676,7 @@ var AddOn2 = ({
|
|
|
27219
27676
|
]
|
|
27220
27677
|
}
|
|
27221
27678
|
),
|
|
27222
|
-
/* @__PURE__ */
|
|
27679
|
+
/* @__PURE__ */ jsxs48(
|
|
27223
27680
|
Flex,
|
|
27224
27681
|
{
|
|
27225
27682
|
$flexDirection: "column",
|
|
@@ -27228,7 +27685,7 @@ var AddOn2 = ({
|
|
|
27228
27685
|
$flexGrow: 1,
|
|
27229
27686
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27230
27687
|
children: [
|
|
27231
|
-
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */
|
|
27688
|
+
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ jsx63(
|
|
27232
27689
|
Flex,
|
|
27233
27690
|
{
|
|
27234
27691
|
as: "ul",
|
|
@@ -27240,7 +27697,7 @@ var AddOn2 = ({
|
|
|
27240
27697
|
$listStyle: "none",
|
|
27241
27698
|
children: displayableEntitlements.map((entitlement, idx) => {
|
|
27242
27699
|
if (entitlement.isUnlimited) {
|
|
27243
|
-
return /* @__PURE__ */
|
|
27700
|
+
return /* @__PURE__ */ jsxs48(
|
|
27244
27701
|
Flex,
|
|
27245
27702
|
{
|
|
27246
27703
|
as: "li",
|
|
@@ -27249,8 +27706,8 @@ var AddOn2 = ({
|
|
|
27249
27706
|
$alignItems: "center",
|
|
27250
27707
|
$gap: "1rem",
|
|
27251
27708
|
children: [
|
|
27252
|
-
/* @__PURE__ */
|
|
27253
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27709
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27710
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27254
27711
|
Icon3,
|
|
27255
27712
|
{
|
|
27256
27713
|
name: entitlement.feature.icon,
|
|
@@ -27259,16 +27716,16 @@ var AddOn2 = ({
|
|
|
27259
27716
|
rounded: true
|
|
27260
27717
|
}
|
|
27261
27718
|
),
|
|
27262
|
-
entitlement.feature && /* @__PURE__ */
|
|
27719
|
+
entitlement.feature && /* @__PURE__ */ jsx63(
|
|
27263
27720
|
Flex,
|
|
27264
27721
|
{
|
|
27265
27722
|
$flexDirection: "column",
|
|
27266
27723
|
$justifyContent: "center",
|
|
27267
|
-
children: /* @__PURE__ */
|
|
27724
|
+
children: /* @__PURE__ */ jsx63(Text, { children: getFeatureName(entitlement.feature) })
|
|
27268
27725
|
}
|
|
27269
27726
|
)
|
|
27270
27727
|
] }),
|
|
27271
|
-
/* @__PURE__ */
|
|
27728
|
+
/* @__PURE__ */ jsx63(
|
|
27272
27729
|
Text,
|
|
27273
27730
|
{
|
|
27274
27731
|
style: { opacity: 0.54 },
|
|
@@ -27283,7 +27740,7 @@ var AddOn2 = ({
|
|
|
27283
27740
|
);
|
|
27284
27741
|
}
|
|
27285
27742
|
const meteredEntitlement = entitlement;
|
|
27286
|
-
return /* @__PURE__ */
|
|
27743
|
+
return /* @__PURE__ */ jsxs48(
|
|
27287
27744
|
Flex,
|
|
27288
27745
|
{
|
|
27289
27746
|
as: "li",
|
|
@@ -27293,8 +27750,8 @@ var AddOn2 = ({
|
|
|
27293
27750
|
$gap: "1rem",
|
|
27294
27751
|
$listStyle: "none",
|
|
27295
27752
|
children: [
|
|
27296
|
-
/* @__PURE__ */
|
|
27297
|
-
meteredEntitlement.feature?.icon && /* @__PURE__ */
|
|
27753
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27754
|
+
meteredEntitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27298
27755
|
Icon3,
|
|
27299
27756
|
{
|
|
27300
27757
|
"data-testid": "sch-feature-icon",
|
|
@@ -27304,9 +27761,9 @@ var AddOn2 = ({
|
|
|
27304
27761
|
rounded: true
|
|
27305
27762
|
}
|
|
27306
27763
|
),
|
|
27307
|
-
/* @__PURE__ */
|
|
27764
|
+
/* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ jsx63(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
|
|
27308
27765
|
] }),
|
|
27309
|
-
/* @__PURE__ */
|
|
27766
|
+
/* @__PURE__ */ jsx63(
|
|
27310
27767
|
Text,
|
|
27311
27768
|
{
|
|
27312
27769
|
style: { opacity: 0.54 },
|
|
@@ -27322,7 +27779,7 @@ var AddOn2 = ({
|
|
|
27322
27779
|
})
|
|
27323
27780
|
}
|
|
27324
27781
|
),
|
|
27325
|
-
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27782
|
+
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ jsx63(
|
|
27326
27783
|
Button,
|
|
27327
27784
|
{
|
|
27328
27785
|
type: "button",
|
|
@@ -27361,10 +27818,10 @@ var AddOn2 = ({
|
|
|
27361
27818
|
};
|
|
27362
27819
|
|
|
27363
27820
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27364
|
-
import { useState as
|
|
27821
|
+
import { useState as useState21 } from "react";
|
|
27365
27822
|
|
|
27366
27823
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
27367
|
-
import { Fragment as Fragment28, jsx as
|
|
27824
|
+
import { Fragment as Fragment28, jsx as jsx64, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
27368
27825
|
var Entitlement2 = ({
|
|
27369
27826
|
entitlement,
|
|
27370
27827
|
sharedProps,
|
|
@@ -27398,8 +27855,8 @@ var Entitlement2 = ({
|
|
|
27398
27855
|
entitlement,
|
|
27399
27856
|
credits
|
|
27400
27857
|
);
|
|
27401
|
-
return /* @__PURE__ */
|
|
27402
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27858
|
+
return /* @__PURE__ */ jsxs49(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
|
|
27859
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx64(
|
|
27403
27860
|
Icon3,
|
|
27404
27861
|
{
|
|
27405
27862
|
"data-testid": "sch-feature-icon",
|
|
@@ -27409,31 +27866,31 @@ var Entitlement2 = ({
|
|
|
27409
27866
|
rounded: true
|
|
27410
27867
|
}
|
|
27411
27868
|
),
|
|
27412
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
27413
|
-
/* @__PURE__ */
|
|
27414
|
-
/* @__PURE__ */
|
|
27869
|
+
entitlement.feature?.name && /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27870
|
+
/* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
27871
|
+
/* @__PURE__ */ jsx64(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27415
27872
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27416
27873
|
" ",
|
|
27417
27874
|
t4("per"),
|
|
27418
27875
|
" ",
|
|
27419
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27876
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27420
27877
|
formatNumber(entitlementPackageSize),
|
|
27421
27878
|
" "
|
|
27422
27879
|
] }),
|
|
27423
27880
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
27424
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
27881
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27425
27882
|
" ",
|
|
27426
27883
|
t4("per"),
|
|
27427
27884
|
" ",
|
|
27428
27885
|
selectedPeriod
|
|
27429
27886
|
] })
|
|
27430
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */
|
|
27887
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ jsx64(
|
|
27431
27888
|
TieredPricingDetails,
|
|
27432
27889
|
{
|
|
27433
27890
|
entitlement,
|
|
27434
27891
|
period: selectedPeriod
|
|
27435
27892
|
}
|
|
27436
|
-
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */
|
|
27893
|
+
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27437
27894
|
formatConsumptionRate(entitlement.consumptionRate),
|
|
27438
27895
|
" ",
|
|
27439
27896
|
getFeatureName(
|
|
@@ -27444,7 +27901,7 @@ var Entitlement2 = ({
|
|
|
27444
27901
|
t4("per"),
|
|
27445
27902
|
" ",
|
|
27446
27903
|
getFeatureName(entitlement.feature, 1)
|
|
27447
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */
|
|
27904
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx64(Fragment28, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
|
|
27448
27905
|
amount: formatNumber(creditBasedEntitlementLimit.limit),
|
|
27449
27906
|
units: getFeatureName(
|
|
27450
27907
|
entitlement.feature,
|
|
@@ -27457,25 +27914,25 @@ var Entitlement2 = ({
|
|
|
27457
27914
|
entitlement.feature,
|
|
27458
27915
|
creditBasedEntitlementLimit.limit
|
|
27459
27916
|
)
|
|
27460
|
-
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */
|
|
27917
|
+
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27461
27918
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
|
|
27462
27919
|
item: getFeatureName(entitlement.feature)
|
|
27463
|
-
}) : /* @__PURE__ */
|
|
27464
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
27920
|
+
}) : /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27921
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27465
27922
|
formatNumber(limit),
|
|
27466
27923
|
" "
|
|
27467
27924
|
] }),
|
|
27468
27925
|
getFeatureName(entitlement.feature, limit)
|
|
27469
27926
|
] }),
|
|
27470
|
-
metricPeriodName && /* @__PURE__ */
|
|
27927
|
+
metricPeriodName && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27471
27928
|
" ",
|
|
27472
27929
|
t4("per"),
|
|
27473
27930
|
" ",
|
|
27474
27931
|
t4(metricPeriodName)
|
|
27475
27932
|
] })
|
|
27476
27933
|
] }) : entitlement.feature.name }),
|
|
27477
|
-
/* @__PURE__ */
|
|
27478
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */
|
|
27934
|
+
/* @__PURE__ */ jsxs49(Text, { children: [
|
|
27935
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsx64(Fragment28, { children: /* @__PURE__ */ jsxs49(
|
|
27479
27936
|
Text,
|
|
27480
27937
|
{
|
|
27481
27938
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27485,7 +27942,7 @@ var Entitlement2 = ({
|
|
|
27485
27942
|
" ",
|
|
27486
27943
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27487
27944
|
"/",
|
|
27488
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27945
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27489
27946
|
formatNumber(entitlementPackageSize),
|
|
27490
27947
|
" "
|
|
27491
27948
|
] }),
|
|
@@ -27493,14 +27950,14 @@ var Entitlement2 = ({
|
|
|
27493
27950
|
entitlement.feature,
|
|
27494
27951
|
entitlementPackageSize
|
|
27495
27952
|
),
|
|
27496
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
27953
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27497
27954
|
"/",
|
|
27498
27955
|
shortenPeriod(selectedPeriod)
|
|
27499
27956
|
] })
|
|
27500
27957
|
]
|
|
27501
27958
|
}
|
|
27502
|
-
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */
|
|
27503
|
-
/* @__PURE__ */
|
|
27959
|
+
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27960
|
+
/* @__PURE__ */ jsx64(
|
|
27504
27961
|
Text,
|
|
27505
27962
|
{
|
|
27506
27963
|
style: { opacity: 0.54 },
|
|
@@ -27509,7 +27966,7 @@ var Entitlement2 = ({
|
|
|
27509
27966
|
children: t4("Tier-based")
|
|
27510
27967
|
}
|
|
27511
27968
|
),
|
|
27512
|
-
/* @__PURE__ */
|
|
27969
|
+
/* @__PURE__ */ jsx64(
|
|
27513
27970
|
PricingTiersTooltip,
|
|
27514
27971
|
{
|
|
27515
27972
|
feature: entitlement.feature,
|
|
@@ -27520,14 +27977,14 @@ var Entitlement2 = ({
|
|
|
27520
27977
|
}
|
|
27521
27978
|
)
|
|
27522
27979
|
] }),
|
|
27523
|
-
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
27980
|
+
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx64(
|
|
27524
27981
|
HardLimitTooltip,
|
|
27525
27982
|
{
|
|
27526
27983
|
feature: entitlement.feature,
|
|
27527
27984
|
limit: entitlement.valueNumeric
|
|
27528
27985
|
}
|
|
27529
27986
|
),
|
|
27530
|
-
entitlement.billingThreshold && /* @__PURE__ */
|
|
27987
|
+
entitlement.billingThreshold && /* @__PURE__ */ jsx64(
|
|
27531
27988
|
BillingThresholdTooltip,
|
|
27532
27989
|
{
|
|
27533
27990
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -27535,7 +27992,7 @@ var Entitlement2 = ({
|
|
|
27535
27992
|
)
|
|
27536
27993
|
] })
|
|
27537
27994
|
] }),
|
|
27538
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */
|
|
27995
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx64(
|
|
27539
27996
|
Text,
|
|
27540
27997
|
{
|
|
27541
27998
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27548,7 +28005,7 @@ var Entitlement2 = ({
|
|
|
27548
28005
|
};
|
|
27549
28006
|
|
|
27550
28007
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27551
|
-
import { jsx as
|
|
28008
|
+
import { jsx as jsx65, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
27552
28009
|
var Plan2 = ({
|
|
27553
28010
|
plan,
|
|
27554
28011
|
index,
|
|
@@ -27562,7 +28019,7 @@ var Plan2 = ({
|
|
|
27562
28019
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
27563
28020
|
const isLightBackground = useIsLightBackground();
|
|
27564
28021
|
const trialEnd = useTrialEnd();
|
|
27565
|
-
const [entitlementVisibility, setEntitlementVisibility] =
|
|
28022
|
+
const [entitlementVisibility, setEntitlementVisibility] = useState21({});
|
|
27566
28023
|
const handleToggleShowAll = (id) => {
|
|
27567
28024
|
setEntitlementVisibility((prev2) => {
|
|
27568
28025
|
const updated = !(prev2[id] ?? false);
|
|
@@ -27591,7 +28048,7 @@ var Plan2 = ({
|
|
|
27591
28048
|
const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
|
|
27592
28049
|
const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
|
|
27593
28050
|
const isExpanded = entitlementVisibility[plan.id] ?? false;
|
|
27594
|
-
return /* @__PURE__ */
|
|
28051
|
+
return /* @__PURE__ */ jsxs50(
|
|
27595
28052
|
Flex,
|
|
27596
28053
|
{
|
|
27597
28054
|
as: "li",
|
|
@@ -27611,7 +28068,7 @@ var Plan2 = ({
|
|
|
27611
28068
|
$boxShadow: cardBoxShadow
|
|
27612
28069
|
},
|
|
27613
28070
|
children: [
|
|
27614
|
-
/* @__PURE__ */
|
|
28071
|
+
/* @__PURE__ */ jsxs50(
|
|
27615
28072
|
Flex,
|
|
27616
28073
|
{
|
|
27617
28074
|
$flexDirection: "column",
|
|
@@ -27622,7 +28079,7 @@ var Plan2 = ({
|
|
|
27622
28079
|
$borderStyle: "solid",
|
|
27623
28080
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27624
28081
|
children: [
|
|
27625
|
-
/* @__PURE__ */
|
|
28082
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsx65(
|
|
27626
28083
|
Text,
|
|
27627
28084
|
{
|
|
27628
28085
|
as: "h3",
|
|
@@ -27631,8 +28088,8 @@ var Plan2 = ({
|
|
|
27631
28088
|
children: plan.name
|
|
27632
28089
|
}
|
|
27633
28090
|
) }),
|
|
27634
|
-
layout.plans.description.isVisible && /* @__PURE__ */
|
|
27635
|
-
/* @__PURE__ */
|
|
28091
|
+
layout.plans.description.isVisible && /* @__PURE__ */ jsx65(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx65(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
28092
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsxs50(
|
|
27636
28093
|
Text,
|
|
27637
28094
|
{
|
|
27638
28095
|
"data-testid": "sch-plan-price",
|
|
@@ -27648,14 +28105,14 @@ var Plan2 = ({
|
|
|
27648
28105
|
currency: planCurrency,
|
|
27649
28106
|
testSignificantDigits: false
|
|
27650
28107
|
}) : formatCurrency(planPrice ?? 0, planCurrency),
|
|
27651
|
-
!plan.custom && !isFreePlan && /* @__PURE__ */
|
|
28108
|
+
!plan.custom && !isFreePlan && /* @__PURE__ */ jsxs50("sub", { children: [
|
|
27652
28109
|
"/",
|
|
27653
28110
|
showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
|
|
27654
28111
|
] })
|
|
27655
28112
|
]
|
|
27656
28113
|
}
|
|
27657
28114
|
) }),
|
|
27658
|
-
showCredits && credits.length > 0 && /* @__PURE__ */
|
|
28115
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ jsx65(
|
|
27659
28116
|
Flex,
|
|
27660
28117
|
{
|
|
27661
28118
|
as: "ul",
|
|
@@ -27667,8 +28124,8 @@ var Plan2 = ({
|
|
|
27667
28124
|
$margin: 0,
|
|
27668
28125
|
$listStyle: "none",
|
|
27669
28126
|
children: credits.map((credit, idx) => {
|
|
27670
|
-
return /* @__PURE__ */
|
|
27671
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */
|
|
28127
|
+
return /* @__PURE__ */ jsxs50(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
|
|
28128
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx65(
|
|
27672
28129
|
Icon3,
|
|
27673
28130
|
{
|
|
27674
28131
|
"data-testid": "sch-feature-icon",
|
|
@@ -27678,13 +28135,13 @@ var Plan2 = ({
|
|
|
27678
28135
|
rounded: true
|
|
27679
28136
|
}
|
|
27680
28137
|
),
|
|
27681
|
-
credit.name && /* @__PURE__ */
|
|
28138
|
+
credit.name && /* @__PURE__ */ jsx65(
|
|
27682
28139
|
Flex,
|
|
27683
28140
|
{
|
|
27684
28141
|
$flexDirection: "column",
|
|
27685
28142
|
$justifyContent: "center",
|
|
27686
28143
|
$gap: "0.5rem",
|
|
27687
|
-
children: /* @__PURE__ */
|
|
28144
|
+
children: /* @__PURE__ */ jsx65(
|
|
27688
28145
|
PlanCreditText,
|
|
27689
28146
|
{
|
|
27690
28147
|
credit,
|
|
@@ -27697,7 +28154,7 @@ var Plan2 = ({
|
|
|
27697
28154
|
})
|
|
27698
28155
|
}
|
|
27699
28156
|
),
|
|
27700
|
-
isActivePlan && /* @__PURE__ */
|
|
28157
|
+
isActivePlan && /* @__PURE__ */ jsx65(
|
|
27701
28158
|
Flex,
|
|
27702
28159
|
{
|
|
27703
28160
|
"data-testid": "sch-plan-active",
|
|
@@ -27707,7 +28164,7 @@ var Plan2 = ({
|
|
|
27707
28164
|
$backgroundColor: settings.theme.primary,
|
|
27708
28165
|
$borderRadius: "9999px",
|
|
27709
28166
|
$padding: "0.125rem 0.85rem",
|
|
27710
|
-
children: /* @__PURE__ */
|
|
28167
|
+
children: /* @__PURE__ */ jsx65(
|
|
27711
28168
|
Text,
|
|
27712
28169
|
{
|
|
27713
28170
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27720,7 +28177,7 @@ var Plan2 = ({
|
|
|
27720
28177
|
]
|
|
27721
28178
|
}
|
|
27722
28179
|
),
|
|
27723
|
-
/* @__PURE__ */
|
|
28180
|
+
/* @__PURE__ */ jsxs50(
|
|
27724
28181
|
Flex,
|
|
27725
28182
|
{
|
|
27726
28183
|
$flexDirection: "column",
|
|
@@ -27729,7 +28186,7 @@ var Plan2 = ({
|
|
|
27729
28186
|
$gap: `${cardPadding}rem`,
|
|
27730
28187
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27731
28188
|
children: [
|
|
27732
|
-
layout.plans.showEntitlements && /* @__PURE__ */
|
|
28189
|
+
layout.plans.showEntitlements && /* @__PURE__ */ jsxs50(
|
|
27733
28190
|
Flex,
|
|
27734
28191
|
{
|
|
27735
28192
|
as: "ul",
|
|
@@ -27740,14 +28197,14 @@ var Plan2 = ({
|
|
|
27740
28197
|
$margin: 0,
|
|
27741
28198
|
$listStyle: "none",
|
|
27742
28199
|
children: [
|
|
27743
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */
|
|
28200
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx65(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx65(Text, { children: t4("Everything in", {
|
|
27744
28201
|
plan: plans[index - 1].name
|
|
27745
28202
|
}) }) }),
|
|
27746
28203
|
(plan.entitlements ?? []).reduce(
|
|
27747
28204
|
(acc, entitlement, idx) => {
|
|
27748
28205
|
if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
|
|
27749
28206
|
acc.push(
|
|
27750
|
-
/* @__PURE__ */
|
|
28207
|
+
/* @__PURE__ */ jsx65(
|
|
27751
28208
|
Entitlement2,
|
|
27752
28209
|
{
|
|
27753
28210
|
entitlement,
|
|
@@ -27765,7 +28222,7 @@ var Plan2 = ({
|
|
|
27765
28222
|
},
|
|
27766
28223
|
[]
|
|
27767
28224
|
),
|
|
27768
|
-
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */
|
|
28225
|
+
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsx65(
|
|
27769
28226
|
ExpandListToggle,
|
|
27770
28227
|
{
|
|
27771
28228
|
as: "li",
|
|
@@ -27780,7 +28237,7 @@ var Plan2 = ({
|
|
|
27780
28237
|
]
|
|
27781
28238
|
}
|
|
27782
28239
|
),
|
|
27783
|
-
isActivePlan ? /* @__PURE__ */
|
|
28240
|
+
isActivePlan ? /* @__PURE__ */ jsxs50(
|
|
27784
28241
|
Flex,
|
|
27785
28242
|
{
|
|
27786
28243
|
$justifyContent: "center",
|
|
@@ -27788,7 +28245,7 @@ var Plan2 = ({
|
|
|
27788
28245
|
$gap: "0.25rem",
|
|
27789
28246
|
$padding: "0.625rem 0",
|
|
27790
28247
|
children: [
|
|
27791
|
-
/* @__PURE__ */
|
|
28248
|
+
/* @__PURE__ */ jsx65(
|
|
27792
28249
|
Icon3,
|
|
27793
28250
|
{
|
|
27794
28251
|
name: "check-rounded",
|
|
@@ -27796,11 +28253,11 @@ var Plan2 = ({
|
|
|
27796
28253
|
color: settings.theme.primary
|
|
27797
28254
|
}
|
|
27798
28255
|
),
|
|
27799
|
-
/* @__PURE__ */
|
|
28256
|
+
/* @__PURE__ */ jsx65(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
|
|
27800
28257
|
]
|
|
27801
28258
|
}
|
|
27802
|
-
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27803
|
-
/* @__PURE__ */
|
|
28259
|
+
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs50(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28260
|
+
/* @__PURE__ */ jsx65(
|
|
27804
28261
|
Button,
|
|
27805
28262
|
{
|
|
27806
28263
|
type: "button",
|
|
@@ -27838,10 +28295,10 @@ var Plan2 = ({
|
|
|
27838
28295
|
}
|
|
27839
28296
|
},
|
|
27840
28297
|
$fullWidth: true,
|
|
27841
|
-
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */
|
|
28298
|
+
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")
|
|
27842
28299
|
}
|
|
27843
28300
|
),
|
|
27844
|
-
!plan.valid && /* @__PURE__ */
|
|
28301
|
+
!plan.valid && /* @__PURE__ */ jsx65(UsageViolationText, { violations: plan.usageViolations })
|
|
27845
28302
|
] })
|
|
27846
28303
|
]
|
|
27847
28304
|
}
|
|
@@ -27852,7 +28309,7 @@ var Plan2 = ({
|
|
|
27852
28309
|
};
|
|
27853
28310
|
|
|
27854
28311
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
27855
|
-
import { Fragment as Fragment30, jsx as
|
|
28312
|
+
import { Fragment as Fragment30, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
27856
28313
|
var resolveDesignProps8 = (props) => {
|
|
27857
28314
|
return {
|
|
27858
28315
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -27917,11 +28374,11 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27917
28374
|
},
|
|
27918
28375
|
[]
|
|
27919
28376
|
);
|
|
27920
|
-
const [selectedPeriod, setSelectedPeriod] =
|
|
28377
|
+
const [selectedPeriod, setSelectedPeriod] = useState22(
|
|
27921
28378
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
|
|
27922
28379
|
);
|
|
27923
28380
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
27924
|
-
const [selectedCurrency, setSelectedCurrency] =
|
|
28381
|
+
const [selectedCurrency, setSelectedCurrency] = useState22(
|
|
27925
28382
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
27926
28383
|
);
|
|
27927
28384
|
if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
|
|
@@ -27939,25 +28396,25 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27939
28396
|
} = useAvailablePlans(selectedPeriod, {
|
|
27940
28397
|
useSelectedPeriod: showPeriodToggle
|
|
27941
28398
|
});
|
|
27942
|
-
const plans =
|
|
28399
|
+
const plans = useMemo35(
|
|
27943
28400
|
() => hasCurrency ? allPlans.filter(
|
|
27944
28401
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
27945
28402
|
) : allPlans,
|
|
27946
28403
|
[allPlans, hasCurrency, selectedCurrency]
|
|
27947
28404
|
);
|
|
27948
|
-
const addOns =
|
|
28405
|
+
const addOns = useMemo35(
|
|
27949
28406
|
() => hasCurrency ? allAddOns.filter(
|
|
27950
28407
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
27951
28408
|
) : allAddOns,
|
|
27952
28409
|
[allAddOns, hasCurrency, selectedCurrency]
|
|
27953
28410
|
);
|
|
27954
|
-
|
|
28411
|
+
useEffect9(() => {
|
|
27955
28412
|
if (typeof data?.component === "undefined") {
|
|
27956
28413
|
hydratePublic();
|
|
27957
28414
|
}
|
|
27958
28415
|
}, [data?.component, hydratePublic]);
|
|
27959
28416
|
if (isPending) {
|
|
27960
|
-
return /* @__PURE__ */
|
|
28417
|
+
return /* @__PURE__ */ jsx66(
|
|
27961
28418
|
Flex,
|
|
27962
28419
|
{
|
|
27963
28420
|
$width: "100%",
|
|
@@ -27965,12 +28422,12 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27965
28422
|
$alignItems: "center",
|
|
27966
28423
|
$justifyContent: "center",
|
|
27967
28424
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
27968
|
-
children: /* @__PURE__ */
|
|
28425
|
+
children: /* @__PURE__ */ jsx66(Loader, { "aria-label": "loading", $size: "2xl" })
|
|
27969
28426
|
}
|
|
27970
28427
|
);
|
|
27971
28428
|
}
|
|
27972
28429
|
if (hasNoUsableCurrency) {
|
|
27973
|
-
return /* @__PURE__ */
|
|
28430
|
+
return /* @__PURE__ */ jsx66(Container, { children: /* @__PURE__ */ jsx66(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ jsx66(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
|
|
27974
28431
|
}
|
|
27975
28432
|
const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
|
|
27976
28433
|
const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
|
|
@@ -27979,7 +28436,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27979
28436
|
rest.callToActionTarget
|
|
27980
28437
|
);
|
|
27981
28438
|
const Wrapper = typeof data?.component === "undefined" ? Container : Fragment29;
|
|
27982
|
-
return /* @__PURE__ */
|
|
28439
|
+
return /* @__PURE__ */ jsx66(Wrapper, { children: /* @__PURE__ */ jsxs51(
|
|
27983
28440
|
FussyChild,
|
|
27984
28441
|
{
|
|
27985
28442
|
ref,
|
|
@@ -27989,8 +28446,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
27989
28446
|
$flexDirection: "column",
|
|
27990
28447
|
$gap: "2rem",
|
|
27991
28448
|
children: [
|
|
27992
|
-
/* @__PURE__ */
|
|
27993
|
-
/* @__PURE__ */
|
|
28449
|
+
/* @__PURE__ */ jsxs51(Box, { children: [
|
|
28450
|
+
/* @__PURE__ */ jsxs51(
|
|
27994
28451
|
Flex,
|
|
27995
28452
|
{
|
|
27996
28453
|
$flexDirection: "column",
|
|
@@ -28005,7 +28462,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28005
28462
|
}
|
|
28006
28463
|
},
|
|
28007
28464
|
children: [
|
|
28008
|
-
/* @__PURE__ */
|
|
28465
|
+
/* @__PURE__ */ jsx66(
|
|
28009
28466
|
Text,
|
|
28010
28467
|
{
|
|
28011
28468
|
as: "h2",
|
|
@@ -28014,8 +28471,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28014
28471
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
|
|
28015
28472
|
}
|
|
28016
28473
|
),
|
|
28017
|
-
/* @__PURE__ */
|
|
28018
|
-
showCurrencySelector && /* @__PURE__ */
|
|
28474
|
+
/* @__PURE__ */ jsxs51(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
|
|
28475
|
+
showCurrencySelector && /* @__PURE__ */ jsx66(
|
|
28019
28476
|
CurrencyToggle,
|
|
28020
28477
|
{
|
|
28021
28478
|
currencies,
|
|
@@ -28023,7 +28480,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28023
28480
|
onSelect: setSelectedCurrency
|
|
28024
28481
|
}
|
|
28025
28482
|
),
|
|
28026
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */
|
|
28483
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx66(
|
|
28027
28484
|
PeriodToggle,
|
|
28028
28485
|
{
|
|
28029
28486
|
options: periods,
|
|
@@ -28040,7 +28497,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28040
28497
|
]
|
|
28041
28498
|
}
|
|
28042
28499
|
),
|
|
28043
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */
|
|
28500
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx66(
|
|
28044
28501
|
Box,
|
|
28045
28502
|
{
|
|
28046
28503
|
as: "ul",
|
|
@@ -28053,7 +28510,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28053
28510
|
$listStyle: "none",
|
|
28054
28511
|
children: plans.map((plan, index, self2) => {
|
|
28055
28512
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28056
|
-
return /* @__PURE__ */
|
|
28513
|
+
return /* @__PURE__ */ jsx66(
|
|
28057
28514
|
Plan2,
|
|
28058
28515
|
{
|
|
28059
28516
|
plan,
|
|
@@ -28075,14 +28532,14 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28075
28532
|
}
|
|
28076
28533
|
)
|
|
28077
28534
|
] }),
|
|
28078
|
-
/* @__PURE__ */
|
|
28079
|
-
props.header.isVisible && /* @__PURE__ */
|
|
28535
|
+
/* @__PURE__ */ jsx66(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs51(Fragment30, { children: [
|
|
28536
|
+
props.header.isVisible && /* @__PURE__ */ jsx66(
|
|
28080
28537
|
Flex,
|
|
28081
28538
|
{
|
|
28082
28539
|
$justifyContent: "space-between",
|
|
28083
28540
|
$alignItems: "center",
|
|
28084
28541
|
$marginBottom: "1rem",
|
|
28085
|
-
children: /* @__PURE__ */
|
|
28542
|
+
children: /* @__PURE__ */ jsx66(
|
|
28086
28543
|
Text,
|
|
28087
28544
|
{
|
|
28088
28545
|
as: "h2",
|
|
@@ -28093,7 +28550,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28093
28550
|
)
|
|
28094
28551
|
}
|
|
28095
28552
|
),
|
|
28096
|
-
/* @__PURE__ */
|
|
28553
|
+
/* @__PURE__ */ jsx66(
|
|
28097
28554
|
Box,
|
|
28098
28555
|
{
|
|
28099
28556
|
as: "ul",
|
|
@@ -28105,7 +28562,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28105
28562
|
$listStyle: "none",
|
|
28106
28563
|
children: addOns.map((addOn, index) => {
|
|
28107
28564
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28108
|
-
return /* @__PURE__ */
|
|
28565
|
+
return /* @__PURE__ */ jsx66(
|
|
28109
28566
|
AddOn2,
|
|
28110
28567
|
{
|
|
28111
28568
|
addOn,
|
|
@@ -28133,7 +28590,7 @@ PricingTable.displayName = "PricingTable";
|
|
|
28133
28590
|
|
|
28134
28591
|
// src/components/elements/text/Text.tsx
|
|
28135
28592
|
import { forwardRef as forwardRef16 } from "react";
|
|
28136
|
-
import { jsx as
|
|
28593
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
28137
28594
|
var resolveDesignProps9 = (props) => {
|
|
28138
28595
|
return {
|
|
28139
28596
|
text: {
|
|
@@ -28145,7 +28602,7 @@ var resolveDesignProps9 = (props) => {
|
|
|
28145
28602
|
};
|
|
28146
28603
|
var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
28147
28604
|
const props = resolveDesignProps9(rest);
|
|
28148
|
-
return /* @__PURE__ */
|
|
28605
|
+
return /* @__PURE__ */ jsx67(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx67(
|
|
28149
28606
|
Text,
|
|
28150
28607
|
{
|
|
28151
28608
|
display: props.text.fontStyle,
|
|
@@ -28158,8 +28615,8 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
|
28158
28615
|
TextElement.displayName = "Text";
|
|
28159
28616
|
|
|
28160
28617
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28161
|
-
import { forwardRef as forwardRef17, useMemo as
|
|
28162
|
-
import { jsx as
|
|
28618
|
+
import { forwardRef as forwardRef17, useMemo as useMemo36 } from "react";
|
|
28619
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
28163
28620
|
var buttonStyles = {
|
|
28164
28621
|
primary: {
|
|
28165
28622
|
color: "primary",
|
|
@@ -28189,13 +28646,13 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28189
28646
|
const props = resolveDesignProps10(rest);
|
|
28190
28647
|
const { t: t4 } = useTranslation();
|
|
28191
28648
|
const { data, setLayout } = useEmbed();
|
|
28192
|
-
const hasActiveSubscription =
|
|
28649
|
+
const hasActiveSubscription = useMemo36(() => {
|
|
28193
28650
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28194
28651
|
}, [data?.subscription]);
|
|
28195
28652
|
if (!hasActiveSubscription) {
|
|
28196
28653
|
return null;
|
|
28197
28654
|
}
|
|
28198
|
-
return /* @__PURE__ */
|
|
28655
|
+
return /* @__PURE__ */ jsx68(
|
|
28199
28656
|
Element,
|
|
28200
28657
|
{
|
|
28201
28658
|
as: Flex,
|
|
@@ -28203,7 +28660,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28203
28660
|
className,
|
|
28204
28661
|
$flexDirection: "column",
|
|
28205
28662
|
$gap: "2rem",
|
|
28206
|
-
children: /* @__PURE__ */
|
|
28663
|
+
children: /* @__PURE__ */ jsx68(
|
|
28207
28664
|
Button,
|
|
28208
28665
|
{
|
|
28209
28666
|
type: "button",
|
|
@@ -28224,8 +28681,8 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28224
28681
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
28225
28682
|
|
|
28226
28683
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
28227
|
-
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as
|
|
28228
|
-
import { jsx as
|
|
28684
|
+
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo37, useState as useState23 } from "react";
|
|
28685
|
+
import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
28229
28686
|
function resolveDesignProps11(props) {
|
|
28230
28687
|
return {
|
|
28231
28688
|
header: {
|
|
@@ -28249,10 +28706,10 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28249
28706
|
const { t: t4 } = useTranslation();
|
|
28250
28707
|
const { data, settings, getUpcomingInvoice } = useEmbed();
|
|
28251
28708
|
const isLightBackground = useIsLightBackground();
|
|
28252
|
-
const [isLoading, setIsLoading] =
|
|
28253
|
-
const [error, setError] =
|
|
28254
|
-
const [upcomingInvoice, setUpcomingInvoice] =
|
|
28255
|
-
const discounts =
|
|
28709
|
+
const [isLoading, setIsLoading] = useState23(false);
|
|
28710
|
+
const [error, setError] = useState23();
|
|
28711
|
+
const [upcomingInvoice, setUpcomingInvoice] = useState23(data?.upcomingInvoice);
|
|
28712
|
+
const discounts = useMemo37(() => {
|
|
28256
28713
|
return (data?.subscription?.discounts || []).filter(
|
|
28257
28714
|
(discount) => (
|
|
28258
28715
|
// Only surface discounts that are currently active and actually
|
|
@@ -28286,15 +28743,15 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28286
28743
|
}
|
|
28287
28744
|
}
|
|
28288
28745
|
}, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
|
|
28289
|
-
|
|
28746
|
+
useEffect10(() => {
|
|
28290
28747
|
getInvoice();
|
|
28291
28748
|
}, [getInvoice]);
|
|
28292
|
-
|
|
28749
|
+
useEffect10(() => {
|
|
28293
28750
|
if (data?.upcomingInvoice) {
|
|
28294
28751
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
28295
28752
|
}
|
|
28296
28753
|
}, [data?.upcomingInvoice]);
|
|
28297
|
-
const { currency, applied, remaining } =
|
|
28754
|
+
const { currency, applied, remaining } = useMemo37(() => {
|
|
28298
28755
|
const currency2 = upcomingInvoice?.currency;
|
|
28299
28756
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
28300
28757
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -28313,9 +28770,9 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28313
28770
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
28314
28771
|
return null;
|
|
28315
28772
|
}
|
|
28316
|
-
return /* @__PURE__ */
|
|
28317
|
-
/* @__PURE__ */
|
|
28318
|
-
error ? /* @__PURE__ */
|
|
28773
|
+
return /* @__PURE__ */ jsxs52(Element, { ref, className, children: [
|
|
28774
|
+
/* @__PURE__ */ jsx69(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx69(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
28775
|
+
error ? /* @__PURE__ */ jsxs52(
|
|
28319
28776
|
Flex,
|
|
28320
28777
|
{
|
|
28321
28778
|
as: TransitionBox,
|
|
@@ -28324,8 +28781,8 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28324
28781
|
$alignItems: "center",
|
|
28325
28782
|
$gap: "1rem",
|
|
28326
28783
|
children: [
|
|
28327
|
-
/* @__PURE__ */
|
|
28328
|
-
/* @__PURE__ */
|
|
28784
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
|
|
28785
|
+
/* @__PURE__ */ jsx69(
|
|
28329
28786
|
Button,
|
|
28330
28787
|
{
|
|
28331
28788
|
type: "button",
|
|
@@ -28338,28 +28795,28 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28338
28795
|
)
|
|
28339
28796
|
]
|
|
28340
28797
|
}
|
|
28341
|
-
) : !isLoading && /* @__PURE__ */
|
|
28342
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */
|
|
28798
|
+
) : !isLoading && /* @__PURE__ */ jsx69(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
28799
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
|
|
28343
28800
|
props.header.prefix,
|
|
28344
28801
|
" ",
|
|
28345
28802
|
toPrettyDate(upcomingInvoice.dueDate)
|
|
28346
28803
|
] }),
|
|
28347
|
-
/* @__PURE__ */
|
|
28804
|
+
/* @__PURE__ */ jsxs52(
|
|
28348
28805
|
Flex,
|
|
28349
28806
|
{
|
|
28350
28807
|
$justifyContent: "space-between",
|
|
28351
28808
|
$alignItems: "start",
|
|
28352
28809
|
$gap: "1rem",
|
|
28353
28810
|
children: [
|
|
28354
|
-
props.price.isVisible && /* @__PURE__ */
|
|
28811
|
+
props.price.isVisible && /* @__PURE__ */ jsx69(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
|
|
28355
28812
|
upcomingInvoice.amountDue,
|
|
28356
28813
|
upcomingInvoice.currency
|
|
28357
28814
|
) }),
|
|
28358
|
-
/* @__PURE__ */
|
|
28815
|
+
/* @__PURE__ */ jsx69(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx69(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
|
|
28359
28816
|
]
|
|
28360
28817
|
}
|
|
28361
28818
|
),
|
|
28362
|
-
hasApplied && /* @__PURE__ */
|
|
28819
|
+
hasApplied && /* @__PURE__ */ jsxs52(
|
|
28363
28820
|
Flex,
|
|
28364
28821
|
{
|
|
28365
28822
|
as: TransitionBox,
|
|
@@ -28367,12 +28824,12 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28367
28824
|
$alignItems: "start",
|
|
28368
28825
|
$gap: "1rem",
|
|
28369
28826
|
children: [
|
|
28370
|
-
/* @__PURE__ */
|
|
28371
|
-
/* @__PURE__ */
|
|
28827
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
|
|
28828
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(-applied, currency) })
|
|
28372
28829
|
]
|
|
28373
28830
|
}
|
|
28374
28831
|
),
|
|
28375
|
-
hasBalance && /* @__PURE__ */
|
|
28832
|
+
hasBalance && /* @__PURE__ */ jsxs52(
|
|
28376
28833
|
Flex,
|
|
28377
28834
|
{
|
|
28378
28835
|
as: TransitionBox,
|
|
@@ -28380,20 +28837,20 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28380
28837
|
$alignItems: "start",
|
|
28381
28838
|
$gap: "1rem",
|
|
28382
28839
|
children: [
|
|
28383
|
-
/* @__PURE__ */
|
|
28384
|
-
/* @__PURE__ */
|
|
28840
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
|
|
28841
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(remaining, currency) })
|
|
28385
28842
|
]
|
|
28386
28843
|
}
|
|
28387
28844
|
),
|
|
28388
|
-
discounts.length > 0 && /* @__PURE__ */
|
|
28845
|
+
discounts.length > 0 && /* @__PURE__ */ jsxs52(
|
|
28389
28846
|
Flex,
|
|
28390
28847
|
{
|
|
28391
28848
|
$justifyContent: "space-between",
|
|
28392
28849
|
$alignItems: "start",
|
|
28393
28850
|
$gap: "1rem",
|
|
28394
28851
|
children: [
|
|
28395
|
-
/* @__PURE__ */
|
|
28396
|
-
/* @__PURE__ */
|
|
28852
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Discount") }),
|
|
28853
|
+
/* @__PURE__ */ jsx69(
|
|
28397
28854
|
Flex,
|
|
28398
28855
|
{
|
|
28399
28856
|
$flexDirection: "column",
|
|
@@ -28409,13 +28866,13 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28409
28866
|
discount?.currency
|
|
28410
28867
|
)
|
|
28411
28868
|
});
|
|
28412
|
-
return /* @__PURE__ */
|
|
28869
|
+
return /* @__PURE__ */ jsxs52(
|
|
28413
28870
|
Flex,
|
|
28414
28871
|
{
|
|
28415
28872
|
$alignItems: "center",
|
|
28416
28873
|
$gap: "0.5rem",
|
|
28417
28874
|
children: [
|
|
28418
|
-
discount.customerFacingCode && /* @__PURE__ */
|
|
28875
|
+
discount.customerFacingCode && /* @__PURE__ */ jsx69(
|
|
28419
28876
|
Flex,
|
|
28420
28877
|
{
|
|
28421
28878
|
$alignItems: "center",
|
|
@@ -28424,7 +28881,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28424
28881
|
$borderStyle: "solid",
|
|
28425
28882
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
28426
28883
|
$borderRadius: "0.3125rem",
|
|
28427
|
-
children: /* @__PURE__ */
|
|
28884
|
+
children: /* @__PURE__ */ jsx69(
|
|
28428
28885
|
Text,
|
|
28429
28886
|
{
|
|
28430
28887
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28434,7 +28891,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28434
28891
|
)
|
|
28435
28892
|
}
|
|
28436
28893
|
),
|
|
28437
|
-
/* @__PURE__ */
|
|
28894
|
+
/* @__PURE__ */ jsx69(Box, { children: /* @__PURE__ */ jsx69(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
|
|
28438
28895
|
discount: label,
|
|
28439
28896
|
count: discount.durationInMonths
|
|
28440
28897
|
}) : label }) })
|
|
@@ -28448,7 +28905,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28448
28905
|
]
|
|
28449
28906
|
}
|
|
28450
28907
|
)
|
|
28451
|
-
] }) : /* @__PURE__ */
|
|
28908
|
+
] }) : /* @__PURE__ */ jsx69(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
|
|
28452
28909
|
] });
|
|
28453
28910
|
});
|
|
28454
28911
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -31084,7 +31541,7 @@ function inflate(input, options = {}) {
|
|
|
31084
31541
|
}
|
|
31085
31542
|
|
|
31086
31543
|
// src/components/embed/Embed.tsx
|
|
31087
|
-
import { useContext as useContext6, useEffect as
|
|
31544
|
+
import { useContext as useContext6, useEffect as useEffect11, useMemo as useMemo38 } from "react";
|
|
31088
31545
|
|
|
31089
31546
|
// src/components/embed/renderer.ts
|
|
31090
31547
|
import { createElement as createElement5 } from "react";
|
|
@@ -31164,11 +31621,11 @@ function createRenderer(options) {
|
|
|
31164
31621
|
}
|
|
31165
31622
|
|
|
31166
31623
|
// src/components/embed/Embed.tsx
|
|
31167
|
-
import { jsx as
|
|
31624
|
+
import { jsx as jsx70, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
31168
31625
|
var renderer = createRenderer();
|
|
31169
31626
|
var Loading = () => {
|
|
31170
31627
|
const { settings } = useEmbed();
|
|
31171
|
-
return /* @__PURE__ */
|
|
31628
|
+
return /* @__PURE__ */ jsx70(
|
|
31172
31629
|
Flex,
|
|
31173
31630
|
{
|
|
31174
31631
|
$width: "100%",
|
|
@@ -31176,13 +31633,13 @@ var Loading = () => {
|
|
|
31176
31633
|
$alignItems: "center",
|
|
31177
31634
|
$justifyContent: "center",
|
|
31178
31635
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
31179
|
-
children: /* @__PURE__ */
|
|
31636
|
+
children: /* @__PURE__ */ jsx70(Loader, { $color: settings.theme.primary, $size: "2xl" })
|
|
31180
31637
|
}
|
|
31181
31638
|
);
|
|
31182
31639
|
};
|
|
31183
31640
|
var Error2 = ({ message }) => {
|
|
31184
31641
|
const { settings } = useEmbed();
|
|
31185
|
-
return /* @__PURE__ */
|
|
31642
|
+
return /* @__PURE__ */ jsxs53(
|
|
31186
31643
|
Flex,
|
|
31187
31644
|
{
|
|
31188
31645
|
$flexDirection: "column",
|
|
@@ -31193,8 +31650,8 @@ var Error2 = ({ message }) => {
|
|
|
31193
31650
|
$alignItems: "center",
|
|
31194
31651
|
$justifyContent: "center",
|
|
31195
31652
|
children: [
|
|
31196
|
-
/* @__PURE__ */
|
|
31197
|
-
/* @__PURE__ */
|
|
31653
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { display: "heading1", children: "Error" }) }),
|
|
31654
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { children: message }) })
|
|
31198
31655
|
]
|
|
31199
31656
|
}
|
|
31200
31657
|
);
|
|
@@ -31212,7 +31669,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31212
31669
|
setBuilderSettings
|
|
31213
31670
|
} = useEmbed();
|
|
31214
31671
|
const compressedAst = data?.component?.ast;
|
|
31215
|
-
const { children, parsedSettings, parseError } =
|
|
31672
|
+
const { children, parsedSettings, parseError } = useMemo38(() => {
|
|
31216
31673
|
let children2 = null;
|
|
31217
31674
|
let parsedSettings2 = null;
|
|
31218
31675
|
let parseError2 = null;
|
|
@@ -31244,22 +31701,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31244
31701
|
parseError: parseError2
|
|
31245
31702
|
};
|
|
31246
31703
|
}, [compressedAst]);
|
|
31247
|
-
|
|
31704
|
+
useEffect11(() => {
|
|
31248
31705
|
if (accessToken) {
|
|
31249
31706
|
setAccessToken(accessToken);
|
|
31250
31707
|
}
|
|
31251
31708
|
}, [accessToken, setAccessToken]);
|
|
31252
|
-
|
|
31709
|
+
useEffect11(() => {
|
|
31253
31710
|
if (id && stale) {
|
|
31254
31711
|
hydrateComponent(id);
|
|
31255
31712
|
}
|
|
31256
31713
|
}, [id, hydrateComponent, stale]);
|
|
31257
|
-
|
|
31714
|
+
useEffect11(() => {
|
|
31258
31715
|
if (parsedSettings) {
|
|
31259
31716
|
setBuilderSettings(parsedSettings);
|
|
31260
31717
|
}
|
|
31261
31718
|
}, [parsedSettings, setBuilderSettings]);
|
|
31262
|
-
|
|
31719
|
+
useEffect11(() => {
|
|
31263
31720
|
if (parseError) {
|
|
31264
31721
|
setError(parseError);
|
|
31265
31722
|
}
|
|
@@ -31268,13 +31725,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31268
31725
|
return stub();
|
|
31269
31726
|
}
|
|
31270
31727
|
if (error) {
|
|
31271
|
-
return /* @__PURE__ */
|
|
31728
|
+
return /* @__PURE__ */ jsx70(Error2, { message: error.message });
|
|
31272
31729
|
}
|
|
31273
31730
|
if (accessToken?.length === 0) {
|
|
31274
|
-
return /* @__PURE__ */
|
|
31731
|
+
return /* @__PURE__ */ jsx70(Error2, { message: "Please provide an access token." });
|
|
31275
31732
|
}
|
|
31276
31733
|
if (!accessToken?.startsWith("token_")) {
|
|
31277
|
-
return /* @__PURE__ */
|
|
31734
|
+
return /* @__PURE__ */ jsx70(
|
|
31278
31735
|
Error2,
|
|
31279
31736
|
{
|
|
31280
31737
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -31282,9 +31739,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31282
31739
|
);
|
|
31283
31740
|
}
|
|
31284
31741
|
if (isPending) {
|
|
31285
|
-
return /* @__PURE__ */
|
|
31742
|
+
return /* @__PURE__ */ jsx70(Loading, {});
|
|
31286
31743
|
}
|
|
31287
|
-
return /* @__PURE__ */
|
|
31744
|
+
return /* @__PURE__ */ jsx70(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ jsx70(Loading, {}) });
|
|
31288
31745
|
};
|
|
31289
31746
|
export {
|
|
31290
31747
|
AddOns,
|