@schematichq/schematic-components 1.7.0 → 1.8.0
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 +711 -577
- package/dist/schematic-components.d.ts +12 -8
- package/dist/schematic-components.esm.js +627 -493
- package/package.json +1 -1
|
@@ -1852,7 +1852,7 @@ var HOURS_IN_MS = MINUTES_IN_MS * 60;
|
|
|
1852
1852
|
var DAYS_IN_MS = HOURS_IN_MS * 24;
|
|
1853
1853
|
|
|
1854
1854
|
// src/const/debounce.ts
|
|
1855
|
-
var
|
|
1855
|
+
var LEADING_DEBOUNCE_SETTINGS = {
|
|
1856
1856
|
leading: true,
|
|
1857
1857
|
trailing: false
|
|
1858
1858
|
};
|
|
@@ -2092,6 +2092,8 @@ function getUsageDetails(entitlement, period) {
|
|
|
2092
2092
|
limit = entitlement.allocation;
|
|
2093
2093
|
} else if (entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlement.softLimit === "number") {
|
|
2094
2094
|
limit = entitlement.softLimit;
|
|
2095
|
+
} else if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && typeof entitlement.creditTotal === "number" && typeof entitlement.creditConsumptionRate === "number") {
|
|
2096
|
+
limit = entitlement.creditTotal / entitlement.creditConsumptionRate;
|
|
2095
2097
|
}
|
|
2096
2098
|
let amount;
|
|
2097
2099
|
if (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof entitlement.allocation === "number") {
|
|
@@ -2100,6 +2102,8 @@ function getUsageDetails(entitlement, period) {
|
|
|
2100
2102
|
amount = entitlement.usage;
|
|
2101
2103
|
} else if (entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlement.usage === "number" && typeof entitlement.softLimit === "number") {
|
|
2102
2104
|
amount = Math.max(0, entitlement.usage - entitlement.softLimit);
|
|
2105
|
+
} else if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && typeof entitlement.creditUsed === "number" && typeof entitlement.creditConsumptionRate === "number") {
|
|
2106
|
+
amount = entitlement.creditUsed / entitlement.creditConsumptionRate;
|
|
2103
2107
|
}
|
|
2104
2108
|
const cost = getEntitlementCost(entitlement, period);
|
|
2105
2109
|
const tiers = billingPrice?.priceTier || [];
|
|
@@ -2131,6 +2135,17 @@ function getUsageDetails(entitlement, period) {
|
|
|
2131
2135
|
}
|
|
2132
2136
|
return { billingPrice, limit, amount, cost, currentTier };
|
|
2133
2137
|
}
|
|
2138
|
+
function getCreditBasedEntitlementLimit(entitlement, credits) {
|
|
2139
|
+
const matchedCredit = credits.find(
|
|
2140
|
+
(credit) => credit.id === entitlement.valueCredit?.id
|
|
2141
|
+
);
|
|
2142
|
+
if (matchedCredit && entitlement.consumptionRate) {
|
|
2143
|
+
return {
|
|
2144
|
+
limit: Math.floor(matchedCredit.quantity / entitlement.consumptionRate),
|
|
2145
|
+
period: matchedCredit.period
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2134
2149
|
|
|
2135
2150
|
// src/utils/pluralize.ts
|
|
2136
2151
|
var pluralRules = [];
|
|
@@ -6720,6 +6735,7 @@ var en_default = {
|
|
|
6720
6735
|
"An unknown error occurred.": "An unknown error occurred.",
|
|
6721
6736
|
Billed: "Billed {{period}}",
|
|
6722
6737
|
"Cancel subscription": "Cancel subscription",
|
|
6738
|
+
"Cannot change to this plan.": "{{reason, list(style: 'long'; type: 'disjunction';)}} usage is over the limit.",
|
|
6723
6739
|
"Cannot downgrade entitlement": "Cannot downgrade to a quantity lower than current usage.",
|
|
6724
6740
|
"Card ending in": "\u{1F4B3} Card ending in {{value}}",
|
|
6725
6741
|
"Change add-on": "Change add-on",
|
|
@@ -6773,7 +6789,7 @@ var en_default = {
|
|
|
6773
6789
|
"One time ": "One time",
|
|
6774
6790
|
"Optionally add features to your subscription": "Optionally add features to your subscription",
|
|
6775
6791
|
"Other existing payment method": "Other existing payment method",
|
|
6776
|
-
"Over
|
|
6792
|
+
"Over plan limit": "Over plan limit",
|
|
6777
6793
|
"Pay-in-advance features require a quantity.": "Pay-in-advance features require a quantity.",
|
|
6778
6794
|
"Pay now": "Pay now",
|
|
6779
6795
|
"Payment Method": "Payment Method",
|
|
@@ -6828,6 +6844,8 @@ var en_default = {
|
|
|
6828
6844
|
"Unsubscribe failed": "Unsubscribe failed",
|
|
6829
6845
|
Unsubscribe: "Unsubscribe",
|
|
6830
6846
|
"Unused time": "Unused time",
|
|
6847
|
+
"Up to X units": "Up to {{amount}} {{units}}",
|
|
6848
|
+
"Up to X units per period": "Up to {{amount}} {{units}} per {{period}}",
|
|
6831
6849
|
"Up to a limit of": "Up to a limit of {{amount}} {{units}}",
|
|
6832
6850
|
"Up to X units at $Y/unit": "Up to {{X}} {{units}} at {{Y}} per {{unit}}",
|
|
6833
6851
|
"Up to X units at $Y/unit + $Z/period": "Up to {{X}} {{units}} at {{Y}} per {{unit}} plus {{Z}} per {{period}}",
|
|
@@ -7434,7 +7452,7 @@ function BillingProductResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
7434
7452
|
return {
|
|
7435
7453
|
accountId: json["account_id"],
|
|
7436
7454
|
createdAt: new Date(json["created_at"]),
|
|
7437
|
-
currency: json["currency"],
|
|
7455
|
+
currency: json["currency"] == null ? void 0 : json["currency"],
|
|
7438
7456
|
environmentId: json["environment_id"],
|
|
7439
7457
|
externalId: json["external_id"],
|
|
7440
7458
|
isActive: json["is_active"],
|
|
@@ -7582,7 +7600,7 @@ function BillingProductDetailResponseDataFromJSONTyped(json, ignoreDiscriminator
|
|
|
7582
7600
|
return {
|
|
7583
7601
|
accountId: json["account_id"],
|
|
7584
7602
|
createdAt: new Date(json["created_at"]),
|
|
7585
|
-
currency: json["currency"],
|
|
7603
|
+
currency: json["currency"] == null ? void 0 : json["currency"],
|
|
7586
7604
|
environmentId: json["environment_id"],
|
|
7587
7605
|
externalId: json["external_id"],
|
|
7588
7606
|
isActive: json["is_active"],
|
|
@@ -9824,7 +9842,7 @@ function BillingProductResponseDataFromJSONTyped4(json, ignoreDiscriminator) {
|
|
|
9824
9842
|
return {
|
|
9825
9843
|
accountId: json["account_id"],
|
|
9826
9844
|
createdAt: new Date(json["created_at"]),
|
|
9827
|
-
currency: json["currency"],
|
|
9845
|
+
currency: json["currency"] == null ? void 0 : json["currency"],
|
|
9828
9846
|
environmentId: json["environment_id"],
|
|
9829
9847
|
externalId: json["external_id"],
|
|
9830
9848
|
isActive: json["is_active"],
|
|
@@ -9944,7 +9962,7 @@ function BillingProductDetailResponseDataFromJSONTyped5(json, ignoreDiscriminato
|
|
|
9944
9962
|
return {
|
|
9945
9963
|
accountId: json["account_id"],
|
|
9946
9964
|
createdAt: new Date(json["created_at"]),
|
|
9947
|
-
currency: json["currency"],
|
|
9965
|
+
currency: json["currency"] == null ? void 0 : json["currency"],
|
|
9948
9966
|
environmentId: json["environment_id"],
|
|
9949
9967
|
externalId: json["external_id"],
|
|
9950
9968
|
isActive: json["is_active"],
|
|
@@ -10588,7 +10606,7 @@ var EmbedProvider = ({
|
|
|
10588
10606
|
});
|
|
10589
10607
|
const customHeaders = useMemo3(
|
|
10590
10608
|
() => ({
|
|
10591
|
-
"X-Schematic-Components-Version": "1.
|
|
10609
|
+
"X-Schematic-Components-Version": "1.8.0",
|
|
10592
10610
|
"X-Schematic-Session-ID": sessionIdRef.current
|
|
10593
10611
|
}),
|
|
10594
10612
|
[]
|
|
@@ -10630,7 +10648,11 @@ var EmbedProvider = ({
|
|
|
10630
10648
|
}
|
|
10631
10649
|
}, [api.public]);
|
|
10632
10650
|
const debouncedHydratePublic = useMemo3(
|
|
10633
|
-
() => (0, import_debounce.default)(
|
|
10651
|
+
() => (0, import_debounce.default)(
|
|
10652
|
+
hydratePublic,
|
|
10653
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10654
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10655
|
+
),
|
|
10634
10656
|
[hydratePublic]
|
|
10635
10657
|
);
|
|
10636
10658
|
const hydrate = useCallback3(async () => {
|
|
@@ -10652,7 +10674,7 @@ var EmbedProvider = ({
|
|
|
10652
10674
|
}
|
|
10653
10675
|
}, [api.checkout]);
|
|
10654
10676
|
const debouncedHydrate = useMemo3(
|
|
10655
|
-
() => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT,
|
|
10677
|
+
() => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
10656
10678
|
[hydrate]
|
|
10657
10679
|
);
|
|
10658
10680
|
const hydrateComponent = useCallback3(
|
|
@@ -10679,7 +10701,11 @@ var EmbedProvider = ({
|
|
|
10679
10701
|
[api.checkout]
|
|
10680
10702
|
);
|
|
10681
10703
|
const debouncedHydrateComponent = useMemo3(
|
|
10682
|
-
() => (0, import_debounce.default)(
|
|
10704
|
+
() => (0, import_debounce.default)(
|
|
10705
|
+
hydrateComponent,
|
|
10706
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10707
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10708
|
+
),
|
|
10683
10709
|
[hydrateComponent]
|
|
10684
10710
|
);
|
|
10685
10711
|
const hydrateExternal = useCallback3(async function(fn) {
|
|
@@ -10699,14 +10725,22 @@ var EmbedProvider = ({
|
|
|
10699
10725
|
}
|
|
10700
10726
|
}, []);
|
|
10701
10727
|
const debouncedHydrateExternal = useMemo3(
|
|
10702
|
-
() => (0, import_debounce.default)(
|
|
10728
|
+
() => (0, import_debounce.default)(
|
|
10729
|
+
hydrateExternal,
|
|
10730
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10731
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10732
|
+
),
|
|
10703
10733
|
[hydrateExternal]
|
|
10704
10734
|
);
|
|
10705
10735
|
const createSetupIntent = useCallback3(async () => {
|
|
10706
10736
|
return api.checkout?.createSetupIntent();
|
|
10707
10737
|
}, [api.checkout]);
|
|
10708
10738
|
const debouncedCreateSetupIntent = useMemo3(
|
|
10709
|
-
() => (0, import_debounce.default)(
|
|
10739
|
+
() => (0, import_debounce.default)(
|
|
10740
|
+
createSetupIntent,
|
|
10741
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10742
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10743
|
+
),
|
|
10710
10744
|
[createSetupIntent]
|
|
10711
10745
|
);
|
|
10712
10746
|
const updatePaymentMethod = useCallback3(
|
|
@@ -10725,7 +10759,11 @@ var EmbedProvider = ({
|
|
|
10725
10759
|
[api.checkout]
|
|
10726
10760
|
);
|
|
10727
10761
|
const debouncedUpdatePaymentMethod = useMemo3(
|
|
10728
|
-
() => (0, import_debounce.default)(
|
|
10762
|
+
() => (0, import_debounce.default)(
|
|
10763
|
+
updatePaymentMethod,
|
|
10764
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10765
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10766
|
+
),
|
|
10729
10767
|
[updatePaymentMethod]
|
|
10730
10768
|
);
|
|
10731
10769
|
const deletePaymentMethod = useCallback3(
|
|
@@ -10744,7 +10782,11 @@ var EmbedProvider = ({
|
|
|
10744
10782
|
[api.checkout]
|
|
10745
10783
|
);
|
|
10746
10784
|
const debouncedDeletePaymentMethod = useMemo3(
|
|
10747
|
-
() => (0, import_debounce.default)(
|
|
10785
|
+
() => (0, import_debounce.default)(
|
|
10786
|
+
deletePaymentMethod,
|
|
10787
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10788
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10789
|
+
),
|
|
10748
10790
|
[deletePaymentMethod]
|
|
10749
10791
|
);
|
|
10750
10792
|
const checkout = useCallback3(
|
|
@@ -10763,7 +10805,7 @@ var EmbedProvider = ({
|
|
|
10763
10805
|
[api.checkout]
|
|
10764
10806
|
);
|
|
10765
10807
|
const debouncedCheckout = useMemo3(
|
|
10766
|
-
() => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT,
|
|
10808
|
+
() => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
10767
10809
|
[checkout]
|
|
10768
10810
|
);
|
|
10769
10811
|
const previewCheckout = useCallback3(
|
|
@@ -10772,15 +10814,6 @@ var EmbedProvider = ({
|
|
|
10772
10814
|
},
|
|
10773
10815
|
[api.checkout]
|
|
10774
10816
|
);
|
|
10775
|
-
const debouncedPreviewCheckout = useMemo3(
|
|
10776
|
-
() => (0, import_debounce.default)(previewCheckout, FETCH_DEBOUNCE_TIMEOUT, {
|
|
10777
|
-
// invoke immediately for minimal latency
|
|
10778
|
-
leading: true,
|
|
10779
|
-
// but also ensure latest data is fetched
|
|
10780
|
-
trailing: true
|
|
10781
|
-
}),
|
|
10782
|
-
[previewCheckout]
|
|
10783
|
-
);
|
|
10784
10817
|
const unsubscribe = useCallback3(async () => {
|
|
10785
10818
|
const response = await api.checkout?.checkoutUnsubscribe();
|
|
10786
10819
|
if (response) {
|
|
@@ -10792,7 +10825,7 @@ var EmbedProvider = ({
|
|
|
10792
10825
|
return response;
|
|
10793
10826
|
}, [api.checkout]);
|
|
10794
10827
|
const debouncedUnsubscribe = useMemo3(
|
|
10795
|
-
() => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT,
|
|
10828
|
+
() => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
10796
10829
|
[unsubscribe]
|
|
10797
10830
|
);
|
|
10798
10831
|
const getUpcomingInvoice = useCallback3(
|
|
@@ -10804,21 +10837,29 @@ var EmbedProvider = ({
|
|
|
10804
10837
|
[api.checkout]
|
|
10805
10838
|
);
|
|
10806
10839
|
const debouncedGetUpcomingInvoice = useMemo3(
|
|
10807
|
-
() => (0, import_debounce.default)(
|
|
10840
|
+
() => (0, import_debounce.default)(
|
|
10841
|
+
getUpcomingInvoice,
|
|
10842
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10843
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10844
|
+
),
|
|
10808
10845
|
[getUpcomingInvoice]
|
|
10809
10846
|
);
|
|
10810
10847
|
const getCustomerBalance = useCallback3(async () => {
|
|
10811
10848
|
return api.checkout?.fetchCustomerBalance();
|
|
10812
10849
|
}, [api.checkout]);
|
|
10813
10850
|
const debouncedGetCustomerBalance = useMemo3(
|
|
10814
|
-
() => (0, import_debounce.default)(
|
|
10851
|
+
() => (0, import_debounce.default)(
|
|
10852
|
+
getCustomerBalance,
|
|
10853
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
10854
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
10855
|
+
),
|
|
10815
10856
|
[getCustomerBalance]
|
|
10816
10857
|
);
|
|
10817
10858
|
const listInvoices = useCallback3(async () => {
|
|
10818
10859
|
return api.checkout?.listInvoices();
|
|
10819
10860
|
}, [api.checkout]);
|
|
10820
10861
|
const debouncedListInvoices = useMemo3(
|
|
10821
|
-
() => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT,
|
|
10862
|
+
() => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
10822
10863
|
[listInvoices]
|
|
10823
10864
|
);
|
|
10824
10865
|
const setError = useCallback3(
|
|
@@ -10958,7 +10999,7 @@ var EmbedProvider = ({
|
|
|
10958
10999
|
updatePaymentMethod: debouncedUpdatePaymentMethod,
|
|
10959
11000
|
deletePaymentMethod: debouncedDeletePaymentMethod,
|
|
10960
11001
|
checkout: debouncedCheckout,
|
|
10961
|
-
previewCheckout
|
|
11002
|
+
previewCheckout,
|
|
10962
11003
|
unsubscribe: debouncedUnsubscribe,
|
|
10963
11004
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
10964
11005
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
@@ -14001,8 +14042,15 @@ var Navigation = ({
|
|
|
14001
14042
|
};
|
|
14002
14043
|
|
|
14003
14044
|
// src/components/shared/checkout-dialog/Plan.tsx
|
|
14004
|
-
import { useEffect as useEffect5, useMemo as useMemo8, useState as useState9 } from "react";
|
|
14005
|
-
|
|
14045
|
+
import { Fragment as Fragment8, useEffect as useEffect5, useMemo as useMemo8, useState as useState9 } from "react";
|
|
14046
|
+
|
|
14047
|
+
// src/components/shared/checkout-dialog/styles.ts
|
|
14048
|
+
var FlexWithAlignEnd = dt(Flex)`
|
|
14049
|
+
align-items: end;
|
|
14050
|
+
`;
|
|
14051
|
+
|
|
14052
|
+
// src/components/shared/checkout-dialog/Plan.tsx
|
|
14053
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
14006
14054
|
var Selected = ({ isCurrent = false, isTrial = false }) => {
|
|
14007
14055
|
const { t: t2 } = useTranslation();
|
|
14008
14056
|
const { settings } = useEmbed();
|
|
@@ -14042,104 +14090,96 @@ var PlanButtonGroup = ({
|
|
|
14042
14090
|
}) => {
|
|
14043
14091
|
const { t: t2 } = useTranslation();
|
|
14044
14092
|
const { data } = useEmbed();
|
|
14045
|
-
const
|
|
14093
|
+
const isTrialing = useMemo8(() => {
|
|
14094
|
+
return isCheckoutData(data) && data.subscription?.status === "trialing" || false;
|
|
14095
|
+
}, [data]);
|
|
14096
|
+
const { isCurrentPlan, isValidPlan } = useMemo8(() => {
|
|
14046
14097
|
if (isCheckoutData(data)) {
|
|
14047
14098
|
return {
|
|
14048
14099
|
isCurrentPlan: data.company?.plan?.id === plan.id,
|
|
14049
|
-
isValidPlan: isHydratedPlan(plan) && plan.valid
|
|
14050
|
-
isTrialing: data.subscription?.status === "trialing"
|
|
14100
|
+
isValidPlan: isHydratedPlan(plan) && plan.valid
|
|
14051
14101
|
};
|
|
14052
14102
|
}
|
|
14053
14103
|
return {
|
|
14054
14104
|
isCurrentPlan: false,
|
|
14055
|
-
isValidPlan: true
|
|
14056
|
-
isTrialing: false
|
|
14105
|
+
isValidPlan: true
|
|
14057
14106
|
};
|
|
14058
14107
|
}, [data, plan]);
|
|
14059
14108
|
if (isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable) {
|
|
14060
14109
|
return /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "1.5rem", children: [
|
|
14061
|
-
!isTrialing && /* @__PURE__ */ jsx19(
|
|
14062
|
-
|
|
14063
|
-
|
|
14064
|
-
|
|
14065
|
-
|
|
14066
|
-
|
|
14067
|
-
|
|
14068
|
-
|
|
14069
|
-
|
|
14070
|
-
|
|
14071
|
-
|
|
14110
|
+
!isTrialing && /* @__PURE__ */ jsx19(Fragment9, { children: isSelected && shouldTrial ? /* @__PURE__ */ jsx19(Selected, { isCurrent: isCurrentPlan, isTrial: shouldTrial }) : /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
14111
|
+
/* @__PURE__ */ jsx19(
|
|
14112
|
+
Button,
|
|
14113
|
+
{
|
|
14114
|
+
type: "button",
|
|
14115
|
+
disabled: (isLoading || !isValidPlan) && !plan.custom,
|
|
14116
|
+
...plan.custom ? {
|
|
14117
|
+
as: "a",
|
|
14118
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
14119
|
+
target: "_blank",
|
|
14120
|
+
rel: "noreferrer"
|
|
14121
|
+
} : {
|
|
14122
|
+
onClick: () => {
|
|
14123
|
+
onSelect({
|
|
14124
|
+
plan,
|
|
14125
|
+
shouldTrial: true
|
|
14126
|
+
});
|
|
14127
|
+
}
|
|
14128
|
+
},
|
|
14129
|
+
$size: "sm",
|
|
14130
|
+
$color: "primary",
|
|
14131
|
+
$variant: "filled",
|
|
14132
|
+
$fullWidth: true,
|
|
14133
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx19(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : t2("Start X day trial", { days: plan.trialDays })
|
|
14134
|
+
}
|
|
14135
|
+
),
|
|
14136
|
+
isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ jsx19(UsageViolationText, { violations: plan.usageViolations })
|
|
14137
|
+
] }) }),
|
|
14138
|
+
!plan.custom && /* @__PURE__ */ jsx19(Fragment9, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ jsx19(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
14139
|
+
/* @__PURE__ */ jsx19(
|
|
14140
|
+
Button,
|
|
14141
|
+
{
|
|
14142
|
+
type: "button",
|
|
14143
|
+
disabled: isLoading || !isValidPlan,
|
|
14072
14144
|
onClick: () => {
|
|
14073
|
-
onSelect({
|
|
14074
|
-
|
|
14075
|
-
|
|
14076
|
-
|
|
14077
|
-
|
|
14078
|
-
|
|
14079
|
-
|
|
14080
|
-
|
|
14081
|
-
|
|
14082
|
-
|
|
14083
|
-
|
|
14084
|
-
Tooltip,
|
|
14085
|
-
{
|
|
14086
|
-
trigger: /* @__PURE__ */ jsx19(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
14087
|
-
content: /* @__PURE__ */ jsx19(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
14088
|
-
}
|
|
14089
|
-
) : t2("Start X day trial", { days: plan.trialDays })
|
|
14090
|
-
}
|
|
14091
|
-
) }),
|
|
14092
|
-
!plan.custom && /* @__PURE__ */ jsx19(Fragment8, { children: isSelected && (!shouldTrial || isTrialing) ? /* @__PURE__ */ jsx19(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsx19(
|
|
14093
|
-
Button,
|
|
14094
|
-
{
|
|
14095
|
-
type: "button",
|
|
14096
|
-
disabled: isLoading || !isValidPlan,
|
|
14097
|
-
onClick: () => {
|
|
14098
|
-
onSelect({ plan, shouldTrial: false });
|
|
14099
|
-
},
|
|
14100
|
-
$size: "sm",
|
|
14101
|
-
$color: "primary",
|
|
14102
|
-
$variant: isTrialing ? "filled" : "text",
|
|
14103
|
-
$fullWidth: true,
|
|
14104
|
-
children: !isValidPlan ? /* @__PURE__ */ jsx19(
|
|
14105
|
-
Tooltip,
|
|
14106
|
-
{
|
|
14107
|
-
trigger: /* @__PURE__ */ jsx19(Text, { as: Box, $align: "center", children: t2("Over usage limit") }),
|
|
14108
|
-
content: /* @__PURE__ */ jsx19(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
14109
|
-
}
|
|
14110
|
-
) : t2("Choose plan")
|
|
14111
|
-
}
|
|
14112
|
-
) })
|
|
14145
|
+
onSelect({ plan, shouldTrial: false });
|
|
14146
|
+
},
|
|
14147
|
+
$size: "sm",
|
|
14148
|
+
$color: "primary",
|
|
14149
|
+
$variant: isTrialing ? "filled" : "text",
|
|
14150
|
+
$fullWidth: true,
|
|
14151
|
+
children: !isValidPlan ? /* @__PURE__ */ jsx19(Box, { $textAlign: "center", children: /* @__PURE__ */ jsx19(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) }) : t2("Choose plan")
|
|
14152
|
+
}
|
|
14153
|
+
),
|
|
14154
|
+
isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ jsx19(UsageViolationText, { violations: plan.usageViolations })
|
|
14155
|
+
] }) })
|
|
14113
14156
|
] });
|
|
14114
14157
|
}
|
|
14115
|
-
return isSelected ? /* @__PURE__ */ jsx19(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14133
|
-
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14139
|
-
|
|
14140
|
-
) : t2("Choose plan")
|
|
14141
|
-
}
|
|
14142
|
-
);
|
|
14158
|
+
return isSelected ? /* @__PURE__ */ jsx19(Selected, { isCurrent: isCurrentPlan }) : /* @__PURE__ */ jsxs14(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
14159
|
+
/* @__PURE__ */ jsx19(
|
|
14160
|
+
Button,
|
|
14161
|
+
{
|
|
14162
|
+
type: "button",
|
|
14163
|
+
disabled: (isLoading || !isValidPlan) && !plan.custom,
|
|
14164
|
+
...plan.custom ? {
|
|
14165
|
+
as: "a",
|
|
14166
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
14167
|
+
target: "_blank",
|
|
14168
|
+
rel: "noreferrer"
|
|
14169
|
+
} : {
|
|
14170
|
+
onClick: () => {
|
|
14171
|
+
onSelect({ plan });
|
|
14172
|
+
}
|
|
14173
|
+
},
|
|
14174
|
+
$size: "sm",
|
|
14175
|
+
$color: "primary",
|
|
14176
|
+
$variant: "filled",
|
|
14177
|
+
$fullWidth: true,
|
|
14178
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : !isValidPlan ? /* @__PURE__ */ jsx19(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : t2("Choose plan")
|
|
14179
|
+
}
|
|
14180
|
+
),
|
|
14181
|
+
isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ jsx19(UsageViolationText, { violations: plan.usageViolations })
|
|
14182
|
+
] });
|
|
14143
14183
|
};
|
|
14144
14184
|
var Plan = ({
|
|
14145
14185
|
isLoading,
|
|
@@ -14147,8 +14187,7 @@ var Plan = ({
|
|
|
14147
14187
|
selectedPlan,
|
|
14148
14188
|
period,
|
|
14149
14189
|
selectPlan,
|
|
14150
|
-
shouldTrial
|
|
14151
|
-
showPeriodToggle
|
|
14190
|
+
shouldTrial
|
|
14152
14191
|
}) => {
|
|
14153
14192
|
const { t: t2 } = useTranslation();
|
|
14154
14193
|
const { data, settings } = useEmbed();
|
|
@@ -14156,16 +14195,23 @@ var Plan = ({
|
|
|
14156
14195
|
const [entitlementCounts, setEntitlementCounts] = useState9(
|
|
14157
14196
|
() => plans.reduce(entitlementCountsReducer, {})
|
|
14158
14197
|
);
|
|
14159
|
-
const { isTrialing, showZeroPriceAsFree } = useMemo8(() => {
|
|
14198
|
+
const { isTrialing, showCredits, showPeriodToggle, showZeroPriceAsFree } = useMemo8(() => {
|
|
14199
|
+
const showCredits2 = data?.showCredits ?? true;
|
|
14200
|
+
const showPeriodToggle2 = data?.showPeriodToggle ?? true;
|
|
14201
|
+
const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
|
|
14160
14202
|
if (isCheckoutData(data)) {
|
|
14161
14203
|
return {
|
|
14162
14204
|
isTrialing: data.subscription?.status === "trialing",
|
|
14163
|
-
|
|
14205
|
+
showCredits: showCredits2,
|
|
14206
|
+
showPeriodToggle: showPeriodToggle2,
|
|
14207
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
14164
14208
|
};
|
|
14165
14209
|
}
|
|
14166
14210
|
return {
|
|
14167
14211
|
isTrialing: false,
|
|
14168
|
-
|
|
14212
|
+
showCredits: showCredits2,
|
|
14213
|
+
showPeriodToggle: showPeriodToggle2,
|
|
14214
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
14169
14215
|
};
|
|
14170
14216
|
}, [data]);
|
|
14171
14217
|
const handleToggleShowAll = (id) => {
|
|
@@ -14262,7 +14308,7 @@ var Plan = ({
|
|
|
14262
14308
|
}
|
|
14263
14309
|
)
|
|
14264
14310
|
] }),
|
|
14265
|
-
credits.length > 0 && /* @__PURE__ */ jsx19(
|
|
14311
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ jsx19(
|
|
14266
14312
|
Flex,
|
|
14267
14313
|
{
|
|
14268
14314
|
$flexDirection: "column",
|
|
@@ -14297,7 +14343,7 @@ var Plan = ({
|
|
|
14297
14343
|
credit.quantity,
|
|
14298
14344
|
" ",
|
|
14299
14345
|
getFeatureName(credit, credit.quantity),
|
|
14300
|
-
credit.period && /* @__PURE__ */ jsxs14(
|
|
14346
|
+
credit.period && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14301
14347
|
" ",
|
|
14302
14348
|
t2("per"),
|
|
14303
14349
|
" ",
|
|
@@ -14348,6 +14394,7 @@ var Plan = ({
|
|
|
14348
14394
|
plan.entitlements.map((entitlement, entitlementIndex) => {
|
|
14349
14395
|
const hasNumericValue = entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */;
|
|
14350
14396
|
const limit = entitlement.softLimit ?? entitlement.valueNumeric;
|
|
14397
|
+
const creditBasedEntitlementLimit = getCreditBasedEntitlementLimit(entitlement, credits);
|
|
14351
14398
|
const {
|
|
14352
14399
|
price: entitlementPrice,
|
|
14353
14400
|
priceTier: entitlementPriceTiers,
|
|
@@ -14355,6 +14402,7 @@ var Plan = ({
|
|
|
14355
14402
|
packageSize: entitlementPackageSize = 1
|
|
14356
14403
|
} = getEntitlementPrice(entitlement, planPeriod) || {};
|
|
14357
14404
|
const metricPeriodName = getMetricPeriodName(entitlement);
|
|
14405
|
+
const UsageDetailsContainer = entitlement.billingThreshold ? FlexWithAlignEnd : Fragment8;
|
|
14358
14406
|
return /* @__PURE__ */ jsx19(
|
|
14359
14407
|
Flex,
|
|
14360
14408
|
{
|
|
@@ -14379,7 +14427,7 @@ var Plan = ({
|
|
|
14379
14427
|
$justifyContent: "center",
|
|
14380
14428
|
$gap: "0.5rem",
|
|
14381
14429
|
children: [
|
|
14382
|
-
/* @__PURE__ */ jsx19(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs14(
|
|
14430
|
+
/* @__PURE__ */ jsx19(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14383
14431
|
formatCurrency(
|
|
14384
14432
|
entitlementPrice,
|
|
14385
14433
|
entitlementCurrency
|
|
@@ -14387,7 +14435,7 @@ var Plan = ({
|
|
|
14387
14435
|
" ",
|
|
14388
14436
|
t2("per"),
|
|
14389
14437
|
" ",
|
|
14390
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(
|
|
14438
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14391
14439
|
entitlementPackageSize,
|
|
14392
14440
|
" "
|
|
14393
14441
|
] }),
|
|
@@ -14395,7 +14443,7 @@ var Plan = ({
|
|
|
14395
14443
|
entitlement.feature,
|
|
14396
14444
|
entitlementPackageSize
|
|
14397
14445
|
),
|
|
14398
|
-
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs14(
|
|
14446
|
+
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14399
14447
|
" ",
|
|
14400
14448
|
t2("per"),
|
|
14401
14449
|
" ",
|
|
@@ -14407,7 +14455,7 @@ var Plan = ({
|
|
|
14407
14455
|
entitlement,
|
|
14408
14456
|
period: planPeriod
|
|
14409
14457
|
}
|
|
14410
|
-
) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ jsxs14(
|
|
14458
|
+
) : showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14411
14459
|
entitlement.consumptionRate,
|
|
14412
14460
|
" ",
|
|
14413
14461
|
getFeatureName(
|
|
@@ -14418,12 +14466,25 @@ var Plan = ({
|
|
|
14418
14466
|
t2("per"),
|
|
14419
14467
|
" ",
|
|
14420
14468
|
getFeatureName(entitlement.feature, 1)
|
|
14421
|
-
] }) :
|
|
14469
|
+
] }) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx19(Fragment9, { children: creditBasedEntitlementLimit?.period ? t2("Up to X units per period", {
|
|
14470
|
+
amount: creditBasedEntitlementLimit.limit,
|
|
14471
|
+
units: getFeatureName(
|
|
14472
|
+
entitlement.feature,
|
|
14473
|
+
creditBasedEntitlementLimit.limit
|
|
14474
|
+
),
|
|
14475
|
+
period: creditBasedEntitlementLimit.period
|
|
14476
|
+
}) : t2("Up to X units", {
|
|
14477
|
+
amount: creditBasedEntitlementLimit.limit,
|
|
14478
|
+
units: getFeatureName(
|
|
14479
|
+
entitlement.feature,
|
|
14480
|
+
creditBasedEntitlementLimit.limit
|
|
14481
|
+
)
|
|
14482
|
+
}) }) : hasNumericValue ? /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14422
14483
|
entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
14423
14484
|
item: getFeatureName(
|
|
14424
14485
|
entitlement.feature
|
|
14425
14486
|
)
|
|
14426
|
-
}) : typeof limit === "number" && /* @__PURE__ */ jsxs14(
|
|
14487
|
+
}) : typeof limit === "number" && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14427
14488
|
formatNumber(limit),
|
|
14428
14489
|
" ",
|
|
14429
14490
|
getFeatureName(
|
|
@@ -14431,14 +14492,14 @@ var Plan = ({
|
|
|
14431
14492
|
limit
|
|
14432
14493
|
)
|
|
14433
14494
|
] }),
|
|
14434
|
-
metricPeriodName && /* @__PURE__ */ jsxs14(
|
|
14495
|
+
metricPeriodName && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14435
14496
|
" ",
|
|
14436
14497
|
t2("per"),
|
|
14437
14498
|
" ",
|
|
14438
14499
|
t2(metricPeriodName)
|
|
14439
14500
|
] })
|
|
14440
14501
|
] }) : entitlement.feature.name }),
|
|
14441
|
-
/* @__PURE__ */ jsxs14(
|
|
14502
|
+
/* @__PURE__ */ jsxs14(UsageDetailsContainer, { children: [
|
|
14442
14503
|
entitlement.priceBehavior === "overage" /* Overage */ && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsxs14(
|
|
14443
14504
|
Text,
|
|
14444
14505
|
{
|
|
@@ -14453,7 +14514,7 @@ var Plan = ({
|
|
|
14453
14514
|
entitlementCurrency
|
|
14454
14515
|
),
|
|
14455
14516
|
"/",
|
|
14456
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(
|
|
14517
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14457
14518
|
entitlementPackageSize,
|
|
14458
14519
|
" "
|
|
14459
14520
|
] }),
|
|
@@ -14461,7 +14522,7 @@ var Plan = ({
|
|
|
14461
14522
|
entitlement.feature,
|
|
14462
14523
|
entitlementPackageSize
|
|
14463
14524
|
),
|
|
14464
|
-
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs14(
|
|
14525
|
+
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
14465
14526
|
"/",
|
|
14466
14527
|
shortenPeriod(planPeriod)
|
|
14467
14528
|
] })
|
|
@@ -14560,7 +14621,7 @@ var Plan = ({
|
|
|
14560
14621
|
};
|
|
14561
14622
|
|
|
14562
14623
|
// src/components/shared/checkout-dialog/Usage.tsx
|
|
14563
|
-
import { Fragment as
|
|
14624
|
+
import { Fragment as Fragment10, jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
14564
14625
|
var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
14565
14626
|
const { settings } = useEmbed();
|
|
14566
14627
|
const { t: t2 } = useTranslation();
|
|
@@ -14668,7 +14729,7 @@ var Usage = ({ entitlements, updateQuantity, period }) => {
|
|
|
14668
14729
|
formatCurrency(price ?? 0, currency),
|
|
14669
14730
|
/* @__PURE__ */ jsxs15("sub", { children: [
|
|
14670
14731
|
"/",
|
|
14671
|
-
packageSize > 1 && /* @__PURE__ */ jsxs15(
|
|
14732
|
+
packageSize > 1 && /* @__PURE__ */ jsxs15(Fragment10, { children: [
|
|
14672
14733
|
packageSize,
|
|
14673
14734
|
" "
|
|
14674
14735
|
] }),
|
|
@@ -14733,18 +14794,19 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
14733
14794
|
showPeriodToggle,
|
|
14734
14795
|
trialPaymentMethodRequired
|
|
14735
14796
|
} = useMemo9(() => {
|
|
14797
|
+
const showPeriodToggle2 = data?.showPeriodToggle ?? true;
|
|
14736
14798
|
if (isCheckoutData(data)) {
|
|
14737
14799
|
return {
|
|
14738
14800
|
currentPlanId: data.company?.plan?.id,
|
|
14739
14801
|
currentEntitlements: data.featureUsage ? data.featureUsage.features : [],
|
|
14740
|
-
showPeriodToggle:
|
|
14802
|
+
showPeriodToggle: showPeriodToggle2,
|
|
14741
14803
|
trialPaymentMethodRequired: data.trialPaymentMethodRequired === true
|
|
14742
14804
|
};
|
|
14743
14805
|
}
|
|
14744
14806
|
return {
|
|
14745
14807
|
currentPlanId: void 0,
|
|
14746
14808
|
currentEntitlements: [],
|
|
14747
|
-
showPeriodToggle:
|
|
14809
|
+
showPeriodToggle: showPeriodToggle2,
|
|
14748
14810
|
trialPaymentMethodRequired: false
|
|
14749
14811
|
};
|
|
14750
14812
|
}, [data]);
|
|
@@ -15347,8 +15409,7 @@ var CheckoutDialog = ({ top = 0 }) => {
|
|
|
15347
15409
|
plans: availablePlans,
|
|
15348
15410
|
selectedPlan,
|
|
15349
15411
|
selectPlan,
|
|
15350
|
-
shouldTrial
|
|
15351
|
-
showPeriodToggle
|
|
15412
|
+
shouldTrial
|
|
15352
15413
|
}
|
|
15353
15414
|
) : checkoutStage === "usage" ? /* @__PURE__ */ jsx21(
|
|
15354
15415
|
Usage,
|
|
@@ -15726,7 +15787,7 @@ import { useMemo as useMemo12 } from "react";
|
|
|
15726
15787
|
|
|
15727
15788
|
// src/components/shared/pricing-tiers-tooltip/PriceText.tsx
|
|
15728
15789
|
import { useMemo as useMemo11 } from "react";
|
|
15729
|
-
import { Fragment as
|
|
15790
|
+
import { Fragment as Fragment11, jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
15730
15791
|
var PriceText = ({
|
|
15731
15792
|
feature,
|
|
15732
15793
|
period,
|
|
@@ -15737,7 +15798,7 @@ var PriceText = ({
|
|
|
15737
15798
|
const { settings } = useEmbed();
|
|
15738
15799
|
const text = useMemo11(() => {
|
|
15739
15800
|
if (!flatAmount && perUnitPrice) {
|
|
15740
|
-
return /* @__PURE__ */ jsxs19(
|
|
15801
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
15741
15802
|
formatCurrency(perUnitPrice, currency),
|
|
15742
15803
|
/* @__PURE__ */ jsxs19("sub", { children: [
|
|
15743
15804
|
"/",
|
|
@@ -15746,7 +15807,7 @@ var PriceText = ({
|
|
|
15746
15807
|
] });
|
|
15747
15808
|
}
|
|
15748
15809
|
if (flatAmount && !perUnitPrice) {
|
|
15749
|
-
return /* @__PURE__ */ jsxs19(
|
|
15810
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
15750
15811
|
formatCurrency(flatAmount, currency),
|
|
15751
15812
|
period && /* @__PURE__ */ jsxs19("sub", { children: [
|
|
15752
15813
|
"/",
|
|
@@ -15754,7 +15815,7 @@ var PriceText = ({
|
|
|
15754
15815
|
] })
|
|
15755
15816
|
] });
|
|
15756
15817
|
}
|
|
15757
|
-
return /* @__PURE__ */ jsxs19(
|
|
15818
|
+
return /* @__PURE__ */ jsxs19(Fragment11, { children: [
|
|
15758
15819
|
formatCurrency(perUnitPrice, currency),
|
|
15759
15820
|
/* @__PURE__ */ jsxs19("sub", { children: [
|
|
15760
15821
|
"/",
|
|
@@ -15772,7 +15833,7 @@ var PriceText = ({
|
|
|
15772
15833
|
};
|
|
15773
15834
|
|
|
15774
15835
|
// src/components/shared/pricing-tiers-tooltip/PricingTiersTooltip.tsx
|
|
15775
|
-
import { Fragment as
|
|
15836
|
+
import { Fragment as Fragment12, jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
15776
15837
|
var PricingTiersTooltip = ({
|
|
15777
15838
|
feature,
|
|
15778
15839
|
period,
|
|
@@ -15829,7 +15890,7 @@ var PricingTiersTooltip = ({
|
|
|
15829
15890
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
15830
15891
|
children: [
|
|
15831
15892
|
tier.from,
|
|
15832
|
-
tier.from !== tier.to && /* @__PURE__ */ jsx26(
|
|
15893
|
+
tier.from !== tier.to && /* @__PURE__ */ jsx26(Fragment12, { children: tier.to === Infinity ? "+" : `\u2013${tier.to}` })
|
|
15833
15894
|
]
|
|
15834
15895
|
}
|
|
15835
15896
|
) }),
|
|
@@ -15848,7 +15909,7 @@ var PricingTiersTooltip = ({
|
|
|
15848
15909
|
index
|
|
15849
15910
|
);
|
|
15850
15911
|
}) }),
|
|
15851
|
-
(tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ jsxs20(
|
|
15912
|
+
(tiersMode === "volume" /* Volume */ || tiersMode === "graduated" /* Graduated */) && /* @__PURE__ */ jsxs20(Fragment12, { children: [
|
|
15852
15913
|
/* @__PURE__ */ jsx26(
|
|
15853
15914
|
"hr",
|
|
15854
15915
|
{
|
|
@@ -16050,8 +16111,31 @@ var UnsubscribeDialog = ({ top = 0 }) => {
|
|
|
16050
16111
|
] });
|
|
16051
16112
|
};
|
|
16052
16113
|
|
|
16114
|
+
// src/components/shared/usage-violation-text/UsageViolationText.tsx
|
|
16115
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
16116
|
+
var UsageViolationText = ({ violations }) => {
|
|
16117
|
+
const { t: t2 } = useTranslation();
|
|
16118
|
+
const { settings } = useEmbed();
|
|
16119
|
+
return /* @__PURE__ */ jsx28(
|
|
16120
|
+
Text,
|
|
16121
|
+
{
|
|
16122
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
16123
|
+
$leading: 1.35,
|
|
16124
|
+
style: { opacity: 0.625 },
|
|
16125
|
+
children: t2("Cannot change to this plan.", {
|
|
16126
|
+
reason: violations.reduce((acc, violation) => {
|
|
16127
|
+
if (violation.feature) {
|
|
16128
|
+
acc.push(violation.feature.name);
|
|
16129
|
+
}
|
|
16130
|
+
return acc;
|
|
16131
|
+
}, [])
|
|
16132
|
+
})
|
|
16133
|
+
}
|
|
16134
|
+
);
|
|
16135
|
+
};
|
|
16136
|
+
|
|
16053
16137
|
// src/components/ui/badge/Badge.tsx
|
|
16054
|
-
import { jsx as
|
|
16138
|
+
import { jsx as jsx29, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
16055
16139
|
var Badge = () => {
|
|
16056
16140
|
const { t: t2 } = useTranslation();
|
|
16057
16141
|
const { settings } = useEmbed();
|
|
@@ -16073,77 +16157,77 @@ var Badge = () => {
|
|
|
16073
16157
|
" "
|
|
16074
16158
|
] }),
|
|
16075
16159
|
/* @__PURE__ */ jsxs22("svg", { viewBox: "0 0 86 16", width: 86, height: 16, children: [
|
|
16076
|
-
/* @__PURE__ */
|
|
16160
|
+
/* @__PURE__ */ jsx29(
|
|
16077
16161
|
"path",
|
|
16078
16162
|
{
|
|
16079
16163
|
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",
|
|
16080
16164
|
fill: "currentColor"
|
|
16081
16165
|
}
|
|
16082
16166
|
),
|
|
16083
|
-
/* @__PURE__ */
|
|
16167
|
+
/* @__PURE__ */ jsx29(
|
|
16084
16168
|
"path",
|
|
16085
16169
|
{
|
|
16086
16170
|
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",
|
|
16087
16171
|
fill: "currentColor"
|
|
16088
16172
|
}
|
|
16089
16173
|
),
|
|
16090
|
-
/* @__PURE__ */
|
|
16174
|
+
/* @__PURE__ */ jsx29(
|
|
16091
16175
|
"path",
|
|
16092
16176
|
{
|
|
16093
16177
|
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",
|
|
16094
16178
|
fill: "currentColor"
|
|
16095
16179
|
}
|
|
16096
16180
|
),
|
|
16097
|
-
/* @__PURE__ */
|
|
16181
|
+
/* @__PURE__ */ jsx29(
|
|
16098
16182
|
"path",
|
|
16099
16183
|
{
|
|
16100
16184
|
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",
|
|
16101
16185
|
fill: "currentColor"
|
|
16102
16186
|
}
|
|
16103
16187
|
),
|
|
16104
|
-
/* @__PURE__ */
|
|
16188
|
+
/* @__PURE__ */ jsx29(
|
|
16105
16189
|
"path",
|
|
16106
16190
|
{
|
|
16107
16191
|
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",
|
|
16108
16192
|
fill: "currentColor"
|
|
16109
16193
|
}
|
|
16110
16194
|
),
|
|
16111
|
-
/* @__PURE__ */
|
|
16195
|
+
/* @__PURE__ */ jsx29(
|
|
16112
16196
|
"path",
|
|
16113
16197
|
{
|
|
16114
16198
|
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",
|
|
16115
16199
|
fill: "currentColor"
|
|
16116
16200
|
}
|
|
16117
16201
|
),
|
|
16118
|
-
/* @__PURE__ */
|
|
16202
|
+
/* @__PURE__ */ jsx29(
|
|
16119
16203
|
"path",
|
|
16120
16204
|
{
|
|
16121
16205
|
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",
|
|
16122
16206
|
fill: "currentColor"
|
|
16123
16207
|
}
|
|
16124
16208
|
),
|
|
16125
|
-
/* @__PURE__ */
|
|
16209
|
+
/* @__PURE__ */ jsx29(
|
|
16126
16210
|
"path",
|
|
16127
16211
|
{
|
|
16128
16212
|
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",
|
|
16129
16213
|
fill: "currentColor"
|
|
16130
16214
|
}
|
|
16131
16215
|
),
|
|
16132
|
-
/* @__PURE__ */
|
|
16216
|
+
/* @__PURE__ */ jsx29(
|
|
16133
16217
|
"path",
|
|
16134
16218
|
{
|
|
16135
16219
|
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",
|
|
16136
16220
|
fill: "currentColor"
|
|
16137
16221
|
}
|
|
16138
16222
|
),
|
|
16139
|
-
/* @__PURE__ */
|
|
16223
|
+
/* @__PURE__ */ jsx29(
|
|
16140
16224
|
"path",
|
|
16141
16225
|
{
|
|
16142
16226
|
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",
|
|
16143
16227
|
fill: "currentColor"
|
|
16144
16228
|
}
|
|
16145
16229
|
),
|
|
16146
|
-
/* @__PURE__ */
|
|
16230
|
+
/* @__PURE__ */ jsx29(
|
|
16147
16231
|
"path",
|
|
16148
16232
|
{
|
|
16149
16233
|
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",
|
|
@@ -16157,9 +16241,9 @@ var Badge = () => {
|
|
|
16157
16241
|
};
|
|
16158
16242
|
|
|
16159
16243
|
// src/components/layout/RenderLayout.tsx
|
|
16160
|
-
import { jsx as
|
|
16244
|
+
import { jsx as jsx30, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
16161
16245
|
var Disabled = () => {
|
|
16162
|
-
return /* @__PURE__ */
|
|
16246
|
+
return /* @__PURE__ */ jsx30(Box, { $width: "max-content", $height: "max-content", $margin: "0 auto", children: /* @__PURE__ */ jsx30(Card, { children: /* @__PURE__ */ jsxs23(
|
|
16163
16247
|
Element,
|
|
16164
16248
|
{
|
|
16165
16249
|
as: Flex,
|
|
@@ -16168,8 +16252,8 @@ var Disabled = () => {
|
|
|
16168
16252
|
$alignItems: "center",
|
|
16169
16253
|
$whiteSpace: "nowrap",
|
|
16170
16254
|
children: [
|
|
16171
|
-
/* @__PURE__ */
|
|
16172
|
-
/* @__PURE__ */
|
|
16255
|
+
/* @__PURE__ */ jsx30(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx30(Text, { as: "h1", display: "heading1", children: "Portal not found" }) }),
|
|
16256
|
+
/* @__PURE__ */ jsx30(Text, { as: "p", children: "Please try again later." })
|
|
16173
16257
|
]
|
|
16174
16258
|
}
|
|
16175
16259
|
) }) });
|
|
@@ -16178,7 +16262,7 @@ var RenderLayout = ({ children }) => {
|
|
|
16178
16262
|
const { layout } = useEmbed();
|
|
16179
16263
|
switch (layout) {
|
|
16180
16264
|
case "disabled":
|
|
16181
|
-
return /* @__PURE__ */
|
|
16265
|
+
return /* @__PURE__ */ jsx30(Disabled, {});
|
|
16182
16266
|
default:
|
|
16183
16267
|
return children;
|
|
16184
16268
|
}
|
|
@@ -16203,7 +16287,7 @@ var StyledViewport = dt.div.withConfig({
|
|
|
16203
16287
|
`;
|
|
16204
16288
|
|
|
16205
16289
|
// src/components/layout/viewport/Viewport.tsx
|
|
16206
|
-
import { Fragment as
|
|
16290
|
+
import { Fragment as Fragment13, jsx as jsx31, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
16207
16291
|
var Viewport = forwardRef5(
|
|
16208
16292
|
({ children, portal, ...props }, ref) => {
|
|
16209
16293
|
const { data, layout, settings } = useEmbed();
|
|
@@ -16229,24 +16313,24 @@ var Viewport = forwardRef5(
|
|
|
16229
16313
|
parent.style.overflow = "";
|
|
16230
16314
|
};
|
|
16231
16315
|
}, [portal, layout]);
|
|
16232
|
-
return /* @__PURE__ */ jsxs24(
|
|
16316
|
+
return /* @__PURE__ */ jsxs24(Fragment13, { children: [
|
|
16233
16317
|
/* @__PURE__ */ jsxs24(StyledViewport, { ref, ...props, children: [
|
|
16234
|
-
/* @__PURE__ */
|
|
16235
|
-
isBadgeVisible && /* @__PURE__ */
|
|
16318
|
+
/* @__PURE__ */ jsx31(RenderLayout, { children }),
|
|
16319
|
+
isBadgeVisible && /* @__PURE__ */ jsx31(Badge, {})
|
|
16236
16320
|
] }),
|
|
16237
|
-
canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */
|
|
16321
|
+
canCheckout && layout === "checkout" && createPortal2(/* @__PURE__ */ jsx31(CheckoutDialog, { top }), portal || document.body),
|
|
16238
16322
|
layout === "unsubscribe" && createPortal2(
|
|
16239
|
-
/* @__PURE__ */
|
|
16323
|
+
/* @__PURE__ */ jsx31(UnsubscribeDialog, { top }),
|
|
16240
16324
|
portal || document.body
|
|
16241
16325
|
),
|
|
16242
|
-
layout === "payment" && createPortal2(/* @__PURE__ */
|
|
16326
|
+
layout === "payment" && createPortal2(/* @__PURE__ */ jsx31(PaymentDialog, { top }), portal || document.body)
|
|
16243
16327
|
] });
|
|
16244
16328
|
}
|
|
16245
16329
|
);
|
|
16246
16330
|
Viewport.displayName = "Viewport";
|
|
16247
16331
|
|
|
16248
16332
|
// src/components/elements/button/Button.tsx
|
|
16249
|
-
import { jsx as
|
|
16333
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
16250
16334
|
var resolveDesignProps = (props) => {
|
|
16251
16335
|
return {
|
|
16252
16336
|
button: {
|
|
@@ -16277,7 +16361,7 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
|
|
|
16277
16361
|
variant: "text"
|
|
16278
16362
|
}
|
|
16279
16363
|
};
|
|
16280
|
-
return /* @__PURE__ */
|
|
16364
|
+
return /* @__PURE__ */ jsx32(
|
|
16281
16365
|
Element,
|
|
16282
16366
|
{
|
|
16283
16367
|
as: Flex,
|
|
@@ -16285,7 +16369,7 @@ var ButtonElement = forwardRef6(({ children, className, ...rest }, ref) => {
|
|
|
16285
16369
|
className,
|
|
16286
16370
|
$flexDirection: "column",
|
|
16287
16371
|
$gap: "2rem",
|
|
16288
|
-
children: /* @__PURE__ */
|
|
16372
|
+
children: /* @__PURE__ */ jsx32(
|
|
16289
16373
|
Button,
|
|
16290
16374
|
{
|
|
16291
16375
|
as: "a",
|
|
@@ -16309,8 +16393,8 @@ ButtonElement.displayName = "Button";
|
|
|
16309
16393
|
import { forwardRef as forwardRef7, useMemo as useMemo17, useRef as useRef10, useState as useState14 } from "react";
|
|
16310
16394
|
|
|
16311
16395
|
// src/components/elements/included-features/UsageDetails.tsx
|
|
16312
|
-
import { Fragment as
|
|
16313
|
-
import { Fragment as
|
|
16396
|
+
import { Fragment as Fragment14, useMemo as useMemo16 } from "react";
|
|
16397
|
+
import { Fragment as Fragment15, jsx as jsx33, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
16314
16398
|
var UsageDetails = ({
|
|
16315
16399
|
entitlement,
|
|
16316
16400
|
shouldWrapChildren,
|
|
@@ -16328,8 +16412,18 @@ var UsageDetails = ({
|
|
|
16328
16412
|
} = entitlement;
|
|
16329
16413
|
const { t: t2 } = useTranslation();
|
|
16330
16414
|
const { data } = useEmbed();
|
|
16331
|
-
const period = useMemo16(() => {
|
|
16332
|
-
|
|
16415
|
+
const { period, showCredits } = useMemo16(() => {
|
|
16416
|
+
const showCredits2 = data?.showCredits ?? true;
|
|
16417
|
+
if (isCheckoutData(data)) {
|
|
16418
|
+
return {
|
|
16419
|
+
period: data.company?.plan?.planPeriod || void 0,
|
|
16420
|
+
showCredits: showCredits2
|
|
16421
|
+
};
|
|
16422
|
+
}
|
|
16423
|
+
return {
|
|
16424
|
+
period: void 0,
|
|
16425
|
+
showCredits: showCredits2
|
|
16426
|
+
};
|
|
16333
16427
|
}, [data]);
|
|
16334
16428
|
const { billingPrice, cost, currentTier } = useMemo16(
|
|
16335
16429
|
() => getUsageDetails(entitlement, period),
|
|
@@ -16341,19 +16435,19 @@ var UsageDetails = ({
|
|
|
16341
16435
|
}
|
|
16342
16436
|
const { price, currency, packageSize = 1 } = billingPrice || {};
|
|
16343
16437
|
if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof allocation === "number") {
|
|
16344
|
-
return /* @__PURE__ */ jsxs25(
|
|
16438
|
+
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16345
16439
|
formatNumber(allocation),
|
|
16346
16440
|
" ",
|
|
16347
16441
|
getFeatureName(feature, allocation)
|
|
16348
16442
|
] });
|
|
16349
16443
|
}
|
|
16350
16444
|
if (priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof price === "number") {
|
|
16351
|
-
return /* @__PURE__ */ jsxs25(
|
|
16445
|
+
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16352
16446
|
formatCurrency(price, currency),
|
|
16353
16447
|
" ",
|
|
16354
16448
|
t2("per"),
|
|
16355
16449
|
" ",
|
|
16356
|
-
packageSize > 1 && /* @__PURE__ */ jsxs25(
|
|
16450
|
+
packageSize > 1 && /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16357
16451
|
packageSize,
|
|
16358
16452
|
" "
|
|
16359
16453
|
] }),
|
|
@@ -16361,22 +16455,22 @@ var UsageDetails = ({
|
|
|
16361
16455
|
] });
|
|
16362
16456
|
}
|
|
16363
16457
|
if (priceBehavior === "overage" /* Overage */ && typeof softLimit === "number") {
|
|
16364
|
-
return /* @__PURE__ */ jsxs25(
|
|
16458
|
+
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16365
16459
|
formatNumber(softLimit),
|
|
16366
16460
|
" ",
|
|
16367
16461
|
getFeatureName(feature, softLimit)
|
|
16368
16462
|
] });
|
|
16369
16463
|
}
|
|
16370
16464
|
if (priceBehavior === "tier" /* Tiered */) {
|
|
16371
|
-
return /* @__PURE__ */
|
|
16465
|
+
return /* @__PURE__ */ jsx33(Fragment15, { children: typeof currentTier?.to === "number" && (currentTier?.to === Infinity ? t2("Unlimited in this tier", {
|
|
16372
16466
|
feature: getFeatureName(feature)
|
|
16373
16467
|
}) : t2("Up to X units in this tier", {
|
|
16374
16468
|
amount: formatNumber(currentTier.to),
|
|
16375
16469
|
feature: getFeatureName(feature, currentTier?.to)
|
|
16376
16470
|
})) });
|
|
16377
16471
|
}
|
|
16378
|
-
if (priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
|
|
16379
|
-
return /* @__PURE__ */ jsxs25(
|
|
16472
|
+
if (showCredits && priceBehavior === "credit_burndown" /* Credit */ && planEntitlement?.valueCredit && typeof planEntitlement?.consumptionRate === "number") {
|
|
16473
|
+
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16380
16474
|
planEntitlement.consumptionRate,
|
|
16381
16475
|
" ",
|
|
16382
16476
|
getFeatureName(
|
|
@@ -16390,7 +16484,7 @@ var UsageDetails = ({
|
|
|
16390
16484
|
] });
|
|
16391
16485
|
}
|
|
16392
16486
|
if (!priceBehavior && typeof allocation === "number") {
|
|
16393
|
-
return /* @__PURE__ */ jsxs25(
|
|
16487
|
+
return /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16394
16488
|
formatNumber(allocation),
|
|
16395
16489
|
" ",
|
|
16396
16490
|
getFeatureName(feature, allocation)
|
|
@@ -16408,7 +16502,8 @@ var UsageDetails = ({
|
|
|
16408
16502
|
priceBehavior,
|
|
16409
16503
|
softLimit,
|
|
16410
16504
|
billingPrice,
|
|
16411
|
-
currentTier?.to
|
|
16505
|
+
currentTier?.to,
|
|
16506
|
+
showCredits
|
|
16412
16507
|
]);
|
|
16413
16508
|
const usageText = useMemo16(() => {
|
|
16414
16509
|
if (!feature) {
|
|
@@ -16419,10 +16514,10 @@ var UsageDetails = ({
|
|
|
16419
16514
|
let index = 0;
|
|
16420
16515
|
if (priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof period === "string" && typeof price === "number") {
|
|
16421
16516
|
acc.push(
|
|
16422
|
-
/* @__PURE__ */ jsxs25(
|
|
16517
|
+
/* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
16423
16518
|
formatCurrency(price, currency),
|
|
16424
16519
|
"/",
|
|
16425
|
-
packageSize > 1 && /* @__PURE__ */ jsxs25(
|
|
16520
|
+
packageSize > 1 && /* @__PURE__ */ jsxs25(Fragment15, { children: [
|
|
16426
16521
|
packageSize,
|
|
16427
16522
|
" "
|
|
16428
16523
|
] }),
|
|
@@ -16434,7 +16529,7 @@ var UsageDetails = ({
|
|
|
16434
16529
|
index += 1;
|
|
16435
16530
|
} else if ((priceBehavior === "pay_as_you_go" /* PayAsYouGo */ || priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */ || priceBehavior === "credit_burndown" /* Credit */) && typeof usage === "number") {
|
|
16436
16531
|
acc.push(
|
|
16437
|
-
/* @__PURE__ */ jsxs25(
|
|
16532
|
+
/* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
16438
16533
|
usage,
|
|
16439
16534
|
" ",
|
|
16440
16535
|
getFeatureName(feature, usage),
|
|
@@ -16446,14 +16541,14 @@ var UsageDetails = ({
|
|
|
16446
16541
|
}
|
|
16447
16542
|
if (typeof cost === "number" && cost > 0) {
|
|
16448
16543
|
acc.push(
|
|
16449
|
-
/* @__PURE__ */ jsxs25(
|
|
16450
|
-
acc.length > 0 && /* @__PURE__ */
|
|
16544
|
+
/* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
16545
|
+
acc.length > 0 && /* @__PURE__ */ jsx33(Fragment15, { children: " \u2022 " }),
|
|
16451
16546
|
formatCurrency(cost, currency)
|
|
16452
16547
|
] }, index)
|
|
16453
16548
|
);
|
|
16454
16549
|
index += 1;
|
|
16455
16550
|
if (feature.featureType === "trait" /* Trait */ && typeof period === "string") {
|
|
16456
|
-
acc.push(/* @__PURE__ */ jsxs25(
|
|
16551
|
+
acc.push(/* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
16457
16552
|
"/",
|
|
16458
16553
|
shortenPeriod(period)
|
|
16459
16554
|
] }, index));
|
|
@@ -16462,8 +16557,8 @@ var UsageDetails = ({
|
|
|
16462
16557
|
}
|
|
16463
16558
|
if (metricResetAt) {
|
|
16464
16559
|
acc.push(
|
|
16465
|
-
/* @__PURE__ */ jsxs25(
|
|
16466
|
-
acc.length > 0 && /* @__PURE__ */
|
|
16560
|
+
/* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
16561
|
+
acc.length > 0 && /* @__PURE__ */ jsx33(Fragment15, { children: " \u2022 " }),
|
|
16467
16562
|
t2("Resets", {
|
|
16468
16563
|
date: toPrettyDate(metricResetAt, {
|
|
16469
16564
|
month: "numeric",
|
|
@@ -16497,7 +16592,7 @@ var UsageDetails = ({
|
|
|
16497
16592
|
billingPrice,
|
|
16498
16593
|
cost
|
|
16499
16594
|
]);
|
|
16500
|
-
if (!text || !feature
|
|
16595
|
+
if (!text && !usageText || !feature) {
|
|
16501
16596
|
return null;
|
|
16502
16597
|
}
|
|
16503
16598
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -16507,10 +16602,10 @@ var UsageDetails = ({
|
|
|
16507
16602
|
$flexGrow: "1",
|
|
16508
16603
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
16509
16604
|
children: [
|
|
16510
|
-
layout.entitlement.isVisible && /* @__PURE__ */
|
|
16605
|
+
layout.entitlement.isVisible && /* @__PURE__ */ jsx33(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx33(Text, { display: layout.entitlement.fontStyle, $leading: 1, children: text }) }),
|
|
16511
16606
|
layout.usage.isVisible && usageText && /* @__PURE__ */ jsxs25(Flex, { $justifyContent: "end", $alignItems: "end", $whiteSpace: "nowrap", children: [
|
|
16512
|
-
/* @__PURE__ */
|
|
16513
|
-
priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */
|
|
16607
|
+
/* @__PURE__ */ jsx33(Text, { display: layout.usage.fontStyle, $leading: 1, children: usageText }),
|
|
16608
|
+
priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx33(
|
|
16514
16609
|
PricingTiersTooltip,
|
|
16515
16610
|
{
|
|
16516
16611
|
feature,
|
|
@@ -16526,7 +16621,7 @@ var UsageDetails = ({
|
|
|
16526
16621
|
};
|
|
16527
16622
|
|
|
16528
16623
|
// src/components/elements/included-features/IncludedFeatures.tsx
|
|
16529
|
-
import { jsx as
|
|
16624
|
+
import { jsx as jsx34, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
16530
16625
|
function resolveDesignProps2(props) {
|
|
16531
16626
|
return {
|
|
16532
16627
|
header: {
|
|
@@ -16610,7 +16705,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16610
16705
|
$flexDirection: "column",
|
|
16611
16706
|
$gap: "1rem",
|
|
16612
16707
|
children: [
|
|
16613
|
-
props.header.isVisible && /* @__PURE__ */
|
|
16708
|
+
props.header.isVisible && /* @__PURE__ */ jsx34(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx34(Text, { display: props.header.fontStyle, children: props.header.text }) }),
|
|
16614
16709
|
featureUsage.slice(0, showCount).map((entitlement, index) => {
|
|
16615
16710
|
const shouldShowDetails = entitlement.feature?.name && (entitlement.feature?.featureType === "event" /* Event */ || entitlement.feature?.featureType === "trait" /* Trait */);
|
|
16616
16711
|
return /* @__PURE__ */ jsxs26(
|
|
@@ -16634,7 +16729,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16634
16729
|
$flexBasis: "min-content",
|
|
16635
16730
|
$gap: "1rem",
|
|
16636
16731
|
children: [
|
|
16637
|
-
props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */
|
|
16732
|
+
props.icons.isVisible && entitlement.feature?.icon && /* @__PURE__ */ jsx34(
|
|
16638
16733
|
Icon3,
|
|
16639
16734
|
{
|
|
16640
16735
|
name: entitlement.feature.icon,
|
|
@@ -16643,7 +16738,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16643
16738
|
rounded: true
|
|
16644
16739
|
}
|
|
16645
16740
|
),
|
|
16646
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
16741
|
+
entitlement.feature?.name && /* @__PURE__ */ jsx34(Text, { display: props.icons.fontStyle, children: entitlement.feature.name }),
|
|
16647
16742
|
props.entitlementExpiration.isVisible && entitlement.entitlementExpirationDate && /* @__PURE__ */ jsxs26(
|
|
16648
16743
|
Text,
|
|
16649
16744
|
{
|
|
@@ -16661,7 +16756,7 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16661
16756
|
]
|
|
16662
16757
|
}
|
|
16663
16758
|
),
|
|
16664
|
-
shouldShowDetails && /* @__PURE__ */
|
|
16759
|
+
shouldShowDetails && /* @__PURE__ */ jsx34(
|
|
16665
16760
|
UsageDetails,
|
|
16666
16761
|
{
|
|
16667
16762
|
entitlement,
|
|
@@ -16675,14 +16770,14 @@ var IncludedFeatures = forwardRef7(({ className, ...rest }, ref) => {
|
|
|
16675
16770
|
);
|
|
16676
16771
|
}),
|
|
16677
16772
|
shouldShowExpand && /* @__PURE__ */ jsxs26(Flex, { $alignItems: "center", $justifyContent: "start", $marginTop: "1rem", children: [
|
|
16678
|
-
/* @__PURE__ */
|
|
16773
|
+
/* @__PURE__ */ jsx34(
|
|
16679
16774
|
Icon3,
|
|
16680
16775
|
{
|
|
16681
16776
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
16682
16777
|
color: "#D0D0D0"
|
|
16683
16778
|
}
|
|
16684
16779
|
),
|
|
16685
|
-
/* @__PURE__ */
|
|
16780
|
+
/* @__PURE__ */ jsx34(
|
|
16686
16781
|
Text,
|
|
16687
16782
|
{
|
|
16688
16783
|
onClick: handleToggleShowAll,
|
|
@@ -16700,7 +16795,7 @@ IncludedFeatures.displayName = "IncludedFeatures";
|
|
|
16700
16795
|
|
|
16701
16796
|
// src/components/elements/invoices/Invoices.tsx
|
|
16702
16797
|
import { forwardRef as forwardRef8, useCallback as useCallback11, useEffect as useEffect7, useState as useState15 } from "react";
|
|
16703
|
-
import { Fragment as
|
|
16798
|
+
import { Fragment as Fragment16, jsx as jsx35, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
16704
16799
|
function resolveDesignProps3(props) {
|
|
16705
16800
|
return {
|
|
16706
16801
|
header: {
|
|
@@ -16771,7 +16866,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16771
16866
|
return null;
|
|
16772
16867
|
}
|
|
16773
16868
|
return /* @__PURE__ */ jsxs27(Element, { ref, className, children: [
|
|
16774
|
-
/* @__PURE__ */
|
|
16869
|
+
/* @__PURE__ */ jsx35(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx35(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
16775
16870
|
error ? /* @__PURE__ */ jsxs27(
|
|
16776
16871
|
Flex,
|
|
16777
16872
|
{
|
|
@@ -16781,8 +16876,8 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16781
16876
|
$alignItems: "center",
|
|
16782
16877
|
$gap: "1rem",
|
|
16783
16878
|
children: [
|
|
16784
|
-
/* @__PURE__ */
|
|
16785
|
-
/* @__PURE__ */
|
|
16879
|
+
/* @__PURE__ */ jsx35(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your invoices.") }),
|
|
16880
|
+
/* @__PURE__ */ jsx35(
|
|
16786
16881
|
Button,
|
|
16787
16882
|
{
|
|
16788
16883
|
type: "button",
|
|
@@ -16795,12 +16890,12 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16795
16890
|
)
|
|
16796
16891
|
]
|
|
16797
16892
|
}
|
|
16798
|
-
) : !isLoading && /* @__PURE__ */
|
|
16799
|
-
props.header.isVisible && /* @__PURE__ */
|
|
16800
|
-
invoices.length > 0 ? /* @__PURE__ */ jsxs27(
|
|
16801
|
-
/* @__PURE__ */
|
|
16893
|
+
) : !isLoading && /* @__PURE__ */ jsx35(TransitionBox, { children: /* @__PURE__ */ jsxs27(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
16894
|
+
props.header.isVisible && /* @__PURE__ */ jsx35(Flex, { $justifyContent: "space-between", $alignItems: "center", children: /* @__PURE__ */ jsx35(Text, { display: props.header.fontStyle, children: t2("Invoices") }) }),
|
|
16895
|
+
invoices.length > 0 ? /* @__PURE__ */ jsxs27(Fragment16, { children: [
|
|
16896
|
+
/* @__PURE__ */ jsx35(Flex, { $flexDirection: "column", $gap: "0.5rem", children: invoices.slice(0, listSize).map(({ date, amount, url }, index) => {
|
|
16802
16897
|
return /* @__PURE__ */ jsxs27(Flex, { $justifyContent: "space-between", children: [
|
|
16803
|
-
props.date.isVisible && /* @__PURE__ */
|
|
16898
|
+
props.date.isVisible && /* @__PURE__ */ jsx35(
|
|
16804
16899
|
Text,
|
|
16805
16900
|
{
|
|
16806
16901
|
display: props.date.fontStyle,
|
|
@@ -16814,18 +16909,18 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16814
16909
|
children: date
|
|
16815
16910
|
}
|
|
16816
16911
|
),
|
|
16817
|
-
props.amount.isVisible && /* @__PURE__ */
|
|
16912
|
+
props.amount.isVisible && /* @__PURE__ */ jsx35(Text, { display: props.amount.fontStyle, children: amount })
|
|
16818
16913
|
] }, index);
|
|
16819
16914
|
}) }),
|
|
16820
16915
|
props.collapse.isVisible && invoices.length > props.limit.number && /* @__PURE__ */ jsxs27(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
16821
|
-
/* @__PURE__ */
|
|
16916
|
+
/* @__PURE__ */ jsx35(
|
|
16822
16917
|
Icon3,
|
|
16823
16918
|
{
|
|
16824
16919
|
name: `chevron-${listSize === props.limit.number ? "down" : "up"}`,
|
|
16825
16920
|
color: "#D0D0D0"
|
|
16826
16921
|
}
|
|
16827
16922
|
),
|
|
16828
|
-
/* @__PURE__ */
|
|
16923
|
+
/* @__PURE__ */ jsx35(
|
|
16829
16924
|
Text,
|
|
16830
16925
|
{
|
|
16831
16926
|
onClick: toggleListSize,
|
|
@@ -16837,7 +16932,7 @@ var Invoices = forwardRef8(({ className, data, ...rest }, ref) => {
|
|
|
16837
16932
|
}
|
|
16838
16933
|
)
|
|
16839
16934
|
] })
|
|
16840
|
-
] }) : /* @__PURE__ */
|
|
16935
|
+
] }) : /* @__PURE__ */ jsx35(Text, { display: "heading2", children: t2("No invoices created yet") })
|
|
16841
16936
|
] }) })
|
|
16842
16937
|
] });
|
|
16843
16938
|
});
|
|
@@ -16847,14 +16942,14 @@ Invoices.displayName = "Invoices";
|
|
|
16847
16942
|
import { forwardRef as forwardRef9, useCallback as useCallback12, useMemo as useMemo18, useRef as useRef11, useState as useState16 } from "react";
|
|
16848
16943
|
|
|
16849
16944
|
// src/components/elements/metered-features/Meter.tsx
|
|
16850
|
-
import { jsx as
|
|
16945
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
16851
16946
|
var Meter = ({ entitlement, usageDetails }) => {
|
|
16852
16947
|
const { priceBehavior, usage } = entitlement;
|
|
16853
16948
|
const limit = usageDetails.limit ?? usageDetails.currentTier?.to;
|
|
16854
16949
|
if (typeof usage !== "number" || !limit || limit === Infinity) {
|
|
16855
16950
|
return null;
|
|
16856
16951
|
}
|
|
16857
|
-
const meter = /* @__PURE__ */
|
|
16952
|
+
const meter = /* @__PURE__ */ jsx36(
|
|
16858
16953
|
ProgressBar,
|
|
16859
16954
|
{
|
|
16860
16955
|
progress: Math.min(usage, limit) / Math.max(usage, limit) * 100,
|
|
@@ -16871,7 +16966,7 @@ var Meter = ({ entitlement, usageDetails }) => {
|
|
|
16871
16966
|
};
|
|
16872
16967
|
|
|
16873
16968
|
// src/components/elements/metered-features/PriceDetails.tsx
|
|
16874
|
-
import { Fragment as
|
|
16969
|
+
import { Fragment as Fragment17, jsx as jsx37, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
16875
16970
|
var PriceDetails = ({
|
|
16876
16971
|
entitlement,
|
|
16877
16972
|
usageDetails,
|
|
@@ -16918,12 +17013,12 @@ var PriceDetails = ({
|
|
|
16918
17013
|
formatCurrency(currentTierPerUnitPrice, currency),
|
|
16919
17014
|
/* @__PURE__ */ jsxs28(Box, { as: "sub", $whiteSpace: "nowrap", children: [
|
|
16920
17015
|
"/",
|
|
16921
|
-
packageSize > 1 && /* @__PURE__ */ jsxs28(
|
|
17016
|
+
packageSize > 1 && /* @__PURE__ */ jsxs28(Fragment17, { children: [
|
|
16922
17017
|
packageSize,
|
|
16923
17018
|
" "
|
|
16924
17019
|
] }),
|
|
16925
17020
|
getFeatureName(feature, packageSize),
|
|
16926
|
-
feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ jsxs28(
|
|
17021
|
+
feature.featureType === "trait" /* Trait */ && period && /* @__PURE__ */ jsxs28(Fragment17, { children: [
|
|
16927
17022
|
"/",
|
|
16928
17023
|
shortenPeriod(period)
|
|
16929
17024
|
] })
|
|
@@ -16933,9 +17028,9 @@ var PriceDetails = ({
|
|
|
16933
17028
|
t2("Tier"),
|
|
16934
17029
|
": ",
|
|
16935
17030
|
currentTier?.from || 1,
|
|
16936
|
-
typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */
|
|
17031
|
+
typeof currentTier?.to === "number" && (currentTier?.from || 1) !== currentTier?.to && /* @__PURE__ */ jsx37(Fragment17, { children: currentTier.to === Infinity ? "+" : `\u2013${currentTier.to}` })
|
|
16937
17032
|
] }),
|
|
16938
|
-
/* @__PURE__ */
|
|
17033
|
+
/* @__PURE__ */ jsx37(
|
|
16939
17034
|
PricingTiersTooltip,
|
|
16940
17035
|
{
|
|
16941
17036
|
period,
|
|
@@ -16946,7 +17041,7 @@ var PriceDetails = ({
|
|
|
16946
17041
|
}
|
|
16947
17042
|
)
|
|
16948
17043
|
] }),
|
|
16949
|
-
typeof amount === "number" && /* @__PURE__ */
|
|
17044
|
+
typeof amount === "number" && /* @__PURE__ */ jsx37(Fragment17, { children: priceBehavior === "overage" /* Overage */ ? /* @__PURE__ */ jsxs28(Text, { children: [
|
|
16950
17045
|
formatNumber(amount),
|
|
16951
17046
|
" ",
|
|
16952
17047
|
getFeatureName(feature, amount),
|
|
@@ -16986,7 +17081,7 @@ var Container2 = dt.div`
|
|
|
16986
17081
|
`;
|
|
16987
17082
|
|
|
16988
17083
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
16989
|
-
import { Fragment as
|
|
17084
|
+
import { Fragment as Fragment18, jsx as jsx38, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
16990
17085
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
16991
17086
|
const { t: t2 } = useTranslation();
|
|
16992
17087
|
const { feature, priceBehavior, allocation, usage, metricResetAt } = entitlement;
|
|
@@ -17000,7 +17095,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
17000
17095
|
feature: getFeatureName(feature)
|
|
17001
17096
|
}) : priceBehavior === "overage" /* Overage */ && typeof limit === "number" ? t2("X included", {
|
|
17002
17097
|
amount: formatNumber(limit)
|
|
17003
|
-
}) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : typeof
|
|
17098
|
+
}) : priceBehavior === "pay_in_advance" /* PayInAdvance */ && typeof usage === "number" ? `${formatNumber(usage)} ${t2("used")}` : priceBehavior === "pay_as_you_go" /* PayAsYouGo */ && typeof cost === "number" ? formatCurrency(cost, billingPrice?.currency) : priceBehavior === "credit_burndown" /* Credit */ && typeof limit === "number" ? t2("Limit of", {
|
|
17099
|
+
amount: formatNumber(limit)
|
|
17100
|
+
}) : typeof allocation === "number" ? t2("Limit of", {
|
|
17004
17101
|
amount: formatNumber(allocation)
|
|
17005
17102
|
}) : t2("No limit")
|
|
17006
17103
|
);
|
|
@@ -17015,7 +17112,7 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
17015
17112
|
})
|
|
17016
17113
|
);
|
|
17017
17114
|
}
|
|
17018
|
-
return /* @__PURE__ */
|
|
17115
|
+
return /* @__PURE__ */ jsx38(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx38(Text, { display: fontStyle, children: acc.join(" \u2022 ") }) });
|
|
17019
17116
|
};
|
|
17020
17117
|
function resolveDesignProps4(props) {
|
|
17021
17118
|
return {
|
|
@@ -17049,7 +17146,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17049
17146
|
const { t: t2 } = useTranslation();
|
|
17050
17147
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
17051
17148
|
const isLightBackground = useIsLightBackground();
|
|
17052
|
-
const { period, meteredFeatures, creditGroups } = useMemo18(() => {
|
|
17149
|
+
const { period, meteredFeatures, creditGroups, showCredits } = useMemo18(() => {
|
|
17150
|
+
const showCredits2 = data?.showCredits ?? true;
|
|
17053
17151
|
if (isCheckoutData(data)) {
|
|
17054
17152
|
const period2 = typeof data.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0;
|
|
17055
17153
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
@@ -17067,20 +17165,19 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17067
17165
|
return {
|
|
17068
17166
|
period: period2,
|
|
17069
17167
|
meteredFeatures: (orderedFeatureUsage || data.featureUsage?.features || []).filter(
|
|
17070
|
-
({
|
|
17071
|
-
// credit-based entitlements behave differently and should not be shown as a metered feature
|
|
17072
|
-
priceBehavior !== "credit_burndown" /* Credit */ && (feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */)
|
|
17073
|
-
)
|
|
17168
|
+
({ feature }) => feature?.featureType === "event" /* Event */ || feature?.featureType === "trait" /* Trait */
|
|
17074
17169
|
),
|
|
17075
17170
|
creditGroups: groupCreditGrants(data.creditGrants, {
|
|
17076
17171
|
groupBy: "credit"
|
|
17077
|
-
})
|
|
17172
|
+
}),
|
|
17173
|
+
showCredits: showCredits2
|
|
17078
17174
|
};
|
|
17079
17175
|
}
|
|
17080
17176
|
return {
|
|
17081
17177
|
period: void 0,
|
|
17082
17178
|
meteredFeatures: [],
|
|
17083
|
-
creditGroups: []
|
|
17179
|
+
creditGroups: [],
|
|
17180
|
+
showCredits: showCredits2
|
|
17084
17181
|
};
|
|
17085
17182
|
}, [props.visibleFeatures, data]);
|
|
17086
17183
|
const [creditVisibility, setCreditVisibility] = useState16(
|
|
@@ -17108,7 +17205,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17108
17205
|
acc.push(
|
|
17109
17206
|
/* @__PURE__ */ jsxs29(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
17110
17207
|
/* @__PURE__ */ jsxs29(Flex, { $gap: "1.5rem", children: [
|
|
17111
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
17208
|
+
props.icon.isVisible && /* @__PURE__ */ jsx38(
|
|
17112
17209
|
Icon3,
|
|
17113
17210
|
{
|
|
17114
17211
|
name: feature.icon,
|
|
@@ -17130,8 +17227,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17130
17227
|
$gap: "1rem",
|
|
17131
17228
|
children: [
|
|
17132
17229
|
/* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
17133
|
-
/* @__PURE__ */
|
|
17134
|
-
props.description.isVisible && /* @__PURE__ */
|
|
17230
|
+
/* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
17231
|
+
props.description.isVisible && /* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
17135
17232
|
] }),
|
|
17136
17233
|
/* @__PURE__ */ jsxs29(
|
|
17137
17234
|
Box,
|
|
@@ -17140,20 +17237,20 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17140
17237
|
$flexGrow: 1,
|
|
17141
17238
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
17142
17239
|
children: [
|
|
17143
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
17144
|
-
typeof limit === "number" && /* @__PURE__ */ jsxs29(
|
|
17240
|
+
props.usage.isVisible && /* @__PURE__ */ jsx38(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx38(Text, { display: props.usage.fontStyle, children: priceBehavior === "pay_in_advance" /* PayInAdvance */ ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
|
|
17241
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs29(Fragment18, { children: [
|
|
17145
17242
|
formatNumber(limit),
|
|
17146
17243
|
" "
|
|
17147
17244
|
] }),
|
|
17148
17245
|
getFeatureName(feature, limit)
|
|
17149
|
-
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs29(
|
|
17246
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs29(Fragment18, { children: [
|
|
17150
17247
|
formatNumber(usage),
|
|
17151
17248
|
" ",
|
|
17152
17249
|
getFeatureName(feature, usage),
|
|
17153
17250
|
" ",
|
|
17154
17251
|
t2("used")
|
|
17155
17252
|
] }) }) }),
|
|
17156
|
-
props.allocation.isVisible && /* @__PURE__ */
|
|
17253
|
+
props.allocation.isVisible && /* @__PURE__ */ jsx38(
|
|
17157
17254
|
Limit,
|
|
17158
17255
|
{
|
|
17159
17256
|
entitlement,
|
|
@@ -17167,14 +17264,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17167
17264
|
]
|
|
17168
17265
|
}
|
|
17169
17266
|
),
|
|
17170
|
-
props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */
|
|
17267
|
+
props.isVisible && priceBehavior !== "pay_as_you_go" /* PayAsYouGo */ && /* @__PURE__ */ jsx38(
|
|
17171
17268
|
Meter,
|
|
17172
17269
|
{
|
|
17173
17270
|
entitlement,
|
|
17174
17271
|
usageDetails
|
|
17175
17272
|
}
|
|
17176
17273
|
),
|
|
17177
|
-
priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */
|
|
17274
|
+
priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsx38(
|
|
17178
17275
|
Button,
|
|
17179
17276
|
{
|
|
17180
17277
|
type: "button",
|
|
@@ -17187,7 +17284,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17187
17284
|
)
|
|
17188
17285
|
] })
|
|
17189
17286
|
] }),
|
|
17190
|
-
(priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */
|
|
17287
|
+
(priceBehavior === "overage" /* Overage */ || priceBehavior === "tier" /* Tiered */) && /* @__PURE__ */ jsx38(
|
|
17191
17288
|
PriceDetails,
|
|
17192
17289
|
{
|
|
17193
17290
|
entitlement,
|
|
@@ -17199,11 +17296,11 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17199
17296
|
);
|
|
17200
17297
|
return acc;
|
|
17201
17298
|
}, []),
|
|
17202
|
-
creditGroups.map((credit, index) => {
|
|
17299
|
+
showCredits && creditGroups.map((credit, index) => {
|
|
17203
17300
|
const isExpanded = creditVisibility.find(({ id }) => credit.id === id)?.isExpanded ?? false;
|
|
17204
17301
|
return /* @__PURE__ */ jsxs29(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
17205
17302
|
/* @__PURE__ */ jsxs29(Flex, { $gap: "1.5rem", children: [
|
|
17206
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
17303
|
+
props.icon.isVisible && /* @__PURE__ */ jsx38(
|
|
17207
17304
|
Icon3,
|
|
17208
17305
|
{
|
|
17209
17306
|
name: credit.icon,
|
|
@@ -17213,12 +17310,12 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17213
17310
|
}
|
|
17214
17311
|
),
|
|
17215
17312
|
/* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
17216
|
-
/* @__PURE__ */
|
|
17217
|
-
/* @__PURE__ */
|
|
17218
|
-
props.description.isVisible && /* @__PURE__ */
|
|
17313
|
+
/* @__PURE__ */ jsx38(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs29(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
17314
|
+
/* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
17315
|
+
props.description.isVisible && /* @__PURE__ */ jsx38(Box, { children: /* @__PURE__ */ jsx38(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
17219
17316
|
] }) }),
|
|
17220
17317
|
/* @__PURE__ */ jsxs29(Flex, { $gap: "1rem", children: [
|
|
17221
|
-
/* @__PURE__ */
|
|
17318
|
+
/* @__PURE__ */ jsx38(
|
|
17222
17319
|
ProgressBar,
|
|
17223
17320
|
{
|
|
17224
17321
|
progress: credit.total.used / credit.total.value * 100,
|
|
@@ -17229,7 +17326,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17229
17326
|
)]
|
|
17230
17327
|
}
|
|
17231
17328
|
),
|
|
17232
|
-
/* @__PURE__ */
|
|
17329
|
+
/* @__PURE__ */ jsx38(
|
|
17233
17330
|
Button,
|
|
17234
17331
|
{
|
|
17235
17332
|
type: "button",
|
|
@@ -17244,12 +17341,12 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17244
17341
|
] })
|
|
17245
17342
|
] })
|
|
17246
17343
|
] }),
|
|
17247
|
-
/* @__PURE__ */
|
|
17344
|
+
/* @__PURE__ */ jsx38(
|
|
17248
17345
|
Box,
|
|
17249
17346
|
{
|
|
17250
17347
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
17251
17348
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
17252
|
-
children: /* @__PURE__ */
|
|
17349
|
+
children: /* @__PURE__ */ jsx38(
|
|
17253
17350
|
TransitionBox,
|
|
17254
17351
|
{
|
|
17255
17352
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -17257,19 +17354,19 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17257
17354
|
children: credit.grants.map((grant, index2) => {
|
|
17258
17355
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
17259
17356
|
const padding = index2 > 0 ? `0 ${paddingX}rem 1rem` : `1rem ${paddingX}rem`;
|
|
17260
|
-
return /* @__PURE__ */
|
|
17261
|
-
/* @__PURE__ */
|
|
17357
|
+
return /* @__PURE__ */ jsx38(Box, { $display: "table-row", children: grant.grantReason === "plan" /* Plan */ ? /* @__PURE__ */ jsxs29(Fragment18, { children: [
|
|
17358
|
+
/* @__PURE__ */ jsx38(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx38(Text, { children: t2("X items included in plan", {
|
|
17262
17359
|
amount: grant.quantity,
|
|
17263
17360
|
item: getFeatureName(credit, grant.quantity)
|
|
17264
17361
|
}) }) }),
|
|
17265
|
-
/* @__PURE__ */
|
|
17362
|
+
/* @__PURE__ */ jsx38(
|
|
17266
17363
|
Box,
|
|
17267
17364
|
{
|
|
17268
17365
|
$display: "table-cell",
|
|
17269
17366
|
$padding: padding,
|
|
17270
17367
|
$textAlign: "right",
|
|
17271
17368
|
$whiteSpace: "nowrap",
|
|
17272
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
17369
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx38(Text, { children: t2("Resets", {
|
|
17273
17370
|
date: toPrettyDate(
|
|
17274
17371
|
modifyDate(grant.expiresAt, 1),
|
|
17275
17372
|
{
|
|
@@ -17281,8 +17378,8 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17281
17378
|
}) })
|
|
17282
17379
|
}
|
|
17283
17380
|
)
|
|
17284
|
-
] }) : /* @__PURE__ */ jsxs29(
|
|
17285
|
-
/* @__PURE__ */
|
|
17381
|
+
] }) : /* @__PURE__ */ jsxs29(Fragment18, { children: [
|
|
17382
|
+
/* @__PURE__ */ jsx38(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx38(Text, { children: grant.grantReason === "purchased" /* Purchased */ ? /* @__PURE__ */ jsx38(Fragment18, { children: t2("X item bundle", {
|
|
17286
17383
|
amount: grant.quantity,
|
|
17287
17384
|
item: getFeatureName(credit, 1),
|
|
17288
17385
|
createdAt: toPrettyDate(grant.createdAt, {
|
|
@@ -17290,7 +17387,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17290
17387
|
month: "2-digit",
|
|
17291
17388
|
year: "2-digit"
|
|
17292
17389
|
})
|
|
17293
|
-
}) }) : /* @__PURE__ */
|
|
17390
|
+
}) }) : /* @__PURE__ */ jsx38(Fragment18, { children: t2("X item grant", {
|
|
17294
17391
|
amount: grant.quantity,
|
|
17295
17392
|
item: getFeatureName(
|
|
17296
17393
|
credit,
|
|
@@ -17302,14 +17399,14 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17302
17399
|
year: "2-digit"
|
|
17303
17400
|
})
|
|
17304
17401
|
}) }) }) }),
|
|
17305
|
-
/* @__PURE__ */
|
|
17402
|
+
/* @__PURE__ */ jsx38(
|
|
17306
17403
|
Box,
|
|
17307
17404
|
{
|
|
17308
17405
|
$display: "table-cell",
|
|
17309
17406
|
$padding: padding,
|
|
17310
17407
|
$textAlign: "right",
|
|
17311
17408
|
$whiteSpace: "nowrap",
|
|
17312
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
17409
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx38(Text, { children: t2("Expires", {
|
|
17313
17410
|
date: toPrettyDate(
|
|
17314
17411
|
modifyDate(grant.expiresAt, 1),
|
|
17315
17412
|
{
|
|
@@ -17328,7 +17425,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17328
17425
|
}
|
|
17329
17426
|
),
|
|
17330
17427
|
/* @__PURE__ */ jsxs29(Flex, { $gap: "0.25rem", children: [
|
|
17331
|
-
/* @__PURE__ */
|
|
17428
|
+
/* @__PURE__ */ jsx38(
|
|
17332
17429
|
Icon3,
|
|
17333
17430
|
{
|
|
17334
17431
|
name: "chevron-down",
|
|
@@ -17339,7 +17436,7 @@ var MeteredFeatures = forwardRef9(({ className, ...rest }, ref) => {
|
|
|
17339
17436
|
}
|
|
17340
17437
|
}
|
|
17341
17438
|
),
|
|
17342
|
-
/* @__PURE__ */
|
|
17439
|
+
/* @__PURE__ */ jsx38(
|
|
17343
17440
|
Text,
|
|
17344
17441
|
{
|
|
17345
17442
|
onClick: () => toggleBalanceDetails(credit.id),
|
|
@@ -17359,24 +17456,24 @@ import { forwardRef as forwardRef10, useMemo as useMemo20 } from "react";
|
|
|
17359
17456
|
|
|
17360
17457
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
17361
17458
|
import { useMemo as useMemo19 } from "react";
|
|
17362
|
-
import { jsx as
|
|
17459
|
+
import { jsx as jsx39, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
17363
17460
|
var PaymentElement2 = ({
|
|
17364
17461
|
iconName,
|
|
17365
17462
|
iconTitle,
|
|
17366
17463
|
label,
|
|
17367
17464
|
paymentLast4
|
|
17368
17465
|
}) => {
|
|
17369
|
-
return /* @__PURE__ */
|
|
17370
|
-
iconName && /* @__PURE__ */
|
|
17466
|
+
return /* @__PURE__ */ jsx39(Text, { children: /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
17467
|
+
iconName && /* @__PURE__ */ jsx39(Icon3, { name: iconName, title: iconTitle }),
|
|
17371
17468
|
(label || paymentLast4) && /* @__PURE__ */ jsxs30(Box, { $flexGrow: 1, children: [
|
|
17372
|
-
label && /* @__PURE__ */
|
|
17469
|
+
label && /* @__PURE__ */ jsx39(Text, { children: label }),
|
|
17373
17470
|
" ",
|
|
17374
|
-
paymentLast4 && /* @__PURE__ */
|
|
17471
|
+
paymentLast4 && /* @__PURE__ */ jsx39(Text, { children: paymentLast4 })
|
|
17375
17472
|
] })
|
|
17376
17473
|
] }) });
|
|
17377
17474
|
};
|
|
17378
17475
|
var EmptyPaymentElement = () => {
|
|
17379
|
-
return /* @__PURE__ */
|
|
17476
|
+
return /* @__PURE__ */ jsx39(Text, { children: /* @__PURE__ */ jsx39(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx39(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx39(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
|
|
17380
17477
|
};
|
|
17381
17478
|
var getPaymentMethodData = ({
|
|
17382
17479
|
accountLast4,
|
|
@@ -17443,8 +17540,8 @@ var PaymentMethodElement = ({
|
|
|
17443
17540
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
17444
17541
|
return /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
17445
17542
|
props.header.isVisible && /* @__PURE__ */ jsxs30(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
17446
|
-
/* @__PURE__ */
|
|
17447
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */
|
|
17543
|
+
/* @__PURE__ */ jsx39(Text, { display: props.header.fontStyle, children: t2("Payment Method") }),
|
|
17544
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx39(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t2("Expires in X months", { months: monthsToExpiration }) : t2("Expired") })
|
|
17448
17545
|
] }),
|
|
17449
17546
|
/* @__PURE__ */ jsxs30(
|
|
17450
17547
|
Flex,
|
|
@@ -17455,8 +17552,8 @@ var PaymentMethodElement = ({
|
|
|
17455
17552
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
17456
17553
|
$borderRadius: "9999px",
|
|
17457
17554
|
children: [
|
|
17458
|
-
paymentMethod ? /* @__PURE__ */
|
|
17459
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */
|
|
17555
|
+
paymentMethod ? /* @__PURE__ */ jsx39(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx39(EmptyPaymentElement, {}),
|
|
17556
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx39(
|
|
17460
17557
|
Text,
|
|
17461
17558
|
{
|
|
17462
17559
|
onClick: onEdit,
|
|
@@ -17501,21 +17598,21 @@ var PaymentListElement = ({
|
|
|
17501
17598
|
$borderStyle: "solid",
|
|
17502
17599
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
17503
17600
|
children: [
|
|
17504
|
-
iconName && /* @__PURE__ */
|
|
17601
|
+
iconName && /* @__PURE__ */ jsx39(Icon3, { name: iconName, title: iconTitle }),
|
|
17505
17602
|
(label || paymentLast4) && /* @__PURE__ */ jsxs30(Box, { $flexGrow: 1, children: [
|
|
17506
|
-
label && /* @__PURE__ */
|
|
17603
|
+
label && /* @__PURE__ */ jsx39(Text, { children: label }),
|
|
17507
17604
|
" ",
|
|
17508
|
-
paymentLast4 && /* @__PURE__ */
|
|
17605
|
+
paymentLast4 && /* @__PURE__ */ jsx39(Text, { children: paymentLast4 })
|
|
17509
17606
|
] }),
|
|
17510
|
-
expirationDate && /* @__PURE__ */
|
|
17607
|
+
expirationDate && /* @__PURE__ */ jsx39(
|
|
17511
17608
|
Box,
|
|
17512
17609
|
{
|
|
17513
17610
|
$flexGrow: 1,
|
|
17514
17611
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
17515
|
-
children: /* @__PURE__ */
|
|
17612
|
+
children: /* @__PURE__ */ jsx39(Text, { children: t("Expires", { date: expirationDate }) })
|
|
17516
17613
|
}
|
|
17517
17614
|
),
|
|
17518
|
-
/* @__PURE__ */
|
|
17615
|
+
/* @__PURE__ */ jsx39(Box, { children: /* @__PURE__ */ jsx39(
|
|
17519
17616
|
Text,
|
|
17520
17617
|
{
|
|
17521
17618
|
onClick: () => {
|
|
@@ -17528,7 +17625,7 @@ var PaymentListElement = ({
|
|
|
17528
17625
|
children: t("Set default")
|
|
17529
17626
|
}
|
|
17530
17627
|
) }),
|
|
17531
|
-
/* @__PURE__ */
|
|
17628
|
+
/* @__PURE__ */ jsx39(
|
|
17532
17629
|
Icon3,
|
|
17533
17630
|
{
|
|
17534
17631
|
tabIndex: 0,
|
|
@@ -17550,7 +17647,7 @@ var PaymentListElement = ({
|
|
|
17550
17647
|
};
|
|
17551
17648
|
|
|
17552
17649
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
17553
|
-
import { jsx as
|
|
17650
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
17554
17651
|
var resolveDesignProps5 = (props) => {
|
|
17555
17652
|
return {
|
|
17556
17653
|
header: {
|
|
@@ -17591,7 +17688,7 @@ var PaymentMethod = forwardRef10(({ children, className, portal, allowEdit = tru
|
|
|
17591
17688
|
monthsToExpiration: void 0
|
|
17592
17689
|
};
|
|
17593
17690
|
}, [data]);
|
|
17594
|
-
return /* @__PURE__ */
|
|
17691
|
+
return /* @__PURE__ */ jsx40(Element, { ref, className, children: /* @__PURE__ */ jsx40(
|
|
17595
17692
|
PaymentMethodElement,
|
|
17596
17693
|
{
|
|
17597
17694
|
paymentMethod,
|
|
@@ -17760,7 +17857,7 @@ var loadStripe = function loadStripe2() {
|
|
|
17760
17857
|
|
|
17761
17858
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
17762
17859
|
import { useCallback as useCallback13, useEffect as useEffect8, useMemo as useMemo21, useState as useState17 } from "react";
|
|
17763
|
-
import { jsx as
|
|
17860
|
+
import { jsx as jsx41, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
17764
17861
|
var resolveDesignProps6 = () => {
|
|
17765
17862
|
return {
|
|
17766
17863
|
header: {
|
|
@@ -17919,7 +18016,7 @@ var PaymentMethodDetails = ({
|
|
|
17919
18016
|
initializePaymentMethod
|
|
17920
18017
|
]);
|
|
17921
18018
|
return /* @__PURE__ */ jsxs31(Flex, { $position: "relative", children: [
|
|
17922
|
-
/* @__PURE__ */
|
|
18019
|
+
/* @__PURE__ */ jsx41(
|
|
17923
18020
|
Flex,
|
|
17924
18021
|
{
|
|
17925
18022
|
$position: "absolute",
|
|
@@ -17928,7 +18025,7 @@ var PaymentMethodDetails = ({
|
|
|
17928
18025
|
$alignItems: "center",
|
|
17929
18026
|
$width: "100%",
|
|
17930
18027
|
$height: "100%",
|
|
17931
|
-
children: /* @__PURE__ */
|
|
18028
|
+
children: /* @__PURE__ */ jsx41(
|
|
17932
18029
|
Loader,
|
|
17933
18030
|
{
|
|
17934
18031
|
$color: settings.theme.primary,
|
|
@@ -17981,7 +18078,7 @@ var PaymentMethodDetails = ({
|
|
|
17981
18078
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
17982
18079
|
},
|
|
17983
18080
|
children: [
|
|
17984
|
-
/* @__PURE__ */
|
|
18081
|
+
/* @__PURE__ */ jsx41(
|
|
17985
18082
|
PaymentForm,
|
|
17986
18083
|
{
|
|
17987
18084
|
financeData,
|
|
@@ -17992,7 +18089,7 @@ var PaymentMethodDetails = ({
|
|
|
17992
18089
|
}
|
|
17993
18090
|
}
|
|
17994
18091
|
),
|
|
17995
|
-
currentPaymentMethod && /* @__PURE__ */
|
|
18092
|
+
currentPaymentMethod && /* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(
|
|
17996
18093
|
Text,
|
|
17997
18094
|
{
|
|
17998
18095
|
onClick: focusExistingPaymentMethods,
|
|
@@ -18006,7 +18103,7 @@ var PaymentMethodDetails = ({
|
|
|
18006
18103
|
]
|
|
18007
18104
|
}
|
|
18008
18105
|
) : /* @__PURE__ */ jsxs31(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
18009
|
-
/* @__PURE__ */
|
|
18106
|
+
/* @__PURE__ */ jsx41(
|
|
18010
18107
|
PaymentMethodElement,
|
|
18011
18108
|
{
|
|
18012
18109
|
paymentMethod: currentPaymentMethod,
|
|
@@ -18015,7 +18112,7 @@ var PaymentMethodDetails = ({
|
|
|
18015
18112
|
}
|
|
18016
18113
|
),
|
|
18017
18114
|
paymentMethods.length > 0 && /* @__PURE__ */ jsxs31(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18018
|
-
/* @__PURE__ */
|
|
18115
|
+
/* @__PURE__ */ jsx41(
|
|
18019
18116
|
Text,
|
|
18020
18117
|
{
|
|
18021
18118
|
onClick: toggleShowPaymentMethods,
|
|
@@ -18026,7 +18123,7 @@ var PaymentMethodDetails = ({
|
|
|
18026
18123
|
children: t2("Choose different payment method")
|
|
18027
18124
|
}
|
|
18028
18125
|
),
|
|
18029
|
-
/* @__PURE__ */
|
|
18126
|
+
/* @__PURE__ */ jsx41(
|
|
18030
18127
|
Icon3,
|
|
18031
18128
|
{
|
|
18032
18129
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down"
|
|
@@ -18034,9 +18131,9 @@ var PaymentMethodDetails = ({
|
|
|
18034
18131
|
)
|
|
18035
18132
|
] }),
|
|
18036
18133
|
showDifferentPaymentMethods && /* @__PURE__ */ jsxs31(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
18037
|
-
/* @__PURE__ */
|
|
18134
|
+
/* @__PURE__ */ jsx41(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
18038
18135
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
18039
|
-
) || []).map((paymentMethod) => /* @__PURE__ */
|
|
18136
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ jsx41(
|
|
18040
18137
|
PaymentListElement,
|
|
18041
18138
|
{
|
|
18042
18139
|
paymentMethod,
|
|
@@ -18045,7 +18142,7 @@ var PaymentMethodDetails = ({
|
|
|
18045
18142
|
},
|
|
18046
18143
|
paymentMethod.id
|
|
18047
18144
|
)) }),
|
|
18048
|
-
(!setupIntent || !currentPaymentMethod) && /* @__PURE__ */
|
|
18145
|
+
(!setupIntent || !currentPaymentMethod) && /* @__PURE__ */ jsx41(
|
|
18049
18146
|
Button,
|
|
18050
18147
|
{
|
|
18051
18148
|
type: "button",
|
|
@@ -18057,7 +18154,7 @@ var PaymentMethodDetails = ({
|
|
|
18057
18154
|
)
|
|
18058
18155
|
] })
|
|
18059
18156
|
] }),
|
|
18060
|
-
!isLoading && error && /* @__PURE__ */
|
|
18157
|
+
!isLoading && error && /* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
18061
18158
|
]
|
|
18062
18159
|
}
|
|
18063
18160
|
)
|
|
@@ -18068,7 +18165,7 @@ var PaymentMethodDetails = ({
|
|
|
18068
18165
|
import { forwardRef as forwardRef11, useMemo as useMemo23 } from "react";
|
|
18069
18166
|
|
|
18070
18167
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
18071
|
-
import { jsx as
|
|
18168
|
+
import { jsx as jsx42, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
18072
18169
|
var AddOn = ({ addOn, currency, layout }) => {
|
|
18073
18170
|
return /* @__PURE__ */ jsxs32(
|
|
18074
18171
|
Flex,
|
|
@@ -18078,10 +18175,10 @@ var AddOn = ({ addOn, currency, layout }) => {
|
|
|
18078
18175
|
$flexWrap: "wrap",
|
|
18079
18176
|
$gap: "1rem",
|
|
18080
18177
|
children: [
|
|
18081
|
-
/* @__PURE__ */
|
|
18178
|
+
/* @__PURE__ */ jsx42(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
18082
18179
|
typeof addOn.planPrice === "number" && addOn.planPeriod && /* @__PURE__ */ jsxs32(Text, { children: [
|
|
18083
18180
|
formatCurrency(addOn.planPrice, currency),
|
|
18084
|
-
/* @__PURE__ */
|
|
18181
|
+
/* @__PURE__ */ jsx42("sub", { children: addOn.planPeriod == "one-time" ? shortenPeriod(addOn.planPeriod) : `/${shortenPeriod(addOn.planPeriod)}` })
|
|
18085
18182
|
] })
|
|
18086
18183
|
]
|
|
18087
18184
|
}
|
|
@@ -18089,11 +18186,12 @@ var AddOn = ({ addOn, currency, layout }) => {
|
|
|
18089
18186
|
};
|
|
18090
18187
|
|
|
18091
18188
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
18092
|
-
import { Fragment as
|
|
18093
|
-
import { Fragment as
|
|
18189
|
+
import { Fragment as Fragment19, useMemo as useMemo22 } from "react";
|
|
18190
|
+
import { Fragment as Fragment20, jsx as jsx43, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
18094
18191
|
var UsageDetails2 = ({
|
|
18095
18192
|
entitlement,
|
|
18096
18193
|
period,
|
|
18194
|
+
showCredits,
|
|
18097
18195
|
layout
|
|
18098
18196
|
}) => {
|
|
18099
18197
|
const { t: t2 } = useTranslation();
|
|
@@ -18112,9 +18210,9 @@ var UsageDetails2 = ({
|
|
|
18112
18210
|
let index = 0;
|
|
18113
18211
|
if (entitlement.priceBehavior === "overage" /* Overage */) {
|
|
18114
18212
|
acc.push(
|
|
18115
|
-
amount > 0 ? /* @__PURE__ */
|
|
18213
|
+
amount > 0 ? /* @__PURE__ */ jsx43(Fragment19, { children: t2("X additional", {
|
|
18116
18214
|
amount
|
|
18117
|
-
}) }, index) : /* @__PURE__ */ jsxs33(
|
|
18215
|
+
}) }, index) : /* @__PURE__ */ jsxs33(Fragment19, { children: [
|
|
18118
18216
|
t2("Additional"),
|
|
18119
18217
|
": "
|
|
18120
18218
|
] }, index)
|
|
@@ -18125,16 +18223,16 @@ var UsageDetails2 = ({
|
|
|
18125
18223
|
if (entitlement.priceBehavior !== "tier" /* Tiered */ && entitlement.feature && typeof price === "number" && !amount) {
|
|
18126
18224
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
18127
18225
|
acc.push(
|
|
18128
|
-
/* @__PURE__ */ jsxs33(
|
|
18226
|
+
/* @__PURE__ */ jsxs33(Fragment19, { children: [
|
|
18129
18227
|
formatCurrency(price, billingPrice?.currency),
|
|
18130
18228
|
/* @__PURE__ */ jsxs33("sub", { children: [
|
|
18131
18229
|
"/",
|
|
18132
|
-
packageSize > 1 && /* @__PURE__ */ jsxs33(
|
|
18230
|
+
packageSize > 1 && /* @__PURE__ */ jsxs33(Fragment20, { children: [
|
|
18133
18231
|
packageSize,
|
|
18134
18232
|
" "
|
|
18135
18233
|
] }),
|
|
18136
18234
|
getFeatureName(entitlement.feature, packageSize),
|
|
18137
|
-
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs33(
|
|
18235
|
+
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs33(Fragment20, { children: [
|
|
18138
18236
|
"/",
|
|
18139
18237
|
shortenPeriod(period)
|
|
18140
18238
|
] })
|
|
@@ -18143,10 +18241,10 @@ var UsageDetails2 = ({
|
|
|
18143
18241
|
);
|
|
18144
18242
|
index += 1;
|
|
18145
18243
|
}
|
|
18146
|
-
if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
18244
|
+
if (showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
18147
18245
|
const creditAmount = entitlement.planEntitlement.consumptionRate * amount;
|
|
18148
18246
|
acc.push(
|
|
18149
|
-
creditAmount > 0 ? /* @__PURE__ */ jsxs33(
|
|
18247
|
+
creditAmount > 0 ? /* @__PURE__ */ jsxs33(Fragment19, { children: [
|
|
18150
18248
|
creditAmount,
|
|
18151
18249
|
" ",
|
|
18152
18250
|
getFeatureName(
|
|
@@ -18155,7 +18253,7 @@ var UsageDetails2 = ({
|
|
|
18155
18253
|
),
|
|
18156
18254
|
" ",
|
|
18157
18255
|
t2("used")
|
|
18158
|
-
] }, index) : /* @__PURE__ */ jsxs33(
|
|
18256
|
+
] }, index) : /* @__PURE__ */ jsxs33(Fragment19, { children: [
|
|
18159
18257
|
entitlement.planEntitlement.consumptionRate,
|
|
18160
18258
|
" ",
|
|
18161
18259
|
getFeatureName(
|
|
@@ -18171,11 +18269,11 @@ var UsageDetails2 = ({
|
|
|
18171
18269
|
index += 1;
|
|
18172
18270
|
}
|
|
18173
18271
|
return acc;
|
|
18174
|
-
}, [t2, period, entitlement, billingPrice, amount]);
|
|
18175
|
-
if (!entitlement.feature?.name) {
|
|
18272
|
+
}, [t2, period, showCredits, entitlement, billingPrice, amount]);
|
|
18273
|
+
if (entitlement.priceBehavior === "credit_burndown" /* Credit */ && !showCredits || !entitlement.feature?.name) {
|
|
18176
18274
|
return null;
|
|
18177
18275
|
}
|
|
18178
|
-
const quantity = limit || amount;
|
|
18276
|
+
const quantity = entitlement.priceBehavior !== "credit_burndown" /* Credit */ ? limit || amount : void 0;
|
|
18179
18277
|
return /* @__PURE__ */ jsxs33(
|
|
18180
18278
|
Flex,
|
|
18181
18279
|
{
|
|
@@ -18184,13 +18282,13 @@ var UsageDetails2 = ({
|
|
|
18184
18282
|
$flexWrap: "wrap",
|
|
18185
18283
|
$gap: "0.5rem",
|
|
18186
18284
|
children: [
|
|
18187
|
-
/* @__PURE__ */
|
|
18285
|
+
/* @__PURE__ */ jsx43(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" && quantity > 0 ? /* @__PURE__ */ jsxs33(Fragment20, { children: [
|
|
18188
18286
|
quantity,
|
|
18189
18287
|
" ",
|
|
18190
18288
|
entitlement.feature.name
|
|
18191
18289
|
] }) : entitlement.feature.name }),
|
|
18192
18290
|
/* @__PURE__ */ jsxs33(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
18193
|
-
description.length > 0 && /* @__PURE__ */
|
|
18291
|
+
description.length > 0 && /* @__PURE__ */ jsx43(
|
|
18194
18292
|
Text,
|
|
18195
18293
|
{
|
|
18196
18294
|
style: { opacity: 0.54 },
|
|
@@ -18207,7 +18305,7 @@ var UsageDetails2 = ({
|
|
|
18207
18305
|
shortenPeriod(period)
|
|
18208
18306
|
] })
|
|
18209
18307
|
] }),
|
|
18210
|
-
entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */
|
|
18308
|
+
entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsx43(
|
|
18211
18309
|
PricingTiersTooltip,
|
|
18212
18310
|
{
|
|
18213
18311
|
feature: entitlement.feature,
|
|
@@ -18224,7 +18322,7 @@ var UsageDetails2 = ({
|
|
|
18224
18322
|
};
|
|
18225
18323
|
|
|
18226
18324
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
18227
|
-
import { Fragment as
|
|
18325
|
+
import { Fragment as Fragment21, jsx as jsx44, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
18228
18326
|
var resolveDesignProps7 = (props) => {
|
|
18229
18327
|
return {
|
|
18230
18328
|
header: {
|
|
@@ -18268,9 +18366,12 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18268
18366
|
canCheckout,
|
|
18269
18367
|
postTrialPlan,
|
|
18270
18368
|
featureUsage,
|
|
18369
|
+
showCredits,
|
|
18271
18370
|
showZeroPriceAsFree,
|
|
18272
18371
|
trialPaymentMethodRequired
|
|
18273
18372
|
} = useMemo23(() => {
|
|
18373
|
+
const showCredits2 = data?.showCredits ?? true;
|
|
18374
|
+
const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
|
|
18274
18375
|
if (isCheckoutData(data)) {
|
|
18275
18376
|
const {
|
|
18276
18377
|
company,
|
|
@@ -18279,7 +18380,6 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18279
18380
|
capabilities,
|
|
18280
18381
|
postTrialPlan: postTrialPlan2,
|
|
18281
18382
|
featureUsage: featureUsage2,
|
|
18282
|
-
showZeroPriceAsFree: showZeroPriceAsFree2,
|
|
18283
18383
|
trialPaymentMethodRequired: trialPaymentMethodRequired2
|
|
18284
18384
|
} = data;
|
|
18285
18385
|
const creditGroups2 = groupCreditGrants(creditGrants, {
|
|
@@ -18309,8 +18409,9 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18309
18409
|
canCheckout: capabilities?.checkout ?? true,
|
|
18310
18410
|
postTrialPlan: postTrialPlan2,
|
|
18311
18411
|
featureUsage: featureUsage2?.features || [],
|
|
18312
|
-
|
|
18313
|
-
|
|
18412
|
+
trialPaymentMethodRequired: trialPaymentMethodRequired2,
|
|
18413
|
+
showCredits: showCredits2,
|
|
18414
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
18314
18415
|
};
|
|
18315
18416
|
}
|
|
18316
18417
|
return {
|
|
@@ -18322,8 +18423,9 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18322
18423
|
canCheckout: false,
|
|
18323
18424
|
postTrialPlan: void 0,
|
|
18324
18425
|
featureUsage: [],
|
|
18325
|
-
|
|
18326
|
-
|
|
18426
|
+
trialPaymentMethodRequired: false,
|
|
18427
|
+
showCredits: showCredits2,
|
|
18428
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
18327
18429
|
};
|
|
18328
18430
|
}, [data]);
|
|
18329
18431
|
const usageBasedEntitlements = useMemo23(
|
|
@@ -18349,7 +18451,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18349
18451
|
}, [billingSubscription]);
|
|
18350
18452
|
const isFreePlan = currentPlan?.planPrice === 0;
|
|
18351
18453
|
const isUsageBasedPlan = isFreePlan && usageBasedEntitlements.length > 0;
|
|
18352
|
-
return /* @__PURE__ */ jsxs34(
|
|
18454
|
+
return /* @__PURE__ */ jsxs34(Fragment21, { children: [
|
|
18353
18455
|
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs34(
|
|
18354
18456
|
Notice,
|
|
18355
18457
|
{
|
|
@@ -18360,8 +18462,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18360
18462
|
$textAlign: "center",
|
|
18361
18463
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
18362
18464
|
children: [
|
|
18363
|
-
typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */
|
|
18364
|
-
/* @__PURE__ */
|
|
18465
|
+
typeof trialEnd.formatted !== "undefined" && /* @__PURE__ */ jsx44(Text, { as: "h3", display: "heading3", children: trialEnd.formatted }),
|
|
18466
|
+
/* @__PURE__ */ jsx44(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: trialPaymentMethodRequired ? t2("After the trial, subscribe") : postTrialPlan ? t2("After the trial, cancel", {
|
|
18365
18467
|
postTrialPlanName: postTrialPlan?.name
|
|
18366
18468
|
}) : t2("After the trial, cancel no default", {
|
|
18367
18469
|
planName: currentPlan?.name
|
|
@@ -18378,8 +18480,8 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18378
18480
|
$textAlign: "center",
|
|
18379
18481
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
18380
18482
|
children: [
|
|
18381
|
-
/* @__PURE__ */
|
|
18382
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */
|
|
18483
|
+
/* @__PURE__ */ jsx44(Text, { as: "h3", display: "heading3", children: t2("Subscription canceled") }),
|
|
18484
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx44(
|
|
18383
18485
|
Text,
|
|
18384
18486
|
{
|
|
18385
18487
|
as: "p",
|
|
@@ -18414,11 +18516,11 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18414
18516
|
$gap: "1rem",
|
|
18415
18517
|
children: [
|
|
18416
18518
|
/* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
18417
|
-
/* @__PURE__ */
|
|
18418
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */
|
|
18519
|
+
/* @__PURE__ */ jsx44(Text, { display: props.header.title.fontStyle, $leading: 1, children: currentPlan.name }),
|
|
18520
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx44(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
18419
18521
|
] }),
|
|
18420
18522
|
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && currentPlan.planPeriod && /* @__PURE__ */ jsxs34(Box, { children: [
|
|
18421
|
-
/* @__PURE__ */
|
|
18523
|
+
/* @__PURE__ */ jsx44(
|
|
18422
18524
|
Text,
|
|
18423
18525
|
{
|
|
18424
18526
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -18428,7 +18530,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18428
18530
|
)
|
|
18429
18531
|
}
|
|
18430
18532
|
),
|
|
18431
|
-
!isFreePlan && /* @__PURE__ */
|
|
18533
|
+
!isFreePlan && /* @__PURE__ */ jsx44(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs34("sub", { children: [
|
|
18432
18534
|
"/",
|
|
18433
18535
|
shortenPeriod(currentPlan.planPeriod)
|
|
18434
18536
|
] }) })
|
|
@@ -18437,7 +18539,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18437
18539
|
}
|
|
18438
18540
|
),
|
|
18439
18541
|
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18440
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
18542
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx44(
|
|
18441
18543
|
Text,
|
|
18442
18544
|
{
|
|
18443
18545
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -18445,7 +18547,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18445
18547
|
children: t2("Add-ons")
|
|
18446
18548
|
}
|
|
18447
18549
|
),
|
|
18448
|
-
/* @__PURE__ */
|
|
18550
|
+
/* @__PURE__ */ jsx44(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx44(
|
|
18449
18551
|
AddOn,
|
|
18450
18552
|
{
|
|
18451
18553
|
addOn,
|
|
@@ -18456,7 +18558,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18456
18558
|
)) })
|
|
18457
18559
|
] }),
|
|
18458
18560
|
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18459
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
18561
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx44(
|
|
18460
18562
|
Text,
|
|
18461
18563
|
{
|
|
18462
18564
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -18464,20 +18566,21 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18464
18566
|
children: t2("Usage-based")
|
|
18465
18567
|
}
|
|
18466
18568
|
),
|
|
18467
|
-
/* @__PURE__ */
|
|
18468
|
-
return /* @__PURE__ */
|
|
18569
|
+
/* @__PURE__ */ jsx44(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
18570
|
+
return /* @__PURE__ */ jsx44(
|
|
18469
18571
|
UsageDetails2,
|
|
18470
18572
|
{
|
|
18471
18573
|
entitlement,
|
|
18472
18574
|
period: currentPlan?.planPeriod || "month",
|
|
18575
|
+
showCredits,
|
|
18473
18576
|
layout: props
|
|
18474
18577
|
},
|
|
18475
18578
|
entitlementIndex
|
|
18476
18579
|
);
|
|
18477
18580
|
}) })
|
|
18478
18581
|
] }),
|
|
18479
|
-
props.addOns.isVisible && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18480
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
18582
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18583
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx44(
|
|
18481
18584
|
Text,
|
|
18482
18585
|
{
|
|
18483
18586
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -18485,7 +18588,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18485
18588
|
children: t2("Credits in plan")
|
|
18486
18589
|
}
|
|
18487
18590
|
),
|
|
18488
|
-
/* @__PURE__ */
|
|
18591
|
+
/* @__PURE__ */ jsx44(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.plan.map((group, groupIndex) => {
|
|
18489
18592
|
return /* @__PURE__ */ jsxs34(
|
|
18490
18593
|
Flex,
|
|
18491
18594
|
{
|
|
@@ -18499,7 +18602,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18499
18602
|
" ",
|
|
18500
18603
|
getFeatureName(group, group.quantity),
|
|
18501
18604
|
" ",
|
|
18502
|
-
subscriptionInterval && /* @__PURE__ */ jsxs34(
|
|
18605
|
+
subscriptionInterval && /* @__PURE__ */ jsxs34(Fragment21, { children: [
|
|
18503
18606
|
t2("per"),
|
|
18504
18607
|
" ",
|
|
18505
18608
|
t2(subscriptionInterval)
|
|
@@ -18525,7 +18628,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18525
18628
|
}) })
|
|
18526
18629
|
] }),
|
|
18527
18630
|
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18528
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
18631
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx44(
|
|
18529
18632
|
Text,
|
|
18530
18633
|
{
|
|
18531
18634
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -18533,7 +18636,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18533
18636
|
children: t2("Credit bundles")
|
|
18534
18637
|
}
|
|
18535
18638
|
),
|
|
18536
|
-
/* @__PURE__ */
|
|
18639
|
+
/* @__PURE__ */ jsx44(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.bundles.map((group, groupIndex) => {
|
|
18537
18640
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
18538
18641
|
return /* @__PURE__ */ jsxs34(
|
|
18539
18642
|
Flex,
|
|
@@ -18581,7 +18684,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18581
18684
|
}) })
|
|
18582
18685
|
] }),
|
|
18583
18686
|
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs34(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18584
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
18687
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx44(
|
|
18585
18688
|
Text,
|
|
18586
18689
|
{
|
|
18587
18690
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -18589,7 +18692,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18589
18692
|
children: t2("Promotional credits")
|
|
18590
18693
|
}
|
|
18591
18694
|
),
|
|
18592
|
-
/* @__PURE__ */
|
|
18695
|
+
/* @__PURE__ */ jsx44(Flex, { $flexDirection: "column", $gap: "1rem", children: creditGroups.promotional.map((group, groupIndex) => {
|
|
18593
18696
|
return /* @__PURE__ */ jsxs34(
|
|
18594
18697
|
Flex,
|
|
18595
18698
|
{
|
|
@@ -18622,7 +18725,7 @@ var PlanManager = forwardRef11(({ children, className, portal, ...rest }, ref) =
|
|
|
18622
18725
|
);
|
|
18623
18726
|
}) })
|
|
18624
18727
|
] }),
|
|
18625
|
-
canCheckout && props.callToAction.isVisible && /* @__PURE__ */
|
|
18728
|
+
canCheckout && props.callToAction.isVisible && /* @__PURE__ */ jsx44(
|
|
18626
18729
|
Button,
|
|
18627
18730
|
{
|
|
18628
18731
|
type: "button",
|
|
@@ -18648,7 +18751,7 @@ PlanManager.displayName = "PlanManager";
|
|
|
18648
18751
|
|
|
18649
18752
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
18650
18753
|
import {
|
|
18651
|
-
Fragment as
|
|
18754
|
+
Fragment as Fragment25,
|
|
18652
18755
|
forwardRef as forwardRef12,
|
|
18653
18756
|
useEffect as useEffect9,
|
|
18654
18757
|
useMemo as useMemo26,
|
|
@@ -18657,7 +18760,7 @@ import {
|
|
|
18657
18760
|
|
|
18658
18761
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
18659
18762
|
import { useMemo as useMemo24 } from "react";
|
|
18660
|
-
import { Fragment as
|
|
18763
|
+
import { Fragment as Fragment22, jsx as jsx45, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
18661
18764
|
var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
18662
18765
|
const { layout } = sharedProps;
|
|
18663
18766
|
const { t: t2 } = useTranslation();
|
|
@@ -18700,16 +18803,16 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18700
18803
|
},
|
|
18701
18804
|
children: [
|
|
18702
18805
|
/* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $gap: "0.75rem", children: [
|
|
18703
|
-
/* @__PURE__ */
|
|
18704
|
-
layout.addOns.showDescription && /* @__PURE__ */
|
|
18705
|
-
/* @__PURE__ */
|
|
18806
|
+
/* @__PURE__ */ jsx45(Box, { children: /* @__PURE__ */ jsx45(Text, { display: layout.plans.name.fontStyle, children: addOn.name }) }),
|
|
18807
|
+
layout.addOns.showDescription && /* @__PURE__ */ jsx45(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx45(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
18808
|
+
/* @__PURE__ */ jsx45(Box, { children: /* @__PURE__ */ jsxs35(Text, { display: layout.plans.name.fontStyle, children: [
|
|
18706
18809
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
18707
18810
|
/* @__PURE__ */ jsxs35("sub", { children: [
|
|
18708
18811
|
"/",
|
|
18709
18812
|
selectedPeriod
|
|
18710
18813
|
] })
|
|
18711
18814
|
] }) }),
|
|
18712
|
-
isActiveAddOn && /* @__PURE__ */
|
|
18815
|
+
isActiveAddOn && /* @__PURE__ */ jsx45(
|
|
18713
18816
|
Flex,
|
|
18714
18817
|
{
|
|
18715
18818
|
$position: "absolute",
|
|
@@ -18718,7 +18821,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18718
18821
|
$backgroundColor: settings.theme.primary,
|
|
18719
18822
|
$borderRadius: "9999px",
|
|
18720
18823
|
$padding: "0.125rem 0.85rem",
|
|
18721
|
-
children: /* @__PURE__ */
|
|
18824
|
+
children: /* @__PURE__ */ jsx45(
|
|
18722
18825
|
Text,
|
|
18723
18826
|
{
|
|
18724
18827
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -18737,7 +18840,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18737
18840
|
$gap: `${cardPadding}rem`,
|
|
18738
18841
|
$flexGrow: 1,
|
|
18739
18842
|
children: [
|
|
18740
|
-
layout.addOns.showEntitlements && /* @__PURE__ */
|
|
18843
|
+
layout.addOns.showEntitlements && /* @__PURE__ */ jsx45(
|
|
18741
18844
|
Flex,
|
|
18742
18845
|
{
|
|
18743
18846
|
$flexDirection: "column",
|
|
@@ -18746,7 +18849,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18746
18849
|
$flexGrow: 1,
|
|
18747
18850
|
children: addOn.entitlements.map((entitlement, entitlementIndex) => {
|
|
18748
18851
|
const metricPeriodName = getMetricPeriodName(entitlement);
|
|
18749
|
-
return /* @__PURE__ */
|
|
18852
|
+
return /* @__PURE__ */ jsx45(
|
|
18750
18853
|
Flex,
|
|
18751
18854
|
{
|
|
18752
18855
|
$flexWrap: "wrap",
|
|
@@ -18754,7 +18857,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18754
18857
|
$alignItems: "center",
|
|
18755
18858
|
$gap: "1rem",
|
|
18756
18859
|
children: /* @__PURE__ */ jsxs35(Flex, { $gap: "1rem", children: [
|
|
18757
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
18860
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx45(
|
|
18758
18861
|
Icon3,
|
|
18759
18862
|
{
|
|
18760
18863
|
name: entitlement.feature.icon,
|
|
@@ -18764,10 +18867,10 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18764
18867
|
}
|
|
18765
18868
|
),
|
|
18766
18869
|
/* @__PURE__ */ jsxs35(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18767
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
18870
|
+
entitlement.feature?.name && /* @__PURE__ */ jsx45(Flex, { $alignItems: "center", $flexGrow: 1, children: /* @__PURE__ */ jsx45(Text, { children: entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs35(Fragment22, { children: [
|
|
18768
18871
|
entitlement.valueType === "unlimited" /* Unlimited */ ? t2("Unlimited", {
|
|
18769
18872
|
item: getFeatureName(entitlement.feature)
|
|
18770
|
-
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs35(
|
|
18873
|
+
}) : typeof entitlement.valueNumeric === "number" && /* @__PURE__ */ jsxs35(Fragment22, { children: [
|
|
18771
18874
|
formatNumber(entitlement.valueNumeric),
|
|
18772
18875
|
" ",
|
|
18773
18876
|
getFeatureName(
|
|
@@ -18775,14 +18878,14 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18775
18878
|
entitlement.valueNumeric
|
|
18776
18879
|
)
|
|
18777
18880
|
] }),
|
|
18778
|
-
metricPeriodName && /* @__PURE__ */ jsxs35(
|
|
18881
|
+
metricPeriodName && /* @__PURE__ */ jsxs35(Fragment22, { children: [
|
|
18779
18882
|
" ",
|
|
18780
18883
|
t2("per"),
|
|
18781
18884
|
" ",
|
|
18782
18885
|
t2(metricPeriodName)
|
|
18783
18886
|
] })
|
|
18784
18887
|
] }) : entitlement.feature.name }) }),
|
|
18785
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */
|
|
18888
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx45(
|
|
18786
18889
|
Text,
|
|
18787
18890
|
{
|
|
18788
18891
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -18798,7 +18901,7 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18798
18901
|
})
|
|
18799
18902
|
}
|
|
18800
18903
|
),
|
|
18801
|
-
showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */
|
|
18904
|
+
showCallToAction && layout.upgrade.isVisible && /* @__PURE__ */ jsx45(
|
|
18802
18905
|
Button,
|
|
18803
18906
|
{
|
|
18804
18907
|
type: "button",
|
|
@@ -18839,11 +18942,13 @@ var AddOn2 = ({ addOn, sharedProps, selectedPeriod }) => {
|
|
|
18839
18942
|
import { useMemo as useMemo25 } from "react";
|
|
18840
18943
|
|
|
18841
18944
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
18842
|
-
import { Fragment as
|
|
18945
|
+
import { Fragment as Fragment23, jsx as jsx46, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
18843
18946
|
var Entitlement = ({
|
|
18844
18947
|
entitlement,
|
|
18845
|
-
|
|
18846
|
-
selectedPeriod
|
|
18948
|
+
credits = [],
|
|
18949
|
+
selectedPeriod,
|
|
18950
|
+
showCredits,
|
|
18951
|
+
sharedProps
|
|
18847
18952
|
}) => {
|
|
18848
18953
|
const { layout } = sharedProps;
|
|
18849
18954
|
const { t: t2 } = useTranslation();
|
|
@@ -18855,13 +18960,14 @@ var Entitlement = ({
|
|
|
18855
18960
|
currency: entitlementCurrency,
|
|
18856
18961
|
packageSize: entitlementPackageSize = 1
|
|
18857
18962
|
} = getEntitlementPrice(entitlement, selectedPeriod) || {};
|
|
18858
|
-
if (entitlement.priceBehavior && typeof entitlementPrice !== "number") {
|
|
18859
|
-
return null;
|
|
18860
|
-
}
|
|
18861
18963
|
const limit = entitlement.softLimit ?? entitlement.valueNumeric;
|
|
18862
18964
|
const metricPeriodName = getMetricPeriodName(entitlement);
|
|
18965
|
+
const creditBasedEntitlementLimit = getCreditBasedEntitlementLimit(
|
|
18966
|
+
entitlement,
|
|
18967
|
+
credits
|
|
18968
|
+
);
|
|
18863
18969
|
return /* @__PURE__ */ jsxs36(Flex, { $gap: "1rem", children: [
|
|
18864
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
18970
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx46(
|
|
18865
18971
|
Icon3,
|
|
18866
18972
|
{
|
|
18867
18973
|
name: entitlement.feature.icon,
|
|
@@ -18872,37 +18978,61 @@ var Entitlement = ({
|
|
|
18872
18978
|
),
|
|
18873
18979
|
entitlement.feature?.name && /* @__PURE__ */ jsxs36(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
18874
18980
|
/* @__PURE__ */ jsxs36(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
18875
|
-
/* @__PURE__ */
|
|
18981
|
+
/* @__PURE__ */ jsx46(Text, { children: typeof entitlementPrice === "number" && (entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ || entitlement.priceBehavior === "pay_as_you_go" /* PayAsYouGo */) ? /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18876
18982
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
18877
18983
|
" ",
|
|
18878
18984
|
t2("per"),
|
|
18879
18985
|
" ",
|
|
18880
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(
|
|
18986
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18881
18987
|
entitlementPackageSize,
|
|
18882
18988
|
" "
|
|
18883
18989
|
] }),
|
|
18884
18990
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
18885
|
-
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs36(
|
|
18991
|
+
entitlement.priceBehavior === "pay_in_advance" /* PayInAdvance */ && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18886
18992
|
" ",
|
|
18887
18993
|
t2("per"),
|
|
18888
18994
|
" ",
|
|
18889
18995
|
selectedPeriod
|
|
18890
18996
|
] })
|
|
18891
|
-
] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */
|
|
18997
|
+
] }) : entitlement.priceBehavior === "tier" /* Tiered */ ? /* @__PURE__ */ jsx46(
|
|
18892
18998
|
TieredPricingDetails,
|
|
18893
18999
|
{
|
|
18894
19000
|
entitlement,
|
|
18895
19001
|
period: selectedPeriod
|
|
18896
19002
|
}
|
|
18897
|
-
) :
|
|
19003
|
+
) : showCredits && entitlement.priceBehavior === "credit_burndown" /* Credit */ && entitlement.valueCredit ? /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
19004
|
+
entitlement.consumptionRate,
|
|
19005
|
+
" ",
|
|
19006
|
+
getFeatureName(
|
|
19007
|
+
entitlement.valueCredit,
|
|
19008
|
+
entitlement.consumptionRate || void 0
|
|
19009
|
+
),
|
|
19010
|
+
" ",
|
|
19011
|
+
t2("per"),
|
|
19012
|
+
" ",
|
|
19013
|
+
getFeatureName(entitlement.feature, 1)
|
|
19014
|
+
] }) : entitlement.priceBehavior === "credit_burndown" /* Credit */ && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx46(Fragment23, { children: creditBasedEntitlementLimit?.period ? t2("Up to X units per period", {
|
|
19015
|
+
amount: creditBasedEntitlementLimit.limit,
|
|
19016
|
+
units: getFeatureName(
|
|
19017
|
+
entitlement.feature,
|
|
19018
|
+
creditBasedEntitlementLimit.limit
|
|
19019
|
+
),
|
|
19020
|
+
period: creditBasedEntitlementLimit.period
|
|
19021
|
+
}) : t2("Up to X units", {
|
|
19022
|
+
amount: creditBasedEntitlementLimit.limit,
|
|
19023
|
+
units: getFeatureName(
|
|
19024
|
+
entitlement.feature,
|
|
19025
|
+
creditBasedEntitlementLimit.limit
|
|
19026
|
+
)
|
|
19027
|
+
}) }) : entitlement.valueType === "numeric" /* Numeric */ || entitlement.valueType === "unlimited" /* Unlimited */ || entitlement.valueType === "trait" /* Trait */ ? /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18898
19028
|
entitlement.valueType === "unlimited" /* Unlimited */ && !entitlement.priceBehavior ? t2("Unlimited", {
|
|
18899
19029
|
item: getFeatureName(entitlement.feature)
|
|
18900
|
-
}) : typeof limit === "number" && /* @__PURE__ */ jsxs36(
|
|
19030
|
+
}) : typeof limit === "number" && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18901
19031
|
formatNumber(limit),
|
|
18902
19032
|
" ",
|
|
18903
19033
|
getFeatureName(entitlement.feature, limit)
|
|
18904
19034
|
] }),
|
|
18905
|
-
metricPeriodName && /* @__PURE__ */ jsxs36(
|
|
19035
|
+
metricPeriodName && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18906
19036
|
" ",
|
|
18907
19037
|
t2("per"),
|
|
18908
19038
|
" ",
|
|
@@ -18920,19 +19050,19 @@ var Entitlement = ({
|
|
|
18920
19050
|
" ",
|
|
18921
19051
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
18922
19052
|
"/",
|
|
18923
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(
|
|
19053
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18924
19054
|
entitlementPackageSize,
|
|
18925
19055
|
" "
|
|
18926
19056
|
] }),
|
|
18927
19057
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
18928
|
-
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs36(
|
|
19058
|
+
entitlement.feature.featureType === "trait" /* Trait */ && /* @__PURE__ */ jsxs36(Fragment23, { children: [
|
|
18929
19059
|
"/",
|
|
18930
19060
|
shortenPeriod(selectedPeriod)
|
|
18931
19061
|
] })
|
|
18932
19062
|
]
|
|
18933
19063
|
}
|
|
18934
19064
|
) : entitlement.priceBehavior === "tier" /* Tiered */ && /* @__PURE__ */ jsxs36(Flex, { $alignItems: "end", children: [
|
|
18935
|
-
/* @__PURE__ */
|
|
19065
|
+
/* @__PURE__ */ jsx46(
|
|
18936
19066
|
Text,
|
|
18937
19067
|
{
|
|
18938
19068
|
style: { opacity: 0.54 },
|
|
@@ -18941,7 +19071,7 @@ var Entitlement = ({
|
|
|
18941
19071
|
children: t2("Tier-based")
|
|
18942
19072
|
}
|
|
18943
19073
|
),
|
|
18944
|
-
/* @__PURE__ */
|
|
19074
|
+
/* @__PURE__ */ jsx46(
|
|
18945
19075
|
PricingTiersTooltip,
|
|
18946
19076
|
{
|
|
18947
19077
|
feature: entitlement.feature,
|
|
@@ -18951,7 +19081,7 @@ var Entitlement = ({
|
|
|
18951
19081
|
}
|
|
18952
19082
|
)
|
|
18953
19083
|
] }),
|
|
18954
|
-
entitlement.billingThreshold && /* @__PURE__ */
|
|
19084
|
+
entitlement.billingThreshold && /* @__PURE__ */ jsx46(
|
|
18955
19085
|
BillingThresholdTooltip,
|
|
18956
19086
|
{
|
|
18957
19087
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -18959,7 +19089,7 @@ var Entitlement = ({
|
|
|
18959
19089
|
)
|
|
18960
19090
|
] })
|
|
18961
19091
|
] }),
|
|
18962
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */
|
|
19092
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx46(
|
|
18963
19093
|
Text,
|
|
18964
19094
|
{
|
|
18965
19095
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -18972,7 +19102,7 @@ var Entitlement = ({
|
|
|
18972
19102
|
};
|
|
18973
19103
|
|
|
18974
19104
|
// src/components/elements/pricing-table/Plan.tsx
|
|
18975
|
-
import { Fragment as
|
|
19105
|
+
import { Fragment as Fragment24, jsx as jsx47, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
18976
19106
|
var Plan2 = ({
|
|
18977
19107
|
plan,
|
|
18978
19108
|
index,
|
|
@@ -18987,15 +19117,20 @@ var Plan2 = ({
|
|
|
18987
19117
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
18988
19118
|
const isLightBackground = useIsLightBackground();
|
|
18989
19119
|
const trialEnd = useTrialEnd();
|
|
19120
|
+
const showCallToAction = useMemo25(() => {
|
|
19121
|
+
return typeof sharedProps.callToActionUrl === "string" || typeof sharedProps.onCallToAction === "function";
|
|
19122
|
+
}, [sharedProps.callToActionUrl, sharedProps.onCallToAction]);
|
|
18990
19123
|
const {
|
|
18991
19124
|
currentPeriod,
|
|
18992
19125
|
canCheckout,
|
|
18993
19126
|
isTrialSubscription,
|
|
18994
19127
|
willSubscriptionCancel,
|
|
18995
19128
|
isStandalone,
|
|
18996
|
-
|
|
19129
|
+
showCredits,
|
|
18997
19130
|
showZeroPriceAsFree
|
|
18998
19131
|
} = useMemo25(() => {
|
|
19132
|
+
const showCredits2 = data?.showCredits ?? true;
|
|
19133
|
+
const showZeroPriceAsFree2 = data?.showZeroPriceAsFree ?? false;
|
|
18999
19134
|
if (isCheckoutData(data)) {
|
|
19000
19135
|
const billingSubscription = data.company?.billingSubscription;
|
|
19001
19136
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -19006,8 +19141,8 @@ var Plan2 = ({
|
|
|
19006
19141
|
isTrialSubscription: isTrialSubscription2,
|
|
19007
19142
|
willSubscriptionCancel: willSubscriptionCancel2,
|
|
19008
19143
|
isStandalone: false,
|
|
19009
|
-
|
|
19010
|
-
showZeroPriceAsFree:
|
|
19144
|
+
showCredits: showCredits2,
|
|
19145
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
19011
19146
|
};
|
|
19012
19147
|
}
|
|
19013
19148
|
return {
|
|
@@ -19016,10 +19151,10 @@ var Plan2 = ({
|
|
|
19016
19151
|
isTrialSubscription: false,
|
|
19017
19152
|
willSubscriptionCancel: false,
|
|
19018
19153
|
isStandalone: true,
|
|
19019
|
-
|
|
19020
|
-
showZeroPriceAsFree:
|
|
19154
|
+
showCredits: showCredits2,
|
|
19155
|
+
showZeroPriceAsFree: showZeroPriceAsFree2
|
|
19021
19156
|
};
|
|
19022
|
-
}, [data
|
|
19157
|
+
}, [data]);
|
|
19023
19158
|
const callToActionTarget = useMemo25(() => {
|
|
19024
19159
|
if (sharedProps.callToActionTarget) {
|
|
19025
19160
|
return sharedProps.callToActionTarget;
|
|
@@ -19078,9 +19213,9 @@ var Plan2 = ({
|
|
|
19078
19213
|
$borderStyle: "solid",
|
|
19079
19214
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
19080
19215
|
children: [
|
|
19081
|
-
/* @__PURE__ */
|
|
19082
|
-
layout.plans.description.isVisible && /* @__PURE__ */
|
|
19083
|
-
/* @__PURE__ */
|
|
19216
|
+
/* @__PURE__ */ jsx47(Box, { children: /* @__PURE__ */ jsx47(Text, { display: layout.plans.name.fontStyle, children: plan.name }) }),
|
|
19217
|
+
layout.plans.description.isVisible && /* @__PURE__ */ jsx47(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx47(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
19218
|
+
/* @__PURE__ */ jsx47(Box, { children: /* @__PURE__ */ jsxs37(
|
|
19084
19219
|
Text,
|
|
19085
19220
|
{
|
|
19086
19221
|
$font: headerPriceFontStyle.fontFamily,
|
|
@@ -19096,7 +19231,7 @@ var Plan2 = ({
|
|
|
19096
19231
|
]
|
|
19097
19232
|
}
|
|
19098
19233
|
) }),
|
|
19099
|
-
credits.length > 0 && /* @__PURE__ */
|
|
19234
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ jsx47(
|
|
19100
19235
|
Flex,
|
|
19101
19236
|
{
|
|
19102
19237
|
$flexDirection: "column",
|
|
@@ -19105,7 +19240,7 @@ var Plan2 = ({
|
|
|
19105
19240
|
$marginTop: "0.5rem",
|
|
19106
19241
|
children: credits.map((credit, idx) => {
|
|
19107
19242
|
return /* @__PURE__ */ jsxs37(Flex, { $gap: "1rem", children: [
|
|
19108
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */
|
|
19243
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx47(
|
|
19109
19244
|
Icon3,
|
|
19110
19245
|
{
|
|
19111
19246
|
name: credit.icon,
|
|
@@ -19114,7 +19249,7 @@ var Plan2 = ({
|
|
|
19114
19249
|
rounded: true
|
|
19115
19250
|
}
|
|
19116
19251
|
),
|
|
19117
|
-
credit.name && /* @__PURE__ */
|
|
19252
|
+
credit.name && /* @__PURE__ */ jsx47(
|
|
19118
19253
|
Flex,
|
|
19119
19254
|
{
|
|
19120
19255
|
$flexDirection: "column",
|
|
@@ -19124,7 +19259,7 @@ var Plan2 = ({
|
|
|
19124
19259
|
credit.quantity,
|
|
19125
19260
|
" ",
|
|
19126
19261
|
getFeatureName(credit, credit.quantity),
|
|
19127
|
-
credit.period && /* @__PURE__ */ jsxs37(
|
|
19262
|
+
credit.period && /* @__PURE__ */ jsxs37(Fragment24, { children: [
|
|
19128
19263
|
" ",
|
|
19129
19264
|
t2("per"),
|
|
19130
19265
|
" ",
|
|
@@ -19137,7 +19272,7 @@ var Plan2 = ({
|
|
|
19137
19272
|
})
|
|
19138
19273
|
}
|
|
19139
19274
|
),
|
|
19140
|
-
isActivePlan && /* @__PURE__ */
|
|
19275
|
+
isActivePlan && /* @__PURE__ */ jsx47(
|
|
19141
19276
|
Flex,
|
|
19142
19277
|
{
|
|
19143
19278
|
$position: "absolute",
|
|
@@ -19146,7 +19281,7 @@ var Plan2 = ({
|
|
|
19146
19281
|
$backgroundColor: settings.theme.primary,
|
|
19147
19282
|
$borderRadius: "9999px",
|
|
19148
19283
|
$padding: "0.125rem 0.85rem",
|
|
19149
|
-
children: /* @__PURE__ */
|
|
19284
|
+
children: /* @__PURE__ */ jsx47(
|
|
19150
19285
|
Text,
|
|
19151
19286
|
{
|
|
19152
19287
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -19169,15 +19304,17 @@ var Plan2 = ({
|
|
|
19169
19304
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
19170
19305
|
children: [
|
|
19171
19306
|
layout.plans.showEntitlements && /* @__PURE__ */ jsxs37(Flex, { $flexDirection: "column", $gap: "1rem", $flexGrow: 1, children: [
|
|
19172
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */
|
|
19307
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx47(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx47(Text, { children: t2("Everything in", {
|
|
19173
19308
|
plan: plans[index - 1].name
|
|
19174
19309
|
}) }) }),
|
|
19175
|
-
plan.entitlements.map((entitlement, idx) => /* @__PURE__ */
|
|
19310
|
+
plan.entitlements.map((entitlement, idx) => /* @__PURE__ */ jsx47(
|
|
19176
19311
|
Entitlement,
|
|
19177
19312
|
{
|
|
19178
19313
|
entitlement,
|
|
19179
|
-
|
|
19180
|
-
selectedPeriod
|
|
19314
|
+
credits,
|
|
19315
|
+
selectedPeriod,
|
|
19316
|
+
showCredits,
|
|
19317
|
+
sharedProps: { layout }
|
|
19181
19318
|
},
|
|
19182
19319
|
idx
|
|
19183
19320
|
)).slice(0, count?.limit ?? VISIBLE_ENTITLEMENT_COUNT),
|
|
@@ -19189,14 +19326,14 @@ var Plan2 = ({
|
|
|
19189
19326
|
$gap: "0.5rem",
|
|
19190
19327
|
$marginTop: "1rem",
|
|
19191
19328
|
children: [
|
|
19192
|
-
/* @__PURE__ */
|
|
19329
|
+
/* @__PURE__ */ jsx47(
|
|
19193
19330
|
Icon3,
|
|
19194
19331
|
{
|
|
19195
19332
|
name: isExpanded ? "chevron-up" : "chevron-down",
|
|
19196
19333
|
color: "#D0D0D0"
|
|
19197
19334
|
}
|
|
19198
19335
|
),
|
|
19199
|
-
/* @__PURE__ */
|
|
19336
|
+
/* @__PURE__ */ jsx47(
|
|
19200
19337
|
Text,
|
|
19201
19338
|
{
|
|
19202
19339
|
onClick: () => handleToggleShowAll(plan.id),
|
|
@@ -19224,7 +19361,7 @@ var Plan2 = ({
|
|
|
19224
19361
|
$gap: "0.25rem",
|
|
19225
19362
|
$padding: "0.625rem 0",
|
|
19226
19363
|
children: [
|
|
19227
|
-
/* @__PURE__ */
|
|
19364
|
+
/* @__PURE__ */ jsx47(
|
|
19228
19365
|
Icon3,
|
|
19229
19366
|
{
|
|
19230
19367
|
name: "check-rounded",
|
|
@@ -19232,55 +19369,52 @@ var Plan2 = ({
|
|
|
19232
19369
|
color: settings.theme.primary
|
|
19233
19370
|
}
|
|
19234
19371
|
),
|
|
19235
|
-
/* @__PURE__ */
|
|
19372
|
+
/* @__PURE__ */ jsx47(Text, { $size: 15, $leading: 1, children: t2("Current plan") })
|
|
19236
19373
|
]
|
|
19237
19374
|
}
|
|
19238
|
-
) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
|
|
19262
|
-
|
|
19263
|
-
|
|
19264
|
-
|
|
19265
|
-
|
|
19266
|
-
|
|
19267
|
-
|
|
19268
|
-
|
|
19269
|
-
|
|
19270
|
-
|
|
19375
|
+
) : showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs37(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
19376
|
+
/* @__PURE__ */ jsx47(
|
|
19377
|
+
Button,
|
|
19378
|
+
{
|
|
19379
|
+
type: "button",
|
|
19380
|
+
disabled: (isHydratedPlan(plan) && !plan.valid || !canCheckout) && !plan.custom,
|
|
19381
|
+
...index > currentPlanIndex ? {
|
|
19382
|
+
$size: layout.upgrade.buttonSize,
|
|
19383
|
+
$color: layout.upgrade.buttonStyle,
|
|
19384
|
+
$variant: "filled"
|
|
19385
|
+
} : {
|
|
19386
|
+
$size: layout.downgrade.buttonSize,
|
|
19387
|
+
$color: layout.downgrade.buttonStyle,
|
|
19388
|
+
$variant: "outline"
|
|
19389
|
+
},
|
|
19390
|
+
...plan.custom ? {
|
|
19391
|
+
as: "a",
|
|
19392
|
+
href: plan.customPlanConfig?.ctaWebSite ?? "#",
|
|
19393
|
+
target: "_blank",
|
|
19394
|
+
rel: "noreferrer"
|
|
19395
|
+
} : sharedProps.callToActionUrl ? {
|
|
19396
|
+
as: "a",
|
|
19397
|
+
href: sharedProps.callToActionUrl,
|
|
19398
|
+
target: callToActionTarget,
|
|
19399
|
+
rel: "noreferrer"
|
|
19400
|
+
} : {
|
|
19401
|
+
onClick: () => {
|
|
19402
|
+
sharedProps.onCallToAction?.(plan);
|
|
19403
|
+
if (!isStandalone && isHydratedPlan(plan) && !plan.custom) {
|
|
19404
|
+
setCheckoutState({
|
|
19405
|
+
period: selectedPeriod,
|
|
19406
|
+
planId: isActivePlan ? null : plan.id,
|
|
19407
|
+
usage: false
|
|
19408
|
+
});
|
|
19409
|
+
}
|
|
19271
19410
|
}
|
|
19272
|
-
}
|
|
19273
|
-
|
|
19274
|
-
|
|
19275
|
-
|
|
19276
|
-
|
|
19277
|
-
|
|
19278
|
-
|
|
19279
|
-
content: /* @__PURE__ */ jsx46(Text, { children: t2("Current usage exceeds the limit of this plan.") })
|
|
19280
|
-
}
|
|
19281
|
-
) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
|
|
19282
|
-
}
|
|
19283
|
-
)
|
|
19411
|
+
},
|
|
19412
|
+
$fullWidth: true,
|
|
19413
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t2("Talk to support") : isHydratedPlan(plan) && !plan.valid ? /* @__PURE__ */ jsx47(Text, { as: Box, $align: "center", children: t2("Over plan limit") }) : isHydratedPlan(plan) && plan.companyCanTrial && plan.isTrialable ? t2("Start X day trial", { days: plan.trialDays }) : t2("Choose plan")
|
|
19414
|
+
}
|
|
19415
|
+
),
|
|
19416
|
+
isHydratedPlan(plan) && !plan.valid && /* @__PURE__ */ jsx47(UsageViolationText, { violations: plan.usageViolations })
|
|
19417
|
+
] })
|
|
19284
19418
|
]
|
|
19285
19419
|
}
|
|
19286
19420
|
)
|
|
@@ -19290,7 +19424,7 @@ var Plan2 = ({
|
|
|
19290
19424
|
};
|
|
19291
19425
|
|
|
19292
19426
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
19293
|
-
import { Fragment as
|
|
19427
|
+
import { Fragment as Fragment26, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
19294
19428
|
var resolveDesignProps8 = (props) => {
|
|
19295
19429
|
return {
|
|
19296
19430
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -19394,7 +19528,7 @@ var PricingTable = forwardRef12(
|
|
|
19394
19528
|
setEntitlementCounts(plans.reduce(entitlementCountsReducer, {}));
|
|
19395
19529
|
}, [plans]);
|
|
19396
19530
|
if (isPending) {
|
|
19397
|
-
return /* @__PURE__ */
|
|
19531
|
+
return /* @__PURE__ */ jsx48(
|
|
19398
19532
|
Flex,
|
|
19399
19533
|
{
|
|
19400
19534
|
$width: "100%",
|
|
@@ -19402,12 +19536,12 @@ var PricingTable = forwardRef12(
|
|
|
19402
19536
|
$alignItems: "center",
|
|
19403
19537
|
$justifyContent: "center",
|
|
19404
19538
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
19405
|
-
children: /* @__PURE__ */
|
|
19539
|
+
children: /* @__PURE__ */ jsx48(Loader, { $size: "2xl" })
|
|
19406
19540
|
}
|
|
19407
19541
|
);
|
|
19408
19542
|
}
|
|
19409
|
-
const Wrapper = isStandalone ? Container :
|
|
19410
|
-
return /* @__PURE__ */
|
|
19543
|
+
const Wrapper = isStandalone ? Container : Fragment25;
|
|
19544
|
+
return /* @__PURE__ */ jsx48(Wrapper, { children: /* @__PURE__ */ jsxs38(
|
|
19411
19545
|
FussyChild,
|
|
19412
19546
|
{
|
|
19413
19547
|
ref,
|
|
@@ -19432,8 +19566,8 @@ var PricingTable = forwardRef12(
|
|
|
19432
19566
|
}
|
|
19433
19567
|
},
|
|
19434
19568
|
children: [
|
|
19435
|
-
/* @__PURE__ */
|
|
19436
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */
|
|
19569
|
+
/* @__PURE__ */ jsx48(Text, { display: props.header.fontStyle, children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t2("Plans") }),
|
|
19570
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx48(
|
|
19437
19571
|
PeriodToggle,
|
|
19438
19572
|
{
|
|
19439
19573
|
options: periods,
|
|
@@ -19448,7 +19582,7 @@ var PricingTable = forwardRef12(
|
|
|
19448
19582
|
]
|
|
19449
19583
|
}
|
|
19450
19584
|
),
|
|
19451
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */
|
|
19585
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx48(
|
|
19452
19586
|
Box,
|
|
19453
19587
|
{
|
|
19454
19588
|
$display: "grid",
|
|
@@ -19456,7 +19590,7 @@ var PricingTable = forwardRef12(
|
|
|
19456
19590
|
$gap: "1rem",
|
|
19457
19591
|
children: plans.map((plan, index, self2) => {
|
|
19458
19592
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.yearlyPrice && !plan.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
|
|
19459
|
-
return /* @__PURE__ */
|
|
19593
|
+
return /* @__PURE__ */ jsx48(
|
|
19460
19594
|
Plan2,
|
|
19461
19595
|
{
|
|
19462
19596
|
plan,
|
|
@@ -19478,17 +19612,17 @@ var PricingTable = forwardRef12(
|
|
|
19478
19612
|
}
|
|
19479
19613
|
)
|
|
19480
19614
|
] }),
|
|
19481
|
-
/* @__PURE__ */
|
|
19482
|
-
props.header.isVisible && /* @__PURE__ */
|
|
19615
|
+
/* @__PURE__ */ jsx48(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs38(Fragment26, { children: [
|
|
19616
|
+
props.header.isVisible && /* @__PURE__ */ jsx48(
|
|
19483
19617
|
Flex,
|
|
19484
19618
|
{
|
|
19485
19619
|
$justifyContent: "space-between",
|
|
19486
19620
|
$alignItems: "center",
|
|
19487
19621
|
$marginBottom: "1rem",
|
|
19488
|
-
children: /* @__PURE__ */
|
|
19622
|
+
children: /* @__PURE__ */ jsx48(Text, { display: props.header.fontStyle, children: t2("Add-ons") })
|
|
19489
19623
|
}
|
|
19490
19624
|
),
|
|
19491
|
-
/* @__PURE__ */
|
|
19625
|
+
/* @__PURE__ */ jsx48(
|
|
19492
19626
|
Box,
|
|
19493
19627
|
{
|
|
19494
19628
|
$display: "grid",
|
|
@@ -19496,7 +19630,7 @@ var PricingTable = forwardRef12(
|
|
|
19496
19630
|
$gap: "1rem",
|
|
19497
19631
|
children: addOns.map((addOn, index) => {
|
|
19498
19632
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.yearlyPrice && !addOn.monthlyPrice ? "year" /* Year */ : "month" /* Month */;
|
|
19499
|
-
return /* @__PURE__ */
|
|
19633
|
+
return /* @__PURE__ */ jsx48(
|
|
19500
19634
|
AddOn2,
|
|
19501
19635
|
{
|
|
19502
19636
|
addOn,
|
|
@@ -19523,7 +19657,7 @@ PricingTable.displayName = "PricingTable";
|
|
|
19523
19657
|
|
|
19524
19658
|
// src/components/elements/text/Text.tsx
|
|
19525
19659
|
import { forwardRef as forwardRef13 } from "react";
|
|
19526
|
-
import { jsx as
|
|
19660
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
19527
19661
|
var resolveDesignProps9 = (props) => {
|
|
19528
19662
|
return {
|
|
19529
19663
|
text: {
|
|
@@ -19535,7 +19669,7 @@ var resolveDesignProps9 = (props) => {
|
|
|
19535
19669
|
};
|
|
19536
19670
|
var TextElement = forwardRef13(({ children, className, ...rest }, ref) => {
|
|
19537
19671
|
const props = resolveDesignProps9(rest);
|
|
19538
|
-
return /* @__PURE__ */
|
|
19672
|
+
return /* @__PURE__ */ jsx49(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx49(
|
|
19539
19673
|
Text,
|
|
19540
19674
|
{
|
|
19541
19675
|
display: props.text.fontStyle,
|
|
@@ -19549,7 +19683,7 @@ TextElement.displayName = "Text";
|
|
|
19549
19683
|
|
|
19550
19684
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
19551
19685
|
import { forwardRef as forwardRef14, useMemo as useMemo27 } from "react";
|
|
19552
|
-
import { jsx as
|
|
19686
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
19553
19687
|
var buttonStyles = {
|
|
19554
19688
|
primary: {
|
|
19555
19689
|
color: "primary",
|
|
@@ -19585,7 +19719,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
|
|
|
19585
19719
|
if (!hasActiveSubscription) {
|
|
19586
19720
|
return null;
|
|
19587
19721
|
}
|
|
19588
|
-
return /* @__PURE__ */
|
|
19722
|
+
return /* @__PURE__ */ jsx50(
|
|
19589
19723
|
Element,
|
|
19590
19724
|
{
|
|
19591
19725
|
as: Flex,
|
|
@@ -19593,7 +19727,7 @@ var UnsubscribeButton = forwardRef14(({ children, className, ...rest }, ref) =>
|
|
|
19593
19727
|
className,
|
|
19594
19728
|
$flexDirection: "column",
|
|
19595
19729
|
$gap: "2rem",
|
|
19596
|
-
children: /* @__PURE__ */
|
|
19730
|
+
children: /* @__PURE__ */ jsx50(
|
|
19597
19731
|
Button,
|
|
19598
19732
|
{
|
|
19599
19733
|
type: "button",
|
|
@@ -19615,7 +19749,7 @@ UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
|
19615
19749
|
|
|
19616
19750
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
19617
19751
|
import { forwardRef as forwardRef15, useCallback as useCallback14, useEffect as useEffect10, useMemo as useMemo28, useState as useState19 } from "react";
|
|
19618
|
-
import { jsx as
|
|
19752
|
+
import { jsx as jsx51, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
19619
19753
|
function resolveDesignProps11(props) {
|
|
19620
19754
|
return {
|
|
19621
19755
|
header: {
|
|
@@ -19691,7 +19825,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19691
19825
|
return null;
|
|
19692
19826
|
}
|
|
19693
19827
|
return /* @__PURE__ */ jsxs39(Element, { ref, className, children: [
|
|
19694
|
-
/* @__PURE__ */
|
|
19828
|
+
/* @__PURE__ */ jsx51(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx51(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
19695
19829
|
error ? /* @__PURE__ */ jsxs39(
|
|
19696
19830
|
Flex,
|
|
19697
19831
|
{
|
|
@@ -19701,8 +19835,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19701
19835
|
$alignItems: "center",
|
|
19702
19836
|
$gap: "1rem",
|
|
19703
19837
|
children: [
|
|
19704
|
-
/* @__PURE__ */
|
|
19705
|
-
/* @__PURE__ */
|
|
19838
|
+
/* @__PURE__ */ jsx51(Text, { $weight: 500, $color: "#DB6669", children: t2("There was a problem retrieving your upcoming invoice.") }),
|
|
19839
|
+
/* @__PURE__ */ jsx51(
|
|
19706
19840
|
Button,
|
|
19707
19841
|
{
|
|
19708
19842
|
type: "button",
|
|
@@ -19715,7 +19849,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19715
19849
|
)
|
|
19716
19850
|
]
|
|
19717
19851
|
}
|
|
19718
|
-
) : !isLoading && /* @__PURE__ */
|
|
19852
|
+
) : !isLoading && /* @__PURE__ */ jsx51(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs39(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
19719
19853
|
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs39(Text, { display: props.header.fontStyle, children: [
|
|
19720
19854
|
props.header.prefix,
|
|
19721
19855
|
" ",
|
|
@@ -19728,11 +19862,11 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19728
19862
|
$alignItems: "start",
|
|
19729
19863
|
$gap: "1rem",
|
|
19730
19864
|
children: [
|
|
19731
|
-
props.price.isVisible && /* @__PURE__ */
|
|
19865
|
+
props.price.isVisible && /* @__PURE__ */ jsx51(Text, { display: props.price.fontStyle, $leading: 1, children: formatCurrency(
|
|
19732
19866
|
upcomingInvoice.amountDue,
|
|
19733
19867
|
upcomingInvoice.currency
|
|
19734
19868
|
) }),
|
|
19735
|
-
/* @__PURE__ */
|
|
19869
|
+
/* @__PURE__ */ jsx51(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx51(Text, { display: props.contractEndDate.fontStyle, children: t2("Estimated bill") }) })
|
|
19736
19870
|
]
|
|
19737
19871
|
}
|
|
19738
19872
|
),
|
|
@@ -19744,8 +19878,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19744
19878
|
$alignItems: "start",
|
|
19745
19879
|
$gap: "1rem",
|
|
19746
19880
|
children: [
|
|
19747
|
-
/* @__PURE__ */
|
|
19748
|
-
/* @__PURE__ */
|
|
19881
|
+
/* @__PURE__ */ jsx51(Text, { $weight: 600, children: t2("Remaining balance") }),
|
|
19882
|
+
/* @__PURE__ */ jsx51(Flex, { $flexDirection: "column", $gap: "0.5rem", children: balances.map((item, idx) => /* @__PURE__ */ jsx51(Text, { children: formatCurrency(item.balance, item.currency) }, idx)) })
|
|
19749
19883
|
]
|
|
19750
19884
|
}
|
|
19751
19885
|
),
|
|
@@ -19756,8 +19890,8 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19756
19890
|
$alignItems: "start",
|
|
19757
19891
|
$gap: "1rem",
|
|
19758
19892
|
children: [
|
|
19759
|
-
/* @__PURE__ */
|
|
19760
|
-
/* @__PURE__ */
|
|
19893
|
+
/* @__PURE__ */ jsx51(Text, { $weight: 600, children: t2("Discount") }),
|
|
19894
|
+
/* @__PURE__ */ jsx51(
|
|
19761
19895
|
Flex,
|
|
19762
19896
|
{
|
|
19763
19897
|
$flexDirection: "column",
|
|
@@ -19773,7 +19907,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19773
19907
|
$alignItems: "center",
|
|
19774
19908
|
$gap: "0.5rem",
|
|
19775
19909
|
children: [
|
|
19776
|
-
discount.customerFacingCode && /* @__PURE__ */
|
|
19910
|
+
discount.customerFacingCode && /* @__PURE__ */ jsx51(
|
|
19777
19911
|
Flex,
|
|
19778
19912
|
{
|
|
19779
19913
|
$alignItems: "center",
|
|
@@ -19782,7 +19916,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19782
19916
|
$borderStyle: "solid",
|
|
19783
19917
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
19784
19918
|
$borderRadius: "0.3125rem",
|
|
19785
|
-
children: /* @__PURE__ */
|
|
19919
|
+
children: /* @__PURE__ */ jsx51(
|
|
19786
19920
|
Text,
|
|
19787
19921
|
{
|
|
19788
19922
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -19792,7 +19926,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19792
19926
|
)
|
|
19793
19927
|
}
|
|
19794
19928
|
),
|
|
19795
|
-
/* @__PURE__ */
|
|
19929
|
+
/* @__PURE__ */ jsx51(Box, { children: /* @__PURE__ */ jsx51(Text, { children: typeof discount.percentOff === "number" ? t2("Percent off", {
|
|
19796
19930
|
percent: discount.percentOff
|
|
19797
19931
|
}) : t2("Amount off", {
|
|
19798
19932
|
amount: formatCurrency(
|
|
@@ -19816,7 +19950,7 @@ var UpcomingBill = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
19816
19950
|
]
|
|
19817
19951
|
}
|
|
19818
19952
|
)
|
|
19819
|
-
] }) : /* @__PURE__ */
|
|
19953
|
+
] }) : /* @__PURE__ */ jsx51(Text, { display: "heading2", children: t2("No upcoming invoice") }) })
|
|
19820
19954
|
] });
|
|
19821
19955
|
});
|
|
19822
19956
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -24076,10 +24210,10 @@ function createRenderer(options) {
|
|
|
24076
24210
|
}
|
|
24077
24211
|
|
|
24078
24212
|
// src/components/embed/Embed.tsx
|
|
24079
|
-
import { Fragment as
|
|
24213
|
+
import { Fragment as Fragment27, jsx as jsx52, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
24080
24214
|
var Loading = () => {
|
|
24081
24215
|
const { settings } = useEmbed();
|
|
24082
|
-
return /* @__PURE__ */
|
|
24216
|
+
return /* @__PURE__ */ jsx52(
|
|
24083
24217
|
Flex,
|
|
24084
24218
|
{
|
|
24085
24219
|
$width: "100%",
|
|
@@ -24087,7 +24221,7 @@ var Loading = () => {
|
|
|
24087
24221
|
$alignItems: "center",
|
|
24088
24222
|
$justifyContent: "center",
|
|
24089
24223
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
24090
|
-
children: /* @__PURE__ */
|
|
24224
|
+
children: /* @__PURE__ */ jsx52(Loader, { $color: "#194BFB", $size: "2xl" })
|
|
24091
24225
|
}
|
|
24092
24226
|
);
|
|
24093
24227
|
};
|
|
@@ -24104,14 +24238,14 @@ var Error2 = ({ message }) => {
|
|
|
24104
24238
|
$alignItems: "center",
|
|
24105
24239
|
$justifyContent: "center",
|
|
24106
24240
|
children: [
|
|
24107
|
-
/* @__PURE__ */
|
|
24108
|
-
/* @__PURE__ */
|
|
24241
|
+
/* @__PURE__ */ jsx52(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx52(Text, { display: "heading1", children: "Error" }) }),
|
|
24242
|
+
/* @__PURE__ */ jsx52(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx52(Text, { children: message }) })
|
|
24109
24243
|
]
|
|
24110
24244
|
}
|
|
24111
24245
|
);
|
|
24112
24246
|
};
|
|
24113
24247
|
var SchematicEmbed = ({ id, accessToken }) => {
|
|
24114
|
-
const [children, setChildren] = useState20(/* @__PURE__ */
|
|
24248
|
+
const [children, setChildren] = useState20(/* @__PURE__ */ jsx52(Loading, {}));
|
|
24115
24249
|
const theme = useContext5(et);
|
|
24116
24250
|
const {
|
|
24117
24251
|
data,
|
|
@@ -24161,13 +24295,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
24161
24295
|
return stub();
|
|
24162
24296
|
}
|
|
24163
24297
|
if (error) {
|
|
24164
|
-
return /* @__PURE__ */
|
|
24298
|
+
return /* @__PURE__ */ jsx52(Error2, { message: error.message });
|
|
24165
24299
|
}
|
|
24166
24300
|
if (accessToken?.length === 0) {
|
|
24167
|
-
return /* @__PURE__ */
|
|
24301
|
+
return /* @__PURE__ */ jsx52(Error2, { message: "Please provide an access token." });
|
|
24168
24302
|
}
|
|
24169
24303
|
if (!accessToken?.startsWith("token_")) {
|
|
24170
|
-
return /* @__PURE__ */
|
|
24304
|
+
return /* @__PURE__ */ jsx52(
|
|
24171
24305
|
Error2,
|
|
24172
24306
|
{
|
|
24173
24307
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -24175,9 +24309,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
24175
24309
|
);
|
|
24176
24310
|
}
|
|
24177
24311
|
if (isPending) {
|
|
24178
|
-
return /* @__PURE__ */
|
|
24312
|
+
return /* @__PURE__ */ jsx52(Loading, {});
|
|
24179
24313
|
}
|
|
24180
|
-
return /* @__PURE__ */
|
|
24314
|
+
return /* @__PURE__ */ jsx52(Fragment27, { children });
|
|
24181
24315
|
};
|
|
24182
24316
|
export {
|
|
24183
24317
|
Box,
|