@schematichq/schematic-components 0.4.3 → 0.4.5
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.
|
@@ -3781,18 +3781,22 @@ function useAvailablePlans(activePeriod) {
|
|
|
3781
3781
|
}, [data.activePlans, data.activeAddOns]);
|
|
3782
3782
|
const getActivePlans = (0, import_react10.useCallback)(
|
|
3783
3783
|
(plans) => {
|
|
3784
|
-
const
|
|
3784
|
+
const customPlanExist = plans.some((plan) => plan.custom);
|
|
3785
|
+
let plansWithSelected = mode === "edit" ? plans.slice() : plans.filter(
|
|
3785
3786
|
(plan) => activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice
|
|
3786
|
-
)
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3787
|
+
);
|
|
3788
|
+
if (!customPlanExist) {
|
|
3789
|
+
plansWithSelected = plansWithSelected.sort((a2, b2) => {
|
|
3790
|
+
if (activePeriod === "year") {
|
|
3791
|
+
return (a2.yearlyPrice?.price ?? 0) - (b2.yearlyPrice?.price ?? 0);
|
|
3792
|
+
}
|
|
3793
|
+
if (activePeriod === "month") {
|
|
3794
|
+
return (a2.monthlyPrice?.price ?? 0) - (b2.monthlyPrice?.price ?? 0);
|
|
3795
|
+
}
|
|
3796
|
+
return 0;
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3799
|
+
return plansWithSelected.map((plan) => ({ ...plan, isSelected: false }));
|
|
3796
3800
|
},
|
|
3797
3801
|
[activePeriod, mode]
|
|
3798
3802
|
);
|
|
@@ -11937,6 +11941,8 @@ var en_default = {
|
|
|
11937
11941
|
"Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
|
|
11938
11942
|
"Error updating payment method. Please try again.": "Error updating payment method. Please try again.",
|
|
11939
11943
|
"Estimated bill.": "Estimated bill.",
|
|
11944
|
+
"Custom Plan Price": "Custom price",
|
|
11945
|
+
"Custom Plan CTA": "Talk to support",
|
|
11940
11946
|
"Everything in": "Everything in {{plan}}, plus",
|
|
11941
11947
|
Expired: "Expired",
|
|
11942
11948
|
"Expires in x months": "Expires in {{months}} mo",
|
|
@@ -12729,7 +12735,7 @@ var EmbedProvider = ({
|
|
|
12729
12735
|
(0, import_react11.useEffect)(() => {
|
|
12730
12736
|
if (accessToken) {
|
|
12731
12737
|
const { headers = {} } = apiConfig ?? {};
|
|
12732
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12738
|
+
headers["X-Schematic-Components-Version"] = "0.4.5";
|
|
12733
12739
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12734
12740
|
const config = new Configuration({
|
|
12735
12741
|
...apiConfig,
|
|
@@ -15536,6 +15542,16 @@ var Sidebar = ({
|
|
|
15536
15542
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
15537
15543
|
var import_react22 = require("react");
|
|
15538
15544
|
var import_pluralize2 = __toESM(require_pluralize());
|
|
15545
|
+
|
|
15546
|
+
// src/components/elements/pricing-table/styles.ts
|
|
15547
|
+
var ButtonLink = dt.a`
|
|
15548
|
+
display: flex;
|
|
15549
|
+
justify-content: center;
|
|
15550
|
+
align-items: center;
|
|
15551
|
+
flex-grow: 1;
|
|
15552
|
+
`;
|
|
15553
|
+
|
|
15554
|
+
// src/components/shared/checkout-dialog/Plan.tsx
|
|
15539
15555
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
15540
15556
|
var Plan = ({
|
|
15541
15557
|
isLoading,
|
|
@@ -15642,13 +15658,13 @@ var Plan = ({
|
|
|
15642
15658
|
$size: theme.typography.heading2.fontSize,
|
|
15643
15659
|
$weight: theme.typography.heading2.fontWeight,
|
|
15644
15660
|
$color: theme.typography.heading2.color,
|
|
15645
|
-
children: formatCurrency(
|
|
15661
|
+
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig?.priceText : t2("Custom Plan Price") : formatCurrency(
|
|
15646
15662
|
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
15647
15663
|
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
15648
15664
|
)
|
|
15649
15665
|
}
|
|
15650
15666
|
),
|
|
15651
|
-
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
15667
|
+
!plan.custom && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
15652
15668
|
Text,
|
|
15653
15669
|
{
|
|
15654
15670
|
$font: theme.typography.heading2.fontFamily,
|
|
@@ -15844,13 +15860,25 @@ var Plan = ({
|
|
|
15844
15860
|
EmbedButton,
|
|
15845
15861
|
{
|
|
15846
15862
|
disabled: isLoading || !plan.valid,
|
|
15847
|
-
|
|
15848
|
-
|
|
15863
|
+
...{
|
|
15864
|
+
onClick: () => {
|
|
15865
|
+
if (plan.custom) {
|
|
15866
|
+
return;
|
|
15867
|
+
}
|
|
15868
|
+
selectPlan({ plan });
|
|
15869
|
+
}
|
|
15849
15870
|
},
|
|
15850
15871
|
$size: "sm",
|
|
15851
15872
|
$color: "primary",
|
|
15852
15873
|
$variant: plan.current ? "outline" : "filled",
|
|
15853
|
-
children:
|
|
15874
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
15875
|
+
ButtonLink,
|
|
15876
|
+
{
|
|
15877
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
15878
|
+
target: "_blank",
|
|
15879
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
15880
|
+
}
|
|
15881
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
15854
15882
|
Tooltip,
|
|
15855
15883
|
{
|
|
15856
15884
|
trigger: t2("Over usage limit"),
|
|
@@ -16586,18 +16614,6 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16586
16614
|
),
|
|
16587
16615
|
[usageBasedEntitlements]
|
|
16588
16616
|
);
|
|
16589
|
-
const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(() => {
|
|
16590
|
-
if (selected.planId !== currentPlan?.id) {
|
|
16591
|
-
return payInAdvanceEntitlements.length > 0 ? "usage" : "addons";
|
|
16592
|
-
}
|
|
16593
|
-
if (selected.addOnId) {
|
|
16594
|
-
return "addons";
|
|
16595
|
-
}
|
|
16596
|
-
if (selected.usage) {
|
|
16597
|
-
return "usage";
|
|
16598
|
-
}
|
|
16599
|
-
return "plan";
|
|
16600
|
-
});
|
|
16601
16617
|
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
|
|
16602
16618
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16603
16619
|
({ quantity }) => quantity > 0
|
|
@@ -16641,6 +16657,18 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16641
16657
|
selectedPlan?.companyCanTrial,
|
|
16642
16658
|
requiresPayment
|
|
16643
16659
|
]);
|
|
16660
|
+
const [checkoutStage, setCheckoutStage] = (0, import_react24.useState)(() => {
|
|
16661
|
+
if (selected.addOnId) {
|
|
16662
|
+
return "addons";
|
|
16663
|
+
}
|
|
16664
|
+
if (selected.usage) {
|
|
16665
|
+
return "usage";
|
|
16666
|
+
}
|
|
16667
|
+
if (selected.planId !== currentPlan?.id) {
|
|
16668
|
+
return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : "plan";
|
|
16669
|
+
}
|
|
16670
|
+
return "plan";
|
|
16671
|
+
});
|
|
16644
16672
|
const isLightBackground = useIsLightBackground();
|
|
16645
16673
|
const previewCheckout = (0, import_react24.useCallback)(
|
|
16646
16674
|
async (updates) => {
|
|
@@ -17592,7 +17620,7 @@ var Details = ({
|
|
|
17592
17620
|
if (!priceBehavior) {
|
|
17593
17621
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17594
17622
|
}
|
|
17595
|
-
}, [allocation, feature?.name, price, priceBehavior, t2]);
|
|
17623
|
+
}, [allocation, feature?.name, price, priceBehavior, t2, currency]);
|
|
17596
17624
|
const usageText = (0, import_react31.useMemo)(() => {
|
|
17597
17625
|
if (!feature?.name) {
|
|
17598
17626
|
return;
|
|
@@ -17629,7 +17657,8 @@ var Details = ({
|
|
|
17629
17657
|
priceBehavior,
|
|
17630
17658
|
t2,
|
|
17631
17659
|
usage,
|
|
17632
|
-
usageData
|
|
17660
|
+
usageData,
|
|
17661
|
+
currency
|
|
17633
17662
|
]);
|
|
17634
17663
|
if (!text) {
|
|
17635
17664
|
return null;
|
|
@@ -18660,13 +18689,13 @@ var PlanManager = (0, import_react36.forwardRef)(({ children, className, portal,
|
|
|
18660
18689
|
(acc, usage) => {
|
|
18661
18690
|
const quantity = usage?.allocation ?? 0;
|
|
18662
18691
|
let price;
|
|
18663
|
-
let currencyCode
|
|
18692
|
+
let currencyCode;
|
|
18664
18693
|
if (currentPlan?.planPeriod === "month") {
|
|
18665
18694
|
price = usage.monthlyUsageBasedPrice?.price;
|
|
18666
|
-
currencyCode = usage.monthlyUsageBasedPrice?.currency
|
|
18695
|
+
currencyCode = usage.monthlyUsageBasedPrice?.currency;
|
|
18667
18696
|
} else if (currentPlan?.planPeriod === "year") {
|
|
18668
18697
|
price = usage.yearlyUsageBasedPrice?.price;
|
|
18669
|
-
currencyCode = usage.yearlyUsageBasedPrice?.currency
|
|
18698
|
+
currencyCode = usage.yearlyUsageBasedPrice?.currency;
|
|
18670
18699
|
}
|
|
18671
18700
|
if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
|
|
18672
18701
|
acc.push({ ...usage, price, quantity, currencyCode });
|
|
@@ -19159,13 +19188,13 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19159
19188
|
$size: theme.typography[props.plans.name.fontStyle].fontSize,
|
|
19160
19189
|
$weight: theme.typography[props.plans.name.fontStyle].fontWeight,
|
|
19161
19190
|
$color: theme.typography[props.plans.name.fontStyle].color,
|
|
19162
|
-
children: formatCurrency(
|
|
19191
|
+
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig?.priceText : t2("Custom Plan Price") : formatCurrency(
|
|
19163
19192
|
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
19164
19193
|
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
19165
19194
|
)
|
|
19166
19195
|
}
|
|
19167
19196
|
),
|
|
19168
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19197
|
+
!plan.custom && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
19169
19198
|
Text,
|
|
19170
19199
|
{
|
|
19171
19200
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19357,13 +19386,15 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19357
19386
|
EmbedButton,
|
|
19358
19387
|
{
|
|
19359
19388
|
disabled: !plan.valid || !canCheckout,
|
|
19360
|
-
|
|
19361
|
-
|
|
19362
|
-
|
|
19363
|
-
|
|
19364
|
-
|
|
19365
|
-
|
|
19366
|
-
|
|
19389
|
+
...!plan.custom && {
|
|
19390
|
+
onClick: () => {
|
|
19391
|
+
setSelected({
|
|
19392
|
+
period: selectedPeriod,
|
|
19393
|
+
planId: isActivePlan ? null : plan.id,
|
|
19394
|
+
usage: false
|
|
19395
|
+
});
|
|
19396
|
+
setLayout("checkout");
|
|
19397
|
+
}
|
|
19367
19398
|
},
|
|
19368
19399
|
...index > currentPlanIndex ? {
|
|
19369
19400
|
$size: props.upgrade.buttonSize,
|
|
@@ -19374,7 +19405,14 @@ var PricingTable = (0, import_react37.forwardRef)(({ children, className, ...res
|
|
|
19374
19405
|
$color: props.downgrade.buttonStyle,
|
|
19375
19406
|
$variant: "outline"
|
|
19376
19407
|
},
|
|
19377
|
-
children:
|
|
19408
|
+
children: plan.custom ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19409
|
+
ButtonLink,
|
|
19410
|
+
{
|
|
19411
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19412
|
+
target: "_blank",
|
|
19413
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
19414
|
+
}
|
|
19415
|
+
) : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
19378
19416
|
Tooltip,
|
|
19379
19417
|
{
|
|
19380
19418
|
trigger: t2("Over usage limit"),
|
|
@@ -4447,8 +4447,60 @@ declare interface UsageBasedEntitlementResponseData {
|
|
|
4447
4447
|
}
|
|
4448
4448
|
|
|
4449
4449
|
export declare function useAvailablePlans(activePeriod: string): {
|
|
4450
|
-
plans:
|
|
4451
|
-
|
|
4450
|
+
plans: {
|
|
4451
|
+
isSelected: boolean;
|
|
4452
|
+
audienceType?: string | null;
|
|
4453
|
+
billingProduct?: BillingProductDetailResponseData;
|
|
4454
|
+
companyCanTrial: boolean;
|
|
4455
|
+
companyCount: number;
|
|
4456
|
+
createdAt: Date;
|
|
4457
|
+
current: boolean;
|
|
4458
|
+
custom: boolean;
|
|
4459
|
+
customPlanConfig?: CustomPlanConfig;
|
|
4460
|
+
description: string;
|
|
4461
|
+
entitlements: Array<PlanEntitlementResponseData>;
|
|
4462
|
+
features: Array<FeatureDetailResponseData>;
|
|
4463
|
+
icon: string;
|
|
4464
|
+
id: string;
|
|
4465
|
+
isCustom: boolean;
|
|
4466
|
+
isDefault: boolean;
|
|
4467
|
+
isFree: boolean;
|
|
4468
|
+
isTrialable: boolean;
|
|
4469
|
+
monthlyPrice?: BillingPriceResponseData;
|
|
4470
|
+
name: string;
|
|
4471
|
+
planType: string;
|
|
4472
|
+
trialDays?: number | null;
|
|
4473
|
+
updatedAt: Date;
|
|
4474
|
+
valid: boolean;
|
|
4475
|
+
yearlyPrice?: BillingPriceResponseData;
|
|
4476
|
+
}[];
|
|
4477
|
+
addOns: {
|
|
4478
|
+
isSelected: boolean;
|
|
4479
|
+
audienceType?: string | null;
|
|
4480
|
+
billingProduct?: BillingProductDetailResponseData;
|
|
4481
|
+
companyCanTrial: boolean;
|
|
4482
|
+
companyCount: number;
|
|
4483
|
+
createdAt: Date;
|
|
4484
|
+
current: boolean;
|
|
4485
|
+
custom: boolean;
|
|
4486
|
+
customPlanConfig?: CustomPlanConfig;
|
|
4487
|
+
description: string;
|
|
4488
|
+
entitlements: Array<PlanEntitlementResponseData>;
|
|
4489
|
+
features: Array<FeatureDetailResponseData>;
|
|
4490
|
+
icon: string;
|
|
4491
|
+
id: string;
|
|
4492
|
+
isCustom: boolean;
|
|
4493
|
+
isDefault: boolean;
|
|
4494
|
+
isFree: boolean;
|
|
4495
|
+
isTrialable: boolean;
|
|
4496
|
+
monthlyPrice?: BillingPriceResponseData;
|
|
4497
|
+
name: string;
|
|
4498
|
+
planType: string;
|
|
4499
|
+
trialDays?: number | null;
|
|
4500
|
+
updatedAt: Date;
|
|
4501
|
+
valid: boolean;
|
|
4502
|
+
yearlyPrice?: BillingPriceResponseData;
|
|
4503
|
+
}[];
|
|
4452
4504
|
periods: string[];
|
|
4453
4505
|
};
|
|
4454
4506
|
|
|
@@ -3734,18 +3734,22 @@ function useAvailablePlans(activePeriod) {
|
|
|
3734
3734
|
}, [data.activePlans, data.activeAddOns]);
|
|
3735
3735
|
const getActivePlans = useCallback2(
|
|
3736
3736
|
(plans) => {
|
|
3737
|
-
const
|
|
3737
|
+
const customPlanExist = plans.some((plan) => plan.custom);
|
|
3738
|
+
let plansWithSelected = mode === "edit" ? plans.slice() : plans.filter(
|
|
3738
3739
|
(plan) => activePeriod === "month" && plan.monthlyPrice || activePeriod === "year" && plan.yearlyPrice
|
|
3739
|
-
)
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3740
|
+
);
|
|
3741
|
+
if (!customPlanExist) {
|
|
3742
|
+
plansWithSelected = plansWithSelected.sort((a2, b2) => {
|
|
3743
|
+
if (activePeriod === "year") {
|
|
3744
|
+
return (a2.yearlyPrice?.price ?? 0) - (b2.yearlyPrice?.price ?? 0);
|
|
3745
|
+
}
|
|
3746
|
+
if (activePeriod === "month") {
|
|
3747
|
+
return (a2.monthlyPrice?.price ?? 0) - (b2.monthlyPrice?.price ?? 0);
|
|
3748
|
+
}
|
|
3749
|
+
return 0;
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
return plansWithSelected.map((plan) => ({ ...plan, isSelected: false }));
|
|
3749
3753
|
},
|
|
3750
3754
|
[activePeriod, mode]
|
|
3751
3755
|
);
|
|
@@ -11890,6 +11894,8 @@ var en_default = {
|
|
|
11890
11894
|
"Error retrieving plan details. Please try again in a moment.": "Error retrieving plan details. Please try again in a moment.",
|
|
11891
11895
|
"Error updating payment method. Please try again.": "Error updating payment method. Please try again.",
|
|
11892
11896
|
"Estimated bill.": "Estimated bill.",
|
|
11897
|
+
"Custom Plan Price": "Custom price",
|
|
11898
|
+
"Custom Plan CTA": "Talk to support",
|
|
11893
11899
|
"Everything in": "Everything in {{plan}}, plus",
|
|
11894
11900
|
Expired: "Expired",
|
|
11895
11901
|
"Expires in x months": "Expires in {{months}} mo",
|
|
@@ -12682,7 +12688,7 @@ var EmbedProvider = ({
|
|
|
12682
12688
|
useEffect2(() => {
|
|
12683
12689
|
if (accessToken) {
|
|
12684
12690
|
const { headers = {} } = apiConfig ?? {};
|
|
12685
|
-
headers["X-Schematic-Components-Version"] = "0.4.
|
|
12691
|
+
headers["X-Schematic-Components-Version"] = "0.4.5";
|
|
12686
12692
|
headers["X-Schematic-Session-ID"] = sessionIdRef.current;
|
|
12687
12693
|
const config = new Configuration({
|
|
12688
12694
|
...apiConfig,
|
|
@@ -15496,6 +15502,16 @@ var Sidebar = ({
|
|
|
15496
15502
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
15497
15503
|
import { useState as useState5 } from "react";
|
|
15498
15504
|
var import_pluralize2 = __toESM(require_pluralize());
|
|
15505
|
+
|
|
15506
|
+
// src/components/elements/pricing-table/styles.ts
|
|
15507
|
+
var ButtonLink = dt.a`
|
|
15508
|
+
display: flex;
|
|
15509
|
+
justify-content: center;
|
|
15510
|
+
align-items: center;
|
|
15511
|
+
flex-grow: 1;
|
|
15512
|
+
`;
|
|
15513
|
+
|
|
15514
|
+
// src/components/shared/checkout-dialog/Plan.tsx
|
|
15499
15515
|
import { Fragment as Fragment5, jsx as jsx13, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
15500
15516
|
var Plan = ({
|
|
15501
15517
|
isLoading,
|
|
@@ -15602,13 +15618,13 @@ var Plan = ({
|
|
|
15602
15618
|
$size: theme.typography.heading2.fontSize,
|
|
15603
15619
|
$weight: theme.typography.heading2.fontWeight,
|
|
15604
15620
|
$color: theme.typography.heading2.color,
|
|
15605
|
-
children: formatCurrency(
|
|
15621
|
+
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig?.priceText : t2("Custom Plan Price") : formatCurrency(
|
|
15606
15622
|
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
15607
15623
|
(period === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
15608
15624
|
)
|
|
15609
15625
|
}
|
|
15610
15626
|
),
|
|
15611
|
-
/* @__PURE__ */ jsxs9(
|
|
15627
|
+
!plan.custom && /* @__PURE__ */ jsxs9(
|
|
15612
15628
|
Text,
|
|
15613
15629
|
{
|
|
15614
15630
|
$font: theme.typography.heading2.fontFamily,
|
|
@@ -15804,13 +15820,25 @@ var Plan = ({
|
|
|
15804
15820
|
EmbedButton,
|
|
15805
15821
|
{
|
|
15806
15822
|
disabled: isLoading || !plan.valid,
|
|
15807
|
-
|
|
15808
|
-
|
|
15823
|
+
...{
|
|
15824
|
+
onClick: () => {
|
|
15825
|
+
if (plan.custom) {
|
|
15826
|
+
return;
|
|
15827
|
+
}
|
|
15828
|
+
selectPlan({ plan });
|
|
15829
|
+
}
|
|
15809
15830
|
},
|
|
15810
15831
|
$size: "sm",
|
|
15811
15832
|
$color: "primary",
|
|
15812
15833
|
$variant: plan.current ? "outline" : "filled",
|
|
15813
|
-
children:
|
|
15834
|
+
children: plan.custom ? /* @__PURE__ */ jsx13(
|
|
15835
|
+
ButtonLink,
|
|
15836
|
+
{
|
|
15837
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
15838
|
+
target: "_blank",
|
|
15839
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
15840
|
+
}
|
|
15841
|
+
) : !plan.valid ? /* @__PURE__ */ jsx13(
|
|
15814
15842
|
Tooltip,
|
|
15815
15843
|
{
|
|
15816
15844
|
trigger: t2("Over usage limit"),
|
|
@@ -16546,18 +16574,6 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16546
16574
|
),
|
|
16547
16575
|
[usageBasedEntitlements]
|
|
16548
16576
|
);
|
|
16549
|
-
const [checkoutStage, setCheckoutStage] = useState7(() => {
|
|
16550
|
-
if (selected.planId !== currentPlan?.id) {
|
|
16551
|
-
return payInAdvanceEntitlements.length > 0 ? "usage" : "addons";
|
|
16552
|
-
}
|
|
16553
|
-
if (selected.addOnId) {
|
|
16554
|
-
return "addons";
|
|
16555
|
-
}
|
|
16556
|
-
if (selected.usage) {
|
|
16557
|
-
return "usage";
|
|
16558
|
-
}
|
|
16559
|
-
return "plan";
|
|
16560
|
-
});
|
|
16561
16577
|
const hasActiveAddOns = addOns.some((addOn) => addOn.isSelected === true);
|
|
16562
16578
|
const hasActivePayInAdvanceEntitlements = payInAdvanceEntitlements.some(
|
|
16563
16579
|
({ quantity }) => quantity > 0
|
|
@@ -16601,6 +16617,18 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
16601
16617
|
selectedPlan?.companyCanTrial,
|
|
16602
16618
|
requiresPayment
|
|
16603
16619
|
]);
|
|
16620
|
+
const [checkoutStage, setCheckoutStage] = useState7(() => {
|
|
16621
|
+
if (selected.addOnId) {
|
|
16622
|
+
return "addons";
|
|
16623
|
+
}
|
|
16624
|
+
if (selected.usage) {
|
|
16625
|
+
return "usage";
|
|
16626
|
+
}
|
|
16627
|
+
if (selected.planId !== currentPlan?.id) {
|
|
16628
|
+
return checkoutStages.some((stage) => stage.id === "usage") ? "usage" : checkoutStages.some((stage) => stage.id === "addons") ? "addons" : "plan";
|
|
16629
|
+
}
|
|
16630
|
+
return "plan";
|
|
16631
|
+
});
|
|
16604
16632
|
const isLightBackground = useIsLightBackground();
|
|
16605
16633
|
const previewCheckout = useCallback7(
|
|
16606
16634
|
async (updates) => {
|
|
@@ -17556,7 +17584,7 @@ var Details = ({
|
|
|
17556
17584
|
if (!priceBehavior) {
|
|
17557
17585
|
return t2("Unlimited", { item: (0, import_pluralize4.default)(feature.name) });
|
|
17558
17586
|
}
|
|
17559
|
-
}, [allocation, feature?.name, price, priceBehavior, t2]);
|
|
17587
|
+
}, [allocation, feature?.name, price, priceBehavior, t2, currency]);
|
|
17560
17588
|
const usageText = useMemo7(() => {
|
|
17561
17589
|
if (!feature?.name) {
|
|
17562
17590
|
return;
|
|
@@ -17593,7 +17621,8 @@ var Details = ({
|
|
|
17593
17621
|
priceBehavior,
|
|
17594
17622
|
t2,
|
|
17595
17623
|
usage,
|
|
17596
|
-
usageData
|
|
17624
|
+
usageData,
|
|
17625
|
+
currency
|
|
17597
17626
|
]);
|
|
17598
17627
|
if (!text) {
|
|
17599
17628
|
return null;
|
|
@@ -18631,13 +18660,13 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18631
18660
|
(acc, usage) => {
|
|
18632
18661
|
const quantity = usage?.allocation ?? 0;
|
|
18633
18662
|
let price;
|
|
18634
|
-
let currencyCode
|
|
18663
|
+
let currencyCode;
|
|
18635
18664
|
if (currentPlan?.planPeriod === "month") {
|
|
18636
18665
|
price = usage.monthlyUsageBasedPrice?.price;
|
|
18637
|
-
currencyCode = usage.monthlyUsageBasedPrice?.currency
|
|
18666
|
+
currencyCode = usage.monthlyUsageBasedPrice?.currency;
|
|
18638
18667
|
} else if (currentPlan?.planPeriod === "year") {
|
|
18639
18668
|
price = usage.yearlyUsageBasedPrice?.price;
|
|
18640
|
-
currencyCode = usage.yearlyUsageBasedPrice?.currency
|
|
18669
|
+
currencyCode = usage.yearlyUsageBasedPrice?.currency;
|
|
18641
18670
|
}
|
|
18642
18671
|
if (usage.priceBehavior && typeof price === "number" && quantity > 0) {
|
|
18643
18672
|
acc.push({ ...usage, price, quantity, currencyCode });
|
|
@@ -19130,13 +19159,13 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19130
19159
|
$size: theme.typography[props.plans.name.fontStyle].fontSize,
|
|
19131
19160
|
$weight: theme.typography[props.plans.name.fontStyle].fontWeight,
|
|
19132
19161
|
$color: theme.typography[props.plans.name.fontStyle].color,
|
|
19133
|
-
children: formatCurrency(
|
|
19162
|
+
children: plan.custom ? plan.customPlanConfig?.priceText ? plan.customPlanConfig?.priceText : t2("Custom Plan Price") : formatCurrency(
|
|
19134
19163
|
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.price ?? 0,
|
|
19135
19164
|
(selectedPeriod === "month" ? plan.monthlyPrice : plan.yearlyPrice)?.currency
|
|
19136
19165
|
)
|
|
19137
19166
|
}
|
|
19138
19167
|
),
|
|
19139
|
-
/* @__PURE__ */ jsxs24(
|
|
19168
|
+
!plan.custom && /* @__PURE__ */ jsxs24(
|
|
19140
19169
|
Text,
|
|
19141
19170
|
{
|
|
19142
19171
|
$font: theme.typography[props.plans.name.fontStyle].fontFamily,
|
|
@@ -19328,13 +19357,15 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19328
19357
|
EmbedButton,
|
|
19329
19358
|
{
|
|
19330
19359
|
disabled: !plan.valid || !canCheckout,
|
|
19331
|
-
|
|
19332
|
-
|
|
19333
|
-
|
|
19334
|
-
|
|
19335
|
-
|
|
19336
|
-
|
|
19337
|
-
|
|
19360
|
+
...!plan.custom && {
|
|
19361
|
+
onClick: () => {
|
|
19362
|
+
setSelected({
|
|
19363
|
+
period: selectedPeriod,
|
|
19364
|
+
planId: isActivePlan ? null : plan.id,
|
|
19365
|
+
usage: false
|
|
19366
|
+
});
|
|
19367
|
+
setLayout("checkout");
|
|
19368
|
+
}
|
|
19338
19369
|
},
|
|
19339
19370
|
...index > currentPlanIndex ? {
|
|
19340
19371
|
$size: props.upgrade.buttonSize,
|
|
@@ -19345,7 +19376,14 @@ var PricingTable = forwardRef12(({ children, className, ...rest }, ref) => {
|
|
|
19345
19376
|
$color: props.downgrade.buttonStyle,
|
|
19346
19377
|
$variant: "outline"
|
|
19347
19378
|
},
|
|
19348
|
-
children:
|
|
19379
|
+
children: plan.custom ? /* @__PURE__ */ jsx31(
|
|
19380
|
+
ButtonLink,
|
|
19381
|
+
{
|
|
19382
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19383
|
+
target: "_blank",
|
|
19384
|
+
children: plan.customPlanConfig?.ctaText ?? t2("Custom Plan CTA")
|
|
19385
|
+
}
|
|
19386
|
+
) : !plan.valid ? /* @__PURE__ */ jsx31(
|
|
19349
19387
|
Tooltip,
|
|
19350
19388
|
{
|
|
19351
19389
|
trigger: t2("Over usage limit"),
|