@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
|
@@ -2076,7 +2076,7 @@ var require_pluralize = __commonJS({
|
|
|
2076
2076
|
});
|
|
2077
2077
|
|
|
2078
2078
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
2079
|
-
import { forwardRef as forwardRef7, useRef as useRef6, useState as
|
|
2079
|
+
import { forwardRef as forwardRef7, useRef as useRef6, useState as useState13 } from "react";
|
|
2080
2080
|
|
|
2081
2081
|
// node_modules/react-i18next/dist/es/Trans.js
|
|
2082
2082
|
import { useContext } from "react";
|
|
@@ -11925,6 +11925,7 @@ var CheckoutexternalApi = class extends BaseAPI {
|
|
|
11925
11925
|
var en_default = {
|
|
11926
11926
|
translation: {
|
|
11927
11927
|
"A problem occurred while saving your payment method.": "A problem occurred while saving your payment method.",
|
|
11928
|
+
"Access to plan will end on": "Access to plan will end on {{date}}",
|
|
11928
11929
|
Active: "Active",
|
|
11929
11930
|
"Add payment method": "Add payment method",
|
|
11930
11931
|
"Add Seats": "Add More",
|
|
@@ -11934,6 +11935,7 @@ var en_default = {
|
|
|
11934
11935
|
"After the trial, cancel no default": "After the trial, you will be lose access to {{planName}} plan and your subscription will be cancelled.",
|
|
11935
11936
|
Billed: "Billed {{period}}",
|
|
11936
11937
|
"billing period": "billing period",
|
|
11938
|
+
"Cancel subscription": "Cancel subscription",
|
|
11937
11939
|
"Cannot downgrade entitlement": "Cannot downgrade to a lower quantity than current usage.",
|
|
11938
11940
|
"Card ending in": "\u{1F4B3} Card ending in {{value}}",
|
|
11939
11941
|
"Change add-on": "Change add-on",
|
|
@@ -11968,9 +11970,11 @@ var en_default = {
|
|
|
11968
11970
|
Invoices: "Invoices",
|
|
11969
11971
|
"Limit of": "Limit of {{amount}}",
|
|
11970
11972
|
Loading: "Loading",
|
|
11973
|
+
"Manage plan": "Manage plan",
|
|
11971
11974
|
Monthly: "Monthly",
|
|
11972
11975
|
Next: "Next",
|
|
11973
11976
|
"No limit": "No limit",
|
|
11977
|
+
"Not ready to cancel?": "Not ready to cancel?",
|
|
11974
11978
|
"Optionally add features to your subscription": "Optionally add features to your subscription",
|
|
11975
11979
|
"Other existing payment method": "Other existing payment method",
|
|
11976
11980
|
"Over usage limit": "Over usage limit",
|
|
@@ -11997,10 +12001,13 @@ var en_default = {
|
|
|
11997
12001
|
"Start trial": "Start trial",
|
|
11998
12002
|
"Subscribe and close": "Subscribe and close",
|
|
11999
12003
|
Subscription: "Subscription",
|
|
12004
|
+
"Subscription canceled": "Subscription canceled",
|
|
12000
12005
|
Trial: "Trial",
|
|
12001
12006
|
"Trial ends in": "Trial ends in {{days}} days",
|
|
12002
12007
|
"Trial plan": "Try free for {{days}} days",
|
|
12003
12008
|
Unlimited: "Unlimited {{item}}",
|
|
12009
|
+
Unsubscribe: "Unsubscribe",
|
|
12010
|
+
"Unsubscribe failed": "Unsubscribe failed",
|
|
12004
12011
|
"Unused time": "Unused time",
|
|
12005
12012
|
Usage: "Usage",
|
|
12006
12013
|
"Usage-based": "Usage-based",
|
|
@@ -12008,6 +12015,7 @@ var en_default = {
|
|
|
12008
12015
|
"X% off": "{{percent}}% off",
|
|
12009
12016
|
"X off": "{{amount}} off",
|
|
12010
12017
|
Yearly: "Yearly",
|
|
12018
|
+
"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",
|
|
12011
12019
|
day: "day",
|
|
12012
12020
|
month: "month",
|
|
12013
12021
|
per: "per",
|
|
@@ -12742,7 +12750,8 @@ var EmbedProvider = ({
|
|
|
12742
12750
|
useEffect2(() => {
|
|
12743
12751
|
const element = document.getElementById("schematic-fonts");
|
|
12744
12752
|
if (element) {
|
|
12745
|
-
|
|
12753
|
+
styleRef.current = element;
|
|
12754
|
+
return;
|
|
12746
12755
|
}
|
|
12747
12756
|
const style = document.createElement("link");
|
|
12748
12757
|
style.id = "schematic-fonts";
|
|
@@ -12753,7 +12762,7 @@ var EmbedProvider = ({
|
|
|
12753
12762
|
useEffect2(() => {
|
|
12754
12763
|
if (accessToken) {
|
|
12755
12764
|
const { headers = {} } = apiConfig ?? {};
|
|
12756
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12765
|
+
headers["X-Schematic-Components-Version"] = "0.4.7";
|
|
12757
12766
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12758
12767
|
const config = new Configuration({
|
|
12759
12768
|
...apiConfig,
|
|
@@ -13200,7 +13209,7 @@ var Button2 = forwardRef(
|
|
|
13200
13209
|
disabled,
|
|
13201
13210
|
...props,
|
|
13202
13211
|
children: [
|
|
13203
|
-
/* @__PURE__ */ jsx2(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13212
|
+
isLoading && /* @__PURE__ */ jsx2(Loader, { $size: "sm", $isLoading: isLoading }),
|
|
13204
13213
|
children
|
|
13205
13214
|
]
|
|
13206
13215
|
}
|
|
@@ -13277,8 +13286,6 @@ var EmbedButton = dt(Button2)`
|
|
|
13277
13286
|
font-family: "Public Sans", sans-serif;
|
|
13278
13287
|
font-weight: 500;
|
|
13279
13288
|
text-align: center;
|
|
13280
|
-
width: 100%;
|
|
13281
|
-
padding: 0;
|
|
13282
13289
|
|
|
13283
13290
|
${({ disabled, $color = "primary", theme }) => {
|
|
13284
13291
|
const { l: l2 } = hexToHSL(theme[$color]);
|
|
@@ -13408,6 +13415,38 @@ var EmbedButton = dt(Button2)`
|
|
|
13408
13415
|
`;
|
|
13409
13416
|
}
|
|
13410
13417
|
}}
|
|
13418
|
+
|
|
13419
|
+
${({ $alignment = "center" }) => {
|
|
13420
|
+
switch ($alignment) {
|
|
13421
|
+
case "start":
|
|
13422
|
+
return lt`
|
|
13423
|
+
justify-content: start;
|
|
13424
|
+
`;
|
|
13425
|
+
case "end":
|
|
13426
|
+
return lt`
|
|
13427
|
+
justify-content: end;
|
|
13428
|
+
`;
|
|
13429
|
+
case "center":
|
|
13430
|
+
default:
|
|
13431
|
+
return lt`
|
|
13432
|
+
justify-content: center;
|
|
13433
|
+
`;
|
|
13434
|
+
}
|
|
13435
|
+
}}
|
|
13436
|
+
|
|
13437
|
+
${({ $fullWidth = true }) => {
|
|
13438
|
+
if ($fullWidth) {
|
|
13439
|
+
return lt`
|
|
13440
|
+
width: 100%;
|
|
13441
|
+
padding: 0;
|
|
13442
|
+
`;
|
|
13443
|
+
}
|
|
13444
|
+
return lt`
|
|
13445
|
+
width: fit-content;
|
|
13446
|
+
padding-left: 1rem;
|
|
13447
|
+
padding-right: 1rem;
|
|
13448
|
+
`;
|
|
13449
|
+
}}
|
|
13411
13450
|
`;
|
|
13412
13451
|
|
|
13413
13452
|
// src/components/ui/flex/styles.ts
|
|
@@ -14146,7 +14185,7 @@ var Root = forwardRef3(
|
|
|
14146
14185
|
Root.displayName = "Root";
|
|
14147
14186
|
|
|
14148
14187
|
// src/components/layout/viewport/Viewport.tsx
|
|
14149
|
-
import { forwardRef as forwardRef4, useLayoutEffect as useLayoutEffect5, useState as
|
|
14188
|
+
import { forwardRef as forwardRef4, useLayoutEffect as useLayoutEffect5, useState as useState12 } from "react";
|
|
14150
14189
|
import { createPortal as createPortal2 } from "react-dom";
|
|
14151
14190
|
|
|
14152
14191
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
@@ -14261,11 +14300,11 @@ var Navigation = ({
|
|
|
14261
14300
|
] });
|
|
14262
14301
|
};
|
|
14263
14302
|
|
|
14264
|
-
// src/components/shared/
|
|
14303
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14265
14304
|
import { useCallback as useCallback6, useMemo as useMemo4 } from "react";
|
|
14266
14305
|
var import_pluralize = __toESM(require_pluralize());
|
|
14267
14306
|
|
|
14268
|
-
// src/components/shared/
|
|
14307
|
+
// src/components/shared/sidebar/StageButton.tsx
|
|
14269
14308
|
import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
14270
14309
|
var StageButton = ({
|
|
14271
14310
|
canTrial,
|
|
@@ -14456,7 +14495,7 @@ var StageButton = ({
|
|
|
14456
14495
|
}
|
|
14457
14496
|
};
|
|
14458
14497
|
|
|
14459
|
-
// src/components/shared/
|
|
14498
|
+
// src/components/shared/sidebar/Sidebar.tsx
|
|
14460
14499
|
import { Fragment as Fragment4, jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
14461
14500
|
var Sidebar = ({
|
|
14462
14501
|
addOns,
|
|
@@ -14479,11 +14518,12 @@ var Sidebar = ({
|
|
|
14479
14518
|
showPaymentForm,
|
|
14480
14519
|
toggleLoading,
|
|
14481
14520
|
updatePromoCode,
|
|
14482
|
-
usageBasedEntitlements
|
|
14521
|
+
usageBasedEntitlements,
|
|
14522
|
+
showHeader = true
|
|
14483
14523
|
}) => {
|
|
14484
14524
|
const { t: t2 } = useTranslation();
|
|
14485
14525
|
const theme = nt();
|
|
14486
|
-
const { api, data, mode, setLayout } = useEmbed();
|
|
14526
|
+
const { api, data, mode, layout, setLayout } = useEmbed();
|
|
14487
14527
|
const isLightBackground = useIsLightBackground();
|
|
14488
14528
|
const payInAdvanceEntitlements = usageBasedEntitlements.filter(
|
|
14489
14529
|
({ entitlement }) => entitlement.priceBehavior === "pay_in_advance"
|
|
@@ -14492,27 +14532,28 @@ var Sidebar = ({
|
|
|
14492
14532
|
({ entitlement }) => entitlement.priceBehavior === "pay_as_you_go"
|
|
14493
14533
|
);
|
|
14494
14534
|
const subscriptionPrice = useMemo4(() => {
|
|
14495
|
-
|
|
14535
|
+
const plan = selectedPlan || currentPlan;
|
|
14536
|
+
if (!plan || !plan.monthlyPrice || !plan.yearlyPrice) {
|
|
14496
14537
|
return;
|
|
14497
14538
|
}
|
|
14498
14539
|
let total = 0;
|
|
14499
|
-
const planPrice = (planPeriod === "month" ?
|
|
14500
|
-
const currency = (planPeriod === "month" ?
|
|
14540
|
+
const planPrice = (planPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price;
|
|
14541
|
+
const currency = (planPeriod === "month" ? plan?.monthlyPrice : plan?.yearlyPrice)?.currency;
|
|
14501
14542
|
if (planPrice) {
|
|
14502
14543
|
total += planPrice;
|
|
14503
14544
|
}
|
|
14504
14545
|
const addOnCost = addOns.reduce(
|
|
14505
|
-
(sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price
|
|
14546
|
+
(sum, addOn) => sum + (addOn.isSelected ? (planPeriod === "month" ? addOn.monthlyPrice : addOn.yearlyPrice)?.price ?? 0 : 0),
|
|
14506
14547
|
0
|
|
14507
14548
|
);
|
|
14508
14549
|
total += addOnCost;
|
|
14509
14550
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
14510
|
-
(sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price
|
|
14551
|
+
(sum, { entitlement, quantity }) => sum + quantity * ((planPeriod === "month" ? entitlement.meteredMonthlyPrice : entitlement.meteredYearlyPrice)?.price ?? 0),
|
|
14511
14552
|
0
|
|
14512
14553
|
);
|
|
14513
14554
|
total += payInAdvanceCost;
|
|
14514
14555
|
return formatCurrency(total, currency);
|
|
14515
|
-
}, [selectedPlan, addOns, payInAdvanceEntitlements
|
|
14556
|
+
}, [selectedPlan, currentPlan, planPeriod, addOns, payInAdvanceEntitlements]);
|
|
14516
14557
|
const { amountOff, dueNow, newCharges, percentOff, periodStart, proration } = useMemo4(() => {
|
|
14517
14558
|
return {
|
|
14518
14559
|
amountOff: charges?.amountOff ?? 0,
|
|
@@ -14585,8 +14626,23 @@ var Sidebar = ({
|
|
|
14585
14626
|
payInAdvanceEntitlements,
|
|
14586
14627
|
promoCode
|
|
14587
14628
|
]);
|
|
14629
|
+
const unsubscribe = useCallback6(async () => {
|
|
14630
|
+
if (!api) {
|
|
14631
|
+
return;
|
|
14632
|
+
}
|
|
14633
|
+
try {
|
|
14634
|
+
setError(void 0);
|
|
14635
|
+
toggleLoading();
|
|
14636
|
+
await api.checkoutUnsubscribe();
|
|
14637
|
+
setError("success");
|
|
14638
|
+
} catch {
|
|
14639
|
+
setError(t2("Unsubscribe failed"));
|
|
14640
|
+
} finally {
|
|
14641
|
+
toggleLoading();
|
|
14642
|
+
}
|
|
14643
|
+
}, [api, setError, t2, toggleLoading]);
|
|
14588
14644
|
const selectedAddOns = addOns.filter((addOn) => addOn.isSelected);
|
|
14589
|
-
const willPlanChange = typeof selectedPlan !== "undefined" && selectedPlan.current
|
|
14645
|
+
const willPlanChange = typeof selectedPlan !== "undefined" && !selectedPlan.current;
|
|
14590
14646
|
const canUpdateSubscription = mode === "edit" || api !== null && (willPlanChange || // TODO: test add-on comparison for finding "changes"
|
|
14591
14647
|
selectedAddOns.length !== currentAddOns.length || !selectedAddOns.every(
|
|
14592
14648
|
(addOn) => currentAddOns.some((currentAddOn) => addOn.id === currentAddOn.id)
|
|
@@ -14666,7 +14722,7 @@ var Sidebar = ({
|
|
|
14666
14722
|
}
|
|
14667
14723
|
},
|
|
14668
14724
|
children: [
|
|
14669
|
-
/* @__PURE__ */ jsx12(
|
|
14725
|
+
showHeader && /* @__PURE__ */ jsx12(
|
|
14670
14726
|
Flex,
|
|
14671
14727
|
{
|
|
14672
14728
|
$position: "relative",
|
|
@@ -15416,7 +15472,7 @@ var Sidebar = ({
|
|
|
15416
15472
|
]
|
|
15417
15473
|
}
|
|
15418
15474
|
),
|
|
15419
|
-
|
|
15475
|
+
subscriptionPrice && /* @__PURE__ */ jsxs8(
|
|
15420
15476
|
Flex,
|
|
15421
15477
|
{
|
|
15422
15478
|
$justifyContent: "space-between",
|
|
@@ -15519,11 +15575,11 @@ var Sidebar = ({
|
|
|
15519
15575
|
}
|
|
15520
15576
|
) })
|
|
15521
15577
|
] }),
|
|
15522
|
-
/* @__PURE__ */ jsx12(
|
|
15578
|
+
layout === "checkout" && /* @__PURE__ */ jsx12(
|
|
15523
15579
|
StageButton,
|
|
15524
15580
|
{
|
|
15525
15581
|
canTrial: selectedPlan?.companyCanTrial === true,
|
|
15526
|
-
canCheckout
|
|
15582
|
+
canCheckout,
|
|
15527
15583
|
canUpdateSubscription,
|
|
15528
15584
|
checkout,
|
|
15529
15585
|
checkoutStage,
|
|
@@ -15536,6 +15592,16 @@ var Sidebar = ({
|
|
|
15536
15592
|
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
15537
15593
|
}
|
|
15538
15594
|
),
|
|
15595
|
+
layout === "unsubscribe" && /* @__PURE__ */ jsx12(
|
|
15596
|
+
EmbedButton,
|
|
15597
|
+
{
|
|
15598
|
+
onClick: async () => {
|
|
15599
|
+
unsubscribe();
|
|
15600
|
+
},
|
|
15601
|
+
isLoading,
|
|
15602
|
+
children: t2("Cancel subscription")
|
|
15603
|
+
}
|
|
15604
|
+
),
|
|
15539
15605
|
!isLoading && error && /* @__PURE__ */ jsx12(Box, { children: /* @__PURE__ */ jsx12(
|
|
15540
15606
|
Text,
|
|
15541
15607
|
{
|
|
@@ -15546,7 +15612,7 @@ var Sidebar = ({
|
|
|
15546
15612
|
children: error
|
|
15547
15613
|
}
|
|
15548
15614
|
) }),
|
|
15549
|
-
/* @__PURE__ */ jsx12(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx12(
|
|
15615
|
+
layout !== "unsubscribe" && /* @__PURE__ */ jsx12(Box, { $opacity: "0.625", children: /* @__PURE__ */ jsx12(
|
|
15550
15616
|
Text,
|
|
15551
15617
|
{
|
|
15552
15618
|
$font: theme.typography.text.fontFamily,
|
|
@@ -16641,7 +16707,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16641
16707
|
),
|
|
16642
16708
|
[usageBasedEntitlements]
|
|
16643
16709
|
);
|
|
16644
|
-
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected
|
|
16710
|
+
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected);
|
|
16645
16711
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16646
16712
|
({ quantity }) => quantity > 0
|
|
16647
16713
|
);
|
|
@@ -17255,20 +17321,234 @@ var PeriodToggle = ({
|
|
|
17255
17321
|
);
|
|
17256
17322
|
};
|
|
17257
17323
|
|
|
17258
|
-
// src/components/
|
|
17324
|
+
// src/components/shared/unsubscribe-dialog/UnsubscribeDialog.tsx
|
|
17325
|
+
import { useCallback as useCallback8, useMemo as useMemo7, useState as useState10 } from "react";
|
|
17259
17326
|
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
17327
|
+
var UnsubscribeDialog = () => {
|
|
17328
|
+
const { t: t2 } = useTranslation();
|
|
17329
|
+
const theme = nt();
|
|
17330
|
+
const { data, setSelected } = useEmbed();
|
|
17331
|
+
const [error, setError] = useState10();
|
|
17332
|
+
const [isLoading, setIsLoading] = useState10(false);
|
|
17333
|
+
const planPeriod = useMemo7(
|
|
17334
|
+
() => data.company?.plan?.planPeriod ?? "month",
|
|
17335
|
+
[data.company?.plan?.planPeriod]
|
|
17336
|
+
);
|
|
17337
|
+
const { setLayout } = useEmbed();
|
|
17338
|
+
const currentPlan = useMemo7(
|
|
17339
|
+
() => ({
|
|
17340
|
+
...data.company?.plan,
|
|
17341
|
+
monthlyPrice: { price: data.company?.plan?.planPrice },
|
|
17342
|
+
yearlyPrice: { price: data.company?.plan?.planPrice }
|
|
17343
|
+
}),
|
|
17344
|
+
[data.company?.plan]
|
|
17345
|
+
);
|
|
17346
|
+
const currentAddOns = useMemo7(
|
|
17347
|
+
() => data.company?.addOns || [],
|
|
17348
|
+
[data.company?.addOns]
|
|
17349
|
+
);
|
|
17350
|
+
const addOns = useMemo7(
|
|
17351
|
+
() => currentAddOns.map((addOn) => ({
|
|
17352
|
+
...addOn,
|
|
17353
|
+
isSelected: true,
|
|
17354
|
+
monthlyPrice: {
|
|
17355
|
+
price: addOn.planPrice
|
|
17356
|
+
},
|
|
17357
|
+
yearlyPrice: {
|
|
17358
|
+
price: addOn.planPrice
|
|
17359
|
+
}
|
|
17360
|
+
})),
|
|
17361
|
+
[currentAddOns]
|
|
17362
|
+
);
|
|
17363
|
+
const currentUsageBasedEntitlements = useMemo7(
|
|
17364
|
+
() => data.activeUsageBasedEntitlements.reduce(
|
|
17365
|
+
(acc, usageData) => {
|
|
17366
|
+
const featureUsage = data.featureUsage?.features.find(
|
|
17367
|
+
(usage2) => usage2.feature?.id === usageData.featureId
|
|
17368
|
+
);
|
|
17369
|
+
const allocation = featureUsage?.allocation ?? 0;
|
|
17370
|
+
const usage = featureUsage?.usage ?? 0;
|
|
17371
|
+
acc.push({
|
|
17372
|
+
entitlement: {
|
|
17373
|
+
...usageData,
|
|
17374
|
+
id: featureUsage?.entitlementId ?? usageData.featureId,
|
|
17375
|
+
feature: featureUsage?.feature,
|
|
17376
|
+
meteredMonthlyPrice: usageData.meteredPrice,
|
|
17377
|
+
meteredYearlyPrice: usageData.meteredPrice
|
|
17378
|
+
},
|
|
17379
|
+
usageData,
|
|
17380
|
+
allocation,
|
|
17381
|
+
quantity: allocation ?? usage,
|
|
17382
|
+
usage
|
|
17383
|
+
});
|
|
17384
|
+
return acc;
|
|
17385
|
+
},
|
|
17386
|
+
[]
|
|
17387
|
+
),
|
|
17388
|
+
[data.activeUsageBasedEntitlements, data.featureUsage?.features]
|
|
17389
|
+
);
|
|
17390
|
+
const cancelDate = new Date(
|
|
17391
|
+
data.subscription?.cancelAt || data.upcomingInvoice?.dueDate || Date.now()
|
|
17392
|
+
);
|
|
17393
|
+
const isLightBackground = useIsLightBackground();
|
|
17394
|
+
const handleClose = useCallback8(() => {
|
|
17395
|
+
setLayout("portal");
|
|
17396
|
+
}, [setLayout]);
|
|
17397
|
+
return /* @__PURE__ */ jsxs15(Modal, { id: "unsubscribe-dialog", size: "auto", children: [
|
|
17398
|
+
/* @__PURE__ */ jsx20(
|
|
17399
|
+
Box,
|
|
17400
|
+
{
|
|
17401
|
+
$display: "inline-flex",
|
|
17402
|
+
$position: "absolute",
|
|
17403
|
+
$top: 0,
|
|
17404
|
+
$right: 0,
|
|
17405
|
+
$zIndex: 1,
|
|
17406
|
+
$cursor: "pointer",
|
|
17407
|
+
onClick: handleClose,
|
|
17408
|
+
children: /* @__PURE__ */ jsx20(
|
|
17409
|
+
Icon2,
|
|
17410
|
+
{
|
|
17411
|
+
name: "close",
|
|
17412
|
+
style: {
|
|
17413
|
+
fontSize: 36,
|
|
17414
|
+
color: isLightBackground ? "hsla(0, 0%, 0%, 0.275)" : "hsla(0, 0%, 100%, 0.275)"
|
|
17415
|
+
}
|
|
17416
|
+
}
|
|
17417
|
+
)
|
|
17418
|
+
}
|
|
17419
|
+
),
|
|
17420
|
+
/* @__PURE__ */ jsxs15(
|
|
17421
|
+
Flex,
|
|
17422
|
+
{
|
|
17423
|
+
$position: "relative",
|
|
17424
|
+
$flexDirection: "column",
|
|
17425
|
+
$height: "auto",
|
|
17426
|
+
$viewport: {
|
|
17427
|
+
md: {
|
|
17428
|
+
$flexDirection: "row",
|
|
17429
|
+
$height: "calc(100% - 5rem)"
|
|
17430
|
+
}
|
|
17431
|
+
},
|
|
17432
|
+
children: [
|
|
17433
|
+
/* @__PURE__ */ jsxs15(
|
|
17434
|
+
Flex,
|
|
17435
|
+
{
|
|
17436
|
+
$flexDirection: "column",
|
|
17437
|
+
$flexWrap: "wrap",
|
|
17438
|
+
$justifyContent: "space-around",
|
|
17439
|
+
$gap: "5rem",
|
|
17440
|
+
$padding: "2.5rem",
|
|
17441
|
+
children: [
|
|
17442
|
+
/* @__PURE__ */ jsxs15(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
|
|
17443
|
+
/* @__PURE__ */ jsx20(
|
|
17444
|
+
Text,
|
|
17445
|
+
{
|
|
17446
|
+
as: "h2",
|
|
17447
|
+
$font: theme.typography.heading2.fontFamily,
|
|
17448
|
+
$size: theme.typography.heading2.fontSize,
|
|
17449
|
+
$weight: theme.typography.heading2.fontWeight,
|
|
17450
|
+
$color: theme.typography.heading2.color,
|
|
17451
|
+
children: t2("Cancel subscription")
|
|
17452
|
+
}
|
|
17453
|
+
),
|
|
17454
|
+
/* @__PURE__ */ jsxs15(
|
|
17455
|
+
Text,
|
|
17456
|
+
{
|
|
17457
|
+
as: "p",
|
|
17458
|
+
$font: theme.typography.text.fontFamily,
|
|
17459
|
+
$size: theme.typography.text.fontSize,
|
|
17460
|
+
$weight: theme.typography.text.fontWeight,
|
|
17461
|
+
$color: theme.typography.text.color,
|
|
17462
|
+
children: [
|
|
17463
|
+
t2(
|
|
17464
|
+
"You will retain access to your plan until the end of the billing period, on"
|
|
17465
|
+
),
|
|
17466
|
+
" ",
|
|
17467
|
+
cancelDate ? toPrettyDate(cancelDate, {
|
|
17468
|
+
month: "numeric"
|
|
17469
|
+
}) : ""
|
|
17470
|
+
]
|
|
17471
|
+
}
|
|
17472
|
+
)
|
|
17473
|
+
] }),
|
|
17474
|
+
/* @__PURE__ */ jsxs15(Flex, { $flexDirection: "column", $flexWrap: "wrap", $gap: "0.5rem", children: [
|
|
17475
|
+
/* @__PURE__ */ jsx20(
|
|
17476
|
+
Text,
|
|
17477
|
+
{
|
|
17478
|
+
as: "p",
|
|
17479
|
+
$font: theme.typography.text.fontFamily,
|
|
17480
|
+
$size: theme.typography.text.fontSize,
|
|
17481
|
+
$weight: theme.typography.text.fontWeight,
|
|
17482
|
+
$color: theme.typography.text.color,
|
|
17483
|
+
children: t2("Not ready to cancel?")
|
|
17484
|
+
}
|
|
17485
|
+
),
|
|
17486
|
+
/* @__PURE__ */ jsx20(
|
|
17487
|
+
EmbedButton,
|
|
17488
|
+
{
|
|
17489
|
+
onClick: () => {
|
|
17490
|
+
setSelected({
|
|
17491
|
+
planId: currentPlan?.id,
|
|
17492
|
+
addOnId: void 0,
|
|
17493
|
+
usage: false
|
|
17494
|
+
});
|
|
17495
|
+
setLayout("checkout");
|
|
17496
|
+
},
|
|
17497
|
+
$size: "sm",
|
|
17498
|
+
$color: "secondary",
|
|
17499
|
+
$variant: "ghost",
|
|
17500
|
+
$fullWidth: false,
|
|
17501
|
+
children: t2("Manage plan")
|
|
17502
|
+
}
|
|
17503
|
+
)
|
|
17504
|
+
] })
|
|
17505
|
+
]
|
|
17506
|
+
}
|
|
17507
|
+
),
|
|
17508
|
+
/* @__PURE__ */ jsx20(
|
|
17509
|
+
Sidebar,
|
|
17510
|
+
{
|
|
17511
|
+
addOns,
|
|
17512
|
+
checkoutStage: "checkout",
|
|
17513
|
+
checkoutStages: [],
|
|
17514
|
+
currentAddOns,
|
|
17515
|
+
currentUsageBasedEntitlements,
|
|
17516
|
+
error,
|
|
17517
|
+
currentPlan,
|
|
17518
|
+
isLoading,
|
|
17519
|
+
planPeriod,
|
|
17520
|
+
requiresPayment: false,
|
|
17521
|
+
setCheckoutStage: () => {
|
|
17522
|
+
},
|
|
17523
|
+
setError: (msg) => setError(msg),
|
|
17524
|
+
showPaymentForm: false,
|
|
17525
|
+
toggleLoading: () => setIsLoading((prev2) => !prev2),
|
|
17526
|
+
updatePromoCode: () => {
|
|
17527
|
+
},
|
|
17528
|
+
usageBasedEntitlements: currentUsageBasedEntitlements,
|
|
17529
|
+
showHeader: false
|
|
17530
|
+
}
|
|
17531
|
+
)
|
|
17532
|
+
]
|
|
17533
|
+
}
|
|
17534
|
+
)
|
|
17535
|
+
] });
|
|
17536
|
+
};
|
|
17537
|
+
|
|
17538
|
+
// src/components/ui/badge/Badge.tsx
|
|
17539
|
+
import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
17260
17540
|
var Badge = () => {
|
|
17261
17541
|
const { t: t2 } = useTranslation();
|
|
17262
17542
|
const { settings } = useEmbed();
|
|
17263
|
-
return /* @__PURE__ */
|
|
17543
|
+
return /* @__PURE__ */ jsxs16(
|
|
17264
17544
|
Flex,
|
|
17265
17545
|
{
|
|
17266
17546
|
$justifyContent: settings.badge?.alignment || "start",
|
|
17267
17547
|
$alignItems: "center",
|
|
17268
17548
|
$gridColumn: "1 / -1",
|
|
17269
17549
|
children: [
|
|
17270
|
-
/* @__PURE__ */
|
|
17271
|
-
/* @__PURE__ */
|
|
17550
|
+
/* @__PURE__ */ jsx21(Box, { $fontSize: "0.75rem", $marginRight: "0.5rem", children: t2("Powered by") }),
|
|
17551
|
+
/* @__PURE__ */ jsxs16(
|
|
17272
17552
|
"svg",
|
|
17273
17553
|
{
|
|
17274
17554
|
width: 86,
|
|
@@ -17276,77 +17556,77 @@ var Badge = () => {
|
|
|
17276
17556
|
viewBox: "0 0 86 16",
|
|
17277
17557
|
style: { marginTop: "0.125rem" },
|
|
17278
17558
|
children: [
|
|
17279
|
-
/* @__PURE__ */
|
|
17559
|
+
/* @__PURE__ */ jsx21(
|
|
17280
17560
|
"path",
|
|
17281
17561
|
{
|
|
17282
17562
|
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",
|
|
17283
17563
|
fill: "currentColor"
|
|
17284
17564
|
}
|
|
17285
17565
|
),
|
|
17286
|
-
/* @__PURE__ */
|
|
17566
|
+
/* @__PURE__ */ jsx21(
|
|
17287
17567
|
"path",
|
|
17288
17568
|
{
|
|
17289
17569
|
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",
|
|
17290
17570
|
fill: "currentColor"
|
|
17291
17571
|
}
|
|
17292
17572
|
),
|
|
17293
|
-
/* @__PURE__ */
|
|
17573
|
+
/* @__PURE__ */ jsx21(
|
|
17294
17574
|
"path",
|
|
17295
17575
|
{
|
|
17296
17576
|
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",
|
|
17297
17577
|
fill: "currentColor"
|
|
17298
17578
|
}
|
|
17299
17579
|
),
|
|
17300
|
-
/* @__PURE__ */
|
|
17580
|
+
/* @__PURE__ */ jsx21(
|
|
17301
17581
|
"path",
|
|
17302
17582
|
{
|
|
17303
17583
|
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",
|
|
17304
17584
|
fill: "currentColor"
|
|
17305
17585
|
}
|
|
17306
17586
|
),
|
|
17307
|
-
/* @__PURE__ */
|
|
17587
|
+
/* @__PURE__ */ jsx21(
|
|
17308
17588
|
"path",
|
|
17309
17589
|
{
|
|
17310
17590
|
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",
|
|
17311
17591
|
fill: "currentColor"
|
|
17312
17592
|
}
|
|
17313
17593
|
),
|
|
17314
|
-
/* @__PURE__ */
|
|
17594
|
+
/* @__PURE__ */ jsx21(
|
|
17315
17595
|
"path",
|
|
17316
17596
|
{
|
|
17317
17597
|
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",
|
|
17318
17598
|
fill: "currentColor"
|
|
17319
17599
|
}
|
|
17320
17600
|
),
|
|
17321
|
-
/* @__PURE__ */
|
|
17601
|
+
/* @__PURE__ */ jsx21(
|
|
17322
17602
|
"path",
|
|
17323
17603
|
{
|
|
17324
17604
|
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",
|
|
17325
17605
|
fill: "currentColor"
|
|
17326
17606
|
}
|
|
17327
17607
|
),
|
|
17328
|
-
/* @__PURE__ */
|
|
17608
|
+
/* @__PURE__ */ jsx21(
|
|
17329
17609
|
"path",
|
|
17330
17610
|
{
|
|
17331
17611
|
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",
|
|
17332
17612
|
fill: "currentColor"
|
|
17333
17613
|
}
|
|
17334
17614
|
),
|
|
17335
|
-
/* @__PURE__ */
|
|
17615
|
+
/* @__PURE__ */ jsx21(
|
|
17336
17616
|
"path",
|
|
17337
17617
|
{
|
|
17338
17618
|
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",
|
|
17339
17619
|
fill: "currentColor"
|
|
17340
17620
|
}
|
|
17341
17621
|
),
|
|
17342
|
-
/* @__PURE__ */
|
|
17622
|
+
/* @__PURE__ */ jsx21(
|
|
17343
17623
|
"path",
|
|
17344
17624
|
{
|
|
17345
17625
|
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",
|
|
17346
17626
|
fill: "currentColor"
|
|
17347
17627
|
}
|
|
17348
17628
|
),
|
|
17349
|
-
/* @__PURE__ */
|
|
17629
|
+
/* @__PURE__ */ jsx21(
|
|
17350
17630
|
"path",
|
|
17351
17631
|
{
|
|
17352
17632
|
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",
|
|
@@ -17362,11 +17642,11 @@ var Badge = () => {
|
|
|
17362
17642
|
};
|
|
17363
17643
|
|
|
17364
17644
|
// src/components/layout/RenderLayout.tsx
|
|
17365
|
-
import { useEffect as useEffect6, useState as
|
|
17366
|
-
import { jsx as
|
|
17645
|
+
import { useEffect as useEffect6, useState as useState11 } from "react";
|
|
17646
|
+
import { jsx as jsx22, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
17367
17647
|
var Disabled = () => {
|
|
17368
17648
|
const theme = nt();
|
|
17369
|
-
return /* @__PURE__ */
|
|
17649
|
+
return /* @__PURE__ */ jsx22(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx22(Card, { children: /* @__PURE__ */ jsxs17(
|
|
17370
17650
|
Element,
|
|
17371
17651
|
{
|
|
17372
17652
|
as: Flex,
|
|
@@ -17375,7 +17655,7 @@ var Disabled = () => {
|
|
|
17375
17655
|
$alignItems: "center",
|
|
17376
17656
|
$whiteSpace: "nowrap",
|
|
17377
17657
|
children: [
|
|
17378
|
-
/* @__PURE__ */
|
|
17658
|
+
/* @__PURE__ */ jsx22(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx22(
|
|
17379
17659
|
Text,
|
|
17380
17660
|
{
|
|
17381
17661
|
as: "h1",
|
|
@@ -17386,7 +17666,7 @@ var Disabled = () => {
|
|
|
17386
17666
|
children: "Portal not found"
|
|
17387
17667
|
}
|
|
17388
17668
|
) }),
|
|
17389
|
-
/* @__PURE__ */
|
|
17669
|
+
/* @__PURE__ */ jsx22(
|
|
17390
17670
|
Text,
|
|
17391
17671
|
{
|
|
17392
17672
|
as: "p",
|
|
@@ -17404,7 +17684,7 @@ var Disabled = () => {
|
|
|
17404
17684
|
var Success = () => {
|
|
17405
17685
|
const theme = nt();
|
|
17406
17686
|
const { hydrate, data, api, setLayout, isPending } = useEmbed();
|
|
17407
|
-
const [isOpen, setIsOpen] =
|
|
17687
|
+
const [isOpen, setIsOpen] = useState11(true);
|
|
17408
17688
|
useEffect6(() => {
|
|
17409
17689
|
if (api && data.component?.id) {
|
|
17410
17690
|
hydrate();
|
|
@@ -17416,7 +17696,7 @@ var Success = () => {
|
|
|
17416
17696
|
setLayout("portal");
|
|
17417
17697
|
}
|
|
17418
17698
|
}, [isPending, isOpen, setLayout]);
|
|
17419
|
-
return /* @__PURE__ */
|
|
17699
|
+
return /* @__PURE__ */ jsx22(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx22(Card, { children: /* @__PURE__ */ jsxs17(
|
|
17420
17700
|
Element,
|
|
17421
17701
|
{
|
|
17422
17702
|
as: Flex,
|
|
@@ -17425,7 +17705,7 @@ var Success = () => {
|
|
|
17425
17705
|
$alignItems: "center",
|
|
17426
17706
|
$whiteSpace: "nowrap",
|
|
17427
17707
|
children: [
|
|
17428
|
-
/* @__PURE__ */
|
|
17708
|
+
/* @__PURE__ */ jsx22(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx22(
|
|
17429
17709
|
IconRound,
|
|
17430
17710
|
{
|
|
17431
17711
|
name: "check",
|
|
@@ -17433,7 +17713,7 @@ var Success = () => {
|
|
|
17433
17713
|
colors: [theme.card.background, theme.primary]
|
|
17434
17714
|
}
|
|
17435
17715
|
) }),
|
|
17436
|
-
/* @__PURE__ */
|
|
17716
|
+
/* @__PURE__ */ jsx22(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx22(
|
|
17437
17717
|
Text,
|
|
17438
17718
|
{
|
|
17439
17719
|
as: "h1",
|
|
@@ -17444,7 +17724,7 @@ var Success = () => {
|
|
|
17444
17724
|
children: "Subscription updated!"
|
|
17445
17725
|
}
|
|
17446
17726
|
) }),
|
|
17447
|
-
/* @__PURE__ */
|
|
17727
|
+
/* @__PURE__ */ jsx22(
|
|
17448
17728
|
Text,
|
|
17449
17729
|
{
|
|
17450
17730
|
as: "p",
|
|
@@ -17463,9 +17743,9 @@ var RenderLayout = ({ children }) => {
|
|
|
17463
17743
|
const { layout } = useEmbed();
|
|
17464
17744
|
switch (layout) {
|
|
17465
17745
|
case "disabled":
|
|
17466
|
-
return /* @__PURE__ */
|
|
17746
|
+
return /* @__PURE__ */ jsx22(Disabled, {});
|
|
17467
17747
|
case "success":
|
|
17468
|
-
return /* @__PURE__ */
|
|
17748
|
+
return /* @__PURE__ */ jsx22(Success, {});
|
|
17469
17749
|
default:
|
|
17470
17750
|
return children;
|
|
17471
17751
|
}
|
|
@@ -17490,14 +17770,14 @@ var StyledViewport = dt(Box).attrs(({ theme }) => ({
|
|
|
17490
17770
|
`;
|
|
17491
17771
|
|
|
17492
17772
|
// src/components/layout/viewport/Viewport.tsx
|
|
17493
|
-
import { Fragment as Fragment9, jsx as
|
|
17773
|
+
import { Fragment as Fragment9, jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
17494
17774
|
var Viewport = forwardRef4(
|
|
17495
17775
|
({ children, portal, ...props }, ref) => {
|
|
17496
17776
|
const { data, layout } = useEmbed();
|
|
17497
|
-
const [top, setTop] =
|
|
17777
|
+
const [top, setTop] = useState12(0);
|
|
17498
17778
|
const canCheckout = data.capabilities?.checkout ?? true;
|
|
17499
17779
|
useLayoutEffect5(() => {
|
|
17500
|
-
if (layout !== "checkout") {
|
|
17780
|
+
if (layout !== "checkout" && layout !== "unsubscribe") {
|
|
17501
17781
|
return;
|
|
17502
17782
|
}
|
|
17503
17783
|
const parent = portal || document.body;
|
|
@@ -17510,12 +17790,13 @@ var Viewport = forwardRef4(
|
|
|
17510
17790
|
parent.style.overflow = "";
|
|
17511
17791
|
};
|
|
17512
17792
|
}, [layout, portal]);
|
|
17513
|
-
return /* @__PURE__ */
|
|
17514
|
-
/* @__PURE__ */
|
|
17515
|
-
/* @__PURE__ */
|
|
17516
|
-
/* @__PURE__ */
|
|
17793
|
+
return /* @__PURE__ */ jsxs18(Fragment9, { children: [
|
|
17794
|
+
/* @__PURE__ */ jsxs18(StyledViewport, { ref, ...props, children: [
|
|
17795
|
+
/* @__PURE__ */ jsx23(RenderLayout, { children }),
|
|
17796
|
+
/* @__PURE__ */ jsx23(Badge, {})
|
|
17517
17797
|
] }),
|
|
17518
|
-
canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */
|
|
17798
|
+
canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx23(CheckoutDialog, { top }), portal || document.body),
|
|
17799
|
+
layout === "unsubscribe" && createPortal2(/* @__PURE__ */ jsx23(UnsubscribeDialog, {}), portal || document.body)
|
|
17519
17800
|
] });
|
|
17520
17801
|
}
|
|
17521
17802
|
);
|
|
@@ -17568,10 +17849,10 @@ var StyledCard = dt.div(({ theme }) => {
|
|
|
17568
17849
|
});
|
|
17569
17850
|
|
|
17570
17851
|
// src/components/layout/card/Card.tsx
|
|
17571
|
-
import { jsx as
|
|
17852
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
17572
17853
|
var Card = forwardRef5(
|
|
17573
17854
|
({ children, className }, ref) => {
|
|
17574
|
-
return /* @__PURE__ */
|
|
17855
|
+
return /* @__PURE__ */ jsx24(StyledCard, { ref, className, children });
|
|
17575
17856
|
}
|
|
17576
17857
|
);
|
|
17577
17858
|
Card.displayName = "Card";
|
|
@@ -17582,18 +17863,18 @@ var StyledColumn = dt.div`
|
|
|
17582
17863
|
`;
|
|
17583
17864
|
|
|
17584
17865
|
// src/components/layout/column/Column.tsx
|
|
17585
|
-
import { jsx as
|
|
17866
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
17586
17867
|
var Column = forwardRef6(
|
|
17587
17868
|
({ children, basis, ...props }, ref) => {
|
|
17588
|
-
return /* @__PURE__ */
|
|
17869
|
+
return /* @__PURE__ */ jsx25(StyledColumn, { ref, ...props, children: /* @__PURE__ */ jsx25(Card, { children }) });
|
|
17589
17870
|
}
|
|
17590
17871
|
);
|
|
17591
17872
|
Column.displayName = "Column";
|
|
17592
17873
|
|
|
17593
17874
|
// src/components/elements/included-features/Details.tsx
|
|
17594
|
-
import { useMemo as
|
|
17875
|
+
import { useMemo as useMemo8 } from "react";
|
|
17595
17876
|
var import_pluralize4 = __toESM(require_pluralize());
|
|
17596
|
-
import { jsx as
|
|
17877
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
17597
17878
|
var Details = ({
|
|
17598
17879
|
details,
|
|
17599
17880
|
shouldWrapChildren,
|
|
@@ -17611,7 +17892,7 @@ var Details = ({
|
|
|
17611
17892
|
const { t: t2 } = useTranslation();
|
|
17612
17893
|
const theme = nt();
|
|
17613
17894
|
const { data } = useEmbed();
|
|
17614
|
-
const currency =
|
|
17895
|
+
const currency = useMemo8(() => {
|
|
17615
17896
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17616
17897
|
return monthlyUsageBasedPrice?.currency;
|
|
17617
17898
|
}
|
|
@@ -17623,7 +17904,7 @@ var Details = ({
|
|
|
17623
17904
|
monthlyUsageBasedPrice,
|
|
17624
17905
|
yearlyUsageBasedPrice
|
|
17625
17906
|
]);
|
|
17626
|
-
const price =
|
|
17907
|
+
const price = useMemo8(() => {
|
|
17627
17908
|
if (data.company?.plan?.planPeriod === "month") {
|
|
17628
17909
|
return monthlyUsageBasedPrice?.price;
|
|
17629
17910
|
}
|
|
@@ -17635,7 +17916,7 @@ var Details = ({
|
|
|
17635
17916
|
monthlyUsageBasedPrice,
|
|
17636
17917
|
yearlyUsageBasedPrice
|
|
17637
17918
|
]);
|
|
17638
|
-
const text =
|
|
17919
|
+
const text = useMemo8(() => {
|
|
17639
17920
|
if (!feature?.name) {
|
|
17640
17921
|
return;
|
|
17641
17922
|
}
|
|
@@ -17652,7 +17933,7 @@ var Details = ({
|
|
|
17652
17933
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17653
17934
|
}
|
|
17654
17935
|
}, [allocation, feature?.name, price, priceBehavior, t2, currency]);
|
|
17655
|
-
const usageText =
|
|
17936
|
+
const usageText = useMemo8(() => {
|
|
17656
17937
|
if (!feature?.name) {
|
|
17657
17938
|
return;
|
|
17658
17939
|
}
|
|
@@ -17694,14 +17975,14 @@ var Details = ({
|
|
|
17694
17975
|
if (!text) {
|
|
17695
17976
|
return null;
|
|
17696
17977
|
}
|
|
17697
|
-
return /* @__PURE__ */
|
|
17978
|
+
return /* @__PURE__ */ jsxs19(
|
|
17698
17979
|
Box,
|
|
17699
17980
|
{
|
|
17700
17981
|
$flexBasis: "min-content",
|
|
17701
17982
|
$flexGrow: "1",
|
|
17702
17983
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
17703
17984
|
children: [
|
|
17704
|
-
props.entitlement.isVisible && /* @__PURE__ */
|
|
17985
|
+
props.entitlement.isVisible && /* @__PURE__ */ jsx26(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx26(
|
|
17705
17986
|
Text,
|
|
17706
17987
|
{
|
|
17707
17988
|
$font: theme.typography[props.entitlement.fontStyle].fontFamily,
|
|
@@ -17712,7 +17993,7 @@ var Details = ({
|
|
|
17712
17993
|
children: text
|
|
17713
17994
|
}
|
|
17714
17995
|
) }),
|
|
17715
|
-
props.usage.isVisible && usageText && /* @__PURE__ */
|
|
17996
|
+
props.usage.isVisible && usageText && /* @__PURE__ */ jsx26(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx26(
|
|
17716
17997
|
Text,
|
|
17717
17998
|
{
|
|
17718
17999
|
$font: theme.typography[props.usage.fontStyle].fontFamily,
|
|
@@ -17729,7 +18010,7 @@ var Details = ({
|
|
|
17729
18010
|
};
|
|
17730
18011
|
|
|
17731
18012
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
17732
|
-
import { jsx as
|
|
18013
|
+
import { jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
17733
18014
|
function resolveDesignProps(props) {
|
|
17734
18015
|
return {
|
|
17735
18016
|
header: {
|
|
@@ -17766,7 +18047,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17766
18047
|
const elements = useRef6([]);
|
|
17767
18048
|
const shouldWrapChildren = useWrapChildren(elements.current);
|
|
17768
18049
|
const isLightBackground = useIsLightBackground();
|
|
17769
|
-
const [showCount, setShowCount] =
|
|
18050
|
+
const [showCount, setShowCount] = useState13(VISIBLE_ENTITLEMENT_COUNT);
|
|
17770
18051
|
const entitlements = (props.visibleFeatures ? props.visibleFeatures : data.featureUsage?.features.sort((a2, b2) => {
|
|
17771
18052
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
17772
18053
|
return 1;
|
|
@@ -17810,7 +18091,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17810
18091
|
}
|
|
17811
18092
|
const shouldShowExpand = featureListSize > VISIBLE_ENTITLEMENT_COUNT;
|
|
17812
18093
|
const isExpanded = showCount > VISIBLE_ENTITLEMENT_COUNT;
|
|
17813
|
-
return /* @__PURE__ */
|
|
18094
|
+
return /* @__PURE__ */ jsxs20(
|
|
17814
18095
|
Element,
|
|
17815
18096
|
{
|
|
17816
18097
|
as: Flex,
|
|
@@ -17819,7 +18100,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17819
18100
|
$flexDirection: "column",
|
|
17820
18101
|
$gap: "1rem",
|
|
17821
18102
|
children: [
|
|
17822
|
-
props.header.isVisible && /* @__PURE__ */
|
|
18103
|
+
props.header.isVisible && /* @__PURE__ */ jsx27(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx27(
|
|
17823
18104
|
Text,
|
|
17824
18105
|
{
|
|
17825
18106
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -17832,7 +18113,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17832
18113
|
entitlements.slice(0, showCount).map((entitlement, index) => {
|
|
17833
18114
|
const { entitlementExpirationDate, feature } = entitlement.featureUsage || {};
|
|
17834
18115
|
const shouldShowDetails = feature?.name && (feature?.featureType === "event" || feature?.featureType === "trait");
|
|
17835
|
-
return /* @__PURE__ */
|
|
18116
|
+
return /* @__PURE__ */ jsxs20(
|
|
17836
18117
|
Flex,
|
|
17837
18118
|
{
|
|
17838
18119
|
ref: (el) => {
|
|
@@ -17845,7 +18126,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17845
18126
|
$alignItems: "center",
|
|
17846
18127
|
$gap: "1rem",
|
|
17847
18128
|
children: [
|
|
17848
|
-
/* @__PURE__ */
|
|
18129
|
+
/* @__PURE__ */ jsxs20(
|
|
17849
18130
|
Flex,
|
|
17850
18131
|
{
|
|
17851
18132
|
$alignItems: "center",
|
|
@@ -17853,7 +18134,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17853
18134
|
$flexBasis: "min-content",
|
|
17854
18135
|
$gap: "1rem",
|
|
17855
18136
|
children: [
|
|
17856
|
-
props.icons.isVisible && feature?.icon && /* @__PURE__ */
|
|
18137
|
+
props.icons.isVisible && feature?.icon && /* @__PURE__ */ jsx27(
|
|
17857
18138
|
IconRound,
|
|
17858
18139
|
{
|
|
17859
18140
|
name: feature.icon,
|
|
@@ -17864,7 +18145,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17864
18145
|
]
|
|
17865
18146
|
}
|
|
17866
18147
|
),
|
|
17867
|
-
feature?.name && /* @__PURE__ */
|
|
18148
|
+
feature?.name && /* @__PURE__ */ jsx27(
|
|
17868
18149
|
Text,
|
|
17869
18150
|
{
|
|
17870
18151
|
$font: theme.typography[props.icons.fontStyle].fontFamily,
|
|
@@ -17874,7 +18155,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17874
18155
|
children: feature.name
|
|
17875
18156
|
}
|
|
17876
18157
|
),
|
|
17877
|
-
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */
|
|
18158
|
+
props.entitlementExpiration.isVisible && entitlementExpirationDate && /* @__PURE__ */ jsxs20(
|
|
17878
18159
|
Text,
|
|
17879
18160
|
{
|
|
17880
18161
|
$font: theme.typography[props.entitlementExpiration.fontStyle].fontFamily,
|
|
@@ -17894,7 +18175,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17894
18175
|
]
|
|
17895
18176
|
}
|
|
17896
18177
|
),
|
|
17897
|
-
shouldShowDetails && /* @__PURE__ */
|
|
18178
|
+
shouldShowDetails && /* @__PURE__ */ jsx27(
|
|
17898
18179
|
Details,
|
|
17899
18180
|
{
|
|
17900
18181
|
details: entitlement,
|
|
@@ -17907,8 +18188,8 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17907
18188
|
index
|
|
17908
18189
|
);
|
|
17909
18190
|
}),
|
|
17910
|
-
shouldShowExpand && /* @__PURE__ */
|
|
17911
|
-
/* @__PURE__ */
|
|
18191
|
+
shouldShowExpand && /* @__PURE__ */ jsxs20(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
|
|
18192
|
+
/* @__PURE__ */ jsx27(
|
|
17912
18193
|
Icon2,
|
|
17913
18194
|
{
|
|
17914
18195
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -17920,7 +18201,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17920
18201
|
}
|
|
17921
18202
|
}
|
|
17922
18203
|
),
|
|
17923
|
-
/* @__PURE__ */
|
|
18204
|
+
/* @__PURE__ */ jsx27(
|
|
17924
18205
|
Text,
|
|
17925
18206
|
{
|
|
17926
18207
|
onClick: handleToggleShowAll,
|
|
@@ -17941,8 +18222,8 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
17941
18222
|
IncludedFeatures.displayName = "IncludedFeatures";
|
|
17942
18223
|
|
|
17943
18224
|
// src/components/elements/invoices/Invoices.tsx
|
|
17944
|
-
import { forwardRef as forwardRef8, useEffect as useEffect7, useState as
|
|
17945
|
-
import { jsx as
|
|
18225
|
+
import { forwardRef as forwardRef8, useEffect as useEffect7, useState as useState14 } from "react";
|
|
18226
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
17946
18227
|
function resolveDesignProps2(props) {
|
|
17947
18228
|
return {
|
|
17948
18229
|
header: {
|
|
@@ -17978,7 +18259,7 @@ function formatInvoices(invoices) {
|
|
|
17978
18259
|
}
|
|
17979
18260
|
var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
17980
18261
|
const theme = nt();
|
|
17981
|
-
const dateText = /* @__PURE__ */
|
|
18262
|
+
const dateText = /* @__PURE__ */ jsx28(
|
|
17982
18263
|
Text,
|
|
17983
18264
|
{
|
|
17984
18265
|
...url && { onClick: () => {
|
|
@@ -17991,7 +18272,7 @@ var InvoiceDate = ({ date, fontStyle, url }) => {
|
|
|
17991
18272
|
}
|
|
17992
18273
|
);
|
|
17993
18274
|
if (url) {
|
|
17994
|
-
return /* @__PURE__ */
|
|
18275
|
+
return /* @__PURE__ */ jsx28("a", { href: url, target: "_blank", rel: "noreferrer", children: dateText });
|
|
17995
18276
|
}
|
|
17996
18277
|
return dateText;
|
|
17997
18278
|
};
|
|
@@ -18000,8 +18281,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
18000
18281
|
const { t: t2 } = useTranslation();
|
|
18001
18282
|
const theme = nt();
|
|
18002
18283
|
const { api } = useEmbed();
|
|
18003
|
-
const [invoices, setInvoices] =
|
|
18004
|
-
const [listSize, setListSize] =
|
|
18284
|
+
const [invoices, setInvoices] = useState14(() => formatInvoices(data));
|
|
18285
|
+
const [listSize, setListSize] = useState14(props.limit.number);
|
|
18005
18286
|
const toggleListSize = () => {
|
|
18006
18287
|
setListSize(
|
|
18007
18288
|
(prev2) => prev2 !== props.limit.number ? props.limit.number : MAX_VISIBLE_INVOICE_COUNT
|
|
@@ -18015,8 +18296,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
18015
18296
|
if (invoices.length === 0) {
|
|
18016
18297
|
return null;
|
|
18017
18298
|
}
|
|
18018
|
-
return /* @__PURE__ */
|
|
18019
|
-
props.header.isVisible && /* @__PURE__ */
|
|
18299
|
+
return /* @__PURE__ */ jsx28(Element, { ref, className, children: /* @__PURE__ */ jsxs21(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
18300
|
+
props.header.isVisible && /* @__PURE__ */ jsx28(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx28(
|
|
18020
18301
|
Text,
|
|
18021
18302
|
{
|
|
18022
18303
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18026,9 +18307,9 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
18026
18307
|
children: t2("Invoices")
|
|
18027
18308
|
}
|
|
18028
18309
|
) }),
|
|
18029
|
-
/* @__PURE__ */
|
|
18030
|
-
return /* @__PURE__ */
|
|
18031
|
-
props.date.isVisible && date && /* @__PURE__ */
|
|
18310
|
+
/* @__PURE__ */ jsx28(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
|
|
18311
|
+
return /* @__PURE__ */ jsxs21(Flex, { $justifyContent: "space-between", children: [
|
|
18312
|
+
props.date.isVisible && date && /* @__PURE__ */ jsx28(
|
|
18032
18313
|
InvoiceDate,
|
|
18033
18314
|
{
|
|
18034
18315
|
date,
|
|
@@ -18036,7 +18317,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
18036
18317
|
url
|
|
18037
18318
|
}
|
|
18038
18319
|
),
|
|
18039
|
-
props.amount.isVisible && /* @__PURE__ */
|
|
18320
|
+
props.amount.isVisible && /* @__PURE__ */ jsx28(
|
|
18040
18321
|
Text,
|
|
18041
18322
|
{
|
|
18042
18323
|
$font: theme.typography[props.amount.fontStyle].fontFamily,
|
|
@@ -18048,15 +18329,15 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
18048
18329
|
)
|
|
18049
18330
|
] }, index);
|
|
18050
18331
|
}) }),
|
|
18051
|
-
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */
|
|
18052
|
-
/* @__PURE__ */
|
|
18332
|
+
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs21(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18333
|
+
/* @__PURE__ */ jsx28(
|
|
18053
18334
|
Icon2,
|
|
18054
18335
|
{
|
|
18055
18336
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
18056
18337
|
style: { color: "#D0D0D0" }
|
|
18057
18338
|
}
|
|
18058
18339
|
),
|
|
18059
|
-
/* @__PURE__ */
|
|
18340
|
+
/* @__PURE__ */ jsx28(
|
|
18060
18341
|
Text,
|
|
18061
18342
|
{
|
|
18062
18343
|
onClick: toggleListSize,
|
|
@@ -18094,7 +18375,7 @@ var Container4 = dt(Flex)`
|
|
|
18094
18375
|
`;
|
|
18095
18376
|
|
|
18096
18377
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
18097
|
-
import { Fragment as Fragment10, jsx as
|
|
18378
|
+
import { Fragment as Fragment10, jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
18098
18379
|
function resolveDesignProps3(props) {
|
|
18099
18380
|
return {
|
|
18100
18381
|
isVisible: props.isVisible ?? true,
|
|
@@ -18144,7 +18425,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18144
18425
|
if (!shouldShowFeatures) {
|
|
18145
18426
|
return null;
|
|
18146
18427
|
}
|
|
18147
|
-
return /* @__PURE__ */
|
|
18428
|
+
return /* @__PURE__ */ jsx29(Container4, { ref, className, children: featureUsage.map(
|
|
18148
18429
|
({
|
|
18149
18430
|
allocation,
|
|
18150
18431
|
feature,
|
|
@@ -18163,8 +18444,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18163
18444
|
price = yearlyUsageBasedPrice?.price;
|
|
18164
18445
|
currency = yearlyUsageBasedPrice?.currency;
|
|
18165
18446
|
}
|
|
18166
|
-
return /* @__PURE__ */
|
|
18167
|
-
props.icon.isVisible && feature?.icon && /* @__PURE__ */
|
|
18447
|
+
return /* @__PURE__ */ jsxs22(Element, { as: Flex, $gap: "1.5rem", children: [
|
|
18448
|
+
props.icon.isVisible && feature?.icon && /* @__PURE__ */ jsx29(
|
|
18168
18449
|
IconRound,
|
|
18169
18450
|
{
|
|
18170
18451
|
name: feature.icon,
|
|
@@ -18175,8 +18456,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18175
18456
|
]
|
|
18176
18457
|
}
|
|
18177
18458
|
),
|
|
18178
|
-
/* @__PURE__ */
|
|
18179
|
-
/* @__PURE__ */
|
|
18459
|
+
/* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: "1", children: [
|
|
18460
|
+
/* @__PURE__ */ jsxs22(
|
|
18180
18461
|
Flex,
|
|
18181
18462
|
{
|
|
18182
18463
|
ref: (el) => {
|
|
@@ -18187,8 +18468,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18187
18468
|
$flexWrap: "wrap",
|
|
18188
18469
|
$gap: "1rem",
|
|
18189
18470
|
children: [
|
|
18190
|
-
feature?.name && /* @__PURE__ */
|
|
18191
|
-
/* @__PURE__ */
|
|
18471
|
+
feature?.name && /* @__PURE__ */ jsxs22(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: "1", children: [
|
|
18472
|
+
/* @__PURE__ */ jsx29(
|
|
18192
18473
|
Text,
|
|
18193
18474
|
{
|
|
18194
18475
|
as: Box,
|
|
@@ -18196,14 +18477,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18196
18477
|
$size: theme.typography[props.header.fontStyle].fontSize,
|
|
18197
18478
|
$weight: theme.typography[props.header.fontStyle].fontWeight,
|
|
18198
18479
|
$color: theme.typography[props.header.fontStyle].color,
|
|
18199
|
-
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */
|
|
18480
|
+
children: priceBehavior === "pay_as_you_go" ? typeof usage === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
18200
18481
|
formatNumber(usage),
|
|
18201
18482
|
" ",
|
|
18202
18483
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18203
18484
|
] }) : feature.name
|
|
18204
18485
|
}
|
|
18205
18486
|
),
|
|
18206
|
-
props.description.isVisible && /* @__PURE__ */
|
|
18487
|
+
props.description.isVisible && /* @__PURE__ */ jsx29(
|
|
18207
18488
|
Text,
|
|
18208
18489
|
{
|
|
18209
18490
|
as: Box,
|
|
@@ -18215,14 +18496,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18215
18496
|
}
|
|
18216
18497
|
)
|
|
18217
18498
|
] }),
|
|
18218
|
-
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */
|
|
18499
|
+
(feature?.featureType === "event" || feature?.featureType === "trait") && feature?.name && /* @__PURE__ */ jsxs22(
|
|
18219
18500
|
Box,
|
|
18220
18501
|
{
|
|
18221
18502
|
$flexBasis: "min-content",
|
|
18222
18503
|
$flexGrow: "1",
|
|
18223
18504
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
18224
18505
|
children: [
|
|
18225
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
18506
|
+
props.usage.isVisible && /* @__PURE__ */ jsx29(
|
|
18226
18507
|
Text,
|
|
18227
18508
|
{
|
|
18228
18509
|
as: Box,
|
|
@@ -18231,18 +18512,18 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18231
18512
|
$weight: theme.typography[props.usage.fontStyle].fontWeight,
|
|
18232
18513
|
$leading: 1.25,
|
|
18233
18514
|
$color: theme.typography[props.usage.fontStyle].color,
|
|
18234
|
-
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */
|
|
18515
|
+
children: priceBehavior === "pay_in_advance" ? typeof allocation === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
18235
18516
|
formatNumber(allocation),
|
|
18236
18517
|
" ",
|
|
18237
18518
|
(0, import_pluralize5.default)(feature.name, allocation)
|
|
18238
|
-
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */
|
|
18519
|
+
] }) : priceBehavior === "pay_as_you_go" ? typeof price === "number" && typeof usage === "number" && formatCurrency(usage * price, currency) : typeof usage === "number" && /* @__PURE__ */ jsxs22(Fragment10, { children: [
|
|
18239
18520
|
formatNumber(usage),
|
|
18240
18521
|
" ",
|
|
18241
18522
|
(0, import_pluralize5.default)(feature.name, usage)
|
|
18242
18523
|
] })
|
|
18243
18524
|
}
|
|
18244
18525
|
),
|
|
18245
|
-
props.allocation.isVisible && /* @__PURE__ */
|
|
18526
|
+
props.allocation.isVisible && /* @__PURE__ */ jsx29(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx29(
|
|
18246
18527
|
Text,
|
|
18247
18528
|
{
|
|
18248
18529
|
$font: theme.typography[props.allocation.fontStyle].fontFamily,
|
|
@@ -18266,8 +18547,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18266
18547
|
]
|
|
18267
18548
|
}
|
|
18268
18549
|
),
|
|
18269
|
-
props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */
|
|
18270
|
-
/* @__PURE__ */
|
|
18550
|
+
props.isVisible && typeof usage === "number" && typeof allocation === "number" && priceBehavior !== "pay_as_you_go" && /* @__PURE__ */ jsxs22(Flex, { $gap: "2rem", children: [
|
|
18551
|
+
/* @__PURE__ */ jsx29(
|
|
18271
18552
|
ProgressBar,
|
|
18272
18553
|
{
|
|
18273
18554
|
progress: usage / allocation * 100,
|
|
@@ -18279,7 +18560,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
18279
18560
|
$flexGrow: "1"
|
|
18280
18561
|
}
|
|
18281
18562
|
),
|
|
18282
|
-
priceBehavior === "pay_in_advance" && /* @__PURE__ */
|
|
18563
|
+
priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsx29(
|
|
18283
18564
|
EmbedButton,
|
|
18284
18565
|
{
|
|
18285
18566
|
onClick: () => {
|
|
@@ -18304,15 +18585,15 @@ MeteredFeatures.displayName = "MeteredFeatures";
|
|
|
18304
18585
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
18305
18586
|
import {
|
|
18306
18587
|
forwardRef as forwardRef10,
|
|
18307
|
-
useCallback as
|
|
18588
|
+
useCallback as useCallback9,
|
|
18308
18589
|
useEffect as useEffect8,
|
|
18309
18590
|
useLayoutEffect as useLayoutEffect6,
|
|
18310
|
-
useMemo as
|
|
18311
|
-
useState as
|
|
18591
|
+
useMemo as useMemo9,
|
|
18592
|
+
useState as useState15
|
|
18312
18593
|
} from "react";
|
|
18313
18594
|
import { createPortal as createPortal3 } from "react-dom";
|
|
18314
18595
|
import { Elements as Elements2 } from "@stripe/react-stripe-js";
|
|
18315
|
-
import { Fragment as Fragment11, jsx as
|
|
18596
|
+
import { Fragment as Fragment11, jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
18316
18597
|
var PaymentElement2 = ({
|
|
18317
18598
|
iconName,
|
|
18318
18599
|
iconTitle,
|
|
@@ -18321,11 +18602,11 @@ var PaymentElement2 = ({
|
|
|
18321
18602
|
paymentLast4
|
|
18322
18603
|
}) => {
|
|
18323
18604
|
const theme = nt();
|
|
18324
|
-
return /* @__PURE__ */
|
|
18325
|
-
iconName && /* @__PURE__ */
|
|
18326
|
-
/* @__PURE__ */
|
|
18327
|
-
/* @__PURE__ */
|
|
18328
|
-
paymentLast4 && /* @__PURE__ */
|
|
18605
|
+
return /* @__PURE__ */ jsx30(Fragment11, { children: /* @__PURE__ */ jsx30(Text, { $font: theme.typography.text.fontFamily, $size: 16, children: /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "row", $alignItems: "center", children: [
|
|
18606
|
+
iconName && /* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(Icon2, { name: iconName, title: iconTitle, style: iconStyles }) }),
|
|
18607
|
+
/* @__PURE__ */ jsxs23(Flex, { $alignItems: "center", children: [
|
|
18608
|
+
/* @__PURE__ */ jsx30(Box, { $lineHeight: "1", $marginRight: "4px", children: t(label) }),
|
|
18609
|
+
paymentLast4 && /* @__PURE__ */ jsx30(Box, { $display: "inline-block", $fontWeight: "bold", children: paymentLast4 })
|
|
18329
18610
|
] })
|
|
18330
18611
|
] }) }) });
|
|
18331
18612
|
};
|
|
@@ -18423,16 +18704,16 @@ var PaymentMethodElement = ({
|
|
|
18423
18704
|
iconTitle: genericLabel,
|
|
18424
18705
|
label: genericLabel
|
|
18425
18706
|
};
|
|
18426
|
-
return /* @__PURE__ */
|
|
18707
|
+
return /* @__PURE__ */ jsx30(
|
|
18427
18708
|
PaymentElement2,
|
|
18428
18709
|
{
|
|
18429
18710
|
...paymentMethodElementProps(iconName, iconTitle, label, paymentLast4)
|
|
18430
18711
|
}
|
|
18431
18712
|
);
|
|
18432
18713
|
};
|
|
18433
|
-
return /* @__PURE__ */
|
|
18434
|
-
props.header.isVisible && /* @__PURE__ */
|
|
18435
|
-
/* @__PURE__ */
|
|
18714
|
+
return /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
18715
|
+
props.header.isVisible && /* @__PURE__ */ jsxs23(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
18716
|
+
/* @__PURE__ */ jsx30(
|
|
18436
18717
|
Text,
|
|
18437
18718
|
{
|
|
18438
18719
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -18442,7 +18723,7 @@ var PaymentMethodElement = ({
|
|
|
18442
18723
|
children: t2("Payment Method")
|
|
18443
18724
|
}
|
|
18444
18725
|
),
|
|
18445
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */
|
|
18726
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx30(
|
|
18446
18727
|
Text,
|
|
18447
18728
|
{
|
|
18448
18729
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18452,7 +18733,7 @@ var PaymentMethodElement = ({
|
|
|
18452
18733
|
}
|
|
18453
18734
|
)
|
|
18454
18735
|
] }),
|
|
18455
|
-
/* @__PURE__ */
|
|
18736
|
+
/* @__PURE__ */ jsxs23(
|
|
18456
18737
|
Flex,
|
|
18457
18738
|
{
|
|
18458
18739
|
$justifyContent: "space-between",
|
|
@@ -18462,7 +18743,7 @@ var PaymentMethodElement = ({
|
|
|
18462
18743
|
$borderRadius: "9999px",
|
|
18463
18744
|
children: [
|
|
18464
18745
|
renderPaymentMethodElement(),
|
|
18465
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */
|
|
18746
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx30(
|
|
18466
18747
|
Text,
|
|
18467
18748
|
{
|
|
18468
18749
|
onClick: onEdit,
|
|
@@ -18485,18 +18766,18 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18485
18766
|
const theme = nt();
|
|
18486
18767
|
const { api, data, layout, setLayout } = useEmbed();
|
|
18487
18768
|
const isLightBackground = useIsLightBackground();
|
|
18488
|
-
const [isLoading, setIsLoading] =
|
|
18489
|
-
const [error, setError] =
|
|
18490
|
-
const [showPaymentForm, setShowPaymentForm] =
|
|
18769
|
+
const [isLoading, setIsLoading] = useState15(false);
|
|
18770
|
+
const [error, setError] = useState15();
|
|
18771
|
+
const [showPaymentForm, setShowPaymentForm] = useState15(
|
|
18491
18772
|
() => typeof data.subscription?.paymentMethod === "undefined"
|
|
18492
18773
|
);
|
|
18493
|
-
const [stripe, setStripe] =
|
|
18494
|
-
const [setupIntent, setSetupIntent] =
|
|
18495
|
-
const [top, setTop] =
|
|
18496
|
-
const paymentMethod =
|
|
18774
|
+
const [stripe, setStripe] = useState15(null);
|
|
18775
|
+
const [setupIntent, setSetupIntent] = useState15();
|
|
18776
|
+
const [top, setTop] = useState15(0);
|
|
18777
|
+
const paymentMethod = useMemo9(() => {
|
|
18497
18778
|
return data.subscription?.paymentMethod;
|
|
18498
18779
|
}, [data.subscription?.paymentMethod]);
|
|
18499
|
-
const monthsToExpiration =
|
|
18780
|
+
const monthsToExpiration = useMemo9(() => {
|
|
18500
18781
|
let expiration;
|
|
18501
18782
|
if (typeof paymentMethod?.cardExpYear === "number" && typeof paymentMethod?.cardExpMonth === "number") {
|
|
18502
18783
|
const today = /* @__PURE__ */ new Date();
|
|
@@ -18509,7 +18790,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18509
18790
|
}
|
|
18510
18791
|
return expiration;
|
|
18511
18792
|
}, [paymentMethod?.cardExpYear, paymentMethod?.cardExpMonth]);
|
|
18512
|
-
const createSetupIntent =
|
|
18793
|
+
const createSetupIntent = useCallback9(async () => {
|
|
18513
18794
|
if (!api || !data.component?.id) {
|
|
18514
18795
|
return;
|
|
18515
18796
|
}
|
|
@@ -18528,7 +18809,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18528
18809
|
setIsLoading(false);
|
|
18529
18810
|
}
|
|
18530
18811
|
}, [t2, api, data.component?.id]);
|
|
18531
|
-
const updatePaymentMethod =
|
|
18812
|
+
const updatePaymentMethod = useCallback9(
|
|
18532
18813
|
async (id) => {
|
|
18533
18814
|
if (!api || !id) {
|
|
18534
18815
|
return;
|
|
@@ -18568,8 +18849,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18568
18849
|
if (!paymentMethod?.paymentMethodType) {
|
|
18569
18850
|
return null;
|
|
18570
18851
|
}
|
|
18571
|
-
return /* @__PURE__ */
|
|
18572
|
-
/* @__PURE__ */
|
|
18852
|
+
return /* @__PURE__ */ jsxs23(Element, { ref, className, children: [
|
|
18853
|
+
/* @__PURE__ */ jsx30(
|
|
18573
18854
|
PaymentMethodElement,
|
|
18574
18855
|
{
|
|
18575
18856
|
paymentMethod,
|
|
@@ -18579,8 +18860,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18579
18860
|
}
|
|
18580
18861
|
),
|
|
18581
18862
|
layout === "payment" && createPortal3(
|
|
18582
|
-
/* @__PURE__ */
|
|
18583
|
-
/* @__PURE__ */
|
|
18863
|
+
/* @__PURE__ */ jsxs23(Modal, { size: "md", top, onClose: () => setShowPaymentForm(false), children: [
|
|
18864
|
+
/* @__PURE__ */ jsx30(ModalHeader, { bordered: true, children: /* @__PURE__ */ jsx30(
|
|
18584
18865
|
Text,
|
|
18585
18866
|
{
|
|
18586
18867
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18590,7 +18871,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18590
18871
|
children: t2("Edit payment method")
|
|
18591
18872
|
}
|
|
18592
18873
|
) }),
|
|
18593
|
-
/* @__PURE__ */
|
|
18874
|
+
/* @__PURE__ */ jsx30(Flex, { $position: "relative", $height: "calc(100% - 5rem)", children: /* @__PURE__ */ jsx30(
|
|
18594
18875
|
Flex,
|
|
18595
18876
|
{
|
|
18596
18877
|
$flexDirection: "column",
|
|
@@ -18599,8 +18880,8 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18599
18880
|
$padding: "2rem 2.5rem 2rem 2.5rem",
|
|
18600
18881
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.025)" : "hsla(0, 0%, 100%, 0.025)",
|
|
18601
18882
|
$overflow: "auto",
|
|
18602
|
-
children: /* @__PURE__ */
|
|
18603
|
-
showPaymentForm ? /* @__PURE__ */
|
|
18883
|
+
children: /* @__PURE__ */ jsxs23(Fragment11, { children: [
|
|
18884
|
+
showPaymentForm ? /* @__PURE__ */ jsx30(
|
|
18604
18885
|
Elements2,
|
|
18605
18886
|
{
|
|
18606
18887
|
stripe,
|
|
@@ -18629,15 +18910,15 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18629
18910
|
},
|
|
18630
18911
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
18631
18912
|
},
|
|
18632
|
-
children: /* @__PURE__ */
|
|
18913
|
+
children: /* @__PURE__ */ jsx30(
|
|
18633
18914
|
PaymentForm,
|
|
18634
18915
|
{
|
|
18635
18916
|
onConfirm: (value) => updatePaymentMethod(value)
|
|
18636
18917
|
}
|
|
18637
18918
|
)
|
|
18638
18919
|
}
|
|
18639
|
-
) : /* @__PURE__ */
|
|
18640
|
-
/* @__PURE__ */
|
|
18920
|
+
) : /* @__PURE__ */ jsxs23(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
18921
|
+
/* @__PURE__ */ jsx30(
|
|
18641
18922
|
PaymentMethodElement,
|
|
18642
18923
|
{
|
|
18643
18924
|
size: "lg",
|
|
@@ -18646,7 +18927,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18646
18927
|
...props
|
|
18647
18928
|
}
|
|
18648
18929
|
),
|
|
18649
|
-
/* @__PURE__ */
|
|
18930
|
+
/* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(
|
|
18650
18931
|
Text,
|
|
18651
18932
|
{
|
|
18652
18933
|
onClick: createSetupIntent,
|
|
@@ -18658,7 +18939,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
18658
18939
|
}
|
|
18659
18940
|
) })
|
|
18660
18941
|
] }),
|
|
18661
|
-
!isLoading && error && /* @__PURE__ */
|
|
18942
|
+
!isLoading && error && /* @__PURE__ */ jsx30(Box, { children: /* @__PURE__ */ jsx30(
|
|
18662
18943
|
Text,
|
|
18663
18944
|
{
|
|
18664
18945
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18681,7 +18962,7 @@ PaymentMethod.displayName = "PaymentMethod";
|
|
|
18681
18962
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
18682
18963
|
import { forwardRef as forwardRef11 } from "react";
|
|
18683
18964
|
var import_pluralize6 = __toESM(require_pluralize());
|
|
18684
|
-
import { Fragment as Fragment12, jsx as
|
|
18965
|
+
import { Fragment as Fragment12, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
18685
18966
|
var resolveDesignProps5 = (props) => {
|
|
18686
18967
|
return {
|
|
18687
18968
|
header: {
|
|
@@ -18745,20 +19026,21 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18745
19026
|
const billingSubscription = data.company?.billingSubscription;
|
|
18746
19027
|
const subscriptionCurrency = billingSubscription?.currency;
|
|
18747
19028
|
const showTrialBox = billingSubscription && billingSubscription.status == "trialing";
|
|
19029
|
+
const showUnsubscribeBox = billingSubscription && billingSubscription.status == "cancelled";
|
|
18748
19030
|
const trialEndDate = billingSubscription?.trialEnd ? new Date(billingSubscription.trialEnd * 1e3) : /* @__PURE__ */ new Date();
|
|
18749
19031
|
const todayDate = /* @__PURE__ */ new Date();
|
|
18750
19032
|
const trialEndDays = Math.floor(
|
|
18751
19033
|
(trialEndDate.getTime() - todayDate.getTime()) / (1e3 * 60 * 60 * 24)
|
|
18752
19034
|
);
|
|
18753
|
-
return /* @__PURE__ */
|
|
18754
|
-
showTrialBox && /* @__PURE__ */
|
|
19035
|
+
return /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
19036
|
+
showTrialBox && !showUnsubscribeBox && /* @__PURE__ */ jsxs24(
|
|
18755
19037
|
Box,
|
|
18756
19038
|
{
|
|
18757
19039
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
|
|
18758
19040
|
$textAlign: "center",
|
|
18759
19041
|
$padding: "1rem",
|
|
18760
19042
|
children: [
|
|
18761
|
-
/* @__PURE__ */
|
|
19043
|
+
/* @__PURE__ */ jsx31(
|
|
18762
19044
|
Text,
|
|
18763
19045
|
{
|
|
18764
19046
|
as: "h3",
|
|
@@ -18769,7 +19051,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18769
19051
|
children: t2("Trial ends in", { days: trialEndDays.toString() })
|
|
18770
19052
|
}
|
|
18771
19053
|
),
|
|
18772
|
-
/* @__PURE__ */
|
|
19054
|
+
/* @__PURE__ */ jsx31(
|
|
18773
19055
|
Text,
|
|
18774
19056
|
{
|
|
18775
19057
|
as: "p",
|
|
@@ -18787,7 +19069,43 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18787
19069
|
]
|
|
18788
19070
|
}
|
|
18789
19071
|
),
|
|
18790
|
-
/* @__PURE__ */
|
|
19072
|
+
showUnsubscribeBox && /* @__PURE__ */ jsxs24(
|
|
19073
|
+
Box,
|
|
19074
|
+
{
|
|
19075
|
+
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.04)" : "hsla(0, 0%, 100%, 0.04)",
|
|
19076
|
+
$textAlign: "center",
|
|
19077
|
+
$padding: "1rem",
|
|
19078
|
+
children: [
|
|
19079
|
+
/* @__PURE__ */ jsx31(
|
|
19080
|
+
Text,
|
|
19081
|
+
{
|
|
19082
|
+
as: "h3",
|
|
19083
|
+
$font: theme.typography.heading3.fontFamily,
|
|
19084
|
+
$size: theme.typography.heading3.fontSize,
|
|
19085
|
+
$weight: theme.typography.heading3.fontWeight,
|
|
19086
|
+
$color: theme.typography.heading3.color,
|
|
19087
|
+
children: t2("Subscription canceled")
|
|
19088
|
+
}
|
|
19089
|
+
),
|
|
19090
|
+
/* @__PURE__ */ jsx31(
|
|
19091
|
+
Text,
|
|
19092
|
+
{
|
|
19093
|
+
as: "p",
|
|
19094
|
+
$font: theme.typography.text.fontFamily,
|
|
19095
|
+
$size: theme.typography.text.fontSize * 0.8125,
|
|
19096
|
+
$weight: theme.typography.text.fontWeight,
|
|
19097
|
+
$color: theme.typography.text.color,
|
|
19098
|
+
children: billingSubscription.cancelAt ? t2("Access to plan will end on", {
|
|
19099
|
+
date: toPrettyDate(new Date(billingSubscription.cancelAt), {
|
|
19100
|
+
month: "numeric"
|
|
19101
|
+
})
|
|
19102
|
+
}) : ""
|
|
19103
|
+
}
|
|
19104
|
+
)
|
|
19105
|
+
]
|
|
19106
|
+
}
|
|
19107
|
+
),
|
|
19108
|
+
/* @__PURE__ */ jsxs24(
|
|
18791
19109
|
Element,
|
|
18792
19110
|
{
|
|
18793
19111
|
as: Flex,
|
|
@@ -18796,7 +19114,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18796
19114
|
$flexDirection: "column",
|
|
18797
19115
|
$gap: "2rem",
|
|
18798
19116
|
children: [
|
|
18799
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */
|
|
19117
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs24(
|
|
18800
19118
|
Flex,
|
|
18801
19119
|
{
|
|
18802
19120
|
$justifyContent: "space-between",
|
|
@@ -18804,8 +19122,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18804
19122
|
$flexWrap: "wrap",
|
|
18805
19123
|
$gap: "1rem",
|
|
18806
19124
|
children: [
|
|
18807
|
-
/* @__PURE__ */
|
|
18808
|
-
/* @__PURE__ */
|
|
19125
|
+
/* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19126
|
+
/* @__PURE__ */ jsx31(
|
|
18809
19127
|
Text,
|
|
18810
19128
|
{
|
|
18811
19129
|
as: Box,
|
|
@@ -18817,7 +19135,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18817
19135
|
children: currentPlan.name
|
|
18818
19136
|
}
|
|
18819
19137
|
),
|
|
18820
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */
|
|
19138
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx31(
|
|
18821
19139
|
Text,
|
|
18822
19140
|
{
|
|
18823
19141
|
as: Box,
|
|
@@ -18829,8 +19147,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18829
19147
|
}
|
|
18830
19148
|
)
|
|
18831
19149
|
] }),
|
|
18832
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */
|
|
18833
|
-
/* @__PURE__ */
|
|
19150
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs24(Box, { children: [
|
|
19151
|
+
/* @__PURE__ */ jsx31(
|
|
18834
19152
|
Text,
|
|
18835
19153
|
{
|
|
18836
19154
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
@@ -18843,14 +19161,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18843
19161
|
)
|
|
18844
19162
|
}
|
|
18845
19163
|
),
|
|
18846
|
-
/* @__PURE__ */
|
|
19164
|
+
/* @__PURE__ */ jsx31(
|
|
18847
19165
|
Text,
|
|
18848
19166
|
{
|
|
18849
19167
|
$font: theme.typography[props.header.price.fontStyle].fontFamily,
|
|
18850
19168
|
$size: theme.typography[props.header.price.fontStyle].fontSize,
|
|
18851
19169
|
$weight: theme.typography[props.header.price.fontStyle].fontWeight,
|
|
18852
19170
|
$color: theme.typography[props.header.price.fontStyle].color,
|
|
18853
|
-
children: /* @__PURE__ */
|
|
19171
|
+
children: /* @__PURE__ */ jsxs24("sub", { children: [
|
|
18854
19172
|
"/",
|
|
18855
19173
|
shortenPeriod(currentPlan.planPeriod)
|
|
18856
19174
|
] })
|
|
@@ -18860,8 +19178,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18860
19178
|
]
|
|
18861
19179
|
}
|
|
18862
19180
|
),
|
|
18863
|
-
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */
|
|
18864
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
19181
|
+
props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19182
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx31(
|
|
18865
19183
|
Text,
|
|
18866
19184
|
{
|
|
18867
19185
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18872,7 +19190,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18872
19190
|
children: t2("Add-ons")
|
|
18873
19191
|
}
|
|
18874
19192
|
),
|
|
18875
|
-
addOns.map((addOn) => /* @__PURE__ */
|
|
19193
|
+
addOns.map((addOn) => /* @__PURE__ */ jsxs24(
|
|
18876
19194
|
Flex,
|
|
18877
19195
|
{
|
|
18878
19196
|
$justifyContent: "space-between",
|
|
@@ -18880,7 +19198,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18880
19198
|
$flexWrap: "wrap",
|
|
18881
19199
|
$gap: "1rem",
|
|
18882
19200
|
children: [
|
|
18883
|
-
/* @__PURE__ */
|
|
19201
|
+
/* @__PURE__ */ jsx31(
|
|
18884
19202
|
Text,
|
|
18885
19203
|
{
|
|
18886
19204
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
@@ -18890,7 +19208,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18890
19208
|
children: addOn.name
|
|
18891
19209
|
}
|
|
18892
19210
|
),
|
|
18893
|
-
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */
|
|
19211
|
+
addOn.planPrice && addOn.planPeriod && /* @__PURE__ */ jsxs24(
|
|
18894
19212
|
Text,
|
|
18895
19213
|
{
|
|
18896
19214
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18899,7 +19217,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18899
19217
|
$color: theme.typography.text.color,
|
|
18900
19218
|
children: [
|
|
18901
19219
|
formatCurrency(addOn.planPrice, subscriptionCurrency),
|
|
18902
|
-
/* @__PURE__ */
|
|
19220
|
+
/* @__PURE__ */ jsxs24("sub", { children: [
|
|
18903
19221
|
"/",
|
|
18904
19222
|
shortenPeriod(addOn.planPeriod)
|
|
18905
19223
|
] })
|
|
@@ -18911,8 +19229,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18911
19229
|
addOn.id
|
|
18912
19230
|
))
|
|
18913
19231
|
] }),
|
|
18914
|
-
usageBasedEntitlements.length > 0 && /* @__PURE__ */
|
|
18915
|
-
/* @__PURE__ */
|
|
19232
|
+
usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs24(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19233
|
+
/* @__PURE__ */ jsx31(
|
|
18916
19234
|
Text,
|
|
18917
19235
|
{
|
|
18918
19236
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18927,7 +19245,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18927
19245
|
(acc, entitlement) => {
|
|
18928
19246
|
if (entitlement.feature?.name) {
|
|
18929
19247
|
acc.push(
|
|
18930
|
-
/* @__PURE__ */
|
|
19248
|
+
/* @__PURE__ */ jsxs24(
|
|
18931
19249
|
Flex,
|
|
18932
19250
|
{
|
|
18933
19251
|
$justifyContent: "space-between",
|
|
@@ -18935,14 +19253,14 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18935
19253
|
$flexWrap: "wrap",
|
|
18936
19254
|
$gap: "1rem",
|
|
18937
19255
|
children: [
|
|
18938
|
-
/* @__PURE__ */
|
|
19256
|
+
/* @__PURE__ */ jsx31(
|
|
18939
19257
|
Text,
|
|
18940
19258
|
{
|
|
18941
19259
|
$font: theme.typography[props.addOns.fontStyle].fontFamily,
|
|
18942
19260
|
$size: theme.typography[props.addOns.fontStyle].fontSize,
|
|
18943
19261
|
$weight: theme.typography[props.addOns.fontStyle].fontWeight,
|
|
18944
19262
|
$color: theme.typography[props.addOns.fontStyle].color,
|
|
18945
|
-
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */
|
|
19263
|
+
children: entitlement.priceBehavior === "pay_in_advance" ? /* @__PURE__ */ jsxs24(Fragment12, { children: [
|
|
18946
19264
|
entitlement.quantity,
|
|
18947
19265
|
" ",
|
|
18948
19266
|
(0, import_pluralize6.default)(
|
|
@@ -18952,8 +19270,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18952
19270
|
] }) : entitlement.feature.name
|
|
18953
19271
|
}
|
|
18954
19272
|
),
|
|
18955
|
-
/* @__PURE__ */
|
|
18956
|
-
entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */
|
|
19273
|
+
/* @__PURE__ */ jsxs24(Flex, { $alignItems: "center", $gap: "1rem", children: [
|
|
19274
|
+
entitlement.priceBehavior === "pay_in_advance" && currentPlan?.planPeriod && /* @__PURE__ */ jsxs24(
|
|
18957
19275
|
Text,
|
|
18958
19276
|
{
|
|
18959
19277
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18965,7 +19283,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18965
19283
|
entitlement.price,
|
|
18966
19284
|
entitlement.currencyCode
|
|
18967
19285
|
),
|
|
18968
|
-
/* @__PURE__ */
|
|
19286
|
+
/* @__PURE__ */ jsxs24("sub", { children: [
|
|
18969
19287
|
"/",
|
|
18970
19288
|
(0, import_pluralize6.default)(
|
|
18971
19289
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -18977,7 +19295,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18977
19295
|
]
|
|
18978
19296
|
}
|
|
18979
19297
|
),
|
|
18980
|
-
/* @__PURE__ */
|
|
19298
|
+
/* @__PURE__ */ jsxs24(
|
|
18981
19299
|
Text,
|
|
18982
19300
|
{
|
|
18983
19301
|
$font: theme.typography.text.fontFamily,
|
|
@@ -18989,7 +19307,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18989
19307
|
entitlement.price * (entitlement.priceBehavior === "pay_in_advance" ? entitlement.quantity : 1),
|
|
18990
19308
|
entitlement.currencyCode
|
|
18991
19309
|
),
|
|
18992
|
-
/* @__PURE__ */
|
|
19310
|
+
/* @__PURE__ */ jsxs24("sub", { children: [
|
|
18993
19311
|
"/",
|
|
18994
19312
|
currentPlan?.planPeriod && entitlement.priceBehavior === "pay_in_advance" ? shortenPeriod(currentPlan.planPeriod) : (0, import_pluralize6.default)(
|
|
18995
19313
|
entitlement.feature.name.toLowerCase(),
|
|
@@ -19011,7 +19329,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
19011
19329
|
[]
|
|
19012
19330
|
)
|
|
19013
19331
|
] }),
|
|
19014
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */
|
|
19332
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx31(
|
|
19015
19333
|
EmbedButton,
|
|
19016
19334
|
{
|
|
19017
19335
|
onClick: () => {
|
|
@@ -19035,9 +19353,9 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
19035
19353
|
PlanManager.displayName = "PlanManager";
|
|
19036
19354
|
|
|
19037
19355
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
19038
|
-
import { forwardRef as forwardRef12, useState as
|
|
19356
|
+
import { forwardRef as forwardRef12, useState as useState16 } from "react";
|
|
19039
19357
|
var import_pluralize7 = __toESM(require_pluralize());
|
|
19040
|
-
import { Fragment as Fragment13, jsx as
|
|
19358
|
+
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
19041
19359
|
var resolveDesignProps6 = (props) => {
|
|
19042
19360
|
return {
|
|
19043
19361
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -19083,12 +19401,12 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19083
19401
|
const theme = nt();
|
|
19084
19402
|
const { data, setLayout, setSelected } = useEmbed();
|
|
19085
19403
|
const trialEndDays = useTrialEnd();
|
|
19086
|
-
const [selectedPeriod, setSelectedPeriod] =
|
|
19404
|
+
const [selectedPeriod, setSelectedPeriod] = useState16(
|
|
19087
19405
|
() => data.company?.plan?.planPeriod || "month"
|
|
19088
19406
|
);
|
|
19089
19407
|
const { plans, addOns, periods } = useAvailablePlans(selectedPeriod);
|
|
19090
19408
|
const isLightBackground = useIsLightBackground();
|
|
19091
|
-
const [entitlementCounts, setEntitlementCounts] =
|
|
19409
|
+
const [entitlementCounts, setEntitlementCounts] = useState16(
|
|
19092
19410
|
() => plans.reduce(
|
|
19093
19411
|
(acc, plan) => {
|
|
19094
19412
|
acc[plan.id] = {
|
|
@@ -19115,7 +19433,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19115
19433
|
};
|
|
19116
19434
|
});
|
|
19117
19435
|
};
|
|
19118
|
-
return /* @__PURE__ */
|
|
19436
|
+
return /* @__PURE__ */ jsxs25(
|
|
19119
19437
|
FussyChild,
|
|
19120
19438
|
{
|
|
19121
19439
|
ref,
|
|
@@ -19124,8 +19442,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19124
19442
|
$flexDirection: "column",
|
|
19125
19443
|
$gap: "2rem",
|
|
19126
19444
|
children: [
|
|
19127
|
-
/* @__PURE__ */
|
|
19128
|
-
/* @__PURE__ */
|
|
19445
|
+
/* @__PURE__ */ jsxs25(Box, { children: [
|
|
19446
|
+
/* @__PURE__ */ jsxs25(
|
|
19129
19447
|
Flex,
|
|
19130
19448
|
{
|
|
19131
19449
|
$flexDirection: "column",
|
|
@@ -19140,7 +19458,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19140
19458
|
}
|
|
19141
19459
|
},
|
|
19142
19460
|
children: [
|
|
19143
|
-
/* @__PURE__ */
|
|
19461
|
+
/* @__PURE__ */ jsx32(
|
|
19144
19462
|
Text,
|
|
19145
19463
|
{
|
|
19146
19464
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19150,7 +19468,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19150
19468
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans")
|
|
19151
19469
|
}
|
|
19152
19470
|
),
|
|
19153
|
-
props.showPeriodToggle && /* @__PURE__ */
|
|
19471
|
+
props.showPeriodToggle && /* @__PURE__ */ jsx32(
|
|
19154
19472
|
PeriodToggle,
|
|
19155
19473
|
{
|
|
19156
19474
|
options: periods,
|
|
@@ -19161,7 +19479,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19161
19479
|
]
|
|
19162
19480
|
}
|
|
19163
19481
|
),
|
|
19164
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */
|
|
19482
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx32(
|
|
19165
19483
|
Box,
|
|
19166
19484
|
{
|
|
19167
19485
|
$display: "grid",
|
|
@@ -19174,7 +19492,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19174
19492
|
if (count?.limit && count.limit > VISIBLE_ENTITLEMENT_COUNT) {
|
|
19175
19493
|
isExpanded = true;
|
|
19176
19494
|
}
|
|
19177
|
-
return /* @__PURE__ */
|
|
19495
|
+
return /* @__PURE__ */ jsxs25(
|
|
19178
19496
|
Flex,
|
|
19179
19497
|
{
|
|
19180
19498
|
$position: "relative",
|
|
@@ -19187,7 +19505,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19187
19505
|
$outlineColor: isActivePlan ? theme.primary : "transparent",
|
|
19188
19506
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19189
19507
|
children: [
|
|
19190
|
-
/* @__PURE__ */
|
|
19508
|
+
/* @__PURE__ */ jsxs25(
|
|
19191
19509
|
Flex,
|
|
19192
19510
|
{
|
|
19193
19511
|
$flexDirection: "column",
|
|
@@ -19198,7 +19516,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19198
19516
|
$borderStyle: "solid",
|
|
19199
19517
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
19200
19518
|
children: [
|
|
19201
|
-
/* @__PURE__ */
|
|
19519
|
+
/* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
|
|
19202
19520
|
Text,
|
|
19203
19521
|
{
|
|
19204
19522
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19208,7 +19526,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19208
19526
|
children: plan.name
|
|
19209
19527
|
}
|
|
19210
19528
|
) }),
|
|
19211
|
-
props.plans.description.isVisible && /* @__PURE__ */
|
|
19529
|
+
props.plans.description.isVisible && /* @__PURE__ */ jsx32(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx32(
|
|
19212
19530
|
Text,
|
|
19213
19531
|
{
|
|
19214
19532
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19218,8 +19536,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19218
19536
|
children: plan.description
|
|
19219
19537
|
}
|
|
19220
19538
|
) }),
|
|
19221
|
-
/* @__PURE__ */
|
|
19222
|
-
/* @__PURE__ */
|
|
19539
|
+
/* @__PURE__ */ jsxs25(Box, { children: [
|
|
19540
|
+
/* @__PURE__ */ jsx32(
|
|
19223
19541
|
Text,
|
|
19224
19542
|
{
|
|
19225
19543
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19232,7 +19550,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19232
19550
|
)
|
|
19233
19551
|
}
|
|
19234
19552
|
),
|
|
19235
|
-
!plan.custom && /* @__PURE__ */
|
|
19553
|
+
!plan.custom && /* @__PURE__ */ jsxs25(
|
|
19236
19554
|
Text,
|
|
19237
19555
|
{
|
|
19238
19556
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19246,7 +19564,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19246
19564
|
}
|
|
19247
19565
|
)
|
|
19248
19566
|
] }),
|
|
19249
|
-
isActivePlan && /* @__PURE__ */
|
|
19567
|
+
isActivePlan && /* @__PURE__ */ jsx32(
|
|
19250
19568
|
Flex,
|
|
19251
19569
|
{
|
|
19252
19570
|
$position: "absolute",
|
|
@@ -19263,7 +19581,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19263
19581
|
]
|
|
19264
19582
|
}
|
|
19265
19583
|
),
|
|
19266
|
-
/* @__PURE__ */
|
|
19584
|
+
/* @__PURE__ */ jsxs25(
|
|
19267
19585
|
Flex,
|
|
19268
19586
|
{
|
|
19269
19587
|
$flexDirection: "column",
|
|
@@ -19272,7 +19590,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19272
19590
|
$gap: `${cardPadding}rem`,
|
|
19273
19591
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
19274
19592
|
children: [
|
|
19275
|
-
props.plans.showEntitlements && /* @__PURE__ */
|
|
19593
|
+
props.plans.showEntitlements && /* @__PURE__ */ jsxs25(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: "1", children: [
|
|
19276
19594
|
plan.entitlements.slice().sort((a2, b2) => {
|
|
19277
19595
|
if (a2.feature?.name && b2.feature?.name && a2.feature?.name > b2.feature?.name) {
|
|
19278
19596
|
return 1;
|
|
@@ -19295,8 +19613,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19295
19613
|
return acc;
|
|
19296
19614
|
}
|
|
19297
19615
|
acc.push(
|
|
19298
|
-
/* @__PURE__ */
|
|
19299
|
-
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
19616
|
+
/* @__PURE__ */ jsxs25(Flex, { $gap: "1rem", children: [
|
|
19617
|
+
props.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx32(
|
|
19300
19618
|
IconRound,
|
|
19301
19619
|
{
|
|
19302
19620
|
name: entitlement.feature.icon,
|
|
@@ -19307,7 +19625,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19307
19625
|
]
|
|
19308
19626
|
}
|
|
19309
19627
|
),
|
|
19310
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
19628
|
+
entitlement.feature?.name && /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(
|
|
19311
19629
|
Text,
|
|
19312
19630
|
{
|
|
19313
19631
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19315,7 +19633,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19315
19633
|
$weight: theme.typography.text.fontWeight,
|
|
19316
19634
|
$color: theme.typography.text.color,
|
|
19317
19635
|
$leading: 1.35,
|
|
19318
|
-
children: typeof price !== "undefined" ? /* @__PURE__ */
|
|
19636
|
+
children: typeof price !== "undefined" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19319
19637
|
formatCurrency(price, currency),
|
|
19320
19638
|
" ",
|
|
19321
19639
|
t2("per"),
|
|
@@ -19324,19 +19642,19 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19324
19642
|
entitlement.feature.name,
|
|
19325
19643
|
1
|
|
19326
19644
|
),
|
|
19327
|
-
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */
|
|
19645
|
+
entitlement.priceBehavior === "pay_in_advance" && /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19328
19646
|
" ",
|
|
19329
19647
|
t2("per"),
|
|
19330
19648
|
" ",
|
|
19331
19649
|
selectedPeriod
|
|
19332
19650
|
] })
|
|
19333
|
-
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */
|
|
19651
|
+
] }) : entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19334
19652
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19335
19653
|
item: (0, import_pluralize7.default)(
|
|
19336
19654
|
entitlement.feature.name
|
|
19337
19655
|
)
|
|
19338
19656
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19339
|
-
entitlement.metricPeriod && /* @__PURE__ */
|
|
19657
|
+
entitlement.metricPeriod && /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19340
19658
|
" ",
|
|
19341
19659
|
t2("per"),
|
|
19342
19660
|
" ",
|
|
@@ -19354,14 +19672,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19354
19672
|
);
|
|
19355
19673
|
return acc;
|
|
19356
19674
|
}, []).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
19357
|
-
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */
|
|
19675
|
+
(count?.size || plan.entitlements.length) > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs25(
|
|
19358
19676
|
Flex,
|
|
19359
19677
|
{
|
|
19360
19678
|
$alignItems: "center",
|
|
19361
19679
|
$justifyContent: "start",
|
|
19362
19680
|
$marginTop: "1rem",
|
|
19363
19681
|
children: [
|
|
19364
|
-
/* @__PURE__ */
|
|
19682
|
+
/* @__PURE__ */ jsx32(
|
|
19365
19683
|
Icon2,
|
|
19366
19684
|
{
|
|
19367
19685
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
@@ -19373,7 +19691,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19373
19691
|
}
|
|
19374
19692
|
}
|
|
19375
19693
|
),
|
|
19376
|
-
/* @__PURE__ */
|
|
19694
|
+
/* @__PURE__ */ jsx32(
|
|
19377
19695
|
Text,
|
|
19378
19696
|
{
|
|
19379
19697
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -19390,7 +19708,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19390
19708
|
}
|
|
19391
19709
|
)
|
|
19392
19710
|
] }),
|
|
19393
|
-
isActivePlan ? /* @__PURE__ */
|
|
19711
|
+
isActivePlan ? /* @__PURE__ */ jsxs25(
|
|
19394
19712
|
Flex,
|
|
19395
19713
|
{
|
|
19396
19714
|
$justifyContent: "center",
|
|
@@ -19398,7 +19716,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19398
19716
|
$gap: "0.25rem",
|
|
19399
19717
|
$padding: "0.625rem 0",
|
|
19400
19718
|
children: [
|
|
19401
|
-
/* @__PURE__ */
|
|
19719
|
+
/* @__PURE__ */ jsx32(
|
|
19402
19720
|
Icon2,
|
|
19403
19721
|
{
|
|
19404
19722
|
name: "check-rounded",
|
|
@@ -19409,7 +19727,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19409
19727
|
}
|
|
19410
19728
|
}
|
|
19411
19729
|
),
|
|
19412
|
-
/* @__PURE__ */
|
|
19730
|
+
/* @__PURE__ */ jsx32(
|
|
19413
19731
|
Text,
|
|
19414
19732
|
{
|
|
19415
19733
|
$size: 15,
|
|
@@ -19420,7 +19738,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19420
19738
|
)
|
|
19421
19739
|
]
|
|
19422
19740
|
}
|
|
19423
|
-
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */
|
|
19741
|
+
) : (props.upgrade.isVisible || props.downgrade.isVisible) && /* @__PURE__ */ jsx32(
|
|
19424
19742
|
EmbedButton,
|
|
19425
19743
|
{
|
|
19426
19744
|
disabled: !plan.valid || !canCheckout,
|
|
@@ -19443,14 +19761,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19443
19761
|
$color: props.downgrade.buttonStyle,
|
|
19444
19762
|
$variant: "outline"
|
|
19445
19763
|
},
|
|
19446
|
-
children: plan.custom ? /* @__PURE__ */
|
|
19764
|
+
children: plan.custom ? /* @__PURE__ */ jsx32(
|
|
19447
19765
|
ButtonLink,
|
|
19448
19766
|
{
|
|
19449
19767
|
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19450
19768
|
target: "_blank",
|
|
19451
19769
|
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
19452
19770
|
}
|
|
19453
|
-
) : !plan.valid ? /* @__PURE__ */
|
|
19771
|
+
) : !plan.valid ? /* @__PURE__ */ jsx32(
|
|
19454
19772
|
Tooltip,
|
|
19455
19773
|
{
|
|
19456
19774
|
trigger: t2("Over usage limit"),
|
|
@@ -19472,14 +19790,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19472
19790
|
}
|
|
19473
19791
|
)
|
|
19474
19792
|
] }),
|
|
19475
|
-
/* @__PURE__ */
|
|
19476
|
-
props.header.isVisible && /* @__PURE__ */
|
|
19793
|
+
/* @__PURE__ */ jsx32(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19794
|
+
props.header.isVisible && /* @__PURE__ */ jsx32(
|
|
19477
19795
|
Flex,
|
|
19478
19796
|
{
|
|
19479
19797
|
$justifyContent: "space-between",
|
|
19480
19798
|
$alignItems: "center",
|
|
19481
19799
|
$marginBottom: "1rem",
|
|
19482
|
-
children: /* @__PURE__ */
|
|
19800
|
+
children: /* @__PURE__ */ jsx32(
|
|
19483
19801
|
Text,
|
|
19484
19802
|
{
|
|
19485
19803
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19491,7 +19809,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19491
19809
|
)
|
|
19492
19810
|
}
|
|
19493
19811
|
),
|
|
19494
|
-
/* @__PURE__ */
|
|
19812
|
+
/* @__PURE__ */ jsx32(
|
|
19495
19813
|
Box,
|
|
19496
19814
|
{
|
|
19497
19815
|
$display: "grid",
|
|
@@ -19499,7 +19817,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19499
19817
|
$gap: "1rem",
|
|
19500
19818
|
children: addOns.map((addOn, index) => {
|
|
19501
19819
|
const isActiveAddOn = addOn.current && selectedPeriod === data.company?.addOns.find((a2) => a2.id === addOn.id)?.planPeriod;
|
|
19502
|
-
return /* @__PURE__ */
|
|
19820
|
+
return /* @__PURE__ */ jsxs25(
|
|
19503
19821
|
Flex,
|
|
19504
19822
|
{
|
|
19505
19823
|
$position: "relative",
|
|
@@ -19513,8 +19831,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19513
19831
|
$outlineColor: isActiveAddOn ? theme.primary : "transparent",
|
|
19514
19832
|
...theme.card.hasShadow && { $boxShadow: cardBoxShadow },
|
|
19515
19833
|
children: [
|
|
19516
|
-
/* @__PURE__ */
|
|
19517
|
-
/* @__PURE__ */
|
|
19834
|
+
/* @__PURE__ */ jsxs25(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
19835
|
+
/* @__PURE__ */ jsx32(Box, { children: /* @__PURE__ */ jsx32(
|
|
19518
19836
|
Text,
|
|
19519
19837
|
{
|
|
19520
19838
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19524,7 +19842,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19524
19842
|
children: addOn.name
|
|
19525
19843
|
}
|
|
19526
19844
|
) }),
|
|
19527
|
-
props.addOns.showDescription && /* @__PURE__ */
|
|
19845
|
+
props.addOns.showDescription && /* @__PURE__ */ jsx32(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx32(
|
|
19528
19846
|
Text,
|
|
19529
19847
|
{
|
|
19530
19848
|
$font: theme.typography[props.plans.description.fontStyle].fontFamily,
|
|
@@ -19534,8 +19852,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19534
19852
|
children: addOn.description
|
|
19535
19853
|
}
|
|
19536
19854
|
) }),
|
|
19537
|
-
/* @__PURE__ */
|
|
19538
|
-
/* @__PURE__ */
|
|
19855
|
+
/* @__PURE__ */ jsxs25(Box, { children: [
|
|
19856
|
+
/* @__PURE__ */ jsx32(
|
|
19539
19857
|
Text,
|
|
19540
19858
|
{
|
|
19541
19859
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19548,7 +19866,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19548
19866
|
)
|
|
19549
19867
|
}
|
|
19550
19868
|
),
|
|
19551
|
-
/* @__PURE__ */
|
|
19869
|
+
/* @__PURE__ */ jsxs25(
|
|
19552
19870
|
Text,
|
|
19553
19871
|
{
|
|
19554
19872
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19562,7 +19880,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19562
19880
|
}
|
|
19563
19881
|
)
|
|
19564
19882
|
] }),
|
|
19565
|
-
isActiveAddOn && /* @__PURE__ */
|
|
19883
|
+
isActiveAddOn && /* @__PURE__ */ jsx32(
|
|
19566
19884
|
Flex,
|
|
19567
19885
|
{
|
|
19568
19886
|
$position: "absolute",
|
|
@@ -19577,7 +19895,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19577
19895
|
}
|
|
19578
19896
|
)
|
|
19579
19897
|
] }),
|
|
19580
|
-
/* @__PURE__ */
|
|
19898
|
+
/* @__PURE__ */ jsxs25(
|
|
19581
19899
|
Flex,
|
|
19582
19900
|
{
|
|
19583
19901
|
$flexDirection: "column",
|
|
@@ -19585,7 +19903,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19585
19903
|
$gap: `${cardPadding}rem`,
|
|
19586
19904
|
$flexGrow: "1",
|
|
19587
19905
|
children: [
|
|
19588
|
-
props.addOns.showEntitlements && /* @__PURE__ */
|
|
19906
|
+
props.addOns.showEntitlements && /* @__PURE__ */ jsx32(
|
|
19589
19907
|
Flex,
|
|
19590
19908
|
{
|
|
19591
19909
|
$flexDirection: "column",
|
|
@@ -19593,15 +19911,15 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19593
19911
|
$gap: "1rem",
|
|
19594
19912
|
$flexGrow: "1",
|
|
19595
19913
|
children: addOn.entitlements.map((entitlement) => {
|
|
19596
|
-
return /* @__PURE__ */
|
|
19914
|
+
return /* @__PURE__ */ jsx32(
|
|
19597
19915
|
Flex,
|
|
19598
19916
|
{
|
|
19599
19917
|
$flexWrap: "wrap",
|
|
19600
19918
|
$justifyContent: "space-between",
|
|
19601
19919
|
$alignItems: "center",
|
|
19602
19920
|
$gap: "1rem",
|
|
19603
|
-
children: /* @__PURE__ */
|
|
19604
|
-
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
19921
|
+
children: /* @__PURE__ */ jsxs25(Flex, { $gap: "1rem", children: [
|
|
19922
|
+
props.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx32(
|
|
19605
19923
|
IconRound,
|
|
19606
19924
|
{
|
|
19607
19925
|
name: entitlement.feature.icon,
|
|
@@ -19612,20 +19930,20 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19612
19930
|
]
|
|
19613
19931
|
}
|
|
19614
19932
|
),
|
|
19615
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
19933
|
+
entitlement.feature?.name && /* @__PURE__ */ jsx32(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx32(
|
|
19616
19934
|
Text,
|
|
19617
19935
|
{
|
|
19618
19936
|
$font: theme.typography.text.fontFamily,
|
|
19619
19937
|
$size: theme.typography.text.fontSize,
|
|
19620
19938
|
$weight: theme.typography.text.fontWeight,
|
|
19621
19939
|
$color: theme.typography.text.color,
|
|
19622
|
-
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */
|
|
19940
|
+
children: entitlement.valueType === "numeric" || entitlement.valueType === "unlimited" || entitlement.valueType === "trait" ? /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19623
19941
|
entitlement.valueType === "unlimited" ? t2("Unlimited", {
|
|
19624
19942
|
item: (0, import_pluralize7.default)(
|
|
19625
19943
|
entitlement.feature.name
|
|
19626
19944
|
)
|
|
19627
19945
|
}) : typeof entitlement.valueNumeric === "number" && `${formatNumber(entitlement.valueNumeric)} ${(0, import_pluralize7.default)(entitlement.feature.name, entitlement.valueNumeric)}`,
|
|
19628
|
-
entitlement.metricPeriod && /* @__PURE__ */
|
|
19946
|
+
entitlement.metricPeriod && /* @__PURE__ */ jsxs25(Fragment13, { children: [
|
|
19629
19947
|
" ",
|
|
19630
19948
|
t2("per"),
|
|
19631
19949
|
" ",
|
|
@@ -19646,7 +19964,7 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19646
19964
|
})
|
|
19647
19965
|
}
|
|
19648
19966
|
),
|
|
19649
|
-
props.upgrade.isVisible && /* @__PURE__ */
|
|
19967
|
+
props.upgrade.isVisible && /* @__PURE__ */ jsx32(
|
|
19650
19968
|
EmbedButton,
|
|
19651
19969
|
{
|
|
19652
19970
|
disabled: !addOn.valid || !canCheckout,
|
|
@@ -19682,8 +20000,8 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19682
20000
|
PricingTable.displayName = "PricingTable";
|
|
19683
20001
|
|
|
19684
20002
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
19685
|
-
import { forwardRef as forwardRef13, useMemo as
|
|
19686
|
-
import { jsx as
|
|
20003
|
+
import { forwardRef as forwardRef13, useMemo as useMemo10 } from "react";
|
|
20004
|
+
import { jsx as jsx33, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
19687
20005
|
function resolveDesignProps7(props) {
|
|
19688
20006
|
return {
|
|
19689
20007
|
header: {
|
|
@@ -19708,7 +20026,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19708
20026
|
const theme = nt();
|
|
19709
20027
|
const { data } = useEmbed();
|
|
19710
20028
|
const isLightBackground = useIsLightBackground();
|
|
19711
|
-
const { upcomingInvoice, discounts } =
|
|
20029
|
+
const { upcomingInvoice, discounts } = useMemo10(() => {
|
|
19712
20030
|
const discounts2 = (data.subscription?.discounts || []).map((discount) => ({
|
|
19713
20031
|
amountOff: discount.amountOff,
|
|
19714
20032
|
couponId: discount.couponId,
|
|
@@ -19735,7 +20053,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19735
20053
|
if (typeof upcomingInvoice.amountDue !== "number" || !upcomingInvoice.dueDate) {
|
|
19736
20054
|
return null;
|
|
19737
20055
|
}
|
|
19738
|
-
return /* @__PURE__ */
|
|
20056
|
+
return /* @__PURE__ */ jsxs26(
|
|
19739
20057
|
Element,
|
|
19740
20058
|
{
|
|
19741
20059
|
as: Flex,
|
|
@@ -19744,7 +20062,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19744
20062
|
$flexDirection: "column",
|
|
19745
20063
|
$gap: "1rem",
|
|
19746
20064
|
children: [
|
|
19747
|
-
props.header.isVisible && /* @__PURE__ */
|
|
20065
|
+
props.header.isVisible && /* @__PURE__ */ jsx33(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsxs26(
|
|
19748
20066
|
Text,
|
|
19749
20067
|
{
|
|
19750
20068
|
$font: theme.typography[props.header.fontStyle].fontFamily,
|
|
@@ -19758,8 +20076,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19758
20076
|
]
|
|
19759
20077
|
}
|
|
19760
20078
|
) }),
|
|
19761
|
-
/* @__PURE__ */
|
|
19762
|
-
props.price.isVisible && /* @__PURE__ */
|
|
20079
|
+
/* @__PURE__ */ jsxs26(Flex, { $justifyContent: "space-between", $alignItems: "start", $gap: "1rem", children: [
|
|
20080
|
+
props.price.isVisible && /* @__PURE__ */ jsx33(Flex, { $alignItems: "end", $flexGrow: "1", children: /* @__PURE__ */ jsx33(
|
|
19763
20081
|
Text,
|
|
19764
20082
|
{
|
|
19765
20083
|
$font: theme.typography[props.price.fontStyle].fontFamily,
|
|
@@ -19773,7 +20091,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19773
20091
|
)
|
|
19774
20092
|
}
|
|
19775
20093
|
) }),
|
|
19776
|
-
/* @__PURE__ */
|
|
20094
|
+
/* @__PURE__ */ jsx33(Box, { $lineHeight: 1.15, $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx33(
|
|
19777
20095
|
Text,
|
|
19778
20096
|
{
|
|
19779
20097
|
$font: theme.typography[props.contractEndDate.fontStyle].fontFamily,
|
|
@@ -19785,8 +20103,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19785
20103
|
}
|
|
19786
20104
|
) })
|
|
19787
20105
|
] }),
|
|
19788
|
-
discounts.length > 0 && /* @__PURE__ */
|
|
19789
|
-
/* @__PURE__ */
|
|
20106
|
+
discounts.length > 0 && /* @__PURE__ */ jsxs26(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
20107
|
+
/* @__PURE__ */ jsx33(Box, { children: /* @__PURE__ */ jsx33(
|
|
19790
20108
|
Text,
|
|
19791
20109
|
{
|
|
19792
20110
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19796,8 +20114,8 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19796
20114
|
children: t2("Discount")
|
|
19797
20115
|
}
|
|
19798
20116
|
) }),
|
|
19799
|
-
/* @__PURE__ */
|
|
19800
|
-
/* @__PURE__ */
|
|
20117
|
+
/* @__PURE__ */ jsx33(Box, { children: discounts.map((discount) => /* @__PURE__ */ jsxs26(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
20118
|
+
/* @__PURE__ */ jsx33(
|
|
19801
20119
|
Flex,
|
|
19802
20120
|
{
|
|
19803
20121
|
$alignItems: "center",
|
|
@@ -19806,7 +20124,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19806
20124
|
$borderStyle: "solid",
|
|
19807
20125
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
19808
20126
|
$borderRadius: "0.3125rem",
|
|
19809
|
-
children: /* @__PURE__ */
|
|
20127
|
+
children: /* @__PURE__ */ jsx33(
|
|
19810
20128
|
Text,
|
|
19811
20129
|
{
|
|
19812
20130
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19818,7 +20136,7 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19818
20136
|
)
|
|
19819
20137
|
}
|
|
19820
20138
|
),
|
|
19821
|
-
/* @__PURE__ */
|
|
20139
|
+
/* @__PURE__ */ jsx33(Box, { children: /* @__PURE__ */ jsx33(
|
|
19822
20140
|
Text,
|
|
19823
20141
|
{
|
|
19824
20142
|
$font: theme.typography.text.fontFamily,
|
|
@@ -19836,8 +20154,69 @@ var UpcomingBill = forwardRef13(({ className, ...rest }, ref) => {
|
|
|
19836
20154
|
});
|
|
19837
20155
|
UpcomingBill.displayName = "UpcomingBill";
|
|
19838
20156
|
|
|
20157
|
+
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
20158
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
20159
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
20160
|
+
var resolveDesignProps8 = (props) => {
|
|
20161
|
+
return {
|
|
20162
|
+
button: {
|
|
20163
|
+
text: props.button?.text ?? "Unsubscribe",
|
|
20164
|
+
style: props.button?.style ?? "primary",
|
|
20165
|
+
size: props.button?.size ?? "md",
|
|
20166
|
+
fullWidth: props.button?.fullWidth ?? true,
|
|
20167
|
+
alignment: props.button?.alignment ?? "center"
|
|
20168
|
+
}
|
|
20169
|
+
};
|
|
20170
|
+
};
|
|
20171
|
+
var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) => {
|
|
20172
|
+
const props = resolveDesignProps8(rest);
|
|
20173
|
+
const { t: t2 } = useTranslation();
|
|
20174
|
+
const { data, setLayout } = useEmbed();
|
|
20175
|
+
const disabled = !data.subscription || data.subscription.status === "cancelled";
|
|
20176
|
+
const buttonStyles = {
|
|
20177
|
+
primary: {
|
|
20178
|
+
color: "primary",
|
|
20179
|
+
variant: "filled"
|
|
20180
|
+
},
|
|
20181
|
+
secondary: {
|
|
20182
|
+
color: "primary",
|
|
20183
|
+
variant: "outline"
|
|
20184
|
+
},
|
|
20185
|
+
tertiary: {
|
|
20186
|
+
color: "primary",
|
|
20187
|
+
variant: "text"
|
|
20188
|
+
}
|
|
20189
|
+
};
|
|
20190
|
+
return /* @__PURE__ */ jsx34(
|
|
20191
|
+
Element,
|
|
20192
|
+
{
|
|
20193
|
+
as: Flex,
|
|
20194
|
+
ref,
|
|
20195
|
+
className,
|
|
20196
|
+
$flexDirection: "column",
|
|
20197
|
+
$gap: "2rem",
|
|
20198
|
+
children: /* @__PURE__ */ jsx34(
|
|
20199
|
+
EmbedButton,
|
|
20200
|
+
{
|
|
20201
|
+
$size: props.button.size,
|
|
20202
|
+
$color: buttonStyles[props.button.style].color,
|
|
20203
|
+
$variant: buttonStyles[props.button.style].variant,
|
|
20204
|
+
$alignment: props.button.alignment,
|
|
20205
|
+
$fullWidth: props.button.fullWidth,
|
|
20206
|
+
onClick: () => {
|
|
20207
|
+
setLayout("unsubscribe");
|
|
20208
|
+
},
|
|
20209
|
+
disabled,
|
|
20210
|
+
children: t2(props.button.text) ?? t2("Unsubscribe")
|
|
20211
|
+
}
|
|
20212
|
+
)
|
|
20213
|
+
}
|
|
20214
|
+
);
|
|
20215
|
+
});
|
|
20216
|
+
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
20217
|
+
|
|
19839
20218
|
// src/components/embed/ComponentTree.tsx
|
|
19840
|
-
import { useEffect as useEffect9, useState as
|
|
20219
|
+
import { useEffect as useEffect9, useState as useState17 } from "react";
|
|
19841
20220
|
|
|
19842
20221
|
// src/components/embed/renderer.ts
|
|
19843
20222
|
import { createElement as createElement5 } from "react";
|
|
@@ -19852,7 +20231,8 @@ var components = {
|
|
|
19852
20231
|
UpcomingBill,
|
|
19853
20232
|
PaymentMethod,
|
|
19854
20233
|
Invoices,
|
|
19855
|
-
PricingTable
|
|
20234
|
+
PricingTable,
|
|
20235
|
+
UnsubscribeButton
|
|
19856
20236
|
};
|
|
19857
20237
|
function createRenderer(options) {
|
|
19858
20238
|
const { useFallback = false } = options || {};
|
|
@@ -19862,7 +20242,7 @@ function createRenderer(options) {
|
|
|
19862
20242
|
const component = useFallback ? components[name] || "div" : components[name];
|
|
19863
20243
|
if (!components[name]) {
|
|
19864
20244
|
console.debug(
|
|
19865
|
-
"`schematic-embed`:
|
|
20245
|
+
"`schematic-embed`: Encountered an unknown component during render cycle.",
|
|
19866
20246
|
name
|
|
19867
20247
|
);
|
|
19868
20248
|
}
|
|
@@ -19885,10 +20265,10 @@ function createRenderer(options) {
|
|
|
19885
20265
|
}
|
|
19886
20266
|
|
|
19887
20267
|
// src/components/embed/ComponentTree.tsx
|
|
19888
|
-
import { Fragment as Fragment14, jsx as
|
|
20268
|
+
import { Fragment as Fragment14, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
19889
20269
|
var Loading = () => {
|
|
19890
20270
|
const theme = nt();
|
|
19891
|
-
return /* @__PURE__ */
|
|
20271
|
+
return /* @__PURE__ */ jsx35(
|
|
19892
20272
|
Flex,
|
|
19893
20273
|
{
|
|
19894
20274
|
$width: "100%",
|
|
@@ -19896,13 +20276,13 @@ var Loading = () => {
|
|
|
19896
20276
|
$alignItems: "center",
|
|
19897
20277
|
$justifyContent: "center",
|
|
19898
20278
|
$padding: `${theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
19899
|
-
children: /* @__PURE__ */
|
|
20279
|
+
children: /* @__PURE__ */ jsx35(Loader, { $size: "2xl", $color: "#194BFB" })
|
|
19900
20280
|
}
|
|
19901
20281
|
);
|
|
19902
20282
|
};
|
|
19903
20283
|
var Error2 = ({ message }) => {
|
|
19904
20284
|
const theme = nt();
|
|
19905
|
-
return /* @__PURE__ */
|
|
20285
|
+
return /* @__PURE__ */ jsxs27(
|
|
19906
20286
|
Flex,
|
|
19907
20287
|
{
|
|
19908
20288
|
$flexDirection: "column",
|
|
@@ -19913,7 +20293,7 @@ var Error2 = ({ message }) => {
|
|
|
19913
20293
|
$alignItems: "center",
|
|
19914
20294
|
$justifyContent: "center",
|
|
19915
20295
|
children: [
|
|
19916
|
-
/* @__PURE__ */
|
|
20296
|
+
/* @__PURE__ */ jsx35(
|
|
19917
20297
|
Box,
|
|
19918
20298
|
{
|
|
19919
20299
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19924,7 +20304,7 @@ var Error2 = ({ message }) => {
|
|
|
19924
20304
|
children: "Error"
|
|
19925
20305
|
}
|
|
19926
20306
|
),
|
|
19927
|
-
/* @__PURE__ */
|
|
20307
|
+
/* @__PURE__ */ jsx35(
|
|
19928
20308
|
Box,
|
|
19929
20309
|
{
|
|
19930
20310
|
$marginBottom: `${8 / TEXT_BASE_SIZE}rem`,
|
|
@@ -19941,31 +20321,31 @@ var Error2 = ({ message }) => {
|
|
|
19941
20321
|
};
|
|
19942
20322
|
var ComponentTree = () => {
|
|
19943
20323
|
const { error, nodes, isPending } = useEmbed();
|
|
19944
|
-
const [children, setChildren] =
|
|
20324
|
+
const [children, setChildren] = useState17(/* @__PURE__ */ jsx35(Loading, {}));
|
|
19945
20325
|
useEffect9(() => {
|
|
19946
20326
|
const renderer = createRenderer();
|
|
19947
20327
|
setChildren(nodes.map(renderer));
|
|
19948
20328
|
}, [nodes]);
|
|
19949
20329
|
if (error) {
|
|
19950
20330
|
console.error(error);
|
|
19951
|
-
return /* @__PURE__ */
|
|
20331
|
+
return /* @__PURE__ */ jsx35(Error2, { message: error.message });
|
|
19952
20332
|
}
|
|
19953
20333
|
if (isPending) {
|
|
19954
|
-
return /* @__PURE__ */
|
|
20334
|
+
return /* @__PURE__ */ jsx35(Loading, {});
|
|
19955
20335
|
}
|
|
19956
|
-
return /* @__PURE__ */
|
|
20336
|
+
return /* @__PURE__ */ jsx35(Fragment14, { children });
|
|
19957
20337
|
};
|
|
19958
20338
|
|
|
19959
20339
|
// src/components/embed/Embed.tsx
|
|
19960
|
-
import { jsx as
|
|
20340
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
19961
20341
|
var SchematicEmbed = ({ id, accessToken, apiConfig }) => {
|
|
19962
20342
|
if (accessToken?.length === 0) {
|
|
19963
|
-
return /* @__PURE__ */
|
|
20343
|
+
return /* @__PURE__ */ jsx36("div", { children: "Please provide an access token." });
|
|
19964
20344
|
}
|
|
19965
20345
|
if (!accessToken?.startsWith("token_")) {
|
|
19966
|
-
return /* @__PURE__ */
|
|
20346
|
+
return /* @__PURE__ */ jsx36("div", { children: 'Invalid access token; your temporary access token will start with "token_".' });
|
|
19967
20347
|
}
|
|
19968
|
-
return /* @__PURE__ */
|
|
20348
|
+
return /* @__PURE__ */ jsx36(EmbedProvider, { id, accessToken, apiConfig, children: /* @__PURE__ */ jsx36(ComponentTree, {}) });
|
|
19969
20349
|
};
|
|
19970
20350
|
export {
|
|
19971
20351
|
Box,
|
|
@@ -19997,6 +20377,7 @@ export {
|
|
|
19997
20377
|
StyledCard,
|
|
19998
20378
|
Text,
|
|
19999
20379
|
Tooltip,
|
|
20380
|
+
UnsubscribeButton,
|
|
20000
20381
|
UpcomingBill,
|
|
20001
20382
|
Viewport,
|
|
20002
20383
|
cardBoxShadow,
|