@schematichq/schematic-components 0.4.5 → 0.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components.cjs.js +753 -305
- package/dist/schematic-components.d.ts +119 -4
- package/dist/schematic-components.esm.js +730 -282
- package/package.json +1 -1
|
@@ -2107,6 +2107,7 @@ __export(index_exports, {
|
|
|
2107
2107
|
StyledCard: () => StyledCard,
|
|
2108
2108
|
Text: () => Text,
|
|
2109
2109
|
Tooltip: () => Tooltip,
|
|
2110
|
+
UnsubscribeButton: () => UnsubscribeButton,
|
|
2110
2111
|
UpcomingBill: () => UpcomingBill,
|
|
2111
2112
|
Viewport: () => Viewport,
|
|
2112
2113
|
cardBoxShadow: () => cardBoxShadow,
|
|
@@ -2123,7 +2124,7 @@ __export(index_exports, {
|
|
|
2123
2124
|
module.exports = __toCommonJS(index_exports);
|
|
2124
2125
|
|
|
2125
2126
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
2126
|
-
var
|
|
2127
|
+
var import_react33 = require("react");
|
|
2127
2128
|
|
|
2128
2129
|
// node_modules/react-i18next/dist/es/Trans.js
|
|
2129
2130
|
var import_react3 = require("react");
|
|
@@ -10655,6 +10656,8 @@ function BillingSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
10655
10656
|
return json;
|
|
10656
10657
|
}
|
|
10657
10658
|
return {
|
|
10659
|
+
cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
|
|
10660
|
+
cancelAtPeriodEnd: json["cancel_at_period_end"],
|
|
10658
10661
|
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
10659
10662
|
createdAt: new Date(json["created_at"]),
|
|
10660
10663
|
currency: json["currency"],
|
|
@@ -10741,6 +10744,8 @@ function BillingSubscriptionViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10741
10744
|
return json;
|
|
10742
10745
|
}
|
|
10743
10746
|
return {
|
|
10747
|
+
cancelAt: json["cancel_at"] == null ? void 0 : json["cancel_at"],
|
|
10748
|
+
cancelAtPeriodEnd: json["cancel_at_period_end"],
|
|
10744
10749
|
companyId: json["company_id"] == null ? void 0 : json["company_id"],
|
|
10745
10750
|
createdAt: new Date(json["created_at"]),
|
|
10746
10751
|
currency: json["currency"],
|
|
@@ -10823,6 +10828,33 @@ function CheckoutResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
10823
10828
|
};
|
|
10824
10829
|
}
|
|
10825
10830
|
|
|
10831
|
+
// src/api/models/DeleteResponse.ts
|
|
10832
|
+
function DeleteResponseFromJSON(json) {
|
|
10833
|
+
return DeleteResponseFromJSONTyped(json, false);
|
|
10834
|
+
}
|
|
10835
|
+
function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
10836
|
+
if (json == null) {
|
|
10837
|
+
return json;
|
|
10838
|
+
}
|
|
10839
|
+
return {
|
|
10840
|
+
deleted: json["deleted"] == null ? void 0 : json["deleted"]
|
|
10841
|
+
};
|
|
10842
|
+
}
|
|
10843
|
+
|
|
10844
|
+
// src/api/models/CheckoutUnsubscribeResponse.ts
|
|
10845
|
+
function CheckoutUnsubscribeResponseFromJSON(json) {
|
|
10846
|
+
return CheckoutUnsubscribeResponseFromJSONTyped(json, false);
|
|
10847
|
+
}
|
|
10848
|
+
function CheckoutUnsubscribeResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
10849
|
+
if (json == null) {
|
|
10850
|
+
return json;
|
|
10851
|
+
}
|
|
10852
|
+
return {
|
|
10853
|
+
data: DeleteResponseFromJSON(json["data"]),
|
|
10854
|
+
params: json["params"]
|
|
10855
|
+
};
|
|
10856
|
+
}
|
|
10857
|
+
|
|
10826
10858
|
// src/api/models/CompanyEventPeriodMetricsResponseData.ts
|
|
10827
10859
|
function CompanyEventPeriodMetricsResponseDataFromJSON(json) {
|
|
10828
10860
|
return CompanyEventPeriodMetricsResponseDataFromJSONTyped(json, false);
|
|
@@ -11322,6 +11354,8 @@ function CompanySubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator)
|
|
|
11322
11354
|
return json;
|
|
11323
11355
|
}
|
|
11324
11356
|
return {
|
|
11357
|
+
cancelAt: json["cancel_at"] == null ? void 0 : new Date(json["cancel_at"]),
|
|
11358
|
+
cancelAtPeriodEnd: json["cancel_at_period_end"],
|
|
11325
11359
|
currency: json["currency"],
|
|
11326
11360
|
customerExternalId: json["customer_external_id"],
|
|
11327
11361
|
discounts: json["discounts"].map(
|
|
@@ -11682,6 +11716,38 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
11682
11716
|
const response = await this.checkoutRaw(requestParameters, initOverrides);
|
|
11683
11717
|
return await response.value();
|
|
11684
11718
|
}
|
|
11719
|
+
/**
|
|
11720
|
+
* Checkout unsubscribe
|
|
11721
|
+
*/
|
|
11722
|
+
async checkoutUnsubscribeRaw(initOverrides) {
|
|
11723
|
+
const queryParameters = {};
|
|
11724
|
+
const headerParameters = {};
|
|
11725
|
+
if (this.configuration && this.configuration.apiKey) {
|
|
11726
|
+
headerParameters["X-Schematic-Api-Key"] = await this.configuration.apiKey(
|
|
11727
|
+
"X-Schematic-Api-Key"
|
|
11728
|
+
);
|
|
11729
|
+
}
|
|
11730
|
+
const response = await this.request(
|
|
11731
|
+
{
|
|
11732
|
+
path: `/checkout/unsubscribe`,
|
|
11733
|
+
method: "DELETE",
|
|
11734
|
+
headers: headerParameters,
|
|
11735
|
+
query: queryParameters
|
|
11736
|
+
},
|
|
11737
|
+
initOverrides
|
|
11738
|
+
);
|
|
11739
|
+
return new JSONApiResponse(
|
|
11740
|
+
response,
|
|
11741
|
+
(jsonValue) => CheckoutUnsubscribeResponseFromJSON(jsonValue)
|
|
11742
|
+
);
|
|
11743
|
+
}
|
|
11744
|
+
/**
|
|
11745
|
+
* Checkout unsubscribe
|
|
11746
|
+
*/
|
|
11747
|
+
async checkoutUnsubscribe(initOverrides) {
|
|
11748
|
+
const response = await this.checkoutUnsubscribeRaw(initOverrides);
|
|
11749
|
+
return await response.value();
|
|
11750
|
+
}
|
|
11685
11751
|
/**
|
|
11686
11752
|
* Get setup intent
|
|
11687
11753
|
*/
|
|
@@ -11907,6 +11973,7 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
11907
11973
|
var en_default = {
|
|
11908
11974
|
translation: {
|
|
11909
11975
|
"A problem occurred while saving your payment method.": "A problem occurred while saving your payment method.",
|
|
11976
|
+
"Access to plan will end on": "Access to plan will end on {{date}}",
|
|
11910
11977
|
Active: "Active",
|
|
11911
11978
|
"Add payment method": "Add payment method",
|
|
11912
11979
|
"Add Seats": "Add More",
|
|
@@ -11916,6 +11983,7 @@ var en_default = {
|
|
|
11916
11983
|
"After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
|
|
11917
11984
|
Billed: "Billed {{period}}",
|
|
11918
11985
|
"billing period": "billing period",
|
|
11986
|
+
"Cancel subscription": "Cancel subscription",
|
|
11919
11987
|
"Cannot downgrade entitlement": "Cannot downgrade to a lower quantity than current usage.",
|
|
11920
11988
|
"Card ending in": "\u{1F4B3} Card ending in {{value}}",
|
|
11921
11989
|
"Change add-on": "Change add-on",
|
|
@@ -11950,9 +12018,11 @@ var en_default = {
|
|
|
11950
12018
|
Invoices: "Invoices",
|
|
11951
12019
|
"Limit of": "Limit of {{amount}}",
|
|
11952
12020
|
Loading: "Loading",
|
|
12021
|
+
"Manage plan": "Manage plan",
|
|
11953
12022
|
Monthly: "Monthly",
|
|
11954
12023
|
Next: "Next",
|
|
11955
12024
|
"No limit": "No limit",
|
|
12025
|
+
"Not ready to cancel?": "Not ready to cancel?",
|
|
11956
12026
|
"Optionally add features to your subscription": "Optionally add features to your subscription",
|
|
11957
12027
|
"Other existing payment method": "Other existing payment method",
|
|
11958
12028
|
"Over usage limit": "Over usage limit",
|
|
@@ -11979,10 +12049,13 @@ var en_default = {
|
|
|
11979
12049
|
"Start trial": "Start trial",
|
|
11980
12050
|
"Subscribe and close": "Subscribe and close",
|
|
11981
12051
|
Subscription: "Subscription",
|
|
12052
|
+
"Subscription canceled": "Subscription canceled",
|
|
11982
12053
|
Trial: "Trial",
|
|
11983
12054
|
"Trial ends in": "Trial ends in {{days}} days",
|
|
11984
12055
|
"Trial plan": "Try free for {{days}} days",
|
|
11985
12056
|
Unlimited: "Unlimited {{item}}",
|
|
12057
|
+
Unsubscribe: "Unsubscribe",
|
|
12058
|
+
"Unsubscribe failed": "Unsubscribe failed",
|
|
11986
12059
|
"Unused time": "Unused time",
|
|
11987
12060
|
Usage: "Usage",
|
|
11988
12061
|
"Usage-based": "Usage-based",
|
|
@@ -11990,6 +12063,7 @@ var en_default = {
|
|
|
11990
12063
|
"X% off": "{{percent}}% off",
|
|
11991
12064
|
"X off": "{{amount}} off",
|
|
11992
12065
|
Yearly: "Yearly",
|
|
12066
|
+
"You will retain access to your plan until the end of the billing period, on": "You will retain access to your plan until the end of the billing period, on",
|
|
11993
12067
|
day: "day",
|
|
11994
12068
|
month: "month",
|
|
11995
12069
|
per: "per",
|
|
@@ -12724,7 +12798,8 @@ var EmbedProvider = ({
|
|
|
12724
12798
|
(0, import_react11.useEffect)(() => {
|
|
12725
12799
|
const element = document.getElementById("schematic-fonts");
|
|
12726
12800
|
if (element) {
|
|
12727
|
-
|
|
12801
|
+
styleRef.current = element;
|
|
12802
|
+
return;
|
|
12728
12803
|
}
|
|
12729
12804
|
const style = document.createElement("link");
|
|
12730
12805
|
style.id = "schematic-fonts";
|
|
@@ -12735,7 +12810,7 @@ var EmbedProvider = ({
|
|
|
12735
12810
|
(0, import_react11.useEffect)(() => {
|
|
12736
12811
|
if (accessToken) {
|
|
12737
12812
|
const { headers = {} } = apiConfig ?? {};
|
|
12738
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12813
|
+
headers["X-Schematic-Components-Version"] = "0.4.7";
|
|
12739
12814
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12740
12815
|
const config = new Configuration({
|
|
12741
12816
|
...apiConfig,
|
|
@@ -12910,13 +12985,15 @@ function shortenPeriod(period) {
|
|
|
12910
12985
|
}
|
|
12911
12986
|
|
|
12912
12987
|
// src/utils/string.ts
|
|
12988
|
+
var DEFAULT_CURRENCY = "USD";
|
|
12913
12989
|
function camelToHyphen(str) {
|
|
12914
12990
|
return str.replace(/([a-z][A-Z])/g, (g2) => `${g2[0]}-${g2[1].toLowerCase()}`);
|
|
12915
12991
|
}
|
|
12916
12992
|
function formatNumber(num) {
|
|
12917
12993
|
return new Intl.NumberFormat("en-US").format(num);
|
|
12918
12994
|
}
|
|
12919
|
-
function formatCurrency(amount, currency =
|
|
12995
|
+
function formatCurrency(amount, currency = DEFAULT_CURRENCY) {
|
|
12996
|
+
const nonEmptyCurrency = currency ? currency.toUpperCase() : DEFAULT_CURRENCY;
|
|
12920
12997
|
try {
|
|
12921
12998
|
const dollars = amount / 100;
|
|
12922
12999
|
const formatValue = (value, symbol) => {
|
|
@@ -12924,8 +13001,8 @@ function formatCurrency(amount, currency = "USD") {
|
|
|
12924
13001
|
if (formatted.endsWith(".0")) {
|
|
12925
13002
|
formatted = formatted.slice(0, -2);
|
|
12926
13003
|
}
|
|
12927
|
-
if (
|
|
12928
|
-
return `${
|
|
13004
|
+
if (nonEmptyCurrency !== DEFAULT_CURRENCY) {
|
|
13005
|
+
return `${nonEmptyCurrency}${formatted}${symbol}`;
|
|
12929
13006
|
}
|
|
12930
13007
|
return `$${formatted}${symbol}`;
|
|
12931
13008
|
};
|
|
@@ -12936,14 +13013,14 @@ function formatCurrency(amount, currency = "USD") {
|
|
|
12936
13013
|
} else {
|
|
12937
13014
|
return new Intl.NumberFormat("en-US", {
|
|
12938
13015
|
style: "currency",
|
|
12939
|
-
currency:
|
|
13016
|
+
currency: nonEmptyCurrency
|
|
12940
13017
|
}).format(dollars);
|
|
12941
13018
|
}
|
|
12942
13019
|
} catch (error) {
|
|
12943
13020
|
console.error("Error formatting currency", error);
|
|
12944
13021
|
return new Intl.NumberFormat("en-US", {
|
|
12945
13022
|
style: "currency",
|
|
12946
|
-
currency:
|
|
13023
|
+
currency: nonEmptyCurrency
|
|
12947
13024
|
}).format(amount / 100);
|
|
12948
13025
|
}
|
|
12949
13026
|
}
|
|
@@ -13180,7 +13257,7 @@ var Button2 = (0, import_react16.forwardRef)(
|
|
|
13180
13257
|
disabled,
|
|
13181
13258
|
...props,
|
|
13182
13259
|
children: [
|
|
13183
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13260
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13184
13261
|
children
|
|
13185
13262
|
]
|
|
13186
13263
|
}
|
|
@@ -13257,8 +13334,6 @@ var EmbedButton = dt(Button2)`
|
|
|
13257
13334
|
font-family: "Public Sans", sans-serif;
|
|
13258
13335
|
font-weight: 500;
|
|
13259
13336
|
text-align: center;
|
|
13260
|
-
width: 100%;
|
|
13261
|
-
padding: 0;
|
|
13262
13337
|
|
|
13263
13338
|
${({ disabled, $color = "primary", theme }) => {
|
|
13264
13339
|
const { l: l2 } = hexToHSL(theme[$color]);
|
|
@@ -13388,6 +13463,38 @@ var EmbedButton = dt(Button2)`
|
|
|
13388
13463
|
`;
|
|
13389
13464
|
}
|
|
13390
13465
|
}}
|
|
13466
|
+
|
|
13467
|
+
${({ $alignment = "center" }) => {
|
|
13468
|
+
switch ($alignment) {
|
|
13469
|
+
case "start":
|
|
13470
|
+
return lt`
|
|
13471
|
+
justify-content: start;
|
|
13472
|
+
`;
|
|
13473
|
+
case "end":
|
|
13474
|
+
return lt`
|
|
13475
|
+
justify-content: end;
|
|
13476
|
+
`;
|
|
13477
|
+
case "center":
|
|
13478
|
+
default:
|
|
13479
|
+
return lt`
|
|
13480
|
+
justify-content: center;
|
|
13481
|
+
`;
|
|
13482
|
+
}
|
|
13483
|
+
}}
|
|
13484
|
+
|
|
13485
|
+
${({ $fullWidth = true }) => {
|
|
13486
|
+
if ($fullWidth) {
|
|
13487
|
+
return lt`
|
|
13488
|
+
width: 100%;
|
|
13489
|
+
padding: 0;
|
|
13490
|
+
`;
|
|
13491
|
+
}
|
|
13492
|
+
return lt`
|
|
13493
|
+
width: fit-content;
|
|
13494
|
+
padding-left: 1rem;
|
|
13495
|
+
padding-right: 1rem;
|
|
13496
|
+
`;
|
|
13497
|
+
}}
|
|
13391
13498
|
`;
|
|
13392
13499
|
|
|
13393
13500
|
// src/components/ui/flex/styles.ts
|
|
@@ -14126,7 +14233,7 @@ var Root = (0, import_react20.forwardRef)(
|
|
|
14126
14233
|
Root.displayName = "Root";
|
|
14127
14234
|
|
|
14128
14235
|
// src/components/layout/viewport/Viewport.tsx
|
|
14129
|
-
var
|
|
14236
|
+
var import_react29 = require("react");
|
|
14130
14237
|
var import_react_dom2 = require("react-dom");
|
|
14131
14238
|
|
|
14132
14239
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
@@ -14234,11 +14341,11 @@ var Navigation = ({
|
|
|
14234
14341
|
] });
|
|
14235
14342
|
};
|
|
14236
14343
|
|
|
14237
|
-
// src/components/shared/
|
|
14344
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14238
14345
|
var import_react21 = require("react");
|
|
14239
14346
|
var import_pluralize = __toESM(require_pluralize());
|
|
14240
14347
|
|
|
14241
|
-
// src/components/shared/
|
|
14348
|
+
// src/components/shared/sidebar/StageButton.tsx
|
|
14242
14349
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
14243
14350
|
var StageButton = ({
|
|
14244
14351
|
canTrial,
|
|
@@ -14429,7 +14536,7 @@ var StageButton = ({
|
|
|
14429
14536
|
}
|
|
14430
14537
|
};
|
|
14431
14538
|
|
|
14432
|
-
// src/components/shared/
|
|
14539
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14433
14540
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
14434
14541
|
var Sidebar = ({
|
|
14435
14542
|
addOns,
|
|
@@ -14452,11 +14559,12 @@ var Sidebar = ({
|
|
|
14452
14559
|
showPaymentForm,
|
|
14453
14560
|
toggleLoading,
|
|
14454
14561
|
updatePromoCode,
|
|
14455
|
-
usageBasedEntitlements
|
|
14562
|
+
usageBasedEntitlements,
|
|
14563
|
+
showHeader = true
|
|
14456
14564
|
}) => {
|
|
14457
14565
|
const { t: t2 } = useTranslation();
|
|
14458
14566
|
const theme = nt();
|
|
14459
|
-
const { api, data, mode, setLayout } = useEmbed();
|
|
14567
|
+
const { api, data, mode, layout, setLayout } = useEmbed();
|
|
14460
14568
|
const isLightBackground = useIsLightBackground();
|
|
14461
14569
|
const payInAdvanceEntitlements = usageBasedEntitlements.filter(
|
|
14462
14570
|
({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
|
|
@@ -14465,27 +14573,28 @@ var Sidebar = ({
|
|
|
14465
14573
|
({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
|
|
14466
14574
|
);
|
|
14467
14575
|
const subscriptionPrice = (0, import_react21.useMemo)(() => {
|
|
14468
|
-
|
|
14576
|
+
const plan = selectedPlan || currentPlan;
|
|
14577
|
+
if (!plan || !plan.monthlyPrice || !plan.yearlyPrice) {
|
|
14469
14578
|
return;
|
|
14470
14579
|
}
|
|
14471
14580
|
let total = 0;
|
|
14472
|
-
const planPrice = (planPeriod === "month" ?
|
|
14473
|
-
const currency = (planPeriod === "month" ?
|
|
14581
|
+
const planPrice = (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price;
|
|
14582
|
+
const currency = (planPeriod === "month" ? plan?.monthlyPrice : plan?.yearlyPrice)?.currency;
|
|
14474
14583
|
if (planPrice) {
|
|
14475
14584
|
total += planPrice;
|
|
14476
14585
|
}
|
|
14477
14586
|
const addOnCost = addOns.reduce(
|
|
14478
|
-
(sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price
|
|
14587
|
+
(sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0 : 0),
|
|
14479
14588
|
0
|
|
14480
14589
|
);
|
|
14481
14590
|
total += addOnCost;
|
|
14482
14591
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
14483
|
-
(sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price
|
|
14592
|
+
(sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price ?? 0),
|
|
14484
14593
|
0
|
|
14485
14594
|
);
|
|
14486
14595
|
total += payInAdvanceCost;
|
|
14487
14596
|
return formatCurrency(total, currency);
|
|
14488
|
-
}, [selectedPlan, addOns, payInAdvanceEntitlements
|
|
14597
|
+
}, [selectedPlan, currentPlan, planPeriod, addOns, payInAdvanceEntitlements]);
|
|
14489
14598
|
const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = (0, import_react21.useMemo)(() => {
|
|
14490
14599
|
return {
|
|
14491
14600
|
amountOff: charges?.amountOff ?? 0,
|
|
@@ -14558,8 +14667,23 @@ var Sidebar = ({
|
|
|
14558
14667
|
payInAdvanceEntitlements,
|
|
14559
14668
|
promoCode
|
|
14560
14669
|
]);
|
|
14670
|
+
const unsubscribe = (0, import_react21.useCallback)(async () => {
|
|
14671
|
+
if (!api) {
|
|
14672
|
+
return;
|
|
14673
|
+
}
|
|
14674
|
+
try {
|
|
14675
|
+
setError(void 0);
|
|
14676
|
+
toggleLoading();
|
|
14677
|
+
await api.checkoutUnsubscribe();
|
|
14678
|
+
setError("success");
|
|
14679
|
+
} catch {
|
|
14680
|
+
setError(t2("Unsubscribe failed"));
|
|
14681
|
+
} finally {
|
|
14682
|
+
toggleLoading();
|
|
14683
|
+
}
|
|
14684
|
+
}, [api, setError, t2, toggleLoading]);
|
|
14561
14685
|
const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
|
|
14562
|
-
const willPlanChange = typeof selectedPlan !== "undefined" && selectedPlan.current
|
|
14686
|
+
const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
|
|
14563
14687
|
const canUpdateSubscription = mode === "edit" || api !== null && (willPlanChange || // TODO: test add-on comparison for finding "changes"
|
|
14564
14688
|
selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
|
|
14565
14689
|
(addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
|
|
@@ -14639,7 +14763,7 @@ var Sidebar = ({
|
|
|
14639
14763
|
}
|
|
14640
14764
|
},
|
|
14641
14765
|
children: [
|
|
14642
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
14766
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
14643
14767
|
Flex,
|
|
14644
14768
|
{
|
|
14645
14769
|
$position: "relative",
|
|
@@ -15389,7 +15513,7 @@ var Sidebar = ({
|
|
|
15389
15513
|
]
|
|
15390
15514
|
}
|
|
15391
15515
|
),
|
|
15392
|
-
|
|
15516
|
+
subscriptionPrice && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
15393
15517
|
Flex,
|
|
15394
15518
|
{
|
|
15395
15519
|
$justifyContent: "space-between",
|
|
@@ -15492,11 +15616,11 @@ var Sidebar = ({
|
|
|
15492
15616
|
}
|
|
15493
15617
|
) })
|
|
15494
15618
|
] }),
|
|
15495
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15619
|
+
layout === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15496
15620
|
StageButton,
|
|
15497
15621
|
{
|
|
15498
15622
|
canTrial: selectedPlan?.companyCanTrial === true,
|
|
15499
|
-
canCheckout
|
|
15623
|
+
canCheckout,
|
|
15500
15624
|
canUpdateSubscription,
|
|
15501
15625
|
checkout,
|
|
15502
15626
|
checkoutStage,
|
|
@@ -15509,6 +15633,16 @@ var Sidebar = ({
|
|
|
15509
15633
|
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
15510
15634
|
}
|
|
15511
15635
|
),
|
|
15636
|
+
layout === "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15637
|
+
EmbedButton,
|
|
15638
|
+
{
|
|
15639
|
+
onClick: async () => {
|
|
15640
|
+
unsubscribe();
|
|
15641
|
+
},
|
|
15642
|
+
isLoading,
|
|
15643
|
+
children: t2("Cancel subscription")
|
|
15644
|
+
}
|
|
15645
|
+
),
|
|
15512
15646
|
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15513
15647
|
Text,
|
|
15514
15648
|
{
|
|
@@ -15519,7 +15653,7 @@ var Sidebar = ({
|
|
|
15519
15653
|
children: error
|
|
15520
15654
|
}
|
|
15521
15655
|
) }),
|
|
15522
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15656
|
+
layout !== "unsubscribe" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { $opacity: "0.625", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15523
15657
|
Text,
|
|
15524
15658
|
{
|
|
15525
15659
|
$font: theme.typography.text.fontFamily,
|
|
@@ -16614,7 +16748,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16614
16748
|
),
|
|
16615
16749
|
[usageBasedEntitlements]
|
|
16616
16750
|
);
|
|
16617
|
-
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected
|
|
16751
|
+
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
|
|
16618
16752
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16619
16753
|
({ quantity }) => quantity > 0
|
|
16620
16754
|
);
|
|
@@ -17224,20 +17358,234 @@ var PeriodToggle = ({
|
|
|
17224
17358
|
);
|
|
17225
17359
|
};
|
|
17226
17360
|
|
|
17227
|
-
// src/components/
|
|
17361
|
+
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
17362
|
+
var import_react27 = require("react");
|
|
17228
17363
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
17364
|
+
var UnsubscribeDialog = () => {
|
|
17365
|
+
const { t: t2 } = useTranslation();
|
|
17366
|
+
const theme = nt();
|
|
17367
|
+
const { data, setSelected } = useEmbed();
|
|
17368
|
+
const [error, setError] = (0, import_react27.useState)();
|
|
17369
|
+
const [isLoading, setIsLoading] = (0, import_react27.useState)(false);
|
|
17370
|
+
const planPeriod = (0, import_react27.useMemo)(
|
|
17371
|
+
() => data.company?.plan?.planPeriod ?? "month",
|
|
17372
|
+
[data.company?.plan?.planPeriod]
|
|
17373
|
+
);
|
|
17374
|
+
const { setLayout } = useEmbed();
|
|
17375
|
+
const currentPlan = (0, import_react27.useMemo)(
|
|
17376
|
+
() => ({
|
|
17377
|
+
...data.company?.plan,
|
|
17378
|
+
monthlyPrice: { price: data.company?.plan?.planPrice },
|
|
17379
|
+
yearlyPrice: { price: data.company?.plan?.planPrice }
|
|
17380
|
+
}),
|
|
17381
|
+
[data.company?.plan]
|
|
17382
|
+
);
|
|
17383
|
+
const currentAddOns = (0, import_react27.useMemo)(
|
|
17384
|
+
() => data.company?.addOns || [],
|
|
17385
|
+
[data.company?.addOns]
|
|
17386
|
+
);
|
|
17387
|
+
const addOns = (0, import_react27.useMemo)(
|
|
17388
|
+
() => currentAddOns.map((addOn) => ({
|
|
17389
|
+
...addOn,
|
|
17390
|
+
isSelected: true,
|
|
17391
|
+
monthlyPrice: {
|
|
17392
|
+
price: addOn.planPrice
|
|
17393
|
+
},
|
|
17394
|
+
yearlyPrice: {
|
|
17395
|
+
price: addOn.planPrice
|
|
17396
|
+
}
|
|
17397
|
+
})),
|
|
17398
|
+
[currentAddOns]
|
|
17399
|
+
);
|
|
17400
|
+
const currentUsageBasedEntitlements = (0, import_react27.useMemo)(
|
|
17401
|
+
() => data.activeUsageBasedEntitlements.reduce(
|
|
17402
|
+
(acc, usageData) => {
|
|
17403
|
+
const featureUsage = data.featureUsage?.features.find(
|
|
17404
|
+
(usage2) => usage2.feature?.id === usageData.featureId
|
|
17405
|
+
);
|
|
17406
|
+
const allocation = featureUsage?.allocation ?? 0;
|
|
17407
|
+
const usage = featureUsage?.usage ?? 0;
|
|
17408
|
+
acc.push({
|
|
17409
|
+
entitlement: {
|
|
17410
|
+
...usageData,
|
|
17411
|
+
id: featureUsage?.entitlementId ?? usageData.featureId,
|
|
17412
|
+
feature: featureUsage?.feature,
|
|
17413
|
+
meteredMonthlyPrice: usageData.meteredPrice,
|
|
17414
|
+
meteredYearlyPrice: usageData.meteredPrice
|
|
17415
|
+
},
|
|
17416
|
+
usageData,
|
|
17417
|
+
allocation,
|
|
17418
|
+
quantity: allocation ?? usage,
|
|
17419
|
+
usage
|
|
17420
|
+
});
|
|
17421
|
+
return acc;
|
|
17422
|
+
},
|
|
17423
|
+
[]
|
|
17424
|
+
),
|
|
17425
|
+
[data.activeUsageBasedEntitlements, data.featureUsage?.features]
|
|
17426
|
+
);
|
|
17427
|
+
const cancelDate = new Date(
|
|
17428
|
+
data.subscription?.cancelAt || data.upcomingInvoice?.dueDate || Date.now()
|
|
17429
|
+
);
|
|
17430
|
+
const isLightBackground = useIsLightBackground();
|
|
17431
|
+
const handleClose = (0, import_react27.useCallback)(() => {
|
|
17432
|
+
setLayout("portal");
|
|
17433
|
+
}, [setLayout]);
|
|
17434
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Modal, { id: "unsubscribe-dialog", size: "auto", children: [
|
|
17435
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17436
|
+
Box,
|
|
17437
|
+
{
|
|
17438
|
+
$display: "inline-flex",
|
|
17439
|
+
$position: "absolute",
|
|
17440
|
+
$top: 0,
|
|
17441
|
+
$right: 0,
|
|
17442
|
+
$zIndex: 1,
|
|
17443
|
+
$cursor: "pointer",
|
|
17444
|
+
onClick: handleClose,
|
|
17445
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17446
|
+
Icon2,
|
|
17447
|
+
{
|
|
17448
|
+
name: "close",
|
|
17449
|
+
style: {
|
|
17450
|
+
fontSize: 36,
|
|
17451
|
+
color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
|
|
17452
|
+
}
|
|
17453
|
+
}
|
|
17454
|
+
)
|
|
17455
|
+
}
|
|
17456
|
+
),
|
|
17457
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
17458
|
+
Flex,
|
|
17459
|
+
{
|
|
17460
|
+
$position: "relative",
|
|
17461
|
+
$flexDirection: "column",
|
|
17462
|
+
$height: "auto",
|
|
17463
|
+
$viewport: {
|
|
17464
|
+
md: {
|
|
17465
|
+
$flexDirection: "row",
|
|
17466
|
+
$height: "calc(100% - 5rem)"
|
|
17467
|
+
}
|
|
17468
|
+
},
|
|
17469
|
+
children: [
|
|
17470
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
17471
|
+
Flex,
|
|
17472
|
+
{
|
|
17473
|
+
$flexDirection: "column",
|
|
17474
|
+
$flexWrap: "wrap",
|
|
17475
|
+
$justifyContent: "space-around",
|
|
17476
|
+
$gap: "5rem",
|
|
17477
|
+
$padding: "2.5rem",
|
|
17478
|
+
children: [
|
|
17479
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
|
|
17480
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17481
|
+
Text,
|
|
17482
|
+
{
|
|
17483
|
+
as: "h2",
|
|
17484
|
+
$font: theme.typography.heading2.fontFamily,
|
|
17485
|
+
$size: theme.typography.heading2.fontSize,
|
|
17486
|
+
$weight: theme.typography.heading2.fontWeight,
|
|
17487
|
+
$color: theme.typography.heading2.color,
|
|
17488
|
+
children: t2("Cancel subscription")
|
|
17489
|
+
}
|
|
17490
|
+
),
|
|
17491
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
17492
|
+
Text,
|
|
17493
|
+
{
|
|
17494
|
+
as: "p",
|
|
17495
|
+
$font: theme.typography.text.fontFamily,
|
|
17496
|
+
$size: theme.typography.text.fontSize,
|
|
17497
|
+
$weight: theme.typography.text.fontWeight,
|
|
17498
|
+
$color: theme.typography.text.color,
|
|
17499
|
+
children: [
|
|
17500
|
+
t2(
|
|
17501
|
+
"You will retain access to your plan until the end of the billing period, on"
|
|
17502
|
+
),
|
|
17503
|
+
" ",
|
|
17504
|
+
cancelDate ? toPrettyDate(cancelDate, {
|
|
17505
|
+
month: "numeric"
|
|
17506
|
+
}) : ""
|
|
17507
|
+
]
|
|
17508
|
+
}
|
|
17509
|
+
)
|
|
17510
|
+
] }),
|
|
17511
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
|
|
17512
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17513
|
+
Text,
|
|
17514
|
+
{
|
|
17515
|
+
as: "p",
|
|
17516
|
+
$font: theme.typography.text.fontFamily,
|
|
17517
|
+
$size: theme.typography.text.fontSize,
|
|
17518
|
+
$weight: theme.typography.text.fontWeight,
|
|
17519
|
+
$color: theme.typography.text.color,
|
|
17520
|
+
children: t2("Not ready to cancel?")
|
|
17521
|
+
}
|
|
17522
|
+
),
|
|
17523
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17524
|
+
EmbedButton,
|
|
17525
|
+
{
|
|
17526
|
+
onClick: () => {
|
|
17527
|
+
setSelected({
|
|
17528
|
+
planId: currentPlan?.id,
|
|
17529
|
+
addOnId: void 0,
|
|
17530
|
+
usage: false
|
|
17531
|
+
});
|
|
17532
|
+
setLayout("checkout");
|
|
17533
|
+
},
|
|
17534
|
+
$size: "sm",
|
|
17535
|
+
$color: "secondary",
|
|
17536
|
+
$variant: "ghost",
|
|
17537
|
+
$fullWidth: false,
|
|
17538
|
+
children: t2("Manage plan")
|
|
17539
|
+
}
|
|
17540
|
+
)
|
|
17541
|
+
] })
|
|
17542
|
+
]
|
|
17543
|
+
}
|
|
17544
|
+
),
|
|
17545
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
17546
|
+
Sidebar,
|
|
17547
|
+
{
|
|
17548
|
+
addOns,
|
|
17549
|
+
checkoutStage: "checkout",
|
|
17550
|
+
checkoutStages: [],
|
|
17551
|
+
currentAddOns,
|
|
17552
|
+
currentUsageBasedEntitlements,
|
|
17553
|
+
error,
|
|
17554
|
+
currentPlan,
|
|
17555
|
+
isLoading,
|
|
17556
|
+
planPeriod,
|
|
17557
|
+
requiresPayment: false,
|
|
17558
|
+
setCheckoutStage: () => {
|
|
17559
|
+
},
|
|
17560
|
+
setError: (msg) => setError(msg),
|
|
17561
|
+
showPaymentForm: false,
|
|
17562
|
+
toggleLoading: () => setIsLoading((prev2) => !prev2),
|
|
17563
|
+
updatePromoCode: () => {
|
|
17564
|
+
},
|
|
17565
|
+
usageBasedEntitlements: currentUsageBasedEntitlements,
|
|
17566
|
+
showHeader: false
|
|
17567
|
+
}
|
|
17568
|
+
)
|
|
17569
|
+
]
|
|
17570
|
+
}
|
|
17571
|
+
)
|
|
17572
|
+
] });
|
|
17573
|
+
};
|
|
17574
|
+
|
|
17575
|
+
// src/components/ui/badge/Badge.tsx
|
|
17576
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
17229
17577
|
var Badge = () => {
|
|
17230
17578
|
const { t: t2 } = useTranslation();
|
|
17231
17579
|
const { settings } = useEmbed();
|
|
17232
|
-
return /* @__PURE__ */ (0,
|
|
17580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
17233
17581
|
Flex,
|
|
17234
17582
|
{
|
|
17235
17583
|
$justifyContent: settings.badge?.alignment || "start",
|
|
17236
17584
|
$alignItems: "center",
|
|
17237
17585
|
$gridColumn: "1 / -1",
|
|
17238
17586
|
children: [
|
|
17239
|
-
/* @__PURE__ */ (0,
|
|
17240
|
-
/* @__PURE__ */ (0,
|
|
17587
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: t2("Powered by") }),
|
|
17588
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
17241
17589
|
"svg",
|
|
17242
17590
|
{
|
|
17243
17591
|
width: 86,
|
|
@@ -17245,77 +17593,77 @@ var Badge = () => {
|
|
|
17245
17593
|
viewBox: "0 0 86 16",
|
|
17246
17594
|
style: { marginTop: "0.125rem" },
|
|
17247
17595
|
children: [
|
|
17248
|
-
/* @__PURE__ */ (0,
|
|
17596
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17249
17597
|
"path",
|
|
17250
17598
|
{
|
|
17251
17599
|
d: "M21.2354 6.16227C21.1796 5.95015 21.0494 5.76779 20.8261 5.61893C20.6028 5.46635 20.3423 5.39564 20.0408 5.39564C19.3151 5.39564 18.7941 5.69708 18.7941 6.2367C18.7941 6.49721 18.9095 6.69073 19.1402 6.81726C19.3635 6.94379 19.732 7.07033 20.2344 7.18569C21.0084 7.37177 21.4922 7.51691 21.9686 7.7402C22.203 7.85557 22.3928 7.97465 22.5305 8.10863C22.7948 8.3803 22.9548 8.74501 22.9362 9.20276C22.9176 9.86147 22.6571 10.375 22.1547 10.7397C21.6523 11.1082 20.9563 11.2905 20.0818 11.2905C19.2072 11.2905 18.5597 11.1268 18.0312 10.8067C17.5065 10.4867 17.2013 10.0215 17.1194 9.41116L18.6192 9.27719C18.6974 9.57491 18.8723 9.7982 19.1514 9.94706C19.4305 10.0959 19.7394 10.1778 20.0818 10.1778C20.4614 10.1778 20.7777 10.0996 21.0308 9.9359C21.2838 9.77959 21.4104 9.56002 21.4104 9.28835C21.4104 8.90876 21.0531 8.61104 20.5991 8.43613C20.3683 8.35053 20.0855 8.27238 19.7468 8.19423C19.2705 8.07886 18.8946 7.97094 18.6155 7.87418C18.3364 7.78486 18.0908 7.66205 17.8712 7.51319C17.4358 7.21547 17.2832 6.8247 17.2832 6.2367C17.2832 5.61521 17.5325 5.13141 18.0312 4.79648C18.5262 4.46526 19.2035 4.29407 20.0669 4.29407C21.5853 4.29407 22.5752 4.9044 22.7389 6.05807L21.228 6.16227H21.2354Z",
|
|
17252
17600
|
fill: "currentColor"
|
|
17253
17601
|
}
|
|
17254
17602
|
),
|
|
17255
|
-
/* @__PURE__ */ (0,
|
|
17603
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17256
17604
|
"path",
|
|
17257
17605
|
{
|
|
17258
17606
|
d: "M29.4145 8.9796L30.7803 9.55271C30.49 10.0923 30.0621 10.5129 29.5001 10.8217C28.9382 11.1344 28.3167 11.2944 27.6319 11.2944C26.9472 11.2944 26.3629 11.1567 25.8121 10.8701C25.2613 10.5873 24.8147 10.1742 24.4835 9.6383C24.1523 9.09868 23.9811 8.48835 23.9811 7.79987C23.9811 7.11138 24.1486 6.49361 24.4835 5.95771C24.8147 5.41809 25.2613 5.00873 25.8121 4.72589C26.3629 4.44305 26.9732 4.30164 27.6319 4.30164C28.2906 4.30164 28.9382 4.45794 29.5038 4.77427C30.0658 5.08688 30.4938 5.51113 30.7803 6.05075L29.4145 6.62015C29.0535 5.93539 28.3985 5.56323 27.6319 5.56323C27.0327 5.56323 26.5303 5.77536 26.1135 6.19961C25.6967 6.62387 25.492 7.15977 25.492 7.80731C25.492 8.45486 25.6967 8.99076 26.1135 9.40757C26.5303 9.83182 27.0327 10.0439 27.6319 10.0439C28.3985 10.0439 29.0535 9.66807 29.4145 8.98703V8.9796Z",
|
|
17259
17607
|
fill: "currentColor"
|
|
17260
17608
|
}
|
|
17261
17609
|
),
|
|
17262
|
-
/* @__PURE__ */ (0,
|
|
17610
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17263
17611
|
"path",
|
|
17264
17612
|
{
|
|
17265
17613
|
d: "M37.4386 11.2049V7.80341C37.4386 6.35945 36.9139 5.59282 35.697 5.59282C35.0978 5.59282 34.614 5.7975 34.2419 6.21059C33.8623 6.61996 33.6725 7.15214 33.6725 7.80713V11.2086H32.1615V1.9234H33.6725V5.47745C34.1004 4.73315 35.001 4.29773 36.1919 4.29773C37.167 4.29773 37.8666 4.59917 38.302 5.19834C38.7375 5.7975 38.9533 6.66834 38.9533 7.80341V11.2049H37.4349H37.4386Z",
|
|
17266
17614
|
fill: "currentColor"
|
|
17267
17615
|
}
|
|
17268
17616
|
),
|
|
17269
|
-
/* @__PURE__ */ (0,
|
|
17617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17270
17618
|
"path",
|
|
17271
17619
|
{
|
|
17272
17620
|
d: "M46.5692 5.38819C47.2167 6.07295 47.5777 7.1187 47.5107 8.30587H41.8242C41.9284 8.83805 42.1741 9.26602 42.5611 9.59352C42.9481 9.92473 43.4022 10.0885 43.9157 10.0885C44.8052 10.0885 45.5234 9.59724 45.8844 8.78222L47.1795 9.40372C46.8818 9.99172 46.4352 10.4495 45.8509 10.7881C45.2629 11.1268 44.6191 11.2943 43.9157 11.2943C42.9295 11.2943 42.0178 10.9444 41.3516 10.3453C40.6855 9.7461 40.2649 8.83432 40.2649 7.79602C40.2649 6.75771 40.6892 5.84222 41.3516 5.23933C42.0178 4.64017 42.9295 4.29034 43.9157 4.29034C44.9801 4.29034 45.9216 4.69971 46.5692 5.38447V5.38819ZM42.5388 6.00224C42.1592 6.32974 41.921 6.75772 41.8205 7.29734H46.0221C45.9179 6.75772 45.6835 6.3223 45.3039 5.99852C44.9243 5.67847 44.4628 5.51473 43.9195 5.51473C43.3761 5.51473 42.9221 5.67847 42.5425 6.00597L42.5388 6.00224Z",
|
|
17273
17621
|
fill: "currentColor"
|
|
17274
17622
|
}
|
|
17275
17623
|
),
|
|
17276
|
-
/* @__PURE__ */ (0,
|
|
17624
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17277
17625
|
"path",
|
|
17278
17626
|
{
|
|
17279
17627
|
d: "M59.7699 5.23933C60.1495 5.86827 60.3132 6.68329 60.3132 7.80347V11.2049H58.8023V7.80347C58.8023 6.35952 58.3371 5.59288 57.2318 5.59288C56.6438 5.59288 56.1861 5.79384 55.8586 6.19577C55.5311 6.60141 55.3673 7.13731 55.3673 7.80347V11.2049H53.8489V7.80347C53.8489 6.35952 53.3838 5.59288 52.2785 5.59288C51.6905 5.59288 51.2327 5.79384 50.9052 6.19577C50.574 6.60141 50.4102 7.13731 50.4102 7.80347V11.2049H48.8993V4.39827H50.3433L50.4102 5.47379C50.8196 4.65878 51.5825 4.29407 52.8106 4.29407C53.9606 4.29407 54.7161 4.78531 55.077 5.76407C55.5199 4.81508 56.4428 4.29407 57.7677 4.29407C58.7093 4.29407 59.3829 4.61412 59.7699 5.23562V5.23933Z",
|
|
17280
17628
|
fill: "currentColor"
|
|
17281
17629
|
}
|
|
17282
17630
|
),
|
|
17283
|
-
/* @__PURE__ */ (0,
|
|
17631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17284
17632
|
"path",
|
|
17285
17633
|
{
|
|
17286
17634
|
d: "M67.4264 5.47382L67.4934 4.3983H68.9373V11.205H67.4934L67.4264 10.1294C67.0282 10.9147 66.1797 11.3092 64.8809 11.3017C63.102 11.3427 61.591 9.79823 61.6283 7.8035C61.591 5.8162 63.102 4.2606 64.8809 4.29782C66.0643 4.29782 67.0096 4.7444 67.4264 5.47754V5.47382ZM66.8049 9.37398C67.2217 8.95717 67.4264 8.43243 67.4264 7.79605C67.4264 7.15967 67.2217 6.64238 66.8049 6.21813C66.3881 5.80132 65.8782 5.58919 65.2828 5.58919C64.6874 5.58919 64.1887 5.80132 63.7719 6.21813C63.355 6.64238 63.1504 7.16711 63.1504 7.79605C63.1504 8.42499 63.355 8.95717 63.7719 9.37398C64.1887 9.79823 64.6911 10.0104 65.2828 10.0104C65.8745 10.0104 66.3881 9.79823 66.8049 9.37398Z",
|
|
17287
17635
|
fill: "currentColor"
|
|
17288
17636
|
}
|
|
17289
17637
|
),
|
|
17290
|
-
/* @__PURE__ */ (0,
|
|
17638
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17291
17639
|
"path",
|
|
17292
17640
|
{
|
|
17293
17641
|
d: "M71.3891 2.85757H72.8926V4.39828H74.6455V5.58172H72.8926V8.9683C72.8926 9.5898 73.1048 9.90985 73.5923 9.96568C73.89 10.0252 74.2398 10.0141 74.6455 9.9359V11.1863C74.1989 11.257 73.7858 11.2943 73.4062 11.2943C72.6731 11.2943 72.1595 11.1082 71.8543 10.7323C71.5454 10.3639 71.3891 9.79076 71.3891 9.02041V5.58172H70.4215V4.39828H71.3891V2.85757Z",
|
|
17294
17642
|
fill: "currentColor"
|
|
17295
17643
|
}
|
|
17296
17644
|
),
|
|
17297
|
-
/* @__PURE__ */ (0,
|
|
17645
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17298
17646
|
"path",
|
|
17299
17647
|
{
|
|
17300
17648
|
d: "M76.1747 3.15526C75.9923 2.98035 75.903 2.76078 75.903 2.50772C75.903 2.25466 75.9923 2.04997 76.1747 1.86762C76.3496 1.69271 76.5691 1.60339 76.8222 1.60339C77.0753 1.60339 77.2874 1.69271 77.4623 1.86762C77.6372 2.04997 77.7265 2.2621 77.7265 2.50772C77.7265 2.75334 77.6372 2.97291 77.4623 3.15526C77.2874 3.33762 77.0678 3.42694 76.8222 3.42694C76.5766 3.42694 76.3496 3.33762 76.1747 3.15526ZM76.0593 4.39826H77.5777V11.2049H76.0593V4.39826Z",
|
|
17301
17649
|
fill: "currentColor"
|
|
17302
17650
|
}
|
|
17303
17651
|
),
|
|
17304
|
-
/* @__PURE__ */ (0,
|
|
17652
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17305
17653
|
"path",
|
|
17306
17654
|
{
|
|
17307
17655
|
d: "M84.3023 8.9796L85.6681 9.55271C85.3778 10.0923 84.9498 10.5129 84.3879 10.8217C83.8259 11.1344 83.2044 11.2944 82.5197 11.2944C81.8349 11.2944 81.2506 11.1567 80.6998 10.8701C80.1491 10.5873 79.7025 10.1742 79.3713 9.6383C79.04 9.09868 78.8689 8.48835 78.8689 7.79987C78.8689 7.11138 79.0363 6.49361 79.3713 5.95771C79.7025 5.41809 80.1528 5.00873 80.6998 4.72589C81.2469 4.44305 81.8609 4.30164 82.5197 4.30164C83.1784 4.30164 83.8259 4.45794 84.3916 4.77427C84.9535 5.08688 85.3815 5.51113 85.6681 6.05075L84.3023 6.62015C83.9413 5.93539 83.2863 5.56323 82.5197 5.56323C81.9205 5.56323 81.4181 5.77536 81.0013 6.19961C80.5845 6.62387 80.3798 7.15977 80.3798 7.80731C80.3798 8.45486 80.5845 8.99076 81.0013 9.40757C81.4181 9.83182 81.9205 10.0439 82.5197 10.0439C83.2863 10.0439 83.9413 9.66807 84.3023 8.98703V8.9796Z",
|
|
17308
17656
|
fill: "currentColor"
|
|
17309
17657
|
}
|
|
17310
17658
|
),
|
|
17311
|
-
/* @__PURE__ */ (0,
|
|
17659
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17312
17660
|
"path",
|
|
17313
17661
|
{
|
|
17314
17662
|
d: "M5.93091 10.8141L7.2758 9.41753L3.83719 5.84667C2.98568 4.9624 2.98568 3.52157 3.83719 2.63731C4.68871 1.75305 6.07617 1.75305 6.92769 2.63731L10.3663 6.20817L11.7112 4.81156L8.27258 1.24069C6.67975 -0.413401 4.08513 -0.413401 2.4923 1.24069C0.899472 2.89479 0.899472 5.58919 2.4923 7.24328L5.93091 10.8141Z",
|
|
17315
17663
|
fill: "currentColor"
|
|
17316
17664
|
}
|
|
17317
17665
|
),
|
|
17318
|
-
/* @__PURE__ */ (0,
|
|
17666
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17319
17667
|
"path",
|
|
17320
17668
|
{
|
|
17321
17669
|
d: "M6.05827 3.54751C5.68761 3.1626 5.08404 3.1626 4.71338 3.54751C4.34272 3.93243 4.34272 4.55921 4.71338 4.94413L9.02103 9.41746L5.93054 12.6268L1.62288 8.15349C1.25223 7.76857 0.648653 7.76857 0.277994 8.15349C-0.0926647 8.5384 -0.0926647 9.16519 0.277994 9.5501L5.93054 15.4201L11.7108 9.41746L6.05827 3.54751Z",
|
|
@@ -17331,11 +17679,11 @@ var Badge = () => {
|
|
|
17331
17679
|
};
|
|
17332
17680
|
|
|
17333
17681
|
// src/components/layout/RenderLayout.tsx
|
|
17334
|
-
var
|
|
17335
|
-
var
|
|
17682
|
+
var import_react28 = require("react");
|
|
17683
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
17336
17684
|
var Disabled = () => {
|
|
17337
17685
|
const theme = nt();
|
|
17338
|
-
return /* @__PURE__ */ (0,
|
|
17686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
17339
17687
|
Element,
|
|
17340
17688
|
{
|
|
17341
17689
|
as: Flex,
|
|
@@ -17344,7 +17692,7 @@ var Disabled = () => {
|
|
|
17344
17692
|
$alignItems: "center",
|
|
17345
17693
|
$whiteSpace: "nowrap",
|
|
17346
17694
|
children: [
|
|
17347
|
-
/* @__PURE__ */ (0,
|
|
17695
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17348
17696
|
Text,
|
|
17349
17697
|
{
|
|
17350
17698
|
as: "h1",
|
|
@@ -17355,7 +17703,7 @@ var Disabled = () => {
|
|
|
17355
17703
|
children: "Portal not found"
|
|
17356
17704
|
}
|
|
17357
17705
|
) }),
|
|
17358
|
-
/* @__PURE__ */ (0,
|
|
17706
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17359
17707
|
Text,
|
|
17360
17708
|
{
|
|
17361
17709
|
as: "p",
|
|
@@ -17373,19 +17721,19 @@ var Disabled = () => {
|
|
|
17373
17721
|
var Success = () => {
|
|
17374
17722
|
const theme = nt();
|
|
17375
17723
|
const { hydrate, data, api, setLayout, isPending } = useEmbed();
|
|
17376
|
-
const [isOpen, setIsOpen] = (0,
|
|
17377
|
-
(0,
|
|
17724
|
+
const [isOpen, setIsOpen] = (0, import_react28.useState)(true);
|
|
17725
|
+
(0, import_react28.useEffect)(() => {
|
|
17378
17726
|
if (api && data.component?.id) {
|
|
17379
17727
|
hydrate();
|
|
17380
17728
|
setTimeout(() => setIsOpen(false), 2e3);
|
|
17381
17729
|
}
|
|
17382
17730
|
}, [api, data.component?.id, hydrate]);
|
|
17383
|
-
(0,
|
|
17731
|
+
(0, import_react28.useEffect)(() => {
|
|
17384
17732
|
if (!isPending && !isOpen) {
|
|
17385
17733
|
setLayout("portal");
|
|
17386
17734
|
}
|
|
17387
17735
|
}, [isPending, isOpen, setLayout]);
|
|
17388
|
-
return /* @__PURE__ */ (0,
|
|
17736
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
17389
17737
|
Element,
|
|
17390
17738
|
{
|
|
17391
17739
|
as: Flex,
|
|
@@ -17394,7 +17742,7 @@ var Success = () => {
|
|
|
17394
17742
|
$alignItems: "center",
|
|
17395
17743
|
$whiteSpace: "nowrap",
|
|
17396
17744
|
children: [
|
|
17397
|
-
/* @__PURE__ */ (0,
|
|
17745
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17398
17746
|
IconRound,
|
|
17399
17747
|
{
|
|
17400
17748
|
name: "check",
|
|
@@ -17402,7 +17750,7 @@ var Success = () => {
|
|
|
17402
17750
|
colors: [theme.card.background, theme.primary]
|
|
17403
17751
|
}
|
|
17404
17752
|
) }),
|
|
17405
|
-
/* @__PURE__ */ (0,
|
|
17753
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17406
17754
|
Text,
|
|
17407
17755
|
{
|
|
17408
17756
|
as: "h1",
|
|
@@ -17413,7 +17761,7 @@ var Success = () => {
|
|
|
17413
17761
|
children: "Subscription updated!"
|
|
17414
17762
|
}
|
|
17415
17763
|
) }),
|
|
17416
|
-
/* @__PURE__ */ (0,
|
|
17764
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17417
17765
|
Text,
|
|
17418
17766
|
{
|
|
17419
17767
|
as: "p",
|
|
@@ -17432,9 +17780,9 @@ var RenderLayout = ({ children }) => {
|
|
|
17432
17780
|
const { layout } = useEmbed();
|
|
17433
17781
|
switch (layout) {
|
|
17434
17782
|
case "disabled":
|
|
17435
|
-
return /* @__PURE__ */ (0,
|
|
17783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Disabled, {});
|
|
17436
17784
|
case "success":
|
|
17437
|
-
return /* @__PURE__ */ (0,
|
|
17785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Success, {});
|
|
17438
17786
|
default:
|
|
17439
17787
|
return children;
|
|
17440
17788
|
}
|
|
@@ -17459,14 +17807,14 @@ var StyledViewport = dt(Box).attrs(({ theme }) => ({
|
|
|
17459
17807
|
`;
|
|
17460
17808
|
|
|
17461
17809
|
// src/components/layout/viewport/Viewport.tsx
|
|
17462
|
-
var
|
|
17463
|
-
var Viewport = (0,
|
|
17810
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
17811
|
+
var Viewport = (0, import_react29.forwardRef)(
|
|
17464
17812
|
({ children, portal, ...props }, ref) => {
|
|
17465
17813
|
const { data, layout } = useEmbed();
|
|
17466
|
-
const [top, setTop] = (0,
|
|
17814
|
+
const [top, setTop] = (0, import_react29.useState)(0);
|
|
17467
17815
|
const canCheckout = data.capabilities?.checkout ?? true;
|
|
17468
|
-
(0,
|
|
17469
|
-
if (layout !== "checkout") {
|
|
17816
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
17817
|
+
if (layout !== "checkout" && layout !== "unsubscribe") {
|
|
17470
17818
|
return;
|
|
17471
17819
|
}
|
|
17472
17820
|
const parent = portal || document.body;
|
|
@@ -17479,22 +17827,23 @@ var Viewport = (0, import_react28.forwardRef)(
|
|
|
17479
17827
|
parent.style.overflow = "";
|
|
17480
17828
|
};
|
|
17481
17829
|
}, [layout, portal]);
|
|
17482
|
-
return /* @__PURE__ */ (0,
|
|
17483
|
-
/* @__PURE__ */ (0,
|
|
17484
|
-
/* @__PURE__ */ (0,
|
|
17485
|
-
/* @__PURE__ */ (0,
|
|
17830
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
|
|
17831
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(StyledViewport, { ref, ...props, children: [
|
|
17832
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RenderLayout, { children }),
|
|
17833
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge, {})
|
|
17486
17834
|
] }),
|
|
17487
|
-
canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0,
|
|
17835
|
+
canCheckout && layout === "checkout" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CheckoutDialog, { top }), portal || document.body),
|
|
17836
|
+
layout === "unsubscribe" && (0, import_react_dom2.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(UnsubscribeDialog, {}), portal || document.body)
|
|
17488
17837
|
] });
|
|
17489
17838
|
}
|
|
17490
17839
|
);
|
|
17491
17840
|
Viewport.displayName = "Viewport";
|
|
17492
17841
|
|
|
17493
17842
|
// src/components/layout/column/Column.tsx
|
|
17494
|
-
var
|
|
17843
|
+
var import_react31 = require("react");
|
|
17495
17844
|
|
|
17496
17845
|
// src/components/layout/card/Card.tsx
|
|
17497
|
-
var
|
|
17846
|
+
var import_react30 = require("react");
|
|
17498
17847
|
|
|
17499
17848
|
// src/components/layout/card/styles.ts
|
|
17500
17849
|
var Element = dt(Box)``;
|
|
@@ -17537,10 +17886,10 @@ var StyledCard = dt.div(({ theme }) => {
|
|
|
17537
17886
|
});
|
|
17538
17887
|
|
|
17539
17888
|
// src/components/layout/card/Card.tsx
|
|
17540
|
-
var
|
|
17541
|
-
var Card = (0,
|
|
17889
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
17890
|
+
var Card = (0, import_react30.forwardRef)(
|
|
17542
17891
|
({ children, className }, ref) => {
|
|
17543
|
-
return /* @__PURE__ */ (0,
|
|
17892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledCard, { ref, className, children });
|
|
17544
17893
|
}
|
|
17545
17894
|
);
|
|
17546
17895
|
Card.displayName = "Card";
|
|
@@ -17551,18 +17900,18 @@ var StyledColumn = dt.div`
|
|
|
17551
17900
|
`;
|
|
17552
17901
|
|
|
17553
17902
|
// src/components/layout/column/Column.tsx
|
|
17554
|
-
var
|
|
17555
|
-
var Column = (0,
|
|
17903
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
17904
|
+
var Column = (0, import_react31.forwardRef)(
|
|
17556
17905
|
({ children, basis, ...props }, ref) => {
|
|
17557
|
-
return /* @__PURE__ */ (0,
|
|
17906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Card, { children }) });
|
|
17558
17907
|
}
|
|
17559
17908
|
);
|
|
17560
17909
|
Column.displayName = "Column";
|
|
17561
17910
|
|
|
17562
17911
|
// src/components/elements/included-features/Details.tsx
|
|
17563
|
-
var
|
|
17912
|
+
var import_react32 = require("react");
|
|
17564
17913
|
var import_pluralize4 = __toESM(require_pluralize());
|
|
17565
|
-
var
|
|
17914
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
17566
17915
|
var Details = ({
|
|
17567
17916
|
details,
|
|
17568
17917
|
shouldWrapChildren,
|
|
@@ -17580,7 +17929,7 @@ var Details = ({
|
|
|
17580
17929
|
const { t: t2 } = useTranslation();
|
|
17581
17930
|
const theme = nt();
|
|
17582
17931
|
const { data } = useEmbed();
|
|
17583
|
-
const currency = (0,
|
|
17932
|
+
const currency = (0, import_react32.useMemo)(() => {
|
|
17584
17933
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17585
17934
|
return monthlyUsageBasedPrice?.currency;
|
|
17586
17935
|
}
|
|
@@ -17592,7 +17941,7 @@ var Details = ({
|
|
|
17592
17941
|
monthlyUsageBasedPrice,
|
|
17593
17942
|
yearlyUsageBasedPrice
|
|
17594
17943
|
]);
|
|
17595
|
-
const price = (0,
|
|
17944
|
+
const price = (0, import_react32.useMemo)(() => {
|
|
17596
17945
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17597
17946
|
return monthlyUsageBasedPrice?.price;
|
|
17598
17947
|
}
|
|
@@ -17604,7 +17953,7 @@ var Details = ({
|
|
|
17604
17953
|
monthlyUsageBasedPrice,
|
|
17605
17954
|
yearlyUsageBasedPrice
|
|
17606
17955
|
]);
|
|
17607
|
-
const text = (0,
|
|
17956
|
+
const text = (0, import_react32.useMemo)(() => {
|
|
17608
17957
|
if (!feature?.name) {
|
|
17609
17958
|
return;
|
|
17610
17959
|
}
|
|
@@ -17621,7 +17970,7 @@ var Details = ({
|
|
|
17621
17970
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17622
17971
|
}
|
|
17623
17972
|
}, [allocation, feature?.name, price, priceBehavior, t2, currency]);
|
|
17624
|
-
const usageText = (0,
|
|
17973
|
+
const usageText = (0, import_react32.useMemo)(() => {
|
|
17625
17974
|
if (!feature?.name) {
|
|
17626
17975
|
return;
|
|
17627
17976
|
}
|
|
@@ -17663,14 +18012,14 @@ var Details = ({
|
|
|
17663
18012
|
if (!text) {
|
|
17664
18013
|
return null;
|
|
17665
18014
|
}
|
|
17666
|
-
return /* @__PURE__ */ (0,
|
|
18015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
17667
18016
|
Box,
|
|
17668
18017
|
{
|
|
17669
18018
|
$flexBasis: "min-content",
|
|
17670
18019
|
$flexGrow: "1",
|
|
17671
18020
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
17672
18021
|
children: [
|
|
17673
|
-
props.entitlement.isVisible && /* @__PURE__ */ (0,
|
|
18022
|
+
props.entitlement.isVisible && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
17674
18023
|
Text,
|
|
17675
18024
|
{
|
|
17676
18025
|
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
@@ -17681,7 +18030,7 @@ var Details = ({
|
|
|
17681
18030
|
children: text
|
|
17682
18031
|
}
|
|
17683
18032
|
) }),
|
|
17684
|
-
props.usage.isVisible && usageText && /* @__PURE__ */ (0,
|
|
18033
|
+
props.usage.isVisible && usageText && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
17685
18034
|
Text,
|
|
17686
18035
|
{
|
|
17687
18036
|
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
@@ -17698,7 +18047,7 @@ var Details = ({
|
|
|
17698
18047
|
};
|
|
17699
18048
|
|
|
17700
18049
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
17701
|
-
var
|
|
18050
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
17702
18051
|
function resolveDesignProps(props) {
|
|
17703
18052
|
return {
|
|
17704
18053
|
header: {
|
|
@@ -17727,15 +18076,15 @@ function resolveDesignProps(props) {
|
|
|
17727
18076
|
visibleFeatures: props.visibleFeatures
|
|
17728
18077
|
};
|
|
17729
18078
|
}
|
|
17730
|
-
var IncludedFeatures = (0,
|
|
18079
|
+
var IncludedFeatures = (0, import_react33.forwardRef)(({ className, ...rest }, ref) => {
|
|
17731
18080
|
const props = resolveDesignProps(rest);
|
|
17732
18081
|
const { t: t2 } = useTranslation();
|
|
17733
18082
|
const theme = nt();
|
|
17734
18083
|
const { data } = useEmbed();
|
|
17735
|
-
const elements = (0,
|
|
18084
|
+
const elements = (0, import_react33.useRef)([]);
|
|
17736
18085
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
17737
18086
|
const isLightBackground = useIsLightBackground();
|
|
17738
|
-
const [showCount, setShowCount] = (0,
|
|
18087
|
+
const [showCount, setShowCount] = (0, import_react33.useState)(VISIBLE_ENTITLEMENT_COUNT);
|
|
17739
18088
|
const entitlements = (props.visibleFeatures ? props.visibleFeatures : data.featureUsage?.features.sort((a2, b2) => {
|
|
17740
18089
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
17741
18090
|
return 1;
|
|
@@ -17779,7 +18128,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17779
18128
|
}
|
|
17780
18129
|
const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
|
|
17781
18130
|
const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
|
|
17782
|
-
return /* @__PURE__ */ (0,
|
|
18131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17783
18132
|
Element,
|
|
17784
18133
|
{
|
|
17785
18134
|
as: Flex,
|
|
@@ -17788,7 +18137,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17788
18137
|
$flexDirection: "column",
|
|
17789
18138
|
$gap: "1rem",
|
|
17790
18139
|
children: [
|
|
17791
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18140
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17792
18141
|
Text,
|
|
17793
18142
|
{
|
|
17794
18143
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -17801,7 +18150,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17801
18150
|
entitlements.slice(0, showCount).map((entitlement, index) => {
|
|
17802
18151
|
const { entitlementExpirationDate, feature } = entitlement.featureUsage || {};
|
|
17803
18152
|
const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
|
|
17804
|
-
return /* @__PURE__ */ (0,
|
|
18153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17805
18154
|
Flex,
|
|
17806
18155
|
{
|
|
17807
18156
|
ref: (el) => {
|
|
@@ -17814,7 +18163,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17814
18163
|
$alignItems: "center",
|
|
17815
18164
|
$gap: "1rem",
|
|
17816
18165
|
children: [
|
|
17817
|
-
/* @__PURE__ */ (0,
|
|
18166
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17818
18167
|
Flex,
|
|
17819
18168
|
{
|
|
17820
18169
|
$alignItems: "center",
|
|
@@ -17822,7 +18171,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17822
18171
|
$flexBasis: "min-content",
|
|
17823
18172
|
$gap: "1rem",
|
|
17824
18173
|
children: [
|
|
17825
|
-
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
18174
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17826
18175
|
IconRound,
|
|
17827
18176
|
{
|
|
17828
18177
|
name: feature.icon,
|
|
@@ -17833,7 +18182,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17833
18182
|
]
|
|
17834
18183
|
}
|
|
17835
18184
|
),
|
|
17836
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18185
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17837
18186
|
Text,
|
|
17838
18187
|
{
|
|
17839
18188
|
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
@@ -17843,7 +18192,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17843
18192
|
children: feature.name
|
|
17844
18193
|
}
|
|
17845
18194
|
),
|
|
17846
|
-
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ (0,
|
|
18195
|
+
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17847
18196
|
Text,
|
|
17848
18197
|
{
|
|
17849
18198
|
$font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
|
|
@@ -17863,7 +18212,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17863
18212
|
]
|
|
17864
18213
|
}
|
|
17865
18214
|
),
|
|
17866
|
-
shouldShowDetails && /* @__PURE__ */ (0,
|
|
18215
|
+
shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17867
18216
|
Details,
|
|
17868
18217
|
{
|
|
17869
18218
|
details: entitlement,
|
|
@@ -17876,8 +18225,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17876
18225
|
index
|
|
17877
18226
|
);
|
|
17878
18227
|
}),
|
|
17879
|
-
shouldShowExpand && /* @__PURE__ */ (0,
|
|
17880
|
-
/* @__PURE__ */ (0,
|
|
18228
|
+
shouldShowExpand && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
|
|
18229
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17881
18230
|
Icon2,
|
|
17882
18231
|
{
|
|
17883
18232
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -17889,7 +18238,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17889
18238
|
}
|
|
17890
18239
|
}
|
|
17891
18240
|
),
|
|
17892
|
-
/* @__PURE__ */ (0,
|
|
18241
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17893
18242
|
Text,
|
|
17894
18243
|
{
|
|
17895
18244
|
onClick: handleToggleShowAll,
|
|
@@ -17910,8 +18259,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17910
18259
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
17911
18260
|
|
|
17912
18261
|
// src/components/elements/invoices/Invoices.tsx
|
|
17913
|
-
var
|
|
17914
|
-
var
|
|
18262
|
+
var import_react34 = require("react");
|
|
18263
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
17915
18264
|
function resolveDesignProps2(props) {
|
|
17916
18265
|
return {
|
|
17917
18266
|
header: {
|
|
@@ -17947,7 +18296,7 @@ function formatInvoices(invoices) {
|
|
|
17947
18296
|
}
|
|
17948
18297
|
var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
17949
18298
|
const theme = nt();
|
|
17950
|
-
const dateText = /* @__PURE__ */ (0,
|
|
18299
|
+
const dateText = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17951
18300
|
Text,
|
|
17952
18301
|
{
|
|
17953
18302
|
...url && { onClick: () => {
|
|
@@ -17960,23 +18309,23 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
|
17960
18309
|
}
|
|
17961
18310
|
);
|
|
17962
18311
|
if (url) {
|
|
17963
|
-
return /* @__PURE__ */ (0,
|
|
18312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
|
|
17964
18313
|
}
|
|
17965
18314
|
return dateText;
|
|
17966
18315
|
};
|
|
17967
|
-
var Invoices = (0,
|
|
18316
|
+
var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref) => {
|
|
17968
18317
|
const props = resolveDesignProps2(rest);
|
|
17969
18318
|
const { t: t2 } = useTranslation();
|
|
17970
18319
|
const theme = nt();
|
|
17971
18320
|
const { api } = useEmbed();
|
|
17972
|
-
const [invoices, setInvoices] = (0,
|
|
17973
|
-
const [listSize, setListSize] = (0,
|
|
18321
|
+
const [invoices, setInvoices] = (0, import_react34.useState)(() => formatInvoices(data));
|
|
18322
|
+
const [listSize, setListSize] = (0, import_react34.useState)(props.limit.number);
|
|
17974
18323
|
const toggleListSize = () => {
|
|
17975
18324
|
setListSize(
|
|
17976
18325
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
17977
18326
|
);
|
|
17978
18327
|
};
|
|
17979
|
-
(0,
|
|
18328
|
+
(0, import_react34.useEffect)(() => {
|
|
17980
18329
|
api?.listInvoices().then(({ data: data2 }) => {
|
|
17981
18330
|
setInvoices(formatInvoices(data2));
|
|
17982
18331
|
});
|
|
@@ -17984,8 +18333,8 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
17984
18333
|
if (invoices.length === 0) {
|
|
17985
18334
|
return null;
|
|
17986
18335
|
}
|
|
17987
|
-
return /* @__PURE__ */ (0,
|
|
17988
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
18337
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
17989
18338
|
Text,
|
|
17990
18339
|
{
|
|
17991
18340
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -17995,9 +18344,9 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
17995
18344
|
children: t2("Invoices")
|
|
17996
18345
|
}
|
|
17997
18346
|
) }),
|
|
17998
|
-
/* @__PURE__ */ (0,
|
|
17999
|
-
return /* @__PURE__ */ (0,
|
|
18000
|
-
props.date.isVisible && date && /* @__PURE__ */ (0,
|
|
18347
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
|
|
18348
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $justifyContent: "space-between", children: [
|
|
18349
|
+
props.date.isVisible && date && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18001
18350
|
InvoiceDate,
|
|
18002
18351
|
{
|
|
18003
18352
|
date,
|
|
@@ -18005,7 +18354,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18005
18354
|
url
|
|
18006
18355
|
}
|
|
18007
18356
|
),
|
|
18008
|
-
props.amount.isVisible && /* @__PURE__ */ (0,
|
|
18357
|
+
props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18009
18358
|
Text,
|
|
18010
18359
|
{
|
|
18011
18360
|
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
|
@@ -18017,15 +18366,15 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18017
18366
|
)
|
|
18018
18367
|
] }, index);
|
|
18019
18368
|
}) }),
|
|
18020
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0,
|
|
18021
|
-
/* @__PURE__ */ (0,
|
|
18369
|
+
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18370
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18022
18371
|
Icon2,
|
|
18023
18372
|
{
|
|
18024
18373
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
18025
18374
|
style: { color: "#D0D0D0" }
|
|
18026
18375
|
}
|
|
18027
18376
|
),
|
|
18028
|
-
/* @__PURE__ */ (0,
|
|
18377
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18029
18378
|
Text,
|
|
18030
18379
|
{
|
|
18031
18380
|
onClick: toggleListSize,
|
|
@@ -18042,7 +18391,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18042
18391
|
Invoices.displayName = "Invoices";
|
|
18043
18392
|
|
|
18044
18393
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18045
|
-
var
|
|
18394
|
+
var import_react35 = require("react");
|
|
18046
18395
|
var import_pluralize5 = __toESM(require_pluralize());
|
|
18047
18396
|
|
|
18048
18397
|
// src/components/elements/metered-features/styles.ts
|
|
@@ -18063,7 +18412,7 @@ var Container4 = dt(Flex)`
|
|
|
18063
18412
|
`;
|
|
18064
18413
|
|
|
18065
18414
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18066
|
-
var
|
|
18415
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
18067
18416
|
function resolveDesignProps3(props) {
|
|
18068
18417
|
return {
|
|
18069
18418
|
isVisible: props.isVisible ?? true,
|
|
@@ -18089,9 +18438,9 @@ function resolveDesignProps3(props) {
|
|
|
18089
18438
|
visibleFeatures: props.visibleFeatures
|
|
18090
18439
|
};
|
|
18091
18440
|
}
|
|
18092
|
-
var MeteredFeatures = (0,
|
|
18441
|
+
var MeteredFeatures = (0, import_react35.forwardRef)(({ className, ...rest }, ref) => {
|
|
18093
18442
|
const props = resolveDesignProps3(rest);
|
|
18094
|
-
const elements = (0,
|
|
18443
|
+
const elements = (0, import_react35.useRef)([]);
|
|
18095
18444
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18096
18445
|
const { t: t2 } = useTranslation();
|
|
18097
18446
|
const theme = nt();
|
|
@@ -18113,7 +18462,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18113
18462
|
if (!shouldShowFeatures) {
|
|
18114
18463
|
return null;
|
|
18115
18464
|
}
|
|
18116
|
-
return /* @__PURE__ */ (0,
|
|
18465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Container4, { ref, className, children: featureUsage.map(
|
|
18117
18466
|
({
|
|
18118
18467
|
allocation,
|
|
18119
18468
|
feature,
|
|
@@ -18132,8 +18481,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18132
18481
|
price = yearlyUsageBasedPrice?.price;
|
|
18133
18482
|
currency = yearlyUsageBasedPrice?.currency;
|
|
18134
18483
|
}
|
|
18135
|
-
return /* @__PURE__ */ (0,
|
|
18136
|
-
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
18484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
18485
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18137
18486
|
IconRound,
|
|
18138
18487
|
{
|
|
18139
18488
|
name: feature.icon,
|
|
@@ -18144,8 +18493,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18144
18493
|
]
|
|
18145
18494
|
}
|
|
18146
18495
|
),
|
|
18147
|
-
/* @__PURE__ */ (0,
|
|
18148
|
-
/* @__PURE__ */ (0,
|
|
18496
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
|
|
18497
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18149
18498
|
Flex,
|
|
18150
18499
|
{
|
|
18151
18500
|
ref: (el) => {
|
|
@@ -18156,8 +18505,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18156
18505
|
$flexWrap: "wrap",
|
|
18157
18506
|
$gap: "1rem",
|
|
18158
18507
|
children: [
|
|
18159
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18160
|
-
/* @__PURE__ */ (0,
|
|
18508
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
|
|
18509
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18161
18510
|
Text,
|
|
18162
18511
|
{
|
|
18163
18512
|
as: Box,
|
|
@@ -18165,14 +18514,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18165
18514
|
$size: theme.typography[props.header.fontStyle].fontSize,
|
|
18166
18515
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18167
18516
|
$color: theme.typography[props.header.fontStyle].color,
|
|
18168
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0,
|
|
18517
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18169
18518
|
formatNumber(usage),
|
|
18170
18519
|
" ",
|
|
18171
18520
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18172
18521
|
] }) : feature.name
|
|
18173
18522
|
}
|
|
18174
18523
|
),
|
|
18175
|
-
props.description.isVisible && /* @__PURE__ */ (0,
|
|
18524
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18176
18525
|
Text,
|
|
18177
18526
|
{
|
|
18178
18527
|
as: Box,
|
|
@@ -18184,14 +18533,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18184
18533
|
}
|
|
18185
18534
|
)
|
|
18186
18535
|
] }),
|
|
18187
|
-
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0,
|
|
18536
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18188
18537
|
Box,
|
|
18189
18538
|
{
|
|
18190
18539
|
$flexBasis: "min-content",
|
|
18191
18540
|
$flexGrow: "1",
|
|
18192
18541
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18193
18542
|
children: [
|
|
18194
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
18543
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18195
18544
|
Text,
|
|
18196
18545
|
{
|
|
18197
18546
|
as: Box,
|
|
@@ -18200,18 +18549,18 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18200
18549
|
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
18201
18550
|
$leading: 1.25,
|
|
18202
18551
|
$color: theme.typography[props.usage.fontStyle].color,
|
|
18203
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0,
|
|
18552
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18204
18553
|
formatNumber(allocation),
|
|
18205
18554
|
" ",
|
|
18206
18555
|
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18207
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0,
|
|
18556
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
18208
18557
|
formatNumber(usage),
|
|
18209
18558
|
" ",
|
|
18210
18559
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18211
18560
|
] })
|
|
18212
18561
|
}
|
|
18213
18562
|
),
|
|
18214
|
-
props.allocation.isVisible && /* @__PURE__ */ (0,
|
|
18563
|
+
props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18215
18564
|
Text,
|
|
18216
18565
|
{
|
|
18217
18566
|
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
@@ -18235,8 +18584,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18235
18584
|
]
|
|
18236
18585
|
}
|
|
18237
18586
|
),
|
|
18238
|
-
props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
18239
|
-
/* @__PURE__ */ (0,
|
|
18587
|
+
props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $gap: "2rem", children: [
|
|
18588
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18240
18589
|
ProgressBar,
|
|
18241
18590
|
{
|
|
18242
18591
|
progress: usage / allocation * 100,
|
|
@@ -18248,7 +18597,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18248
18597
|
$flexGrow: "1"
|
|
18249
18598
|
}
|
|
18250
18599
|
),
|
|
18251
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
18600
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18252
18601
|
EmbedButton,
|
|
18253
18602
|
{
|
|
18254
18603
|
onClick: () => {
|
|
@@ -18271,10 +18620,10 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18271
18620
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
18272
18621
|
|
|
18273
18622
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
18274
|
-
var
|
|
18623
|
+
var import_react36 = require("react");
|
|
18275
18624
|
var import_react_dom3 = require("react-dom");
|
|
18276
18625
|
var import_react_stripe_js3 = require("@stripe/react-stripe-js");
|
|
18277
|
-
var
|
|
18626
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
18278
18627
|
var PaymentElement2 = ({
|
|
18279
18628
|
iconName,
|
|
18280
18629
|
iconTitle,
|
|
@@ -18283,11 +18632,11 @@ var PaymentElement2 = ({
|
|
|
18283
18632
|
paymentLast4
|
|
18284
18633
|
}) => {
|
|
18285
18634
|
const theme = nt();
|
|
18286
|
-
return /* @__PURE__ */ (0,
|
|
18287
|
-
iconName && /* @__PURE__ */ (0,
|
|
18288
|
-
/* @__PURE__ */ (0,
|
|
18289
|
-
/* @__PURE__ */ (0,
|
|
18290
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
18635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", children: [
|
|
18636
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
|
|
18637
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $alignItems: "center", children: [
|
|
18638
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
|
|
18639
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
|
|
18291
18640
|
] })
|
|
18292
18641
|
] }) }) });
|
|
18293
18642
|
};
|
|
@@ -18385,16 +18734,16 @@ var PaymentMethodElement = ({
|
|
|
18385
18734
|
iconTitle: genericLabel,
|
|
18386
18735
|
label: genericLabel
|
|
18387
18736
|
};
|
|
18388
|
-
return /* @__PURE__ */ (0,
|
|
18737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18389
18738
|
PaymentElement2,
|
|
18390
18739
|
{
|
|
18391
18740
|
...paymentMethodElementProps(iconName, iconTitle, label, paymentLast4)
|
|
18392
18741
|
}
|
|
18393
18742
|
);
|
|
18394
18743
|
};
|
|
18395
|
-
return /* @__PURE__ */ (0,
|
|
18396
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18397
|
-
/* @__PURE__ */ (0,
|
|
18744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
18745
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
18746
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18398
18747
|
Text,
|
|
18399
18748
|
{
|
|
18400
18749
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18404,7 +18753,7 @@ var PaymentMethodElement = ({
|
|
|
18404
18753
|
children: t2("Payment Method")
|
|
18405
18754
|
}
|
|
18406
18755
|
),
|
|
18407
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0,
|
|
18756
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18408
18757
|
Text,
|
|
18409
18758
|
{
|
|
18410
18759
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18414,7 +18763,7 @@ var PaymentMethodElement = ({
|
|
|
18414
18763
|
}
|
|
18415
18764
|
)
|
|
18416
18765
|
] }),
|
|
18417
|
-
/* @__PURE__ */ (0,
|
|
18766
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
18418
18767
|
Flex,
|
|
18419
18768
|
{
|
|
18420
18769
|
$justifyContent: "space-between",
|
|
@@ -18424,7 +18773,7 @@ var PaymentMethodElement = ({
|
|
|
18424
18773
|
$borderRadius: "9999px",
|
|
18425
18774
|
children: [
|
|
18426
18775
|
renderPaymentMethodElement(),
|
|
18427
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
18776
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18428
18777
|
Text,
|
|
18429
18778
|
{
|
|
18430
18779
|
onClick: onEdit,
|
|
@@ -18441,24 +18790,24 @@ var PaymentMethodElement = ({
|
|
|
18441
18790
|
)
|
|
18442
18791
|
] });
|
|
18443
18792
|
};
|
|
18444
|
-
var PaymentMethod = (0,
|
|
18793
|
+
var PaymentMethod = (0, import_react36.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
18445
18794
|
const props = resolveDesignProps4(rest);
|
|
18446
18795
|
const { t: t2 } = useTranslation();
|
|
18447
18796
|
const theme = nt();
|
|
18448
18797
|
const { api, data, layout, setLayout } = useEmbed();
|
|
18449
18798
|
const isLightBackground = useIsLightBackground();
|
|
18450
|
-
const [isLoading, setIsLoading] = (0,
|
|
18451
|
-
const [error, setError] = (0,
|
|
18452
|
-
const [showPaymentForm, setShowPaymentForm] = (0,
|
|
18799
|
+
const [isLoading, setIsLoading] = (0, import_react36.useState)(false);
|
|
18800
|
+
const [error, setError] = (0, import_react36.useState)();
|
|
18801
|
+
const [showPaymentForm, setShowPaymentForm] = (0, import_react36.useState)(
|
|
18453
18802
|
() => typeof data.subscription?.paymentMethod === "undefined"
|
|
18454
18803
|
);
|
|
18455
|
-
const [stripe, setStripe] = (0,
|
|
18456
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
18457
|
-
const [top, setTop] = (0,
|
|
18458
|
-
const paymentMethod = (0,
|
|
18804
|
+
const [stripe, setStripe] = (0, import_react36.useState)(null);
|
|
18805
|
+
const [setupIntent, setSetupIntent] = (0, import_react36.useState)();
|
|
18806
|
+
const [top, setTop] = (0, import_react36.useState)(0);
|
|
18807
|
+
const paymentMethod = (0, import_react36.useMemo)(() => {
|
|
18459
18808
|
return data.subscription?.paymentMethod;
|
|
18460
18809
|
}, [data.subscription?.paymentMethod]);
|
|
18461
|
-
const monthsToExpiration = (0,
|
|
18810
|
+
const monthsToExpiration = (0, import_react36.useMemo)(() => {
|
|
18462
18811
|
let expiration;
|
|
18463
18812
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
18464
18813
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -18471,7 +18820,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18471
18820
|
}
|
|
18472
18821
|
return expiration;
|
|
18473
18822
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
18474
|
-
const createSetupIntent = (0,
|
|
18823
|
+
const createSetupIntent = (0, import_react36.useCallback)(async () => {
|
|
18475
18824
|
if (!api || !data.component?.id) {
|
|
18476
18825
|
return;
|
|
18477
18826
|
}
|
|
@@ -18490,7 +18839,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18490
18839
|
setIsLoading(false);
|
|
18491
18840
|
}
|
|
18492
18841
|
}, [t2, api, data.component?.id]);
|
|
18493
|
-
const updatePaymentMethod = (0,
|
|
18842
|
+
const updatePaymentMethod = (0, import_react36.useCallback)(
|
|
18494
18843
|
async (id) => {
|
|
18495
18844
|
if (!api || !id) {
|
|
18496
18845
|
return;
|
|
@@ -18511,12 +18860,12 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18511
18860
|
},
|
|
18512
18861
|
[t2, api, setLayout]
|
|
18513
18862
|
);
|
|
18514
|
-
(0,
|
|
18863
|
+
(0, import_react36.useEffect)(() => {
|
|
18515
18864
|
if (!stripe && setupIntent?.publishableKey) {
|
|
18516
18865
|
setStripe(loadStripe(setupIntent.publishableKey));
|
|
18517
18866
|
}
|
|
18518
18867
|
}, [stripe, setupIntent?.publishableKey]);
|
|
18519
|
-
(0,
|
|
18868
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
18520
18869
|
const parent = portal || document.body;
|
|
18521
18870
|
const value = Math.abs(
|
|
18522
18871
|
(parent === document.body ? window.scrollY : parent.scrollTop) ?? 0
|
|
@@ -18530,8 +18879,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18530
18879
|
if (!paymentMethod?.paymentMethodType) {
|
|
18531
18880
|
return null;
|
|
18532
18881
|
}
|
|
18533
|
-
return /* @__PURE__ */ (0,
|
|
18534
|
-
/* @__PURE__ */ (0,
|
|
18882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Element, { ref, className, children: [
|
|
18883
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18535
18884
|
PaymentMethodElement,
|
|
18536
18885
|
{
|
|
18537
18886
|
paymentMethod,
|
|
@@ -18541,8 +18890,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18541
18890
|
}
|
|
18542
18891
|
),
|
|
18543
18892
|
layout === "payment" && (0, import_react_dom3.createPortal)(
|
|
18544
|
-
/* @__PURE__ */ (0,
|
|
18545
|
-
/* @__PURE__ */ (0,
|
|
18893
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
|
|
18894
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(ModalHeader, { bordered: true, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18546
18895
|
Text,
|
|
18547
18896
|
{
|
|
18548
18897
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18552,7 +18901,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18552
18901
|
children: t2("Edit payment method")
|
|
18553
18902
|
}
|
|
18554
18903
|
) }),
|
|
18555
|
-
/* @__PURE__ */ (0,
|
|
18904
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18556
18905
|
Flex,
|
|
18557
18906
|
{
|
|
18558
18907
|
$flexDirection: "column",
|
|
@@ -18561,8 +18910,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18561
18910
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
|
18562
18911
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
18563
18912
|
$overflow: "auto",
|
|
18564
|
-
children: /* @__PURE__ */ (0,
|
|
18565
|
-
showPaymentForm ? /* @__PURE__ */ (0,
|
|
18913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
18914
|
+
showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18566
18915
|
import_react_stripe_js3.Elements,
|
|
18567
18916
|
{
|
|
18568
18917
|
stripe,
|
|
@@ -18591,15 +18940,15 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18591
18940
|
},
|
|
18592
18941
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
18593
18942
|
},
|
|
18594
|
-
children: /* @__PURE__ */ (0,
|
|
18943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18595
18944
|
PaymentForm,
|
|
18596
18945
|
{
|
|
18597
18946
|
onConfirm: (value) => updatePaymentMethod(value)
|
|
18598
18947
|
}
|
|
18599
18948
|
)
|
|
18600
18949
|
}
|
|
18601
|
-
) : /* @__PURE__ */ (0,
|
|
18602
|
-
/* @__PURE__ */ (0,
|
|
18950
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
18951
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18603
18952
|
PaymentMethodElement,
|
|
18604
18953
|
{
|
|
18605
18954
|
size: "lg",
|
|
@@ -18608,7 +18957,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18608
18957
|
...props
|
|
18609
18958
|
}
|
|
18610
18959
|
),
|
|
18611
|
-
/* @__PURE__ */ (0,
|
|
18960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18612
18961
|
Text,
|
|
18613
18962
|
{
|
|
18614
18963
|
onClick: createSetupIntent,
|
|
@@ -18620,7 +18969,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18620
18969
|
}
|
|
18621
18970
|
) })
|
|
18622
18971
|
] }),
|
|
18623
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
18972
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18624
18973
|
Text,
|
|
18625
18974
|
{
|
|
18626
18975
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18641,9 +18990,9 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18641
18990
|
PaymentMethod.displayName = "PaymentMethod";
|
|
18642
18991
|
|
|
18643
18992
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
18644
|
-
var
|
|
18993
|
+
var import_react37 = require("react");
|
|
18645
18994
|
var import_pluralize6 = __toESM(require_pluralize());
|
|
18646
|
-
var
|
|
18995
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18647
18996
|
var resolveDesignProps5 = (props) => {
|
|
18648
18997
|
return {
|
|
18649
18998
|
header: {
|
|
@@ -18672,7 +19021,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
18672
19021
|
}
|
|
18673
19022
|
};
|
|
18674
19023
|
};
|
|
18675
|
-
var PlanManager = (0,
|
|
19024
|
+
var PlanManager = (0, import_react37.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
18676
19025
|
const props = resolveDesignProps5(rest);
|
|
18677
19026
|
const theme = nt();
|
|
18678
19027
|
const { t: t2 } = useTranslation();
|
|
@@ -18705,22 +19054,23 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18705
19054
|
[]
|
|
18706
19055
|
);
|
|
18707
19056
|
const billingSubscription = data.company?.billingSubscription;
|
|
18708
|
-
const subscriptionCurrency = billingSubscription?.currency
|
|
19057
|
+
const subscriptionCurrency = billingSubscription?.currency;
|
|
18709
19058
|
const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
|
|
19059
|
+
const showUnsubscribeBox = billingSubscription && billingSubscription.status == "cancelled";
|
|
18710
19060
|
const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
18711
19061
|
const todayDate = /* @__PURE__ */ new Date();
|
|
18712
19062
|
const trialEndDays = Math.floor(
|
|
18713
19063
|
(trialEndDate.getTime() - todayDate.getTime()) / (1e3 * 60 * 60 * 24)
|
|
18714
19064
|
);
|
|
18715
|
-
return /* @__PURE__ */ (0,
|
|
18716
|
-
showTrialBox && /* @__PURE__ */ (0,
|
|
19065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
19066
|
+
showTrialBox && !showUnsubscribeBox && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18717
19067
|
Box,
|
|
18718
19068
|
{
|
|
18719
19069
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
|
|
18720
19070
|
$textAlign: "center",
|
|
18721
19071
|
$padding: "1rem",
|
|
18722
19072
|
children: [
|
|
18723
|
-
/* @__PURE__ */ (0,
|
|
19073
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18724
19074
|
Text,
|
|
18725
19075
|
{
|
|
18726
19076
|
as: "h3",
|
|
@@ -18731,7 +19081,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18731
19081
|
children: t2("Trial ends in", { days: trialEndDays.toString() })
|
|
18732
19082
|
}
|
|
18733
19083
|
),
|
|
18734
|
-
/* @__PURE__ */ (0,
|
|
19084
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18735
19085
|
Text,
|
|
18736
19086
|
{
|
|
18737
19087
|
as: "p",
|
|
@@ -18749,7 +19099,43 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18749
19099
|
]
|
|
18750
19100
|
}
|
|
18751
19101
|
),
|
|
18752
|
-
/* @__PURE__ */ (0,
|
|
19102
|
+
showUnsubscribeBox && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19103
|
+
Box,
|
|
19104
|
+
{
|
|
19105
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
|
|
19106
|
+
$textAlign: "center",
|
|
19107
|
+
$padding: "1rem",
|
|
19108
|
+
children: [
|
|
19109
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19110
|
+
Text,
|
|
19111
|
+
{
|
|
19112
|
+
as: "h3",
|
|
19113
|
+
$font: theme.typography.heading3.fontFamily,
|
|
19114
|
+
$size: theme.typography.heading3.fontSize,
|
|
19115
|
+
$weight: theme.typography.heading3.fontWeight,
|
|
19116
|
+
$color: theme.typography.heading3.color,
|
|
19117
|
+
children: t2("Subscription canceled")
|
|
19118
|
+
}
|
|
19119
|
+
),
|
|
19120
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19121
|
+
Text,
|
|
19122
|
+
{
|
|
19123
|
+
as: "p",
|
|
19124
|
+
$font: theme.typography.text.fontFamily,
|
|
19125
|
+
$size: theme.typography.text.fontSize * 0.8125,
|
|
19126
|
+
$weight: theme.typography.text.fontWeight,
|
|
19127
|
+
$color: theme.typography.text.color,
|
|
19128
|
+
children: billingSubscription.cancelAt ? t2("Access to plan will end on", {
|
|
19129
|
+
date: toPrettyDate(new Date(billingSubscription.cancelAt), {
|
|
19130
|
+
month: "numeric"
|
|
19131
|
+
})
|
|
19132
|
+
}) : ""
|
|
19133
|
+
}
|
|
19134
|
+
)
|
|
19135
|
+
]
|
|
19136
|
+
}
|
|
19137
|
+
),
|
|
19138
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18753
19139
|
Element,
|
|
18754
19140
|
{
|
|
18755
19141
|
as: Flex,
|
|
@@ -18758,7 +19144,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18758
19144
|
$flexDirection: "column",
|
|
18759
19145
|
$gap: "2rem",
|
|
18760
19146
|
children: [
|
|
18761
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
19147
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18762
19148
|
Flex,
|
|
18763
19149
|
{
|
|
18764
19150
|
$justifyContent: "space-between",
|
|
@@ -18766,8 +19152,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18766
19152
|
$flexWrap: "wrap",
|
|
18767
19153
|
$gap: "1rem",
|
|
18768
19154
|
children: [
|
|
18769
|
-
/* @__PURE__ */ (0,
|
|
18770
|
-
/* @__PURE__ */ (0,
|
|
19155
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19156
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18771
19157
|
Text,
|
|
18772
19158
|
{
|
|
18773
19159
|
as: Box,
|
|
@@ -18779,7 +19165,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18779
19165
|
children: currentPlan.name
|
|
18780
19166
|
}
|
|
18781
19167
|
),
|
|
18782
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
19168
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18783
19169
|
Text,
|
|
18784
19170
|
{
|
|
18785
19171
|
as: Box,
|
|
@@ -18791,8 +19177,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18791
19177
|
}
|
|
18792
19178
|
)
|
|
18793
19179
|
] }),
|
|
18794
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0,
|
|
18795
|
-
/* @__PURE__ */ (0,
|
|
19180
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Box, { children: [
|
|
19181
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18796
19182
|
Text,
|
|
18797
19183
|
{
|
|
18798
19184
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
@@ -18805,14 +19191,14 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18805
19191
|
)
|
|
18806
19192
|
}
|
|
18807
19193
|
),
|
|
18808
|
-
/* @__PURE__ */ (0,
|
|
19194
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18809
19195
|
Text,
|
|
18810
19196
|
{
|
|
18811
19197
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
18812
19198
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
18813
19199
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
18814
19200
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
18815
|
-
children: /* @__PURE__ */ (0,
|
|
19201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18816
19202
|
"/",
|
|
18817
19203
|
shortenPeriod(currentPlan.planPeriod)
|
|
18818
19204
|
] })
|
|
@@ -18822,8 +19208,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18822
19208
|
]
|
|
18823
19209
|
}
|
|
18824
19210
|
),
|
|
18825
|
-
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0,
|
|
18826
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
19211
|
+
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19212
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18827
19213
|
Text,
|
|
18828
19214
|
{
|
|
18829
19215
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18834,7 +19220,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18834
19220
|
children: t2("Add-ons")
|
|
18835
19221
|
}
|
|
18836
19222
|
),
|
|
18837
|
-
addOns.map((addOn) => /* @__PURE__ */ (0,
|
|
19223
|
+
addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18838
19224
|
Flex,
|
|
18839
19225
|
{
|
|
18840
19226
|
$justifyContent: "space-between",
|
|
@@ -18842,7 +19228,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18842
19228
|
$flexWrap: "wrap",
|
|
18843
19229
|
$gap: "1rem",
|
|
18844
19230
|
children: [
|
|
18845
|
-
/* @__PURE__ */ (0,
|
|
19231
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18846
19232
|
Text,
|
|
18847
19233
|
{
|
|
18848
19234
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -18852,7 +19238,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18852
19238
|
children: addOn.name
|
|
18853
19239
|
}
|
|
18854
19240
|
),
|
|
18855
|
-
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0,
|
|
19241
|
+
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18856
19242
|
Text,
|
|
18857
19243
|
{
|
|
18858
19244
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18861,7 +19247,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18861
19247
|
$color: theme.typography.text.color,
|
|
18862
19248
|
children: [
|
|
18863
19249
|
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
18864
|
-
/* @__PURE__ */ (0,
|
|
19250
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18865
19251
|
"/",
|
|
18866
19252
|
shortenPeriod(addOn.planPeriod)
|
|
18867
19253
|
] })
|
|
@@ -18873,8 +19259,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18873
19259
|
addOn.id
|
|
18874
19260
|
))
|
|
18875
19261
|
] }),
|
|
18876
|
-
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
18877
|
-
/* @__PURE__ */ (0,
|
|
19262
|
+
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19263
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18878
19264
|
Text,
|
|
18879
19265
|
{
|
|
18880
19266
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18889,7 +19275,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18889
19275
|
(acc, entitlement) => {
|
|
18890
19276
|
if (entitlement.feature?.name) {
|
|
18891
19277
|
acc.push(
|
|
18892
|
-
/* @__PURE__ */ (0,
|
|
19278
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18893
19279
|
Flex,
|
|
18894
19280
|
{
|
|
18895
19281
|
$justifyContent: "space-between",
|
|
@@ -18897,14 +19283,14 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18897
19283
|
$flexWrap: "wrap",
|
|
18898
19284
|
$gap: "1rem",
|
|
18899
19285
|
children: [
|
|
18900
|
-
/* @__PURE__ */ (0,
|
|
19286
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18901
19287
|
Text,
|
|
18902
19288
|
{
|
|
18903
19289
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
18904
19290
|
$size: theme.typography[props.addOns.fontStyle].fontSize,
|
|
18905
19291
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
18906
19292
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
18907
|
-
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0,
|
|
19293
|
+
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
18908
19294
|
entitlement.quantity,
|
|
18909
19295
|
" ",
|
|
18910
19296
|
(0, import_pluralize6.default)(
|
|
@@ -18914,8 +19300,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18914
19300
|
] }) : entitlement.feature.name
|
|
18915
19301
|
}
|
|
18916
19302
|
),
|
|
18917
|
-
/* @__PURE__ */ (0,
|
|
18918
|
-
entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0,
|
|
19303
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $alignItems: "center", $gap: "1rem", children: [
|
|
19304
|
+
entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18919
19305
|
Text,
|
|
18920
19306
|
{
|
|
18921
19307
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18927,7 +19313,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18927
19313
|
entitlement.price,
|
|
18928
19314
|
entitlement.currencyCode
|
|
18929
19315
|
),
|
|
18930
|
-
/* @__PURE__ */ (0,
|
|
19316
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18931
19317
|
"/",
|
|
18932
19318
|
(0, import_pluralize6.default)(
|
|
18933
19319
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -18939,7 +19325,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18939
19325
|
]
|
|
18940
19326
|
}
|
|
18941
19327
|
),
|
|
18942
|
-
/* @__PURE__ */ (0,
|
|
19328
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18943
19329
|
Text,
|
|
18944
19330
|
{
|
|
18945
19331
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18951,7 +19337,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18951
19337
|
entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
|
|
18952
19338
|
entitlement.currencyCode
|
|
18953
19339
|
),
|
|
18954
|
-
/* @__PURE__ */ (0,
|
|
19340
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18955
19341
|
"/",
|
|
18956
19342
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
|
|
18957
19343
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -18973,7 +19359,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18973
19359
|
[]
|
|
18974
19360
|
)
|
|
18975
19361
|
] }),
|
|
18976
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0,
|
|
19362
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18977
19363
|
EmbedButton,
|
|
18978
19364
|
{
|
|
18979
19365
|
onClick: () => {
|
|
@@ -18997,9 +19383,9 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18997
19383
|
PlanManager.displayName = "PlanManager";
|
|
18998
19384
|
|
|
18999
19385
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
19000
|
-
var
|
|
19386
|
+
var import_react38 = require("react");
|
|
19001
19387
|
var import_pluralize7 = __toESM(require_pluralize());
|
|
19002
|
-
var
|
|
19388
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19003
19389
|
var resolveDesignProps6 = (props) => {
|
|
19004
19390
|
return {
|
|
19005
19391
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -19039,18 +19425,18 @@ var resolveDesignProps6 = (props) => {
|
|
|
19039
19425
|
}
|
|
19040
19426
|
};
|
|
19041
19427
|
};
|
|
19042
|
-
var PricingTable = (0,
|
|
19428
|
+
var PricingTable = (0, import_react38.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
19043
19429
|
const props = resolveDesignProps6(rest);
|
|
19044
19430
|
const { t: t2 } = useTranslation();
|
|
19045
19431
|
const theme = nt();
|
|
19046
19432
|
const { data, setLayout, setSelected } = useEmbed();
|
|
19047
19433
|
const trialEndDays = useTrialEnd();
|
|
19048
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
19434
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react38.useState)(
|
|
19049
19435
|
() => data.company?.plan?.planPeriod || "month"
|
|
19050
19436
|
);
|
|
19051
19437
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
19052
19438
|
const isLightBackground = useIsLightBackground();
|
|
19053
|
-
const [entitlementCounts, setEntitlementCounts] = (0,
|
|
19439
|
+
const [entitlementCounts, setEntitlementCounts] = (0, import_react38.useState)(
|
|
19054
19440
|
() => plans.reduce(
|
|
19055
19441
|
(acc, plan) => {
|
|
19056
19442
|
acc[plan.id] = {
|
|
@@ -19077,7 +19463,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19077
19463
|
};
|
|
19078
19464
|
});
|
|
19079
19465
|
};
|
|
19080
|
-
return /* @__PURE__ */ (0,
|
|
19466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19081
19467
|
FussyChild,
|
|
19082
19468
|
{
|
|
19083
19469
|
ref,
|
|
@@ -19086,8 +19472,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19086
19472
|
$flexDirection: "column",
|
|
19087
19473
|
$gap: "2rem",
|
|
19088
19474
|
children: [
|
|
19089
|
-
/* @__PURE__ */ (0,
|
|
19090
|
-
/* @__PURE__ */ (0,
|
|
19475
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19476
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19091
19477
|
Flex,
|
|
19092
19478
|
{
|
|
19093
19479
|
$flexDirection: "column",
|
|
@@ -19102,7 +19488,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19102
19488
|
}
|
|
19103
19489
|
},
|
|
19104
19490
|
children: [
|
|
19105
|
-
/* @__PURE__ */ (0,
|
|
19491
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19106
19492
|
Text,
|
|
19107
19493
|
{
|
|
19108
19494
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19112,7 +19498,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19112
19498
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
19113
19499
|
}
|
|
19114
19500
|
),
|
|
19115
|
-
props.showPeriodToggle && /* @__PURE__ */ (0,
|
|
19501
|
+
props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19116
19502
|
PeriodToggle,
|
|
19117
19503
|
{
|
|
19118
19504
|
options: periods,
|
|
@@ -19123,7 +19509,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19123
19509
|
]
|
|
19124
19510
|
}
|
|
19125
19511
|
),
|
|
19126
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
19512
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19127
19513
|
Box,
|
|
19128
19514
|
{
|
|
19129
19515
|
$display: "grid",
|
|
@@ -19136,7 +19522,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19136
19522
|
if (count?.limit && count.limit > VISIBLE_ENTITLEMENT_COUNT) {
|
|
19137
19523
|
isExpanded = true;
|
|
19138
19524
|
}
|
|
19139
|
-
return /* @__PURE__ */ (0,
|
|
19525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19140
19526
|
Flex,
|
|
19141
19527
|
{
|
|
19142
19528
|
$position: "relative",
|
|
@@ -19149,7 +19535,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19149
19535
|
$outlineColor: isActivePlan ? theme.primary : "transparent",
|
|
19150
19536
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19151
19537
|
children: [
|
|
19152
|
-
/* @__PURE__ */ (0,
|
|
19538
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19153
19539
|
Flex,
|
|
19154
19540
|
{
|
|
19155
19541
|
$flexDirection: "column",
|
|
@@ -19160,7 +19546,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19160
19546
|
$borderStyle: "solid",
|
|
19161
19547
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
19162
19548
|
children: [
|
|
19163
|
-
/* @__PURE__ */ (0,
|
|
19549
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19164
19550
|
Text,
|
|
19165
19551
|
{
|
|
19166
19552
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19170,7 +19556,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19170
19556
|
children: plan.name
|
|
19171
19557
|
}
|
|
19172
19558
|
) }),
|
|
19173
|
-
props.plans.description.isVisible && /* @__PURE__ */ (0,
|
|
19559
|
+
props.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19174
19560
|
Text,
|
|
19175
19561
|
{
|
|
19176
19562
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19180,8 +19566,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19180
19566
|
children: plan.description
|
|
19181
19567
|
}
|
|
19182
19568
|
) }),
|
|
19183
|
-
/* @__PURE__ */ (0,
|
|
19184
|
-
/* @__PURE__ */ (0,
|
|
19569
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19570
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19185
19571
|
Text,
|
|
19186
19572
|
{
|
|
19187
19573
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19194,7 +19580,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19194
19580
|
)
|
|
19195
19581
|
}
|
|
19196
19582
|
),
|
|
19197
|
-
!plan.custom && /* @__PURE__ */ (0,
|
|
19583
|
+
!plan.custom && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19198
19584
|
Text,
|
|
19199
19585
|
{
|
|
19200
19586
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19208,7 +19594,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19208
19594
|
}
|
|
19209
19595
|
)
|
|
19210
19596
|
] }),
|
|
19211
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
19597
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19212
19598
|
Flex,
|
|
19213
19599
|
{
|
|
19214
19600
|
$position: "absolute",
|
|
@@ -19225,7 +19611,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19225
19611
|
]
|
|
19226
19612
|
}
|
|
19227
19613
|
),
|
|
19228
|
-
/* @__PURE__ */ (0,
|
|
19614
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19229
19615
|
Flex,
|
|
19230
19616
|
{
|
|
19231
19617
|
$flexDirection: "column",
|
|
@@ -19234,7 +19620,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19234
19620
|
$gap: `${cardPadding}rem`,
|
|
19235
19621
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
19236
19622
|
children: [
|
|
19237
|
-
props.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
19623
|
+
props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
|
|
19238
19624
|
plan.entitlements.slice().sort((a2, b2) => {
|
|
19239
19625
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
19240
19626
|
return 1;
|
|
@@ -19257,8 +19643,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19257
19643
|
return acc;
|
|
19258
19644
|
}
|
|
19259
19645
|
acc.push(
|
|
19260
|
-
/* @__PURE__ */ (0,
|
|
19261
|
-
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
19646
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $gap: "1rem", children: [
|
|
19647
|
+
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19262
19648
|
IconRound,
|
|
19263
19649
|
{
|
|
19264
19650
|
name: entitlement.feature.icon,
|
|
@@ -19269,7 +19655,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19269
19655
|
]
|
|
19270
19656
|
}
|
|
19271
19657
|
),
|
|
19272
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
19658
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19273
19659
|
Text,
|
|
19274
19660
|
{
|
|
19275
19661
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19277,7 +19663,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19277
19663
|
$weight: theme.typography.text.fontWeight,
|
|
19278
19664
|
$color: theme.typography.text.color,
|
|
19279
19665
|
$leading: 1.35,
|
|
19280
|
-
children: typeof price !== "undefined" ? /* @__PURE__ */ (0,
|
|
19666
|
+
children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19281
19667
|
formatCurrency(price, currency),
|
|
19282
19668
|
" ",
|
|
19283
19669
|
t2("per"),
|
|
@@ -19286,19 +19672,19 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19286
19672
|
entitlement.feature.name,
|
|
19287
19673
|
1
|
|
19288
19674
|
),
|
|
19289
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
19675
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19290
19676
|
" ",
|
|
19291
19677
|
t2("per"),
|
|
19292
19678
|
" ",
|
|
19293
19679
|
selectedPeriod
|
|
19294
19680
|
] })
|
|
19295
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
19681
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19296
19682
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19297
19683
|
item: (0, import_pluralize7.default)(
|
|
19298
19684
|
entitlement.feature.name
|
|
19299
19685
|
)
|
|
19300
19686
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19301
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
19687
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19302
19688
|
" ",
|
|
19303
19689
|
t2("per"),
|
|
19304
19690
|
" ",
|
|
@@ -19316,14 +19702,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19316
19702
|
);
|
|
19317
19703
|
return acc;
|
|
19318
19704
|
}, []).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
19319
|
-
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0,
|
|
19705
|
+
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19320
19706
|
Flex,
|
|
19321
19707
|
{
|
|
19322
19708
|
$alignItems: "center",
|
|
19323
19709
|
$justifyContent: "start",
|
|
19324
19710
|
$marginTop: "1rem",
|
|
19325
19711
|
children: [
|
|
19326
|
-
/* @__PURE__ */ (0,
|
|
19712
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19327
19713
|
Icon2,
|
|
19328
19714
|
{
|
|
19329
19715
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -19335,7 +19721,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19335
19721
|
}
|
|
19336
19722
|
}
|
|
19337
19723
|
),
|
|
19338
|
-
/* @__PURE__ */ (0,
|
|
19724
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19339
19725
|
Text,
|
|
19340
19726
|
{
|
|
19341
19727
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -19352,7 +19738,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19352
19738
|
}
|
|
19353
19739
|
)
|
|
19354
19740
|
] }),
|
|
19355
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
19741
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19356
19742
|
Flex,
|
|
19357
19743
|
{
|
|
19358
19744
|
$justifyContent: "center",
|
|
@@ -19360,7 +19746,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19360
19746
|
$gap: "0.25rem",
|
|
19361
19747
|
$padding: "0.625rem 0",
|
|
19362
19748
|
children: [
|
|
19363
|
-
/* @__PURE__ */ (0,
|
|
19749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19364
19750
|
Icon2,
|
|
19365
19751
|
{
|
|
19366
19752
|
name: "check-rounded",
|
|
@@ -19371,7 +19757,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19371
19757
|
}
|
|
19372
19758
|
}
|
|
19373
19759
|
),
|
|
19374
|
-
/* @__PURE__ */ (0,
|
|
19760
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19375
19761
|
Text,
|
|
19376
19762
|
{
|
|
19377
19763
|
$size: 15,
|
|
@@ -19382,7 +19768,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19382
19768
|
)
|
|
19383
19769
|
]
|
|
19384
19770
|
}
|
|
19385
|
-
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
19771
|
+
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19386
19772
|
EmbedButton,
|
|
19387
19773
|
{
|
|
19388
19774
|
disabled: !plan.valid || !canCheckout,
|
|
@@ -19405,14 +19791,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19405
19791
|
$color: props.downgrade.buttonStyle,
|
|
19406
19792
|
$variant: "outline"
|
|
19407
19793
|
},
|
|
19408
|
-
children: plan.custom ? /* @__PURE__ */ (0,
|
|
19794
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19409
19795
|
ButtonLink,
|
|
19410
19796
|
{
|
|
19411
19797
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19412
19798
|
target: "_blank",
|
|
19413
19799
|
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
19414
19800
|
}
|
|
19415
|
-
) : !plan.valid ? /* @__PURE__ */ (0,
|
|
19801
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19416
19802
|
Tooltip,
|
|
19417
19803
|
{
|
|
19418
19804
|
trigger: t2("Over usage limit"),
|
|
@@ -19434,14 +19820,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19434
19820
|
}
|
|
19435
19821
|
)
|
|
19436
19822
|
] }),
|
|
19437
|
-
/* @__PURE__ */ (0,
|
|
19438
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
19823
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19824
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19439
19825
|
Flex,
|
|
19440
19826
|
{
|
|
19441
19827
|
$justifyContent: "space-between",
|
|
19442
19828
|
$alignItems: "center",
|
|
19443
19829
|
$marginBottom: "1rem",
|
|
19444
|
-
children: /* @__PURE__ */ (0,
|
|
19830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19445
19831
|
Text,
|
|
19446
19832
|
{
|
|
19447
19833
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19453,7 +19839,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19453
19839
|
)
|
|
19454
19840
|
}
|
|
19455
19841
|
),
|
|
19456
|
-
/* @__PURE__ */ (0,
|
|
19842
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19457
19843
|
Box,
|
|
19458
19844
|
{
|
|
19459
19845
|
$display: "grid",
|
|
@@ -19461,7 +19847,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19461
19847
|
$gap: "1rem",
|
|
19462
19848
|
children: addOns.map((addOn, index) => {
|
|
19463
19849
|
const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
|
|
19464
|
-
return /* @__PURE__ */ (0,
|
|
19850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19465
19851
|
Flex,
|
|
19466
19852
|
{
|
|
19467
19853
|
$position: "relative",
|
|
@@ -19475,8 +19861,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19475
19861
|
$outlineColor: isActiveAddOn ? theme.primary : "transparent",
|
|
19476
19862
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19477
19863
|
children: [
|
|
19478
|
-
/* @__PURE__ */ (0,
|
|
19479
|
-
/* @__PURE__ */ (0,
|
|
19864
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
19865
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19480
19866
|
Text,
|
|
19481
19867
|
{
|
|
19482
19868
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19486,7 +19872,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19486
19872
|
children: addOn.name
|
|
19487
19873
|
}
|
|
19488
19874
|
) }),
|
|
19489
|
-
props.addOns.showDescription && /* @__PURE__ */ (0,
|
|
19875
|
+
props.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19490
19876
|
Text,
|
|
19491
19877
|
{
|
|
19492
19878
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19496,8 +19882,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19496
19882
|
children: addOn.description
|
|
19497
19883
|
}
|
|
19498
19884
|
) }),
|
|
19499
|
-
/* @__PURE__ */ (0,
|
|
19500
|
-
/* @__PURE__ */ (0,
|
|
19885
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19886
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19501
19887
|
Text,
|
|
19502
19888
|
{
|
|
19503
19889
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19510,7 +19896,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19510
19896
|
)
|
|
19511
19897
|
}
|
|
19512
19898
|
),
|
|
19513
|
-
/* @__PURE__ */ (0,
|
|
19899
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19514
19900
|
Text,
|
|
19515
19901
|
{
|
|
19516
19902
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19524,7 +19910,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19524
19910
|
}
|
|
19525
19911
|
)
|
|
19526
19912
|
] }),
|
|
19527
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
19913
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19528
19914
|
Flex,
|
|
19529
19915
|
{
|
|
19530
19916
|
$position: "absolute",
|
|
@@ -19539,7 +19925,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19539
19925
|
}
|
|
19540
19926
|
)
|
|
19541
19927
|
] }),
|
|
19542
|
-
/* @__PURE__ */ (0,
|
|
19928
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19543
19929
|
Flex,
|
|
19544
19930
|
{
|
|
19545
19931
|
$flexDirection: "column",
|
|
@@ -19547,7 +19933,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19547
19933
|
$gap: `${cardPadding}rem`,
|
|
19548
19934
|
$flexGrow: "1",
|
|
19549
19935
|
children: [
|
|
19550
|
-
props.addOns.showEntitlements && /* @__PURE__ */ (0,
|
|
19936
|
+
props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19551
19937
|
Flex,
|
|
19552
19938
|
{
|
|
19553
19939
|
$flexDirection: "column",
|
|
@@ -19555,15 +19941,15 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19555
19941
|
$gap: "1rem",
|
|
19556
19942
|
$flexGrow: "1",
|
|
19557
19943
|
children: addOn.entitlements.map((entitlement) => {
|
|
19558
|
-
return /* @__PURE__ */ (0,
|
|
19944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19559
19945
|
Flex,
|
|
19560
19946
|
{
|
|
19561
19947
|
$flexWrap: "wrap",
|
|
19562
19948
|
$justifyContent: "space-between",
|
|
19563
19949
|
$alignItems: "center",
|
|
19564
19950
|
$gap: "1rem",
|
|
19565
|
-
children: /* @__PURE__ */ (0,
|
|
19566
|
-
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
19951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $gap: "1rem", children: [
|
|
19952
|
+
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19567
19953
|
IconRound,
|
|
19568
19954
|
{
|
|
19569
19955
|
name: entitlement.feature.icon,
|
|
@@ -19574,20 +19960,20 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19574
19960
|
]
|
|
19575
19961
|
}
|
|
19576
19962
|
),
|
|
19577
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
19963
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19578
19964
|
Text,
|
|
19579
19965
|
{
|
|
19580
19966
|
$font: theme.typography.text.fontFamily,
|
|
19581
19967
|
$size: theme.typography.text.fontSize,
|
|
19582
19968
|
$weight: theme.typography.text.fontWeight,
|
|
19583
19969
|
$color: theme.typography.text.color,
|
|
19584
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0,
|
|
19970
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19585
19971
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19586
19972
|
item: (0, import_pluralize7.default)(
|
|
19587
19973
|
entitlement.feature.name
|
|
19588
19974
|
)
|
|
19589
19975
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19590
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
19976
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19591
19977
|
" ",
|
|
19592
19978
|
t2("per"),
|
|
19593
19979
|
" ",
|
|
@@ -19608,7 +19994,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19608
19994
|
})
|
|
19609
19995
|
}
|
|
19610
19996
|
),
|
|
19611
|
-
props.upgrade.isVisible && /* @__PURE__ */ (0,
|
|
19997
|
+
props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19612
19998
|
EmbedButton,
|
|
19613
19999
|
{
|
|
19614
20000
|
disabled: !addOn.valid || !canCheckout,
|
|
@@ -19644,8 +20030,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19644
20030
|
PricingTable.displayName = "PricingTable";
|
|
19645
20031
|
|
|
19646
20032
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
19647
|
-
var
|
|
19648
|
-
var
|
|
20033
|
+
var import_react39 = require("react");
|
|
20034
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19649
20035
|
function resolveDesignProps7(props) {
|
|
19650
20036
|
return {
|
|
19651
20037
|
header: {
|
|
@@ -19664,13 +20050,13 @@ function resolveDesignProps7(props) {
|
|
|
19664
20050
|
}
|
|
19665
20051
|
};
|
|
19666
20052
|
}
|
|
19667
|
-
var UpcomingBill = (0,
|
|
20053
|
+
var UpcomingBill = (0, import_react39.forwardRef)(({ className, ...rest }, ref) => {
|
|
19668
20054
|
const props = resolveDesignProps7(rest);
|
|
19669
20055
|
const { t: t2 } = useTranslation();
|
|
19670
20056
|
const theme = nt();
|
|
19671
20057
|
const { data } = useEmbed();
|
|
19672
20058
|
const isLightBackground = useIsLightBackground();
|
|
19673
|
-
const { upcomingInvoice, discounts } = (0,
|
|
20059
|
+
const { upcomingInvoice, discounts } = (0, import_react39.useMemo)(() => {
|
|
19674
20060
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
19675
20061
|
amountOff: discount.amountOff,
|
|
19676
20062
|
couponId: discount.couponId,
|
|
@@ -19697,7 +20083,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19697
20083
|
if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
|
|
19698
20084
|
return null;
|
|
19699
20085
|
}
|
|
19700
|
-
return /* @__PURE__ */ (0,
|
|
20086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
19701
20087
|
Element,
|
|
19702
20088
|
{
|
|
19703
20089
|
as: Flex,
|
|
@@ -19706,7 +20092,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19706
20092
|
$flexDirection: "column",
|
|
19707
20093
|
$gap: "1rem",
|
|
19708
20094
|
children: [
|
|
19709
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
20095
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
19710
20096
|
Text,
|
|
19711
20097
|
{
|
|
19712
20098
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19720,8 +20106,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19720
20106
|
]
|
|
19721
20107
|
}
|
|
19722
20108
|
) }),
|
|
19723
|
-
/* @__PURE__ */ (0,
|
|
19724
|
-
props.price.isVisible && /* @__PURE__ */ (0,
|
|
20109
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
|
20110
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19725
20111
|
Text,
|
|
19726
20112
|
{
|
|
19727
20113
|
$font: theme.typography[props.price.fontStyle].fontFamily,
|
|
@@ -19735,7 +20121,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19735
20121
|
)
|
|
19736
20122
|
}
|
|
19737
20123
|
) }),
|
|
19738
|
-
/* @__PURE__ */ (0,
|
|
20124
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19739
20125
|
Text,
|
|
19740
20126
|
{
|
|
19741
20127
|
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
|
@@ -19747,8 +20133,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19747
20133
|
}
|
|
19748
20134
|
) })
|
|
19749
20135
|
] }),
|
|
19750
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
19751
|
-
/* @__PURE__ */ (0,
|
|
20136
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
20137
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19752
20138
|
Text,
|
|
19753
20139
|
{
|
|
19754
20140
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19758,8 +20144,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19758
20144
|
children: t2("Discount")
|
|
19759
20145
|
}
|
|
19760
20146
|
) }),
|
|
19761
|
-
/* @__PURE__ */ (0,
|
|
19762
|
-
/* @__PURE__ */ (0,
|
|
20147
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { children: discounts.map((discount) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
20148
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19763
20149
|
Flex,
|
|
19764
20150
|
{
|
|
19765
20151
|
$alignItems: "center",
|
|
@@ -19768,7 +20154,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19768
20154
|
$borderStyle: "solid",
|
|
19769
20155
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
19770
20156
|
$borderRadius: "0.3125rem",
|
|
19771
|
-
children: /* @__PURE__ */ (0,
|
|
20157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19772
20158
|
Text,
|
|
19773
20159
|
{
|
|
19774
20160
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19780,7 +20166,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19780
20166
|
)
|
|
19781
20167
|
}
|
|
19782
20168
|
),
|
|
19783
|
-
/* @__PURE__ */ (0,
|
|
20169
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19784
20170
|
Text,
|
|
19785
20171
|
{
|
|
19786
20172
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19798,11 +20184,72 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19798
20184
|
});
|
|
19799
20185
|
UpcomingBill.displayName = "UpcomingBill";
|
|
19800
20186
|
|
|
19801
|
-
// src/components/
|
|
20187
|
+
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
19802
20188
|
var import_react40 = require("react");
|
|
20189
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
20190
|
+
var resolveDesignProps8 = (props) => {
|
|
20191
|
+
return {
|
|
20192
|
+
button: {
|
|
20193
|
+
text: props.button?.text ?? "Unsubscribe",
|
|
20194
|
+
style: props.button?.style ?? "primary",
|
|
20195
|
+
size: props.button?.size ?? "md",
|
|
20196
|
+
fullWidth: props.button?.fullWidth ?? true,
|
|
20197
|
+
alignment: props.button?.alignment ?? "center"
|
|
20198
|
+
}
|
|
20199
|
+
};
|
|
20200
|
+
};
|
|
20201
|
+
var UnsubscribeButton = (0, import_react40.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
20202
|
+
const props = resolveDesignProps8(rest);
|
|
20203
|
+
const { t: t2 } = useTranslation();
|
|
20204
|
+
const { data, setLayout } = useEmbed();
|
|
20205
|
+
const disabled = !data.subscription || data.subscription.status === "cancelled";
|
|
20206
|
+
const buttonStyles = {
|
|
20207
|
+
primary: {
|
|
20208
|
+
color: "primary",
|
|
20209
|
+
variant: "filled"
|
|
20210
|
+
},
|
|
20211
|
+
secondary: {
|
|
20212
|
+
color: "primary",
|
|
20213
|
+
variant: "outline"
|
|
20214
|
+
},
|
|
20215
|
+
tertiary: {
|
|
20216
|
+
color: "primary",
|
|
20217
|
+
variant: "text"
|
|
20218
|
+
}
|
|
20219
|
+
};
|
|
20220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
20221
|
+
Element,
|
|
20222
|
+
{
|
|
20223
|
+
as: Flex,
|
|
20224
|
+
ref,
|
|
20225
|
+
className,
|
|
20226
|
+
$flexDirection: "column",
|
|
20227
|
+
$gap: "2rem",
|
|
20228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
20229
|
+
EmbedButton,
|
|
20230
|
+
{
|
|
20231
|
+
$size: props.button.size,
|
|
20232
|
+
$color: buttonStyles[props.button.style].color,
|
|
20233
|
+
$variant: buttonStyles[props.button.style].variant,
|
|
20234
|
+
$alignment: props.button.alignment,
|
|
20235
|
+
$fullWidth: props.button.fullWidth,
|
|
20236
|
+
onClick: () => {
|
|
20237
|
+
setLayout("unsubscribe");
|
|
20238
|
+
},
|
|
20239
|
+
disabled,
|
|
20240
|
+
children: t2(props.button.text) ?? t2("Unsubscribe")
|
|
20241
|
+
}
|
|
20242
|
+
)
|
|
20243
|
+
}
|
|
20244
|
+
);
|
|
20245
|
+
});
|
|
20246
|
+
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
20247
|
+
|
|
20248
|
+
// src/components/embed/ComponentTree.tsx
|
|
20249
|
+
var import_react42 = require("react");
|
|
19803
20250
|
|
|
19804
20251
|
// src/components/embed/renderer.ts
|
|
19805
|
-
var
|
|
20252
|
+
var import_react41 = require("react");
|
|
19806
20253
|
var components = {
|
|
19807
20254
|
Root,
|
|
19808
20255
|
Viewport,
|
|
@@ -19814,7 +20261,8 @@ var components = {
|
|
|
19814
20261
|
UpcomingBill,
|
|
19815
20262
|
PaymentMethod,
|
|
19816
20263
|
Invoices,
|
|
19817
|
-
PricingTable
|
|
20264
|
+
PricingTable,
|
|
20265
|
+
UnsubscribeButton
|
|
19818
20266
|
};
|
|
19819
20267
|
function createRenderer(options) {
|
|
19820
20268
|
const { useFallback = false } = options || {};
|
|
@@ -19824,7 +20272,7 @@ function createRenderer(options) {
|
|
|
19824
20272
|
const component = useFallback ? components[name] || "div" : components[name];
|
|
19825
20273
|
if (!components[name]) {
|
|
19826
20274
|
console.debug(
|
|
19827
|
-
"`schematic-embed`:
|
|
20275
|
+
"`schematic-embed`: Encountered an unknown component during render cycle.",
|
|
19828
20276
|
name
|
|
19829
20277
|
);
|
|
19830
20278
|
}
|
|
@@ -19834,7 +20282,7 @@ function createRenderer(options) {
|
|
|
19834
20282
|
const { className, ...rest } = props;
|
|
19835
20283
|
const resolvedProps = component === "div" ? rest : props;
|
|
19836
20284
|
const resolvedChildren = children.map(renderNode);
|
|
19837
|
-
return (0,
|
|
20285
|
+
return (0, import_react41.createElement)(
|
|
19838
20286
|
component,
|
|
19839
20287
|
{
|
|
19840
20288
|
key: index,
|
|
@@ -19847,10 +20295,10 @@ function createRenderer(options) {
|
|
|
19847
20295
|
}
|
|
19848
20296
|
|
|
19849
20297
|
// src/components/embed/ComponentTree.tsx
|
|
19850
|
-
var
|
|
20298
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19851
20299
|
var Loading = () => {
|
|
19852
20300
|
const theme = nt();
|
|
19853
|
-
return /* @__PURE__ */ (0,
|
|
20301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19854
20302
|
Flex,
|
|
19855
20303
|
{
|
|
19856
20304
|
$width: "100%",
|
|
@@ -19858,13 +20306,13 @@ var Loading = () => {
|
|
|
19858
20306
|
$alignItems: "center",
|
|
19859
20307
|
$justifyContent: "center",
|
|
19860
20308
|
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
19861
|
-
children: /* @__PURE__ */ (0,
|
|
20309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loader, { $size: "2xl", $color: "#194BFB" })
|
|
19862
20310
|
}
|
|
19863
20311
|
);
|
|
19864
20312
|
};
|
|
19865
20313
|
var Error2 = ({ message }) => {
|
|
19866
20314
|
const theme = nt();
|
|
19867
|
-
return /* @__PURE__ */ (0,
|
|
20315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19868
20316
|
Flex,
|
|
19869
20317
|
{
|
|
19870
20318
|
$flexDirection: "column",
|
|
@@ -19875,7 +20323,7 @@ var Error2 = ({ message }) => {
|
|
|
19875
20323
|
$alignItems: "center",
|
|
19876
20324
|
$justifyContent: "center",
|
|
19877
20325
|
children: [
|
|
19878
|
-
/* @__PURE__ */ (0,
|
|
20326
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19879
20327
|
Box,
|
|
19880
20328
|
{
|
|
19881
20329
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19886,7 +20334,7 @@ var Error2 = ({ message }) => {
|
|
|
19886
20334
|
children: "Error"
|
|
19887
20335
|
}
|
|
19888
20336
|
),
|
|
19889
|
-
/* @__PURE__ */ (0,
|
|
20337
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19890
20338
|
Box,
|
|
19891
20339
|
{
|
|
19892
20340
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19903,31 +20351,31 @@ var Error2 = ({ message }) => {
|
|
|
19903
20351
|
};
|
|
19904
20352
|
var ComponentTree = () => {
|
|
19905
20353
|
const { error, nodes, isPending } = useEmbed();
|
|
19906
|
-
const [children, setChildren] = (0,
|
|
19907
|
-
(0,
|
|
20354
|
+
const [children, setChildren] = (0, import_react42.useState)(/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loading, {}));
|
|
20355
|
+
(0, import_react42.useEffect)(() => {
|
|
19908
20356
|
const renderer = createRenderer();
|
|
19909
20357
|
setChildren(nodes.map(renderer));
|
|
19910
20358
|
}, [nodes]);
|
|
19911
20359
|
if (error) {
|
|
19912
20360
|
console.error(error);
|
|
19913
|
-
return /* @__PURE__ */ (0,
|
|
20361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Error2, { message: error.message });
|
|
19914
20362
|
}
|
|
19915
20363
|
if (isPending) {
|
|
19916
|
-
return /* @__PURE__ */ (0,
|
|
20364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loading, {});
|
|
19917
20365
|
}
|
|
19918
|
-
return /* @__PURE__ */ (0,
|
|
20366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
|
|
19919
20367
|
};
|
|
19920
20368
|
|
|
19921
20369
|
// src/components/embed/Embed.tsx
|
|
19922
|
-
var
|
|
20370
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19923
20371
|
var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
|
|
19924
20372
|
if (accessToken?.length === 0) {
|
|
19925
|
-
return /* @__PURE__ */ (0,
|
|
20373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: "Please provide an access token." });
|
|
19926
20374
|
}
|
|
19927
20375
|
if (!accessToken?.startsWith("token_")) {
|
|
19928
|
-
return /* @__PURE__ */ (0,
|
|
20376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
|
19929
20377
|
}
|
|
19930
|
-
return /* @__PURE__ */ (0,
|
|
20378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComponentTree, {}) });
|
|
19931
20379
|
};
|
|
19932
20380
|
/*! Bundled license information:
|
|
19933
20381
|
|