@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
|
@@ -1723,7 +1723,7 @@ var require_debounce = __commonJS({
|
|
|
1723
1723
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
1724
1724
|
var nativeMax = Math.max;
|
|
1725
1725
|
var nativeMin = Math.min;
|
|
1726
|
-
function
|
|
1726
|
+
function debounce6(func, wait, options) {
|
|
1727
1727
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
1728
1728
|
if (typeof func != "function") {
|
|
1729
1729
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
@@ -1804,7 +1804,7 @@ var require_debounce = __commonJS({
|
|
|
1804
1804
|
debounced.flush = flush;
|
|
1805
1805
|
return debounced;
|
|
1806
1806
|
}
|
|
1807
|
-
module2.exports =
|
|
1807
|
+
module2.exports = debounce6;
|
|
1808
1808
|
}
|
|
1809
1809
|
});
|
|
1810
1810
|
|
|
@@ -2051,6 +2051,8 @@ var initialContext = {
|
|
|
2051
2051
|
getUpcomingInvoice: stub,
|
|
2052
2052
|
getCustomerBalance: stub,
|
|
2053
2053
|
listInvoices: stub,
|
|
2054
|
+
getCreditUsageByUser: stub,
|
|
2055
|
+
getFeatureUsageByUser: stub,
|
|
2054
2056
|
createSetupIntent: stub,
|
|
2055
2057
|
updatePaymentMethod: stub,
|
|
2056
2058
|
deletePaymentMethod: stub,
|
|
@@ -5342,6 +5344,18 @@ var en_default = {
|
|
|
5342
5344
|
"month, billed yearly": "month, billed yearly",
|
|
5343
5345
|
"month, billed quarterly": "month, billed quarterly",
|
|
5344
5346
|
purchased: "purchased {{date}}",
|
|
5347
|
+
"Usage by user": "Usage by user",
|
|
5348
|
+
"X used by your team this period": "{{amount}} used by your team this period",
|
|
5349
|
+
"Show all X users_one": "Show all {{count}} user",
|
|
5350
|
+
"Show all X users_other": "Show all {{count}} users",
|
|
5351
|
+
"Show top X users_one": "Show top {{count}} user",
|
|
5352
|
+
"Show top X users_other": "Show top {{count}} users",
|
|
5353
|
+
"Show all": "Show all",
|
|
5354
|
+
"Show fewer": "Show fewer",
|
|
5355
|
+
Unattributed: "Unattributed",
|
|
5356
|
+
"There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
|
|
5357
|
+
"plus X more_one": "plus {{count}} more",
|
|
5358
|
+
"plus X more_other": "plus {{count}} more",
|
|
5345
5359
|
usage: {
|
|
5346
5360
|
limited: "{{amount}} of {{allocation}} used",
|
|
5347
5361
|
unlimited: "{{amount}} used"
|
|
@@ -6947,7 +6961,7 @@ var Icon = ({ name, className = "", ...rest }) => {
|
|
|
6947
6961
|
};
|
|
6948
6962
|
|
|
6949
6963
|
// src/context/EmbedProvider.tsx
|
|
6950
|
-
var
|
|
6964
|
+
var import_debounce2 = __toESM(require_debounce());
|
|
6951
6965
|
var import_merge3 = __toESM(require_merge());
|
|
6952
6966
|
var import_react15 = require("react");
|
|
6953
6967
|
|
|
@@ -7259,6 +7273,22 @@ var JSONApiResponse = class {
|
|
|
7259
7273
|
}
|
|
7260
7274
|
};
|
|
7261
7275
|
|
|
7276
|
+
// src/api/checkoutexternal/models/BillingArrearsAnchor.ts
|
|
7277
|
+
function BillingArrearsAnchorFromJSON(json) {
|
|
7278
|
+
return BillingArrearsAnchorFromJSONTyped(json, false);
|
|
7279
|
+
}
|
|
7280
|
+
function BillingArrearsAnchorFromJSONTyped(json, ignoreDiscriminator) {
|
|
7281
|
+
return json;
|
|
7282
|
+
}
|
|
7283
|
+
|
|
7284
|
+
// src/api/checkoutexternal/models/BillingArrearsCadence.ts
|
|
7285
|
+
function BillingArrearsCadenceFromJSON(json) {
|
|
7286
|
+
return BillingArrearsCadenceFromJSONTyped(json, false);
|
|
7287
|
+
}
|
|
7288
|
+
function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
|
|
7289
|
+
return json;
|
|
7290
|
+
}
|
|
7291
|
+
|
|
7262
7292
|
// src/api/checkoutexternal/models/BillingCollectionMethod.ts
|
|
7263
7293
|
function BillingCollectionMethodFromJSON(json) {
|
|
7264
7294
|
return BillingCollectionMethodFromJSONTyped(json, false);
|
|
@@ -7809,6 +7839,8 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7809
7839
|
return json;
|
|
7810
7840
|
}
|
|
7811
7841
|
return {
|
|
7842
|
+
arrearsAnchor: json["arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["arrears_anchor"]),
|
|
7843
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
7812
7844
|
autoTopupAmount: json["auto_topup_amount"] == null ? void 0 : json["auto_topup_amount"],
|
|
7813
7845
|
autoTopupAmountType: json["auto_topup_amount_type"] == null ? void 0 : json["auto_topup_amount_type"],
|
|
7814
7846
|
autoTopupAvailability: BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -7835,10 +7867,14 @@ function BillingPlanCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminat
|
|
|
7835
7867
|
expiryUnitCount: json["expiry_unit_count"] == null ? void 0 : json["expiry_unit_count"],
|
|
7836
7868
|
id: json["id"],
|
|
7837
7869
|
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
7870
|
+
overdraftLimit: json["overdraft_limit"] == null ? void 0 : json["overdraft_limit"],
|
|
7838
7871
|
plan: json["plan"] == null ? void 0 : PreviewObjectResponseDataFromJSON(json["plan"]),
|
|
7839
7872
|
planId: json["plan_id"],
|
|
7840
7873
|
planName: json["plan_name"],
|
|
7841
7874
|
planVersionId: json["plan_version_id"] == null ? void 0 : json["plan_version_id"],
|
|
7875
|
+
postpaidEnabled: json["postpaid_enabled"],
|
|
7876
|
+
postpaidRatePerUnit: json["postpaid_rate_per_unit"] == null ? void 0 : json["postpaid_rate_per_unit"],
|
|
7877
|
+
postpaidRatePerUnitDecimal: json["postpaid_rate_per_unit_decimal"] == null ? void 0 : json["postpaid_rate_per_unit_decimal"],
|
|
7842
7878
|
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON(json["reset_cadence"]),
|
|
7843
7879
|
resetStart: json["reset_start"] == null ? void 0 : BillingPlanCreditGrantResetStartFromJSON(json["reset_start"]),
|
|
7844
7880
|
resetType: json["reset_type"] == null ? void 0 : BillingPlanCreditGrantResetTypeFromJSON(json["reset_type"]),
|
|
@@ -8416,6 +8452,8 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8416
8452
|
return json;
|
|
8417
8453
|
}
|
|
8418
8454
|
return {
|
|
8455
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
8456
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
8419
8457
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
8420
8458
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
8421
8459
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -8433,6 +8471,10 @@ function CompanyPlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8433
8471
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
8434
8472
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
8435
8473
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
8474
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
8475
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
8476
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
8477
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
8436
8478
|
companyAutoTopupAmount: json["company_auto_topup_amount"] == null ? void 0 : json["company_auto_topup_amount"],
|
|
8437
8479
|
companyAutoTopupEnabled: json["company_auto_topup_enabled"] == null ? void 0 : json["company_auto_topup_enabled"],
|
|
8438
8480
|
companyAutoTopupThresholdCredits: json["company_auto_topup_threshold_credits"] == null ? void 0 : json["company_auto_topup_threshold_credits"],
|
|
@@ -8944,6 +8986,41 @@ function CompanyDetailResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
8944
8986
|
};
|
|
8945
8987
|
}
|
|
8946
8988
|
|
|
8989
|
+
// src/api/checkoutexternal/models/CompanyInvoiceResponseData.ts
|
|
8990
|
+
function CompanyInvoiceResponseDataFromJSON(json) {
|
|
8991
|
+
return CompanyInvoiceResponseDataFromJSONTyped(json, false);
|
|
8992
|
+
}
|
|
8993
|
+
function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
8994
|
+
if (json == null) {
|
|
8995
|
+
return json;
|
|
8996
|
+
}
|
|
8997
|
+
return {
|
|
8998
|
+
amountDue: json["amount_due"],
|
|
8999
|
+
createdAt: new Date(json["created_at"]),
|
|
9000
|
+
currency: json["currency"],
|
|
9001
|
+
dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
|
|
9002
|
+
id: json["id"],
|
|
9003
|
+
status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
|
|
9004
|
+
url: json["url"] == null ? void 0 : json["url"]
|
|
9005
|
+
};
|
|
9006
|
+
}
|
|
9007
|
+
|
|
9008
|
+
// src/api/checkoutexternal/models/CompanyInvoicesResponseData.ts
|
|
9009
|
+
function CompanyInvoicesResponseDataFromJSON(json) {
|
|
9010
|
+
return CompanyInvoicesResponseDataFromJSONTyped(json, false);
|
|
9011
|
+
}
|
|
9012
|
+
function CompanyInvoicesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
9013
|
+
if (json == null) {
|
|
9014
|
+
return json;
|
|
9015
|
+
}
|
|
9016
|
+
return {
|
|
9017
|
+
count: json["count"],
|
|
9018
|
+
invoices: json["invoices"].map(
|
|
9019
|
+
CompanyInvoiceResponseDataFromJSON
|
|
9020
|
+
)
|
|
9021
|
+
};
|
|
9022
|
+
}
|
|
9023
|
+
|
|
8947
9024
|
// src/api/checkoutexternal/models/CompanyOverrideNoteResponseData.ts
|
|
8948
9025
|
function CompanyOverrideNoteResponseDataFromJSON(json) {
|
|
8949
9026
|
return CompanyOverrideNoteResponseDataFromJSONTyped(json, false);
|
|
@@ -9434,6 +9511,8 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9434
9511
|
return json;
|
|
9435
9512
|
}
|
|
9436
9513
|
return {
|
|
9514
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON(json["billing_credit_arrears_anchor"]),
|
|
9515
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["billing_credit_arrears_cadence"]),
|
|
9437
9516
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
9438
9517
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
9439
9518
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON(
|
|
@@ -9451,6 +9530,10 @@ function PlanCreditGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9451
9530
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
9452
9531
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
9453
9532
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
9533
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
9534
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
9535
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
9536
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
9454
9537
|
companyCreditAmount: json["company_credit_amount"],
|
|
9455
9538
|
createdAt: new Date(json["created_at"]),
|
|
9456
9539
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON(json["credit"]),
|
|
@@ -9943,6 +10026,7 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9943
10026
|
return json;
|
|
9944
10027
|
}
|
|
9945
10028
|
return {
|
|
10029
|
+
arrearsCadence: json["arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON(json["arrears_cadence"]),
|
|
9946
10030
|
billingCreditBundleId: json["billing_credit_bundle_id"] == null ? void 0 : json["billing_credit_bundle_id"],
|
|
9947
10031
|
billingCreditId: json["billing_credit_id"],
|
|
9948
10032
|
companyId: json["company_id"],
|
|
@@ -9964,6 +10048,12 @@ function CreditCompanyGrantViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
9964
10048
|
planId: json["plan_id"] == null ? void 0 : json["plan_id"],
|
|
9965
10049
|
planName: json["plan_name"] == null ? void 0 : json["plan_name"],
|
|
9966
10050
|
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
10051
|
+
postpaidChargeAmount: json["postpaid_charge_amount"] == null ? void 0 : json["postpaid_charge_amount"],
|
|
10052
|
+
postpaidChargeCurrency: json["postpaid_charge_currency"] == null ? void 0 : json["postpaid_charge_currency"],
|
|
10053
|
+
postpaidChargedCredits: json["postpaid_charged_credits"] == null ? void 0 : json["postpaid_charged_credits"],
|
|
10054
|
+
postpaidPeriodEnd: json["postpaid_period_end"] == null ? void 0 : new Date(json["postpaid_period_end"]),
|
|
10055
|
+
postpaidRate: json["postpaid_rate"] == null ? void 0 : json["postpaid_rate"],
|
|
10056
|
+
postpaidRateDecimal: json["postpaid_rate_decimal"] == null ? void 0 : json["postpaid_rate_decimal"],
|
|
9967
10057
|
price: json["price"] == null ? void 0 : BillingProductPriceResponseDataFromJSON(json["price"]),
|
|
9968
10058
|
quantity: json["quantity"],
|
|
9969
10059
|
quantityRemaining: json["quantity_remaining"],
|
|
@@ -10287,6 +10377,35 @@ function GetCheckoutTaxIDResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10287
10377
|
};
|
|
10288
10378
|
}
|
|
10289
10379
|
|
|
10380
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesParams.ts
|
|
10381
|
+
function GetCompanyInvoicesParamsFromJSON(json) {
|
|
10382
|
+
return GetCompanyInvoicesParamsFromJSONTyped(json, false);
|
|
10383
|
+
}
|
|
10384
|
+
function GetCompanyInvoicesParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
10385
|
+
if (json == null) {
|
|
10386
|
+
return json;
|
|
10387
|
+
}
|
|
10388
|
+
return {
|
|
10389
|
+
includePending: json["include_pending"] == null ? void 0 : json["include_pending"],
|
|
10390
|
+
limit: json["limit"] == null ? void 0 : json["limit"],
|
|
10391
|
+
offset: json["offset"] == null ? void 0 : json["offset"]
|
|
10392
|
+
};
|
|
10393
|
+
}
|
|
10394
|
+
|
|
10395
|
+
// src/api/checkoutexternal/models/GetCompanyInvoicesResponse.ts
|
|
10396
|
+
function GetCompanyInvoicesResponseFromJSON(json) {
|
|
10397
|
+
return GetCompanyInvoicesResponseFromJSONTyped(json, false);
|
|
10398
|
+
}
|
|
10399
|
+
function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
10400
|
+
if (json == null) {
|
|
10401
|
+
return json;
|
|
10402
|
+
}
|
|
10403
|
+
return {
|
|
10404
|
+
data: CompanyInvoicesResponseDataFromJSON(json["data"]),
|
|
10405
|
+
params: GetCompanyInvoicesParamsFromJSON(json["params"])
|
|
10406
|
+
};
|
|
10407
|
+
}
|
|
10408
|
+
|
|
10290
10409
|
// src/api/checkoutexternal/models/GetCreditUsageByUserParams.ts
|
|
10291
10410
|
function GetCreditUsageByUserParamsFromJSON(json) {
|
|
10292
10411
|
return GetCreditUsageByUserParamsFromJSONTyped(json, false);
|
|
@@ -10897,6 +11016,50 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
10897
11016
|
const response = await this.getCheckoutTaxIDRaw(initOverrides);
|
|
10898
11017
|
return await response.value();
|
|
10899
11018
|
}
|
|
11019
|
+
/**
|
|
11020
|
+
* Get company invoices
|
|
11021
|
+
*/
|
|
11022
|
+
async getCompanyInvoicesRaw(requestParameters, initOverrides) {
|
|
11023
|
+
const queryParameters = {};
|
|
11024
|
+
if (requestParameters["includePending"] != null) {
|
|
11025
|
+
queryParameters["include_pending"] = requestParameters["includePending"];
|
|
11026
|
+
}
|
|
11027
|
+
if (requestParameters["limit"] != null) {
|
|
11028
|
+
queryParameters["limit"] = requestParameters["limit"];
|
|
11029
|
+
}
|
|
11030
|
+
if (requestParameters["offset"] != null) {
|
|
11031
|
+
queryParameters["offset"] = requestParameters["offset"];
|
|
11032
|
+
}
|
|
11033
|
+
const headerParameters = {};
|
|
11034
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
11035
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
11036
|
+
"X-Schematic-Api-Key"
|
|
11037
|
+
);
|
|
11038
|
+
}
|
|
11039
|
+
const response = await this.request(
|
|
11040
|
+
{
|
|
11041
|
+
path: `/company/invoices`,
|
|
11042
|
+
method: "GET",
|
|
11043
|
+
headers: headerParameters,
|
|
11044
|
+
query: queryParameters
|
|
11045
|
+
},
|
|
11046
|
+
initOverrides
|
|
11047
|
+
);
|
|
11048
|
+
return new JSONApiResponse(
|
|
11049
|
+
response,
|
|
11050
|
+
(jsonValue) => GetCompanyInvoicesResponseFromJSON(jsonValue)
|
|
11051
|
+
);
|
|
11052
|
+
}
|
|
11053
|
+
/**
|
|
11054
|
+
* Get company invoices
|
|
11055
|
+
*/
|
|
11056
|
+
async getCompanyInvoices(requestParameters = {}, initOverrides) {
|
|
11057
|
+
const response = await this.getCompanyInvoicesRaw(
|
|
11058
|
+
requestParameters,
|
|
11059
|
+
initOverrides
|
|
11060
|
+
);
|
|
11061
|
+
return await response.value();
|
|
11062
|
+
}
|
|
10900
11063
|
/**
|
|
10901
11064
|
* Get credit usage by user
|
|
10902
11065
|
*/
|
|
@@ -11646,6 +11809,22 @@ var JSONApiResponse2 = class {
|
|
|
11646
11809
|
}
|
|
11647
11810
|
};
|
|
11648
11811
|
|
|
11812
|
+
// src/api/componentspublic/models/BillingArrearsAnchor.ts
|
|
11813
|
+
function BillingArrearsAnchorFromJSON2(json) {
|
|
11814
|
+
return BillingArrearsAnchorFromJSONTyped5(json, false);
|
|
11815
|
+
}
|
|
11816
|
+
function BillingArrearsAnchorFromJSONTyped5(json, ignoreDiscriminator) {
|
|
11817
|
+
return json;
|
|
11818
|
+
}
|
|
11819
|
+
|
|
11820
|
+
// src/api/componentspublic/models/BillingArrearsCadence.ts
|
|
11821
|
+
function BillingArrearsCadenceFromJSON2(json) {
|
|
11822
|
+
return BillingArrearsCadenceFromJSONTyped6(json, false);
|
|
11823
|
+
}
|
|
11824
|
+
function BillingArrearsCadenceFromJSONTyped6(json, ignoreDiscriminator) {
|
|
11825
|
+
return json;
|
|
11826
|
+
}
|
|
11827
|
+
|
|
11649
11828
|
// src/api/componentspublic/models/BillingCreditAutoTopupAvailability.ts
|
|
11650
11829
|
function BillingCreditAutoTopupAvailabilityFromJSON2(json) {
|
|
11651
11830
|
return BillingCreditAutoTopupAvailabilityFromJSONTyped5(json, false);
|
|
@@ -12623,6 +12802,8 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12623
12802
|
return json;
|
|
12624
12803
|
}
|
|
12625
12804
|
return {
|
|
12805
|
+
billingCreditArrearsAnchor: json["billing_credit_arrears_anchor"] == null ? void 0 : BillingArrearsAnchorFromJSON2(json["billing_credit_arrears_anchor"]),
|
|
12806
|
+
billingCreditArrearsCadence: json["billing_credit_arrears_cadence"] == null ? void 0 : BillingArrearsCadenceFromJSON2(json["billing_credit_arrears_cadence"]),
|
|
12626
12807
|
billingCreditAutoTopupAmount: json["billing_credit_auto_topup_amount"] == null ? void 0 : json["billing_credit_auto_topup_amount"],
|
|
12627
12808
|
billingCreditAutoTopupAmountType: json["billing_credit_auto_topup_amount_type"] == null ? void 0 : json["billing_credit_auto_topup_amount_type"],
|
|
12628
12809
|
billingCreditAutoTopupAvailability: json["billing_credit_auto_topup_availability"] == null ? void 0 : BillingCreditAutoTopupAvailabilityFromJSON2(
|
|
@@ -12640,6 +12821,10 @@ function PlanCreditGrantViewFromJSONTyped3(json, ignoreDiscriminator) {
|
|
|
12640
12821
|
billingCreditAutoTopupThresholdCredits: json["billing_credit_auto_topup_threshold_credits"] == null ? void 0 : json["billing_credit_auto_topup_threshold_credits"],
|
|
12641
12822
|
billingCreditAutoTopupThresholdPercent: json["billing_credit_auto_topup_threshold_percent"] == null ? void 0 : json["billing_credit_auto_topup_threshold_percent"],
|
|
12642
12823
|
billingCreditCanBuyBundles: json["billing_credit_can_buy_bundles"],
|
|
12824
|
+
billingCreditOverdraftLimit: json["billing_credit_overdraft_limit"] == null ? void 0 : json["billing_credit_overdraft_limit"],
|
|
12825
|
+
billingCreditPostpaidEnabled: json["billing_credit_postpaid_enabled"],
|
|
12826
|
+
billingCreditPostpaidRatePerUnit: json["billing_credit_postpaid_rate_per_unit"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit"],
|
|
12827
|
+
billingCreditPostpaidRatePerUnitDecimal: json["billing_credit_postpaid_rate_per_unit_decimal"] == null ? void 0 : json["billing_credit_postpaid_rate_per_unit_decimal"],
|
|
12643
12828
|
companyCreditAmount: json["company_credit_amount"],
|
|
12644
12829
|
createdAt: new Date(json["created_at"]),
|
|
12645
12830
|
credit: json["credit"] == null ? void 0 : BillingCreditViewFromJSON2(json["credit"]),
|
|
@@ -13045,6 +13230,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
|
|
|
13045
13230
|
}
|
|
13046
13231
|
return cost;
|
|
13047
13232
|
}
|
|
13233
|
+
function calculateQuantityCost(billingPrice, quantity) {
|
|
13234
|
+
if (!billingPrice) {
|
|
13235
|
+
return 0;
|
|
13236
|
+
}
|
|
13237
|
+
if (isTieredPrice(billingPrice)) {
|
|
13238
|
+
return calculateTieredCost(
|
|
13239
|
+
quantity,
|
|
13240
|
+
billingPrice.priceTier,
|
|
13241
|
+
billingPrice.tiersMode
|
|
13242
|
+
);
|
|
13243
|
+
}
|
|
13244
|
+
return quantity * billingPrice.price;
|
|
13245
|
+
}
|
|
13048
13246
|
function getEntitlementCost(entitlement, period = "month", currency) {
|
|
13049
13247
|
const resolvedPeriod = period ?? "month";
|
|
13050
13248
|
const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
|
|
@@ -13831,6 +14029,18 @@ function buildCreditBundlesRequestBody(creditBundles) {
|
|
|
13831
14029
|
[]
|
|
13832
14030
|
);
|
|
13833
14031
|
}
|
|
14032
|
+
function isCreditOnlyCheckout(options) {
|
|
14033
|
+
const { plan, creditBundles, addOns, period, currency } = options;
|
|
14034
|
+
if (plan) {
|
|
14035
|
+
return false;
|
|
14036
|
+
}
|
|
14037
|
+
if (!creditBundles.some((bundle) => bundle.count > 0)) {
|
|
14038
|
+
return false;
|
|
14039
|
+
}
|
|
14040
|
+
return !addOns.some(
|
|
14041
|
+
(addOn) => addOn.isSelected && !!getAddOnPrice(addOn, period, currency)?.id
|
|
14042
|
+
);
|
|
14043
|
+
}
|
|
13834
14044
|
|
|
13835
14045
|
// src/utils/api/entitlement.ts
|
|
13836
14046
|
var PeriodName = {
|
|
@@ -14097,6 +14307,20 @@ function modifyDate(date, days) {
|
|
|
14097
14307
|
return copy3;
|
|
14098
14308
|
}
|
|
14099
14309
|
|
|
14310
|
+
// src/utils/debounce.ts
|
|
14311
|
+
var import_debounce = __toESM(require_debounce());
|
|
14312
|
+
function debounceByKey(fn, wait, settings) {
|
|
14313
|
+
const debouncedByKey = /* @__PURE__ */ new Map();
|
|
14314
|
+
return (key, ...args) => {
|
|
14315
|
+
let debounced = debouncedByKey.get(key);
|
|
14316
|
+
if (!debounced) {
|
|
14317
|
+
debounced = (0, import_debounce.default)(fn, wait, settings);
|
|
14318
|
+
debouncedByKey.set(key, debounced);
|
|
14319
|
+
}
|
|
14320
|
+
return debounced(key, ...args);
|
|
14321
|
+
};
|
|
14322
|
+
}
|
|
14323
|
+
|
|
14100
14324
|
// src/utils/string.ts
|
|
14101
14325
|
var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
14102
14326
|
"BIF",
|
|
@@ -15100,7 +15324,7 @@ var reducer = (state, action) => {
|
|
|
15100
15324
|
// src/context/EmbedProvider.tsx
|
|
15101
15325
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
15102
15326
|
var getCustomHeaders = (sessionId) => ({
|
|
15103
|
-
"X-Schematic-Components-Version": "2.25.
|
|
15327
|
+
"X-Schematic-Components-Version": "2.25.2",
|
|
15104
15328
|
"X-Schematic-Session-ID": sessionId
|
|
15105
15329
|
});
|
|
15106
15330
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -15211,7 +15435,7 @@ var EmbedProvider = ({
|
|
|
15211
15435
|
}
|
|
15212
15436
|
}, [publicApi]);
|
|
15213
15437
|
const debouncedHydratePublic = (0, import_react15.useMemo)(
|
|
15214
|
-
() => (0,
|
|
15438
|
+
() => (0, import_debounce2.default)(
|
|
15215
15439
|
hydratePublic,
|
|
15216
15440
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15217
15441
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15237,7 +15461,7 @@ var EmbedProvider = ({
|
|
|
15237
15461
|
}
|
|
15238
15462
|
}, [checkoutApi]);
|
|
15239
15463
|
const debouncedHydrate = (0, import_react15.useMemo)(
|
|
15240
|
-
() => (0,
|
|
15464
|
+
() => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15241
15465
|
[hydrate]
|
|
15242
15466
|
);
|
|
15243
15467
|
const hydrateComponent = (0, import_react15.useCallback)(
|
|
@@ -15264,7 +15488,7 @@ var EmbedProvider = ({
|
|
|
15264
15488
|
[checkoutApi]
|
|
15265
15489
|
);
|
|
15266
15490
|
const debouncedHydrateComponent = (0, import_react15.useMemo)(
|
|
15267
|
-
() => (0,
|
|
15491
|
+
() => (0, import_debounce2.default)(
|
|
15268
15492
|
hydrateComponent,
|
|
15269
15493
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15270
15494
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15288,7 +15512,7 @@ var EmbedProvider = ({
|
|
|
15288
15512
|
}
|
|
15289
15513
|
}, []);
|
|
15290
15514
|
const debouncedHydrateExternal = (0, import_react15.useMemo)(
|
|
15291
|
-
() => (0,
|
|
15515
|
+
() => (0, import_debounce2.default)(
|
|
15292
15516
|
hydrateExternal,
|
|
15293
15517
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15294
15518
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15299,7 +15523,7 @@ var EmbedProvider = ({
|
|
|
15299
15523
|
return checkoutApi?.createSetupIntent();
|
|
15300
15524
|
}, [checkoutApi]);
|
|
15301
15525
|
const debouncedCreateSetupIntent = (0, import_react15.useMemo)(
|
|
15302
|
-
() => (0,
|
|
15526
|
+
() => (0, import_debounce2.default)(
|
|
15303
15527
|
createSetupIntent,
|
|
15304
15528
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15305
15529
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15322,7 +15546,7 @@ var EmbedProvider = ({
|
|
|
15322
15546
|
[checkoutApi]
|
|
15323
15547
|
);
|
|
15324
15548
|
const debouncedUpdatePaymentMethod = (0, import_react15.useMemo)(
|
|
15325
|
-
() => (0,
|
|
15549
|
+
() => (0, import_debounce2.default)(
|
|
15326
15550
|
updatePaymentMethod,
|
|
15327
15551
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15328
15552
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15345,7 +15569,7 @@ var EmbedProvider = ({
|
|
|
15345
15569
|
[checkoutApi]
|
|
15346
15570
|
);
|
|
15347
15571
|
const debouncedDeletePaymentMethod = (0, import_react15.useMemo)(
|
|
15348
|
-
() => (0,
|
|
15572
|
+
() => (0, import_debounce2.default)(
|
|
15349
15573
|
deletePaymentMethod,
|
|
15350
15574
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15351
15575
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15368,7 +15592,7 @@ var EmbedProvider = ({
|
|
|
15368
15592
|
[checkoutApi]
|
|
15369
15593
|
);
|
|
15370
15594
|
const debouncedCheckout = (0, import_react15.useMemo)(
|
|
15371
|
-
() => (0,
|
|
15595
|
+
() => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15372
15596
|
[checkout]
|
|
15373
15597
|
);
|
|
15374
15598
|
const previewCheckout = (0, import_react15.useCallback)(
|
|
@@ -15388,7 +15612,7 @@ var EmbedProvider = ({
|
|
|
15388
15612
|
return response;
|
|
15389
15613
|
}, [checkoutApi]);
|
|
15390
15614
|
const debouncedUnsubscribe = (0, import_react15.useMemo)(
|
|
15391
|
-
() => (0,
|
|
15615
|
+
() => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15392
15616
|
[unsubscribe]
|
|
15393
15617
|
);
|
|
15394
15618
|
const updateCustomFieldValues = (0, import_react15.useCallback)(
|
|
@@ -15432,7 +15656,7 @@ var EmbedProvider = ({
|
|
|
15432
15656
|
[checkoutApi]
|
|
15433
15657
|
);
|
|
15434
15658
|
const debouncedGetUpcomingInvoice = (0, import_react15.useMemo)(
|
|
15435
|
-
() => (0,
|
|
15659
|
+
() => (0, import_debounce2.default)(
|
|
15436
15660
|
getUpcomingInvoice,
|
|
15437
15661
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15438
15662
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15443,7 +15667,7 @@ var EmbedProvider = ({
|
|
|
15443
15667
|
return checkoutApi?.fetchCustomerBalance();
|
|
15444
15668
|
}, [checkoutApi]);
|
|
15445
15669
|
const debouncedGetCustomerBalance = (0, import_react15.useMemo)(
|
|
15446
|
-
() => (0,
|
|
15670
|
+
() => (0, import_debounce2.default)(
|
|
15447
15671
|
getCustomerBalance,
|
|
15448
15672
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15449
15673
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15454,9 +15678,37 @@ var EmbedProvider = ({
|
|
|
15454
15678
|
return checkoutApi?.listInvoices();
|
|
15455
15679
|
}, [checkoutApi]);
|
|
15456
15680
|
const debouncedListInvoices = (0, import_react15.useMemo)(
|
|
15457
|
-
() => (0,
|
|
15681
|
+
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15458
15682
|
[listInvoices]
|
|
15459
15683
|
);
|
|
15684
|
+
const getCreditUsageByUser = (0, import_react15.useCallback)(
|
|
15685
|
+
async (billingCreditId, limit) => {
|
|
15686
|
+
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
15687
|
+
},
|
|
15688
|
+
[checkoutApi]
|
|
15689
|
+
);
|
|
15690
|
+
const debouncedGetCreditUsageByUser = (0, import_react15.useMemo)(
|
|
15691
|
+
() => debounceByKey(
|
|
15692
|
+
getCreditUsageByUser,
|
|
15693
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15694
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15695
|
+
),
|
|
15696
|
+
[getCreditUsageByUser]
|
|
15697
|
+
);
|
|
15698
|
+
const getFeatureUsageByUser = (0, import_react15.useCallback)(
|
|
15699
|
+
async (featureId, limit) => {
|
|
15700
|
+
return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
|
|
15701
|
+
},
|
|
15702
|
+
[checkoutApi]
|
|
15703
|
+
);
|
|
15704
|
+
const debouncedGetFeatureUsageByUser = (0, import_react15.useMemo)(
|
|
15705
|
+
() => debounceByKey(
|
|
15706
|
+
getFeatureUsageByUser,
|
|
15707
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15708
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15709
|
+
),
|
|
15710
|
+
[getFeatureUsageByUser]
|
|
15711
|
+
);
|
|
15460
15712
|
const setError = (0, import_react15.useCallback)(
|
|
15461
15713
|
(error) => {
|
|
15462
15714
|
debug(error.message);
|
|
@@ -15622,6 +15874,8 @@ var EmbedProvider = ({
|
|
|
15622
15874
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
15623
15875
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
15624
15876
|
listInvoices: debouncedListInvoices,
|
|
15877
|
+
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
15878
|
+
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
15625
15879
|
finishCheckout,
|
|
15626
15880
|
setError,
|
|
15627
15881
|
setAccessToken,
|
|
@@ -17014,7 +17268,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
|
|
|
17014
17268
|
`;
|
|
17015
17269
|
|
|
17016
17270
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
17017
|
-
var
|
|
17271
|
+
var import_debounce3 = __toESM(require_debounce());
|
|
17018
17272
|
var import_react29 = require("react");
|
|
17019
17273
|
var import_react_dom = require("react-dom");
|
|
17020
17274
|
|
|
@@ -17198,7 +17452,7 @@ var Tooltip = ({
|
|
|
17198
17452
|
}, [portal, position2]);
|
|
17199
17453
|
(0, import_react29.useLayoutEffect)(() => {
|
|
17200
17454
|
updateCoords();
|
|
17201
|
-
const handleResize = (0,
|
|
17455
|
+
const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
|
|
17202
17456
|
window.addEventListener("resize", handleResize);
|
|
17203
17457
|
window.addEventListener("scroll", handleResize, true);
|
|
17204
17458
|
return () => {
|
|
@@ -17355,7 +17609,7 @@ var Root = (0, import_react32.forwardRef)(
|
|
|
17355
17609
|
Root.displayName = "Root";
|
|
17356
17610
|
|
|
17357
17611
|
// src/components/layout/viewport/Viewport.tsx
|
|
17358
|
-
var
|
|
17612
|
+
var import_debounce5 = __toESM(require_debounce());
|
|
17359
17613
|
var import_react50 = require("react");
|
|
17360
17614
|
var import_react_dom3 = require("react-dom");
|
|
17361
17615
|
|
|
@@ -18303,11 +18557,10 @@ var Quantity = ({
|
|
|
18303
18557
|
children: [
|
|
18304
18558
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
|
|
18305
18559
|
formatCurrency(
|
|
18306
|
-
|
|
18307
|
-
|
|
18308
|
-
|
|
18309
|
-
|
|
18310
|
-
) : (price ?? 0) * entitlement.quantity,
|
|
18560
|
+
calculateQuantityCost(
|
|
18561
|
+
entitlementBillingPrice,
|
|
18562
|
+
entitlement.quantity
|
|
18563
|
+
),
|
|
18311
18564
|
currency
|
|
18312
18565
|
),
|
|
18313
18566
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("sub", { children: [
|
|
@@ -19184,7 +19437,7 @@ var Checkout = ({
|
|
|
19184
19437
|
};
|
|
19185
19438
|
|
|
19186
19439
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
19187
|
-
var
|
|
19440
|
+
var import_debounce4 = __toESM(require_debounce());
|
|
19188
19441
|
var import_react39 = require("react");
|
|
19189
19442
|
|
|
19190
19443
|
// src/components/shared/checkout-dialog/Navigation.tsx
|
|
@@ -19504,48 +19757,26 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19504
19757
|
bundleCounts
|
|
19505
19758
|
);
|
|
19506
19759
|
}, [bundleGatingPlanId, data?.creditBundles, bundleCounts]);
|
|
19507
|
-
const selectedPlanPriceId = (0, import_react39.useMemo)(() => {
|
|
19508
|
-
if (!selectedPlan) {
|
|
19509
|
-
return void 0;
|
|
19510
|
-
}
|
|
19511
|
-
const currencyPrice = getPlanPrice(
|
|
19512
|
-
selectedPlan,
|
|
19513
|
-
planPeriod,
|
|
19514
|
-
{ useSelectedPeriod: true },
|
|
19515
|
-
hasCurrency ? effectiveCurrency : void 0
|
|
19516
|
-
);
|
|
19517
|
-
return currencyPrice?.id ?? (planPeriod === "year" ? selectedPlan.yearlyPrice?.id : planPeriod === "quarter" ? selectedPlan.quarterlyPrice?.id : selectedPlan.monthlyPrice?.id);
|
|
19518
|
-
}, [selectedPlan, planPeriod, hasCurrency, effectiveCurrency]);
|
|
19519
19760
|
const [hasInitialPaymentMethod] = (0, import_react39.useState)(
|
|
19520
19761
|
() => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
|
|
19521
19762
|
);
|
|
19522
|
-
const isCreditOnlyPurchase = (0, import_react39.useMemo)(
|
|
19523
|
-
|
|
19524
|
-
|
|
19525
|
-
|
|
19526
|
-
|
|
19527
|
-
|
|
19528
|
-
|
|
19529
|
-
|
|
19530
|
-
|
|
19531
|
-
|
|
19532
|
-
|
|
19533
|
-
|
|
19534
|
-
|
|
19535
|
-
|
|
19536
|
-
|
|
19537
|
-
|
|
19538
|
-
|
|
19539
|
-
return !hasPaidAddOn;
|
|
19540
|
-
}, [
|
|
19541
|
-
data?.company?.billingSubscription,
|
|
19542
|
-
selectedPlanPriceId,
|
|
19543
|
-
creditBundles,
|
|
19544
|
-
addOns,
|
|
19545
|
-
planPeriod,
|
|
19546
|
-
hasCurrency,
|
|
19547
|
-
effectiveCurrency
|
|
19548
|
-
]);
|
|
19763
|
+
const isCreditOnlyPurchase = (0, import_react39.useMemo)(
|
|
19764
|
+
() => isCreditOnlyCheckout({
|
|
19765
|
+
plan: selectedPlan,
|
|
19766
|
+
creditBundles,
|
|
19767
|
+
addOns,
|
|
19768
|
+
period: planPeriod,
|
|
19769
|
+
currency: hasCurrency ? effectiveCurrency : void 0
|
|
19770
|
+
}),
|
|
19771
|
+
[
|
|
19772
|
+
selectedPlan,
|
|
19773
|
+
creditBundles,
|
|
19774
|
+
addOns,
|
|
19775
|
+
planPeriod,
|
|
19776
|
+
hasCurrency,
|
|
19777
|
+
effectiveCurrency
|
|
19778
|
+
]
|
|
19779
|
+
);
|
|
19549
19780
|
const [usageBasedEntitlements, setUsageBasedEntitlements] = (0, import_react39.useState)(
|
|
19550
19781
|
() => applyPrefilledQuantities(
|
|
19551
19782
|
(selectedPlan?.entitlements || []).reduce(
|
|
@@ -19840,9 +20071,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19840
20071
|
updates.creditBundles || creditBundles,
|
|
19841
20072
|
plan?.id ?? data?.company?.plan?.id
|
|
19842
20073
|
);
|
|
19843
|
-
const isCreditOnly =
|
|
19844
|
-
|
|
19845
|
-
|
|
20074
|
+
const isCreditOnly = isCreditOnlyCheckout({
|
|
20075
|
+
plan,
|
|
20076
|
+
creditBundles: resolvedCreditBundles,
|
|
20077
|
+
addOns: updates.addOns || addOns,
|
|
20078
|
+
period,
|
|
20079
|
+
currency: resolvedCurrency
|
|
20080
|
+
});
|
|
19846
20081
|
if ((!plan || !planPriceId) && !isCreditOnly) {
|
|
19847
20082
|
++previewRequestIdRef.current;
|
|
19848
20083
|
setError(void 0);
|
|
@@ -19982,7 +20217,6 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19982
20217
|
addOnCompatibilityLookup,
|
|
19983
20218
|
data?.company?.plan?.id,
|
|
19984
20219
|
data?.company?.plan?.includedCreditGrants,
|
|
19985
|
-
data?.company?.billingSubscription,
|
|
19986
20220
|
previewCheckout,
|
|
19987
20221
|
planPeriod,
|
|
19988
20222
|
selectedPlan,
|
|
@@ -20005,7 +20239,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20005
20239
|
}, [handlePreviewCheckout]);
|
|
20006
20240
|
const debouncedPreviewCheckoutRef = (0, import_react39.useRef)(null);
|
|
20007
20241
|
(0, import_react39.useEffect)(() => {
|
|
20008
|
-
const debounced = (0,
|
|
20242
|
+
const debounced = (0, import_debounce4.default)(
|
|
20009
20243
|
(updates) => handlePreviewCheckoutRef.current(updates),
|
|
20010
20244
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
20011
20245
|
TRAILING_DEBOUNCE_SETTINGS
|
|
@@ -22116,6 +22350,29 @@ var EntitlementRow = (props) => {
|
|
|
22116
22350
|
tiersMode
|
|
22117
22351
|
} = entitlementPrice || {};
|
|
22118
22352
|
const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
|
|
22353
|
+
const tierLabel = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
22354
|
+
Text,
|
|
22355
|
+
{
|
|
22356
|
+
style: { opacity: 0.54 },
|
|
22357
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22358
|
+
$color: settings.theme.typography.text.color,
|
|
22359
|
+
children: [
|
|
22360
|
+
t4("Tier-based"),
|
|
22361
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
22362
|
+
PricingTiersTooltip,
|
|
22363
|
+
{
|
|
22364
|
+
portal,
|
|
22365
|
+
feature,
|
|
22366
|
+
period: planPeriod,
|
|
22367
|
+
currency,
|
|
22368
|
+
priceTiers,
|
|
22369
|
+
tiersMode: tiersMode ?? void 0,
|
|
22370
|
+
position: "left"
|
|
22371
|
+
}
|
|
22372
|
+
)
|
|
22373
|
+
]
|
|
22374
|
+
}
|
|
22375
|
+
);
|
|
22119
22376
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22120
22377
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22121
22378
|
quantity,
|
|
@@ -22126,13 +22383,24 @@ var EntitlementRow = (props) => {
|
|
|
22126
22383
|
" ",
|
|
22127
22384
|
getFeatureName(feature, softLimit)
|
|
22128
22385
|
] }) : feature.name }) }),
|
|
22129
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22130
|
-
|
|
22131
|
-
|
|
22132
|
-
|
|
22133
|
-
|
|
22386
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22387
|
+
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
22388
|
+
// quantity, so the row shows it alongside the tier breakdown
|
|
22389
|
+
// rather than leaving the charge unpriced.
|
|
22390
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
|
|
22391
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
|
|
22392
|
+
formatCurrency(
|
|
22393
|
+
calculateQuantityCost(entitlementPrice, quantity),
|
|
22394
|
+
currency
|
|
22395
|
+
),
|
|
22396
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
|
|
22397
|
+
"/",
|
|
22398
|
+
shortenPeriod(planPeriod)
|
|
22399
|
+
] })
|
|
22400
|
+
] }),
|
|
22401
|
+
tiered && tierLabel
|
|
22134
22402
|
] })
|
|
22135
|
-
|
|
22403
|
+
) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
|
|
22136
22404
|
priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22137
22405
|
t4("then"),
|
|
22138
22406
|
" "
|
|
@@ -22150,29 +22418,7 @@ var EntitlementRow = (props) => {
|
|
|
22150
22418
|
shortenPeriod(planPeriod)
|
|
22151
22419
|
] })
|
|
22152
22420
|
] })
|
|
22153
|
-
] }) :
|
|
22154
|
-
Text,
|
|
22155
|
-
{
|
|
22156
|
-
style: { opacity: 0.54 },
|
|
22157
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22158
|
-
$color: settings.theme.typography.text.color,
|
|
22159
|
-
children: [
|
|
22160
|
-
t4("Tier-based"),
|
|
22161
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
22162
|
-
PricingTiersTooltip,
|
|
22163
|
-
{
|
|
22164
|
-
portal,
|
|
22165
|
-
feature,
|
|
22166
|
-
period: planPeriod,
|
|
22167
|
-
currency,
|
|
22168
|
-
priceTiers,
|
|
22169
|
-
tiersMode: tiersMode ?? void 0,
|
|
22170
|
-
position: "left"
|
|
22171
|
-
}
|
|
22172
|
-
)
|
|
22173
|
-
]
|
|
22174
|
-
}
|
|
22175
|
-
) })
|
|
22421
|
+
] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
|
|
22176
22422
|
] });
|
|
22177
22423
|
}
|
|
22178
22424
|
};
|
|
@@ -22368,12 +22614,18 @@ var SubscriptionSidebar = (0, import_react47.forwardRef)(
|
|
|
22368
22614
|
}, 0);
|
|
22369
22615
|
total += addOnCost;
|
|
22370
22616
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
22371
|
-
(sum, entitlement) => sum +
|
|
22617
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22618
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22619
|
+
entitlement.quantity
|
|
22620
|
+
),
|
|
22372
22621
|
0
|
|
22373
22622
|
);
|
|
22374
22623
|
total += payInAdvanceCost;
|
|
22375
22624
|
const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
|
|
22376
|
-
(sum, entitlement) => sum +
|
|
22625
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22626
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22627
|
+
entitlement.quantity
|
|
22628
|
+
),
|
|
22377
22629
|
0
|
|
22378
22630
|
);
|
|
22379
22631
|
total += addOnPayInAdvanceCost;
|
|
@@ -23836,7 +24088,7 @@ var Viewport = (0, import_react50.forwardRef)(
|
|
|
23836
24088
|
const [top, setTop] = (0, import_react50.useState)(0);
|
|
23837
24089
|
(0, import_react50.useLayoutEffect)(() => {
|
|
23838
24090
|
const element = portalRef.current;
|
|
23839
|
-
const setModalY = (0,
|
|
24091
|
+
const setModalY = (0, import_debounce5.default)(() => {
|
|
23840
24092
|
const value = Math.abs(
|
|
23841
24093
|
(element === document.body ? window.scrollY : element.scrollTop) ?? 0
|
|
23842
24094
|
);
|
|
@@ -24550,7 +24802,7 @@ var Invoices = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
|
|
|
24550
24802
|
Invoices.displayName = "Invoices";
|
|
24551
24803
|
|
|
24552
24804
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24553
|
-
var
|
|
24805
|
+
var import_react56 = require("react");
|
|
24554
24806
|
|
|
24555
24807
|
// src/components/elements/metered-features/Meter.tsx
|
|
24556
24808
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
@@ -24678,6 +24930,190 @@ var PriceDetails = ({
|
|
|
24678
24930
|
);
|
|
24679
24931
|
};
|
|
24680
24932
|
|
|
24933
|
+
// src/components/elements/metered-features/UsageByUser.tsx
|
|
24934
|
+
var import_react55 = require("react");
|
|
24935
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
24936
|
+
var COLLAPSED_COUNT = 3;
|
|
24937
|
+
var EXPANDED_COUNT = 20;
|
|
24938
|
+
var toCreditSection = (data) => ({
|
|
24939
|
+
entries: data.entries.map((entry) => ({
|
|
24940
|
+
id: entry.userId,
|
|
24941
|
+
// An entry with no hydrated user record still has an id worth showing —
|
|
24942
|
+
// a blank row identifies nobody.
|
|
24943
|
+
label: entry.user?.name || entry.userId || "",
|
|
24944
|
+
amount: entry.creditsUsed
|
|
24945
|
+
})),
|
|
24946
|
+
total: data.total,
|
|
24947
|
+
totalUsers: data.totalUsers,
|
|
24948
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
|
|
24949
|
+
});
|
|
24950
|
+
var toFeatureSection = (data) => ({
|
|
24951
|
+
entries: data.rows.map((row) => ({
|
|
24952
|
+
id: row.userId,
|
|
24953
|
+
label: row.user?.name || row.userId || "",
|
|
24954
|
+
amount: row.value
|
|
24955
|
+
})),
|
|
24956
|
+
total: data.total,
|
|
24957
|
+
totalUsers: data.totalUsers,
|
|
24958
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
|
|
24959
|
+
});
|
|
24960
|
+
var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
|
|
24961
|
+
var InitialAvatar = ({ label }) => {
|
|
24962
|
+
const { settings } = useEmbed();
|
|
24963
|
+
const isLightBackground = useIsLightBackground();
|
|
24964
|
+
const initial = (label.trim()[0] ?? "?").toUpperCase();
|
|
24965
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
24966
|
+
Flex,
|
|
24967
|
+
{
|
|
24968
|
+
$alignItems: "center",
|
|
24969
|
+
$justifyContent: "center",
|
|
24970
|
+
$width: "1.75rem",
|
|
24971
|
+
$height: "1.75rem",
|
|
24972
|
+
$flexShrink: 0,
|
|
24973
|
+
$borderRadius: "9999px",
|
|
24974
|
+
$background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
|
|
24975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
24976
|
+
Text,
|
|
24977
|
+
{
|
|
24978
|
+
$size: 11,
|
|
24979
|
+
$weight: 500,
|
|
24980
|
+
$color: settings.theme.typography.text.color,
|
|
24981
|
+
children: initial
|
|
24982
|
+
}
|
|
24983
|
+
)
|
|
24984
|
+
}
|
|
24985
|
+
);
|
|
24986
|
+
};
|
|
24987
|
+
var UsageByUser = ({ source, unit }) => {
|
|
24988
|
+
const { t: t4 } = useTranslation();
|
|
24989
|
+
const isLightBackground = useIsLightBackground();
|
|
24990
|
+
const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
|
|
24991
|
+
const [expanded, setExpanded] = (0, import_react55.useState)(false);
|
|
24992
|
+
const [result, setResult] = (0, import_react55.useState)();
|
|
24993
|
+
const [attempt, setAttempt] = (0, import_react55.useState)(0);
|
|
24994
|
+
const { kind, id } = source;
|
|
24995
|
+
const sourceKey = `${kind}:${id}`;
|
|
24996
|
+
const current = result?.sourceKey === sourceKey ? result : void 0;
|
|
24997
|
+
(0, import_react55.useEffect)(() => {
|
|
24998
|
+
let active = true;
|
|
24999
|
+
const apply = (next2) => {
|
|
25000
|
+
if (active) {
|
|
25001
|
+
setResult(next2);
|
|
25002
|
+
}
|
|
25003
|
+
};
|
|
25004
|
+
const receive = (section) => {
|
|
25005
|
+
if (section) {
|
|
25006
|
+
apply({ sourceKey, section });
|
|
25007
|
+
}
|
|
25008
|
+
};
|
|
25009
|
+
const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
|
|
25010
|
+
if (kind === "credit") {
|
|
25011
|
+
getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25012
|
+
(response) => receive(response && toCreditSection(response.data))
|
|
25013
|
+
).catch(fail);
|
|
25014
|
+
} else {
|
|
25015
|
+
getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25016
|
+
(response) => receive(response && toFeatureSection(response.data))
|
|
25017
|
+
).catch(fail);
|
|
25018
|
+
}
|
|
25019
|
+
return () => {
|
|
25020
|
+
active = false;
|
|
25021
|
+
};
|
|
25022
|
+
}, [
|
|
25023
|
+
attempt,
|
|
25024
|
+
getCreditUsageByUser,
|
|
25025
|
+
getFeatureUsageByUser,
|
|
25026
|
+
id,
|
|
25027
|
+
kind,
|
|
25028
|
+
sourceKey
|
|
25029
|
+
]);
|
|
25030
|
+
const entries = current?.section?.entries;
|
|
25031
|
+
const attributed = (0, import_react55.useMemo)(
|
|
25032
|
+
() => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
|
|
25033
|
+
[entries]
|
|
25034
|
+
);
|
|
25035
|
+
const error = current?.error;
|
|
25036
|
+
const total = current?.section?.total ?? 0;
|
|
25037
|
+
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
25038
|
+
const unattributed = current?.section?.unattributed;
|
|
25039
|
+
const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
|
|
25040
|
+
if (error) {
|
|
25041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
25042
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25043
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
|
|
25044
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25045
|
+
Button,
|
|
25046
|
+
{
|
|
25047
|
+
type: "button",
|
|
25048
|
+
onClick: () => setAttempt((prev2) => prev2 + 1),
|
|
25049
|
+
$size: "sm",
|
|
25050
|
+
$variant: "ghost",
|
|
25051
|
+
$fullWidth: false,
|
|
25052
|
+
children: t4("Try again")
|
|
25053
|
+
}
|
|
25054
|
+
)
|
|
25055
|
+
] });
|
|
25056
|
+
}
|
|
25057
|
+
if (attributed.length === 0 && !unattributed) {
|
|
25058
|
+
return null;
|
|
25059
|
+
}
|
|
25060
|
+
const visible = attributed.slice(
|
|
25061
|
+
0,
|
|
25062
|
+
expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
|
|
25063
|
+
);
|
|
25064
|
+
const remaining = Math.max(totalUsers - visible.length, 0);
|
|
25065
|
+
const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
|
|
25066
|
+
const hiddenUsers = Math.max(
|
|
25067
|
+
expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
|
|
25068
|
+
0
|
|
25069
|
+
);
|
|
25070
|
+
const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
|
|
25071
|
+
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");
|
|
25072
|
+
const row = (key, label, amount, muted) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
|
|
25073
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(InitialAvatar, { label: muted ? "?" : label }),
|
|
25074
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25075
|
+
Text,
|
|
25076
|
+
{
|
|
25077
|
+
display: "text",
|
|
25078
|
+
$color: muted ? mutedColor(isLightBackground) : void 0,
|
|
25079
|
+
children: label
|
|
25080
|
+
}
|
|
25081
|
+
) }),
|
|
25082
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25083
|
+
Text,
|
|
25084
|
+
{
|
|
25085
|
+
display: "text",
|
|
25086
|
+
$align: "right",
|
|
25087
|
+
$color: mutedColor(isLightBackground),
|
|
25088
|
+
children: formatAmount(amount)
|
|
25089
|
+
}
|
|
25090
|
+
)
|
|
25091
|
+
] }, key);
|
|
25092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
25093
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25094
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
|
|
25095
|
+
amount: formatAmount(total)
|
|
25096
|
+
}) }) }),
|
|
25097
|
+
visible.map(
|
|
25098
|
+
(entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
|
|
25099
|
+
),
|
|
25100
|
+
expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
|
|
25101
|
+
expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("plus X more", { count: remaining }) }) }),
|
|
25102
|
+
shouldShowToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25103
|
+
ExpandListToggle,
|
|
25104
|
+
{
|
|
25105
|
+
isExpanded: expanded,
|
|
25106
|
+
onToggle: () => setExpanded((prev2) => !prev2),
|
|
25107
|
+
expandLabel,
|
|
25108
|
+
collapseLabel: t4("Show fewer"),
|
|
25109
|
+
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
|
|
25110
|
+
$marginTop: "0.25rem"
|
|
25111
|
+
}
|
|
25112
|
+
)
|
|
25113
|
+
] });
|
|
25114
|
+
};
|
|
25115
|
+
UsageByUser.displayName = "UsageByUser";
|
|
25116
|
+
|
|
24681
25117
|
// src/components/elements/metered-features/styles.ts
|
|
24682
25118
|
var Container2 = gt.div`
|
|
24683
25119
|
display: flex;
|
|
@@ -24696,7 +25132,7 @@ var Container2 = gt.div`
|
|
|
24696
25132
|
`;
|
|
24697
25133
|
|
|
24698
25134
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24699
|
-
var
|
|
25135
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
24700
25136
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
24701
25137
|
const { t: t4 } = useTranslation();
|
|
24702
25138
|
const { data } = useEmbed();
|
|
@@ -24733,9 +25169,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
24733
25169
|
})
|
|
24734
25170
|
);
|
|
24735
25171
|
}
|
|
24736
|
-
return /* @__PURE__ */ (0,
|
|
25172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { display: fontStyle, children: [
|
|
24737
25173
|
acc.join(" \u2022 "),
|
|
24738
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
25174
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24739
25175
|
HardLimitTooltip,
|
|
24740
25176
|
{
|
|
24741
25177
|
feature: entitlement.feature,
|
|
@@ -24765,19 +25201,22 @@ function resolveDesignProps4(props) {
|
|
|
24765
25201
|
isVisible: props.usage?.isVisible ?? true,
|
|
24766
25202
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
24767
25203
|
},
|
|
25204
|
+
usageByUser: {
|
|
25205
|
+
isVisible: props.usageByUser?.isVisible ?? true
|
|
25206
|
+
},
|
|
24768
25207
|
// there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
|
|
24769
25208
|
visibleFeatures: props.visibleFeatures
|
|
24770
25209
|
};
|
|
24771
25210
|
}
|
|
24772
|
-
var MeteredFeatures = (0,
|
|
25211
|
+
var MeteredFeatures = (0, import_react56.forwardRef)(({ className, ...rest }, ref) => {
|
|
24773
25212
|
const props = resolveDesignProps4(rest);
|
|
24774
|
-
const elementsRef = (0,
|
|
25213
|
+
const elementsRef = (0, import_react56.useRef)([]);
|
|
24775
25214
|
const shouldWrapChildren = useWrapChildren(elementsRef);
|
|
24776
25215
|
const { t: t4 } = useTranslation();
|
|
24777
25216
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
24778
25217
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
24779
25218
|
const isLightBackground = useIsLightBackground();
|
|
24780
|
-
const meteredFeatures = (0,
|
|
25219
|
+
const meteredFeatures = (0, import_react56.useMemo)(() => {
|
|
24781
25220
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
24782
25221
|
(acc, id) => {
|
|
24783
25222
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -24794,7 +25233,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24794
25233
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
24795
25234
|
);
|
|
24796
25235
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
24797
|
-
const creditGroups = (0,
|
|
25236
|
+
const creditGroups = (0, import_react56.useMemo)(
|
|
24798
25237
|
() => withEmptyPlanCreditBalances(
|
|
24799
25238
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
24800
25239
|
listPlanCredits(
|
|
@@ -24805,11 +25244,11 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24805
25244
|
),
|
|
24806
25245
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
24807
25246
|
);
|
|
24808
|
-
const planCreditCompositions = (0,
|
|
25247
|
+
const planCreditCompositions = (0, import_react56.useMemo)(
|
|
24809
25248
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
24810
25249
|
[data?.company?.plan?.includedCreditGrants]
|
|
24811
25250
|
);
|
|
24812
|
-
const resolveLicenseQuantity = (0,
|
|
25251
|
+
const resolveLicenseQuantity = (0, import_react56.useCallback)(
|
|
24813
25252
|
(licenseId) => {
|
|
24814
25253
|
const allocation = findLicenseSource(
|
|
24815
25254
|
data?.featureUsage?.features ?? [],
|
|
@@ -24819,17 +25258,17 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24819
25258
|
},
|
|
24820
25259
|
[data?.featureUsage?.features]
|
|
24821
25260
|
);
|
|
24822
|
-
const purchasableCreditIds = (0,
|
|
25261
|
+
const purchasableCreditIds = (0, import_react56.useMemo)(
|
|
24823
25262
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
24824
25263
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
24825
25264
|
);
|
|
24826
|
-
const [expandedCreditIds, setExpandedCreditIds] = (0,
|
|
25265
|
+
const [expandedCreditIds, setExpandedCreditIds] = (0, import_react56.useState)(
|
|
24827
25266
|
() => /* @__PURE__ */ new Set()
|
|
24828
25267
|
);
|
|
24829
|
-
const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0,
|
|
25268
|
+
const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react56.useState)(
|
|
24830
25269
|
() => /* @__PURE__ */ new Set()
|
|
24831
25270
|
);
|
|
24832
|
-
const toggleFullLedger = (0,
|
|
25271
|
+
const toggleFullLedger = (0, import_react56.useCallback)((id) => {
|
|
24833
25272
|
setFullLedgerCreditIds((prev2) => {
|
|
24834
25273
|
const next2 = new Set(prev2);
|
|
24835
25274
|
if (next2.has(id)) {
|
|
@@ -24840,7 +25279,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24840
25279
|
return next2;
|
|
24841
25280
|
});
|
|
24842
25281
|
}, []);
|
|
24843
|
-
const toggleBalanceDetails = (0,
|
|
25282
|
+
const toggleBalanceDetails = (0, import_react56.useCallback)((id) => {
|
|
24844
25283
|
setExpandedCreditIds((prev2) => {
|
|
24845
25284
|
const next2 = new Set(prev2);
|
|
24846
25285
|
if (next2.has(id)) {
|
|
@@ -24866,7 +25305,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24866
25305
|
const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
|
|
24867
25306
|
const canCheckout = data?.capabilities?.checkout ?? false;
|
|
24868
25307
|
const showCredits = data?.displaySettings?.showCredits ?? true;
|
|
24869
|
-
return /* @__PURE__ */ (0,
|
|
25308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Container2, { ref, className, children: [
|
|
24870
25309
|
meteredFeatures.reduce((acc, entitlement, index) => {
|
|
24871
25310
|
if (!entitlement.feature) {
|
|
24872
25311
|
return acc;
|
|
@@ -24877,9 +25316,9 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24877
25316
|
});
|
|
24878
25317
|
const { limit } = usageDetails;
|
|
24879
25318
|
acc.push(
|
|
24880
|
-
/* @__PURE__ */ (0,
|
|
24881
|
-
/* @__PURE__ */ (0,
|
|
24882
|
-
props.icon.isVisible && /* @__PURE__ */ (0,
|
|
25319
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
25320
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
|
|
25321
|
+
props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24883
25322
|
Icon3,
|
|
24884
25323
|
{
|
|
24885
25324
|
name: feature.icon,
|
|
@@ -24888,8 +25327,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24888
25327
|
rounded: true
|
|
24889
25328
|
}
|
|
24890
25329
|
),
|
|
24891
|
-
/* @__PURE__ */ (0,
|
|
24892
|
-
/* @__PURE__ */ (0,
|
|
25330
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25331
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
24893
25332
|
Flex,
|
|
24894
25333
|
{
|
|
24895
25334
|
ref: (el) => {
|
|
@@ -24900,31 +25339,31 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24900
25339
|
$flexWrap: "wrap",
|
|
24901
25340
|
$gap: "1rem",
|
|
24902
25341
|
children: [
|
|
24903
|
-
/* @__PURE__ */ (0,
|
|
24904
|
-
/* @__PURE__ */ (0,
|
|
24905
|
-
props.description.isVisible && feature.description && /* @__PURE__ */ (0,
|
|
25342
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25343
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
25344
|
+
props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
24906
25345
|
] }),
|
|
24907
|
-
/* @__PURE__ */ (0,
|
|
25346
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
24908
25347
|
Box,
|
|
24909
25348
|
{
|
|
24910
25349
|
$flexBasis: "min-content",
|
|
24911
25350
|
$flexGrow: 1,
|
|
24912
25351
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
24913
25352
|
children: [
|
|
24914
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
24915
|
-
typeof limit === "number" && /* @__PURE__ */ (0,
|
|
25353
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25354
|
+
typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
24916
25355
|
formatNumber(limit),
|
|
24917
25356
|
" "
|
|
24918
25357
|
] }),
|
|
24919
25358
|
getFeatureName(feature, limit)
|
|
24920
|
-
] }) : typeof usage === "number" && /* @__PURE__ */ (0,
|
|
25359
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
24921
25360
|
formatNumber(usage),
|
|
24922
25361
|
" ",
|
|
24923
25362
|
getFeatureName(feature, usage),
|
|
24924
25363
|
" ",
|
|
24925
25364
|
t4("used")
|
|
24926
25365
|
] }) }) }),
|
|
24927
|
-
props.allocation.isVisible && /* @__PURE__ */ (0,
|
|
25366
|
+
props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24928
25367
|
Limit,
|
|
24929
25368
|
{
|
|
24930
25369
|
entitlement,
|
|
@@ -24938,8 +25377,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24938
25377
|
]
|
|
24939
25378
|
}
|
|
24940
25379
|
),
|
|
24941
|
-
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0,
|
|
24942
|
-
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
25380
|
+
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Meter, { entitlement }),
|
|
25381
|
+
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24943
25382
|
Button,
|
|
24944
25383
|
{
|
|
24945
25384
|
type: "button",
|
|
@@ -24952,13 +25391,24 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24952
25391
|
)
|
|
24953
25392
|
] })
|
|
24954
25393
|
] }),
|
|
24955
|
-
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0,
|
|
25394
|
+
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24956
25395
|
PriceDetails,
|
|
24957
25396
|
{
|
|
24958
25397
|
entitlement,
|
|
24959
25398
|
usageDetails,
|
|
24960
25399
|
period
|
|
24961
25400
|
}
|
|
25401
|
+
),
|
|
25402
|
+
props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
|
|
25403
|
+
// they are denominated in the feature's own unit — the same one
|
|
25404
|
+
// the usage line above uses. A credit-burndown feature's credit
|
|
25405
|
+
// spend is broken down separately, under its credit.
|
|
25406
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25407
|
+
UsageByUser,
|
|
25408
|
+
{
|
|
25409
|
+
source: { kind: "feature", id: feature.id },
|
|
25410
|
+
unit: feature
|
|
25411
|
+
}
|
|
24962
25412
|
)
|
|
24963
25413
|
] }, index)
|
|
24964
25414
|
);
|
|
@@ -24972,9 +25422,9 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24972
25422
|
const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
|
|
24973
25423
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
24974
25424
|
const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
|
|
24975
|
-
return /* @__PURE__ */ (0,
|
|
24976
|
-
/* @__PURE__ */ (0,
|
|
24977
|
-
props.icon.isVisible && /* @__PURE__ */ (0,
|
|
25425
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
25426
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
|
|
25427
|
+
props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
24978
25428
|
Icon3,
|
|
24979
25429
|
{
|
|
24980
25430
|
name: credit.icon,
|
|
@@ -24983,13 +25433,13 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
24983
25433
|
rounded: true
|
|
24984
25434
|
}
|
|
24985
25435
|
),
|
|
24986
|
-
/* @__PURE__ */ (0,
|
|
24987
|
-
/* @__PURE__ */ (0,
|
|
24988
|
-
/* @__PURE__ */ (0,
|
|
24989
|
-
props.description.isVisible && credit.description && /* @__PURE__ */ (0,
|
|
25436
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25437
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25438
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
25439
|
+
props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
24990
25440
|
] }) }),
|
|
24991
|
-
/* @__PURE__ */ (0,
|
|
24992
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
25441
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
|
|
25442
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
|
|
24993
25443
|
// Balances burn at rates with up to 10 decimal
|
|
24994
25444
|
// places, so a small remainder must not round to 0.
|
|
24995
25445
|
amount: formatNumber(credit.total.remaining, {
|
|
@@ -25000,7 +25450,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25000
25450
|
credit.total.remaining
|
|
25001
25451
|
)
|
|
25002
25452
|
}) }) }),
|
|
25003
|
-
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0,
|
|
25453
|
+
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25004
25454
|
Button,
|
|
25005
25455
|
{
|
|
25006
25456
|
type: "button",
|
|
@@ -25053,7 +25503,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25053
25503
|
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
25054
25504
|
return (
|
|
25055
25505
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
25056
|
-
/* @__PURE__ */ (0,
|
|
25506
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25057
25507
|
Text,
|
|
25058
25508
|
{
|
|
25059
25509
|
style: { opacity: 0.54 },
|
|
@@ -25066,7 +25516,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25066
25516
|
period: shortenPeriod(composition.period),
|
|
25067
25517
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25068
25518
|
}),
|
|
25069
|
-
renewalDate && /* @__PURE__ */ (0,
|
|
25519
|
+
renewalDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25070
25520
|
" ",
|
|
25071
25521
|
t4("Renews on the day", {
|
|
25072
25522
|
day: formatOrdinal(renewalDate.getDate())
|
|
@@ -25079,12 +25529,12 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25079
25529
|
})()
|
|
25080
25530
|
] })
|
|
25081
25531
|
] }),
|
|
25082
|
-
hasGrants && /* @__PURE__ */ (0,
|
|
25532
|
+
hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25083
25533
|
Box,
|
|
25084
25534
|
{
|
|
25085
25535
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
25086
25536
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
25087
|
-
children: /* @__PURE__ */ (0,
|
|
25537
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25088
25538
|
TransitionBox,
|
|
25089
25539
|
{
|
|
25090
25540
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -25092,22 +25542,22 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25092
25542
|
children: [
|
|
25093
25543
|
visibleGrants.map((grant, index2) => {
|
|
25094
25544
|
const padding = getRowPadding(index2);
|
|
25095
|
-
return /* @__PURE__ */ (0,
|
|
25096
|
-
/* @__PURE__ */ (0,
|
|
25545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25546
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("X items included in plan", {
|
|
25097
25547
|
amount: grant.quantity,
|
|
25098
25548
|
item: getFeatureName(
|
|
25099
25549
|
credit,
|
|
25100
25550
|
grant.quantity
|
|
25101
25551
|
)
|
|
25102
25552
|
}) }) }),
|
|
25103
|
-
/* @__PURE__ */ (0,
|
|
25553
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25104
25554
|
Box,
|
|
25105
25555
|
{
|
|
25106
25556
|
$display: "table-cell",
|
|
25107
25557
|
$padding: padding,
|
|
25108
25558
|
$textAlign: "right",
|
|
25109
25559
|
$whiteSpace: "nowrap",
|
|
25110
|
-
children: grant.expiresAt && /* @__PURE__ */ (0,
|
|
25560
|
+
children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("Resets", {
|
|
25111
25561
|
date: toPrettyDate(
|
|
25112
25562
|
modifyDate(grant.expiresAt, 1),
|
|
25113
25563
|
{ month: "short" }
|
|
@@ -25115,15 +25565,15 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25115
25565
|
}) })
|
|
25116
25566
|
}
|
|
25117
25567
|
)
|
|
25118
|
-
] }) : /* @__PURE__ */ (0,
|
|
25119
|
-
/* @__PURE__ */ (0,
|
|
25568
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25569
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item bundle", {
|
|
25120
25570
|
amount: grant.quantity,
|
|
25121
25571
|
item: getFeatureName(credit, 1),
|
|
25122
25572
|
createdAt: toPrettyDate(
|
|
25123
25573
|
grant.createdAt,
|
|
25124
25574
|
{ month: "short" }
|
|
25125
25575
|
)
|
|
25126
|
-
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0,
|
|
25576
|
+
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item auto-topup", {
|
|
25127
25577
|
amount: grant.quantity,
|
|
25128
25578
|
item: getFeatureName(
|
|
25129
25579
|
credit,
|
|
@@ -25133,7 +25583,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25133
25583
|
grant.createdAt,
|
|
25134
25584
|
{ month: "short" }
|
|
25135
25585
|
)
|
|
25136
|
-
}) }) : /* @__PURE__ */ (0,
|
|
25586
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item grant", {
|
|
25137
25587
|
amount: grant.quantity,
|
|
25138
25588
|
item: getFeatureName(
|
|
25139
25589
|
credit,
|
|
@@ -25144,14 +25594,14 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25144
25594
|
{ month: "short" }
|
|
25145
25595
|
)
|
|
25146
25596
|
}) }) }) }),
|
|
25147
|
-
/* @__PURE__ */ (0,
|
|
25597
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25148
25598
|
Box,
|
|
25149
25599
|
{
|
|
25150
25600
|
$display: "table-cell",
|
|
25151
25601
|
$padding: padding,
|
|
25152
25602
|
$textAlign: "right",
|
|
25153
25603
|
$whiteSpace: "nowrap",
|
|
25154
|
-
children: grant.expiresAt && /* @__PURE__ */ (0,
|
|
25604
|
+
children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("Expires", {
|
|
25155
25605
|
date: toPrettyDate(
|
|
25156
25606
|
modifyDate(grant.expiresAt, 1),
|
|
25157
25607
|
{ month: "short" }
|
|
@@ -25161,8 +25611,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25161
25611
|
)
|
|
25162
25612
|
] }) }, grant.id);
|
|
25163
25613
|
}),
|
|
25164
|
-
canExpandLedger && /* @__PURE__ */ (0,
|
|
25165
|
-
/* @__PURE__ */ (0,
|
|
25614
|
+
canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $display: "table-row", children: [
|
|
25615
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25166
25616
|
ExpandListToggle,
|
|
25167
25617
|
{
|
|
25168
25618
|
isExpanded: showAllGrants,
|
|
@@ -25171,7 +25621,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25171
25621
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25172
25622
|
}
|
|
25173
25623
|
) }),
|
|
25174
|
-
/* @__PURE__ */ (0,
|
|
25624
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25175
25625
|
Box,
|
|
25176
25626
|
{
|
|
25177
25627
|
$display: "table-cell",
|
|
@@ -25184,7 +25634,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25184
25634
|
)
|
|
25185
25635
|
}
|
|
25186
25636
|
),
|
|
25187
|
-
hasGrants && /* @__PURE__ */ (0,
|
|
25637
|
+
hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25188
25638
|
ExpandListToggle,
|
|
25189
25639
|
{
|
|
25190
25640
|
isExpanded,
|
|
@@ -25193,6 +25643,13 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25193
25643
|
collapseLabel: t4("Hide balance details"),
|
|
25194
25644
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25195
25645
|
}
|
|
25646
|
+
),
|
|
25647
|
+
props.usageByUser.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25648
|
+
UsageByUser,
|
|
25649
|
+
{
|
|
25650
|
+
source: { kind: "credit", id: credit.id },
|
|
25651
|
+
unit: credit
|
|
25652
|
+
}
|
|
25196
25653
|
)
|
|
25197
25654
|
] }, index);
|
|
25198
25655
|
})
|
|
@@ -25201,11 +25658,11 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
|
|
|
25201
25658
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
25202
25659
|
|
|
25203
25660
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25204
|
-
var
|
|
25661
|
+
var import_react58 = require("react");
|
|
25205
25662
|
|
|
25206
25663
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
25207
|
-
var
|
|
25208
|
-
var
|
|
25664
|
+
var import_react57 = require("react");
|
|
25665
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
25209
25666
|
var PaymentElement2 = ({
|
|
25210
25667
|
iconName,
|
|
25211
25668
|
iconTitle,
|
|
@@ -25213,8 +25670,8 @@ var PaymentElement2 = ({
|
|
|
25213
25670
|
paymentLast4
|
|
25214
25671
|
}) => {
|
|
25215
25672
|
const { settings } = useEmbed();
|
|
25216
|
-
return /* @__PURE__ */ (0,
|
|
25217
|
-
iconName && /* @__PURE__ */ (0,
|
|
25673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
25674
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25218
25675
|
Icon3,
|
|
25219
25676
|
{
|
|
25220
25677
|
name: iconName,
|
|
@@ -25222,15 +25679,15 @@ var PaymentElement2 = ({
|
|
|
25222
25679
|
color: settings.theme.typography.text.color
|
|
25223
25680
|
}
|
|
25224
25681
|
),
|
|
25225
|
-
(label || paymentLast4) && /* @__PURE__ */ (0,
|
|
25226
|
-
label && /* @__PURE__ */ (0,
|
|
25682
|
+
(label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
|
|
25683
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
|
|
25227
25684
|
" ",
|
|
25228
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
25685
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
|
|
25229
25686
|
] })
|
|
25230
25687
|
] });
|
|
25231
25688
|
};
|
|
25232
25689
|
var EmptyPaymentElement = () => {
|
|
25233
|
-
return /* @__PURE__ */ (0,
|
|
25690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
|
|
25234
25691
|
};
|
|
25235
25692
|
var getPaymentMethodData = ({
|
|
25236
25693
|
accountLast4,
|
|
@@ -25310,12 +25767,12 @@ var PaymentMethodElement = ({
|
|
|
25310
25767
|
const isLightBackground = useIsLightBackground();
|
|
25311
25768
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
25312
25769
|
const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
|
|
25313
|
-
return /* @__PURE__ */ (0,
|
|
25314
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
25315
|
-
/* @__PURE__ */ (0,
|
|
25316
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0,
|
|
25770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
25771
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
25772
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
|
|
25773
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
|
|
25317
25774
|
] }),
|
|
25318
|
-
/* @__PURE__ */ (0,
|
|
25775
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
25319
25776
|
Flex,
|
|
25320
25777
|
{
|
|
25321
25778
|
$justifyContent: "space-between",
|
|
@@ -25324,8 +25781,8 @@ var PaymentMethodElement = ({
|
|
|
25324
25781
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
25325
25782
|
$borderRadius: "9999px",
|
|
25326
25783
|
children: [
|
|
25327
|
-
paymentMethod ? /* @__PURE__ */ (0,
|
|
25328
|
-
onRemove && /* @__PURE__ */ (0,
|
|
25784
|
+
paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EmptyPaymentElement, {}),
|
|
25785
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25329
25786
|
Text,
|
|
25330
25787
|
{
|
|
25331
25788
|
onClick: onRemove,
|
|
@@ -25335,7 +25792,7 @@ var PaymentMethodElement = ({
|
|
|
25335
25792
|
children: t4("Remove")
|
|
25336
25793
|
}
|
|
25337
25794
|
),
|
|
25338
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
25795
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25339
25796
|
Text,
|
|
25340
25797
|
{
|
|
25341
25798
|
onClick: onEdit,
|
|
@@ -25348,8 +25805,8 @@ var PaymentMethodElement = ({
|
|
|
25348
25805
|
]
|
|
25349
25806
|
}
|
|
25350
25807
|
),
|
|
25351
|
-
hasCustomFields && /* @__PURE__ */ (0,
|
|
25352
|
-
/* @__PURE__ */ (0,
|
|
25808
|
+
hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
|
|
25809
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25353
25810
|
Text,
|
|
25354
25811
|
{
|
|
25355
25812
|
$size: 12,
|
|
@@ -25357,7 +25814,7 @@ var PaymentMethodElement = ({
|
|
|
25357
25814
|
children: field.name
|
|
25358
25815
|
}
|
|
25359
25816
|
),
|
|
25360
|
-
/* @__PURE__ */ (0,
|
|
25817
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25361
25818
|
"span",
|
|
25362
25819
|
{
|
|
25363
25820
|
style: {
|
|
@@ -25378,7 +25835,7 @@ var PaymentListElement = ({
|
|
|
25378
25835
|
const { settings } = useEmbed();
|
|
25379
25836
|
const isLightBackground = useIsLightBackground();
|
|
25380
25837
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
25381
|
-
const expirationDate = (0,
|
|
25838
|
+
const expirationDate = (0, import_react57.useMemo)(() => {
|
|
25382
25839
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
25383
25840
|
if (!cardExpMonth || !cardExpYear) {
|
|
25384
25841
|
return;
|
|
@@ -25389,7 +25846,7 @@ var PaymentListElement = ({
|
|
|
25389
25846
|
}
|
|
25390
25847
|
return `${cardExpMonth}/${formatedYear}`;
|
|
25391
25848
|
}, [paymentMethod]);
|
|
25392
|
-
return /* @__PURE__ */ (0,
|
|
25849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
25393
25850
|
Flex,
|
|
25394
25851
|
{
|
|
25395
25852
|
$flexDirection: "row",
|
|
@@ -25401,7 +25858,7 @@ var PaymentListElement = ({
|
|
|
25401
25858
|
$borderStyle: "solid",
|
|
25402
25859
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
25403
25860
|
children: [
|
|
25404
|
-
iconName && /* @__PURE__ */ (0,
|
|
25861
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25405
25862
|
Icon3,
|
|
25406
25863
|
{
|
|
25407
25864
|
name: iconName,
|
|
@@ -25409,20 +25866,20 @@ var PaymentListElement = ({
|
|
|
25409
25866
|
color: settings.theme.typography.text.color
|
|
25410
25867
|
}
|
|
25411
25868
|
),
|
|
25412
|
-
(label || paymentLast4) && /* @__PURE__ */ (0,
|
|
25413
|
-
label && /* @__PURE__ */ (0,
|
|
25869
|
+
(label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
|
|
25870
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
|
|
25414
25871
|
" ",
|
|
25415
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
25872
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
|
|
25416
25873
|
] }),
|
|
25417
|
-
expirationDate && /* @__PURE__ */ (0,
|
|
25874
|
+
expirationDate && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25418
25875
|
Box,
|
|
25419
25876
|
{
|
|
25420
25877
|
$flexGrow: 1,
|
|
25421
25878
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
25422
|
-
children: /* @__PURE__ */ (0,
|
|
25879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
|
|
25423
25880
|
}
|
|
25424
25881
|
),
|
|
25425
|
-
/* @__PURE__ */ (0,
|
|
25882
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25426
25883
|
Text,
|
|
25427
25884
|
{
|
|
25428
25885
|
onClick: () => {
|
|
@@ -25435,7 +25892,7 @@ var PaymentListElement = ({
|
|
|
25435
25892
|
children: t("Set default")
|
|
25436
25893
|
}
|
|
25437
25894
|
) }),
|
|
25438
|
-
/* @__PURE__ */ (0,
|
|
25895
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25439
25896
|
Icon3,
|
|
25440
25897
|
{
|
|
25441
25898
|
tabIndex: 0,
|
|
@@ -25457,7 +25914,7 @@ var PaymentListElement = ({
|
|
|
25457
25914
|
};
|
|
25458
25915
|
|
|
25459
25916
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25460
|
-
var
|
|
25917
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
25461
25918
|
var resolveDesignProps5 = (props) => {
|
|
25462
25919
|
return {
|
|
25463
25920
|
header: {
|
|
@@ -25470,10 +25927,10 @@ var resolveDesignProps5 = (props) => {
|
|
|
25470
25927
|
}
|
|
25471
25928
|
};
|
|
25472
25929
|
};
|
|
25473
|
-
var PaymentMethod = (0,
|
|
25930
|
+
var PaymentMethod = (0, import_react58.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
25474
25931
|
const props = resolveDesignProps5(rest);
|
|
25475
25932
|
const { data, setLayout } = useEmbed();
|
|
25476
|
-
const { paymentMethod, monthsToExpiration } = (0,
|
|
25933
|
+
const { paymentMethod, monthsToExpiration } = (0, import_react58.useMemo)(() => {
|
|
25477
25934
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
25478
25935
|
let monthsToExpiration2;
|
|
25479
25936
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -25492,7 +25949,7 @@ var PaymentMethod = (0, import_react57.forwardRef)(({ children, className, porta
|
|
|
25492
25949
|
monthsToExpiration: monthsToExpiration2
|
|
25493
25950
|
};
|
|
25494
25951
|
}, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
|
|
25495
|
-
return /* @__PURE__ */ (0,
|
|
25952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
25496
25953
|
PaymentMethodElement,
|
|
25497
25954
|
{
|
|
25498
25955
|
customCheckoutFields: data?.customCheckoutFields,
|
|
@@ -25508,7 +25965,7 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
25508
25965
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25509
25966
|
var import_react_stripe_js2 = require("@stripe/react-stripe-js");
|
|
25510
25967
|
|
|
25511
|
-
// node_modules/.pnpm/@stripe+stripe-js@9.
|
|
25968
|
+
// node_modules/.pnpm/@stripe+stripe-js@9.15.0/node_modules/@stripe/stripe-js/dist/index.mjs
|
|
25512
25969
|
function _typeof(obj) {
|
|
25513
25970
|
"@babel/helpers - typeof";
|
|
25514
25971
|
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
@@ -25562,7 +26019,7 @@ var registerWrapper = function registerWrapper2(stripe, startTime) {
|
|
|
25562
26019
|
}
|
|
25563
26020
|
stripe._registerWrapper({
|
|
25564
26021
|
name: "stripe-js",
|
|
25565
|
-
version: "9.
|
|
26022
|
+
version: "9.15.0",
|
|
25566
26023
|
startTime
|
|
25567
26024
|
});
|
|
25568
26025
|
};
|
|
@@ -25640,7 +26097,7 @@ var initStripe = function initStripe2(maybeStripe, args, startTime) {
|
|
|
25640
26097
|
var version = runtimeVersionToUrlVersion(maybeStripe.version);
|
|
25641
26098
|
var expectedVersion = RELEASE_TRAIN;
|
|
25642
26099
|
if (isTestKey && version !== expectedVersion) {
|
|
25643
|
-
console.warn("Stripe.js@".concat(version, " was loaded on the page, but @stripe/stripe-js@").concat("9.
|
|
26100
|
+
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"));
|
|
25644
26101
|
}
|
|
25645
26102
|
var stripe = maybeStripe.apply(void 0, args);
|
|
25646
26103
|
registerWrapper(stripe, startTime);
|
|
@@ -25677,8 +26134,8 @@ var loadStripe = function loadStripe2() {
|
|
|
25677
26134
|
};
|
|
25678
26135
|
|
|
25679
26136
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25680
|
-
var
|
|
25681
|
-
var
|
|
26137
|
+
var import_react59 = require("react");
|
|
26138
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
25682
26139
|
var resolveDesignProps6 = () => {
|
|
25683
26140
|
return {
|
|
25684
26141
|
header: {
|
|
@@ -25706,7 +26163,7 @@ var PaymentMethodDetails = ({
|
|
|
25706
26163
|
updatePaymentMethod,
|
|
25707
26164
|
deletePaymentMethod
|
|
25708
26165
|
} = useEmbed();
|
|
25709
|
-
const { defaultPaymentMethod, paymentMethods, subscription } = (0,
|
|
26166
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react59.useMemo)(() => {
|
|
25710
26167
|
return {
|
|
25711
26168
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
25712
26169
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -25719,13 +26176,13 @@ var PaymentMethodDetails = ({
|
|
|
25719
26176
|
]);
|
|
25720
26177
|
const isLightBackground = useIsLightBackground();
|
|
25721
26178
|
const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
|
|
25722
|
-
const [isLoading, setIsLoading] = (0,
|
|
25723
|
-
const [error, setError] = (0,
|
|
25724
|
-
const [showPaymentForm, setShowPaymentForm] = (0,
|
|
25725
|
-
const [stripe, setStripe] = (0,
|
|
25726
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
25727
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0,
|
|
25728
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] = (0,
|
|
26179
|
+
const [isLoading, setIsLoading] = (0, import_react59.useState)(!initialPaymentMethod);
|
|
26180
|
+
const [error, setError] = (0, import_react59.useState)();
|
|
26181
|
+
const [showPaymentForm, setShowPaymentForm] = (0, import_react59.useState)(false);
|
|
26182
|
+
const [stripe, setStripe] = (0, import_react59.useState)(null);
|
|
26183
|
+
const [setupIntent, setSetupIntent] = (0, import_react59.useState)();
|
|
26184
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react59.useState)(false);
|
|
26185
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react59.useState)(initialPaymentMethod);
|
|
25729
26186
|
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
25730
26187
|
stripe,
|
|
25731
26188
|
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
@@ -25738,7 +26195,7 @@ var PaymentMethodDetails = ({
|
|
|
25738
26195
|
},
|
|
25739
26196
|
autoConfirm: true
|
|
25740
26197
|
});
|
|
25741
|
-
const monthsToExpiration = (0,
|
|
26198
|
+
const monthsToExpiration = (0, import_react59.useMemo)(() => {
|
|
25742
26199
|
let expiration;
|
|
25743
26200
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
25744
26201
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -25761,8 +26218,8 @@ var PaymentMethodDetails = ({
|
|
|
25761
26218
|
const toggleShowPaymentMethods = () => {
|
|
25762
26219
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
25763
26220
|
};
|
|
25764
|
-
const locale = (0,
|
|
25765
|
-
const initializeStripe = (0,
|
|
26221
|
+
const locale = (0, import_react59.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
|
|
26222
|
+
const initializeStripe = (0, import_react59.useCallback)(() => {
|
|
25766
26223
|
if (stripe || !setupIntent) {
|
|
25767
26224
|
return;
|
|
25768
26225
|
}
|
|
@@ -25785,7 +26242,7 @@ var PaymentMethodDetails = ({
|
|
|
25785
26242
|
setShowPaymentForm(false);
|
|
25786
26243
|
});
|
|
25787
26244
|
}, [t4, stripe, setupIntent, locale]);
|
|
25788
|
-
const initializePaymentMethod = (0,
|
|
26245
|
+
const initializePaymentMethod = (0, import_react59.useCallback)(() => {
|
|
25789
26246
|
const pending = createSetupIntent() ?? Promise.resolve(void 0);
|
|
25790
26247
|
return pending.then((response) => {
|
|
25791
26248
|
if (response) {
|
|
@@ -25800,7 +26257,7 @@ var PaymentMethodDetails = ({
|
|
|
25800
26257
|
setIsLoading(false);
|
|
25801
26258
|
});
|
|
25802
26259
|
}, [t4, createSetupIntent]);
|
|
25803
|
-
const handleUpdatePaymentMethod = (0,
|
|
26260
|
+
const handleUpdatePaymentMethod = (0, import_react59.useCallback)(
|
|
25804
26261
|
async (paymentMethodId) => {
|
|
25805
26262
|
try {
|
|
25806
26263
|
setIsLoading(true);
|
|
@@ -25822,7 +26279,7 @@ var PaymentMethodDetails = ({
|
|
|
25822
26279
|
},
|
|
25823
26280
|
[t4, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
|
|
25824
26281
|
);
|
|
25825
|
-
const handleDeletePaymentMethod = (0,
|
|
26282
|
+
const handleDeletePaymentMethod = (0, import_react59.useCallback)(
|
|
25826
26283
|
async (paymentMethodId) => {
|
|
25827
26284
|
try {
|
|
25828
26285
|
setIsLoading(true);
|
|
@@ -25838,10 +26295,10 @@ var PaymentMethodDetails = ({
|
|
|
25838
26295
|
},
|
|
25839
26296
|
[t4, deletePaymentMethod]
|
|
25840
26297
|
);
|
|
25841
|
-
(0,
|
|
26298
|
+
(0, import_react59.useEffect)(() => {
|
|
25842
26299
|
initializeStripe();
|
|
25843
26300
|
}, [initializeStripe]);
|
|
25844
|
-
(0,
|
|
26301
|
+
(0, import_react59.useEffect)(() => {
|
|
25845
26302
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
25846
26303
|
initializePaymentMethod();
|
|
25847
26304
|
}
|
|
@@ -25851,7 +26308,7 @@ var PaymentMethodDetails = ({
|
|
|
25851
26308
|
showPaymentForm,
|
|
25852
26309
|
initializePaymentMethod
|
|
25853
26310
|
]);
|
|
25854
|
-
return /* @__PURE__ */ (0,
|
|
26311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
25855
26312
|
Flex,
|
|
25856
26313
|
{
|
|
25857
26314
|
$position: "relative",
|
|
@@ -25859,7 +26316,7 @@ var PaymentMethodDetails = ({
|
|
|
25859
26316
|
$flexGrow: 1,
|
|
25860
26317
|
$gap: "1.5rem",
|
|
25861
26318
|
children: [
|
|
25862
|
-
/* @__PURE__ */ (0,
|
|
26319
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25863
26320
|
Flex,
|
|
25864
26321
|
{
|
|
25865
26322
|
$position: "absolute",
|
|
@@ -25868,7 +26325,7 @@ var PaymentMethodDetails = ({
|
|
|
25868
26325
|
$alignItems: "center",
|
|
25869
26326
|
$width: "100%",
|
|
25870
26327
|
$height: "100%",
|
|
25871
|
-
children: /* @__PURE__ */ (0,
|
|
26328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25872
26329
|
Loader,
|
|
25873
26330
|
{
|
|
25874
26331
|
$color: settings.theme.primary,
|
|
@@ -25878,7 +26335,7 @@ var PaymentMethodDetails = ({
|
|
|
25878
26335
|
)
|
|
25879
26336
|
}
|
|
25880
26337
|
),
|
|
25881
|
-
/* @__PURE__ */ (0,
|
|
26338
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
25882
26339
|
Flex,
|
|
25883
26340
|
{
|
|
25884
26341
|
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
@@ -25895,7 +26352,7 @@ var PaymentMethodDetails = ({
|
|
|
25895
26352
|
}
|
|
25896
26353
|
},
|
|
25897
26354
|
children: [
|
|
25898
|
-
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0,
|
|
26355
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
25899
26356
|
import_react_stripe_js2.Elements,
|
|
25900
26357
|
{
|
|
25901
26358
|
stripe,
|
|
@@ -25926,7 +26383,7 @@ var PaymentMethodDetails = ({
|
|
|
25926
26383
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
25927
26384
|
},
|
|
25928
26385
|
children: [
|
|
25929
|
-
/* @__PURE__ */ (0,
|
|
26386
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25930
26387
|
PaymentForm,
|
|
25931
26388
|
{
|
|
25932
26389
|
financeData,
|
|
@@ -25937,7 +26394,7 @@ var PaymentMethodDetails = ({
|
|
|
25937
26394
|
}
|
|
25938
26395
|
}
|
|
25939
26396
|
),
|
|
25940
|
-
currentPaymentMethod && /* @__PURE__ */ (0,
|
|
26397
|
+
currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25941
26398
|
Text,
|
|
25942
26399
|
{
|
|
25943
26400
|
onClick: focusExistingPaymentMethods,
|
|
@@ -25950,8 +26407,8 @@ var PaymentMethodDetails = ({
|
|
|
25950
26407
|
) })
|
|
25951
26408
|
]
|
|
25952
26409
|
}
|
|
25953
|
-
) : /* @__PURE__ */ (0,
|
|
25954
|
-
/* @__PURE__ */ (0,
|
|
26410
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
26411
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25955
26412
|
PaymentMethodElement,
|
|
25956
26413
|
{
|
|
25957
26414
|
paymentMethod: currentPaymentMethod,
|
|
@@ -25964,8 +26421,8 @@ var PaymentMethodDetails = ({
|
|
|
25964
26421
|
...props
|
|
25965
26422
|
}
|
|
25966
26423
|
),
|
|
25967
|
-
paymentMethods.length > 0 && /* @__PURE__ */ (0,
|
|
25968
|
-
/* @__PURE__ */ (0,
|
|
26424
|
+
paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
26425
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25969
26426
|
Text,
|
|
25970
26427
|
{
|
|
25971
26428
|
onClick: toggleShowPaymentMethods,
|
|
@@ -25976,7 +26433,7 @@ var PaymentMethodDetails = ({
|
|
|
25976
26433
|
children: t4("Choose different payment method")
|
|
25977
26434
|
}
|
|
25978
26435
|
),
|
|
25979
|
-
/* @__PURE__ */ (0,
|
|
26436
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25980
26437
|
Icon3,
|
|
25981
26438
|
{
|
|
25982
26439
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
|
|
@@ -25984,10 +26441,10 @@ var PaymentMethodDetails = ({
|
|
|
25984
26441
|
}
|
|
25985
26442
|
)
|
|
25986
26443
|
] }),
|
|
25987
|
-
showDifferentPaymentMethods && /* @__PURE__ */ (0,
|
|
25988
|
-
paymentMethods.length > 1 && /* @__PURE__ */ (0,
|
|
26444
|
+
showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
26445
|
+
paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
25989
26446
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
25990
|
-
) || []).map((paymentMethod) => /* @__PURE__ */ (0,
|
|
26447
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
25991
26448
|
PaymentListElement,
|
|
25992
26449
|
{
|
|
25993
26450
|
paymentMethod,
|
|
@@ -25996,7 +26453,7 @@ var PaymentMethodDetails = ({
|
|
|
25996
26453
|
},
|
|
25997
26454
|
paymentMethod.id
|
|
25998
26455
|
)) }),
|
|
25999
|
-
/* @__PURE__ */ (0,
|
|
26456
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26000
26457
|
Button,
|
|
26001
26458
|
{
|
|
26002
26459
|
type: "button",
|
|
@@ -26011,7 +26468,7 @@ var PaymentMethodDetails = ({
|
|
|
26011
26468
|
)
|
|
26012
26469
|
] })
|
|
26013
26470
|
] }),
|
|
26014
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
26471
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
26015
26472
|
]
|
|
26016
26473
|
}
|
|
26017
26474
|
)
|
|
@@ -26021,13 +26478,13 @@ var PaymentMethodDetails = ({
|
|
|
26021
26478
|
};
|
|
26022
26479
|
|
|
26023
26480
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26024
|
-
var
|
|
26481
|
+
var import_react61 = require("react");
|
|
26025
26482
|
|
|
26026
26483
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
26027
|
-
var
|
|
26484
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
26028
26485
|
var AddOn = ({ addOn, currency, period, layout }) => {
|
|
26029
26486
|
const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
|
|
26030
|
-
return /* @__PURE__ */ (0,
|
|
26487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
26031
26488
|
Flex,
|
|
26032
26489
|
{
|
|
26033
26490
|
$justifyContent: "space-between",
|
|
@@ -26035,10 +26492,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26035
26492
|
$flexWrap: "wrap",
|
|
26036
26493
|
$gap: "1rem",
|
|
26037
26494
|
children: [
|
|
26038
|
-
/* @__PURE__ */ (0,
|
|
26039
|
-
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0,
|
|
26495
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
26496
|
+
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
|
|
26040
26497
|
formatCurrency(addOn.planPrice, currency),
|
|
26041
|
-
/* @__PURE__ */ (0,
|
|
26498
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
|
|
26042
26499
|
] })
|
|
26043
26500
|
]
|
|
26044
26501
|
}
|
|
@@ -26046,8 +26503,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26046
26503
|
};
|
|
26047
26504
|
|
|
26048
26505
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
26049
|
-
var
|
|
26050
|
-
var
|
|
26506
|
+
var import_react60 = require("react");
|
|
26507
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
26051
26508
|
var UsageDetails2 = ({
|
|
26052
26509
|
entitlement,
|
|
26053
26510
|
period,
|
|
@@ -26062,40 +26519,40 @@ var UsageDetails2 = ({
|
|
|
26062
26519
|
billingPrice,
|
|
26063
26520
|
limit,
|
|
26064
26521
|
cost = 0
|
|
26065
|
-
} = (0,
|
|
26522
|
+
} = (0, import_react60.useMemo)(
|
|
26066
26523
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26067
26524
|
showWarningThresholdAsLimit
|
|
26068
26525
|
}),
|
|
26069
26526
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26070
26527
|
);
|
|
26071
|
-
const description = (0,
|
|
26528
|
+
const description = (0, import_react60.useMemo)(() => {
|
|
26072
26529
|
const acc = [];
|
|
26073
26530
|
let index = 0;
|
|
26074
26531
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
26075
|
-
acc.push(/* @__PURE__ */ (0,
|
|
26532
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
|
|
26076
26533
|
t4("Additional"),
|
|
26077
26534
|
": "
|
|
26078
26535
|
] }, index));
|
|
26079
26536
|
index += 1;
|
|
26080
26537
|
}
|
|
26081
26538
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
26082
|
-
acc.push(/* @__PURE__ */ (0,
|
|
26539
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react60.Fragment, { children: t4("Tier-based") }, index));
|
|
26083
26540
|
index += 1;
|
|
26084
26541
|
}
|
|
26085
26542
|
const { price } = getEntitlementPrice(entitlement, period, currency) || {};
|
|
26086
26543
|
if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
|
|
26087
26544
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
26088
26545
|
acc.push(
|
|
26089
|
-
/* @__PURE__ */ (0,
|
|
26546
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
|
|
26090
26547
|
formatCurrency(price, billingPrice?.currency),
|
|
26091
|
-
/* @__PURE__ */ (0,
|
|
26548
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
|
|
26092
26549
|
"/",
|
|
26093
|
-
packageSize > 1 && /* @__PURE__ */ (0,
|
|
26550
|
+
packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26094
26551
|
packageSize,
|
|
26095
26552
|
" "
|
|
26096
26553
|
] }),
|
|
26097
26554
|
getFeatureName(entitlement.feature, packageSize),
|
|
26098
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
26555
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26099
26556
|
"/",
|
|
26100
26557
|
shortenPeriod(period)
|
|
26101
26558
|
] })
|
|
@@ -26106,7 +26563,7 @@ var UsageDetails2 = ({
|
|
|
26106
26563
|
}
|
|
26107
26564
|
if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
26108
26565
|
acc.push(
|
|
26109
|
-
/* @__PURE__ */ (0,
|
|
26566
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
|
|
26110
26567
|
formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
|
|
26111
26568
|
" ",
|
|
26112
26569
|
getFeatureName(
|
|
@@ -26134,7 +26591,7 @@ var UsageDetails2 = ({
|
|
|
26134
26591
|
return null;
|
|
26135
26592
|
}
|
|
26136
26593
|
const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
|
|
26137
|
-
return /* @__PURE__ */ (0,
|
|
26594
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
26138
26595
|
Flex,
|
|
26139
26596
|
{
|
|
26140
26597
|
$justifyContent: "space-between",
|
|
@@ -26142,13 +26599,13 @@ var UsageDetails2 = ({
|
|
|
26142
26599
|
$flexWrap: "wrap",
|
|
26143
26600
|
$gap: "0.5rem",
|
|
26144
26601
|
children: [
|
|
26145
|
-
/* @__PURE__ */ (0,
|
|
26602
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26146
26603
|
quantity,
|
|
26147
26604
|
" ",
|
|
26148
26605
|
getFeatureName(entitlement.feature, quantity, true)
|
|
26149
26606
|
] }) : entitlement.feature.name }),
|
|
26150
|
-
/* @__PURE__ */ (0,
|
|
26151
|
-
description.length > 0 && /* @__PURE__ */ (0,
|
|
26607
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { children: [
|
|
26608
|
+
description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26152
26609
|
Text,
|
|
26153
26610
|
{
|
|
26154
26611
|
style: { opacity: 0.54 },
|
|
@@ -26159,15 +26616,15 @@ var UsageDetails2 = ({
|
|
|
26159
26616
|
),
|
|
26160
26617
|
// only show cost for pay-in-advance entitlements
|
|
26161
26618
|
// `description` will include price for other price behaviors
|
|
26162
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
26619
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26163
26620
|
" ",
|
|
26164
26621
|
formatCurrency(cost, billingPrice?.currency),
|
|
26165
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
26622
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
|
|
26166
26623
|
"/",
|
|
26167
26624
|
shortenPeriod(period)
|
|
26168
26625
|
] })
|
|
26169
26626
|
] }),
|
|
26170
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0,
|
|
26627
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26171
26628
|
PricingTiersTooltip,
|
|
26172
26629
|
{
|
|
26173
26630
|
feature: entitlement.feature,
|
|
@@ -26177,7 +26634,7 @@ var UsageDetails2 = ({
|
|
|
26177
26634
|
tiersMode: billingPrice?.tiersMode ?? void 0
|
|
26178
26635
|
}
|
|
26179
26636
|
),
|
|
26180
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
26637
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26181
26638
|
HardLimitTooltip,
|
|
26182
26639
|
{
|
|
26183
26640
|
feature: entitlement.feature,
|
|
@@ -26191,7 +26648,7 @@ var UsageDetails2 = ({
|
|
|
26191
26648
|
};
|
|
26192
26649
|
|
|
26193
26650
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26194
|
-
var
|
|
26651
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
26195
26652
|
var resolveDesignProps7 = (props) => {
|
|
26196
26653
|
return {
|
|
26197
26654
|
header: {
|
|
@@ -26220,7 +26677,7 @@ var resolveDesignProps7 = (props) => {
|
|
|
26220
26677
|
}
|
|
26221
26678
|
};
|
|
26222
26679
|
};
|
|
26223
|
-
var PlanManager = (0,
|
|
26680
|
+
var PlanManager = (0, import_react61.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
26224
26681
|
const props = resolveDesignProps7(rest);
|
|
26225
26682
|
const { t: t4 } = useTranslation();
|
|
26226
26683
|
const { data, settings, setCheckoutState, setLayout } = useEmbed();
|
|
@@ -26239,7 +26696,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26239
26696
|
showCredits,
|
|
26240
26697
|
showZeroPriceAsFree,
|
|
26241
26698
|
trialPaymentMethodRequired
|
|
26242
|
-
} = (0,
|
|
26699
|
+
} = (0, import_react61.useMemo)(() => {
|
|
26243
26700
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
26244
26701
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
26245
26702
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -26299,15 +26756,15 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26299
26756
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
26300
26757
|
data?.trialPaymentMethodRequired
|
|
26301
26758
|
]);
|
|
26302
|
-
const usageBasedEntitlements = (0,
|
|
26759
|
+
const usageBasedEntitlements = (0, import_react61.useMemo)(
|
|
26303
26760
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
26304
26761
|
[featureUsage]
|
|
26305
26762
|
);
|
|
26306
|
-
const planCreditCompositions = (0,
|
|
26763
|
+
const planCreditCompositions = (0, import_react61.useMemo)(
|
|
26307
26764
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
26308
26765
|
[currentPlan?.includedCreditGrants]
|
|
26309
26766
|
);
|
|
26310
|
-
const resolveLicenseQuantity = (0,
|
|
26767
|
+
const resolveLicenseQuantity = (0, import_react61.useMemo)(() => {
|
|
26311
26768
|
return (licenseId) => {
|
|
26312
26769
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
26313
26770
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -26330,7 +26787,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26330
26787
|
subscriptionCurrency,
|
|
26331
26788
|
willSubscriptionCancel,
|
|
26332
26789
|
isTrialSubscription
|
|
26333
|
-
} = (0,
|
|
26790
|
+
} = (0, import_react61.useMemo)(() => {
|
|
26334
26791
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
26335
26792
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
26336
26793
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -26343,7 +26800,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26343
26800
|
};
|
|
26344
26801
|
}, [billingSubscription]);
|
|
26345
26802
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
26346
|
-
const { isFreePlan, isUsageBasedPlan } = (0,
|
|
26803
|
+
const { isFreePlan, isUsageBasedPlan } = (0, import_react61.useMemo)(() => {
|
|
26347
26804
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
26348
26805
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
26349
26806
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -26351,8 +26808,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26351
26808
|
const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
|
|
26352
26809
|
(grant) => isSelfServiceAutoTopupAvailable(grant)
|
|
26353
26810
|
) ?? false;
|
|
26354
|
-
return /* @__PURE__ */ (0,
|
|
26355
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
26811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
26812
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26356
26813
|
Notice,
|
|
26357
26814
|
{
|
|
26358
26815
|
as: Flex,
|
|
@@ -26362,8 +26819,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26362
26819
|
$textAlign: "center",
|
|
26363
26820
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26364
26821
|
children: [
|
|
26365
|
-
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0,
|
|
26366
|
-
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0,
|
|
26822
|
+
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
|
|
26823
|
+
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26367
26824
|
Text,
|
|
26368
26825
|
{
|
|
26369
26826
|
as: "p",
|
|
@@ -26377,7 +26834,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26377
26834
|
)
|
|
26378
26835
|
]
|
|
26379
26836
|
}
|
|
26380
|
-
) : willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
26837
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26381
26838
|
Notice,
|
|
26382
26839
|
{
|
|
26383
26840
|
as: Flex,
|
|
@@ -26387,8 +26844,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26387
26844
|
$textAlign: "center",
|
|
26388
26845
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26389
26846
|
children: [
|
|
26390
|
-
/* @__PURE__ */ (0,
|
|
26391
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0,
|
|
26847
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
|
|
26848
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26392
26849
|
Text,
|
|
26393
26850
|
{
|
|
26394
26851
|
as: "p",
|
|
@@ -26403,7 +26860,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26403
26860
|
)
|
|
26404
26861
|
]
|
|
26405
26862
|
}
|
|
26406
|
-
) : customPlanBilling ? /* @__PURE__ */ (0,
|
|
26863
|
+
) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26407
26864
|
Notice,
|
|
26408
26865
|
{
|
|
26409
26866
|
as: Flex,
|
|
@@ -26413,19 +26870,19 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26413
26870
|
$textAlign: "center",
|
|
26414
26871
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26415
26872
|
children: [
|
|
26416
|
-
/* @__PURE__ */ (0,
|
|
26873
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
|
|
26417
26874
|
plan: customPlanBilling.planName ?? t4("your plan")
|
|
26418
26875
|
}) : t4("Custom plan payment due", {
|
|
26419
26876
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26420
26877
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26421
26878
|
}) }),
|
|
26422
|
-
/* @__PURE__ */ (0,
|
|
26879
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
|
|
26423
26880
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26424
26881
|
}) : t4("Custom plan payment due description", {
|
|
26425
26882
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26426
26883
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26427
26884
|
}) }),
|
|
26428
|
-
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0,
|
|
26885
|
+
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26429
26886
|
Button,
|
|
26430
26887
|
{
|
|
26431
26888
|
as: "a",
|
|
@@ -26439,7 +26896,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26439
26896
|
)
|
|
26440
26897
|
]
|
|
26441
26898
|
}
|
|
26442
|
-
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0,
|
|
26899
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26443
26900
|
Notice,
|
|
26444
26901
|
{
|
|
26445
26902
|
as: Flex,
|
|
@@ -26449,10 +26906,10 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
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__ */ (0,
|
|
26909
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
|
|
26453
26910
|
plan: data.company.scheduledDowngrade.toPlanName
|
|
26454
26911
|
}) }),
|
|
26455
|
-
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0,
|
|
26912
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26456
26913
|
Text,
|
|
26457
26914
|
{
|
|
26458
26915
|
as: "p",
|
|
@@ -26468,7 +26925,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26468
26925
|
]
|
|
26469
26926
|
}
|
|
26470
26927
|
),
|
|
26471
|
-
/* @__PURE__ */ (0,
|
|
26928
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26472
26929
|
Element,
|
|
26473
26930
|
{
|
|
26474
26931
|
as: Flex,
|
|
@@ -26477,19 +26934,19 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26477
26934
|
$flexDirection: "column",
|
|
26478
26935
|
$gap: "2rem",
|
|
26479
26936
|
children: [
|
|
26480
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
26937
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26481
26938
|
Flex,
|
|
26482
26939
|
{
|
|
26483
26940
|
$justifyContent: "space-between",
|
|
26484
26941
|
$alignItems: "center",
|
|
26485
26942
|
$gap: "1rem",
|
|
26486
26943
|
children: [
|
|
26487
|
-
/* @__PURE__ */ (0,
|
|
26488
|
-
/* @__PURE__ */ (0,
|
|
26489
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
26944
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
26945
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
|
|
26946
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
26490
26947
|
] }),
|
|
26491
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0,
|
|
26492
|
-
/* @__PURE__ */ (0,
|
|
26948
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Box, { children: [
|
|
26949
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26493
26950
|
Text,
|
|
26494
26951
|
{
|
|
26495
26952
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -26499,7 +26956,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26499
26956
|
)
|
|
26500
26957
|
}
|
|
26501
26958
|
),
|
|
26502
|
-
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0,
|
|
26959
|
+
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
|
|
26503
26960
|
"/",
|
|
26504
26961
|
shortenPeriod(currentPlanPeriod)
|
|
26505
26962
|
] }) })
|
|
@@ -26507,8 +26964,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26507
26964
|
]
|
|
26508
26965
|
}
|
|
26509
26966
|
),
|
|
26510
|
-
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0,
|
|
26511
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
26967
|
+
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
26968
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26512
26969
|
Text,
|
|
26513
26970
|
{
|
|
26514
26971
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26516,7 +26973,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26516
26973
|
children: t4("Add-ons")
|
|
26517
26974
|
}
|
|
26518
26975
|
),
|
|
26519
|
-
/* @__PURE__ */ (0,
|
|
26976
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26520
26977
|
AddOn,
|
|
26521
26978
|
{
|
|
26522
26979
|
addOn,
|
|
@@ -26527,8 +26984,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26527
26984
|
addOnIndex
|
|
26528
26985
|
)) })
|
|
26529
26986
|
] }),
|
|
26530
|
-
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
26531
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
26987
|
+
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
26988
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26532
26989
|
Text,
|
|
26533
26990
|
{
|
|
26534
26991
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26536,8 +26993,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26536
26993
|
children: t4("Usage-based")
|
|
26537
26994
|
}
|
|
26538
26995
|
),
|
|
26539
|
-
/* @__PURE__ */ (0,
|
|
26540
|
-
return /* @__PURE__ */ (0,
|
|
26996
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
26997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26541
26998
|
UsageDetails2,
|
|
26542
26999
|
{
|
|
26543
27000
|
entitlement,
|
|
@@ -26550,8 +27007,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26550
27007
|
);
|
|
26551
27008
|
}) })
|
|
26552
27009
|
] }),
|
|
26553
|
-
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0,
|
|
26554
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27010
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27011
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26555
27012
|
Text,
|
|
26556
27013
|
{
|
|
26557
27014
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26559,7 +27016,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26559
27016
|
children: t4("Credits in plan")
|
|
26560
27017
|
}
|
|
26561
27018
|
),
|
|
26562
|
-
/* @__PURE__ */ (0,
|
|
27019
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
|
|
26563
27020
|
const planCreditGrant = currentPlan?.includedCreditGrants.find(
|
|
26564
27021
|
(grant) => grant.creditId === group.id
|
|
26565
27022
|
);
|
|
@@ -26582,13 +27039,13 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26582
27039
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
26583
27040
|
const creditPeriod = composition.period ?? subscriptionInterval;
|
|
26584
27041
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
26585
|
-
return /* @__PURE__ */ (0,
|
|
27042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26586
27043
|
Flex,
|
|
26587
27044
|
{
|
|
26588
27045
|
$flexDirection: "column",
|
|
26589
27046
|
$gap: "0.25rem",
|
|
26590
27047
|
children: [
|
|
26591
|
-
/* @__PURE__ */ (0,
|
|
27048
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26592
27049
|
Flex,
|
|
26593
27050
|
{
|
|
26594
27051
|
$justifyContent: "space-between",
|
|
@@ -26596,7 +27053,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26596
27053
|
$flexWrap: "wrap",
|
|
26597
27054
|
$gap: "0.5rem",
|
|
26598
27055
|
children: [
|
|
26599
|
-
/* @__PURE__ */ (0,
|
|
27056
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
26600
27057
|
t4("X credits per license", {
|
|
26601
27058
|
amount: perLicenseGrant.amount,
|
|
26602
27059
|
creditName: getFeatureName(
|
|
@@ -26605,7 +27062,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26605
27062
|
),
|
|
26606
27063
|
licenseName: getFeatureName(licenseFeature, 1)
|
|
26607
27064
|
}),
|
|
26608
|
-
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0,
|
|
27065
|
+
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
26609
27066
|
" ",
|
|
26610
27067
|
t4("Plus X credits per period", {
|
|
26611
27068
|
amount: composition.fixedQuantity,
|
|
@@ -26616,18 +27073,18 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26616
27073
|
period: t4(creditPeriod)
|
|
26617
27074
|
})
|
|
26618
27075
|
] })
|
|
26619
|
-
] }) : /* @__PURE__ */ (0,
|
|
27076
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
26620
27077
|
group.total.value,
|
|
26621
27078
|
" ",
|
|
26622
27079
|
getFeatureName(group, group.total.value),
|
|
26623
27080
|
" ",
|
|
26624
|
-
subscriptionInterval && /* @__PURE__ */ (0,
|
|
27081
|
+
subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
26625
27082
|
t4("per"),
|
|
26626
27083
|
" ",
|
|
26627
27084
|
t4(subscriptionInterval)
|
|
26628
27085
|
] })
|
|
26629
27086
|
] }) }),
|
|
26630
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27087
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26631
27088
|
Text,
|
|
26632
27089
|
{
|
|
26633
27090
|
style: { opacity: 0.54 },
|
|
@@ -26637,7 +27094,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26637
27094
|
group.total.used,
|
|
26638
27095
|
" ",
|
|
26639
27096
|
t4("used"),
|
|
26640
|
-
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0,
|
|
27097
|
+
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26641
27098
|
AutoTopupNotice,
|
|
26642
27099
|
{
|
|
26643
27100
|
thresholdCredits,
|
|
@@ -26650,7 +27107,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26650
27107
|
]
|
|
26651
27108
|
}
|
|
26652
27109
|
),
|
|
26653
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0,
|
|
27110
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26654
27111
|
Text,
|
|
26655
27112
|
{
|
|
26656
27113
|
style: { opacity: 0.54 },
|
|
@@ -26691,7 +27148,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26691
27148
|
groupIndex
|
|
26692
27149
|
);
|
|
26693
27150
|
}) }),
|
|
26694
|
-
planCredits.canExpand && /* @__PURE__ */ (0,
|
|
27151
|
+
planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26695
27152
|
ExpandListToggle,
|
|
26696
27153
|
{
|
|
26697
27154
|
isExpanded: planCredits.isExpanded,
|
|
@@ -26700,7 +27157,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26700
27157
|
$marginTop: "0.5rem"
|
|
26701
27158
|
}
|
|
26702
27159
|
),
|
|
26703
|
-
hasAutoTopupSelfService && /* @__PURE__ */ (0,
|
|
27160
|
+
hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26704
27161
|
Flex,
|
|
26705
27162
|
{
|
|
26706
27163
|
$justifyContent: "space-between",
|
|
@@ -26710,8 +27167,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26710
27167
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26711
27168
|
$borderRadius: "0.5rem",
|
|
26712
27169
|
children: [
|
|
26713
|
-
/* @__PURE__ */ (0,
|
|
26714
|
-
/* @__PURE__ */ (0,
|
|
27170
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27171
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
|
|
26715
27172
|
currentPlan?.includedCreditGrants.reduce(
|
|
26716
27173
|
(acc, grant) => {
|
|
26717
27174
|
if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -26720,7 +27177,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26720
27177
|
const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
|
|
26721
27178
|
if (!autoTopupEnabled) {
|
|
26722
27179
|
acc.push(
|
|
26723
|
-
/* @__PURE__ */ (0,
|
|
27180
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
|
|
26724
27181
|
unit: getFeatureName(grant.credit, 1)
|
|
26725
27182
|
}) }, grant.id)
|
|
26726
27183
|
);
|
|
@@ -26730,7 +27187,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26730
27187
|
const autoTopupAmount = getAutoTopupAmount(grant);
|
|
26731
27188
|
if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
|
|
26732
27189
|
acc.push(
|
|
26733
|
-
/* @__PURE__ */ (0,
|
|
27190
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
|
|
26734
27191
|
unit: getFeatureName(
|
|
26735
27192
|
grant.credit,
|
|
26736
27193
|
autoTopupAmount
|
|
@@ -26745,7 +27202,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26745
27202
|
[]
|
|
26746
27203
|
)
|
|
26747
27204
|
] }),
|
|
26748
|
-
/* @__PURE__ */ (0,
|
|
27205
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26749
27206
|
Button,
|
|
26750
27207
|
{
|
|
26751
27208
|
type: "button",
|
|
@@ -26762,8 +27219,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26762
27219
|
}
|
|
26763
27220
|
)
|
|
26764
27221
|
] }),
|
|
26765
|
-
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0,
|
|
26766
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27222
|
+
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27223
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26767
27224
|
Text,
|
|
26768
27225
|
{
|
|
26769
27226
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26771,9 +27228,9 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26771
27228
|
children: t4("Top-ups")
|
|
26772
27229
|
}
|
|
26773
27230
|
),
|
|
26774
|
-
/* @__PURE__ */ (0,
|
|
27231
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
|
|
26775
27232
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26776
|
-
return /* @__PURE__ */ (0,
|
|
27233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26777
27234
|
Flex,
|
|
26778
27235
|
{
|
|
26779
27236
|
$justifyContent: "space-between",
|
|
@@ -26781,8 +27238,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26781
27238
|
$flexWrap: "wrap",
|
|
26782
27239
|
$gap: "0.5rem",
|
|
26783
27240
|
children: [
|
|
26784
|
-
bundle ? /* @__PURE__ */ (0,
|
|
26785
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27241
|
+
bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27242
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
26786
27243
|
"(",
|
|
26787
27244
|
group.grants.length,
|
|
26788
27245
|
")",
|
|
@@ -26794,8 +27251,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26794
27251
|
" ",
|
|
26795
27252
|
getFeatureName(group, group.quantity),
|
|
26796
27253
|
")"
|
|
26797
|
-
] }) : /* @__PURE__ */ (0,
|
|
26798
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27254
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27255
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
26799
27256
|
"(",
|
|
26800
27257
|
group.grants.length,
|
|
26801
27258
|
")",
|
|
@@ -26805,7 +27262,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26805
27262
|
" ",
|
|
26806
27263
|
getFeatureName(group, group.quantity)
|
|
26807
27264
|
] }),
|
|
26808
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27265
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26809
27266
|
Text,
|
|
26810
27267
|
{
|
|
26811
27268
|
style: { opacity: 0.54 },
|
|
@@ -26823,7 +27280,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26823
27280
|
groupIndex
|
|
26824
27281
|
);
|
|
26825
27282
|
}) }),
|
|
26826
|
-
autoTopupCredits.canExpand && /* @__PURE__ */ (0,
|
|
27283
|
+
autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26827
27284
|
ExpandListToggle,
|
|
26828
27285
|
{
|
|
26829
27286
|
isExpanded: autoTopupCredits.isExpanded,
|
|
@@ -26833,8 +27290,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26833
27290
|
}
|
|
26834
27291
|
)
|
|
26835
27292
|
] }),
|
|
26836
|
-
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0,
|
|
26837
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27293
|
+
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27294
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26838
27295
|
Text,
|
|
26839
27296
|
{
|
|
26840
27297
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26842,9 +27299,9 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26842
27299
|
children: t4("Credit bundles")
|
|
26843
27300
|
}
|
|
26844
27301
|
),
|
|
26845
|
-
/* @__PURE__ */ (0,
|
|
27302
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
|
|
26846
27303
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
26847
|
-
return /* @__PURE__ */ (0,
|
|
27304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26848
27305
|
Flex,
|
|
26849
27306
|
{
|
|
26850
27307
|
$justifyContent: "space-between",
|
|
@@ -26852,8 +27309,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26852
27309
|
$flexWrap: "wrap",
|
|
26853
27310
|
$gap: "0.5rem",
|
|
26854
27311
|
children: [
|
|
26855
|
-
bundle ? /* @__PURE__ */ (0,
|
|
26856
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27312
|
+
bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27313
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
26857
27314
|
"(",
|
|
26858
27315
|
group.grants.length,
|
|
26859
27316
|
")",
|
|
@@ -26865,12 +27322,12 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26865
27322
|
" ",
|
|
26866
27323
|
getFeatureName(group, group.quantity),
|
|
26867
27324
|
")"
|
|
26868
|
-
] }) : /* @__PURE__ */ (0,
|
|
27325
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
26869
27326
|
group.quantity,
|
|
26870
27327
|
" ",
|
|
26871
27328
|
getFeatureName(group, group.quantity)
|
|
26872
27329
|
] }),
|
|
26873
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27330
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26874
27331
|
Text,
|
|
26875
27332
|
{
|
|
26876
27333
|
style: { opacity: 0.54 },
|
|
@@ -26888,7 +27345,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26888
27345
|
groupIndex
|
|
26889
27346
|
);
|
|
26890
27347
|
}) }),
|
|
26891
|
-
bundleCredits.canExpand && /* @__PURE__ */ (0,
|
|
27348
|
+
bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26892
27349
|
ExpandListToggle,
|
|
26893
27350
|
{
|
|
26894
27351
|
isExpanded: bundleCredits.isExpanded,
|
|
@@ -26898,8 +27355,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26898
27355
|
}
|
|
26899
27356
|
)
|
|
26900
27357
|
] }),
|
|
26901
|
-
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0,
|
|
26902
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27358
|
+
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27359
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26903
27360
|
Text,
|
|
26904
27361
|
{
|
|
26905
27362
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26907,8 +27364,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26907
27364
|
children: t4("Promotional credits")
|
|
26908
27365
|
}
|
|
26909
27366
|
),
|
|
26910
|
-
/* @__PURE__ */ (0,
|
|
26911
|
-
return /* @__PURE__ */ (0,
|
|
27367
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
|
|
27368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26912
27369
|
Flex,
|
|
26913
27370
|
{
|
|
26914
27371
|
$justifyContent: "space-between",
|
|
@@ -26916,12 +27373,12 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26916
27373
|
$flexWrap: "wrap",
|
|
26917
27374
|
$gap: "0.5rem",
|
|
26918
27375
|
children: [
|
|
26919
|
-
/* @__PURE__ */ (0,
|
|
27376
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
26920
27377
|
group.quantity,
|
|
26921
27378
|
" ",
|
|
26922
27379
|
getFeatureName(group, group.quantity)
|
|
26923
27380
|
] }),
|
|
26924
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27381
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26925
27382
|
Text,
|
|
26926
27383
|
{
|
|
26927
27384
|
style: { opacity: 0.54 },
|
|
@@ -26939,7 +27396,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26939
27396
|
groupIndex
|
|
26940
27397
|
);
|
|
26941
27398
|
}) }),
|
|
26942
|
-
promotionalCredits.canExpand && /* @__PURE__ */ (0,
|
|
27399
|
+
promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26943
27400
|
ExpandListToggle,
|
|
26944
27401
|
{
|
|
26945
27402
|
isExpanded: promotionalCredits.isExpanded,
|
|
@@ -26949,7 +27406,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26949
27406
|
}
|
|
26950
27407
|
)
|
|
26951
27408
|
] }),
|
|
26952
|
-
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0,
|
|
27409
|
+
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26953
27410
|
Button,
|
|
26954
27411
|
{
|
|
26955
27412
|
type: "button",
|
|
@@ -26970,11 +27427,11 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
|
|
|
26970
27427
|
PlanManager.displayName = "PlanManager";
|
|
26971
27428
|
|
|
26972
27429
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
26973
|
-
var
|
|
27430
|
+
var import_react64 = require("react");
|
|
26974
27431
|
|
|
26975
27432
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
26976
|
-
var
|
|
26977
|
-
var
|
|
27433
|
+
var import_react62 = require("react");
|
|
27434
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
26978
27435
|
function renderMeteredEntitlementPricing2({
|
|
26979
27436
|
priceBehavior,
|
|
26980
27437
|
softLimit,
|
|
@@ -26986,7 +27443,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
26986
27443
|
isTiered
|
|
26987
27444
|
}) {
|
|
26988
27445
|
if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
|
|
26989
|
-
return /* @__PURE__ */ (0,
|
|
27446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
26990
27447
|
"Additional: ",
|
|
26991
27448
|
formatCurrency(price, currency),
|
|
26992
27449
|
"/",
|
|
@@ -26997,13 +27454,13 @@ function renderMeteredEntitlementPricing2({
|
|
|
26997
27454
|
] });
|
|
26998
27455
|
}
|
|
26999
27456
|
if (isTiered) {
|
|
27000
|
-
return /* @__PURE__ */ (0,
|
|
27457
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: "Tier-based pricing" });
|
|
27001
27458
|
}
|
|
27002
27459
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
|
|
27003
|
-
return /* @__PURE__ */ (0,
|
|
27460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27004
27461
|
formatCurrency(price, currency),
|
|
27005
27462
|
"/",
|
|
27006
|
-
packageSize > 1 && /* @__PURE__ */ (0,
|
|
27463
|
+
packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27007
27464
|
packageSize,
|
|
27008
27465
|
" "
|
|
27009
27466
|
] }),
|
|
@@ -27029,7 +27486,7 @@ var AddOn2 = ({
|
|
|
27029
27486
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
27030
27487
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
27031
27488
|
const isLightBackground = useIsLightBackground();
|
|
27032
|
-
const { currentAddOns, canCheckout, isStandalone } = (0,
|
|
27489
|
+
const { currentAddOns, canCheckout, isStandalone } = (0, import_react62.useMemo)(() => {
|
|
27033
27490
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
27034
27491
|
return {
|
|
27035
27492
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -27072,7 +27529,7 @@ var AddOn2 = ({
|
|
|
27072
27529
|
isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
|
|
27073
27530
|
};
|
|
27074
27531
|
}) || [];
|
|
27075
|
-
return /* @__PURE__ */ (0,
|
|
27532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27076
27533
|
Flex,
|
|
27077
27534
|
{
|
|
27078
27535
|
as: "li",
|
|
@@ -27092,7 +27549,7 @@ var AddOn2 = ({
|
|
|
27092
27549
|
$boxShadow: cardBoxShadow
|
|
27093
27550
|
},
|
|
27094
27551
|
children: [
|
|
27095
|
-
/* @__PURE__ */ (0,
|
|
27552
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27096
27553
|
Flex,
|
|
27097
27554
|
{
|
|
27098
27555
|
$flexDirection: "column",
|
|
@@ -27103,7 +27560,7 @@ var AddOn2 = ({
|
|
|
27103
27560
|
$borderStyle: "solid",
|
|
27104
27561
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27105
27562
|
children: [
|
|
27106
|
-
/* @__PURE__ */ (0,
|
|
27563
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27107
27564
|
Text,
|
|
27108
27565
|
{
|
|
27109
27566
|
as: "h3",
|
|
@@ -27112,22 +27569,22 @@ var AddOn2 = ({
|
|
|
27112
27569
|
children: addOn.name
|
|
27113
27570
|
}
|
|
27114
27571
|
) }),
|
|
27115
|
-
layout.addOns.showDescription && /* @__PURE__ */ (0,
|
|
27116
|
-
/* @__PURE__ */ (0,
|
|
27572
|
+
layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
27573
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27117
27574
|
Text,
|
|
27118
27575
|
{
|
|
27119
27576
|
"data-testid": "sch-addon-price",
|
|
27120
27577
|
display: layout.plans.name.fontStyle,
|
|
27121
|
-
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ (0,
|
|
27578
|
+
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27122
27579
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
27123
|
-
/* @__PURE__ */ (0,
|
|
27580
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("sub", { children: [
|
|
27124
27581
|
"/",
|
|
27125
27582
|
selectedPeriod
|
|
27126
27583
|
] })
|
|
27127
27584
|
] })
|
|
27128
27585
|
}
|
|
27129
27586
|
) }),
|
|
27130
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
27587
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27131
27588
|
Flex,
|
|
27132
27589
|
{
|
|
27133
27590
|
"data-testid": "sch-addon-active",
|
|
@@ -27137,7 +27594,7 @@ var AddOn2 = ({
|
|
|
27137
27594
|
$backgroundColor: settings.theme.primary,
|
|
27138
27595
|
$borderRadius: "9999px",
|
|
27139
27596
|
$padding: "0.125rem 0.85rem",
|
|
27140
|
-
children: /* @__PURE__ */ (0,
|
|
27597
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27141
27598
|
Text,
|
|
27142
27599
|
{
|
|
27143
27600
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27150,7 +27607,7 @@ var AddOn2 = ({
|
|
|
27150
27607
|
]
|
|
27151
27608
|
}
|
|
27152
27609
|
),
|
|
27153
|
-
/* @__PURE__ */ (0,
|
|
27610
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27154
27611
|
Flex,
|
|
27155
27612
|
{
|
|
27156
27613
|
$flexDirection: "column",
|
|
@@ -27159,7 +27616,7 @@ var AddOn2 = ({
|
|
|
27159
27616
|
$flexGrow: 1,
|
|
27160
27617
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27161
27618
|
children: [
|
|
27162
|
-
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
27619
|
+
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27163
27620
|
Flex,
|
|
27164
27621
|
{
|
|
27165
27622
|
as: "ul",
|
|
@@ -27171,7 +27628,7 @@ var AddOn2 = ({
|
|
|
27171
27628
|
$listStyle: "none",
|
|
27172
27629
|
children: displayableEntitlements.map((entitlement, idx) => {
|
|
27173
27630
|
if (entitlement.isUnlimited) {
|
|
27174
|
-
return /* @__PURE__ */ (0,
|
|
27631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27175
27632
|
Flex,
|
|
27176
27633
|
{
|
|
27177
27634
|
as: "li",
|
|
@@ -27180,8 +27637,8 @@ var AddOn2 = ({
|
|
|
27180
27637
|
$alignItems: "center",
|
|
27181
27638
|
$gap: "1rem",
|
|
27182
27639
|
children: [
|
|
27183
|
-
/* @__PURE__ */ (0,
|
|
27184
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
27640
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
|
|
27641
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27185
27642
|
Icon3,
|
|
27186
27643
|
{
|
|
27187
27644
|
name: entitlement.feature.icon,
|
|
@@ -27190,16 +27647,16 @@ var AddOn2 = ({
|
|
|
27190
27647
|
rounded: true
|
|
27191
27648
|
}
|
|
27192
27649
|
),
|
|
27193
|
-
entitlement.feature && /* @__PURE__ */ (0,
|
|
27650
|
+
entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27194
27651
|
Flex,
|
|
27195
27652
|
{
|
|
27196
27653
|
$flexDirection: "column",
|
|
27197
27654
|
$justifyContent: "center",
|
|
27198
|
-
children: /* @__PURE__ */ (0,
|
|
27655
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: getFeatureName(entitlement.feature) })
|
|
27199
27656
|
}
|
|
27200
27657
|
)
|
|
27201
27658
|
] }),
|
|
27202
|
-
/* @__PURE__ */ (0,
|
|
27659
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27203
27660
|
Text,
|
|
27204
27661
|
{
|
|
27205
27662
|
style: { opacity: 0.54 },
|
|
@@ -27214,7 +27671,7 @@ var AddOn2 = ({
|
|
|
27214
27671
|
);
|
|
27215
27672
|
}
|
|
27216
27673
|
const meteredEntitlement = entitlement;
|
|
27217
|
-
return /* @__PURE__ */ (0,
|
|
27674
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27218
27675
|
Flex,
|
|
27219
27676
|
{
|
|
27220
27677
|
as: "li",
|
|
@@ -27224,8 +27681,8 @@ var AddOn2 = ({
|
|
|
27224
27681
|
$gap: "1rem",
|
|
27225
27682
|
$listStyle: "none",
|
|
27226
27683
|
children: [
|
|
27227
|
-
/* @__PURE__ */ (0,
|
|
27228
|
-
meteredEntitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
27684
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
|
|
27685
|
+
meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27229
27686
|
Icon3,
|
|
27230
27687
|
{
|
|
27231
27688
|
"data-testid": "sch-feature-icon",
|
|
@@ -27235,9 +27692,9 @@ var AddOn2 = ({
|
|
|
27235
27692
|
rounded: true
|
|
27236
27693
|
}
|
|
27237
27694
|
),
|
|
27238
|
-
/* @__PURE__ */ (0,
|
|
27695
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
|
|
27239
27696
|
] }),
|
|
27240
|
-
/* @__PURE__ */ (0,
|
|
27697
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27241
27698
|
Text,
|
|
27242
27699
|
{
|
|
27243
27700
|
style: { opacity: 0.54 },
|
|
@@ -27253,7 +27710,7 @@ var AddOn2 = ({
|
|
|
27253
27710
|
})
|
|
27254
27711
|
}
|
|
27255
27712
|
),
|
|
27256
|
-
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
27713
|
+
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27257
27714
|
Button,
|
|
27258
27715
|
{
|
|
27259
27716
|
type: "button",
|
|
@@ -27292,10 +27749,10 @@ var AddOn2 = ({
|
|
|
27292
27749
|
};
|
|
27293
27750
|
|
|
27294
27751
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27295
|
-
var
|
|
27752
|
+
var import_react63 = require("react");
|
|
27296
27753
|
|
|
27297
27754
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
27298
|
-
var
|
|
27755
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
27299
27756
|
var Entitlement2 = ({
|
|
27300
27757
|
entitlement,
|
|
27301
27758
|
sharedProps,
|
|
@@ -27329,8 +27786,8 @@ var Entitlement2 = ({
|
|
|
27329
27786
|
entitlement,
|
|
27330
27787
|
credits
|
|
27331
27788
|
);
|
|
27332
|
-
return /* @__PURE__ */ (0,
|
|
27333
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
27789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
|
|
27790
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27334
27791
|
Icon3,
|
|
27335
27792
|
{
|
|
27336
27793
|
"data-testid": "sch-feature-icon",
|
|
@@ -27340,31 +27797,31 @@ var Entitlement2 = ({
|
|
|
27340
27797
|
rounded: true
|
|
27341
27798
|
}
|
|
27342
27799
|
),
|
|
27343
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
27344
|
-
/* @__PURE__ */ (0,
|
|
27345
|
-
/* @__PURE__ */ (0,
|
|
27800
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27801
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
27802
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27346
27803
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27347
27804
|
" ",
|
|
27348
27805
|
t4("per"),
|
|
27349
27806
|
" ",
|
|
27350
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ (0,
|
|
27807
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27351
27808
|
formatNumber(entitlementPackageSize),
|
|
27352
27809
|
" "
|
|
27353
27810
|
] }),
|
|
27354
27811
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
27355
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
27812
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27356
27813
|
" ",
|
|
27357
27814
|
t4("per"),
|
|
27358
27815
|
" ",
|
|
27359
27816
|
selectedPeriod
|
|
27360
27817
|
] })
|
|
27361
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0,
|
|
27818
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27362
27819
|
TieredPricingDetails,
|
|
27363
27820
|
{
|
|
27364
27821
|
entitlement,
|
|
27365
27822
|
period: selectedPeriod
|
|
27366
27823
|
}
|
|
27367
|
-
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0,
|
|
27824
|
+
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27368
27825
|
formatConsumptionRate(entitlement.consumptionRate),
|
|
27369
27826
|
" ",
|
|
27370
27827
|
getFeatureName(
|
|
@@ -27375,7 +27832,7 @@ var Entitlement2 = ({
|
|
|
27375
27832
|
t4("per"),
|
|
27376
27833
|
" ",
|
|
27377
27834
|
getFeatureName(entitlement.feature, 1)
|
|
27378
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0,
|
|
27835
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
|
|
27379
27836
|
amount: formatNumber(creditBasedEntitlementLimit.limit),
|
|
27380
27837
|
units: getFeatureName(
|
|
27381
27838
|
entitlement.feature,
|
|
@@ -27388,25 +27845,25 @@ var Entitlement2 = ({
|
|
|
27388
27845
|
entitlement.feature,
|
|
27389
27846
|
creditBasedEntitlementLimit.limit
|
|
27390
27847
|
)
|
|
27391
|
-
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0,
|
|
27848
|
+
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27392
27849
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
|
|
27393
27850
|
item: getFeatureName(entitlement.feature)
|
|
27394
|
-
}) : /* @__PURE__ */ (0,
|
|
27395
|
-
typeof limit === "number" && /* @__PURE__ */ (0,
|
|
27851
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27852
|
+
typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27396
27853
|
formatNumber(limit),
|
|
27397
27854
|
" "
|
|
27398
27855
|
] }),
|
|
27399
27856
|
getFeatureName(entitlement.feature, limit)
|
|
27400
27857
|
] }),
|
|
27401
|
-
metricPeriodName && /* @__PURE__ */ (0,
|
|
27858
|
+
metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27402
27859
|
" ",
|
|
27403
27860
|
t4("per"),
|
|
27404
27861
|
" ",
|
|
27405
27862
|
t4(metricPeriodName)
|
|
27406
27863
|
] })
|
|
27407
27864
|
] }) : entitlement.feature.name }),
|
|
27408
|
-
/* @__PURE__ */ (0,
|
|
27409
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0,
|
|
27865
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Text, { children: [
|
|
27866
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
27410
27867
|
Text,
|
|
27411
27868
|
{
|
|
27412
27869
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27416,7 +27873,7 @@ var Entitlement2 = ({
|
|
|
27416
27873
|
" ",
|
|
27417
27874
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27418
27875
|
"/",
|
|
27419
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ (0,
|
|
27876
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27420
27877
|
formatNumber(entitlementPackageSize),
|
|
27421
27878
|
" "
|
|
27422
27879
|
] }),
|
|
@@ -27424,14 +27881,14 @@ var Entitlement2 = ({
|
|
|
27424
27881
|
entitlement.feature,
|
|
27425
27882
|
entitlementPackageSize
|
|
27426
27883
|
),
|
|
27427
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
27884
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27428
27885
|
"/",
|
|
27429
27886
|
shortenPeriod(selectedPeriod)
|
|
27430
27887
|
] })
|
|
27431
27888
|
]
|
|
27432
27889
|
}
|
|
27433
|
-
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0,
|
|
27434
|
-
/* @__PURE__ */ (0,
|
|
27890
|
+
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27891
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27435
27892
|
Text,
|
|
27436
27893
|
{
|
|
27437
27894
|
style: { opacity: 0.54 },
|
|
@@ -27440,7 +27897,7 @@ var Entitlement2 = ({
|
|
|
27440
27897
|
children: t4("Tier-based")
|
|
27441
27898
|
}
|
|
27442
27899
|
),
|
|
27443
|
-
/* @__PURE__ */ (0,
|
|
27900
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27444
27901
|
PricingTiersTooltip,
|
|
27445
27902
|
{
|
|
27446
27903
|
feature: entitlement.feature,
|
|
@@ -27451,14 +27908,14 @@ var Entitlement2 = ({
|
|
|
27451
27908
|
}
|
|
27452
27909
|
)
|
|
27453
27910
|
] }),
|
|
27454
|
-
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
27911
|
+
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27455
27912
|
HardLimitTooltip,
|
|
27456
27913
|
{
|
|
27457
27914
|
feature: entitlement.feature,
|
|
27458
27915
|
limit: entitlement.valueNumeric
|
|
27459
27916
|
}
|
|
27460
27917
|
),
|
|
27461
|
-
entitlement.billingThreshold && /* @__PURE__ */ (0,
|
|
27918
|
+
entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27462
27919
|
BillingThresholdTooltip,
|
|
27463
27920
|
{
|
|
27464
27921
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -27466,7 +27923,7 @@ var Entitlement2 = ({
|
|
|
27466
27923
|
)
|
|
27467
27924
|
] })
|
|
27468
27925
|
] }),
|
|
27469
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0,
|
|
27926
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27470
27927
|
Text,
|
|
27471
27928
|
{
|
|
27472
27929
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27479,7 +27936,7 @@ var Entitlement2 = ({
|
|
|
27479
27936
|
};
|
|
27480
27937
|
|
|
27481
27938
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27482
|
-
var
|
|
27939
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
27483
27940
|
var Plan2 = ({
|
|
27484
27941
|
plan,
|
|
27485
27942
|
index,
|
|
@@ -27493,7 +27950,7 @@ var Plan2 = ({
|
|
|
27493
27950
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
27494
27951
|
const isLightBackground = useIsLightBackground();
|
|
27495
27952
|
const trialEnd = useTrialEnd();
|
|
27496
|
-
const [entitlementVisibility, setEntitlementVisibility] = (0,
|
|
27953
|
+
const [entitlementVisibility, setEntitlementVisibility] = (0, import_react63.useState)({});
|
|
27497
27954
|
const handleToggleShowAll = (id) => {
|
|
27498
27955
|
setEntitlementVisibility((prev2) => {
|
|
27499
27956
|
const updated = !(prev2[id] ?? false);
|
|
@@ -27522,7 +27979,7 @@ var Plan2 = ({
|
|
|
27522
27979
|
const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
|
|
27523
27980
|
const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
|
|
27524
27981
|
const isExpanded = entitlementVisibility[plan.id] ?? false;
|
|
27525
|
-
return /* @__PURE__ */ (0,
|
|
27982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27526
27983
|
Flex,
|
|
27527
27984
|
{
|
|
27528
27985
|
as: "li",
|
|
@@ -27542,7 +27999,7 @@ var Plan2 = ({
|
|
|
27542
27999
|
$boxShadow: cardBoxShadow
|
|
27543
28000
|
},
|
|
27544
28001
|
children: [
|
|
27545
|
-
/* @__PURE__ */ (0,
|
|
28002
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27546
28003
|
Flex,
|
|
27547
28004
|
{
|
|
27548
28005
|
$flexDirection: "column",
|
|
@@ -27553,7 +28010,7 @@ var Plan2 = ({
|
|
|
27553
28010
|
$borderStyle: "solid",
|
|
27554
28011
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27555
28012
|
children: [
|
|
27556
|
-
/* @__PURE__ */ (0,
|
|
28013
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27557
28014
|
Text,
|
|
27558
28015
|
{
|
|
27559
28016
|
as: "h3",
|
|
@@ -27562,8 +28019,8 @@ var Plan2 = ({
|
|
|
27562
28019
|
children: plan.name
|
|
27563
28020
|
}
|
|
27564
28021
|
) }),
|
|
27565
|
-
layout.plans.description.isVisible && /* @__PURE__ */ (0,
|
|
27566
|
-
/* @__PURE__ */ (0,
|
|
28022
|
+
layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
28023
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27567
28024
|
Text,
|
|
27568
28025
|
{
|
|
27569
28026
|
"data-testid": "sch-plan-price",
|
|
@@ -27579,14 +28036,14 @@ var Plan2 = ({
|
|
|
27579
28036
|
currency: planCurrency,
|
|
27580
28037
|
testSignificantDigits: false
|
|
27581
28038
|
}) : formatCurrency(planPrice ?? 0, planCurrency),
|
|
27582
|
-
!plan.custom && !isFreePlan && /* @__PURE__ */ (0,
|
|
28039
|
+
!plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("sub", { children: [
|
|
27583
28040
|
"/",
|
|
27584
28041
|
showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
|
|
27585
28042
|
] })
|
|
27586
28043
|
]
|
|
27587
28044
|
}
|
|
27588
28045
|
) }),
|
|
27589
|
-
showCredits && credits.length > 0 && /* @__PURE__ */ (0,
|
|
28046
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27590
28047
|
Flex,
|
|
27591
28048
|
{
|
|
27592
28049
|
as: "ul",
|
|
@@ -27598,8 +28055,8 @@ var Plan2 = ({
|
|
|
27598
28055
|
$margin: 0,
|
|
27599
28056
|
$listStyle: "none",
|
|
27600
28057
|
children: credits.map((credit, idx) => {
|
|
27601
|
-
return /* @__PURE__ */ (0,
|
|
27602
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0,
|
|
28058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
|
|
28059
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27603
28060
|
Icon3,
|
|
27604
28061
|
{
|
|
27605
28062
|
"data-testid": "sch-feature-icon",
|
|
@@ -27609,13 +28066,13 @@ var Plan2 = ({
|
|
|
27609
28066
|
rounded: true
|
|
27610
28067
|
}
|
|
27611
28068
|
),
|
|
27612
|
-
credit.name && /* @__PURE__ */ (0,
|
|
28069
|
+
credit.name && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27613
28070
|
Flex,
|
|
27614
28071
|
{
|
|
27615
28072
|
$flexDirection: "column",
|
|
27616
28073
|
$justifyContent: "center",
|
|
27617
28074
|
$gap: "0.5rem",
|
|
27618
|
-
children: /* @__PURE__ */ (0,
|
|
28075
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27619
28076
|
PlanCreditText,
|
|
27620
28077
|
{
|
|
27621
28078
|
credit,
|
|
@@ -27628,7 +28085,7 @@ var Plan2 = ({
|
|
|
27628
28085
|
})
|
|
27629
28086
|
}
|
|
27630
28087
|
),
|
|
27631
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
28088
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27632
28089
|
Flex,
|
|
27633
28090
|
{
|
|
27634
28091
|
"data-testid": "sch-plan-active",
|
|
@@ -27638,7 +28095,7 @@ var Plan2 = ({
|
|
|
27638
28095
|
$backgroundColor: settings.theme.primary,
|
|
27639
28096
|
$borderRadius: "9999px",
|
|
27640
28097
|
$padding: "0.125rem 0.85rem",
|
|
27641
|
-
children: /* @__PURE__ */ (0,
|
|
28098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27642
28099
|
Text,
|
|
27643
28100
|
{
|
|
27644
28101
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27651,7 +28108,7 @@ var Plan2 = ({
|
|
|
27651
28108
|
]
|
|
27652
28109
|
}
|
|
27653
28110
|
),
|
|
27654
|
-
/* @__PURE__ */ (0,
|
|
28111
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27655
28112
|
Flex,
|
|
27656
28113
|
{
|
|
27657
28114
|
$flexDirection: "column",
|
|
@@ -27660,7 +28117,7 @@ var Plan2 = ({
|
|
|
27660
28117
|
$gap: `${cardPadding}rem`,
|
|
27661
28118
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27662
28119
|
children: [
|
|
27663
|
-
layout.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
28120
|
+
layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27664
28121
|
Flex,
|
|
27665
28122
|
{
|
|
27666
28123
|
as: "ul",
|
|
@@ -27671,14 +28128,14 @@ var Plan2 = ({
|
|
|
27671
28128
|
$margin: 0,
|
|
27672
28129
|
$listStyle: "none",
|
|
27673
28130
|
children: [
|
|
27674
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0,
|
|
28131
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { children: t4("Everything in", {
|
|
27675
28132
|
plan: plans[index - 1].name
|
|
27676
28133
|
}) }) }),
|
|
27677
28134
|
(plan.entitlements ?? []).reduce(
|
|
27678
28135
|
(acc, entitlement, idx) => {
|
|
27679
28136
|
if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
|
|
27680
28137
|
acc.push(
|
|
27681
|
-
/* @__PURE__ */ (0,
|
|
28138
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27682
28139
|
Entitlement2,
|
|
27683
28140
|
{
|
|
27684
28141
|
entitlement,
|
|
@@ -27696,7 +28153,7 @@ var Plan2 = ({
|
|
|
27696
28153
|
},
|
|
27697
28154
|
[]
|
|
27698
28155
|
),
|
|
27699
|
-
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0,
|
|
28156
|
+
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27700
28157
|
ExpandListToggle,
|
|
27701
28158
|
{
|
|
27702
28159
|
as: "li",
|
|
@@ -27711,7 +28168,7 @@ var Plan2 = ({
|
|
|
27711
28168
|
]
|
|
27712
28169
|
}
|
|
27713
28170
|
),
|
|
27714
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
28171
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
27715
28172
|
Flex,
|
|
27716
28173
|
{
|
|
27717
28174
|
$justifyContent: "center",
|
|
@@ -27719,7 +28176,7 @@ var Plan2 = ({
|
|
|
27719
28176
|
$gap: "0.25rem",
|
|
27720
28177
|
$padding: "0.625rem 0",
|
|
27721
28178
|
children: [
|
|
27722
|
-
/* @__PURE__ */ (0,
|
|
28179
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27723
28180
|
Icon3,
|
|
27724
28181
|
{
|
|
27725
28182
|
name: "check-rounded",
|
|
@@ -27727,11 +28184,11 @@ var Plan2 = ({
|
|
|
27727
28184
|
color: settings.theme.primary
|
|
27728
28185
|
}
|
|
27729
28186
|
),
|
|
27730
|
-
/* @__PURE__ */ (0,
|
|
28187
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
|
|
27731
28188
|
]
|
|
27732
28189
|
}
|
|
27733
|
-
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
27734
|
-
/* @__PURE__ */ (0,
|
|
28190
|
+
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28191
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
27735
28192
|
Button,
|
|
27736
28193
|
{
|
|
27737
28194
|
type: "button",
|
|
@@ -27769,10 +28226,10 @@ var Plan2 = ({
|
|
|
27769
28226
|
}
|
|
27770
28227
|
},
|
|
27771
28228
|
$fullWidth: true,
|
|
27772
|
-
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ (0,
|
|
28229
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
|
|
27773
28230
|
}
|
|
27774
28231
|
),
|
|
27775
|
-
!plan.valid && /* @__PURE__ */ (0,
|
|
28232
|
+
!plan.valid && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UsageViolationText, { violations: plan.usageViolations })
|
|
27776
28233
|
] })
|
|
27777
28234
|
]
|
|
27778
28235
|
}
|
|
@@ -27783,7 +28240,7 @@ var Plan2 = ({
|
|
|
27783
28240
|
};
|
|
27784
28241
|
|
|
27785
28242
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
27786
|
-
var
|
|
28243
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
27787
28244
|
var resolveDesignProps8 = (props) => {
|
|
27788
28245
|
return {
|
|
27789
28246
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -27826,11 +28283,11 @@ var resolveDesignProps8 = (props) => {
|
|
|
27826
28283
|
}
|
|
27827
28284
|
};
|
|
27828
28285
|
};
|
|
27829
|
-
var PricingTable = (0,
|
|
28286
|
+
var PricingTable = (0, import_react64.forwardRef)(({ className, ...rest }, ref) => {
|
|
27830
28287
|
const props = resolveDesignProps8(rest);
|
|
27831
28288
|
const { t: t4 } = useTranslation();
|
|
27832
28289
|
const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
|
|
27833
|
-
const getCallToActionTarget = (0,
|
|
28290
|
+
const getCallToActionTarget = (0, import_react64.useCallback)(
|
|
27834
28291
|
(url, target) => {
|
|
27835
28292
|
if (target) {
|
|
27836
28293
|
return target;
|
|
@@ -27848,11 +28305,11 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27848
28305
|
},
|
|
27849
28306
|
[]
|
|
27850
28307
|
);
|
|
27851
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
28308
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react64.useState)(
|
|
27852
28309
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
|
|
27853
28310
|
);
|
|
27854
28311
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
27855
|
-
const [selectedCurrency, setSelectedCurrency] = (0,
|
|
28312
|
+
const [selectedCurrency, setSelectedCurrency] = (0, import_react64.useState)(
|
|
27856
28313
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
27857
28314
|
);
|
|
27858
28315
|
if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
|
|
@@ -27870,25 +28327,25 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27870
28327
|
} = useAvailablePlans(selectedPeriod, {
|
|
27871
28328
|
useSelectedPeriod: showPeriodToggle
|
|
27872
28329
|
});
|
|
27873
|
-
const plans = (0,
|
|
28330
|
+
const plans = (0, import_react64.useMemo)(
|
|
27874
28331
|
() => hasCurrency ? allPlans.filter(
|
|
27875
28332
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
27876
28333
|
) : allPlans,
|
|
27877
28334
|
[allPlans, hasCurrency, selectedCurrency]
|
|
27878
28335
|
);
|
|
27879
|
-
const addOns = (0,
|
|
28336
|
+
const addOns = (0, import_react64.useMemo)(
|
|
27880
28337
|
() => hasCurrency ? allAddOns.filter(
|
|
27881
28338
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
27882
28339
|
) : allAddOns,
|
|
27883
28340
|
[allAddOns, hasCurrency, selectedCurrency]
|
|
27884
28341
|
);
|
|
27885
|
-
(0,
|
|
28342
|
+
(0, import_react64.useEffect)(() => {
|
|
27886
28343
|
if (typeof data?.component === "undefined") {
|
|
27887
28344
|
hydratePublic();
|
|
27888
28345
|
}
|
|
27889
28346
|
}, [data?.component, hydratePublic]);
|
|
27890
28347
|
if (isPending) {
|
|
27891
|
-
return /* @__PURE__ */ (0,
|
|
28348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27892
28349
|
Flex,
|
|
27893
28350
|
{
|
|
27894
28351
|
$width: "100%",
|
|
@@ -27896,12 +28353,12 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27896
28353
|
$alignItems: "center",
|
|
27897
28354
|
$justifyContent: "center",
|
|
27898
28355
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
27899
|
-
children: /* @__PURE__ */ (0,
|
|
28356
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
|
|
27900
28357
|
}
|
|
27901
28358
|
);
|
|
27902
28359
|
}
|
|
27903
28360
|
if (hasNoUsableCurrency) {
|
|
27904
|
-
return /* @__PURE__ */ (0,
|
|
28361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
|
|
27905
28362
|
}
|
|
27906
28363
|
const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
|
|
27907
28364
|
const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
|
|
@@ -27909,8 +28366,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27909
28366
|
rest.callToActionUrl,
|
|
27910
28367
|
rest.callToActionTarget
|
|
27911
28368
|
);
|
|
27912
|
-
const Wrapper = typeof data?.component === "undefined" ? Container :
|
|
27913
|
-
return /* @__PURE__ */ (0,
|
|
28369
|
+
const Wrapper = typeof data?.component === "undefined" ? Container : import_react64.Fragment;
|
|
28370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
27914
28371
|
FussyChild,
|
|
27915
28372
|
{
|
|
27916
28373
|
ref,
|
|
@@ -27920,8 +28377,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27920
28377
|
$flexDirection: "column",
|
|
27921
28378
|
$gap: "2rem",
|
|
27922
28379
|
children: [
|
|
27923
|
-
/* @__PURE__ */ (0,
|
|
27924
|
-
/* @__PURE__ */ (0,
|
|
28380
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Box, { children: [
|
|
28381
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
27925
28382
|
Flex,
|
|
27926
28383
|
{
|
|
27927
28384
|
$flexDirection: "column",
|
|
@@ -27936,7 +28393,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27936
28393
|
}
|
|
27937
28394
|
},
|
|
27938
28395
|
children: [
|
|
27939
|
-
/* @__PURE__ */ (0,
|
|
28396
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27940
28397
|
Text,
|
|
27941
28398
|
{
|
|
27942
28399
|
as: "h2",
|
|
@@ -27945,8 +28402,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27945
28402
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
|
|
27946
28403
|
}
|
|
27947
28404
|
),
|
|
27948
|
-
/* @__PURE__ */ (0,
|
|
27949
|
-
showCurrencySelector && /* @__PURE__ */ (0,
|
|
28405
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
|
|
28406
|
+
showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27950
28407
|
CurrencyToggle,
|
|
27951
28408
|
{
|
|
27952
28409
|
currencies,
|
|
@@ -27954,7 +28411,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27954
28411
|
onSelect: setSelectedCurrency
|
|
27955
28412
|
}
|
|
27956
28413
|
),
|
|
27957
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0,
|
|
28414
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27958
28415
|
PeriodToggle,
|
|
27959
28416
|
{
|
|
27960
28417
|
options: periods,
|
|
@@ -27971,7 +28428,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27971
28428
|
]
|
|
27972
28429
|
}
|
|
27973
28430
|
),
|
|
27974
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
28431
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27975
28432
|
Box,
|
|
27976
28433
|
{
|
|
27977
28434
|
as: "ul",
|
|
@@ -27984,7 +28441,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
27984
28441
|
$listStyle: "none",
|
|
27985
28442
|
children: plans.map((plan, index, self2) => {
|
|
27986
28443
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
27987
|
-
return /* @__PURE__ */ (0,
|
|
28444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
27988
28445
|
Plan2,
|
|
27989
28446
|
{
|
|
27990
28447
|
plan,
|
|
@@ -28006,14 +28463,14 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
28006
28463
|
}
|
|
28007
28464
|
)
|
|
28008
28465
|
] }),
|
|
28009
|
-
/* @__PURE__ */ (0,
|
|
28010
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
28466
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
28467
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28011
28468
|
Flex,
|
|
28012
28469
|
{
|
|
28013
28470
|
$justifyContent: "space-between",
|
|
28014
28471
|
$alignItems: "center",
|
|
28015
28472
|
$marginBottom: "1rem",
|
|
28016
|
-
children: /* @__PURE__ */ (0,
|
|
28473
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28017
28474
|
Text,
|
|
28018
28475
|
{
|
|
28019
28476
|
as: "h2",
|
|
@@ -28024,7 +28481,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
28024
28481
|
)
|
|
28025
28482
|
}
|
|
28026
28483
|
),
|
|
28027
|
-
/* @__PURE__ */ (0,
|
|
28484
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28028
28485
|
Box,
|
|
28029
28486
|
{
|
|
28030
28487
|
as: "ul",
|
|
@@ -28036,7 +28493,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
28036
28493
|
$listStyle: "none",
|
|
28037
28494
|
children: addOns.map((addOn, index) => {
|
|
28038
28495
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28039
|
-
return /* @__PURE__ */ (0,
|
|
28496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28040
28497
|
AddOn2,
|
|
28041
28498
|
{
|
|
28042
28499
|
addOn,
|
|
@@ -28063,8 +28520,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
|
|
|
28063
28520
|
PricingTable.displayName = "PricingTable";
|
|
28064
28521
|
|
|
28065
28522
|
// src/components/elements/text/Text.tsx
|
|
28066
|
-
var
|
|
28067
|
-
var
|
|
28523
|
+
var import_react65 = require("react");
|
|
28524
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
28068
28525
|
var resolveDesignProps9 = (props) => {
|
|
28069
28526
|
return {
|
|
28070
28527
|
text: {
|
|
@@ -28074,9 +28531,9 @@ var resolveDesignProps9 = (props) => {
|
|
|
28074
28531
|
}
|
|
28075
28532
|
};
|
|
28076
28533
|
};
|
|
28077
|
-
var TextElement = (0,
|
|
28534
|
+
var TextElement = (0, import_react65.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
28078
28535
|
const props = resolveDesignProps9(rest);
|
|
28079
|
-
return /* @__PURE__ */ (0,
|
|
28536
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
28080
28537
|
Text,
|
|
28081
28538
|
{
|
|
28082
28539
|
display: props.text.fontStyle,
|
|
@@ -28089,8 +28546,8 @@ var TextElement = (0, import_react64.forwardRef)(({ children, className, ...rest
|
|
|
28089
28546
|
TextElement.displayName = "Text";
|
|
28090
28547
|
|
|
28091
28548
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28092
|
-
var
|
|
28093
|
-
var
|
|
28549
|
+
var import_react66 = require("react");
|
|
28550
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
28094
28551
|
var buttonStyles = {
|
|
28095
28552
|
primary: {
|
|
28096
28553
|
color: "primary",
|
|
@@ -28116,17 +28573,17 @@ var resolveDesignProps10 = (props) => {
|
|
|
28116
28573
|
}
|
|
28117
28574
|
};
|
|
28118
28575
|
};
|
|
28119
|
-
var UnsubscribeButton = (0,
|
|
28576
|
+
var UnsubscribeButton = (0, import_react66.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
28120
28577
|
const props = resolveDesignProps10(rest);
|
|
28121
28578
|
const { t: t4 } = useTranslation();
|
|
28122
28579
|
const { data, setLayout } = useEmbed();
|
|
28123
|
-
const hasActiveSubscription = (0,
|
|
28580
|
+
const hasActiveSubscription = (0, import_react66.useMemo)(() => {
|
|
28124
28581
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28125
28582
|
}, [data?.subscription]);
|
|
28126
28583
|
if (!hasActiveSubscription) {
|
|
28127
28584
|
return null;
|
|
28128
28585
|
}
|
|
28129
|
-
return /* @__PURE__ */ (0,
|
|
28586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
28130
28587
|
Element,
|
|
28131
28588
|
{
|
|
28132
28589
|
as: Flex,
|
|
@@ -28134,7 +28591,7 @@ var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, .
|
|
|
28134
28591
|
className,
|
|
28135
28592
|
$flexDirection: "column",
|
|
28136
28593
|
$gap: "2rem",
|
|
28137
|
-
children: /* @__PURE__ */ (0,
|
|
28594
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
28138
28595
|
Button,
|
|
28139
28596
|
{
|
|
28140
28597
|
type: "button",
|
|
@@ -28155,8 +28612,8 @@ var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, .
|
|
|
28155
28612
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
28156
28613
|
|
|
28157
28614
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
28158
|
-
var
|
|
28159
|
-
var
|
|
28615
|
+
var import_react67 = require("react");
|
|
28616
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
28160
28617
|
function resolveDesignProps11(props) {
|
|
28161
28618
|
return {
|
|
28162
28619
|
header: {
|
|
@@ -28175,15 +28632,15 @@ function resolveDesignProps11(props) {
|
|
|
28175
28632
|
}
|
|
28176
28633
|
};
|
|
28177
28634
|
}
|
|
28178
|
-
var UpcomingBill = (0,
|
|
28635
|
+
var UpcomingBill = (0, import_react67.forwardRef)(({ className, ...rest }, ref) => {
|
|
28179
28636
|
const props = resolveDesignProps11(rest);
|
|
28180
28637
|
const { t: t4 } = useTranslation();
|
|
28181
28638
|
const { data, settings, getUpcomingInvoice } = useEmbed();
|
|
28182
28639
|
const isLightBackground = useIsLightBackground();
|
|
28183
|
-
const [isLoading, setIsLoading] = (0,
|
|
28184
|
-
const [error, setError] = (0,
|
|
28185
|
-
const [upcomingInvoice, setUpcomingInvoice] = (0,
|
|
28186
|
-
const discounts = (0,
|
|
28640
|
+
const [isLoading, setIsLoading] = (0, import_react67.useState)(false);
|
|
28641
|
+
const [error, setError] = (0, import_react67.useState)();
|
|
28642
|
+
const [upcomingInvoice, setUpcomingInvoice] = (0, import_react67.useState)(data?.upcomingInvoice);
|
|
28643
|
+
const discounts = (0, import_react67.useMemo)(() => {
|
|
28187
28644
|
return (data?.subscription?.discounts || []).filter(
|
|
28188
28645
|
(discount) => (
|
|
28189
28646
|
// Only surface discounts that are currently active and actually
|
|
@@ -28201,7 +28658,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28201
28658
|
durationInMonths: discount.durationInMonths ?? void 0
|
|
28202
28659
|
}));
|
|
28203
28660
|
}, [data?.subscription?.discounts]);
|
|
28204
|
-
const getInvoice = (0,
|
|
28661
|
+
const getInvoice = (0, import_react67.useCallback)(async () => {
|
|
28205
28662
|
if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
|
|
28206
28663
|
try {
|
|
28207
28664
|
setError(void 0);
|
|
@@ -28217,15 +28674,15 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28217
28674
|
}
|
|
28218
28675
|
}
|
|
28219
28676
|
}, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
|
|
28220
|
-
(0,
|
|
28677
|
+
(0, import_react67.useEffect)(() => {
|
|
28221
28678
|
getInvoice();
|
|
28222
28679
|
}, [getInvoice]);
|
|
28223
|
-
(0,
|
|
28680
|
+
(0, import_react67.useEffect)(() => {
|
|
28224
28681
|
if (data?.upcomingInvoice) {
|
|
28225
28682
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
28226
28683
|
}
|
|
28227
28684
|
}, [data?.upcomingInvoice]);
|
|
28228
|
-
const { currency, applied, remaining } = (0,
|
|
28685
|
+
const { currency, applied, remaining } = (0, import_react67.useMemo)(() => {
|
|
28229
28686
|
const currency2 = upcomingInvoice?.currency;
|
|
28230
28687
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
28231
28688
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -28244,9 +28701,9 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28244
28701
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
28245
28702
|
return null;
|
|
28246
28703
|
}
|
|
28247
|
-
return /* @__PURE__ */ (0,
|
|
28248
|
-
/* @__PURE__ */ (0,
|
|
28249
|
-
error ? /* @__PURE__ */ (0,
|
|
28704
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Element, { ref, className, children: [
|
|
28705
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
28706
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28250
28707
|
Flex,
|
|
28251
28708
|
{
|
|
28252
28709
|
as: TransitionBox,
|
|
@@ -28255,8 +28712,8 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28255
28712
|
$alignItems: "center",
|
|
28256
28713
|
$gap: "1rem",
|
|
28257
28714
|
children: [
|
|
28258
|
-
/* @__PURE__ */ (0,
|
|
28259
|
-
/* @__PURE__ */ (0,
|
|
28715
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
|
|
28716
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28260
28717
|
Button,
|
|
28261
28718
|
{
|
|
28262
28719
|
type: "button",
|
|
@@ -28269,28 +28726,28 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28269
28726
|
)
|
|
28270
28727
|
]
|
|
28271
28728
|
}
|
|
28272
|
-
) : !isLoading && /* @__PURE__ */ (0,
|
|
28273
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0,
|
|
28729
|
+
) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
28730
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Text, { display: props.header.fontStyle, children: [
|
|
28274
28731
|
props.header.prefix,
|
|
28275
28732
|
" ",
|
|
28276
28733
|
toPrettyDate(upcomingInvoice.dueDate)
|
|
28277
28734
|
] }),
|
|
28278
|
-
/* @__PURE__ */ (0,
|
|
28735
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28279
28736
|
Flex,
|
|
28280
28737
|
{
|
|
28281
28738
|
$justifyContent: "space-between",
|
|
28282
28739
|
$alignItems: "start",
|
|
28283
28740
|
$gap: "1rem",
|
|
28284
28741
|
children: [
|
|
28285
|
-
props.price.isVisible && /* @__PURE__ */ (0,
|
|
28742
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
|
|
28286
28743
|
upcomingInvoice.amountDue,
|
|
28287
28744
|
upcomingInvoice.currency
|
|
28288
28745
|
) }),
|
|
28289
|
-
/* @__PURE__ */ (0,
|
|
28746
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
|
|
28290
28747
|
]
|
|
28291
28748
|
}
|
|
28292
28749
|
),
|
|
28293
|
-
hasApplied && /* @__PURE__ */ (0,
|
|
28750
|
+
hasApplied && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28294
28751
|
Flex,
|
|
28295
28752
|
{
|
|
28296
28753
|
as: TransitionBox,
|
|
@@ -28298,12 +28755,12 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28298
28755
|
$alignItems: "start",
|
|
28299
28756
|
$gap: "1rem",
|
|
28300
28757
|
children: [
|
|
28301
|
-
/* @__PURE__ */ (0,
|
|
28302
|
-
/* @__PURE__ */ (0,
|
|
28758
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
|
|
28759
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(-applied, currency) })
|
|
28303
28760
|
]
|
|
28304
28761
|
}
|
|
28305
28762
|
),
|
|
28306
|
-
hasBalance && /* @__PURE__ */ (0,
|
|
28763
|
+
hasBalance && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28307
28764
|
Flex,
|
|
28308
28765
|
{
|
|
28309
28766
|
as: TransitionBox,
|
|
@@ -28311,20 +28768,20 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28311
28768
|
$alignItems: "start",
|
|
28312
28769
|
$gap: "1rem",
|
|
28313
28770
|
children: [
|
|
28314
|
-
/* @__PURE__ */ (0,
|
|
28315
|
-
/* @__PURE__ */ (0,
|
|
28771
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
|
|
28772
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(remaining, currency) })
|
|
28316
28773
|
]
|
|
28317
28774
|
}
|
|
28318
28775
|
),
|
|
28319
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
28776
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28320
28777
|
Flex,
|
|
28321
28778
|
{
|
|
28322
28779
|
$justifyContent: "space-between",
|
|
28323
28780
|
$alignItems: "start",
|
|
28324
28781
|
$gap: "1rem",
|
|
28325
28782
|
children: [
|
|
28326
|
-
/* @__PURE__ */ (0,
|
|
28327
|
-
/* @__PURE__ */ (0,
|
|
28783
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Discount") }),
|
|
28784
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28328
28785
|
Flex,
|
|
28329
28786
|
{
|
|
28330
28787
|
$flexDirection: "column",
|
|
@@ -28340,13 +28797,13 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28340
28797
|
discount?.currency
|
|
28341
28798
|
)
|
|
28342
28799
|
});
|
|
28343
|
-
return /* @__PURE__ */ (0,
|
|
28800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28344
28801
|
Flex,
|
|
28345
28802
|
{
|
|
28346
28803
|
$alignItems: "center",
|
|
28347
28804
|
$gap: "0.5rem",
|
|
28348
28805
|
children: [
|
|
28349
|
-
discount.customerFacingCode && /* @__PURE__ */ (0,
|
|
28806
|
+
discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28350
28807
|
Flex,
|
|
28351
28808
|
{
|
|
28352
28809
|
$alignItems: "center",
|
|
@@ -28355,7 +28812,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28355
28812
|
$borderStyle: "solid",
|
|
28356
28813
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
28357
28814
|
$borderRadius: "0.3125rem",
|
|
28358
|
-
children: /* @__PURE__ */ (0,
|
|
28815
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28359
28816
|
Text,
|
|
28360
28817
|
{
|
|
28361
28818
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28365,7 +28822,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28365
28822
|
)
|
|
28366
28823
|
}
|
|
28367
28824
|
),
|
|
28368
|
-
/* @__PURE__ */ (0,
|
|
28825
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
|
|
28369
28826
|
discount: label,
|
|
28370
28827
|
count: discount.durationInMonths
|
|
28371
28828
|
}) : label }) })
|
|
@@ -28379,7 +28836,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
|
|
|
28379
28836
|
]
|
|
28380
28837
|
}
|
|
28381
28838
|
)
|
|
28382
|
-
] }) : /* @__PURE__ */ (0,
|
|
28839
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
|
|
28383
28840
|
] });
|
|
28384
28841
|
});
|
|
28385
28842
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -31015,10 +31472,10 @@ function inflate(input, options = {}) {
|
|
|
31015
31472
|
}
|
|
31016
31473
|
|
|
31017
31474
|
// src/components/embed/Embed.tsx
|
|
31018
|
-
var
|
|
31475
|
+
var import_react69 = require("react");
|
|
31019
31476
|
|
|
31020
31477
|
// src/components/embed/renderer.ts
|
|
31021
|
-
var
|
|
31478
|
+
var import_react68 = require("react");
|
|
31022
31479
|
var components = {
|
|
31023
31480
|
Root,
|
|
31024
31481
|
Viewport,
|
|
@@ -31082,7 +31539,7 @@ function createRenderer(options) {
|
|
|
31082
31539
|
const { className, ...rest } = props;
|
|
31083
31540
|
const resolvedProps = component === "div" ? rest : props;
|
|
31084
31541
|
const resolvedChildren = children.map(renderNode);
|
|
31085
|
-
return (0,
|
|
31542
|
+
return (0, import_react68.createElement)(
|
|
31086
31543
|
component,
|
|
31087
31544
|
{
|
|
31088
31545
|
key: index,
|
|
@@ -31095,11 +31552,11 @@ function createRenderer(options) {
|
|
|
31095
31552
|
}
|
|
31096
31553
|
|
|
31097
31554
|
// src/components/embed/Embed.tsx
|
|
31098
|
-
var
|
|
31555
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
31099
31556
|
var renderer = createRenderer();
|
|
31100
31557
|
var Loading = () => {
|
|
31101
31558
|
const { settings } = useEmbed();
|
|
31102
|
-
return /* @__PURE__ */ (0,
|
|
31559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
31103
31560
|
Flex,
|
|
31104
31561
|
{
|
|
31105
31562
|
$width: "100%",
|
|
@@ -31107,13 +31564,13 @@ var Loading = () => {
|
|
|
31107
31564
|
$alignItems: "center",
|
|
31108
31565
|
$justifyContent: "center",
|
|
31109
31566
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
31110
|
-
children: /* @__PURE__ */ (0,
|
|
31567
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
|
|
31111
31568
|
}
|
|
31112
31569
|
);
|
|
31113
31570
|
};
|
|
31114
31571
|
var Error2 = ({ message }) => {
|
|
31115
31572
|
const { settings } = useEmbed();
|
|
31116
|
-
return /* @__PURE__ */ (0,
|
|
31573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
31117
31574
|
Flex,
|
|
31118
31575
|
{
|
|
31119
31576
|
$flexDirection: "column",
|
|
@@ -31124,14 +31581,14 @@ var Error2 = ({ message }) => {
|
|
|
31124
31581
|
$alignItems: "center",
|
|
31125
31582
|
$justifyContent: "center",
|
|
31126
31583
|
children: [
|
|
31127
|
-
/* @__PURE__ */ (0,
|
|
31128
|
-
/* @__PURE__ */ (0,
|
|
31584
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { display: "heading1", children: "Error" }) }),
|
|
31585
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: message }) })
|
|
31129
31586
|
]
|
|
31130
31587
|
}
|
|
31131
31588
|
);
|
|
31132
31589
|
};
|
|
31133
31590
|
var SchematicEmbed = ({ id, accessToken }) => {
|
|
31134
|
-
const theme = (0,
|
|
31591
|
+
const theme = (0, import_react69.useContext)(nt);
|
|
31135
31592
|
const {
|
|
31136
31593
|
data,
|
|
31137
31594
|
error,
|
|
@@ -31143,7 +31600,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31143
31600
|
setBuilderSettings
|
|
31144
31601
|
} = useEmbed();
|
|
31145
31602
|
const compressedAst = data?.component?.ast;
|
|
31146
|
-
const { children, parsedSettings, parseError } = (0,
|
|
31603
|
+
const { children, parsedSettings, parseError } = (0, import_react69.useMemo)(() => {
|
|
31147
31604
|
let children2 = null;
|
|
31148
31605
|
let parsedSettings2 = null;
|
|
31149
31606
|
let parseError2 = null;
|
|
@@ -31175,22 +31632,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31175
31632
|
parseError: parseError2
|
|
31176
31633
|
};
|
|
31177
31634
|
}, [compressedAst]);
|
|
31178
|
-
(0,
|
|
31635
|
+
(0, import_react69.useEffect)(() => {
|
|
31179
31636
|
if (accessToken) {
|
|
31180
31637
|
setAccessToken(accessToken);
|
|
31181
31638
|
}
|
|
31182
31639
|
}, [accessToken, setAccessToken]);
|
|
31183
|
-
(0,
|
|
31640
|
+
(0, import_react69.useEffect)(() => {
|
|
31184
31641
|
if (id && stale) {
|
|
31185
31642
|
hydrateComponent(id);
|
|
31186
31643
|
}
|
|
31187
31644
|
}, [id, hydrateComponent, stale]);
|
|
31188
|
-
(0,
|
|
31645
|
+
(0, import_react69.useEffect)(() => {
|
|
31189
31646
|
if (parsedSettings) {
|
|
31190
31647
|
setBuilderSettings(parsedSettings);
|
|
31191
31648
|
}
|
|
31192
31649
|
}, [parsedSettings, setBuilderSettings]);
|
|
31193
|
-
(0,
|
|
31650
|
+
(0, import_react69.useEffect)(() => {
|
|
31194
31651
|
if (parseError) {
|
|
31195
31652
|
setError(parseError);
|
|
31196
31653
|
}
|
|
@@ -31199,13 +31656,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31199
31656
|
return stub();
|
|
31200
31657
|
}
|
|
31201
31658
|
if (error) {
|
|
31202
|
-
return /* @__PURE__ */ (0,
|
|
31659
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: error.message });
|
|
31203
31660
|
}
|
|
31204
31661
|
if (accessToken?.length === 0) {
|
|
31205
|
-
return /* @__PURE__ */ (0,
|
|
31662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: "Please provide an access token." });
|
|
31206
31663
|
}
|
|
31207
31664
|
if (!accessToken?.startsWith("token_")) {
|
|
31208
|
-
return /* @__PURE__ */ (0,
|
|
31665
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
31209
31666
|
Error2,
|
|
31210
31667
|
{
|
|
31211
31668
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -31213,7 +31670,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31213
31670
|
);
|
|
31214
31671
|
}
|
|
31215
31672
|
if (isPending) {
|
|
31216
|
-
return /* @__PURE__ */ (0,
|
|
31673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {});
|
|
31217
31674
|
}
|
|
31218
|
-
return /* @__PURE__ */ (0,
|
|
31675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {}) });
|
|
31219
31676
|
};
|