@schematichq/schematic-components 0.4.6 → 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 +680 -299
- package/dist/schematic-components.d.ts +30 -4
- package/dist/schematic-components.esm.js +657 -276
- 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");
|
|
@@ -11972,6 +11973,7 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
11972
11973
|
var en_default = {
|
|
11973
11974
|
translation: {
|
|
11974
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}}",
|
|
11975
11977
|
Active: "Active",
|
|
11976
11978
|
"Add payment method": "Add payment method",
|
|
11977
11979
|
"Add Seats": "Add More",
|
|
@@ -11981,6 +11983,7 @@ var en_default = {
|
|
|
11981
11983
|
"After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
|
|
11982
11984
|
Billed: "Billed {{period}}",
|
|
11983
11985
|
"billing period": "billing period",
|
|
11986
|
+
"Cancel subscription": "Cancel subscription",
|
|
11984
11987
|
"Cannot downgrade entitlement": "Cannot downgrade to a lower quantity than current usage.",
|
|
11985
11988
|
"Card ending in": "\u{1F4B3} Card ending in {{value}}",
|
|
11986
11989
|
"Change add-on": "Change add-on",
|
|
@@ -12015,9 +12018,11 @@ var en_default = {
|
|
|
12015
12018
|
Invoices: "Invoices",
|
|
12016
12019
|
"Limit of": "Limit of {{amount}}",
|
|
12017
12020
|
Loading: "Loading",
|
|
12021
|
+
"Manage plan": "Manage plan",
|
|
12018
12022
|
Monthly: "Monthly",
|
|
12019
12023
|
Next: "Next",
|
|
12020
12024
|
"No limit": "No limit",
|
|
12025
|
+
"Not ready to cancel?": "Not ready to cancel?",
|
|
12021
12026
|
"Optionally add features to your subscription": "Optionally add features to your subscription",
|
|
12022
12027
|
"Other existing payment method": "Other existing payment method",
|
|
12023
12028
|
"Over usage limit": "Over usage limit",
|
|
@@ -12044,10 +12049,13 @@ var en_default = {
|
|
|
12044
12049
|
"Start trial": "Start trial",
|
|
12045
12050
|
"Subscribe and close": "Subscribe and close",
|
|
12046
12051
|
Subscription: "Subscription",
|
|
12052
|
+
"Subscription canceled": "Subscription canceled",
|
|
12047
12053
|
Trial: "Trial",
|
|
12048
12054
|
"Trial ends in": "Trial ends in {{days}} days",
|
|
12049
12055
|
"Trial plan": "Try free for {{days}} days",
|
|
12050
12056
|
Unlimited: "Unlimited {{item}}",
|
|
12057
|
+
Unsubscribe: "Unsubscribe",
|
|
12058
|
+
"Unsubscribe failed": "Unsubscribe failed",
|
|
12051
12059
|
"Unused time": "Unused time",
|
|
12052
12060
|
Usage: "Usage",
|
|
12053
12061
|
"Usage-based": "Usage-based",
|
|
@@ -12055,6 +12063,7 @@ var en_default = {
|
|
|
12055
12063
|
"X% off": "{{percent}}% off",
|
|
12056
12064
|
"X off": "{{amount}} off",
|
|
12057
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",
|
|
12058
12067
|
day: "day",
|
|
12059
12068
|
month: "month",
|
|
12060
12069
|
per: "per",
|
|
@@ -12789,7 +12798,8 @@ var EmbedProvider = ({
|
|
|
12789
12798
|
(0, import_react11.useEffect)(() => {
|
|
12790
12799
|
const element = document.getElementById("schematic-fonts");
|
|
12791
12800
|
if (element) {
|
|
12792
|
-
|
|
12801
|
+
styleRef.current = element;
|
|
12802
|
+
return;
|
|
12793
12803
|
}
|
|
12794
12804
|
const style = document.createElement("link");
|
|
12795
12805
|
style.id = "schematic-fonts";
|
|
@@ -12800,7 +12810,7 @@ var EmbedProvider = ({
|
|
|
12800
12810
|
(0, import_react11.useEffect)(() => {
|
|
12801
12811
|
if (accessToken) {
|
|
12802
12812
|
const { headers = {} } = apiConfig ?? {};
|
|
12803
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12813
|
+
headers["X-Schematic-Components-Version"] = "0.4.7";
|
|
12804
12814
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12805
12815
|
const config = new Configuration({
|
|
12806
12816
|
...apiConfig,
|
|
@@ -13247,7 +13257,7 @@ var Button2 = (0, import_react16.forwardRef)(
|
|
|
13247
13257
|
disabled,
|
|
13248
13258
|
...props,
|
|
13249
13259
|
children: [
|
|
13250
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13260
|
+
isLoading && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13251
13261
|
children
|
|
13252
13262
|
]
|
|
13253
13263
|
}
|
|
@@ -13324,8 +13334,6 @@ var EmbedButton = dt(Button2)`
|
|
|
13324
13334
|
font-family: "Public Sans", sans-serif;
|
|
13325
13335
|
font-weight: 500;
|
|
13326
13336
|
text-align: center;
|
|
13327
|
-
width: 100%;
|
|
13328
|
-
padding: 0;
|
|
13329
13337
|
|
|
13330
13338
|
${({ disabled, $color = "primary", theme }) => {
|
|
13331
13339
|
const { l: l2 } = hexToHSL(theme[$color]);
|
|
@@ -13455,6 +13463,38 @@ var EmbedButton = dt(Button2)`
|
|
|
13455
13463
|
`;
|
|
13456
13464
|
}
|
|
13457
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
|
+
}}
|
|
13458
13498
|
`;
|
|
13459
13499
|
|
|
13460
13500
|
// src/components/ui/flex/styles.ts
|
|
@@ -14193,7 +14233,7 @@ var Root = (0, import_react20.forwardRef)(
|
|
|
14193
14233
|
Root.displayName = "Root";
|
|
14194
14234
|
|
|
14195
14235
|
// src/components/layout/viewport/Viewport.tsx
|
|
14196
|
-
var
|
|
14236
|
+
var import_react29 = require("react");
|
|
14197
14237
|
var import_react_dom2 = require("react-dom");
|
|
14198
14238
|
|
|
14199
14239
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
@@ -14301,11 +14341,11 @@ var Navigation = ({
|
|
|
14301
14341
|
] });
|
|
14302
14342
|
};
|
|
14303
14343
|
|
|
14304
|
-
// src/components/shared/
|
|
14344
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14305
14345
|
var import_react21 = require("react");
|
|
14306
14346
|
var import_pluralize = __toESM(require_pluralize());
|
|
14307
14347
|
|
|
14308
|
-
// src/components/shared/
|
|
14348
|
+
// src/components/shared/sidebar/StageButton.tsx
|
|
14309
14349
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
14310
14350
|
var StageButton = ({
|
|
14311
14351
|
canTrial,
|
|
@@ -14496,7 +14536,7 @@ var StageButton = ({
|
|
|
14496
14536
|
}
|
|
14497
14537
|
};
|
|
14498
14538
|
|
|
14499
|
-
// src/components/shared/
|
|
14539
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14500
14540
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
14501
14541
|
var Sidebar = ({
|
|
14502
14542
|
addOns,
|
|
@@ -14519,11 +14559,12 @@ var Sidebar = ({
|
|
|
14519
14559
|
showPaymentForm,
|
|
14520
14560
|
toggleLoading,
|
|
14521
14561
|
updatePromoCode,
|
|
14522
|
-
usageBasedEntitlements
|
|
14562
|
+
usageBasedEntitlements,
|
|
14563
|
+
showHeader = true
|
|
14523
14564
|
}) => {
|
|
14524
14565
|
const { t: t2 } = useTranslation();
|
|
14525
14566
|
const theme = nt();
|
|
14526
|
-
const { api, data, mode, setLayout } = useEmbed();
|
|
14567
|
+
const { api, data, mode, layout, setLayout } = useEmbed();
|
|
14527
14568
|
const isLightBackground = useIsLightBackground();
|
|
14528
14569
|
const payInAdvanceEntitlements = usageBasedEntitlements.filter(
|
|
14529
14570
|
({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
|
|
@@ -14532,27 +14573,28 @@ var Sidebar = ({
|
|
|
14532
14573
|
({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
|
|
14533
14574
|
);
|
|
14534
14575
|
const subscriptionPrice = (0, import_react21.useMemo)(() => {
|
|
14535
|
-
|
|
14576
|
+
const plan = selectedPlan || currentPlan;
|
|
14577
|
+
if (!plan || !plan.monthlyPrice || !plan.yearlyPrice) {
|
|
14536
14578
|
return;
|
|
14537
14579
|
}
|
|
14538
14580
|
let total = 0;
|
|
14539
|
-
const planPrice = (planPeriod === "month" ?
|
|
14540
|
-
const currency = (planPeriod === "month" ?
|
|
14581
|
+
const planPrice = (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price;
|
|
14582
|
+
const currency = (planPeriod === "month" ? plan?.monthlyPrice : plan?.yearlyPrice)?.currency;
|
|
14541
14583
|
if (planPrice) {
|
|
14542
14584
|
total += planPrice;
|
|
14543
14585
|
}
|
|
14544
14586
|
const addOnCost = addOns.reduce(
|
|
14545
|
-
(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),
|
|
14546
14588
|
0
|
|
14547
14589
|
);
|
|
14548
14590
|
total += addOnCost;
|
|
14549
14591
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
14550
|
-
(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),
|
|
14551
14593
|
0
|
|
14552
14594
|
);
|
|
14553
14595
|
total += payInAdvanceCost;
|
|
14554
14596
|
return formatCurrency(total, currency);
|
|
14555
|
-
}, [selectedPlan, addOns, payInAdvanceEntitlements
|
|
14597
|
+
}, [selectedPlan, currentPlan, planPeriod, addOns, payInAdvanceEntitlements]);
|
|
14556
14598
|
const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = (0, import_react21.useMemo)(() => {
|
|
14557
14599
|
return {
|
|
14558
14600
|
amountOff: charges?.amountOff ?? 0,
|
|
@@ -14625,8 +14667,23 @@ var Sidebar = ({
|
|
|
14625
14667
|
payInAdvanceEntitlements,
|
|
14626
14668
|
promoCode
|
|
14627
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]);
|
|
14628
14685
|
const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
|
|
14629
|
-
const willPlanChange = typeof selectedPlan !== "undefined" && selectedPlan.current
|
|
14686
|
+
const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
|
|
14630
14687
|
const canUpdateSubscription = mode === "edit" || api !== null && (willPlanChange || // TODO: test add-on comparison for finding "changes"
|
|
14631
14688
|
selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
|
|
14632
14689
|
(addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
|
|
@@ -14706,7 +14763,7 @@ var Sidebar = ({
|
|
|
14706
14763
|
}
|
|
14707
14764
|
},
|
|
14708
14765
|
children: [
|
|
14709
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
14766
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
14710
14767
|
Flex,
|
|
14711
14768
|
{
|
|
14712
14769
|
$position: "relative",
|
|
@@ -15456,7 +15513,7 @@ var Sidebar = ({
|
|
|
15456
15513
|
]
|
|
15457
15514
|
}
|
|
15458
15515
|
),
|
|
15459
|
-
|
|
15516
|
+
subscriptionPrice && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
15460
15517
|
Flex,
|
|
15461
15518
|
{
|
|
15462
15519
|
$justifyContent: "space-between",
|
|
@@ -15559,11 +15616,11 @@ var Sidebar = ({
|
|
|
15559
15616
|
}
|
|
15560
15617
|
) })
|
|
15561
15618
|
] }),
|
|
15562
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15619
|
+
layout === "checkout" && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15563
15620
|
StageButton,
|
|
15564
15621
|
{
|
|
15565
15622
|
canTrial: selectedPlan?.companyCanTrial === true,
|
|
15566
|
-
canCheckout
|
|
15623
|
+
canCheckout,
|
|
15567
15624
|
canUpdateSubscription,
|
|
15568
15625
|
checkout,
|
|
15569
15626
|
checkoutStage,
|
|
@@ -15576,6 +15633,16 @@ var Sidebar = ({
|
|
|
15576
15633
|
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
15577
15634
|
}
|
|
15578
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
|
+
),
|
|
15579
15646
|
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
15580
15647
|
Text,
|
|
15581
15648
|
{
|
|
@@ -15586,7 +15653,7 @@ var Sidebar = ({
|
|
|
15586
15653
|
children: error
|
|
15587
15654
|
}
|
|
15588
15655
|
) }),
|
|
15589
|
-
/* @__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)(
|
|
15590
15657
|
Text,
|
|
15591
15658
|
{
|
|
15592
15659
|
$font: theme.typography.text.fontFamily,
|
|
@@ -16681,7 +16748,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16681
16748
|
),
|
|
16682
16749
|
[usageBasedEntitlements]
|
|
16683
16750
|
);
|
|
16684
|
-
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected
|
|
16751
|
+
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
|
|
16685
16752
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16686
16753
|
({ quantity }) => quantity > 0
|
|
16687
16754
|
);
|
|
@@ -17291,20 +17358,234 @@ var PeriodToggle = ({
|
|
|
17291
17358
|
);
|
|
17292
17359
|
};
|
|
17293
17360
|
|
|
17294
|
-
// src/components/
|
|
17361
|
+
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
17362
|
+
var import_react27 = require("react");
|
|
17295
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");
|
|
17296
17577
|
var Badge = () => {
|
|
17297
17578
|
const { t: t2 } = useTranslation();
|
|
17298
17579
|
const { settings } = useEmbed();
|
|
17299
|
-
return /* @__PURE__ */ (0,
|
|
17580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
17300
17581
|
Flex,
|
|
17301
17582
|
{
|
|
17302
17583
|
$justifyContent: settings.badge?.alignment || "start",
|
|
17303
17584
|
$alignItems: "center",
|
|
17304
17585
|
$gridColumn: "1 / -1",
|
|
17305
17586
|
children: [
|
|
17306
|
-
/* @__PURE__ */ (0,
|
|
17307
|
-
/* @__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)(
|
|
17308
17589
|
"svg",
|
|
17309
17590
|
{
|
|
17310
17591
|
width: 86,
|
|
@@ -17312,77 +17593,77 @@ var Badge = () => {
|
|
|
17312
17593
|
viewBox: "0 0 86 16",
|
|
17313
17594
|
style: { marginTop: "0.125rem" },
|
|
17314
17595
|
children: [
|
|
17315
|
-
/* @__PURE__ */ (0,
|
|
17596
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17316
17597
|
"path",
|
|
17317
17598
|
{
|
|
17318
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",
|
|
17319
17600
|
fill: "currentColor"
|
|
17320
17601
|
}
|
|
17321
17602
|
),
|
|
17322
|
-
/* @__PURE__ */ (0,
|
|
17603
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17323
17604
|
"path",
|
|
17324
17605
|
{
|
|
17325
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",
|
|
17326
17607
|
fill: "currentColor"
|
|
17327
17608
|
}
|
|
17328
17609
|
),
|
|
17329
|
-
/* @__PURE__ */ (0,
|
|
17610
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17330
17611
|
"path",
|
|
17331
17612
|
{
|
|
17332
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",
|
|
17333
17614
|
fill: "currentColor"
|
|
17334
17615
|
}
|
|
17335
17616
|
),
|
|
17336
|
-
/* @__PURE__ */ (0,
|
|
17617
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17337
17618
|
"path",
|
|
17338
17619
|
{
|
|
17339
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",
|
|
17340
17621
|
fill: "currentColor"
|
|
17341
17622
|
}
|
|
17342
17623
|
),
|
|
17343
|
-
/* @__PURE__ */ (0,
|
|
17624
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17344
17625
|
"path",
|
|
17345
17626
|
{
|
|
17346
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",
|
|
17347
17628
|
fill: "currentColor"
|
|
17348
17629
|
}
|
|
17349
17630
|
),
|
|
17350
|
-
/* @__PURE__ */ (0,
|
|
17631
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17351
17632
|
"path",
|
|
17352
17633
|
{
|
|
17353
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",
|
|
17354
17635
|
fill: "currentColor"
|
|
17355
17636
|
}
|
|
17356
17637
|
),
|
|
17357
|
-
/* @__PURE__ */ (0,
|
|
17638
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17358
17639
|
"path",
|
|
17359
17640
|
{
|
|
17360
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",
|
|
17361
17642
|
fill: "currentColor"
|
|
17362
17643
|
}
|
|
17363
17644
|
),
|
|
17364
|
-
/* @__PURE__ */ (0,
|
|
17645
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17365
17646
|
"path",
|
|
17366
17647
|
{
|
|
17367
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",
|
|
17368
17649
|
fill: "currentColor"
|
|
17369
17650
|
}
|
|
17370
17651
|
),
|
|
17371
|
-
/* @__PURE__ */ (0,
|
|
17652
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17372
17653
|
"path",
|
|
17373
17654
|
{
|
|
17374
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",
|
|
17375
17656
|
fill: "currentColor"
|
|
17376
17657
|
}
|
|
17377
17658
|
),
|
|
17378
|
-
/* @__PURE__ */ (0,
|
|
17659
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17379
17660
|
"path",
|
|
17380
17661
|
{
|
|
17381
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",
|
|
17382
17663
|
fill: "currentColor"
|
|
17383
17664
|
}
|
|
17384
17665
|
),
|
|
17385
|
-
/* @__PURE__ */ (0,
|
|
17666
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
17386
17667
|
"path",
|
|
17387
17668
|
{
|
|
17388
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",
|
|
@@ -17398,11 +17679,11 @@ var Badge = () => {
|
|
|
17398
17679
|
};
|
|
17399
17680
|
|
|
17400
17681
|
// src/components/layout/RenderLayout.tsx
|
|
17401
|
-
var
|
|
17402
|
-
var
|
|
17682
|
+
var import_react28 = require("react");
|
|
17683
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
17403
17684
|
var Disabled = () => {
|
|
17404
17685
|
const theme = nt();
|
|
17405
|
-
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)(
|
|
17406
17687
|
Element,
|
|
17407
17688
|
{
|
|
17408
17689
|
as: Flex,
|
|
@@ -17411,7 +17692,7 @@ var Disabled = () => {
|
|
|
17411
17692
|
$alignItems: "center",
|
|
17412
17693
|
$whiteSpace: "nowrap",
|
|
17413
17694
|
children: [
|
|
17414
|
-
/* @__PURE__ */ (0,
|
|
17695
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17415
17696
|
Text,
|
|
17416
17697
|
{
|
|
17417
17698
|
as: "h1",
|
|
@@ -17422,7 +17703,7 @@ var Disabled = () => {
|
|
|
17422
17703
|
children: "Portal not found"
|
|
17423
17704
|
}
|
|
17424
17705
|
) }),
|
|
17425
|
-
/* @__PURE__ */ (0,
|
|
17706
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17426
17707
|
Text,
|
|
17427
17708
|
{
|
|
17428
17709
|
as: "p",
|
|
@@ -17440,19 +17721,19 @@ var Disabled = () => {
|
|
|
17440
17721
|
var Success = () => {
|
|
17441
17722
|
const theme = nt();
|
|
17442
17723
|
const { hydrate, data, api, setLayout, isPending } = useEmbed();
|
|
17443
|
-
const [isOpen, setIsOpen] = (0,
|
|
17444
|
-
(0,
|
|
17724
|
+
const [isOpen, setIsOpen] = (0, import_react28.useState)(true);
|
|
17725
|
+
(0, import_react28.useEffect)(() => {
|
|
17445
17726
|
if (api && data.component?.id) {
|
|
17446
17727
|
hydrate();
|
|
17447
17728
|
setTimeout(() => setIsOpen(false), 2e3);
|
|
17448
17729
|
}
|
|
17449
17730
|
}, [api, data.component?.id, hydrate]);
|
|
17450
|
-
(0,
|
|
17731
|
+
(0, import_react28.useEffect)(() => {
|
|
17451
17732
|
if (!isPending && !isOpen) {
|
|
17452
17733
|
setLayout("portal");
|
|
17453
17734
|
}
|
|
17454
17735
|
}, [isPending, isOpen, setLayout]);
|
|
17455
|
-
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)(
|
|
17456
17737
|
Element,
|
|
17457
17738
|
{
|
|
17458
17739
|
as: Flex,
|
|
@@ -17461,7 +17742,7 @@ var Success = () => {
|
|
|
17461
17742
|
$alignItems: "center",
|
|
17462
17743
|
$whiteSpace: "nowrap",
|
|
17463
17744
|
children: [
|
|
17464
|
-
/* @__PURE__ */ (0,
|
|
17745
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17465
17746
|
IconRound,
|
|
17466
17747
|
{
|
|
17467
17748
|
name: "check",
|
|
@@ -17469,7 +17750,7 @@ var Success = () => {
|
|
|
17469
17750
|
colors: [theme.card.background, theme.primary]
|
|
17470
17751
|
}
|
|
17471
17752
|
) }),
|
|
17472
|
-
/* @__PURE__ */ (0,
|
|
17753
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17473
17754
|
Text,
|
|
17474
17755
|
{
|
|
17475
17756
|
as: "h1",
|
|
@@ -17480,7 +17761,7 @@ var Success = () => {
|
|
|
17480
17761
|
children: "Subscription updated!"
|
|
17481
17762
|
}
|
|
17482
17763
|
) }),
|
|
17483
|
-
/* @__PURE__ */ (0,
|
|
17764
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
17484
17765
|
Text,
|
|
17485
17766
|
{
|
|
17486
17767
|
as: "p",
|
|
@@ -17499,9 +17780,9 @@ var RenderLayout = ({ children }) => {
|
|
|
17499
17780
|
const { layout } = useEmbed();
|
|
17500
17781
|
switch (layout) {
|
|
17501
17782
|
case "disabled":
|
|
17502
|
-
return /* @__PURE__ */ (0,
|
|
17783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Disabled, {});
|
|
17503
17784
|
case "success":
|
|
17504
|
-
return /* @__PURE__ */ (0,
|
|
17785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Success, {});
|
|
17505
17786
|
default:
|
|
17506
17787
|
return children;
|
|
17507
17788
|
}
|
|
@@ -17526,14 +17807,14 @@ var StyledViewport = dt(Box).attrs(({ theme }) => ({
|
|
|
17526
17807
|
`;
|
|
17527
17808
|
|
|
17528
17809
|
// src/components/layout/viewport/Viewport.tsx
|
|
17529
|
-
var
|
|
17530
|
-
var Viewport = (0,
|
|
17810
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
17811
|
+
var Viewport = (0, import_react29.forwardRef)(
|
|
17531
17812
|
({ children, portal, ...props }, ref) => {
|
|
17532
17813
|
const { data, layout } = useEmbed();
|
|
17533
|
-
const [top, setTop] = (0,
|
|
17814
|
+
const [top, setTop] = (0, import_react29.useState)(0);
|
|
17534
17815
|
const canCheckout = data.capabilities?.checkout ?? true;
|
|
17535
|
-
(0,
|
|
17536
|
-
if (layout !== "checkout") {
|
|
17816
|
+
(0, import_react29.useLayoutEffect)(() => {
|
|
17817
|
+
if (layout !== "checkout" && layout !== "unsubscribe") {
|
|
17537
17818
|
return;
|
|
17538
17819
|
}
|
|
17539
17820
|
const parent = portal || document.body;
|
|
@@ -17546,22 +17827,23 @@ var Viewport = (0, import_react28.forwardRef)(
|
|
|
17546
17827
|
parent.style.overflow = "";
|
|
17547
17828
|
};
|
|
17548
17829
|
}, [layout, portal]);
|
|
17549
|
-
return /* @__PURE__ */ (0,
|
|
17550
|
-
/* @__PURE__ */ (0,
|
|
17551
|
-
/* @__PURE__ */ (0,
|
|
17552
|
-
/* @__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, {})
|
|
17553
17834
|
] }),
|
|
17554
|
-
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)
|
|
17555
17837
|
] });
|
|
17556
17838
|
}
|
|
17557
17839
|
);
|
|
17558
17840
|
Viewport.displayName = "Viewport";
|
|
17559
17841
|
|
|
17560
17842
|
// src/components/layout/column/Column.tsx
|
|
17561
|
-
var
|
|
17843
|
+
var import_react31 = require("react");
|
|
17562
17844
|
|
|
17563
17845
|
// src/components/layout/card/Card.tsx
|
|
17564
|
-
var
|
|
17846
|
+
var import_react30 = require("react");
|
|
17565
17847
|
|
|
17566
17848
|
// src/components/layout/card/styles.ts
|
|
17567
17849
|
var Element = dt(Box)``;
|
|
@@ -17604,10 +17886,10 @@ var StyledCard = dt.div(({ theme }) => {
|
|
|
17604
17886
|
});
|
|
17605
17887
|
|
|
17606
17888
|
// src/components/layout/card/Card.tsx
|
|
17607
|
-
var
|
|
17608
|
-
var Card = (0,
|
|
17889
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
17890
|
+
var Card = (0, import_react30.forwardRef)(
|
|
17609
17891
|
({ children, className }, ref) => {
|
|
17610
|
-
return /* @__PURE__ */ (0,
|
|
17892
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StyledCard, { ref, className, children });
|
|
17611
17893
|
}
|
|
17612
17894
|
);
|
|
17613
17895
|
Card.displayName = "Card";
|
|
@@ -17618,18 +17900,18 @@ var StyledColumn = dt.div`
|
|
|
17618
17900
|
`;
|
|
17619
17901
|
|
|
17620
17902
|
// src/components/layout/column/Column.tsx
|
|
17621
|
-
var
|
|
17622
|
-
var Column = (0,
|
|
17903
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
17904
|
+
var Column = (0, import_react31.forwardRef)(
|
|
17623
17905
|
({ children, basis, ...props }, ref) => {
|
|
17624
|
-
return /* @__PURE__ */ (0,
|
|
17906
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(StyledColumn, { ref, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Card, { children }) });
|
|
17625
17907
|
}
|
|
17626
17908
|
);
|
|
17627
17909
|
Column.displayName = "Column";
|
|
17628
17910
|
|
|
17629
17911
|
// src/components/elements/included-features/Details.tsx
|
|
17630
|
-
var
|
|
17912
|
+
var import_react32 = require("react");
|
|
17631
17913
|
var import_pluralize4 = __toESM(require_pluralize());
|
|
17632
|
-
var
|
|
17914
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
17633
17915
|
var Details = ({
|
|
17634
17916
|
details,
|
|
17635
17917
|
shouldWrapChildren,
|
|
@@ -17647,7 +17929,7 @@ var Details = ({
|
|
|
17647
17929
|
const { t: t2 } = useTranslation();
|
|
17648
17930
|
const theme = nt();
|
|
17649
17931
|
const { data } = useEmbed();
|
|
17650
|
-
const currency = (0,
|
|
17932
|
+
const currency = (0, import_react32.useMemo)(() => {
|
|
17651
17933
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17652
17934
|
return monthlyUsageBasedPrice?.currency;
|
|
17653
17935
|
}
|
|
@@ -17659,7 +17941,7 @@ var Details = ({
|
|
|
17659
17941
|
monthlyUsageBasedPrice,
|
|
17660
17942
|
yearlyUsageBasedPrice
|
|
17661
17943
|
]);
|
|
17662
|
-
const price = (0,
|
|
17944
|
+
const price = (0, import_react32.useMemo)(() => {
|
|
17663
17945
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17664
17946
|
return monthlyUsageBasedPrice?.price;
|
|
17665
17947
|
}
|
|
@@ -17671,7 +17953,7 @@ var Details = ({
|
|
|
17671
17953
|
monthlyUsageBasedPrice,
|
|
17672
17954
|
yearlyUsageBasedPrice
|
|
17673
17955
|
]);
|
|
17674
|
-
const text = (0,
|
|
17956
|
+
const text = (0, import_react32.useMemo)(() => {
|
|
17675
17957
|
if (!feature?.name) {
|
|
17676
17958
|
return;
|
|
17677
17959
|
}
|
|
@@ -17688,7 +17970,7 @@ var Details = ({
|
|
|
17688
17970
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17689
17971
|
}
|
|
17690
17972
|
}, [allocation, feature?.name, price, priceBehavior, t2, currency]);
|
|
17691
|
-
const usageText = (0,
|
|
17973
|
+
const usageText = (0, import_react32.useMemo)(() => {
|
|
17692
17974
|
if (!feature?.name) {
|
|
17693
17975
|
return;
|
|
17694
17976
|
}
|
|
@@ -17730,14 +18012,14 @@ var Details = ({
|
|
|
17730
18012
|
if (!text) {
|
|
17731
18013
|
return null;
|
|
17732
18014
|
}
|
|
17733
|
-
return /* @__PURE__ */ (0,
|
|
18015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
17734
18016
|
Box,
|
|
17735
18017
|
{
|
|
17736
18018
|
$flexBasis: "min-content",
|
|
17737
18019
|
$flexGrow: "1",
|
|
17738
18020
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
17739
18021
|
children: [
|
|
17740
|
-
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)(
|
|
17741
18023
|
Text,
|
|
17742
18024
|
{
|
|
17743
18025
|
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
@@ -17748,7 +18030,7 @@ var Details = ({
|
|
|
17748
18030
|
children: text
|
|
17749
18031
|
}
|
|
17750
18032
|
) }),
|
|
17751
|
-
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)(
|
|
17752
18034
|
Text,
|
|
17753
18035
|
{
|
|
17754
18036
|
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
@@ -17765,7 +18047,7 @@ var Details = ({
|
|
|
17765
18047
|
};
|
|
17766
18048
|
|
|
17767
18049
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
17768
|
-
var
|
|
18050
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
17769
18051
|
function resolveDesignProps(props) {
|
|
17770
18052
|
return {
|
|
17771
18053
|
header: {
|
|
@@ -17794,15 +18076,15 @@ function resolveDesignProps(props) {
|
|
|
17794
18076
|
visibleFeatures: props.visibleFeatures
|
|
17795
18077
|
};
|
|
17796
18078
|
}
|
|
17797
|
-
var IncludedFeatures = (0,
|
|
18079
|
+
var IncludedFeatures = (0, import_react33.forwardRef)(({ className, ...rest }, ref) => {
|
|
17798
18080
|
const props = resolveDesignProps(rest);
|
|
17799
18081
|
const { t: t2 } = useTranslation();
|
|
17800
18082
|
const theme = nt();
|
|
17801
18083
|
const { data } = useEmbed();
|
|
17802
|
-
const elements = (0,
|
|
18084
|
+
const elements = (0, import_react33.useRef)([]);
|
|
17803
18085
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
17804
18086
|
const isLightBackground = useIsLightBackground();
|
|
17805
|
-
const [showCount, setShowCount] = (0,
|
|
18087
|
+
const [showCount, setShowCount] = (0, import_react33.useState)(VISIBLE_ENTITLEMENT_COUNT);
|
|
17806
18088
|
const entitlements = (props.visibleFeatures ? props.visibleFeatures : data.featureUsage?.features.sort((a2, b2) => {
|
|
17807
18089
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
17808
18090
|
return 1;
|
|
@@ -17846,7 +18128,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17846
18128
|
}
|
|
17847
18129
|
const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
|
|
17848
18130
|
const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
|
|
17849
|
-
return /* @__PURE__ */ (0,
|
|
18131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17850
18132
|
Element,
|
|
17851
18133
|
{
|
|
17852
18134
|
as: Flex,
|
|
@@ -17855,7 +18137,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17855
18137
|
$flexDirection: "column",
|
|
17856
18138
|
$gap: "1rem",
|
|
17857
18139
|
children: [
|
|
17858
|
-
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)(
|
|
17859
18141
|
Text,
|
|
17860
18142
|
{
|
|
17861
18143
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -17868,7 +18150,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17868
18150
|
entitlements.slice(0, showCount).map((entitlement, index) => {
|
|
17869
18151
|
const { entitlementExpirationDate, feature } = entitlement.featureUsage || {};
|
|
17870
18152
|
const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
|
|
17871
|
-
return /* @__PURE__ */ (0,
|
|
18153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17872
18154
|
Flex,
|
|
17873
18155
|
{
|
|
17874
18156
|
ref: (el) => {
|
|
@@ -17881,7 +18163,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17881
18163
|
$alignItems: "center",
|
|
17882
18164
|
$gap: "1rem",
|
|
17883
18165
|
children: [
|
|
17884
|
-
/* @__PURE__ */ (0,
|
|
18166
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17885
18167
|
Flex,
|
|
17886
18168
|
{
|
|
17887
18169
|
$alignItems: "center",
|
|
@@ -17889,7 +18171,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17889
18171
|
$flexBasis: "min-content",
|
|
17890
18172
|
$gap: "1rem",
|
|
17891
18173
|
children: [
|
|
17892
|
-
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0,
|
|
18174
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17893
18175
|
IconRound,
|
|
17894
18176
|
{
|
|
17895
18177
|
name: feature.icon,
|
|
@@ -17900,7 +18182,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17900
18182
|
]
|
|
17901
18183
|
}
|
|
17902
18184
|
),
|
|
17903
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18185
|
+
feature?.name && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17904
18186
|
Text,
|
|
17905
18187
|
{
|
|
17906
18188
|
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
@@ -17910,7 +18192,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17910
18192
|
children: feature.name
|
|
17911
18193
|
}
|
|
17912
18194
|
),
|
|
17913
|
-
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ (0,
|
|
18195
|
+
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
17914
18196
|
Text,
|
|
17915
18197
|
{
|
|
17916
18198
|
$font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
|
|
@@ -17930,7 +18212,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17930
18212
|
]
|
|
17931
18213
|
}
|
|
17932
18214
|
),
|
|
17933
|
-
shouldShowDetails && /* @__PURE__ */ (0,
|
|
18215
|
+
shouldShowDetails && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17934
18216
|
Details,
|
|
17935
18217
|
{
|
|
17936
18218
|
details: entitlement,
|
|
@@ -17943,8 +18225,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17943
18225
|
index
|
|
17944
18226
|
);
|
|
17945
18227
|
}),
|
|
17946
|
-
shouldShowExpand && /* @__PURE__ */ (0,
|
|
17947
|
-
/* @__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)(
|
|
17948
18230
|
Icon2,
|
|
17949
18231
|
{
|
|
17950
18232
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -17956,7 +18238,7 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17956
18238
|
}
|
|
17957
18239
|
}
|
|
17958
18240
|
),
|
|
17959
|
-
/* @__PURE__ */ (0,
|
|
18241
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
17960
18242
|
Text,
|
|
17961
18243
|
{
|
|
17962
18244
|
onClick: handleToggleShowAll,
|
|
@@ -17977,8 +18259,8 @@ var IncludedFeatures = (0, import_react32.forwardRef)(({ className, ...rest }, r
|
|
|
17977
18259
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
17978
18260
|
|
|
17979
18261
|
// src/components/elements/invoices/Invoices.tsx
|
|
17980
|
-
var
|
|
17981
|
-
var
|
|
18262
|
+
var import_react34 = require("react");
|
|
18263
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
17982
18264
|
function resolveDesignProps2(props) {
|
|
17983
18265
|
return {
|
|
17984
18266
|
header: {
|
|
@@ -18014,7 +18296,7 @@ function formatInvoices(invoices) {
|
|
|
18014
18296
|
}
|
|
18015
18297
|
var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
18016
18298
|
const theme = nt();
|
|
18017
|
-
const dateText = /* @__PURE__ */ (0,
|
|
18299
|
+
const dateText = /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18018
18300
|
Text,
|
|
18019
18301
|
{
|
|
18020
18302
|
...url && { onClick: () => {
|
|
@@ -18027,23 +18309,23 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
|
18027
18309
|
}
|
|
18028
18310
|
);
|
|
18029
18311
|
if (url) {
|
|
18030
|
-
return /* @__PURE__ */ (0,
|
|
18312
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
|
|
18031
18313
|
}
|
|
18032
18314
|
return dateText;
|
|
18033
18315
|
};
|
|
18034
|
-
var Invoices = (0,
|
|
18316
|
+
var Invoices = (0, import_react34.forwardRef)(({ className, data, ...rest }, ref) => {
|
|
18035
18317
|
const props = resolveDesignProps2(rest);
|
|
18036
18318
|
const { t: t2 } = useTranslation();
|
|
18037
18319
|
const theme = nt();
|
|
18038
18320
|
const { api } = useEmbed();
|
|
18039
|
-
const [invoices, setInvoices] = (0,
|
|
18040
|
-
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);
|
|
18041
18323
|
const toggleListSize = () => {
|
|
18042
18324
|
setListSize(
|
|
18043
18325
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
18044
18326
|
);
|
|
18045
18327
|
};
|
|
18046
|
-
(0,
|
|
18328
|
+
(0, import_react34.useEffect)(() => {
|
|
18047
18329
|
api?.listInvoices().then(({ data: data2 }) => {
|
|
18048
18330
|
setInvoices(formatInvoices(data2));
|
|
18049
18331
|
});
|
|
@@ -18051,8 +18333,8 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18051
18333
|
if (invoices.length === 0) {
|
|
18052
18334
|
return null;
|
|
18053
18335
|
}
|
|
18054
|
-
return /* @__PURE__ */ (0,
|
|
18055
|
-
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)(
|
|
18056
18338
|
Text,
|
|
18057
18339
|
{
|
|
18058
18340
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18062,9 +18344,9 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18062
18344
|
children: t2("Invoices")
|
|
18063
18345
|
}
|
|
18064
18346
|
) }),
|
|
18065
|
-
/* @__PURE__ */ (0,
|
|
18066
|
-
return /* @__PURE__ */ (0,
|
|
18067
|
-
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)(
|
|
18068
18350
|
InvoiceDate,
|
|
18069
18351
|
{
|
|
18070
18352
|
date,
|
|
@@ -18072,7 +18354,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18072
18354
|
url
|
|
18073
18355
|
}
|
|
18074
18356
|
),
|
|
18075
|
-
props.amount.isVisible && /* @__PURE__ */ (0,
|
|
18357
|
+
props.amount.isVisible && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18076
18358
|
Text,
|
|
18077
18359
|
{
|
|
18078
18360
|
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
|
@@ -18084,15 +18366,15 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18084
18366
|
)
|
|
18085
18367
|
] }, index);
|
|
18086
18368
|
}) }),
|
|
18087
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ (0,
|
|
18088
|
-
/* @__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)(
|
|
18089
18371
|
Icon2,
|
|
18090
18372
|
{
|
|
18091
18373
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
18092
18374
|
style: { color: "#D0D0D0" }
|
|
18093
18375
|
}
|
|
18094
18376
|
),
|
|
18095
|
-
/* @__PURE__ */ (0,
|
|
18377
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
18096
18378
|
Text,
|
|
18097
18379
|
{
|
|
18098
18380
|
onClick: toggleListSize,
|
|
@@ -18109,7 +18391,7 @@ var Invoices = (0, import_react33.forwardRef)(({ className, data, ...rest }, ref
|
|
|
18109
18391
|
Invoices.displayName = "Invoices";
|
|
18110
18392
|
|
|
18111
18393
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18112
|
-
var
|
|
18394
|
+
var import_react35 = require("react");
|
|
18113
18395
|
var import_pluralize5 = __toESM(require_pluralize());
|
|
18114
18396
|
|
|
18115
18397
|
// src/components/elements/metered-features/styles.ts
|
|
@@ -18130,7 +18412,7 @@ var Container4 = dt(Flex)`
|
|
|
18130
18412
|
`;
|
|
18131
18413
|
|
|
18132
18414
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18133
|
-
var
|
|
18415
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
18134
18416
|
function resolveDesignProps3(props) {
|
|
18135
18417
|
return {
|
|
18136
18418
|
isVisible: props.isVisible ?? true,
|
|
@@ -18156,9 +18438,9 @@ function resolveDesignProps3(props) {
|
|
|
18156
18438
|
visibleFeatures: props.visibleFeatures
|
|
18157
18439
|
};
|
|
18158
18440
|
}
|
|
18159
|
-
var MeteredFeatures = (0,
|
|
18441
|
+
var MeteredFeatures = (0, import_react35.forwardRef)(({ className, ...rest }, ref) => {
|
|
18160
18442
|
const props = resolveDesignProps3(rest);
|
|
18161
|
-
const elements = (0,
|
|
18443
|
+
const elements = (0, import_react35.useRef)([]);
|
|
18162
18444
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
18163
18445
|
const { t: t2 } = useTranslation();
|
|
18164
18446
|
const theme = nt();
|
|
@@ -18180,7 +18462,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18180
18462
|
if (!shouldShowFeatures) {
|
|
18181
18463
|
return null;
|
|
18182
18464
|
}
|
|
18183
|
-
return /* @__PURE__ */ (0,
|
|
18465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Container4, { ref, className, children: featureUsage.map(
|
|
18184
18466
|
({
|
|
18185
18467
|
allocation,
|
|
18186
18468
|
feature,
|
|
@@ -18199,8 +18481,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18199
18481
|
price = yearlyUsageBasedPrice?.price;
|
|
18200
18482
|
currency = yearlyUsageBasedPrice?.currency;
|
|
18201
18483
|
}
|
|
18202
|
-
return /* @__PURE__ */ (0,
|
|
18203
|
-
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)(
|
|
18204
18486
|
IconRound,
|
|
18205
18487
|
{
|
|
18206
18488
|
name: feature.icon,
|
|
@@ -18211,8 +18493,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18211
18493
|
]
|
|
18212
18494
|
}
|
|
18213
18495
|
),
|
|
18214
|
-
/* @__PURE__ */ (0,
|
|
18215
|
-
/* @__PURE__ */ (0,
|
|
18496
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
|
|
18497
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
18216
18498
|
Flex,
|
|
18217
18499
|
{
|
|
18218
18500
|
ref: (el) => {
|
|
@@ -18223,8 +18505,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18223
18505
|
$flexWrap: "wrap",
|
|
18224
18506
|
$gap: "1rem",
|
|
18225
18507
|
children: [
|
|
18226
|
-
feature?.name && /* @__PURE__ */ (0,
|
|
18227
|
-
/* @__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)(
|
|
18228
18510
|
Text,
|
|
18229
18511
|
{
|
|
18230
18512
|
as: Box,
|
|
@@ -18232,14 +18514,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18232
18514
|
$size: theme.typography[props.header.fontStyle].fontSize,
|
|
18233
18515
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18234
18516
|
$color: theme.typography[props.header.fontStyle].color,
|
|
18235
|
-
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: [
|
|
18236
18518
|
formatNumber(usage),
|
|
18237
18519
|
" ",
|
|
18238
18520
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18239
18521
|
] }) : feature.name
|
|
18240
18522
|
}
|
|
18241
18523
|
),
|
|
18242
|
-
props.description.isVisible && /* @__PURE__ */ (0,
|
|
18524
|
+
props.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18243
18525
|
Text,
|
|
18244
18526
|
{
|
|
18245
18527
|
as: Box,
|
|
@@ -18251,14 +18533,14 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18251
18533
|
}
|
|
18252
18534
|
)
|
|
18253
18535
|
] }),
|
|
18254
|
-
(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)(
|
|
18255
18537
|
Box,
|
|
18256
18538
|
{
|
|
18257
18539
|
$flexBasis: "min-content",
|
|
18258
18540
|
$flexGrow: "1",
|
|
18259
18541
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18260
18542
|
children: [
|
|
18261
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
18543
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18262
18544
|
Text,
|
|
18263
18545
|
{
|
|
18264
18546
|
as: Box,
|
|
@@ -18267,18 +18549,18 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18267
18549
|
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
18268
18550
|
$leading: 1.25,
|
|
18269
18551
|
$color: theme.typography[props.usage.fontStyle].color,
|
|
18270
|
-
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: [
|
|
18271
18553
|
formatNumber(allocation),
|
|
18272
18554
|
" ",
|
|
18273
18555
|
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18274
|
-
] }) : 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: [
|
|
18275
18557
|
formatNumber(usage),
|
|
18276
18558
|
" ",
|
|
18277
18559
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18278
18560
|
] })
|
|
18279
18561
|
}
|
|
18280
18562
|
),
|
|
18281
|
-
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)(
|
|
18282
18564
|
Text,
|
|
18283
18565
|
{
|
|
18284
18566
|
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
@@ -18302,8 +18584,8 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18302
18584
|
]
|
|
18303
18585
|
}
|
|
18304
18586
|
),
|
|
18305
|
-
props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ (0,
|
|
18306
|
-
/* @__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)(
|
|
18307
18589
|
ProgressBar,
|
|
18308
18590
|
{
|
|
18309
18591
|
progress: usage / allocation * 100,
|
|
@@ -18315,7 +18597,7 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18315
18597
|
$flexGrow: "1"
|
|
18316
18598
|
}
|
|
18317
18599
|
),
|
|
18318
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
18600
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
18319
18601
|
EmbedButton,
|
|
18320
18602
|
{
|
|
18321
18603
|
onClick: () => {
|
|
@@ -18338,10 +18620,10 @@ var MeteredFeatures = (0, import_react34.forwardRef)(({ className, ...rest }, re
|
|
|
18338
18620
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
18339
18621
|
|
|
18340
18622
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
18341
|
-
var
|
|
18623
|
+
var import_react36 = require("react");
|
|
18342
18624
|
var import_react_dom3 = require("react-dom");
|
|
18343
18625
|
var import_react_stripe_js3 = require("@stripe/react-stripe-js");
|
|
18344
|
-
var
|
|
18626
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
18345
18627
|
var PaymentElement2 = ({
|
|
18346
18628
|
iconName,
|
|
18347
18629
|
iconTitle,
|
|
@@ -18350,11 +18632,11 @@ var PaymentElement2 = ({
|
|
|
18350
18632
|
paymentLast4
|
|
18351
18633
|
}) => {
|
|
18352
18634
|
const theme = nt();
|
|
18353
|
-
return /* @__PURE__ */ (0,
|
|
18354
|
-
iconName && /* @__PURE__ */ (0,
|
|
18355
|
-
/* @__PURE__ */ (0,
|
|
18356
|
-
/* @__PURE__ */ (0,
|
|
18357
|
-
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 })
|
|
18358
18640
|
] })
|
|
18359
18641
|
] }) }) });
|
|
18360
18642
|
};
|
|
@@ -18452,16 +18734,16 @@ var PaymentMethodElement = ({
|
|
|
18452
18734
|
iconTitle: genericLabel,
|
|
18453
18735
|
label: genericLabel
|
|
18454
18736
|
};
|
|
18455
|
-
return /* @__PURE__ */ (0,
|
|
18737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18456
18738
|
PaymentElement2,
|
|
18457
18739
|
{
|
|
18458
18740
|
...paymentMethodElementProps(iconName, iconTitle, label, paymentLast4)
|
|
18459
18741
|
}
|
|
18460
18742
|
);
|
|
18461
18743
|
};
|
|
18462
|
-
return /* @__PURE__ */ (0,
|
|
18463
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
18464
|
-
/* @__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)(
|
|
18465
18747
|
Text,
|
|
18466
18748
|
{
|
|
18467
18749
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18471,7 +18753,7 @@ var PaymentMethodElement = ({
|
|
|
18471
18753
|
children: t2("Payment Method")
|
|
18472
18754
|
}
|
|
18473
18755
|
),
|
|
18474
|
-
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)(
|
|
18475
18757
|
Text,
|
|
18476
18758
|
{
|
|
18477
18759
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18481,7 +18763,7 @@ var PaymentMethodElement = ({
|
|
|
18481
18763
|
}
|
|
18482
18764
|
)
|
|
18483
18765
|
] }),
|
|
18484
|
-
/* @__PURE__ */ (0,
|
|
18766
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
18485
18767
|
Flex,
|
|
18486
18768
|
{
|
|
18487
18769
|
$justifyContent: "space-between",
|
|
@@ -18491,7 +18773,7 @@ var PaymentMethodElement = ({
|
|
|
18491
18773
|
$borderRadius: "9999px",
|
|
18492
18774
|
children: [
|
|
18493
18775
|
renderPaymentMethodElement(),
|
|
18494
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
18776
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18495
18777
|
Text,
|
|
18496
18778
|
{
|
|
18497
18779
|
onClick: onEdit,
|
|
@@ -18508,24 +18790,24 @@ var PaymentMethodElement = ({
|
|
|
18508
18790
|
)
|
|
18509
18791
|
] });
|
|
18510
18792
|
};
|
|
18511
|
-
var PaymentMethod = (0,
|
|
18793
|
+
var PaymentMethod = (0, import_react36.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
18512
18794
|
const props = resolveDesignProps4(rest);
|
|
18513
18795
|
const { t: t2 } = useTranslation();
|
|
18514
18796
|
const theme = nt();
|
|
18515
18797
|
const { api, data, layout, setLayout } = useEmbed();
|
|
18516
18798
|
const isLightBackground = useIsLightBackground();
|
|
18517
|
-
const [isLoading, setIsLoading] = (0,
|
|
18518
|
-
const [error, setError] = (0,
|
|
18519
|
-
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)(
|
|
18520
18802
|
() => typeof data.subscription?.paymentMethod === "undefined"
|
|
18521
18803
|
);
|
|
18522
|
-
const [stripe, setStripe] = (0,
|
|
18523
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
18524
|
-
const [top, setTop] = (0,
|
|
18525
|
-
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)(() => {
|
|
18526
18808
|
return data.subscription?.paymentMethod;
|
|
18527
18809
|
}, [data.subscription?.paymentMethod]);
|
|
18528
|
-
const monthsToExpiration = (0,
|
|
18810
|
+
const monthsToExpiration = (0, import_react36.useMemo)(() => {
|
|
18529
18811
|
let expiration;
|
|
18530
18812
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
18531
18813
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -18538,7 +18820,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18538
18820
|
}
|
|
18539
18821
|
return expiration;
|
|
18540
18822
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
18541
|
-
const createSetupIntent = (0,
|
|
18823
|
+
const createSetupIntent = (0, import_react36.useCallback)(async () => {
|
|
18542
18824
|
if (!api || !data.component?.id) {
|
|
18543
18825
|
return;
|
|
18544
18826
|
}
|
|
@@ -18557,7 +18839,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18557
18839
|
setIsLoading(false);
|
|
18558
18840
|
}
|
|
18559
18841
|
}, [t2, api, data.component?.id]);
|
|
18560
|
-
const updatePaymentMethod = (0,
|
|
18842
|
+
const updatePaymentMethod = (0, import_react36.useCallback)(
|
|
18561
18843
|
async (id) => {
|
|
18562
18844
|
if (!api || !id) {
|
|
18563
18845
|
return;
|
|
@@ -18578,12 +18860,12 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18578
18860
|
},
|
|
18579
18861
|
[t2, api, setLayout]
|
|
18580
18862
|
);
|
|
18581
|
-
(0,
|
|
18863
|
+
(0, import_react36.useEffect)(() => {
|
|
18582
18864
|
if (!stripe && setupIntent?.publishableKey) {
|
|
18583
18865
|
setStripe(loadStripe(setupIntent.publishableKey));
|
|
18584
18866
|
}
|
|
18585
18867
|
}, [stripe, setupIntent?.publishableKey]);
|
|
18586
|
-
(0,
|
|
18868
|
+
(0, import_react36.useLayoutEffect)(() => {
|
|
18587
18869
|
const parent = portal || document.body;
|
|
18588
18870
|
const value = Math.abs(
|
|
18589
18871
|
(parent === document.body ? window.scrollY : parent.scrollTop) ?? 0
|
|
@@ -18597,8 +18879,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18597
18879
|
if (!paymentMethod?.paymentMethodType) {
|
|
18598
18880
|
return null;
|
|
18599
18881
|
}
|
|
18600
|
-
return /* @__PURE__ */ (0,
|
|
18601
|
-
/* @__PURE__ */ (0,
|
|
18882
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Element, { ref, className, children: [
|
|
18883
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18602
18884
|
PaymentMethodElement,
|
|
18603
18885
|
{
|
|
18604
18886
|
paymentMethod,
|
|
@@ -18608,8 +18890,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18608
18890
|
}
|
|
18609
18891
|
),
|
|
18610
18892
|
layout === "payment" && (0, import_react_dom3.createPortal)(
|
|
18611
|
-
/* @__PURE__ */ (0,
|
|
18612
|
-
/* @__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)(
|
|
18613
18895
|
Text,
|
|
18614
18896
|
{
|
|
18615
18897
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18619,7 +18901,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18619
18901
|
children: t2("Edit payment method")
|
|
18620
18902
|
}
|
|
18621
18903
|
) }),
|
|
18622
|
-
/* @__PURE__ */ (0,
|
|
18904
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18623
18905
|
Flex,
|
|
18624
18906
|
{
|
|
18625
18907
|
$flexDirection: "column",
|
|
@@ -18628,8 +18910,8 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18628
18910
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
|
18629
18911
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
18630
18912
|
$overflow: "auto",
|
|
18631
|
-
children: /* @__PURE__ */ (0,
|
|
18632
|
-
showPaymentForm ? /* @__PURE__ */ (0,
|
|
18913
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(import_jsx_runtime30.Fragment, { children: [
|
|
18914
|
+
showPaymentForm ? /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18633
18915
|
import_react_stripe_js3.Elements,
|
|
18634
18916
|
{
|
|
18635
18917
|
stripe,
|
|
@@ -18658,15 +18940,15 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18658
18940
|
},
|
|
18659
18941
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
18660
18942
|
},
|
|
18661
|
-
children: /* @__PURE__ */ (0,
|
|
18943
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18662
18944
|
PaymentForm,
|
|
18663
18945
|
{
|
|
18664
18946
|
onConfirm: (value) => updatePaymentMethod(value)
|
|
18665
18947
|
}
|
|
18666
18948
|
)
|
|
18667
18949
|
}
|
|
18668
|
-
) : /* @__PURE__ */ (0,
|
|
18669
|
-
/* @__PURE__ */ (0,
|
|
18950
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
18951
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18670
18952
|
PaymentMethodElement,
|
|
18671
18953
|
{
|
|
18672
18954
|
size: "lg",
|
|
@@ -18675,7 +18957,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18675
18957
|
...props
|
|
18676
18958
|
}
|
|
18677
18959
|
),
|
|
18678
|
-
/* @__PURE__ */ (0,
|
|
18960
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18679
18961
|
Text,
|
|
18680
18962
|
{
|
|
18681
18963
|
onClick: createSetupIntent,
|
|
@@ -18687,7 +18969,7 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18687
18969
|
}
|
|
18688
18970
|
) })
|
|
18689
18971
|
] }),
|
|
18690
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
18972
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
18691
18973
|
Text,
|
|
18692
18974
|
{
|
|
18693
18975
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18708,9 +18990,9 @@ var PaymentMethod = (0, import_react35.forwardRef)(({ children, className, porta
|
|
|
18708
18990
|
PaymentMethod.displayName = "PaymentMethod";
|
|
18709
18991
|
|
|
18710
18992
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
18711
|
-
var
|
|
18993
|
+
var import_react37 = require("react");
|
|
18712
18994
|
var import_pluralize6 = __toESM(require_pluralize());
|
|
18713
|
-
var
|
|
18995
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
18714
18996
|
var resolveDesignProps5 = (props) => {
|
|
18715
18997
|
return {
|
|
18716
18998
|
header: {
|
|
@@ -18739,7 +19021,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
18739
19021
|
}
|
|
18740
19022
|
};
|
|
18741
19023
|
};
|
|
18742
|
-
var PlanManager = (0,
|
|
19024
|
+
var PlanManager = (0, import_react37.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
18743
19025
|
const props = resolveDesignProps5(rest);
|
|
18744
19026
|
const theme = nt();
|
|
18745
19027
|
const { t: t2 } = useTranslation();
|
|
@@ -18774,20 +19056,21 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18774
19056
|
const billingSubscription = data.company?.billingSubscription;
|
|
18775
19057
|
const subscriptionCurrency = billingSubscription?.currency;
|
|
18776
19058
|
const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
|
|
19059
|
+
const showUnsubscribeBox = billingSubscription && billingSubscription.status == "cancelled";
|
|
18777
19060
|
const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
18778
19061
|
const todayDate = /* @__PURE__ */ new Date();
|
|
18779
19062
|
const trialEndDays = Math.floor(
|
|
18780
19063
|
(trialEndDate.getTime() - todayDate.getTime()) / (1e3 * 60 * 60 * 24)
|
|
18781
19064
|
);
|
|
18782
|
-
return /* @__PURE__ */ (0,
|
|
18783
|
-
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)(
|
|
18784
19067
|
Box,
|
|
18785
19068
|
{
|
|
18786
19069
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
|
|
18787
19070
|
$textAlign: "center",
|
|
18788
19071
|
$padding: "1rem",
|
|
18789
19072
|
children: [
|
|
18790
|
-
/* @__PURE__ */ (0,
|
|
19073
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18791
19074
|
Text,
|
|
18792
19075
|
{
|
|
18793
19076
|
as: "h3",
|
|
@@ -18798,7 +19081,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18798
19081
|
children: t2("Trial ends in", { days: trialEndDays.toString() })
|
|
18799
19082
|
}
|
|
18800
19083
|
),
|
|
18801
|
-
/* @__PURE__ */ (0,
|
|
19084
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18802
19085
|
Text,
|
|
18803
19086
|
{
|
|
18804
19087
|
as: "p",
|
|
@@ -18816,7 +19099,43 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18816
19099
|
]
|
|
18817
19100
|
}
|
|
18818
19101
|
),
|
|
18819
|
-
/* @__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)(
|
|
18820
19139
|
Element,
|
|
18821
19140
|
{
|
|
18822
19141
|
as: Flex,
|
|
@@ -18825,7 +19144,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18825
19144
|
$flexDirection: "column",
|
|
18826
19145
|
$gap: "2rem",
|
|
18827
19146
|
children: [
|
|
18828
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
19147
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18829
19148
|
Flex,
|
|
18830
19149
|
{
|
|
18831
19150
|
$justifyContent: "space-between",
|
|
@@ -18833,8 +19152,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18833
19152
|
$flexWrap: "wrap",
|
|
18834
19153
|
$gap: "1rem",
|
|
18835
19154
|
children: [
|
|
18836
|
-
/* @__PURE__ */ (0,
|
|
18837
|
-
/* @__PURE__ */ (0,
|
|
19155
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19156
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18838
19157
|
Text,
|
|
18839
19158
|
{
|
|
18840
19159
|
as: Box,
|
|
@@ -18846,7 +19165,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18846
19165
|
children: currentPlan.name
|
|
18847
19166
|
}
|
|
18848
19167
|
),
|
|
18849
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
19168
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18850
19169
|
Text,
|
|
18851
19170
|
{
|
|
18852
19171
|
as: Box,
|
|
@@ -18858,8 +19177,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18858
19177
|
}
|
|
18859
19178
|
)
|
|
18860
19179
|
] }),
|
|
18861
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ (0,
|
|
18862
|
-
/* @__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)(
|
|
18863
19182
|
Text,
|
|
18864
19183
|
{
|
|
18865
19184
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
@@ -18872,14 +19191,14 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18872
19191
|
)
|
|
18873
19192
|
}
|
|
18874
19193
|
),
|
|
18875
|
-
/* @__PURE__ */ (0,
|
|
19194
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18876
19195
|
Text,
|
|
18877
19196
|
{
|
|
18878
19197
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
18879
19198
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
18880
19199
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
18881
19200
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
18882
|
-
children: /* @__PURE__ */ (0,
|
|
19201
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18883
19202
|
"/",
|
|
18884
19203
|
shortenPeriod(currentPlan.planPeriod)
|
|
18885
19204
|
] })
|
|
@@ -18889,8 +19208,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18889
19208
|
]
|
|
18890
19209
|
}
|
|
18891
19210
|
),
|
|
18892
|
-
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0,
|
|
18893
|
-
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)(
|
|
18894
19213
|
Text,
|
|
18895
19214
|
{
|
|
18896
19215
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18901,7 +19220,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18901
19220
|
children: t2("Add-ons")
|
|
18902
19221
|
}
|
|
18903
19222
|
),
|
|
18904
|
-
addOns.map((addOn) => /* @__PURE__ */ (0,
|
|
19223
|
+
addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18905
19224
|
Flex,
|
|
18906
19225
|
{
|
|
18907
19226
|
$justifyContent: "space-between",
|
|
@@ -18909,7 +19228,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18909
19228
|
$flexWrap: "wrap",
|
|
18910
19229
|
$gap: "1rem",
|
|
18911
19230
|
children: [
|
|
18912
|
-
/* @__PURE__ */ (0,
|
|
19231
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18913
19232
|
Text,
|
|
18914
19233
|
{
|
|
18915
19234
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -18919,7 +19238,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18919
19238
|
children: addOn.name
|
|
18920
19239
|
}
|
|
18921
19240
|
),
|
|
18922
|
-
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0,
|
|
19241
|
+
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18923
19242
|
Text,
|
|
18924
19243
|
{
|
|
18925
19244
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18928,7 +19247,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18928
19247
|
$color: theme.typography.text.color,
|
|
18929
19248
|
children: [
|
|
18930
19249
|
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
18931
|
-
/* @__PURE__ */ (0,
|
|
19250
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18932
19251
|
"/",
|
|
18933
19252
|
shortenPeriod(addOn.planPeriod)
|
|
18934
19253
|
] })
|
|
@@ -18940,8 +19259,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18940
19259
|
addOn.id
|
|
18941
19260
|
))
|
|
18942
19261
|
] }),
|
|
18943
|
-
usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
18944
|
-
/* @__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)(
|
|
18945
19264
|
Text,
|
|
18946
19265
|
{
|
|
18947
19266
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18956,7 +19275,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18956
19275
|
(acc, entitlement) => {
|
|
18957
19276
|
if (entitlement.feature?.name) {
|
|
18958
19277
|
acc.push(
|
|
18959
|
-
/* @__PURE__ */ (0,
|
|
19278
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
18960
19279
|
Flex,
|
|
18961
19280
|
{
|
|
18962
19281
|
$justifyContent: "space-between",
|
|
@@ -18964,14 +19283,14 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18964
19283
|
$flexWrap: "wrap",
|
|
18965
19284
|
$gap: "1rem",
|
|
18966
19285
|
children: [
|
|
18967
|
-
/* @__PURE__ */ (0,
|
|
19286
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
18968
19287
|
Text,
|
|
18969
19288
|
{
|
|
18970
19289
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
18971
19290
|
$size: theme.typography[props.addOns.fontStyle].fontSize,
|
|
18972
19291
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
18973
19292
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
18974
|
-
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: [
|
|
18975
19294
|
entitlement.quantity,
|
|
18976
19295
|
" ",
|
|
18977
19296
|
(0, import_pluralize6.default)(
|
|
@@ -18981,8 +19300,8 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18981
19300
|
] }) : entitlement.feature.name
|
|
18982
19301
|
}
|
|
18983
19302
|
),
|
|
18984
|
-
/* @__PURE__ */ (0,
|
|
18985
|
-
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)(
|
|
18986
19305
|
Text,
|
|
18987
19306
|
{
|
|
18988
19307
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18994,7 +19313,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18994
19313
|
entitlement.price,
|
|
18995
19314
|
entitlement.currencyCode
|
|
18996
19315
|
),
|
|
18997
|
-
/* @__PURE__ */ (0,
|
|
19316
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
18998
19317
|
"/",
|
|
18999
19318
|
(0, import_pluralize6.default)(
|
|
19000
19319
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -19006,7 +19325,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19006
19325
|
]
|
|
19007
19326
|
}
|
|
19008
19327
|
),
|
|
19009
|
-
/* @__PURE__ */ (0,
|
|
19328
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19010
19329
|
Text,
|
|
19011
19330
|
{
|
|
19012
19331
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19018,7 +19337,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19018
19337
|
entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
|
|
19019
19338
|
entitlement.currencyCode
|
|
19020
19339
|
),
|
|
19021
|
-
/* @__PURE__ */ (0,
|
|
19340
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("sub", { children: [
|
|
19022
19341
|
"/",
|
|
19023
19342
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
|
|
19024
19343
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -19040,7 +19359,7 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19040
19359
|
[]
|
|
19041
19360
|
)
|
|
19042
19361
|
] }),
|
|
19043
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0,
|
|
19362
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19044
19363
|
EmbedButton,
|
|
19045
19364
|
{
|
|
19046
19365
|
onClick: () => {
|
|
@@ -19064,9 +19383,9 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
19064
19383
|
PlanManager.displayName = "PlanManager";
|
|
19065
19384
|
|
|
19066
19385
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
19067
|
-
var
|
|
19386
|
+
var import_react38 = require("react");
|
|
19068
19387
|
var import_pluralize7 = __toESM(require_pluralize());
|
|
19069
|
-
var
|
|
19388
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
19070
19389
|
var resolveDesignProps6 = (props) => {
|
|
19071
19390
|
return {
|
|
19072
19391
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -19106,18 +19425,18 @@ var resolveDesignProps6 = (props) => {
|
|
|
19106
19425
|
}
|
|
19107
19426
|
};
|
|
19108
19427
|
};
|
|
19109
|
-
var PricingTable = (0,
|
|
19428
|
+
var PricingTable = (0, import_react38.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
19110
19429
|
const props = resolveDesignProps6(rest);
|
|
19111
19430
|
const { t: t2 } = useTranslation();
|
|
19112
19431
|
const theme = nt();
|
|
19113
19432
|
const { data, setLayout, setSelected } = useEmbed();
|
|
19114
19433
|
const trialEndDays = useTrialEnd();
|
|
19115
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
19434
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react38.useState)(
|
|
19116
19435
|
() => data.company?.plan?.planPeriod || "month"
|
|
19117
19436
|
);
|
|
19118
19437
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
19119
19438
|
const isLightBackground = useIsLightBackground();
|
|
19120
|
-
const [entitlementCounts, setEntitlementCounts] = (0,
|
|
19439
|
+
const [entitlementCounts, setEntitlementCounts] = (0, import_react38.useState)(
|
|
19121
19440
|
() => plans.reduce(
|
|
19122
19441
|
(acc, plan) => {
|
|
19123
19442
|
acc[plan.id] = {
|
|
@@ -19144,7 +19463,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19144
19463
|
};
|
|
19145
19464
|
});
|
|
19146
19465
|
};
|
|
19147
|
-
return /* @__PURE__ */ (0,
|
|
19466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19148
19467
|
FussyChild,
|
|
19149
19468
|
{
|
|
19150
19469
|
ref,
|
|
@@ -19153,8 +19472,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19153
19472
|
$flexDirection: "column",
|
|
19154
19473
|
$gap: "2rem",
|
|
19155
19474
|
children: [
|
|
19156
|
-
/* @__PURE__ */ (0,
|
|
19157
|
-
/* @__PURE__ */ (0,
|
|
19475
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19476
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19158
19477
|
Flex,
|
|
19159
19478
|
{
|
|
19160
19479
|
$flexDirection: "column",
|
|
@@ -19169,7 +19488,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19169
19488
|
}
|
|
19170
19489
|
},
|
|
19171
19490
|
children: [
|
|
19172
|
-
/* @__PURE__ */ (0,
|
|
19491
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19173
19492
|
Text,
|
|
19174
19493
|
{
|
|
19175
19494
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19179,7 +19498,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19179
19498
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
19180
19499
|
}
|
|
19181
19500
|
),
|
|
19182
|
-
props.showPeriodToggle && /* @__PURE__ */ (0,
|
|
19501
|
+
props.showPeriodToggle && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19183
19502
|
PeriodToggle,
|
|
19184
19503
|
{
|
|
19185
19504
|
options: periods,
|
|
@@ -19190,7 +19509,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19190
19509
|
]
|
|
19191
19510
|
}
|
|
19192
19511
|
),
|
|
19193
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
19512
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19194
19513
|
Box,
|
|
19195
19514
|
{
|
|
19196
19515
|
$display: "grid",
|
|
@@ -19203,7 +19522,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19203
19522
|
if (count?.limit && count.limit > VISIBLE_ENTITLEMENT_COUNT) {
|
|
19204
19523
|
isExpanded = true;
|
|
19205
19524
|
}
|
|
19206
|
-
return /* @__PURE__ */ (0,
|
|
19525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19207
19526
|
Flex,
|
|
19208
19527
|
{
|
|
19209
19528
|
$position: "relative",
|
|
@@ -19216,7 +19535,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19216
19535
|
$outlineColor: isActivePlan ? theme.primary : "transparent",
|
|
19217
19536
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19218
19537
|
children: [
|
|
19219
|
-
/* @__PURE__ */ (0,
|
|
19538
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19220
19539
|
Flex,
|
|
19221
19540
|
{
|
|
19222
19541
|
$flexDirection: "column",
|
|
@@ -19227,7 +19546,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19227
19546
|
$borderStyle: "solid",
|
|
19228
19547
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
19229
19548
|
children: [
|
|
19230
|
-
/* @__PURE__ */ (0,
|
|
19549
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19231
19550
|
Text,
|
|
19232
19551
|
{
|
|
19233
19552
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19237,7 +19556,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19237
19556
|
children: plan.name
|
|
19238
19557
|
}
|
|
19239
19558
|
) }),
|
|
19240
|
-
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)(
|
|
19241
19560
|
Text,
|
|
19242
19561
|
{
|
|
19243
19562
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19247,8 +19566,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19247
19566
|
children: plan.description
|
|
19248
19567
|
}
|
|
19249
19568
|
) }),
|
|
19250
|
-
/* @__PURE__ */ (0,
|
|
19251
|
-
/* @__PURE__ */ (0,
|
|
19569
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19570
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19252
19571
|
Text,
|
|
19253
19572
|
{
|
|
19254
19573
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19261,7 +19580,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19261
19580
|
)
|
|
19262
19581
|
}
|
|
19263
19582
|
),
|
|
19264
|
-
!plan.custom && /* @__PURE__ */ (0,
|
|
19583
|
+
!plan.custom && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19265
19584
|
Text,
|
|
19266
19585
|
{
|
|
19267
19586
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19275,7 +19594,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19275
19594
|
}
|
|
19276
19595
|
)
|
|
19277
19596
|
] }),
|
|
19278
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
19597
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19279
19598
|
Flex,
|
|
19280
19599
|
{
|
|
19281
19600
|
$position: "absolute",
|
|
@@ -19292,7 +19611,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19292
19611
|
]
|
|
19293
19612
|
}
|
|
19294
19613
|
),
|
|
19295
|
-
/* @__PURE__ */ (0,
|
|
19614
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19296
19615
|
Flex,
|
|
19297
19616
|
{
|
|
19298
19617
|
$flexDirection: "column",
|
|
@@ -19301,7 +19620,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19301
19620
|
$gap: `${cardPadding}rem`,
|
|
19302
19621
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
19303
19622
|
children: [
|
|
19304
|
-
props.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
19623
|
+
props.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
|
|
19305
19624
|
plan.entitlements.slice().sort((a2, b2) => {
|
|
19306
19625
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
19307
19626
|
return 1;
|
|
@@ -19324,8 +19643,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19324
19643
|
return acc;
|
|
19325
19644
|
}
|
|
19326
19645
|
acc.push(
|
|
19327
|
-
/* @__PURE__ */ (0,
|
|
19328
|
-
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)(
|
|
19329
19648
|
IconRound,
|
|
19330
19649
|
{
|
|
19331
19650
|
name: entitlement.feature.icon,
|
|
@@ -19336,7 +19655,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19336
19655
|
]
|
|
19337
19656
|
}
|
|
19338
19657
|
),
|
|
19339
|
-
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)(
|
|
19340
19659
|
Text,
|
|
19341
19660
|
{
|
|
19342
19661
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19344,7 +19663,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19344
19663
|
$weight: theme.typography.text.fontWeight,
|
|
19345
19664
|
$color: theme.typography.text.color,
|
|
19346
19665
|
$leading: 1.35,
|
|
19347
|
-
children: typeof price !== "undefined" ? /* @__PURE__ */ (0,
|
|
19666
|
+
children: typeof price !== "undefined" ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19348
19667
|
formatCurrency(price, currency),
|
|
19349
19668
|
" ",
|
|
19350
19669
|
t2("per"),
|
|
@@ -19353,19 +19672,19 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19353
19672
|
entitlement.feature.name,
|
|
19354
19673
|
1
|
|
19355
19674
|
),
|
|
19356
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0,
|
|
19675
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19357
19676
|
" ",
|
|
19358
19677
|
t2("per"),
|
|
19359
19678
|
" ",
|
|
19360
19679
|
selectedPeriod
|
|
19361
19680
|
] })
|
|
19362
|
-
] }) : 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: [
|
|
19363
19682
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19364
19683
|
item: (0, import_pluralize7.default)(
|
|
19365
19684
|
entitlement.feature.name
|
|
19366
19685
|
)
|
|
19367
19686
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19368
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
19687
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19369
19688
|
" ",
|
|
19370
19689
|
t2("per"),
|
|
19371
19690
|
" ",
|
|
@@ -19383,14 +19702,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19383
19702
|
);
|
|
19384
19703
|
return acc;
|
|
19385
19704
|
}, []).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
19386
|
-
(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)(
|
|
19387
19706
|
Flex,
|
|
19388
19707
|
{
|
|
19389
19708
|
$alignItems: "center",
|
|
19390
19709
|
$justifyContent: "start",
|
|
19391
19710
|
$marginTop: "1rem",
|
|
19392
19711
|
children: [
|
|
19393
|
-
/* @__PURE__ */ (0,
|
|
19712
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19394
19713
|
Icon2,
|
|
19395
19714
|
{
|
|
19396
19715
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -19402,7 +19721,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19402
19721
|
}
|
|
19403
19722
|
}
|
|
19404
19723
|
),
|
|
19405
|
-
/* @__PURE__ */ (0,
|
|
19724
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19406
19725
|
Text,
|
|
19407
19726
|
{
|
|
19408
19727
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -19419,7 +19738,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19419
19738
|
}
|
|
19420
19739
|
)
|
|
19421
19740
|
] }),
|
|
19422
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
19741
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19423
19742
|
Flex,
|
|
19424
19743
|
{
|
|
19425
19744
|
$justifyContent: "center",
|
|
@@ -19427,7 +19746,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19427
19746
|
$gap: "0.25rem",
|
|
19428
19747
|
$padding: "0.625rem 0",
|
|
19429
19748
|
children: [
|
|
19430
|
-
/* @__PURE__ */ (0,
|
|
19749
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19431
19750
|
Icon2,
|
|
19432
19751
|
{
|
|
19433
19752
|
name: "check-rounded",
|
|
@@ -19438,7 +19757,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19438
19757
|
}
|
|
19439
19758
|
}
|
|
19440
19759
|
),
|
|
19441
|
-
/* @__PURE__ */ (0,
|
|
19760
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19442
19761
|
Text,
|
|
19443
19762
|
{
|
|
19444
19763
|
$size: 15,
|
|
@@ -19449,7 +19768,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19449
19768
|
)
|
|
19450
19769
|
]
|
|
19451
19770
|
}
|
|
19452
|
-
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
19771
|
+
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19453
19772
|
EmbedButton,
|
|
19454
19773
|
{
|
|
19455
19774
|
disabled: !plan.valid || !canCheckout,
|
|
@@ -19472,14 +19791,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19472
19791
|
$color: props.downgrade.buttonStyle,
|
|
19473
19792
|
$variant: "outline"
|
|
19474
19793
|
},
|
|
19475
|
-
children: plan.custom ? /* @__PURE__ */ (0,
|
|
19794
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19476
19795
|
ButtonLink,
|
|
19477
19796
|
{
|
|
19478
19797
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19479
19798
|
target: "_blank",
|
|
19480
19799
|
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
19481
19800
|
}
|
|
19482
|
-
) : !plan.valid ? /* @__PURE__ */ (0,
|
|
19801
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19483
19802
|
Tooltip,
|
|
19484
19803
|
{
|
|
19485
19804
|
trigger: t2("Over usage limit"),
|
|
@@ -19501,14 +19820,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19501
19820
|
}
|
|
19502
19821
|
)
|
|
19503
19822
|
] }),
|
|
19504
|
-
/* @__PURE__ */ (0,
|
|
19505
|
-
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)(
|
|
19506
19825
|
Flex,
|
|
19507
19826
|
{
|
|
19508
19827
|
$justifyContent: "space-between",
|
|
19509
19828
|
$alignItems: "center",
|
|
19510
19829
|
$marginBottom: "1rem",
|
|
19511
|
-
children: /* @__PURE__ */ (0,
|
|
19830
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19512
19831
|
Text,
|
|
19513
19832
|
{
|
|
19514
19833
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19520,7 +19839,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19520
19839
|
)
|
|
19521
19840
|
}
|
|
19522
19841
|
),
|
|
19523
|
-
/* @__PURE__ */ (0,
|
|
19842
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19524
19843
|
Box,
|
|
19525
19844
|
{
|
|
19526
19845
|
$display: "grid",
|
|
@@ -19528,7 +19847,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19528
19847
|
$gap: "1rem",
|
|
19529
19848
|
children: addOns.map((addOn, index) => {
|
|
19530
19849
|
const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
|
|
19531
|
-
return /* @__PURE__ */ (0,
|
|
19850
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19532
19851
|
Flex,
|
|
19533
19852
|
{
|
|
19534
19853
|
$position: "relative",
|
|
@@ -19542,8 +19861,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19542
19861
|
$outlineColor: isActiveAddOn ? theme.primary : "transparent",
|
|
19543
19862
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19544
19863
|
children: [
|
|
19545
|
-
/* @__PURE__ */ (0,
|
|
19546
|
-
/* @__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)(
|
|
19547
19866
|
Text,
|
|
19548
19867
|
{
|
|
19549
19868
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19553,7 +19872,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19553
19872
|
children: addOn.name
|
|
19554
19873
|
}
|
|
19555
19874
|
) }),
|
|
19556
|
-
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)(
|
|
19557
19876
|
Text,
|
|
19558
19877
|
{
|
|
19559
19878
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19563,8 +19882,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19563
19882
|
children: addOn.description
|
|
19564
19883
|
}
|
|
19565
19884
|
) }),
|
|
19566
|
-
/* @__PURE__ */ (0,
|
|
19567
|
-
/* @__PURE__ */ (0,
|
|
19885
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(Box, { children: [
|
|
19886
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19568
19887
|
Text,
|
|
19569
19888
|
{
|
|
19570
19889
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19577,7 +19896,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19577
19896
|
)
|
|
19578
19897
|
}
|
|
19579
19898
|
),
|
|
19580
|
-
/* @__PURE__ */ (0,
|
|
19899
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19581
19900
|
Text,
|
|
19582
19901
|
{
|
|
19583
19902
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19591,7 +19910,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19591
19910
|
}
|
|
19592
19911
|
)
|
|
19593
19912
|
] }),
|
|
19594
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
19913
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19595
19914
|
Flex,
|
|
19596
19915
|
{
|
|
19597
19916
|
$position: "absolute",
|
|
@@ -19606,7 +19925,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19606
19925
|
}
|
|
19607
19926
|
)
|
|
19608
19927
|
] }),
|
|
19609
|
-
/* @__PURE__ */ (0,
|
|
19928
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
19610
19929
|
Flex,
|
|
19611
19930
|
{
|
|
19612
19931
|
$flexDirection: "column",
|
|
@@ -19614,7 +19933,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19614
19933
|
$gap: `${cardPadding}rem`,
|
|
19615
19934
|
$flexGrow: "1",
|
|
19616
19935
|
children: [
|
|
19617
|
-
props.addOns.showEntitlements && /* @__PURE__ */ (0,
|
|
19936
|
+
props.addOns.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19618
19937
|
Flex,
|
|
19619
19938
|
{
|
|
19620
19939
|
$flexDirection: "column",
|
|
@@ -19622,15 +19941,15 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19622
19941
|
$gap: "1rem",
|
|
19623
19942
|
$flexGrow: "1",
|
|
19624
19943
|
children: addOn.entitlements.map((entitlement) => {
|
|
19625
|
-
return /* @__PURE__ */ (0,
|
|
19944
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19626
19945
|
Flex,
|
|
19627
19946
|
{
|
|
19628
19947
|
$flexWrap: "wrap",
|
|
19629
19948
|
$justifyContent: "space-between",
|
|
19630
19949
|
$alignItems: "center",
|
|
19631
19950
|
$gap: "1rem",
|
|
19632
|
-
children: /* @__PURE__ */ (0,
|
|
19633
|
-
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)(
|
|
19634
19953
|
IconRound,
|
|
19635
19954
|
{
|
|
19636
19955
|
name: entitlement.feature.icon,
|
|
@@ -19641,20 +19960,20 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19641
19960
|
]
|
|
19642
19961
|
}
|
|
19643
19962
|
),
|
|
19644
|
-
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)(
|
|
19645
19964
|
Text,
|
|
19646
19965
|
{
|
|
19647
19966
|
$font: theme.typography.text.fontFamily,
|
|
19648
19967
|
$size: theme.typography.text.fontSize,
|
|
19649
19968
|
$weight: theme.typography.text.fontWeight,
|
|
19650
19969
|
$color: theme.typography.text.color,
|
|
19651
|
-
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: [
|
|
19652
19971
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19653
19972
|
item: (0, import_pluralize7.default)(
|
|
19654
19973
|
entitlement.feature.name
|
|
19655
19974
|
)
|
|
19656
19975
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19657
|
-
entitlement.metricPeriod && /* @__PURE__ */ (0,
|
|
19976
|
+
entitlement.metricPeriod && /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
|
|
19658
19977
|
" ",
|
|
19659
19978
|
t2("per"),
|
|
19660
19979
|
" ",
|
|
@@ -19675,7 +19994,7 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19675
19994
|
})
|
|
19676
19995
|
}
|
|
19677
19996
|
),
|
|
19678
|
-
props.upgrade.isVisible && /* @__PURE__ */ (0,
|
|
19997
|
+
props.upgrade.isVisible && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
19679
19998
|
EmbedButton,
|
|
19680
19999
|
{
|
|
19681
20000
|
disabled: !addOn.valid || !canCheckout,
|
|
@@ -19711,8 +20030,8 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19711
20030
|
PricingTable.displayName = "PricingTable";
|
|
19712
20031
|
|
|
19713
20032
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
19714
|
-
var
|
|
19715
|
-
var
|
|
20033
|
+
var import_react39 = require("react");
|
|
20034
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
19716
20035
|
function resolveDesignProps7(props) {
|
|
19717
20036
|
return {
|
|
19718
20037
|
header: {
|
|
@@ -19731,13 +20050,13 @@ function resolveDesignProps7(props) {
|
|
|
19731
20050
|
}
|
|
19732
20051
|
};
|
|
19733
20052
|
}
|
|
19734
|
-
var UpcomingBill = (0,
|
|
20053
|
+
var UpcomingBill = (0, import_react39.forwardRef)(({ className, ...rest }, ref) => {
|
|
19735
20054
|
const props = resolveDesignProps7(rest);
|
|
19736
20055
|
const { t: t2 } = useTranslation();
|
|
19737
20056
|
const theme = nt();
|
|
19738
20057
|
const { data } = useEmbed();
|
|
19739
20058
|
const isLightBackground = useIsLightBackground();
|
|
19740
|
-
const { upcomingInvoice, discounts } = (0,
|
|
20059
|
+
const { upcomingInvoice, discounts } = (0, import_react39.useMemo)(() => {
|
|
19741
20060
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
19742
20061
|
amountOff: discount.amountOff,
|
|
19743
20062
|
couponId: discount.couponId,
|
|
@@ -19764,7 +20083,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19764
20083
|
if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
|
|
19765
20084
|
return null;
|
|
19766
20085
|
}
|
|
19767
|
-
return /* @__PURE__ */ (0,
|
|
20086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
19768
20087
|
Element,
|
|
19769
20088
|
{
|
|
19770
20089
|
as: Flex,
|
|
@@ -19773,7 +20092,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19773
20092
|
$flexDirection: "column",
|
|
19774
20093
|
$gap: "1rem",
|
|
19775
20094
|
children: [
|
|
19776
|
-
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)(
|
|
19777
20096
|
Text,
|
|
19778
20097
|
{
|
|
19779
20098
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19787,8 +20106,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19787
20106
|
]
|
|
19788
20107
|
}
|
|
19789
20108
|
) }),
|
|
19790
|
-
/* @__PURE__ */ (0,
|
|
19791
|
-
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)(
|
|
19792
20111
|
Text,
|
|
19793
20112
|
{
|
|
19794
20113
|
$font: theme.typography[props.price.fontStyle].fontFamily,
|
|
@@ -19802,7 +20121,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19802
20121
|
)
|
|
19803
20122
|
}
|
|
19804
20123
|
) }),
|
|
19805
|
-
/* @__PURE__ */ (0,
|
|
20124
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19806
20125
|
Text,
|
|
19807
20126
|
{
|
|
19808
20127
|
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
|
@@ -19814,8 +20133,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19814
20133
|
}
|
|
19815
20134
|
) })
|
|
19816
20135
|
] }),
|
|
19817
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
19818
|
-
/* @__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)(
|
|
19819
20138
|
Text,
|
|
19820
20139
|
{
|
|
19821
20140
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19825,8 +20144,8 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19825
20144
|
children: t2("Discount")
|
|
19826
20145
|
}
|
|
19827
20146
|
) }),
|
|
19828
|
-
/* @__PURE__ */ (0,
|
|
19829
|
-
/* @__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)(
|
|
19830
20149
|
Flex,
|
|
19831
20150
|
{
|
|
19832
20151
|
$alignItems: "center",
|
|
@@ -19835,7 +20154,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19835
20154
|
$borderStyle: "solid",
|
|
19836
20155
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
19837
20156
|
$borderRadius: "0.3125rem",
|
|
19838
|
-
children: /* @__PURE__ */ (0,
|
|
20157
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19839
20158
|
Text,
|
|
19840
20159
|
{
|
|
19841
20160
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19847,7 +20166,7 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19847
20166
|
)
|
|
19848
20167
|
}
|
|
19849
20168
|
),
|
|
19850
|
-
/* @__PURE__ */ (0,
|
|
20169
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
19851
20170
|
Text,
|
|
19852
20171
|
{
|
|
19853
20172
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19865,11 +20184,72 @@ var UpcomingBill = (0, import_react38.forwardRef)(({ className, ...rest }, ref)
|
|
|
19865
20184
|
});
|
|
19866
20185
|
UpcomingBill.displayName = "UpcomingBill";
|
|
19867
20186
|
|
|
19868
|
-
// src/components/
|
|
20187
|
+
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
19869
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");
|
|
19870
20250
|
|
|
19871
20251
|
// src/components/embed/renderer.ts
|
|
19872
|
-
var
|
|
20252
|
+
var import_react41 = require("react");
|
|
19873
20253
|
var components = {
|
|
19874
20254
|
Root,
|
|
19875
20255
|
Viewport,
|
|
@@ -19881,7 +20261,8 @@ var components = {
|
|
|
19881
20261
|
UpcomingBill,
|
|
19882
20262
|
PaymentMethod,
|
|
19883
20263
|
Invoices,
|
|
19884
|
-
PricingTable
|
|
20264
|
+
PricingTable,
|
|
20265
|
+
UnsubscribeButton
|
|
19885
20266
|
};
|
|
19886
20267
|
function createRenderer(options) {
|
|
19887
20268
|
const { useFallback = false } = options || {};
|
|
@@ -19891,7 +20272,7 @@ function createRenderer(options) {
|
|
|
19891
20272
|
const component = useFallback ? components[name] || "div" : components[name];
|
|
19892
20273
|
if (!components[name]) {
|
|
19893
20274
|
console.debug(
|
|
19894
|
-
"`schematic-embed`:
|
|
20275
|
+
"`schematic-embed`: Encountered an unknown component during render cycle.",
|
|
19895
20276
|
name
|
|
19896
20277
|
);
|
|
19897
20278
|
}
|
|
@@ -19901,7 +20282,7 @@ function createRenderer(options) {
|
|
|
19901
20282
|
const { className, ...rest } = props;
|
|
19902
20283
|
const resolvedProps = component === "div" ? rest : props;
|
|
19903
20284
|
const resolvedChildren = children.map(renderNode);
|
|
19904
|
-
return (0,
|
|
20285
|
+
return (0, import_react41.createElement)(
|
|
19905
20286
|
component,
|
|
19906
20287
|
{
|
|
19907
20288
|
key: index,
|
|
@@ -19914,10 +20295,10 @@ function createRenderer(options) {
|
|
|
19914
20295
|
}
|
|
19915
20296
|
|
|
19916
20297
|
// src/components/embed/ComponentTree.tsx
|
|
19917
|
-
var
|
|
20298
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
19918
20299
|
var Loading = () => {
|
|
19919
20300
|
const theme = nt();
|
|
19920
|
-
return /* @__PURE__ */ (0,
|
|
20301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19921
20302
|
Flex,
|
|
19922
20303
|
{
|
|
19923
20304
|
$width: "100%",
|
|
@@ -19925,13 +20306,13 @@ var Loading = () => {
|
|
|
19925
20306
|
$alignItems: "center",
|
|
19926
20307
|
$justifyContent: "center",
|
|
19927
20308
|
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
19928
|
-
children: /* @__PURE__ */ (0,
|
|
20309
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loader, { $size: "2xl", $color: "#194BFB" })
|
|
19929
20310
|
}
|
|
19930
20311
|
);
|
|
19931
20312
|
};
|
|
19932
20313
|
var Error2 = ({ message }) => {
|
|
19933
20314
|
const theme = nt();
|
|
19934
|
-
return /* @__PURE__ */ (0,
|
|
20315
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
19935
20316
|
Flex,
|
|
19936
20317
|
{
|
|
19937
20318
|
$flexDirection: "column",
|
|
@@ -19942,7 +20323,7 @@ var Error2 = ({ message }) => {
|
|
|
19942
20323
|
$alignItems: "center",
|
|
19943
20324
|
$justifyContent: "center",
|
|
19944
20325
|
children: [
|
|
19945
|
-
/* @__PURE__ */ (0,
|
|
20326
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19946
20327
|
Box,
|
|
19947
20328
|
{
|
|
19948
20329
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19953,7 +20334,7 @@ var Error2 = ({ message }) => {
|
|
|
19953
20334
|
children: "Error"
|
|
19954
20335
|
}
|
|
19955
20336
|
),
|
|
19956
|
-
/* @__PURE__ */ (0,
|
|
20337
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
19957
20338
|
Box,
|
|
19958
20339
|
{
|
|
19959
20340
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19970,31 +20351,31 @@ var Error2 = ({ message }) => {
|
|
|
19970
20351
|
};
|
|
19971
20352
|
var ComponentTree = () => {
|
|
19972
20353
|
const { error, nodes, isPending } = useEmbed();
|
|
19973
|
-
const [children, setChildren] = (0,
|
|
19974
|
-
(0,
|
|
20354
|
+
const [children, setChildren] = (0, import_react42.useState)(/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loading, {}));
|
|
20355
|
+
(0, import_react42.useEffect)(() => {
|
|
19975
20356
|
const renderer = createRenderer();
|
|
19976
20357
|
setChildren(nodes.map(renderer));
|
|
19977
20358
|
}, [nodes]);
|
|
19978
20359
|
if (error) {
|
|
19979
20360
|
console.error(error);
|
|
19980
|
-
return /* @__PURE__ */ (0,
|
|
20361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Error2, { message: error.message });
|
|
19981
20362
|
}
|
|
19982
20363
|
if (isPending) {
|
|
19983
|
-
return /* @__PURE__ */ (0,
|
|
20364
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Loading, {});
|
|
19984
20365
|
}
|
|
19985
|
-
return /* @__PURE__ */ (0,
|
|
20366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children });
|
|
19986
20367
|
};
|
|
19987
20368
|
|
|
19988
20369
|
// src/components/embed/Embed.tsx
|
|
19989
|
-
var
|
|
20370
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
19990
20371
|
var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
|
|
19991
20372
|
if (accessToken?.length === 0) {
|
|
19992
|
-
return /* @__PURE__ */ (0,
|
|
20373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: "Please provide an access token." });
|
|
19993
20374
|
}
|
|
19994
20375
|
if (!accessToken?.startsWith("token_")) {
|
|
19995
|
-
return /* @__PURE__ */ (0,
|
|
20376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
|
19996
20377
|
}
|
|
19997
|
-
return /* @__PURE__ */ (0,
|
|
20378
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ComponentTree, {}) });
|
|
19998
20379
|
};
|
|
19999
20380
|
/*! Bundled license information:
|
|
20000
20381
|
|