@schematichq/schematic-components 2.28.0 → 2.29.1
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/README.md +3 -1
- package/dist/schematic-components.browser.cjs.js +695 -458
- package/dist/schematic-components.browser.esm.js +460 -223
- package/dist/schematic-components.cjs.js +695 -458
- package/dist/schematic-components.d.ts +43 -0
- package/dist/schematic-components.esm.js +460 -223
- package/package.json +6 -6
|
@@ -4002,6 +4002,10 @@ function BillingArrearsCadenceFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
4002
4002
|
}
|
|
4003
4003
|
|
|
4004
4004
|
// src/api/checkoutexternal/models/BillingCollectionMethod.ts
|
|
4005
|
+
var BillingCollectionMethod = {
|
|
4006
|
+
ChargeAutomatically: "charge_automatically",
|
|
4007
|
+
SendInvoice: "send_invoice"
|
|
4008
|
+
};
|
|
4005
4009
|
function BillingCollectionMethodFromJSON(json) {
|
|
4006
4010
|
return BillingCollectionMethodFromJSONTyped(json, false);
|
|
4007
4011
|
}
|
|
@@ -6101,6 +6105,48 @@ function CompanyOverrideResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
6101
6105
|
};
|
|
6102
6106
|
}
|
|
6103
6107
|
|
|
6108
|
+
// src/api/checkoutexternal/models/CompanyPaymentMethodResponseData.ts
|
|
6109
|
+
function CompanyPaymentMethodResponseDataFromJSON(json) {
|
|
6110
|
+
return CompanyPaymentMethodResponseDataFromJSONTyped(json, false);
|
|
6111
|
+
}
|
|
6112
|
+
function CompanyPaymentMethodResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6113
|
+
if (json == null) {
|
|
6114
|
+
return json;
|
|
6115
|
+
}
|
|
6116
|
+
return {
|
|
6117
|
+
accountLast4: json["account_last4"] == null ? void 0 : json["account_last4"],
|
|
6118
|
+
accountName: json["account_name"] == null ? void 0 : json["account_name"],
|
|
6119
|
+
bankName: json["bank_name"] == null ? void 0 : json["bank_name"],
|
|
6120
|
+
billingEmail: json["billing_email"] == null ? void 0 : json["billing_email"],
|
|
6121
|
+
billingName: json["billing_name"] == null ? void 0 : json["billing_name"],
|
|
6122
|
+
canRemove: json["can_remove"],
|
|
6123
|
+
cardBrand: json["card_brand"] == null ? void 0 : json["card_brand"],
|
|
6124
|
+
cardExpMonth: json["card_exp_month"] == null ? void 0 : json["card_exp_month"],
|
|
6125
|
+
cardExpYear: json["card_exp_year"] == null ? void 0 : json["card_exp_year"],
|
|
6126
|
+
cardLast4: json["card_last4"] == null ? void 0 : json["card_last4"],
|
|
6127
|
+
externalId: json["external_id"],
|
|
6128
|
+
id: json["id"],
|
|
6129
|
+
isDefault: json["is_default"],
|
|
6130
|
+
type: json["type"]
|
|
6131
|
+
};
|
|
6132
|
+
}
|
|
6133
|
+
|
|
6134
|
+
// src/api/checkoutexternal/models/CompanyPaymentMethodsResponseData.ts
|
|
6135
|
+
function CompanyPaymentMethodsResponseDataFromJSON(json) {
|
|
6136
|
+
return CompanyPaymentMethodsResponseDataFromJSONTyped(json, false);
|
|
6137
|
+
}
|
|
6138
|
+
function CompanyPaymentMethodsResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
6139
|
+
if (json == null) {
|
|
6140
|
+
return json;
|
|
6141
|
+
}
|
|
6142
|
+
return {
|
|
6143
|
+
count: json["count"],
|
|
6144
|
+
paymentMethods: json["payment_methods"].map(
|
|
6145
|
+
CompanyPaymentMethodResponseDataFromJSON
|
|
6146
|
+
)
|
|
6147
|
+
};
|
|
6148
|
+
}
|
|
6149
|
+
|
|
6104
6150
|
// src/api/checkoutexternal/models/CompanyPlanInvalidReason.ts
|
|
6105
6151
|
var CompanyPlanInvalidReason = {
|
|
6106
6152
|
DowngradeNotPermitted: "downgrade_not_permitted",
|
|
@@ -7504,6 +7550,20 @@ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7504
7550
|
};
|
|
7505
7551
|
}
|
|
7506
7552
|
|
|
7553
|
+
// src/api/checkoutexternal/models/GetCompanyPaymentMethodsResponse.ts
|
|
7554
|
+
function GetCompanyPaymentMethodsResponseFromJSON(json) {
|
|
7555
|
+
return GetCompanyPaymentMethodsResponseFromJSONTyped(json, false);
|
|
7556
|
+
}
|
|
7557
|
+
function GetCompanyPaymentMethodsResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
7558
|
+
if (json == null) {
|
|
7559
|
+
return json;
|
|
7560
|
+
}
|
|
7561
|
+
return {
|
|
7562
|
+
data: CompanyPaymentMethodsResponseDataFromJSON(json["data"]),
|
|
7563
|
+
params: json["params"]
|
|
7564
|
+
};
|
|
7565
|
+
}
|
|
7566
|
+
|
|
7507
7567
|
// src/api/checkoutexternal/models/GetCompanyUpcomingInvoiceResponse.ts
|
|
7508
7568
|
function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
|
|
7509
7569
|
return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
|
|
@@ -8398,6 +8458,38 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
8398
8458
|
);
|
|
8399
8459
|
return await response.value();
|
|
8400
8460
|
}
|
|
8461
|
+
/**
|
|
8462
|
+
* Get company payment methods
|
|
8463
|
+
*/
|
|
8464
|
+
async getCompanyPaymentMethodsRaw(initOverrides) {
|
|
8465
|
+
const queryParameters = {};
|
|
8466
|
+
const headerParameters = {};
|
|
8467
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
8468
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
8469
|
+
"X-Schematic-Api-Key"
|
|
8470
|
+
);
|
|
8471
|
+
}
|
|
8472
|
+
const response = await this.request(
|
|
8473
|
+
{
|
|
8474
|
+
path: `/company/payment-methods`,
|
|
8475
|
+
method: "GET",
|
|
8476
|
+
headers: headerParameters,
|
|
8477
|
+
query: queryParameters
|
|
8478
|
+
},
|
|
8479
|
+
initOverrides
|
|
8480
|
+
);
|
|
8481
|
+
return new JSONApiResponse(
|
|
8482
|
+
response,
|
|
8483
|
+
(jsonValue) => GetCompanyPaymentMethodsResponseFromJSON(jsonValue)
|
|
8484
|
+
);
|
|
8485
|
+
}
|
|
8486
|
+
/**
|
|
8487
|
+
* Get company payment methods
|
|
8488
|
+
*/
|
|
8489
|
+
async getCompanyPaymentMethods(initOverrides) {
|
|
8490
|
+
const response = await this.getCompanyPaymentMethodsRaw(initOverrides);
|
|
8491
|
+
return await response.value();
|
|
8492
|
+
}
|
|
8401
8493
|
/**
|
|
8402
8494
|
* Get company upcoming invoice
|
|
8403
8495
|
*/
|
|
@@ -13259,6 +13351,7 @@ var en = {
|
|
|
13259
13351
|
"An invoice is created when charges reach $X; the rest is billed monthly.": "An invoice is created when charges reach {{amount}}; the rest is billed monthly.",
|
|
13260
13352
|
"An unknown error occurred.": "An unknown error occurred.",
|
|
13261
13353
|
"Billed": "Billed {{period}}",
|
|
13354
|
+
"Billing threshold": "Billing threshold",
|
|
13262
13355
|
"Bundle selected": "Bundle selected",
|
|
13263
13356
|
"Buy credits": "Buy credits",
|
|
13264
13357
|
"Cancel": "Cancel",
|
|
@@ -13293,8 +13386,11 @@ var en = {
|
|
|
13293
13386
|
"Due today": "Due today",
|
|
13294
13387
|
"Edit payment details": "Edit payment details",
|
|
13295
13388
|
"Edit": "Edit",
|
|
13389
|
+
"Email": "Email",
|
|
13296
13390
|
"Ends on": "Ends on {{date}}",
|
|
13297
13391
|
"Enter discount code": "Enter discount code",
|
|
13392
|
+
"Enter email address": "Enter email address",
|
|
13393
|
+
"Error": "Error",
|
|
13298
13394
|
"Error initializing payment method change. Please try again.": "Error initializing payment method change. Please try again.",
|
|
13299
13395
|
"Error processing payment. Please try a different payment method.": "Error processing payment. Please try a different payment method.",
|
|
13300
13396
|
"Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
|
|
@@ -13315,6 +13411,7 @@ var en = {
|
|
|
13315
13411
|
"Invoice credit tooltip": "Credit \u2014 this amount was returned to your account, typically due to a plan change or proration",
|
|
13316
13412
|
"Invoice charge tooltip": "Charge \u2014 you were billed this amount",
|
|
13317
13413
|
"Invoices": "Invoices",
|
|
13414
|
+
"Limit": "Limit",
|
|
13318
13415
|
"Limit of": "Limit of {{amount}}",
|
|
13319
13416
|
"Loading": "Loading",
|
|
13320
13417
|
"Manage plan": "Manage plan",
|
|
@@ -13337,8 +13434,11 @@ var en = {
|
|
|
13337
13434
|
"Error saving custom field values. Please try again.": "Error saving custom field values. Please try again.",
|
|
13338
13435
|
"Pay now": "Pay now",
|
|
13339
13436
|
"Payment Details": "Payment Details",
|
|
13437
|
+
"Payment due": "Payment due {{date}}",
|
|
13340
13438
|
"Plan selected": "Plan selected",
|
|
13341
13439
|
"Please accept the agreement to continue.": "Please accept the agreement to continue.",
|
|
13440
|
+
"Please try again later.": "Please try again later.",
|
|
13441
|
+
"Portal not found": "Portal not found",
|
|
13342
13442
|
"Plan": "Plan",
|
|
13343
13443
|
"Plans": "Plans",
|
|
13344
13444
|
"Please provide an access token.": "Please provide an access token.",
|
|
@@ -13390,6 +13490,7 @@ var en = {
|
|
|
13390
13490
|
"There was a problem retrieving your upcoming invoice.": "There was a problem retrieving your upcoming invoice.",
|
|
13391
13491
|
"There was a problem retrieving your invoices.": "There was a problem retrieving your invoices.",
|
|
13392
13492
|
"Tier-based": "Tier-based",
|
|
13493
|
+
"Tiered pricing": "Tiered pricing",
|
|
13393
13494
|
"Tiers apply progressively as quantity increases.": "Tiers apply progressively as quantity increases.",
|
|
13394
13495
|
"Top up balance with:": "Top up balance with:",
|
|
13395
13496
|
"Top-ups": "Top-ups",
|
|
@@ -13463,6 +13564,15 @@ var en = {
|
|
|
13463
13564
|
"$X/unit/period": "{{cost}}/{{unit}}/{{period}}",
|
|
13464
13565
|
"$X/Y units/period": "{{cost}}/{{size}} {{units}}/{{period}}",
|
|
13465
13566
|
"day": "day",
|
|
13567
|
+
"day_one": "day",
|
|
13568
|
+
"day_other": "days",
|
|
13569
|
+
"hour_one": "hour",
|
|
13570
|
+
"hour_other": "hours",
|
|
13571
|
+
"minute_one": "minute",
|
|
13572
|
+
"minute_other": "minutes",
|
|
13573
|
+
"second_one": "second",
|
|
13574
|
+
"second_other": "seconds",
|
|
13575
|
+
"week": "week",
|
|
13466
13576
|
"month": "month",
|
|
13467
13577
|
"quarter": "quarter",
|
|
13468
13578
|
"year": "year",
|
|
@@ -13471,6 +13581,13 @@ var en = {
|
|
|
13471
13581
|
"yr": "yr",
|
|
13472
13582
|
"one time": "one time",
|
|
13473
13583
|
"billing period": "billing period",
|
|
13584
|
+
"billing period_one": "billing period",
|
|
13585
|
+
"billing period_other": "billing periods",
|
|
13586
|
+
"daily": "daily",
|
|
13587
|
+
"weekly": "weekly",
|
|
13588
|
+
"monthly": "monthly",
|
|
13589
|
+
"quarterly": "quarterly",
|
|
13590
|
+
"yearly": "yearly",
|
|
13474
13591
|
"expires after purchase": "expires {{amount}} {{unit}} after purchase",
|
|
13475
13592
|
"expires at the end of the billing period": "expires at the end of the billing period",
|
|
13476
13593
|
"expires at the end of the next billing period": "expires at the end of the next billing period",
|
|
@@ -14160,11 +14277,9 @@ function formatBundleExpiry(bundle, t3) {
|
|
|
14160
14277
|
if (typeof bundle.expiryUnitCount !== "number") {
|
|
14161
14278
|
return void 0;
|
|
14162
14279
|
}
|
|
14163
|
-
const
|
|
14164
|
-
|
|
14165
|
-
|
|
14166
|
-
unit: pluralize(unit, bundle.expiryUnitCount)
|
|
14167
|
-
});
|
|
14280
|
+
const count = bundle.expiryUnitCount;
|
|
14281
|
+
const unit = bundle.expiryUnit === BillingCreditExpiryUnit.BillingPeriods ? t3("billing period", { count }) : t3("day", { count });
|
|
14282
|
+
return t3("expires after purchase", { amount: count, unit });
|
|
14168
14283
|
}
|
|
14169
14284
|
case BillingCreditExpiryType.EndOfBillingPeriod:
|
|
14170
14285
|
return t3("expires at the end of the billing period");
|
|
@@ -14409,16 +14524,33 @@ function entitlementHasHardLimit(entitlement) {
|
|
|
14409
14524
|
}
|
|
14410
14525
|
|
|
14411
14526
|
// src/utils/api/feature.ts
|
|
14412
|
-
function
|
|
14413
|
-
|
|
14527
|
+
function isEnglish(locale) {
|
|
14528
|
+
try {
|
|
14529
|
+
return new Intl.Locale(locale).language === "en";
|
|
14530
|
+
} catch {
|
|
14531
|
+
return true;
|
|
14532
|
+
}
|
|
14533
|
+
}
|
|
14534
|
+
function isOne(count, locale) {
|
|
14535
|
+
return new Intl.PluralRules(locale).select(count) === "one";
|
|
14536
|
+
}
|
|
14537
|
+
function getFeatureName(feature, locale, count, ignore = false) {
|
|
14538
|
+
if (!isEnglish(locale)) {
|
|
14539
|
+
const named = ignore ? { name: feature.name } : feature;
|
|
14540
|
+
const singularName2 = named.singularName || named.name;
|
|
14541
|
+
const pluralName2 = named.pluralName || singularName2;
|
|
14542
|
+
return count !== void 0 && isOne(count, locale) ? singularName2 : pluralName2;
|
|
14543
|
+
}
|
|
14544
|
+
const resolvedCount = count ?? 0;
|
|
14545
|
+
const shouldBePlural = resolvedCount === 0 || resolvedCount > 1;
|
|
14414
14546
|
const { name, singularName, pluralName } = feature;
|
|
14415
14547
|
if (!ignore && pluralName && shouldBePlural) {
|
|
14416
14548
|
return pluralName;
|
|
14417
14549
|
}
|
|
14418
14550
|
if (!ignore && singularName) {
|
|
14419
|
-
return shouldBePlural ? pluralize(singularName,
|
|
14551
|
+
return shouldBePlural ? pluralize(singularName, resolvedCount) : singularName;
|
|
14420
14552
|
}
|
|
14421
|
-
return pluralize(name,
|
|
14553
|
+
return pluralize(name, resolvedCount);
|
|
14422
14554
|
}
|
|
14423
14555
|
|
|
14424
14556
|
// src/utils/color.ts
|
|
@@ -14628,8 +14760,21 @@ function formatCurrency(amount, {
|
|
|
14628
14760
|
function formatOrdinal(n2, t3) {
|
|
14629
14761
|
return t3("Ordinal", { count: n2, ordinal: true });
|
|
14630
14762
|
}
|
|
14631
|
-
function adjectify(
|
|
14632
|
-
|
|
14763
|
+
function adjectify(period, t3) {
|
|
14764
|
+
switch (period) {
|
|
14765
|
+
case "day":
|
|
14766
|
+
return t3("daily");
|
|
14767
|
+
case "week":
|
|
14768
|
+
return t3("weekly");
|
|
14769
|
+
case "month":
|
|
14770
|
+
return t3("monthly");
|
|
14771
|
+
case "quarter":
|
|
14772
|
+
return t3("quarterly");
|
|
14773
|
+
case "year":
|
|
14774
|
+
return t3("yearly");
|
|
14775
|
+
default:
|
|
14776
|
+
return period;
|
|
14777
|
+
}
|
|
14633
14778
|
}
|
|
14634
14779
|
var CURRENCY_FLAGS = {
|
|
14635
14780
|
usd: "\u{1F1FA}\u{1F1F8}",
|
|
@@ -14745,11 +14890,12 @@ function getBillingPreviewText({
|
|
|
14745
14890
|
);
|
|
14746
14891
|
}
|
|
14747
14892
|
const schedule = scheduleParts.length > 0 ? `${scheduleParts.join(" ")} ` : "";
|
|
14893
|
+
const period = t3(planPeriod);
|
|
14748
14894
|
if (!discount) {
|
|
14749
14895
|
return t3("You will be billed", {
|
|
14750
14896
|
price: subscriptionPrice,
|
|
14751
14897
|
usage,
|
|
14752
|
-
period
|
|
14898
|
+
period,
|
|
14753
14899
|
schedule
|
|
14754
14900
|
});
|
|
14755
14901
|
}
|
|
@@ -14758,7 +14904,7 @@ function getBillingPreviewText({
|
|
|
14758
14904
|
return t3("You will be billed", {
|
|
14759
14905
|
price: discountedPrice,
|
|
14760
14906
|
usage,
|
|
14761
|
-
period
|
|
14907
|
+
period,
|
|
14762
14908
|
schedule
|
|
14763
14909
|
});
|
|
14764
14910
|
}
|
|
@@ -14766,7 +14912,7 @@ function getBillingPreviewText({
|
|
|
14766
14912
|
return t3("You will be billed with discount window", {
|
|
14767
14913
|
price: discountedPrice,
|
|
14768
14914
|
usage,
|
|
14769
|
-
period
|
|
14915
|
+
period,
|
|
14770
14916
|
schedule,
|
|
14771
14917
|
window: t3("for the next months", { count: durationInMonths }),
|
|
14772
14918
|
fullPrice: subscriptionPrice
|
|
@@ -14775,7 +14921,7 @@ function getBillingPreviewText({
|
|
|
14775
14921
|
return t3("You will be billed next bill discount", {
|
|
14776
14922
|
price: discountedPrice,
|
|
14777
14923
|
usage,
|
|
14778
|
-
period
|
|
14924
|
+
period,
|
|
14779
14925
|
schedule,
|
|
14780
14926
|
fullPrice: subscriptionPrice
|
|
14781
14927
|
});
|
|
@@ -15550,7 +15696,7 @@ var reducer = (state, action) => {
|
|
|
15550
15696
|
// src/context/EmbedProvider.tsx
|
|
15551
15697
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
15552
15698
|
var getCustomHeaders = (sessionId) => ({
|
|
15553
|
-
"X-Schematic-Components-Version": "2.
|
|
15699
|
+
"X-Schematic-Components-Version": "2.29.1",
|
|
15554
15700
|
"X-Schematic-Session-ID": sessionId
|
|
15555
15701
|
});
|
|
15556
15702
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -16336,6 +16482,29 @@ function useIsLightBackground() {
|
|
|
16336
16482
|
return isLightBackground;
|
|
16337
16483
|
}
|
|
16338
16484
|
|
|
16485
|
+
// src/hooks/useNextBillDate.ts
|
|
16486
|
+
import { useMemo as useMemo7 } from "react";
|
|
16487
|
+
function useNextBillDate(upcomingInvoice) {
|
|
16488
|
+
const { data } = useEmbed();
|
|
16489
|
+
const invoice = upcomingInvoice === void 0 ? data?.upcomingInvoice : upcomingInvoice;
|
|
16490
|
+
const subscription = data?.company?.billingSubscription;
|
|
16491
|
+
const cancelAtPeriodEnd = subscription?.cancelAtPeriodEnd;
|
|
16492
|
+
const periodEnd = subscription?.periodEnd;
|
|
16493
|
+
const collectionMethod = invoice?.collectionMethod;
|
|
16494
|
+
const dueDate = invoice?.dueDate ?? void 0;
|
|
16495
|
+
return useMemo7(() => {
|
|
16496
|
+
if (cancelAtPeriodEnd) {
|
|
16497
|
+
return { billDate: void 0, paymentDueDate: void 0 };
|
|
16498
|
+
}
|
|
16499
|
+
const billDate = periodEnd && periodEnd > 0 ? new Date(periodEnd * 1e3) : dueDate;
|
|
16500
|
+
const hasSeparateDeadline = collectionMethod === BillingCollectionMethod.SendInvoice && dueDate && billDate && new Date(dueDate).toDateString() !== new Date(billDate).toDateString();
|
|
16501
|
+
return {
|
|
16502
|
+
billDate,
|
|
16503
|
+
paymentDueDate: hasSeparateDeadline ? dueDate : void 0
|
|
16504
|
+
};
|
|
16505
|
+
}, [cancelAtPeriodEnd, periodEnd, collectionMethod, dueDate]);
|
|
16506
|
+
}
|
|
16507
|
+
|
|
16339
16508
|
// src/hooks/usePaymentConfirmation.ts
|
|
16340
16509
|
import { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef3, useState } from "react";
|
|
16341
16510
|
var usePaymentConfirmation = ({
|
|
@@ -16443,7 +16612,7 @@ var usePaymentConfirmation = ({
|
|
|
16443
16612
|
};
|
|
16444
16613
|
|
|
16445
16614
|
// src/hooks/useRequest.ts
|
|
16446
|
-
import { useCallback as useCallback5, useMemo as
|
|
16615
|
+
import { useCallback as useCallback5, useMemo as useMemo8, useState as useState2 } from "react";
|
|
16447
16616
|
function useRequest(fn) {
|
|
16448
16617
|
const [isLoading, setIsLoading] = useState2(false);
|
|
16449
16618
|
const [error, setError] = useState2(null);
|
|
@@ -16463,7 +16632,7 @@ function useRequest(fn) {
|
|
|
16463
16632
|
setIsLoading(false);
|
|
16464
16633
|
}
|
|
16465
16634
|
}, [fn]);
|
|
16466
|
-
const value =
|
|
16635
|
+
const value = useMemo8(() => {
|
|
16467
16636
|
const state = { isLoading, error, data };
|
|
16468
16637
|
return [state, request];
|
|
16469
16638
|
}, [isLoading, error, data, request]);
|
|
@@ -16471,10 +16640,11 @@ function useRequest(fn) {
|
|
|
16471
16640
|
}
|
|
16472
16641
|
|
|
16473
16642
|
// src/hooks/useTrialEnd.ts
|
|
16474
|
-
import { useMemo as
|
|
16643
|
+
import { useMemo as useMemo9 } from "react";
|
|
16475
16644
|
function useTrialEnd() {
|
|
16476
16645
|
const { data } = useEmbed();
|
|
16477
|
-
const {
|
|
16646
|
+
const { t: t3 } = useTranslation();
|
|
16647
|
+
const { endDate, amount, units } = useMemo9(() => {
|
|
16478
16648
|
const billingSubscription = data?.company?.billingSubscription;
|
|
16479
16649
|
const end = typeof billingSubscription?.trialEnd === "number" ? new Date(billingSubscription.trialEnd * 1e3) : void 0;
|
|
16480
16650
|
let amount2;
|
|
@@ -16496,21 +16666,21 @@ function useTrialEnd() {
|
|
|
16496
16666
|
amount2 = Math.floor(difference / SECONDS_IN_MS);
|
|
16497
16667
|
unit = "second";
|
|
16498
16668
|
}
|
|
16499
|
-
units2 =
|
|
16669
|
+
units2 = t3(unit, { count: amount2 });
|
|
16500
16670
|
}
|
|
16501
16671
|
return { endDate: end, amount: amount2, units: units2 };
|
|
16502
|
-
}, [data?.company?.billingSubscription]);
|
|
16672
|
+
}, [data?.company?.billingSubscription, t3]);
|
|
16503
16673
|
return { endDate, amount, units };
|
|
16504
16674
|
}
|
|
16505
16675
|
|
|
16506
16676
|
// src/hooks/useTruncatedList.ts
|
|
16507
|
-
import { useCallback as useCallback6, useMemo as
|
|
16677
|
+
import { useCallback as useCallback6, useMemo as useMemo10, useState as useState3 } from "react";
|
|
16508
16678
|
function useTruncatedList(items, { limit }) {
|
|
16509
16679
|
const [isExpandedState, setIsExpanded] = useState3(false);
|
|
16510
16680
|
const total = items.length;
|
|
16511
16681
|
const canExpand = total > limit;
|
|
16512
16682
|
const isExpanded = canExpand && isExpandedState;
|
|
16513
|
-
const visibleItems =
|
|
16683
|
+
const visibleItems = useMemo10(
|
|
16514
16684
|
() => canExpand && !isExpanded ? items.slice(0, limit) : items,
|
|
16515
16685
|
[items, limit, canExpand, isExpanded]
|
|
16516
16686
|
);
|
|
@@ -16991,7 +17161,7 @@ import {
|
|
|
16991
17161
|
forwardRef,
|
|
16992
17162
|
useImperativeHandle,
|
|
16993
17163
|
useLayoutEffect as useLayoutEffect2,
|
|
16994
|
-
useMemo as
|
|
17164
|
+
useMemo as useMemo11,
|
|
16995
17165
|
useRef as useRef4
|
|
16996
17166
|
} from "react";
|
|
16997
17167
|
|
|
@@ -17084,7 +17254,7 @@ var Dialog2 = forwardRef(
|
|
|
17084
17254
|
document.body.style.overflow = initialOverflowValue;
|
|
17085
17255
|
};
|
|
17086
17256
|
}, [isModal]);
|
|
17087
|
-
const dialog =
|
|
17257
|
+
const dialog = useMemo11(
|
|
17088
17258
|
() => /* @__PURE__ */ jsx4(
|
|
17089
17259
|
Dialog,
|
|
17090
17260
|
{
|
|
@@ -17914,7 +18084,7 @@ var AutoTopupNotice = ({
|
|
|
17914
18084
|
trigger: /* @__PURE__ */ jsx14(
|
|
17915
18085
|
Icon3,
|
|
17916
18086
|
{
|
|
17917
|
-
title: "
|
|
18087
|
+
title: t3("Auto Top-up"),
|
|
17918
18088
|
name: "info-rounded",
|
|
17919
18089
|
color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
|
|
17920
18090
|
style: { lineHeight: 0 }
|
|
@@ -17953,7 +18123,7 @@ var BillingThresholdTooltip = ({
|
|
|
17953
18123
|
trigger: /* @__PURE__ */ jsx15(
|
|
17954
18124
|
Icon3,
|
|
17955
18125
|
{
|
|
17956
|
-
title: "
|
|
18126
|
+
title: t3("Billing threshold"),
|
|
17957
18127
|
name: "info-rounded",
|
|
17958
18128
|
color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
|
|
17959
18129
|
style: { lineHeight: 0 }
|
|
@@ -18097,7 +18267,7 @@ var ButtonGroup = ({
|
|
|
18097
18267
|
};
|
|
18098
18268
|
|
|
18099
18269
|
// src/components/shared/checkout-dialog/Plan/Entitlement.tsx
|
|
18100
|
-
import { useMemo as
|
|
18270
|
+
import { useMemo as useMemo12 } from "react";
|
|
18101
18271
|
import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
18102
18272
|
var Entitlement = ({
|
|
18103
18273
|
portal,
|
|
@@ -18127,7 +18297,7 @@ var Entitlement = ({
|
|
|
18127
18297
|
tiersMode
|
|
18128
18298
|
} = entitlementBillingPrice || {};
|
|
18129
18299
|
const tiered = entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementBillingPrice);
|
|
18130
|
-
const text =
|
|
18300
|
+
const text = useMemo12(() => {
|
|
18131
18301
|
if (!entitlement.feature) {
|
|
18132
18302
|
return;
|
|
18133
18303
|
}
|
|
@@ -18149,7 +18319,7 @@ var Entitlement = ({
|
|
|
18149
18319
|
packageSize,
|
|
18150
18320
|
" "
|
|
18151
18321
|
] }),
|
|
18152
|
-
getFeatureName(entitlement.feature, packageSize),
|
|
18322
|
+
getFeatureName(entitlement.feature, locale, packageSize),
|
|
18153
18323
|
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
18154
18324
|
" ",
|
|
18155
18325
|
t3("per"),
|
|
@@ -18174,12 +18344,13 @@ var Entitlement = ({
|
|
|
18174
18344
|
" ",
|
|
18175
18345
|
getFeatureName(
|
|
18176
18346
|
entitlement.valueCredit,
|
|
18347
|
+
locale,
|
|
18177
18348
|
entitlement.consumptionRate || void 0
|
|
18178
18349
|
),
|
|
18179
18350
|
" ",
|
|
18180
18351
|
t3("per"),
|
|
18181
18352
|
" ",
|
|
18182
|
-
getFeatureName(entitlement.feature, 1)
|
|
18353
|
+
getFeatureName(entitlement.feature, locale, 1)
|
|
18183
18354
|
] });
|
|
18184
18355
|
}
|
|
18185
18356
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit) {
|
|
@@ -18187,13 +18358,17 @@ var Entitlement = ({
|
|
|
18187
18358
|
amount: creditBasedEntitlementLimit.limit,
|
|
18188
18359
|
units: getFeatureName(
|
|
18189
18360
|
entitlement.feature,
|
|
18361
|
+
locale,
|
|
18190
18362
|
creditBasedEntitlementLimit.limit
|
|
18191
18363
|
),
|
|
18192
|
-
period:
|
|
18364
|
+
period: t3(
|
|
18365
|
+
creditBasedEntitlementLimit.period
|
|
18366
|
+
)
|
|
18193
18367
|
}) : t3("Up to X units", {
|
|
18194
18368
|
amount: creditBasedEntitlementLimit.limit,
|
|
18195
18369
|
units: getFeatureName(
|
|
18196
18370
|
entitlement.feature,
|
|
18371
|
+
locale,
|
|
18197
18372
|
creditBasedEntitlementLimit.limit
|
|
18198
18373
|
)
|
|
18199
18374
|
}) });
|
|
@@ -18201,11 +18376,11 @@ var Entitlement = ({
|
|
|
18201
18376
|
if (hasNumericValue) {
|
|
18202
18377
|
return /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
18203
18378
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
|
|
18204
|
-
item: getFeatureName(entitlement.feature)
|
|
18379
|
+
item: getFeatureName(entitlement.feature, locale)
|
|
18205
18380
|
}) : typeof limit === "number" && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
18206
18381
|
formatNumber(limit, { locale }),
|
|
18207
18382
|
" ",
|
|
18208
|
-
getFeatureName(entitlement.feature, limit)
|
|
18383
|
+
getFeatureName(entitlement.feature, locale, limit)
|
|
18209
18384
|
] }),
|
|
18210
18385
|
metricPeriodName && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
18211
18386
|
" ",
|
|
@@ -18230,7 +18405,7 @@ var Entitlement = ({
|
|
|
18230
18405
|
selectedCurrency,
|
|
18231
18406
|
showWarningThresholdAsLimit
|
|
18232
18407
|
]);
|
|
18233
|
-
const usageText =
|
|
18408
|
+
const usageText = useMemo12(() => {
|
|
18234
18409
|
if (!entitlement.feature) {
|
|
18235
18410
|
return;
|
|
18236
18411
|
}
|
|
@@ -18244,7 +18419,7 @@ var Entitlement = ({
|
|
|
18244
18419
|
packageSize,
|
|
18245
18420
|
" "
|
|
18246
18421
|
] }),
|
|
18247
|
-
getFeatureName(entitlement.feature, packageSize),
|
|
18422
|
+
getFeatureName(entitlement.feature, locale, packageSize),
|
|
18248
18423
|
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
18249
18424
|
"/",
|
|
18250
18425
|
shortenPeriod(period, t3)
|
|
@@ -18576,7 +18751,7 @@ var Plan = ({
|
|
|
18576
18751
|
};
|
|
18577
18752
|
|
|
18578
18753
|
// src/components/shared/checkout-dialog/AutoTopup.tsx
|
|
18579
|
-
import { useMemo as
|
|
18754
|
+
import { useMemo as useMemo13 } from "react";
|
|
18580
18755
|
import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
18581
18756
|
var AutoTopup = ({
|
|
18582
18757
|
planCreditGrants,
|
|
@@ -18584,9 +18759,9 @@ var AutoTopup = ({
|
|
|
18584
18759
|
updateAutoTopupConfig
|
|
18585
18760
|
}) => {
|
|
18586
18761
|
const { settings } = useEmbed();
|
|
18587
|
-
const { t: t3 } = useTranslation();
|
|
18762
|
+
const { t: t3, locale } = useTranslation();
|
|
18588
18763
|
const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
18589
|
-
const configurableCreditGrants =
|
|
18764
|
+
const configurableCreditGrants = useMemo13(() => {
|
|
18590
18765
|
return planCreditGrants.reduce(
|
|
18591
18766
|
(acc, grant) => {
|
|
18592
18767
|
if (isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -18631,7 +18806,7 @@ var AutoTopup = ({
|
|
|
18631
18806
|
}) }) }),
|
|
18632
18807
|
/* @__PURE__ */ jsx20(Box, { as: "p", $marginBottom: "2rem", children: /* @__PURE__ */ jsx20(Text, { children: t3(
|
|
18633
18808
|
"Automatically purchase more credits when your balance is low",
|
|
18634
|
-
{ units: getFeatureName(grant.credit) }
|
|
18809
|
+
{ units: getFeatureName(grant.credit, locale) }
|
|
18635
18810
|
) }) })
|
|
18636
18811
|
] }),
|
|
18637
18812
|
/* @__PURE__ */ jsxs10(Flex, { $alignItems: "center", $gap: "0.5rem", $marginBottom: "1rem", children: [
|
|
@@ -18712,7 +18887,7 @@ var AutoTopup = ({
|
|
|
18712
18887
|
};
|
|
18713
18888
|
|
|
18714
18889
|
// src/components/shared/checkout-dialog/Quantity.tsx
|
|
18715
|
-
import { useMemo as
|
|
18890
|
+
import { useMemo as useMemo14 } from "react";
|
|
18716
18891
|
import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
18717
18892
|
var Quantity = ({
|
|
18718
18893
|
portal,
|
|
@@ -18727,12 +18902,12 @@ var Quantity = ({
|
|
|
18727
18902
|
const isLightBackground = useIsLightBackground();
|
|
18728
18903
|
const cardPadding = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
18729
18904
|
const unitPriceFontSize = 0.875 * settings.theme.typography.text.fontSize;
|
|
18730
|
-
const planCredits =
|
|
18905
|
+
const planCredits = useMemo14(
|
|
18731
18906
|
() => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
|
|
18732
18907
|
[selectedPlan?.includedCreditGrants]
|
|
18733
18908
|
);
|
|
18734
18909
|
const prorationBehavior = data?.checkoutSettings?.prorationBehavior;
|
|
18735
|
-
const
|
|
18910
|
+
const { billDate: renewalDate } = useNextBillDate();
|
|
18736
18911
|
return /* @__PURE__ */ jsx21(Flex, { $flexDirection: "column", $gap: "1rem", children: entitlements.reduce((acc, entitlement) => {
|
|
18737
18912
|
if (entitlement.feature) {
|
|
18738
18913
|
const entitlementBillingPrice = getEntitlementPrice(
|
|
@@ -18828,7 +19003,7 @@ var Quantity = ({
|
|
|
18828
19003
|
$color: settings.theme.typography.text.color,
|
|
18829
19004
|
children: t3("Currently using", {
|
|
18830
19005
|
quantity: entitlement.usage,
|
|
18831
|
-
unit: getFeatureName(entitlement.feature)
|
|
19006
|
+
unit: getFeatureName(entitlement.feature, locale)
|
|
18832
19007
|
})
|
|
18833
19008
|
}
|
|
18834
19009
|
),
|
|
@@ -18893,7 +19068,11 @@ var Quantity = ({
|
|
|
18893
19068
|
packageSize,
|
|
18894
19069
|
" "
|
|
18895
19070
|
] }),
|
|
18896
|
-
getFeatureName(
|
|
19071
|
+
getFeatureName(
|
|
19072
|
+
entitlement.feature,
|
|
19073
|
+
locale,
|
|
19074
|
+
packageSize
|
|
19075
|
+
),
|
|
18897
19076
|
"/",
|
|
18898
19077
|
shortenPeriod(period, t3)
|
|
18899
19078
|
] })
|
|
@@ -18930,12 +19109,14 @@ var Quantity = ({
|
|
|
18930
19109
|
quantity: entitlement.quantity,
|
|
18931
19110
|
licenseName: getFeatureName(
|
|
18932
19111
|
entitlement.feature,
|
|
19112
|
+
locale,
|
|
18933
19113
|
entitlement.quantity
|
|
18934
19114
|
),
|
|
18935
19115
|
perUnit: perLicenseGrant.amount,
|
|
18936
19116
|
total: includedCredits,
|
|
18937
19117
|
creditName: getFeatureName(
|
|
18938
19118
|
licenseCredit,
|
|
19119
|
+
locale,
|
|
18939
19120
|
includedCredits
|
|
18940
19121
|
),
|
|
18941
19122
|
period: shortenPeriod(licenseCredit.period, t3)
|
|
@@ -18957,11 +19138,13 @@ var Quantity = ({
|
|
|
18957
19138
|
added: addedQuantity,
|
|
18958
19139
|
licenseName: getFeatureName(
|
|
18959
19140
|
entitlement.feature,
|
|
19141
|
+
locale,
|
|
18960
19142
|
addedQuantity
|
|
18961
19143
|
),
|
|
18962
19144
|
credits: addedCredits,
|
|
18963
19145
|
creditName: getFeatureName(
|
|
18964
19146
|
licenseCredit,
|
|
19147
|
+
locale,
|
|
18965
19148
|
addedCredits
|
|
18966
19149
|
)
|
|
18967
19150
|
}),
|
|
@@ -18971,9 +19154,10 @@ var Quantity = ({
|
|
|
18971
19154
|
total: includedCredits,
|
|
18972
19155
|
creditName: getFeatureName(
|
|
18973
19156
|
licenseCredit,
|
|
19157
|
+
locale,
|
|
18974
19158
|
includedCredits
|
|
18975
19159
|
),
|
|
18976
|
-
cadence: adjectify(licenseCredit.period),
|
|
19160
|
+
cadence: adjectify(licenseCredit.period, t3),
|
|
18977
19161
|
day: formatOrdinal(renewalDate.getDate(), t3)
|
|
18978
19162
|
})
|
|
18979
19163
|
] })
|
|
@@ -19012,6 +19196,7 @@ function renderMeteredEntitlementPricing({
|
|
|
19012
19196
|
"/",
|
|
19013
19197
|
feature ? getFeatureName(
|
|
19014
19198
|
feature,
|
|
19199
|
+
locale,
|
|
19015
19200
|
packageSize
|
|
19016
19201
|
) : featureName || "unit"
|
|
19017
19202
|
] });
|
|
@@ -19029,6 +19214,7 @@ function renderMeteredEntitlementPricing({
|
|
|
19029
19214
|
] }),
|
|
19030
19215
|
feature ? getFeatureName(
|
|
19031
19216
|
feature,
|
|
19217
|
+
locale,
|
|
19032
19218
|
packageSize
|
|
19033
19219
|
) : featureName || "unit"
|
|
19034
19220
|
] });
|
|
@@ -19346,7 +19532,7 @@ var Credits = ({
|
|
|
19346
19532
|
/* @__PURE__ */ jsx23(Box, { children: /* @__PURE__ */ jsxs13(Text, { display: "heading6", children: [
|
|
19347
19533
|
formatNumber(bundle.quantity ?? 0, { locale }),
|
|
19348
19534
|
" ",
|
|
19349
|
-
getFeatureName(bundle)
|
|
19535
|
+
getFeatureName(bundle, locale)
|
|
19350
19536
|
] }) })
|
|
19351
19537
|
] }),
|
|
19352
19538
|
typeof price === "number" && /* @__PURE__ */ jsx23(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx23(Text, { children: formatCurrency(price, {
|
|
@@ -19494,7 +19680,7 @@ var CustomCheckoutFields = ({
|
|
|
19494
19680
|
};
|
|
19495
19681
|
|
|
19496
19682
|
// src/components/shared/checkout-dialog/TaxIdField.tsx
|
|
19497
|
-
import { useMemo as
|
|
19683
|
+
import { useMemo as useMemo15 } from "react";
|
|
19498
19684
|
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
19499
19685
|
var Select = Tt(Input2).attrs({ as: "select" })`
|
|
19500
19686
|
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23666' stroke-width='1.5' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
|
|
@@ -19509,7 +19695,7 @@ var TaxIdField = ({
|
|
|
19509
19695
|
}) => {
|
|
19510
19696
|
const { t: t3, locale } = useTranslation();
|
|
19511
19697
|
const isLightBackground = useIsLightBackground();
|
|
19512
|
-
const countryOptions =
|
|
19698
|
+
const countryOptions = useMemo15(() => taxIdCountryOptions(locale), [locale]);
|
|
19513
19699
|
const jurisdictions = taxIdJurisdictionsForCountry(value.country);
|
|
19514
19700
|
const handleCountryChange = (country) => {
|
|
19515
19701
|
const next2 = taxIdJurisdictionsForCountry(country);
|
|
@@ -19738,7 +19924,7 @@ import {
|
|
|
19738
19924
|
useCallback as useCallback8,
|
|
19739
19925
|
useEffect as useEffect3,
|
|
19740
19926
|
useLayoutEffect as useLayoutEffect4,
|
|
19741
|
-
useMemo as
|
|
19927
|
+
useMemo as useMemo16,
|
|
19742
19928
|
useRef as useRef6,
|
|
19743
19929
|
useState as useState8
|
|
19744
19930
|
} from "react";
|
|
@@ -19902,7 +20088,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19902
20088
|
const [isModal, setIsModal] = useState8(true);
|
|
19903
20089
|
const showPeriodToggle = data?.displaySettings?.showPeriodToggle ?? true;
|
|
19904
20090
|
const trialPaymentMethodRequired = data?.trialPaymentMethodRequired === true;
|
|
19905
|
-
const featureUsage =
|
|
20091
|
+
const featureUsage = useMemo16(
|
|
19906
20092
|
() => data?.featureUsage?.features ?? [],
|
|
19907
20093
|
[data?.featureUsage?.features]
|
|
19908
20094
|
);
|
|
@@ -19958,7 +20144,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19958
20144
|
useSelectedPeriod: showPeriodToggle
|
|
19959
20145
|
});
|
|
19960
20146
|
const [selectedPlanId, setSelectedPlanId] = useState8(void 0);
|
|
19961
|
-
const selectedPlan =
|
|
20147
|
+
const selectedPlan = useMemo16(() => {
|
|
19962
20148
|
if (selectedPlanId === null) {
|
|
19963
20149
|
return void 0;
|
|
19964
20150
|
}
|
|
@@ -19974,7 +20160,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
19974
20160
|
);
|
|
19975
20161
|
}, [availablePlans, checkoutState, selectedPlanId]);
|
|
19976
20162
|
const [shouldTrial, setShouldTrial] = useState8(false);
|
|
19977
|
-
const planCreditGrants =
|
|
20163
|
+
const planCreditGrants = useMemo16(() => {
|
|
19978
20164
|
const grants = mergeCompanyGrants(
|
|
19979
20165
|
selectedPlan?.includedCreditGrants,
|
|
19980
20166
|
data?.company?.plan?.includedCreditGrants
|
|
@@ -20020,11 +20206,11 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20020
20206
|
}
|
|
20021
20207
|
return ids;
|
|
20022
20208
|
});
|
|
20023
|
-
const addOnCompatibilityLookup =
|
|
20209
|
+
const addOnCompatibilityLookup = useMemo16(
|
|
20024
20210
|
() => buildAddOnCompatibilityLookup(data?.addOnCompatibilities),
|
|
20025
20211
|
[data?.addOnCompatibilities]
|
|
20026
20212
|
);
|
|
20027
|
-
const addOns =
|
|
20213
|
+
const addOns = useMemo16(() => {
|
|
20028
20214
|
return availableAddOns.filter((availAddOn) => {
|
|
20029
20215
|
if (hasCurrency && !planSupportsCurrency(availAddOn, effectiveCurrency)) {
|
|
20030
20216
|
return false;
|
|
@@ -20053,7 +20239,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20053
20239
|
const [bundleCounts, setBundleCounts] = useState8({});
|
|
20054
20240
|
const bundleCountsRef = useRef6(bundleCounts);
|
|
20055
20241
|
const bundleGatingPlanId = selectedPlan?.id ?? data?.company?.plan?.id;
|
|
20056
|
-
const creditBundles =
|
|
20242
|
+
const creditBundles = useMemo16(() => {
|
|
20057
20243
|
return deriveCreditBundles(
|
|
20058
20244
|
data?.creditBundles,
|
|
20059
20245
|
bundleGatingPlanId,
|
|
@@ -20063,7 +20249,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20063
20249
|
const [hasInitialPaymentMethod] = useState8(
|
|
20064
20250
|
() => !!(data?.subscription?.paymentMethod?.externalId || data?.company?.defaultPaymentMethod?.externalId)
|
|
20065
20251
|
);
|
|
20066
|
-
const isCreditOnlyPurchase =
|
|
20252
|
+
const isCreditOnlyPurchase = useMemo16(
|
|
20067
20253
|
() => isCreditOnlyCheckout({
|
|
20068
20254
|
plan: selectedPlan,
|
|
20069
20255
|
creditBundles,
|
|
@@ -20130,13 +20316,13 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20130
20316
|
checkoutState?.payInAdvanceQuantities
|
|
20131
20317
|
);
|
|
20132
20318
|
});
|
|
20133
|
-
const payInAdvanceEntitlements =
|
|
20319
|
+
const payInAdvanceEntitlements = useMemo16(
|
|
20134
20320
|
() => usageBasedEntitlements.filter(
|
|
20135
20321
|
(entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
20136
20322
|
),
|
|
20137
20323
|
[usageBasedEntitlements]
|
|
20138
20324
|
);
|
|
20139
|
-
const addOnPayInAdvanceEntitlements =
|
|
20325
|
+
const addOnPayInAdvanceEntitlements = useMemo16(
|
|
20140
20326
|
() => addOnUsageBasedEntitlements.filter(
|
|
20141
20327
|
(entitlement) => entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
20142
20328
|
),
|
|
@@ -20152,7 +20338,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20152
20338
|
}
|
|
20153
20339
|
return values;
|
|
20154
20340
|
});
|
|
20155
|
-
const hasIncompleteRequiredCustomFields =
|
|
20341
|
+
const hasIncompleteRequiredCustomFields = useMemo16(() => {
|
|
20156
20342
|
return (data?.customCheckoutFields ?? []).some(
|
|
20157
20343
|
(field) => field.required && !customFieldValues[field.id]?.trim()
|
|
20158
20344
|
);
|
|
@@ -20202,12 +20388,12 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20202
20388
|
const [optInAccepted, setOptInAccepted] = useState8(false);
|
|
20203
20389
|
const presentedOptInRef = useRef6(null);
|
|
20204
20390
|
const [willScheduleDowngrade, setWillScheduleDowngrade] = useState8(false);
|
|
20205
|
-
const willTrialWithoutPaymentMethod =
|
|
20391
|
+
const willTrialWithoutPaymentMethod = useMemo16(
|
|
20206
20392
|
() => shouldTrial && !trialPaymentMethodRequired,
|
|
20207
20393
|
[shouldTrial, trialPaymentMethodRequired]
|
|
20208
20394
|
);
|
|
20209
20395
|
const isSelectedPlanTrialable = selectedPlan && selectedPlan.isTrialable && selectedPlan.companyCanTrial;
|
|
20210
|
-
const checkoutStages =
|
|
20396
|
+
const checkoutStages = useMemo16(() => {
|
|
20211
20397
|
const stages = [];
|
|
20212
20398
|
const checkoutStage2 = {
|
|
20213
20399
|
id: "checkout",
|
|
@@ -20313,7 +20499,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20313
20499
|
}
|
|
20314
20500
|
return "plan";
|
|
20315
20501
|
});
|
|
20316
|
-
const effectiveCheckoutStage =
|
|
20502
|
+
const effectiveCheckoutStage = useMemo16(() => {
|
|
20317
20503
|
if (isBypassLoading) return checkoutStage;
|
|
20318
20504
|
let id = checkoutStage;
|
|
20319
20505
|
if (id === "credits" && !checkoutStages.some((stage) => stage.id === id)) {
|
|
@@ -20329,7 +20515,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20329
20515
|
}, [checkoutStage, checkoutStages, checkoutState, isBypassLoading]);
|
|
20330
20516
|
const previewRequestIdRef = useRef6(0);
|
|
20331
20517
|
const planStageVisible = checkoutStages.some((stage) => stage.id === "plan") && !checkoutState?.bypassPlanSelection;
|
|
20332
|
-
const checkoutStageCurrencies =
|
|
20518
|
+
const checkoutStageCurrencies = useMemo16(() => {
|
|
20333
20519
|
if (!selectedPlan) return currencies;
|
|
20334
20520
|
return currencies.filter(
|
|
20335
20521
|
(currency) => planOffersCurrencyForPeriod(selectedPlan, planPeriod, currency)
|
|
@@ -20902,7 +21088,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20902
21088
|
const activeCheckoutStage = checkoutStages.find(
|
|
20903
21089
|
(stage) => stage.id === effectiveCheckoutStage
|
|
20904
21090
|
);
|
|
20905
|
-
const visibleStages =
|
|
21091
|
+
const visibleStages = useMemo16(() => {
|
|
20906
21092
|
if (!checkoutState?.hideSkippedStages) {
|
|
20907
21093
|
return checkoutStages;
|
|
20908
21094
|
}
|
|
@@ -20925,7 +21111,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20925
21111
|
return true;
|
|
20926
21112
|
});
|
|
20927
21113
|
}, [checkoutStages, checkoutState]);
|
|
20928
|
-
const navigableStages =
|
|
21114
|
+
const navigableStages = useMemo16(() => {
|
|
20929
21115
|
return checkoutStages.filter((stage) => {
|
|
20930
21116
|
if (stage.id === "plan" && checkoutState?.bypassPlanSelection) {
|
|
20931
21117
|
return false;
|
|
@@ -21305,7 +21491,7 @@ var CurrencyPeriodMismatchNotice = ({
|
|
|
21305
21491
|
style: { opacity: 0.85, textAlign: "center" },
|
|
21306
21492
|
children: t3("No {{currency}} price for the {{period}} billing period.", {
|
|
21307
21493
|
currency: currency.toUpperCase(),
|
|
21308
|
-
period
|
|
21494
|
+
period: adjectify(period, t3)
|
|
21309
21495
|
})
|
|
21310
21496
|
}
|
|
21311
21497
|
)
|
|
@@ -21467,7 +21653,7 @@ var HardLimitTooltip = ({
|
|
|
21467
21653
|
feature,
|
|
21468
21654
|
limit
|
|
21469
21655
|
}) => {
|
|
21470
|
-
const { t: t3 } = useTranslation();
|
|
21656
|
+
const { t: t3, locale } = useTranslation();
|
|
21471
21657
|
const { data } = useEmbed();
|
|
21472
21658
|
const isLightBackground = useIsLightBackground();
|
|
21473
21659
|
const showHardLimit = data?.displaySettings?.showHardLimit ?? false;
|
|
@@ -21481,7 +21667,7 @@ var HardLimitTooltip = ({
|
|
|
21481
21667
|
trigger: /* @__PURE__ */ jsx32(
|
|
21482
21668
|
Icon3,
|
|
21483
21669
|
{
|
|
21484
|
-
title: "
|
|
21670
|
+
title: t3("Limit"),
|
|
21485
21671
|
name: "info-rounded",
|
|
21486
21672
|
color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
|
|
21487
21673
|
style: { lineHeight: 0 }
|
|
@@ -21489,7 +21675,7 @@ var HardLimitTooltip = ({
|
|
|
21489
21675
|
),
|
|
21490
21676
|
content: /* @__PURE__ */ jsx32(Text, { children: t3("Up to a limit of", {
|
|
21491
21677
|
amount: limit,
|
|
21492
|
-
units: getFeatureName(feature, limit)
|
|
21678
|
+
units: getFeatureName(feature, locale, limit)
|
|
21493
21679
|
}) })
|
|
21494
21680
|
}
|
|
21495
21681
|
);
|
|
@@ -21538,17 +21724,17 @@ var InvalidCurrencyNotice = ({
|
|
|
21538
21724
|
import { useCallback as useCallback10, useLayoutEffect as useLayoutEffect5, useRef as useRef7, useState as useState10 } from "react";
|
|
21539
21725
|
|
|
21540
21726
|
// src/components/shared/checkout-dialog/EditableCustomCheckoutFields.tsx
|
|
21541
|
-
import { useCallback as useCallback9, useMemo as
|
|
21727
|
+
import { useCallback as useCallback9, useMemo as useMemo17, useState as useState9 } from "react";
|
|
21542
21728
|
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
21543
21729
|
var EditableCustomCheckoutFields = () => {
|
|
21544
21730
|
const { t: t3 } = useTranslation();
|
|
21545
21731
|
const isLightBackground = useIsLightBackground();
|
|
21546
21732
|
const { data, updateCustomFieldValues } = useEmbed();
|
|
21547
|
-
const customCheckoutFields =
|
|
21733
|
+
const customCheckoutFields = useMemo17(
|
|
21548
21734
|
() => data?.customCheckoutFields ?? [],
|
|
21549
21735
|
[data?.customCheckoutFields]
|
|
21550
21736
|
);
|
|
21551
|
-
const serverFieldValues =
|
|
21737
|
+
const serverFieldValues = useMemo17(() => {
|
|
21552
21738
|
const values2 = {};
|
|
21553
21739
|
for (const field of customCheckoutFields) {
|
|
21554
21740
|
values2[field.id] = field.value ?? "";
|
|
@@ -21718,7 +21904,7 @@ import {
|
|
|
21718
21904
|
useElements,
|
|
21719
21905
|
useStripe
|
|
21720
21906
|
} from "@stripe/react-stripe-js";
|
|
21721
|
-
import { useEffect as useEffect4, useMemo as
|
|
21907
|
+
import { useEffect as useEffect4, useMemo as useMemo18, useRef as useRef8, useState as useState11 } from "react";
|
|
21722
21908
|
import { jsx as jsx36, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
21723
21909
|
var PaymentForm = ({ onConfirm, financeData }) => {
|
|
21724
21910
|
const { t: t3 } = useTranslation();
|
|
@@ -21749,7 +21935,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
21749
21935
|
const [isAddressComplete, setIsAddressComplete] = useState11(
|
|
21750
21936
|
() => !shouldCollectAddress
|
|
21751
21937
|
);
|
|
21752
|
-
const addressDefaultsKey =
|
|
21938
|
+
const addressDefaultsKey = useMemo18(
|
|
21753
21939
|
() => JSON.stringify(billing ?? {}),
|
|
21754
21940
|
[billing]
|
|
21755
21941
|
);
|
|
@@ -21858,7 +22044,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
21858
22044
|
)
|
|
21859
22045
|
] }),
|
|
21860
22046
|
stripe && collectEmail && /* @__PURE__ */ jsxs25(Box, { "data-field": "name", $marginBottom: "1.5rem", $verticalAlign: "top", children: [
|
|
21861
|
-
/* @__PURE__ */ jsx36(Label, { htmlFor: "email", children: "Email" }),
|
|
22047
|
+
/* @__PURE__ */ jsx36(Label, { htmlFor: "email", children: t3("Email") }),
|
|
21862
22048
|
/* @__PURE__ */ jsx36(
|
|
21863
22049
|
Input2,
|
|
21864
22050
|
{
|
|
@@ -21867,7 +22053,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
21867
22053
|
type: "email",
|
|
21868
22054
|
value: email,
|
|
21869
22055
|
autoComplete: "email",
|
|
21870
|
-
placeholder: "Enter email address",
|
|
22056
|
+
placeholder: t3("Enter email address"),
|
|
21871
22057
|
required: true,
|
|
21872
22058
|
onChange: (e) => {
|
|
21873
22059
|
userEditedEmailRef.current = true;
|
|
@@ -21914,7 +22100,7 @@ var PaymentForm = ({ onConfirm, financeData }) => {
|
|
|
21914
22100
|
};
|
|
21915
22101
|
|
|
21916
22102
|
// src/components/shared/period-toggle/PeriodToggle.tsx
|
|
21917
|
-
import { useMemo as
|
|
22103
|
+
import { useMemo as useMemo19 } from "react";
|
|
21918
22104
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
21919
22105
|
var PERIOD_MONTH_COUNT = {
|
|
21920
22106
|
year: 12,
|
|
@@ -21930,7 +22116,7 @@ var PeriodToggle = ({
|
|
|
21930
22116
|
const { t: t3 } = useTranslation();
|
|
21931
22117
|
const { settings } = useEmbed();
|
|
21932
22118
|
const isLightBackground = useIsLightBackground();
|
|
21933
|
-
const savingsByPeriod =
|
|
22119
|
+
const savingsByPeriod = useMemo19(() => {
|
|
21934
22120
|
const result = {};
|
|
21935
22121
|
if (!selectedPlan) {
|
|
21936
22122
|
return result;
|
|
@@ -21994,7 +22180,7 @@ var PeriodToggle = ({
|
|
|
21994
22180
|
},
|
|
21995
22181
|
$size: 15,
|
|
21996
22182
|
$weight: option === selectedOption ? 600 : 400,
|
|
21997
|
-
children: t3("Billed", { period: adjectify(option) })
|
|
22183
|
+
children: t3("Billed", { period: adjectify(option, t3) })
|
|
21998
22184
|
}
|
|
21999
22185
|
)
|
|
22000
22186
|
},
|
|
@@ -22034,7 +22220,7 @@ var PlanCreditText = ({
|
|
|
22034
22220
|
entitlements,
|
|
22035
22221
|
children
|
|
22036
22222
|
}) => {
|
|
22037
|
-
const { t: t3 } = useTranslation();
|
|
22223
|
+
const { t: t3, locale } = useTranslation();
|
|
22038
22224
|
const { settings } = useEmbed();
|
|
22039
22225
|
const sources = entitlements ?? [];
|
|
22040
22226
|
const { perLicenseGrants } = credit;
|
|
@@ -22042,7 +22228,7 @@ var PlanCreditText = ({
|
|
|
22042
22228
|
return /* @__PURE__ */ jsxs26(Text, { children: [
|
|
22043
22229
|
credit.quantity,
|
|
22044
22230
|
" ",
|
|
22045
|
-
getFeatureName(credit, credit.quantity),
|
|
22231
|
+
getFeatureName(credit, locale, credit.quantity),
|
|
22046
22232
|
credit.period && /* @__PURE__ */ jsxs26(Fragment11, { children: [
|
|
22047
22233
|
" ",
|
|
22048
22234
|
t3("per"),
|
|
@@ -22054,18 +22240,18 @@ var PlanCreditText = ({
|
|
|
22054
22240
|
}
|
|
22055
22241
|
const resolveLicenseName = (grant) => {
|
|
22056
22242
|
const licenseFeature = (findLicenseSource(sources, grant.licenseId) ?? (grant.licenseId ? void 0 : findSoleLicenseSource(sources)))?.feature;
|
|
22057
|
-
return licenseFeature ? getFeatureName(licenseFeature, 1) : t3("license");
|
|
22243
|
+
return licenseFeature ? getFeatureName(licenseFeature, locale, 1) : t3("license");
|
|
22058
22244
|
};
|
|
22059
22245
|
return /* @__PURE__ */ jsxs26(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
22060
22246
|
perLicenseGrants.map((grant, grantIndex) => /* @__PURE__ */ jsxs26(Text, { children: [
|
|
22061
22247
|
credit.period ? t3("X credits per license per period", {
|
|
22062
22248
|
amount: grant.amount,
|
|
22063
|
-
creditName: getFeatureName(credit, grant.amount),
|
|
22249
|
+
creditName: getFeatureName(credit, locale, grant.amount),
|
|
22064
22250
|
licenseName: resolveLicenseName(grant),
|
|
22065
22251
|
period: t3(credit.period)
|
|
22066
22252
|
}) : t3("X credits per license", {
|
|
22067
22253
|
amount: grant.amount,
|
|
22068
|
-
creditName: getFeatureName(credit, grant.amount),
|
|
22254
|
+
creditName: getFeatureName(credit, locale, grant.amount),
|
|
22069
22255
|
licenseName: resolveLicenseName(grant)
|
|
22070
22256
|
}),
|
|
22071
22257
|
grantIndex === 0 && children
|
|
@@ -22078,7 +22264,7 @@ var PlanCreditText = ({
|
|
|
22078
22264
|
$color: settings.theme.typography.text.color,
|
|
22079
22265
|
children: t3("Plus X credits per period for your company", {
|
|
22080
22266
|
amount: credit.fixedQuantity,
|
|
22081
|
-
creditName: getFeatureName(credit, credit.fixedQuantity),
|
|
22267
|
+
creditName: getFeatureName(credit, locale, credit.fixedQuantity),
|
|
22082
22268
|
period: t3(credit.period)
|
|
22083
22269
|
})
|
|
22084
22270
|
}
|
|
@@ -22087,10 +22273,10 @@ var PlanCreditText = ({
|
|
|
22087
22273
|
};
|
|
22088
22274
|
|
|
22089
22275
|
// src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
|
|
22090
|
-
import { useMemo as
|
|
22276
|
+
import { useMemo as useMemo21 } from "react";
|
|
22091
22277
|
|
|
22092
22278
|
// src/components/shared/pricing-tiers-tooltip/PriceText.tsx
|
|
22093
|
-
import { useMemo as
|
|
22279
|
+
import { useMemo as useMemo20 } from "react";
|
|
22094
22280
|
import { Fragment as Fragment12, jsx as jsx39, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
22095
22281
|
var PriceText = ({
|
|
22096
22282
|
feature,
|
|
@@ -22101,13 +22287,13 @@ var PriceText = ({
|
|
|
22101
22287
|
}) => {
|
|
22102
22288
|
const { settings } = useEmbed();
|
|
22103
22289
|
const { t: t3, locale } = useTranslation();
|
|
22104
|
-
const text =
|
|
22290
|
+
const text = useMemo20(() => {
|
|
22105
22291
|
if (!flatAmount && perUnitPrice) {
|
|
22106
22292
|
return /* @__PURE__ */ jsxs27(Fragment12, { children: [
|
|
22107
22293
|
formatCurrency(perUnitPrice, { locale, currency }),
|
|
22108
22294
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
22109
22295
|
"/",
|
|
22110
|
-
getFeatureName(feature, 1)
|
|
22296
|
+
getFeatureName(feature, locale, 1)
|
|
22111
22297
|
] })
|
|
22112
22298
|
] });
|
|
22113
22299
|
}
|
|
@@ -22124,7 +22310,7 @@ var PriceText = ({
|
|
|
22124
22310
|
formatCurrency(perUnitPrice, { locale, currency }),
|
|
22125
22311
|
/* @__PURE__ */ jsxs27("sub", { children: [
|
|
22126
22312
|
"/",
|
|
22127
|
-
getFeatureName(feature, 1)
|
|
22313
|
+
getFeatureName(feature, locale, 1)
|
|
22128
22314
|
] }),
|
|
22129
22315
|
" + ",
|
|
22130
22316
|
formatCurrency(flatAmount, { locale, currency }),
|
|
@@ -22158,7 +22344,7 @@ var PricingTiersTooltip = ({
|
|
|
22158
22344
|
const { t: t3 } = useTranslation();
|
|
22159
22345
|
const { settings } = useEmbed();
|
|
22160
22346
|
const isLightBackground = useIsLightBackground();
|
|
22161
|
-
const { tiers } =
|
|
22347
|
+
const { tiers } = useMemo21(() => {
|
|
22162
22348
|
return priceTiers.reduce(
|
|
22163
22349
|
(acc, tier) => {
|
|
22164
22350
|
const end = tier.upTo ?? Infinity;
|
|
@@ -22185,7 +22371,7 @@ var PricingTiersTooltip = ({
|
|
|
22185
22371
|
trigger: /* @__PURE__ */ jsx40(
|
|
22186
22372
|
Icon3,
|
|
22187
22373
|
{
|
|
22188
|
-
title: "
|
|
22374
|
+
title: t3("Tiered pricing"),
|
|
22189
22375
|
name: "info-rounded",
|
|
22190
22376
|
color: `hsla(0, 0%, ${isLightBackground ? 0 : 100}%, 0.5)`,
|
|
22191
22377
|
style: { lineHeight: 0 }
|
|
@@ -22256,7 +22442,7 @@ import {
|
|
|
22256
22442
|
forwardRef as forwardRef7,
|
|
22257
22443
|
useCallback as useCallback11,
|
|
22258
22444
|
useLayoutEffect as useLayoutEffect6,
|
|
22259
|
-
useMemo as
|
|
22445
|
+
useMemo as useMemo22,
|
|
22260
22446
|
useRef as useRef9,
|
|
22261
22447
|
useState as useState13
|
|
22262
22448
|
} from "react";
|
|
@@ -22694,11 +22880,11 @@ var EntitlementRow = (props) => {
|
|
|
22694
22880
|
/* @__PURE__ */ jsx42(Box, { children: /* @__PURE__ */ jsx42(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment14, { children: [
|
|
22695
22881
|
quantity,
|
|
22696
22882
|
" ",
|
|
22697
|
-
getFeatureName(feature, quantity)
|
|
22883
|
+
getFeatureName(feature, locale, quantity)
|
|
22698
22884
|
] }) : priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number" ? /* @__PURE__ */ jsxs30(Fragment14, { children: [
|
|
22699
22885
|
softLimit,
|
|
22700
22886
|
" ",
|
|
22701
|
-
getFeatureName(feature, softLimit)
|
|
22887
|
+
getFeatureName(feature, locale, softLimit)
|
|
22702
22888
|
] }) : feature.name }) }),
|
|
22703
22889
|
/* @__PURE__ */ jsx42(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22704
22890
|
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
@@ -22729,7 +22915,7 @@ var EntitlementRow = (props) => {
|
|
|
22729
22915
|
packageSize,
|
|
22730
22916
|
" "
|
|
22731
22917
|
] }),
|
|
22732
|
-
getFeatureName(feature, packageSize),
|
|
22918
|
+
getFeatureName(feature, locale, packageSize),
|
|
22733
22919
|
feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs30(Fragment14, { children: [
|
|
22734
22920
|
"/",
|
|
22735
22921
|
shortenPeriod(planPeriod, t3)
|
|
@@ -22858,7 +23044,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22858
23044
|
billingSubscription,
|
|
22859
23045
|
paymentMethod,
|
|
22860
23046
|
trialPaymentMethodRequired
|
|
22861
|
-
} =
|
|
23047
|
+
} = useMemo22(() => {
|
|
22862
23048
|
const currentEntitlements2 = data?.featureUsage?.features || [];
|
|
22863
23049
|
return {
|
|
22864
23050
|
currentPlan: data?.company?.plan,
|
|
@@ -22881,7 +23067,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22881
23067
|
data?.subscription?.paymentMethod,
|
|
22882
23068
|
data?.trialPaymentMethodRequired
|
|
22883
23069
|
]);
|
|
22884
|
-
const planCreditGrants =
|
|
23070
|
+
const planCreditGrants = useMemo22(() => {
|
|
22885
23071
|
const grants = mergeCompanyGrants(
|
|
22886
23072
|
selectedPlan?.includedCreditGrants,
|
|
22887
23073
|
data?.company?.plan?.includedCreditGrants
|
|
@@ -22891,11 +23077,11 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22891
23077
|
selectedPlan?.includedCreditGrants,
|
|
22892
23078
|
data?.company?.plan?.includedCreditGrants
|
|
22893
23079
|
]);
|
|
22894
|
-
const planCredits =
|
|
23080
|
+
const planCredits = useMemo22(
|
|
22895
23081
|
() => groupPlanCreditGrants(selectedPlan?.includedCreditGrants ?? []),
|
|
22896
23082
|
[selectedPlan?.includedCreditGrants]
|
|
22897
23083
|
);
|
|
22898
|
-
const { payInAdvanceEntitlements } =
|
|
23084
|
+
const { payInAdvanceEntitlements } = useMemo22(() => {
|
|
22899
23085
|
const payAsYouGoEntitlements = [];
|
|
22900
23086
|
const payInAdvanceEntitlements2 = usageBasedEntitlements.filter(
|
|
22901
23087
|
(entitlement) => {
|
|
@@ -22907,7 +23093,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22907
23093
|
);
|
|
22908
23094
|
return { payAsYouGoEntitlements, payInAdvanceEntitlements: payInAdvanceEntitlements2 };
|
|
22909
23095
|
}, [usageBasedEntitlements]);
|
|
22910
|
-
const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } =
|
|
23096
|
+
const { subscriptionPrice, subscriptionTotal, subscriptionCurrency } = useMemo22(() => {
|
|
22911
23097
|
let planPrice;
|
|
22912
23098
|
let resolvedCurrency;
|
|
22913
23099
|
if (selectedPlan) {
|
|
@@ -22978,7 +23164,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22978
23164
|
proration,
|
|
22979
23165
|
taxAmount,
|
|
22980
23166
|
taxDescription
|
|
22981
|
-
} =
|
|
23167
|
+
} = useMemo22(() => {
|
|
22982
23168
|
return {
|
|
22983
23169
|
amountOff: charges?.amountOff ?? 0,
|
|
22984
23170
|
discountAmount: charges?.discountAmount ?? 0,
|
|
@@ -23026,7 +23212,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23026
23212
|
$color: settings.theme.typography.text.color,
|
|
23027
23213
|
children: t3("Includes X credits per period", {
|
|
23028
23214
|
total: includedCredits,
|
|
23029
|
-
creditName: getFeatureName(credit, includedCredits),
|
|
23215
|
+
creditName: getFeatureName(credit, locale, includedCredits),
|
|
23030
23216
|
period: shortenPeriod(credit.period, t3)
|
|
23031
23217
|
})
|
|
23032
23218
|
}
|
|
@@ -23048,7 +23234,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23048
23234
|
}
|
|
23049
23235
|
);
|
|
23050
23236
|
};
|
|
23051
|
-
const updatedUsageBasedEntitlements =
|
|
23237
|
+
const updatedUsageBasedEntitlements = useMemo22(() => {
|
|
23052
23238
|
const changedUsageBasedEntitlements = [];
|
|
23053
23239
|
const allSelectedUsageBasedEntitlements = [
|
|
23054
23240
|
...usageBasedEntitlements,
|
|
@@ -23111,19 +23297,19 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23111
23297
|
usageBasedEntitlements,
|
|
23112
23298
|
addOnUsageBasedEntitlements
|
|
23113
23299
|
]);
|
|
23114
|
-
const selectedAddOnsWithPrice =
|
|
23300
|
+
const selectedAddOnsWithPrice = useMemo22(
|
|
23115
23301
|
() => addOns.filter(
|
|
23116
23302
|
(addOn) => addOn.isSelected && getPlanPrice(addOn, void 0, void 0, currency)?.price
|
|
23117
23303
|
),
|
|
23118
23304
|
[addOns, currency]
|
|
23119
23305
|
);
|
|
23120
|
-
const selectedOneTimeAddOns =
|
|
23306
|
+
const selectedOneTimeAddOns = useMemo22(
|
|
23121
23307
|
() => addOns.filter(
|
|
23122
23308
|
(addOn) => addOn.isSelected && addOn.chargeType === ChargeType.oneTime && getAddOnPrice(addOn, planPeriod, currency)?.price
|
|
23123
23309
|
),
|
|
23124
23310
|
[addOns, planPeriod, currency]
|
|
23125
23311
|
);
|
|
23126
|
-
const { removedAddOns, willAddOnsChange } =
|
|
23312
|
+
const { removedAddOns, willAddOnsChange } = useMemo22(() => {
|
|
23127
23313
|
const addedAddOns = selectedAddOnsWithPrice.filter(
|
|
23128
23314
|
(selected) => getPlanPrice(selected, void 0, void 0, currency)?.price && !currentAddOns.some((current) => selected.id === current.id)
|
|
23129
23315
|
);
|
|
@@ -23139,15 +23325,15 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23139
23325
|
willAddOnsChange: willAddOnsChange2
|
|
23140
23326
|
};
|
|
23141
23327
|
}, [currentAddOns, selectedAddOnsWithPrice, currency]);
|
|
23142
|
-
const addedCreditBundles =
|
|
23328
|
+
const addedCreditBundles = useMemo22(
|
|
23143
23329
|
() => creditBundles.filter((bundle) => bundle.count > 0),
|
|
23144
23330
|
[creditBundles]
|
|
23145
23331
|
);
|
|
23146
|
-
const discountApplied =
|
|
23332
|
+
const discountApplied = useMemo22(
|
|
23147
23333
|
() => promoCode && (amountOff > 0 || percentOff > 0),
|
|
23148
23334
|
[promoCode, amountOff, percentOff]
|
|
23149
23335
|
);
|
|
23150
|
-
const subscriptionDiscount =
|
|
23336
|
+
const subscriptionDiscount = useMemo22(
|
|
23151
23337
|
() => getSubscriptionDiscount(
|
|
23152
23338
|
charges?.discounts,
|
|
23153
23339
|
subscriptionTotal,
|
|
@@ -23307,7 +23493,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23307
23493
|
}
|
|
23308
23494
|
}, [t3, unsubscribe, setError, setIsLoading, setLayout]);
|
|
23309
23495
|
const isSelectedPlanTrialable = selectedPlan?.companyCanTrial === true && selectedPlan?.isTrialable === true;
|
|
23310
|
-
const button =
|
|
23496
|
+
const button = useMemo22(() => {
|
|
23311
23497
|
const hasEntitlementDowngrade = payInAdvanceEntitlements.some((e) => e.quantity < e.usage) || addOnPayInAdvanceEntitlements.some((e) => e.quantity < e.usage);
|
|
23312
23498
|
const canCheckout = error !== t3("Downgrade not permitted.") && !hasEntitlementDowngrade;
|
|
23313
23499
|
const isSticky = !isButtonInView;
|
|
@@ -23764,7 +23950,7 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
23764
23950
|
/* @__PURE__ */ jsx44(Box, { children: /* @__PURE__ */ jsxs32(Text, { children: [
|
|
23765
23951
|
formatNumber(amount, { locale }),
|
|
23766
23952
|
" ",
|
|
23767
|
-
getFeatureName(bundle, amount),
|
|
23953
|
+
getFeatureName(bundle, locale, amount),
|
|
23768
23954
|
expiry && ` \xB7 ${expiry}`
|
|
23769
23955
|
] }) })
|
|
23770
23956
|
] }),
|
|
@@ -24035,14 +24221,14 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
24035
24221
|
SubscriptionSidebar.displayName = "SubscriptionSidebar";
|
|
24036
24222
|
|
|
24037
24223
|
// src/components/shared/tiered-pricing-details/TieredPricingDetails.tsx
|
|
24038
|
-
import { useMemo as
|
|
24224
|
+
import { useMemo as useMemo23 } from "react";
|
|
24039
24225
|
var TieredPricingDetails = ({
|
|
24040
24226
|
entitlement,
|
|
24041
24227
|
period,
|
|
24042
24228
|
currency: selectedCurrency
|
|
24043
24229
|
}) => {
|
|
24044
24230
|
const { t: t3, locale } = useTranslation();
|
|
24045
|
-
const { currency, flatAmount, perUnitPrice, upTo } =
|
|
24231
|
+
const { currency, flatAmount, perUnitPrice, upTo } = useMemo23(() => {
|
|
24046
24232
|
const { currency: currency2, priceTier } = getEntitlementPrice(entitlement, period, selectedCurrency) || {};
|
|
24047
24233
|
const { flatAmount: flatAmount2, perUnitPrice: perUnitPrice2, perUnitPriceDecimal, upTo: upTo2 } = priceTier?.[0] || {};
|
|
24048
24234
|
return {
|
|
@@ -24058,21 +24244,21 @@ var TieredPricingDetails = ({
|
|
|
24058
24244
|
if (flatAmount === 0 && perUnitPrice === 0) {
|
|
24059
24245
|
return t3("Up to X units for free", {
|
|
24060
24246
|
X: upTo,
|
|
24061
|
-
units: getFeatureName(entitlement.feature, upTo)
|
|
24247
|
+
units: getFeatureName(entitlement.feature, locale, upTo)
|
|
24062
24248
|
});
|
|
24063
24249
|
}
|
|
24064
24250
|
if (flatAmount === 0 && perUnitPrice > 0) {
|
|
24065
24251
|
return t3("Up to X units at $Y/unit", {
|
|
24066
24252
|
X: upTo,
|
|
24067
|
-
units: getFeatureName(entitlement.feature, upTo),
|
|
24253
|
+
units: getFeatureName(entitlement.feature, locale, upTo),
|
|
24068
24254
|
Y: formatCurrency(perUnitPrice, { locale, currency }),
|
|
24069
|
-
unit: getFeatureName(entitlement.feature, 1)
|
|
24255
|
+
unit: getFeatureName(entitlement.feature, locale, 1)
|
|
24070
24256
|
});
|
|
24071
24257
|
}
|
|
24072
24258
|
if (flatAmount > 0 && perUnitPrice === 0) {
|
|
24073
24259
|
return t3("Up to X units for $Y/period", {
|
|
24074
24260
|
X: upTo,
|
|
24075
|
-
units: getFeatureName(entitlement.feature, upTo),
|
|
24261
|
+
units: getFeatureName(entitlement.feature, locale, upTo),
|
|
24076
24262
|
Y: formatCurrency(flatAmount, { locale, currency }),
|
|
24077
24263
|
period
|
|
24078
24264
|
});
|
|
@@ -24080,9 +24266,9 @@ var TieredPricingDetails = ({
|
|
|
24080
24266
|
if (flatAmount > 0 && perUnitPrice > 0) {
|
|
24081
24267
|
return t3("Up to X units at $Y/unit + $Z/period", {
|
|
24082
24268
|
X: upTo,
|
|
24083
|
-
units: getFeatureName(entitlement.feature, upTo),
|
|
24269
|
+
units: getFeatureName(entitlement.feature, locale, upTo),
|
|
24084
24270
|
Y: formatCurrency(perUnitPrice, { locale, currency }),
|
|
24085
|
-
unit: getFeatureName(entitlement.feature, 1),
|
|
24271
|
+
unit: getFeatureName(entitlement.feature, locale, 1),
|
|
24086
24272
|
Z: formatCurrency(flatAmount, { locale, currency }),
|
|
24087
24273
|
period
|
|
24088
24274
|
});
|
|
@@ -24090,7 +24276,7 @@ var TieredPricingDetails = ({
|
|
|
24090
24276
|
};
|
|
24091
24277
|
|
|
24092
24278
|
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
24093
|
-
import { useCallback as useCallback12, useLayoutEffect as useLayoutEffect7, useMemo as
|
|
24279
|
+
import { useCallback as useCallback12, useLayoutEffect as useLayoutEffect7, useMemo as useMemo24, useRef as useRef10, useState as useState14 } from "react";
|
|
24094
24280
|
import { jsx as jsx45, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
24095
24281
|
var UnsubscribeDialog = ({ top }) => {
|
|
24096
24282
|
const { t: t3, locale } = useTranslation();
|
|
@@ -24107,8 +24293,9 @@ var UnsubscribeDialog = ({ top }) => {
|
|
|
24107
24293
|
const [error, setError] = useState14();
|
|
24108
24294
|
const [isLoading, setIsLoading] = useState14(false);
|
|
24109
24295
|
const [isModal, setIsModal] = useState14(true);
|
|
24110
|
-
const {
|
|
24111
|
-
|
|
24296
|
+
const { billDate } = useNextBillDate();
|
|
24297
|
+
const { planPeriod, currentPlan, currentAddOns, featureUsage, cancelDate } = useMemo24(() => {
|
|
24298
|
+
const cancelDate2 = data?.subscription?.cancelAt || billDate;
|
|
24112
24299
|
return {
|
|
24113
24300
|
planPeriod: getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month",
|
|
24114
24301
|
currentPlan: data?.company?.plan,
|
|
@@ -24122,10 +24309,10 @@ var UnsubscribeDialog = ({ top }) => {
|
|
|
24122
24309
|
data?.company?.plan,
|
|
24123
24310
|
data?.featureUsage,
|
|
24124
24311
|
data?.subscription?.cancelAt,
|
|
24125
|
-
|
|
24312
|
+
billDate
|
|
24126
24313
|
]);
|
|
24127
24314
|
const { plans: availablePlans, addOns: availableAddOns } = useAvailablePlans(planPeriod);
|
|
24128
|
-
const selectedPlan =
|
|
24315
|
+
const selectedPlan = useMemo24(
|
|
24129
24316
|
() => availablePlans.find((plan) => plan.id === currentPlan?.id),
|
|
24130
24317
|
[currentPlan?.id, availablePlans]
|
|
24131
24318
|
);
|
|
@@ -24134,7 +24321,7 @@ var UnsubscribeDialog = ({ top }) => {
|
|
|
24134
24321
|
createActiveUsageBasedEntitlementsReducer(currentEntitlements, planPeriod),
|
|
24135
24322
|
[]
|
|
24136
24323
|
);
|
|
24137
|
-
const addOns =
|
|
24324
|
+
const addOns = useMemo24(
|
|
24138
24325
|
() => availableAddOns.map((available) => ({
|
|
24139
24326
|
...available,
|
|
24140
24327
|
isSelected: currentAddOns.some((current) => available.id === current.id) ?? false
|
|
@@ -24385,6 +24572,7 @@ var Badge = () => {
|
|
|
24385
24572
|
// src/components/layout/RenderLayout.tsx
|
|
24386
24573
|
import { jsx as jsx48, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
24387
24574
|
var Disabled = () => {
|
|
24575
|
+
const { t: t3 } = useTranslation();
|
|
24388
24576
|
return /* @__PURE__ */ jsx48(Box, { $width: "max-content", $height: "max-content", children: /* @__PURE__ */ jsx48(Card, { children: /* @__PURE__ */ jsxs35(
|
|
24389
24577
|
Element,
|
|
24390
24578
|
{
|
|
@@ -24394,8 +24582,8 @@ var Disabled = () => {
|
|
|
24394
24582
|
$alignItems: "center",
|
|
24395
24583
|
$whiteSpace: "nowrap",
|
|
24396
24584
|
children: [
|
|
24397
|
-
/* @__PURE__ */ jsx48(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx48(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
|
|
24398
|
-
/* @__PURE__ */ jsx48(Text, { as: "p", children: "Please try again later." })
|
|
24585
|
+
/* @__PURE__ */ jsx48(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx48(Text, { as: "h1", display: "heading1", children: t3("Portal not found") }) }),
|
|
24586
|
+
/* @__PURE__ */ jsx48(Text, { as: "p", children: t3("Please try again later.") })
|
|
24399
24587
|
]
|
|
24400
24588
|
}
|
|
24401
24589
|
) }) });
|
|
@@ -24524,10 +24712,10 @@ var ButtonElement = forwardRef9(({ children, className, ...rest }, ref) => {
|
|
|
24524
24712
|
ButtonElement.displayName = "Button";
|
|
24525
24713
|
|
|
24526
24714
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
24527
|
-
import { Fragment as Fragment19, forwardRef as forwardRef10, useMemo as
|
|
24715
|
+
import { Fragment as Fragment19, forwardRef as forwardRef10, useMemo as useMemo26 } from "react";
|
|
24528
24716
|
|
|
24529
24717
|
// src/components/elements/included-features/UsageDetails.tsx
|
|
24530
|
-
import { Fragment as Fragment17, useMemo as
|
|
24718
|
+
import { Fragment as Fragment17, useMemo as useMemo25 } from "react";
|
|
24531
24719
|
import { Fragment as Fragment18, jsx as jsx51, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
24532
24720
|
var UsageDetails = ({ entitlement, layout }) => {
|
|
24533
24721
|
const {
|
|
@@ -24555,7 +24743,7 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24555
24743
|
currentTier,
|
|
24556
24744
|
tiersMode,
|
|
24557
24745
|
tiered
|
|
24558
|
-
} =
|
|
24746
|
+
} = useMemo25(() => {
|
|
24559
24747
|
const { billingPrice, amount, limit: limit2, cost: cost2, currentTier: currentTier2 } = getUsageDetails(
|
|
24560
24748
|
entitlement,
|
|
24561
24749
|
period,
|
|
@@ -24582,19 +24770,19 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24582
24770
|
tiered: priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(billingPrice)
|
|
24583
24771
|
};
|
|
24584
24772
|
}, [entitlement, period, priceBehavior, showWarningThresholdAsLimit]);
|
|
24585
|
-
const text =
|
|
24773
|
+
const text = useMemo25(() => {
|
|
24586
24774
|
if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
|
|
24587
24775
|
return;
|
|
24588
24776
|
}
|
|
24589
24777
|
if (priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof allocation === "number") {
|
|
24590
24778
|
return t3("X units", {
|
|
24591
24779
|
amount: formatNumber(allocation, { locale }),
|
|
24592
|
-
units: getFeatureName(feature, allocation)
|
|
24780
|
+
units: getFeatureName(feature, locale, allocation)
|
|
24593
24781
|
});
|
|
24594
24782
|
}
|
|
24595
24783
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof price === "number") {
|
|
24596
24784
|
const formattedCost = formatCurrency(price, { locale, currency });
|
|
24597
|
-
const featureName = getFeatureName(feature, packageSize);
|
|
24785
|
+
const featureName = getFeatureName(feature, locale, packageSize);
|
|
24598
24786
|
return packageSize > 1 ? t3("$X per Y units", {
|
|
24599
24787
|
cost: formattedCost,
|
|
24600
24788
|
size: packageSize,
|
|
@@ -24604,15 +24792,15 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24604
24792
|
if (priceBehavior === EntitlementPriceBehavior.Overage && typeof softLimit === "number") {
|
|
24605
24793
|
return t3("X units", {
|
|
24606
24794
|
amount: formatNumber(softLimit, { locale }),
|
|
24607
|
-
units: getFeatureName(feature, softLimit)
|
|
24795
|
+
units: getFeatureName(feature, locale, softLimit)
|
|
24608
24796
|
});
|
|
24609
24797
|
}
|
|
24610
24798
|
if (priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
24611
24799
|
return typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t3("Unlimited in this tier", {
|
|
24612
|
-
feature: getFeatureName(feature)
|
|
24800
|
+
feature: getFeatureName(feature, locale)
|
|
24613
24801
|
}) : t3("Up to X units in this tier", {
|
|
24614
24802
|
amount: formatNumber(currentTier.to, { locale }),
|
|
24615
|
-
feature: getFeatureName(feature, currentTier.to)
|
|
24803
|
+
feature: getFeatureName(feature, locale, currentTier.to)
|
|
24616
24804
|
}));
|
|
24617
24805
|
}
|
|
24618
24806
|
if (showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
|
|
@@ -24620,6 +24808,7 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24620
24808
|
amount: formatConsumptionRate(planEntitlement.consumptionRate, locale),
|
|
24621
24809
|
units: getFeatureName(
|
|
24622
24810
|
planEntitlement.valueCredit,
|
|
24811
|
+
locale,
|
|
24623
24812
|
planEntitlement.consumptionRate
|
|
24624
24813
|
)
|
|
24625
24814
|
});
|
|
@@ -24627,18 +24816,18 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24627
24816
|
if (priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof limit === "number") {
|
|
24628
24817
|
return t3("X units remaining", {
|
|
24629
24818
|
amount: formatNumber(limit, { locale }),
|
|
24630
|
-
units: getFeatureName(feature, limit)
|
|
24819
|
+
units: getFeatureName(feature, locale, limit)
|
|
24631
24820
|
});
|
|
24632
24821
|
}
|
|
24633
24822
|
if (!priceBehavior && typeof allocation === "number") {
|
|
24634
24823
|
const numericLimit = limit ?? allocation;
|
|
24635
24824
|
return t3("X units", {
|
|
24636
24825
|
amount: formatNumber(numericLimit, { locale }),
|
|
24637
|
-
units: getFeatureName(feature, numericLimit)
|
|
24826
|
+
units: getFeatureName(feature, locale, numericLimit)
|
|
24638
24827
|
});
|
|
24639
24828
|
}
|
|
24640
24829
|
if (!priceBehavior && allocationType === "unlimited") {
|
|
24641
|
-
return t3("Unlimited", { item: getFeatureName(feature) });
|
|
24830
|
+
return t3("Unlimited", { item: getFeatureName(feature, locale) });
|
|
24642
24831
|
}
|
|
24643
24832
|
}, [
|
|
24644
24833
|
t3,
|
|
@@ -24656,7 +24845,7 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24656
24845
|
currentTier,
|
|
24657
24846
|
showCredits
|
|
24658
24847
|
]);
|
|
24659
|
-
const usageText =
|
|
24848
|
+
const usageText = useMemo25(() => {
|
|
24660
24849
|
if (!feature || feature.featureType !== FeatureType.Event && feature.featureType !== FeatureType.Trait) {
|
|
24661
24850
|
return;
|
|
24662
24851
|
}
|
|
@@ -24667,11 +24856,11 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24667
24856
|
/* @__PURE__ */ jsx51(Fragment17, { children: packageSize > 1 ? t3("$X/Y units/period", {
|
|
24668
24857
|
cost: formatCurrency(price, { locale, currency }),
|
|
24669
24858
|
size: packageSize,
|
|
24670
|
-
units: getFeatureName(feature, packageSize),
|
|
24859
|
+
units: getFeatureName(feature, locale, packageSize),
|
|
24671
24860
|
period: shortenPeriod(period, t3)
|
|
24672
24861
|
}) : t3("$X/unit/period", {
|
|
24673
24862
|
cost: formatCurrency(price, { locale, currency }),
|
|
24674
|
-
unit: getFeatureName(feature, packageSize),
|
|
24863
|
+
unit: getFeatureName(feature, locale, packageSize),
|
|
24675
24864
|
period: shortenPeriod(period, t3)
|
|
24676
24865
|
}) }, index)
|
|
24677
24866
|
);
|
|
@@ -24680,7 +24869,7 @@ var UsageDetails = ({ entitlement, layout }) => {
|
|
|
24680
24869
|
acc.push(
|
|
24681
24870
|
/* @__PURE__ */ jsx51(Fragment17, { children: t3("X units used", {
|
|
24682
24871
|
amount: usage,
|
|
24683
|
-
units: getFeatureName(feature, usage)
|
|
24872
|
+
units: getFeatureName(feature, locale, usage)
|
|
24684
24873
|
}) }, index)
|
|
24685
24874
|
);
|
|
24686
24875
|
index += 1;
|
|
@@ -24833,7 +25022,7 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
|
|
|
24833
25022
|
const { t: t3, locale } = useTranslation();
|
|
24834
25023
|
const { data, settings } = useEmbed();
|
|
24835
25024
|
const isLightBackground = useIsLightBackground();
|
|
24836
|
-
const { plan, addOns, featureUsage } =
|
|
25025
|
+
const { plan, addOns, featureUsage } = useMemo26(() => {
|
|
24837
25026
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
24838
25027
|
(acc, id) => {
|
|
24839
25028
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -24910,9 +25099,10 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
|
|
|
24910
25099
|
singularName: grant.singularName,
|
|
24911
25100
|
pluralName: grant.pluralName
|
|
24912
25101
|
},
|
|
25102
|
+
locale,
|
|
24913
25103
|
grant.creditAmount
|
|
24914
25104
|
),
|
|
24915
|
-
licenseName: entitlement.feature ? getFeatureName(entitlement.feature, 1) : ""
|
|
25105
|
+
licenseName: entitlement.feature ? getFeatureName(entitlement.feature, locale, 1) : ""
|
|
24916
25106
|
}) }, grantIndex)),
|
|
24917
25107
|
props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ jsx52(
|
|
24918
25108
|
Text,
|
|
@@ -24970,7 +25160,7 @@ var IncludedFeatures = forwardRef10(({ className, ...rest }, ref) => {
|
|
|
24970
25160
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
24971
25161
|
|
|
24972
25162
|
// src/components/elements/invoices/Invoices.tsx
|
|
24973
|
-
import { forwardRef as forwardRef11, useCallback as useCallback13, useEffect as useEffect5, useMemo as
|
|
25163
|
+
import { forwardRef as forwardRef11, useCallback as useCallback13, useEffect as useEffect5, useMemo as useMemo27, useState as useState16 } from "react";
|
|
24974
25164
|
import { Fragment as Fragment20, jsx as jsx53, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
24975
25165
|
function resolveDesignProps3(props) {
|
|
24976
25166
|
return {
|
|
@@ -25038,11 +25228,11 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
25038
25228
|
const [rawInvoices, setInvoices] = useState16(
|
|
25039
25229
|
() => data && "invoices" in data ? data.invoices : rest.data
|
|
25040
25230
|
);
|
|
25041
|
-
const invoices =
|
|
25231
|
+
const invoices = useMemo27(
|
|
25042
25232
|
() => formatInvoices(rawInvoices, locale),
|
|
25043
25233
|
[rawInvoices, locale]
|
|
25044
25234
|
);
|
|
25045
|
-
const reachableInvoices =
|
|
25235
|
+
const reachableInvoices = useMemo27(
|
|
25046
25236
|
() => invoices.slice(0, MAX_VISIBLE_INVOICE_COUNT),
|
|
25047
25237
|
[invoices]
|
|
25048
25238
|
);
|
|
@@ -25161,7 +25351,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
25161
25351
|
Invoices.displayName = "Invoices";
|
|
25162
25352
|
|
|
25163
25353
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
25164
|
-
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as
|
|
25354
|
+
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo29, useRef as useRef12, useState as useState18 } from "react";
|
|
25165
25355
|
|
|
25166
25356
|
// src/components/elements/metered-features/Meter.tsx
|
|
25167
25357
|
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
@@ -25246,7 +25436,7 @@ var PriceDetails = ({
|
|
|
25246
25436
|
packageSize,
|
|
25247
25437
|
" "
|
|
25248
25438
|
] }),
|
|
25249
|
-
getFeatureName(feature, packageSize),
|
|
25439
|
+
getFeatureName(feature, locale, packageSize),
|
|
25250
25440
|
feature.featureType === FeatureType.Trait && period && /* @__PURE__ */ jsxs40(Fragment21, { children: [
|
|
25251
25441
|
"/",
|
|
25252
25442
|
shortenPeriod(period, t3)
|
|
@@ -25271,7 +25461,7 @@ var PriceDetails = ({
|
|
|
25271
25461
|
typeof amount === "number" && /* @__PURE__ */ jsx55(Fragment21, { children: priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs40(Text, { children: [
|
|
25272
25462
|
formatNumber(amount, { locale }),
|
|
25273
25463
|
" ",
|
|
25274
|
-
getFeatureName(feature, amount),
|
|
25464
|
+
getFeatureName(feature, locale, amount),
|
|
25275
25465
|
" \xB7 ",
|
|
25276
25466
|
formatCurrency(currentTierPerUnitPrice * amount, {
|
|
25277
25467
|
locale,
|
|
@@ -25294,7 +25484,7 @@ var PriceDetails = ({
|
|
|
25294
25484
|
};
|
|
25295
25485
|
|
|
25296
25486
|
// src/components/elements/metered-features/UsageByUser.tsx
|
|
25297
|
-
import { useEffect as useEffect6, useMemo as
|
|
25487
|
+
import { useEffect as useEffect6, useMemo as useMemo28, useState as useState17 } from "react";
|
|
25298
25488
|
import { jsx as jsx56, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
25299
25489
|
var COLLAPSED_COUNT = 3;
|
|
25300
25490
|
var EXPANDED_COUNT = 20;
|
|
@@ -25391,7 +25581,7 @@ var UsageByUser = ({ source, unit }) => {
|
|
|
25391
25581
|
sourceKey
|
|
25392
25582
|
]);
|
|
25393
25583
|
const entries = current?.section?.entries;
|
|
25394
|
-
const attributed =
|
|
25584
|
+
const attributed = useMemo28(
|
|
25395
25585
|
() => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
|
|
25396
25586
|
[entries]
|
|
25397
25587
|
);
|
|
@@ -25399,7 +25589,7 @@ var UsageByUser = ({ source, unit }) => {
|
|
|
25399
25589
|
const total = current?.section?.total ?? 0;
|
|
25400
25590
|
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
25401
25591
|
const unattributed = current?.section?.unattributed;
|
|
25402
|
-
const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, amount)}`;
|
|
25592
|
+
const formatAmount = (amount) => `${formatNumber(amount, { locale })} ${getFeatureName(unit, locale, amount)}`;
|
|
25403
25593
|
if (error) {
|
|
25404
25594
|
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
25405
25595
|
/* @__PURE__ */ jsx56(Text, { display: "heading4", children: t3("Usage by user") }),
|
|
@@ -25504,10 +25694,10 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
25504
25694
|
const acc = [];
|
|
25505
25695
|
acc.push(
|
|
25506
25696
|
priceBehavior === EntitlementPriceBehavior.Tier && typeof currentTier?.to === "number" && typeof feature !== "undefined" ? currentTier?.to === Infinity ? t3("Unlimited in this tier", {
|
|
25507
|
-
feature: getFeatureName(feature)
|
|
25697
|
+
feature: getFeatureName(feature, locale)
|
|
25508
25698
|
}) : t3("Up to X units in this tier", {
|
|
25509
25699
|
amount: currentTier.to,
|
|
25510
|
-
feature: getFeatureName(feature)
|
|
25700
|
+
feature: getFeatureName(feature, locale)
|
|
25511
25701
|
}) : priceBehavior === EntitlementPriceBehavior.Overage && typeof limit === "number" ? t3("X included", {
|
|
25512
25702
|
amount: formatNumber(limit, { locale })
|
|
25513
25703
|
}) : priceBehavior === EntitlementPriceBehavior.PayInAdvance && typeof usage === "number" ? `${formatNumber(usage, { locale })} ${t3("used")}` : priceBehavior === EntitlementPriceBehavior.PayAsYouGo && typeof cost === "number" ? formatCurrency(cost, { locale, currency: billingPrice?.currency }) : data?.displaySettings?.showCredits && priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof planEntitlement?.valueCredit !== "undefined" && typeof planEntitlement?.consumptionRate === "number" ? t3("X units per use", {
|
|
@@ -25517,11 +25707,12 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
25517
25707
|
),
|
|
25518
25708
|
units: getFeatureName(
|
|
25519
25709
|
planEntitlement.valueCredit,
|
|
25710
|
+
locale,
|
|
25520
25711
|
planEntitlement.consumptionRate
|
|
25521
25712
|
)
|
|
25522
25713
|
}) : priceBehavior === EntitlementPriceBehavior.CreditBurndown && typeof feature !== "undefined" && typeof limit === "number" ? t3("X units remaining", {
|
|
25523
25714
|
amount: formatNumber(limit, { locale }),
|
|
25524
|
-
units: getFeatureName(feature, limit)
|
|
25715
|
+
units: getFeatureName(feature, locale, limit)
|
|
25525
25716
|
}) : typeof limit === "number" ? t3("Limit of", {
|
|
25526
25717
|
amount: formatNumber(limit, { locale })
|
|
25527
25718
|
}) : t3("No limit")
|
|
@@ -25584,7 +25775,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25584
25775
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
25585
25776
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
25586
25777
|
const isLightBackground = useIsLightBackground();
|
|
25587
|
-
const
|
|
25778
|
+
const { billDate: renewalDate } = useNextBillDate();
|
|
25779
|
+
const meteredFeatures = useMemo29(() => {
|
|
25588
25780
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
25589
25781
|
(acc, id) => {
|
|
25590
25782
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -25601,7 +25793,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25601
25793
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
25602
25794
|
);
|
|
25603
25795
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
25604
|
-
const creditGroups =
|
|
25796
|
+
const creditGroups = useMemo29(
|
|
25605
25797
|
() => withEmptyPlanCreditBalances(
|
|
25606
25798
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
25607
25799
|
listPlanCredits(
|
|
@@ -25612,7 +25804,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25612
25804
|
),
|
|
25613
25805
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
25614
25806
|
);
|
|
25615
|
-
const planCreditCompositions =
|
|
25807
|
+
const planCreditCompositions = useMemo29(
|
|
25616
25808
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
25617
25809
|
[data?.company?.plan?.includedCreditGrants]
|
|
25618
25810
|
);
|
|
@@ -25626,7 +25818,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25626
25818
|
},
|
|
25627
25819
|
[data?.featureUsage?.features]
|
|
25628
25820
|
);
|
|
25629
|
-
const purchasableCreditIds =
|
|
25821
|
+
const purchasableCreditIds = useMemo29(
|
|
25630
25822
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
25631
25823
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
25632
25824
|
);
|
|
@@ -25723,11 +25915,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25723
25915
|
formatNumber(limit, { locale }),
|
|
25724
25916
|
" "
|
|
25725
25917
|
] }),
|
|
25726
|
-
getFeatureName(feature, limit)
|
|
25918
|
+
getFeatureName(feature, locale, limit)
|
|
25727
25919
|
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment22, { children: [
|
|
25728
25920
|
formatNumber(usage, { locale }),
|
|
25729
25921
|
" ",
|
|
25730
|
-
getFeatureName(feature, usage),
|
|
25922
|
+
getFeatureName(feature, locale, usage),
|
|
25731
25923
|
" ",
|
|
25732
25924
|
t3("used")
|
|
25733
25925
|
] }) }) }),
|
|
@@ -25816,6 +26008,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25816
26008
|
}),
|
|
25817
26009
|
units: getFeatureName(
|
|
25818
26010
|
credit,
|
|
26011
|
+
locale,
|
|
25819
26012
|
credit.total.remaining
|
|
25820
26013
|
)
|
|
25821
26014
|
}) }) }),
|
|
@@ -25857,6 +26050,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25857
26050
|
quantity: licenseQuantity,
|
|
25858
26051
|
licenseName: getFeatureName(
|
|
25859
26052
|
licenseFeature,
|
|
26053
|
+
locale,
|
|
25860
26054
|
licenseQuantity
|
|
25861
26055
|
),
|
|
25862
26056
|
perUnit: perLicenseGrant.amount
|
|
@@ -25869,7 +26063,6 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25869
26063
|
})
|
|
25870
26064
|
);
|
|
25871
26065
|
}
|
|
25872
|
-
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
25873
26066
|
return (
|
|
25874
26067
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
25875
26068
|
/* @__PURE__ */ jsx57(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
|
|
@@ -25881,7 +26074,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25881
26074
|
children: [
|
|
25882
26075
|
t3("Your plan includes credits", {
|
|
25883
26076
|
total,
|
|
25884
|
-
creditName: getFeatureName(credit, total),
|
|
26077
|
+
creditName: getFeatureName(credit, locale, total),
|
|
25885
26078
|
period: shortenPeriod(composition.period, t3),
|
|
25886
26079
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25887
26080
|
}),
|
|
@@ -25916,6 +26109,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25916
26109
|
amount: grant.quantity,
|
|
25917
26110
|
item: getFeatureName(
|
|
25918
26111
|
credit,
|
|
26112
|
+
locale,
|
|
25919
26113
|
grant.quantity
|
|
25920
26114
|
)
|
|
25921
26115
|
}) }) }),
|
|
@@ -25937,7 +26131,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25937
26131
|
] }) : /* @__PURE__ */ jsxs42(Fragment22, { children: [
|
|
25938
26132
|
/* @__PURE__ */ jsx57(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx57(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx57(Fragment22, { children: t3("X item bundle", {
|
|
25939
26133
|
amount: grant.quantity,
|
|
25940
|
-
item: getFeatureName(credit, 1),
|
|
26134
|
+
item: getFeatureName(credit, locale, 1),
|
|
25941
26135
|
createdAt: toPrettyDate(
|
|
25942
26136
|
grant.createdAt,
|
|
25943
26137
|
{ locale, month: "short" }
|
|
@@ -25946,6 +26140,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25946
26140
|
amount: grant.quantity,
|
|
25947
26141
|
item: getFeatureName(
|
|
25948
26142
|
credit,
|
|
26143
|
+
locale,
|
|
25949
26144
|
grant.quantity
|
|
25950
26145
|
),
|
|
25951
26146
|
createdAt: toPrettyDate(
|
|
@@ -25956,6 +26151,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25956
26151
|
amount: grant.quantity,
|
|
25957
26152
|
item: getFeatureName(
|
|
25958
26153
|
credit,
|
|
26154
|
+
locale,
|
|
25959
26155
|
grant.quantity
|
|
25960
26156
|
),
|
|
25961
26157
|
createdAt: toPrettyDate(
|
|
@@ -26027,10 +26223,10 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
26027
26223
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
26028
26224
|
|
|
26029
26225
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
26030
|
-
import { forwardRef as forwardRef13, useMemo as
|
|
26226
|
+
import { forwardRef as forwardRef13, useMemo as useMemo31 } from "react";
|
|
26031
26227
|
|
|
26032
26228
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
26033
|
-
import { useMemo as
|
|
26229
|
+
import { useMemo as useMemo30 } from "react";
|
|
26034
26230
|
import { jsx as jsx58, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
26035
26231
|
var PaymentElement2 = ({
|
|
26036
26232
|
iconName,
|
|
@@ -26206,7 +26402,7 @@ var PaymentListElement = ({
|
|
|
26206
26402
|
const { settings } = useEmbed();
|
|
26207
26403
|
const isLightBackground = useIsLightBackground();
|
|
26208
26404
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
26209
|
-
const expirationDate =
|
|
26405
|
+
const expirationDate = useMemo30(() => {
|
|
26210
26406
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
26211
26407
|
if (!cardExpMonth || !cardExpYear) {
|
|
26212
26408
|
return;
|
|
@@ -26301,7 +26497,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
26301
26497
|
var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
26302
26498
|
const props = resolveDesignProps5(rest);
|
|
26303
26499
|
const { data, setLayout } = useEmbed();
|
|
26304
|
-
const { paymentMethod, monthsToExpiration } =
|
|
26500
|
+
const { paymentMethod, monthsToExpiration } = useMemo31(() => {
|
|
26305
26501
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
26306
26502
|
let monthsToExpiration2;
|
|
26307
26503
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -26505,7 +26701,7 @@ var loadStripe = function loadStripe2() {
|
|
|
26505
26701
|
};
|
|
26506
26702
|
|
|
26507
26703
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
26508
|
-
import { useCallback as useCallback15, useEffect as useEffect7, useMemo as
|
|
26704
|
+
import { useCallback as useCallback15, useEffect as useEffect7, useMemo as useMemo32, useState as useState19 } from "react";
|
|
26509
26705
|
import { jsx as jsx60, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
26510
26706
|
var resolveDesignProps6 = () => {
|
|
26511
26707
|
return {
|
|
@@ -26534,7 +26730,7 @@ var PaymentMethodDetails = ({
|
|
|
26534
26730
|
updatePaymentMethod,
|
|
26535
26731
|
deletePaymentMethod
|
|
26536
26732
|
} = useEmbed();
|
|
26537
|
-
const { defaultPaymentMethod, paymentMethods, subscription } =
|
|
26733
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = useMemo32(() => {
|
|
26538
26734
|
return {
|
|
26539
26735
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
26540
26736
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -26566,7 +26762,7 @@ var PaymentMethodDetails = ({
|
|
|
26566
26762
|
},
|
|
26567
26763
|
autoConfirm: true
|
|
26568
26764
|
});
|
|
26569
|
-
const monthsToExpiration =
|
|
26765
|
+
const monthsToExpiration = useMemo32(() => {
|
|
26570
26766
|
let expiration;
|
|
26571
26767
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
26572
26768
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -26589,7 +26785,7 @@ var PaymentMethodDetails = ({
|
|
|
26589
26785
|
const toggleShowPaymentMethods = () => {
|
|
26590
26786
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
26591
26787
|
};
|
|
26592
|
-
const locale =
|
|
26788
|
+
const locale = useMemo32(() => stripeLocale(language), [language]);
|
|
26593
26789
|
const initializeStripe = useCallback15(() => {
|
|
26594
26790
|
if (stripe || !setupIntent) {
|
|
26595
26791
|
return;
|
|
@@ -26849,7 +27045,7 @@ var PaymentMethodDetails = ({
|
|
|
26849
27045
|
};
|
|
26850
27046
|
|
|
26851
27047
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26852
|
-
import { forwardRef as forwardRef14, useMemo as
|
|
27048
|
+
import { forwardRef as forwardRef14, useMemo as useMemo34 } from "react";
|
|
26853
27049
|
|
|
26854
27050
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
26855
27051
|
import { jsx as jsx61, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
@@ -26875,7 +27071,7 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26875
27071
|
};
|
|
26876
27072
|
|
|
26877
27073
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
26878
|
-
import { Fragment as Fragment23, useMemo as
|
|
27074
|
+
import { Fragment as Fragment23, useMemo as useMemo33 } from "react";
|
|
26879
27075
|
import { Fragment as Fragment24, jsx as jsx62, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
26880
27076
|
var UsageDetails2 = ({
|
|
26881
27077
|
entitlement,
|
|
@@ -26891,13 +27087,13 @@ var UsageDetails2 = ({
|
|
|
26891
27087
|
billingPrice,
|
|
26892
27088
|
limit,
|
|
26893
27089
|
cost = 0
|
|
26894
|
-
} =
|
|
27090
|
+
} = useMemo33(
|
|
26895
27091
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26896
27092
|
showWarningThresholdAsLimit
|
|
26897
27093
|
}),
|
|
26898
27094
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26899
27095
|
);
|
|
26900
|
-
const description =
|
|
27096
|
+
const description = useMemo33(() => {
|
|
26901
27097
|
const acc = [];
|
|
26902
27098
|
let index = 0;
|
|
26903
27099
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
@@ -26923,7 +27119,7 @@ var UsageDetails2 = ({
|
|
|
26923
27119
|
packageSize,
|
|
26924
27120
|
" "
|
|
26925
27121
|
] }),
|
|
26926
|
-
getFeatureName(entitlement.feature, packageSize),
|
|
27122
|
+
getFeatureName(entitlement.feature, locale, packageSize),
|
|
26927
27123
|
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26928
27124
|
"/",
|
|
26929
27125
|
shortenPeriod(period, t3)
|
|
@@ -26943,6 +27139,7 @@ var UsageDetails2 = ({
|
|
|
26943
27139
|
" ",
|
|
26944
27140
|
getFeatureName(
|
|
26945
27141
|
entitlement.planEntitlement.valueCredit,
|
|
27142
|
+
locale,
|
|
26946
27143
|
entitlement.planEntitlement.consumptionRate
|
|
26947
27144
|
),
|
|
26948
27145
|
" ",
|
|
@@ -26978,7 +27175,7 @@ var UsageDetails2 = ({
|
|
|
26978
27175
|
/* @__PURE__ */ jsx62(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26979
27176
|
quantity,
|
|
26980
27177
|
" ",
|
|
26981
|
-
getFeatureName(entitlement.feature, quantity, true)
|
|
27178
|
+
getFeatureName(entitlement.feature, locale, quantity, true)
|
|
26982
27179
|
] }) : entitlement.feature.name }),
|
|
26983
27180
|
/* @__PURE__ */ jsxs46(Text, { children: [
|
|
26984
27181
|
description.length > 0 && /* @__PURE__ */ jsx62(
|
|
@@ -27075,7 +27272,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27075
27272
|
showCredits,
|
|
27076
27273
|
showZeroPriceAsFree,
|
|
27077
27274
|
trialPaymentMethodRequired
|
|
27078
|
-
} =
|
|
27275
|
+
} = useMemo34(() => {
|
|
27079
27276
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
27080
27277
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
27081
27278
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -27135,15 +27332,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27135
27332
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
27136
27333
|
data?.trialPaymentMethodRequired
|
|
27137
27334
|
]);
|
|
27138
|
-
const usageBasedEntitlements =
|
|
27335
|
+
const usageBasedEntitlements = useMemo34(
|
|
27139
27336
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
27140
27337
|
[featureUsage]
|
|
27141
27338
|
);
|
|
27142
|
-
const planCreditCompositions =
|
|
27339
|
+
const planCreditCompositions = useMemo34(
|
|
27143
27340
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
27144
27341
|
[currentPlan?.includedCreditGrants]
|
|
27145
27342
|
);
|
|
27146
|
-
const resolveLicenseQuantity =
|
|
27343
|
+
const resolveLicenseQuantity = useMemo34(() => {
|
|
27147
27344
|
return (licenseId) => {
|
|
27148
27345
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
27149
27346
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -27166,7 +27363,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27166
27363
|
subscriptionCurrency,
|
|
27167
27364
|
willSubscriptionCancel,
|
|
27168
27365
|
isTrialSubscription
|
|
27169
|
-
} =
|
|
27366
|
+
} = useMemo34(() => {
|
|
27170
27367
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
27171
27368
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
27172
27369
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -27179,7 +27376,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27179
27376
|
};
|
|
27180
27377
|
}, [billingSubscription]);
|
|
27181
27378
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
27182
|
-
const { isFreePlan, isUsageBasedPlan } =
|
|
27379
|
+
const { isFreePlan, isUsageBasedPlan } = useMemo34(() => {
|
|
27183
27380
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
27184
27381
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
27185
27382
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -27439,9 +27636,14 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27439
27636
|
amount: perLicenseGrant.amount,
|
|
27440
27637
|
creditName: getFeatureName(
|
|
27441
27638
|
group,
|
|
27639
|
+
locale,
|
|
27442
27640
|
perLicenseGrant.amount
|
|
27443
27641
|
),
|
|
27444
|
-
licenseName: getFeatureName(
|
|
27642
|
+
licenseName: getFeatureName(
|
|
27643
|
+
licenseFeature,
|
|
27644
|
+
locale,
|
|
27645
|
+
1
|
|
27646
|
+
)
|
|
27445
27647
|
}),
|
|
27446
27648
|
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
27447
27649
|
" ",
|
|
@@ -27449,6 +27651,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27449
27651
|
amount: composition.fixedQuantity,
|
|
27450
27652
|
creditName: getFeatureName(
|
|
27451
27653
|
group,
|
|
27654
|
+
locale,
|
|
27452
27655
|
composition.fixedQuantity
|
|
27453
27656
|
),
|
|
27454
27657
|
period: t3(
|
|
@@ -27459,7 +27662,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27459
27662
|
] }) : /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
27460
27663
|
group.total.value,
|
|
27461
27664
|
" ",
|
|
27462
|
-
getFeatureName(group, group.total.value),
|
|
27665
|
+
getFeatureName(group, locale, group.total.value),
|
|
27463
27666
|
" ",
|
|
27464
27667
|
subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment25, { children: [
|
|
27465
27668
|
t3("per"),
|
|
@@ -27502,6 +27705,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27502
27705
|
quantity: licenseQuantity,
|
|
27503
27706
|
licenseName: getFeatureName(
|
|
27504
27707
|
licenseFeature,
|
|
27708
|
+
locale,
|
|
27505
27709
|
licenseQuantity
|
|
27506
27710
|
),
|
|
27507
27711
|
perUnit: perLicenseGrant.amount,
|
|
@@ -27509,6 +27713,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27509
27713
|
total: resolvedTotal,
|
|
27510
27714
|
creditName: getFeatureName(
|
|
27511
27715
|
group,
|
|
27716
|
+
locale,
|
|
27512
27717
|
resolvedTotal
|
|
27513
27718
|
),
|
|
27514
27719
|
period: shortenPeriod(creditPeriod, t3)
|
|
@@ -27516,12 +27721,14 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27516
27721
|
quantity: licenseQuantity,
|
|
27517
27722
|
licenseName: getFeatureName(
|
|
27518
27723
|
licenseFeature,
|
|
27724
|
+
locale,
|
|
27519
27725
|
licenseQuantity
|
|
27520
27726
|
),
|
|
27521
27727
|
perUnit: perLicenseGrant.amount,
|
|
27522
27728
|
total: resolvedTotal,
|
|
27523
27729
|
creditName: getFeatureName(
|
|
27524
27730
|
group,
|
|
27731
|
+
locale,
|
|
27525
27732
|
resolvedTotal
|
|
27526
27733
|
),
|
|
27527
27734
|
period: shortenPeriod(creditPeriod, t3)
|
|
@@ -27563,7 +27770,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27563
27770
|
if (!autoTopupEnabled) {
|
|
27564
27771
|
acc.push(
|
|
27565
27772
|
/* @__PURE__ */ jsx63(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
|
|
27566
|
-
unit: getFeatureName(grant.credit, 1)
|
|
27773
|
+
unit: getFeatureName(grant.credit, locale, 1)
|
|
27567
27774
|
}) }, grant.id)
|
|
27568
27775
|
);
|
|
27569
27776
|
return acc;
|
|
@@ -27575,6 +27782,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27575
27782
|
/* @__PURE__ */ jsx63(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
|
|
27576
27783
|
unit: getFeatureName(
|
|
27577
27784
|
grant.credit,
|
|
27785
|
+
locale,
|
|
27578
27786
|
autoTopupAmount
|
|
27579
27787
|
),
|
|
27580
27788
|
amount: autoTopupAmount,
|
|
@@ -27634,7 +27842,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27634
27842
|
" (",
|
|
27635
27843
|
group.quantity,
|
|
27636
27844
|
" ",
|
|
27637
|
-
getFeatureName(group, group.quantity),
|
|
27845
|
+
getFeatureName(group, locale, group.quantity),
|
|
27638
27846
|
")"
|
|
27639
27847
|
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27640
27848
|
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
@@ -27645,7 +27853,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27645
27853
|
] }),
|
|
27646
27854
|
group.quantity,
|
|
27647
27855
|
" ",
|
|
27648
|
-
getFeatureName(group, group.quantity)
|
|
27856
|
+
getFeatureName(group, locale, group.quantity)
|
|
27649
27857
|
] }),
|
|
27650
27858
|
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27651
27859
|
Text,
|
|
@@ -27705,12 +27913,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27705
27913
|
" (",
|
|
27706
27914
|
group.quantity,
|
|
27707
27915
|
" ",
|
|
27708
|
-
getFeatureName(group, group.quantity),
|
|
27916
|
+
getFeatureName(group, locale, group.quantity),
|
|
27709
27917
|
")"
|
|
27710
27918
|
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27711
27919
|
group.quantity,
|
|
27712
27920
|
" ",
|
|
27713
|
-
getFeatureName(group, group.quantity)
|
|
27921
|
+
getFeatureName(group, locale, group.quantity)
|
|
27714
27922
|
] }),
|
|
27715
27923
|
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27716
27924
|
Text,
|
|
@@ -27761,7 +27969,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27761
27969
|
/* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27762
27970
|
group.quantity,
|
|
27763
27971
|
" ",
|
|
27764
|
-
getFeatureName(group, group.quantity)
|
|
27972
|
+
getFeatureName(group, locale, group.quantity)
|
|
27765
27973
|
] }),
|
|
27766
27974
|
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27767
27975
|
Text,
|
|
@@ -27817,12 +28025,12 @@ import {
|
|
|
27817
28025
|
forwardRef as forwardRef15,
|
|
27818
28026
|
useCallback as useCallback16,
|
|
27819
28027
|
useEffect as useEffect8,
|
|
27820
|
-
useMemo as
|
|
28028
|
+
useMemo as useMemo36,
|
|
27821
28029
|
useState as useState21
|
|
27822
28030
|
} from "react";
|
|
27823
28031
|
|
|
27824
28032
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
27825
|
-
import { useMemo as
|
|
28033
|
+
import { useMemo as useMemo35 } from "react";
|
|
27826
28034
|
import { Fragment as Fragment26, jsx as jsx64, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
27827
28035
|
function renderMeteredEntitlementPricing2({
|
|
27828
28036
|
priceBehavior,
|
|
@@ -27841,6 +28049,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
27841
28049
|
"/",
|
|
27842
28050
|
feature ? getFeatureName(
|
|
27843
28051
|
feature,
|
|
28052
|
+
locale,
|
|
27844
28053
|
packageSize
|
|
27845
28054
|
) : featureName || "unit"
|
|
27846
28055
|
] });
|
|
@@ -27858,6 +28067,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
27858
28067
|
] }),
|
|
27859
28068
|
feature ? getFeatureName(
|
|
27860
28069
|
feature,
|
|
28070
|
+
locale,
|
|
27861
28071
|
packageSize
|
|
27862
28072
|
) : featureName || "unit"
|
|
27863
28073
|
] });
|
|
@@ -27878,7 +28088,7 @@ var AddOn2 = ({
|
|
|
27878
28088
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
27879
28089
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
27880
28090
|
const isLightBackground = useIsLightBackground();
|
|
27881
|
-
const { currentAddOns, canCheckout, isStandalone } =
|
|
28091
|
+
const { currentAddOns, canCheckout, isStandalone } = useMemo35(() => {
|
|
27882
28092
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
27883
28093
|
return {
|
|
27884
28094
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -28047,7 +28257,7 @@ var AddOn2 = ({
|
|
|
28047
28257
|
{
|
|
28048
28258
|
$flexDirection: "column",
|
|
28049
28259
|
$justifyContent: "center",
|
|
28050
|
-
children: /* @__PURE__ */ jsx64(Text, { children: getFeatureName(entitlement.feature) })
|
|
28260
|
+
children: /* @__PURE__ */ jsx64(Text, { children: getFeatureName(entitlement.feature, locale) })
|
|
28051
28261
|
}
|
|
28052
28262
|
)
|
|
28053
28263
|
] }),
|
|
@@ -28209,7 +28419,11 @@ var Entitlement2 = ({
|
|
|
28209
28419
|
formatNumber(entitlementPackageSize, { locale }),
|
|
28210
28420
|
" "
|
|
28211
28421
|
] }),
|
|
28212
|
-
getFeatureName(
|
|
28422
|
+
getFeatureName(
|
|
28423
|
+
entitlement.feature,
|
|
28424
|
+
locale,
|
|
28425
|
+
entitlementPackageSize
|
|
28426
|
+
),
|
|
28213
28427
|
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
28214
28428
|
" ",
|
|
28215
28429
|
t3("per"),
|
|
@@ -28227,12 +28441,13 @@ var Entitlement2 = ({
|
|
|
28227
28441
|
" ",
|
|
28228
28442
|
getFeatureName(
|
|
28229
28443
|
entitlement.valueCredit,
|
|
28444
|
+
locale,
|
|
28230
28445
|
entitlement.consumptionRate
|
|
28231
28446
|
),
|
|
28232
28447
|
" ",
|
|
28233
28448
|
t3("per"),
|
|
28234
28449
|
" ",
|
|
28235
|
-
getFeatureName(entitlement.feature, 1)
|
|
28450
|
+
getFeatureName(entitlement.feature, locale, 1)
|
|
28236
28451
|
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx65(Fragment27, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
|
|
28237
28452
|
amount: formatNumber(
|
|
28238
28453
|
creditBasedEntitlementLimit.limit,
|
|
@@ -28240,9 +28455,12 @@ var Entitlement2 = ({
|
|
|
28240
28455
|
),
|
|
28241
28456
|
units: getFeatureName(
|
|
28242
28457
|
entitlement.feature,
|
|
28458
|
+
locale,
|
|
28243
28459
|
creditBasedEntitlementLimit.limit
|
|
28244
28460
|
),
|
|
28245
|
-
period:
|
|
28461
|
+
period: t3(
|
|
28462
|
+
creditBasedEntitlementLimit.period
|
|
28463
|
+
)
|
|
28246
28464
|
}) : t3("Up to X units", {
|
|
28247
28465
|
amount: formatNumber(
|
|
28248
28466
|
creditBasedEntitlementLimit.limit,
|
|
@@ -28250,17 +28468,18 @@ var Entitlement2 = ({
|
|
|
28250
28468
|
),
|
|
28251
28469
|
units: getFeatureName(
|
|
28252
28470
|
entitlement.feature,
|
|
28471
|
+
locale,
|
|
28253
28472
|
creditBasedEntitlementLimit.limit
|
|
28254
28473
|
)
|
|
28255
28474
|
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
28256
28475
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
|
|
28257
|
-
item: getFeatureName(entitlement.feature)
|
|
28476
|
+
item: getFeatureName(entitlement.feature, locale)
|
|
28258
28477
|
}) : /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
28259
28478
|
typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
28260
28479
|
formatNumber(limit, { locale }),
|
|
28261
28480
|
" "
|
|
28262
28481
|
] }),
|
|
28263
|
-
getFeatureName(entitlement.feature, limit)
|
|
28482
|
+
getFeatureName(entitlement.feature, locale, limit)
|
|
28264
28483
|
] }),
|
|
28265
28484
|
metricPeriodName && /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
28266
28485
|
" ",
|
|
@@ -28289,6 +28508,7 @@ var Entitlement2 = ({
|
|
|
28289
28508
|
] }),
|
|
28290
28509
|
getFeatureName(
|
|
28291
28510
|
entitlement.feature,
|
|
28511
|
+
locale,
|
|
28292
28512
|
entitlementPackageSize
|
|
28293
28513
|
),
|
|
28294
28514
|
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment27, { children: [
|
|
@@ -28742,13 +28962,13 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28742
28962
|
} = useAvailablePlans(selectedPeriod, {
|
|
28743
28963
|
useSelectedPeriod: showPeriodToggle
|
|
28744
28964
|
});
|
|
28745
|
-
const plans =
|
|
28965
|
+
const plans = useMemo36(
|
|
28746
28966
|
() => hasCurrency ? allPlans.filter(
|
|
28747
28967
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
28748
28968
|
) : allPlans,
|
|
28749
28969
|
[allPlans, hasCurrency, selectedCurrency]
|
|
28750
28970
|
);
|
|
28751
|
-
const addOns =
|
|
28971
|
+
const addOns = useMemo36(
|
|
28752
28972
|
() => hasCurrency ? allAddOns.filter(
|
|
28753
28973
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
28754
28974
|
) : allAddOns,
|
|
@@ -28768,7 +28988,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28768
28988
|
$alignItems: "center",
|
|
28769
28989
|
$justifyContent: "center",
|
|
28770
28990
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
28771
|
-
children: /* @__PURE__ */ jsx67(Loader, { "aria-label": "
|
|
28991
|
+
children: /* @__PURE__ */ jsx67(Loader, { "aria-label": t3("Loading"), $size: "2xl" })
|
|
28772
28992
|
}
|
|
28773
28993
|
);
|
|
28774
28994
|
}
|
|
@@ -28961,7 +29181,7 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
|
28961
29181
|
TextElement.displayName = "Text";
|
|
28962
29182
|
|
|
28963
29183
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28964
|
-
import { forwardRef as forwardRef17, useMemo as
|
|
29184
|
+
import { forwardRef as forwardRef17, useMemo as useMemo37 } from "react";
|
|
28965
29185
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
28966
29186
|
var buttonStyles = {
|
|
28967
29187
|
primary: {
|
|
@@ -28992,7 +29212,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28992
29212
|
const props = resolveDesignProps10(rest);
|
|
28993
29213
|
const { t: t3 } = useTranslation();
|
|
28994
29214
|
const { data, setLayout } = useEmbed();
|
|
28995
|
-
const hasActiveSubscription =
|
|
29215
|
+
const hasActiveSubscription = useMemo37(() => {
|
|
28996
29216
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28997
29217
|
}, [data?.subscription]);
|
|
28998
29218
|
if (!hasActiveSubscription) {
|
|
@@ -29027,7 +29247,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
29027
29247
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
29028
29248
|
|
|
29029
29249
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
29030
|
-
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect9, useMemo as
|
|
29250
|
+
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect9, useMemo as useMemo38, useState as useState22 } from "react";
|
|
29031
29251
|
import { jsx as jsx70, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
29032
29252
|
function resolveDesignProps11(props) {
|
|
29033
29253
|
return {
|
|
@@ -29055,7 +29275,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
29055
29275
|
const [isLoading, setIsLoading] = useState22(false);
|
|
29056
29276
|
const [error, setError] = useState22();
|
|
29057
29277
|
const [upcomingInvoice, setUpcomingInvoice] = useState22(data?.upcomingInvoice);
|
|
29058
|
-
const discounts =
|
|
29278
|
+
const discounts = useMemo38(() => {
|
|
29059
29279
|
return (data?.subscription?.discounts || []).filter(
|
|
29060
29280
|
(discount) => (
|
|
29061
29281
|
// Only surface discounts that are currently active and actually
|
|
@@ -29097,7 +29317,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
29097
29317
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
29098
29318
|
}
|
|
29099
29319
|
}, [data?.upcomingInvoice]);
|
|
29100
|
-
const { currency, applied, remaining } =
|
|
29320
|
+
const { currency, applied, remaining } = useMemo38(() => {
|
|
29101
29321
|
const currency2 = upcomingInvoice?.currency;
|
|
29102
29322
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
29103
29323
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -29111,6 +29331,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
29111
29331
|
upcomingInvoice?.endingBalance,
|
|
29112
29332
|
upcomingInvoice?.subtotal
|
|
29113
29333
|
]);
|
|
29334
|
+
const { billDate, paymentDueDate } = useNextBillDate(upcomingInvoice ?? null);
|
|
29114
29335
|
const hasApplied = applied > 0;
|
|
29115
29336
|
const hasBalance = remaining > 0 || applied > 0;
|
|
29116
29337
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
@@ -29142,10 +29363,21 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
29142
29363
|
]
|
|
29143
29364
|
}
|
|
29144
29365
|
) : !isLoading && /* @__PURE__ */ jsx70(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
29145
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(
|
|
29146
|
-
|
|
29147
|
-
|
|
29148
|
-
|
|
29366
|
+
props.header.isVisible && upcomingInvoice.dueDate && billDate && /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
29367
|
+
/* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
|
|
29368
|
+
t3(props.header.prefix),
|
|
29369
|
+
" ",
|
|
29370
|
+
toPrettyDate(billDate, { locale })
|
|
29371
|
+
] }),
|
|
29372
|
+
paymentDueDate && /* @__PURE__ */ jsx70(
|
|
29373
|
+
Text,
|
|
29374
|
+
{
|
|
29375
|
+
$size: 0.8125 * settings.theme.typography.text.fontSize,
|
|
29376
|
+
children: t3("Payment due", {
|
|
29377
|
+
date: toPrettyDate(paymentDueDate, { locale })
|
|
29378
|
+
})
|
|
29379
|
+
}
|
|
29380
|
+
)
|
|
29149
29381
|
] }),
|
|
29150
29382
|
/* @__PURE__ */ jsxs52(
|
|
29151
29383
|
Flex,
|
|
@@ -31887,7 +32119,7 @@ function inflate(input, options = {}) {
|
|
|
31887
32119
|
}
|
|
31888
32120
|
|
|
31889
32121
|
// src/components/embed/Embed.tsx
|
|
31890
|
-
import { useContext as useContext3, useEffect as useEffect10, useMemo as
|
|
32122
|
+
import { useContext as useContext3, useEffect as useEffect10, useMemo as useMemo39 } from "react";
|
|
31891
32123
|
|
|
31892
32124
|
// src/components/embed/renderer.ts
|
|
31893
32125
|
import { createElement } from "react";
|
|
@@ -31985,6 +32217,7 @@ var Loading = () => {
|
|
|
31985
32217
|
};
|
|
31986
32218
|
var Error2 = ({ message }) => {
|
|
31987
32219
|
const { settings } = useEmbed();
|
|
32220
|
+
const { t: t3 } = useTranslation();
|
|
31988
32221
|
return /* @__PURE__ */ jsxs53(
|
|
31989
32222
|
Flex,
|
|
31990
32223
|
{
|
|
@@ -31996,7 +32229,7 @@ var Error2 = ({ message }) => {
|
|
|
31996
32229
|
$alignItems: "center",
|
|
31997
32230
|
$justifyContent: "center",
|
|
31998
32231
|
children: [
|
|
31999
|
-
/* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { display: "heading1", children: "Error" }) }),
|
|
32232
|
+
/* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { display: "heading1", children: t3("Error") }) }),
|
|
32000
32233
|
/* @__PURE__ */ jsx71(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx71(Text, { children: message }) })
|
|
32001
32234
|
]
|
|
32002
32235
|
}
|
|
@@ -32004,6 +32237,7 @@ var Error2 = ({ message }) => {
|
|
|
32004
32237
|
};
|
|
32005
32238
|
var SchematicEmbed = ({ id, accessToken }) => {
|
|
32006
32239
|
const theme = useContext3(yt);
|
|
32240
|
+
const { t: t3 } = useTranslation();
|
|
32007
32241
|
const {
|
|
32008
32242
|
data,
|
|
32009
32243
|
error,
|
|
@@ -32015,7 +32249,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
32015
32249
|
setBuilderSettings
|
|
32016
32250
|
} = useEmbed();
|
|
32017
32251
|
const compressedAst = data?.component?.ast;
|
|
32018
|
-
const { children, parsedSettings, parseError } =
|
|
32252
|
+
const { children, parsedSettings, parseError } = useMemo39(() => {
|
|
32019
32253
|
let children2 = null;
|
|
32020
32254
|
let parsedSettings2 = null;
|
|
32021
32255
|
let parseError2 = null;
|
|
@@ -32074,13 +32308,15 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
32074
32308
|
return /* @__PURE__ */ jsx71(Error2, { message: error.message });
|
|
32075
32309
|
}
|
|
32076
32310
|
if (accessToken?.length === 0) {
|
|
32077
|
-
return /* @__PURE__ */ jsx71(Error2, { message: "Please provide an access token." });
|
|
32311
|
+
return /* @__PURE__ */ jsx71(Error2, { message: t3("Please provide an access token.") });
|
|
32078
32312
|
}
|
|
32079
32313
|
if (!accessToken?.startsWith("token_")) {
|
|
32080
32314
|
return /* @__PURE__ */ jsx71(
|
|
32081
32315
|
Error2,
|
|
32082
32316
|
{
|
|
32083
|
-
message:
|
|
32317
|
+
message: t3(
|
|
32318
|
+
"Invalid access token; your temporary access token will start with `token_`."
|
|
32319
|
+
)
|
|
32084
32320
|
}
|
|
32085
32321
|
);
|
|
32086
32322
|
}
|
|
@@ -32168,6 +32404,7 @@ export {
|
|
|
32168
32404
|
useCustomPlanBilling,
|
|
32169
32405
|
useEmbed,
|
|
32170
32406
|
useIsLightBackground,
|
|
32407
|
+
useNextBillDate,
|
|
32171
32408
|
usePaymentConfirmation,
|
|
32172
32409
|
useRequest,
|
|
32173
32410
|
useSubscriptionCurrency,
|