@schematichq/schematic-components 2.25.1 → 2.25.2
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.browser.cjs.js +763 -470
- package/dist/schematic-components.browser.esm.js +743 -450
- package/dist/schematic-components.cjs.js +763 -470
- package/dist/schematic-components.d.ts +358 -2
- package/dist/schematic-components.esm.js +743 -450
- package/package.json +2 -5
|
@@ -3491,7 +3491,7 @@ var require_debounce = __commonJS({
|
|
|
3491
3491
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
3492
3492
|
var nativeMax = Math.max;
|
|
3493
3493
|
var nativeMin = Math.min;
|
|
3494
|
-
function
|
|
3494
|
+
function debounce6(func, wait, options) {
|
|
3495
3495
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
3496
3496
|
if (typeof func != "function") {
|
|
3497
3497
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
@@ -3572,7 +3572,7 @@ var require_debounce = __commonJS({
|
|
|
3572
3572
|
debounced.flush = flush;
|
|
3573
3573
|
return debounced;
|
|
3574
3574
|
}
|
|
3575
|
-
module2.exports =
|
|
3575
|
+
module2.exports = debounce6;
|
|
3576
3576
|
}
|
|
3577
3577
|
});
|
|
3578
3578
|
|
|
@@ -3819,6 +3819,8 @@ var initialContext = {
|
|
|
3819
3819
|
getUpcomingInvoice: stub,
|
|
3820
3820
|
getCustomerBalance: stub,
|
|
3821
3821
|
listInvoices: stub,
|
|
3822
|
+
getCreditUsageByUser: stub,
|
|
3823
|
+
getFeatureUsageByUser: stub,
|
|
3822
3824
|
createSetupIntent: stub,
|
|
3823
3825
|
updatePaymentMethod: stub,
|
|
3824
3826
|
deletePaymentMethod: stub,
|
|
@@ -7110,6 +7112,18 @@ var en_default = {
|
|
|
7110
7112
|
"month, billed yearly": "month, billed yearly",
|
|
7111
7113
|
"month, billed quarterly": "month, billed quarterly",
|
|
7112
7114
|
purchased: "purchased {{date}}",
|
|
7115
|
+
"Usage by user": "Usage by user",
|
|
7116
|
+
"X used by your team this period": "{{amount}} used by your team this period",
|
|
7117
|
+
"Show all X users_one": "Show all {{count}} user",
|
|
7118
|
+
"Show all X users_other": "Show all {{count}} users",
|
|
7119
|
+
"Show top X users_one": "Show top {{count}} user",
|
|
7120
|
+
"Show top X users_other": "Show top {{count}} users",
|
|
7121
|
+
"Show all": "Show all",
|
|
7122
|
+
"Show fewer": "Show fewer",
|
|
7123
|
+
Unattributed: "Unattributed",
|
|
7124
|
+
"There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
|
|
7125
|
+
"plus X more_one": "plus {{count}} more",
|
|
7126
|
+
"plus X more_other": "plus {{count}} more",
|
|
7113
7127
|
usage: {
|
|
7114
7128
|
limited: "{{amount}} of {{allocation}} used",
|
|
7115
7129
|
unlimited: "{{amount}} used"
|
|
@@ -7302,7 +7316,7 @@ var Icon = ({ name, className = "", ...rest }) => {
|
|
|
7302
7316
|
};
|
|
7303
7317
|
|
|
7304
7318
|
// src/context/EmbedProvider.tsx
|
|
7305
|
-
var
|
|
7319
|
+
var import_debounce2 = __toESM(require_debounce());
|
|
7306
7320
|
var import_merge3 = __toESM(require_merge());
|
|
7307
7321
|
var import_react14 = require("react");
|
|
7308
7322
|
var import_styled_components3 = __toESM(require_styled_components_cjs());
|
|
@@ -13572,6 +13586,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
|
|
|
13572
13586
|
}
|
|
13573
13587
|
return cost;
|
|
13574
13588
|
}
|
|
13589
|
+
function calculateQuantityCost(billingPrice, quantity) {
|
|
13590
|
+
if (!billingPrice) {
|
|
13591
|
+
return 0;
|
|
13592
|
+
}
|
|
13593
|
+
if (isTieredPrice(billingPrice)) {
|
|
13594
|
+
return calculateTieredCost(
|
|
13595
|
+
quantity,
|
|
13596
|
+
billingPrice.priceTier,
|
|
13597
|
+
billingPrice.tiersMode
|
|
13598
|
+
);
|
|
13599
|
+
}
|
|
13600
|
+
return quantity * billingPrice.price;
|
|
13601
|
+
}
|
|
13575
13602
|
function getEntitlementCost(entitlement, period = "month", currency) {
|
|
13576
13603
|
const resolvedPeriod = period ?? "month";
|
|
13577
13604
|
const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
|
|
@@ -14636,6 +14663,20 @@ function modifyDate(date, days) {
|
|
|
14636
14663
|
return copy2;
|
|
14637
14664
|
}
|
|
14638
14665
|
|
|
14666
|
+
// src/utils/debounce.ts
|
|
14667
|
+
var import_debounce = __toESM(require_debounce());
|
|
14668
|
+
function debounceByKey(fn, wait, settings) {
|
|
14669
|
+
const debouncedByKey = /* @__PURE__ */ new Map();
|
|
14670
|
+
return (key, ...args) => {
|
|
14671
|
+
let debounced = debouncedByKey.get(key);
|
|
14672
|
+
if (!debounced) {
|
|
14673
|
+
debounced = (0, import_debounce.default)(fn, wait, settings);
|
|
14674
|
+
debouncedByKey.set(key, debounced);
|
|
14675
|
+
}
|
|
14676
|
+
return debounced(key, ...args);
|
|
14677
|
+
};
|
|
14678
|
+
}
|
|
14679
|
+
|
|
14639
14680
|
// src/utils/string.ts
|
|
14640
14681
|
var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
14641
14682
|
"BIF",
|
|
@@ -15640,7 +15681,7 @@ var reducer = (state, action) => {
|
|
|
15640
15681
|
// src/context/EmbedProvider.tsx
|
|
15641
15682
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
15642
15683
|
var getCustomHeaders = (sessionId) => ({
|
|
15643
|
-
"X-Schematic-Components-Version": "2.25.
|
|
15684
|
+
"X-Schematic-Components-Version": "2.25.2",
|
|
15644
15685
|
"X-Schematic-Session-ID": sessionId
|
|
15645
15686
|
});
|
|
15646
15687
|
var normalizeCurrencyFilter = (filter) => {
|
|
@@ -15751,7 +15792,7 @@ var EmbedProvider = ({
|
|
|
15751
15792
|
}
|
|
15752
15793
|
}, [publicApi]);
|
|
15753
15794
|
const debouncedHydratePublic = (0, import_react14.useMemo)(
|
|
15754
|
-
() => (0,
|
|
15795
|
+
() => (0, import_debounce2.default)(
|
|
15755
15796
|
hydratePublic,
|
|
15756
15797
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15757
15798
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15777,7 +15818,7 @@ var EmbedProvider = ({
|
|
|
15777
15818
|
}
|
|
15778
15819
|
}, [checkoutApi]);
|
|
15779
15820
|
const debouncedHydrate = (0, import_react14.useMemo)(
|
|
15780
|
-
() => (0,
|
|
15821
|
+
() => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15781
15822
|
[hydrate]
|
|
15782
15823
|
);
|
|
15783
15824
|
const hydrateComponent = (0, import_react14.useCallback)(
|
|
@@ -15804,7 +15845,7 @@ var EmbedProvider = ({
|
|
|
15804
15845
|
[checkoutApi]
|
|
15805
15846
|
);
|
|
15806
15847
|
const debouncedHydrateComponent = (0, import_react14.useMemo)(
|
|
15807
|
-
() => (0,
|
|
15848
|
+
() => (0, import_debounce2.default)(
|
|
15808
15849
|
hydrateComponent,
|
|
15809
15850
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15810
15851
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15828,7 +15869,7 @@ var EmbedProvider = ({
|
|
|
15828
15869
|
}
|
|
15829
15870
|
}, []);
|
|
15830
15871
|
const debouncedHydrateExternal = (0, import_react14.useMemo)(
|
|
15831
|
-
() => (0,
|
|
15872
|
+
() => (0, import_debounce2.default)(
|
|
15832
15873
|
hydrateExternal,
|
|
15833
15874
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15834
15875
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15839,7 +15880,7 @@ var EmbedProvider = ({
|
|
|
15839
15880
|
return checkoutApi?.createSetupIntent();
|
|
15840
15881
|
}, [checkoutApi]);
|
|
15841
15882
|
const debouncedCreateSetupIntent = (0, import_react14.useMemo)(
|
|
15842
|
-
() => (0,
|
|
15883
|
+
() => (0, import_debounce2.default)(
|
|
15843
15884
|
createSetupIntent,
|
|
15844
15885
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15845
15886
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15862,7 +15903,7 @@ var EmbedProvider = ({
|
|
|
15862
15903
|
[checkoutApi]
|
|
15863
15904
|
);
|
|
15864
15905
|
const debouncedUpdatePaymentMethod = (0, import_react14.useMemo)(
|
|
15865
|
-
() => (0,
|
|
15906
|
+
() => (0, import_debounce2.default)(
|
|
15866
15907
|
updatePaymentMethod,
|
|
15867
15908
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15868
15909
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15885,7 +15926,7 @@ var EmbedProvider = ({
|
|
|
15885
15926
|
[checkoutApi]
|
|
15886
15927
|
);
|
|
15887
15928
|
const debouncedDeletePaymentMethod = (0, import_react14.useMemo)(
|
|
15888
|
-
() => (0,
|
|
15929
|
+
() => (0, import_debounce2.default)(
|
|
15889
15930
|
deletePaymentMethod,
|
|
15890
15931
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15891
15932
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15908,7 +15949,7 @@ var EmbedProvider = ({
|
|
|
15908
15949
|
[checkoutApi]
|
|
15909
15950
|
);
|
|
15910
15951
|
const debouncedCheckout = (0, import_react14.useMemo)(
|
|
15911
|
-
() => (0,
|
|
15952
|
+
() => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15912
15953
|
[checkout]
|
|
15913
15954
|
);
|
|
15914
15955
|
const previewCheckout = (0, import_react14.useCallback)(
|
|
@@ -15928,7 +15969,7 @@ var EmbedProvider = ({
|
|
|
15928
15969
|
return response;
|
|
15929
15970
|
}, [checkoutApi]);
|
|
15930
15971
|
const debouncedUnsubscribe = (0, import_react14.useMemo)(
|
|
15931
|
-
() => (0,
|
|
15972
|
+
() => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15932
15973
|
[unsubscribe]
|
|
15933
15974
|
);
|
|
15934
15975
|
const updateCustomFieldValues = (0, import_react14.useCallback)(
|
|
@@ -15972,7 +16013,7 @@ var EmbedProvider = ({
|
|
|
15972
16013
|
[checkoutApi]
|
|
15973
16014
|
);
|
|
15974
16015
|
const debouncedGetUpcomingInvoice = (0, import_react14.useMemo)(
|
|
15975
|
-
() => (0,
|
|
16016
|
+
() => (0, import_debounce2.default)(
|
|
15976
16017
|
getUpcomingInvoice,
|
|
15977
16018
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15978
16019
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15983,7 +16024,7 @@ var EmbedProvider = ({
|
|
|
15983
16024
|
return checkoutApi?.fetchCustomerBalance();
|
|
15984
16025
|
}, [checkoutApi]);
|
|
15985
16026
|
const debouncedGetCustomerBalance = (0, import_react14.useMemo)(
|
|
15986
|
-
() => (0,
|
|
16027
|
+
() => (0, import_debounce2.default)(
|
|
15987
16028
|
getCustomerBalance,
|
|
15988
16029
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15989
16030
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15994,9 +16035,37 @@ var EmbedProvider = ({
|
|
|
15994
16035
|
return checkoutApi?.listInvoices();
|
|
15995
16036
|
}, [checkoutApi]);
|
|
15996
16037
|
const debouncedListInvoices = (0, import_react14.useMemo)(
|
|
15997
|
-
() => (0,
|
|
16038
|
+
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15998
16039
|
[listInvoices]
|
|
15999
16040
|
);
|
|
16041
|
+
const getCreditUsageByUser = (0, import_react14.useCallback)(
|
|
16042
|
+
async (billingCreditId, limit) => {
|
|
16043
|
+
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
16044
|
+
},
|
|
16045
|
+
[checkoutApi]
|
|
16046
|
+
);
|
|
16047
|
+
const debouncedGetCreditUsageByUser = (0, import_react14.useMemo)(
|
|
16048
|
+
() => debounceByKey(
|
|
16049
|
+
getCreditUsageByUser,
|
|
16050
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
16051
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
16052
|
+
),
|
|
16053
|
+
[getCreditUsageByUser]
|
|
16054
|
+
);
|
|
16055
|
+
const getFeatureUsageByUser = (0, import_react14.useCallback)(
|
|
16056
|
+
async (featureId, limit) => {
|
|
16057
|
+
return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
|
|
16058
|
+
},
|
|
16059
|
+
[checkoutApi]
|
|
16060
|
+
);
|
|
16061
|
+
const debouncedGetFeatureUsageByUser = (0, import_react14.useMemo)(
|
|
16062
|
+
() => debounceByKey(
|
|
16063
|
+
getFeatureUsageByUser,
|
|
16064
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
16065
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
16066
|
+
),
|
|
16067
|
+
[getFeatureUsageByUser]
|
|
16068
|
+
);
|
|
16000
16069
|
const setError = (0, import_react14.useCallback)(
|
|
16001
16070
|
(error) => {
|
|
16002
16071
|
debug(error.message);
|
|
@@ -16162,6 +16231,8 @@ var EmbedProvider = ({
|
|
|
16162
16231
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
16163
16232
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
16164
16233
|
listInvoices: debouncedListInvoices,
|
|
16234
|
+
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
16235
|
+
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
16165
16236
|
finishCheckout,
|
|
16166
16237
|
setError,
|
|
16167
16238
|
setAccessToken,
|
|
@@ -17567,7 +17638,7 @@ var Toggle = import_styled_components14.styled.input.attrs({ type: "checkbox" })
|
|
|
17567
17638
|
`;
|
|
17568
17639
|
|
|
17569
17640
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
17570
|
-
var
|
|
17641
|
+
var import_debounce3 = __toESM(require_debounce());
|
|
17571
17642
|
var import_react28 = require("react");
|
|
17572
17643
|
var import_react_dom = require("react-dom");
|
|
17573
17644
|
|
|
@@ -17752,7 +17823,7 @@ var Tooltip = ({
|
|
|
17752
17823
|
}, [portal, position]);
|
|
17753
17824
|
(0, import_react28.useLayoutEffect)(() => {
|
|
17754
17825
|
updateCoords();
|
|
17755
|
-
const handleResize = (0,
|
|
17826
|
+
const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
|
|
17756
17827
|
window.addEventListener("resize", handleResize);
|
|
17757
17828
|
window.addEventListener("scroll", handleResize, true);
|
|
17758
17829
|
return () => {
|
|
@@ -17912,7 +17983,7 @@ var Root = (0, import_react31.forwardRef)(
|
|
|
17912
17983
|
Root.displayName = "Root";
|
|
17913
17984
|
|
|
17914
17985
|
// src/components/layout/viewport/Viewport.tsx
|
|
17915
|
-
var
|
|
17986
|
+
var import_debounce5 = __toESM(require_debounce());
|
|
17916
17987
|
var import_react49 = require("react");
|
|
17917
17988
|
var import_react_dom3 = require("react-dom");
|
|
17918
17989
|
|
|
@@ -18860,11 +18931,10 @@ var Quantity = ({
|
|
|
18860
18931
|
children: [
|
|
18861
18932
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
|
|
18862
18933
|
formatCurrency(
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
) : (price ?? 0) * entitlement.quantity,
|
|
18934
|
+
calculateQuantityCost(
|
|
18935
|
+
entitlementBillingPrice,
|
|
18936
|
+
entitlement.quantity
|
|
18937
|
+
),
|
|
18868
18938
|
currency
|
|
18869
18939
|
),
|
|
18870
18940
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("sub", { children: [
|
|
@@ -19743,7 +19813,7 @@ var Checkout = ({
|
|
|
19743
19813
|
};
|
|
19744
19814
|
|
|
19745
19815
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
19746
|
-
var
|
|
19816
|
+
var import_debounce4 = __toESM(require_debounce());
|
|
19747
19817
|
var import_react38 = require("react");
|
|
19748
19818
|
|
|
19749
19819
|
// src/components/shared/checkout-dialog/Navigation.tsx
|
|
@@ -20545,7 +20615,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20545
20615
|
}, [handlePreviewCheckout]);
|
|
20546
20616
|
const debouncedPreviewCheckoutRef = (0, import_react38.useRef)(null);
|
|
20547
20617
|
(0, import_react38.useEffect)(() => {
|
|
20548
|
-
const debounced = (0,
|
|
20618
|
+
const debounced = (0, import_debounce4.default)(
|
|
20549
20619
|
(updates) => handlePreviewCheckoutRef.current(updates),
|
|
20550
20620
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
20551
20621
|
TRAILING_DEBOUNCE_SETTINGS
|
|
@@ -22656,6 +22726,29 @@ var EntitlementRow = (props) => {
|
|
|
22656
22726
|
tiersMode
|
|
22657
22727
|
} = entitlementPrice || {};
|
|
22658
22728
|
const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
|
|
22729
|
+
const tierLabel = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
22730
|
+
Text,
|
|
22731
|
+
{
|
|
22732
|
+
style: { opacity: 0.54 },
|
|
22733
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22734
|
+
$color: settings.theme.typography.text.color,
|
|
22735
|
+
children: [
|
|
22736
|
+
t3("Tier-based"),
|
|
22737
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
22738
|
+
PricingTiersTooltip,
|
|
22739
|
+
{
|
|
22740
|
+
portal,
|
|
22741
|
+
feature,
|
|
22742
|
+
period: planPeriod,
|
|
22743
|
+
currency,
|
|
22744
|
+
priceTiers,
|
|
22745
|
+
tiersMode: tiersMode ?? void 0,
|
|
22746
|
+
position: "left"
|
|
22747
|
+
}
|
|
22748
|
+
)
|
|
22749
|
+
]
|
|
22750
|
+
}
|
|
22751
|
+
);
|
|
22659
22752
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22660
22753
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22661
22754
|
quantity,
|
|
@@ -22666,13 +22759,24 @@ var EntitlementRow = (props) => {
|
|
|
22666
22759
|
" ",
|
|
22667
22760
|
getFeatureName(feature, softLimit)
|
|
22668
22761
|
] }) : feature.name }) }),
|
|
22669
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22670
|
-
|
|
22671
|
-
|
|
22672
|
-
|
|
22673
|
-
|
|
22762
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22763
|
+
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
22764
|
+
// quantity, so the row shows it alongside the tier breakdown
|
|
22765
|
+
// rather than leaving the charge unpriced.
|
|
22766
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
|
|
22767
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
|
|
22768
|
+
formatCurrency(
|
|
22769
|
+
calculateQuantityCost(entitlementPrice, quantity),
|
|
22770
|
+
currency
|
|
22771
|
+
),
|
|
22772
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
|
|
22773
|
+
"/",
|
|
22774
|
+
shortenPeriod(planPeriod)
|
|
22775
|
+
] })
|
|
22776
|
+
] }),
|
|
22777
|
+
tiered && tierLabel
|
|
22674
22778
|
] })
|
|
22675
|
-
|
|
22779
|
+
) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
|
|
22676
22780
|
priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
22677
22781
|
t3("then"),
|
|
22678
22782
|
" "
|
|
@@ -22690,29 +22794,7 @@ var EntitlementRow = (props) => {
|
|
|
22690
22794
|
shortenPeriod(planPeriod)
|
|
22691
22795
|
] })
|
|
22692
22796
|
] })
|
|
22693
|
-
] }) :
|
|
22694
|
-
Text,
|
|
22695
|
-
{
|
|
22696
|
-
style: { opacity: 0.54 },
|
|
22697
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22698
|
-
$color: settings.theme.typography.text.color,
|
|
22699
|
-
children: [
|
|
22700
|
-
t3("Tier-based"),
|
|
22701
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
22702
|
-
PricingTiersTooltip,
|
|
22703
|
-
{
|
|
22704
|
-
portal,
|
|
22705
|
-
feature,
|
|
22706
|
-
period: planPeriod,
|
|
22707
|
-
currency,
|
|
22708
|
-
priceTiers,
|
|
22709
|
-
tiersMode: tiersMode ?? void 0,
|
|
22710
|
-
position: "left"
|
|
22711
|
-
}
|
|
22712
|
-
)
|
|
22713
|
-
]
|
|
22714
|
-
}
|
|
22715
|
-
) })
|
|
22797
|
+
] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
|
|
22716
22798
|
] });
|
|
22717
22799
|
}
|
|
22718
22800
|
};
|
|
@@ -22908,12 +22990,18 @@ var SubscriptionSidebar = (0, import_react46.forwardRef)(
|
|
|
22908
22990
|
}, 0);
|
|
22909
22991
|
total += addOnCost;
|
|
22910
22992
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
22911
|
-
(sum, entitlement) => sum +
|
|
22993
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22994
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22995
|
+
entitlement.quantity
|
|
22996
|
+
),
|
|
22912
22997
|
0
|
|
22913
22998
|
);
|
|
22914
22999
|
total += payInAdvanceCost;
|
|
22915
23000
|
const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
|
|
22916
|
-
(sum, entitlement) => sum +
|
|
23001
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
23002
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
23003
|
+
entitlement.quantity
|
|
23004
|
+
),
|
|
22917
23005
|
0
|
|
22918
23006
|
);
|
|
22919
23007
|
total += addOnPayInAdvanceCost;
|
|
@@ -24377,7 +24465,7 @@ var Viewport = (0, import_react49.forwardRef)(
|
|
|
24377
24465
|
const [top, setTop] = (0, import_react49.useState)(0);
|
|
24378
24466
|
(0, import_react49.useLayoutEffect)(() => {
|
|
24379
24467
|
const element = portalRef.current;
|
|
24380
|
-
const setModalY = (0,
|
|
24468
|
+
const setModalY = (0, import_debounce5.default)(() => {
|
|
24381
24469
|
const value = Math.abs(
|
|
24382
24470
|
(element === document.body ? window.scrollY : element.scrollTop) ?? 0
|
|
24383
24471
|
);
|
|
@@ -25091,7 +25179,7 @@ var Invoices = (0, import_react53.forwardRef)(({ className, ...rest }, ref) => {
|
|
|
25091
25179
|
Invoices.displayName = "Invoices";
|
|
25092
25180
|
|
|
25093
25181
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
25094
|
-
var
|
|
25182
|
+
var import_react55 = require("react");
|
|
25095
25183
|
|
|
25096
25184
|
// src/components/elements/metered-features/Meter.tsx
|
|
25097
25185
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
@@ -25219,6 +25307,190 @@ var PriceDetails = ({
|
|
|
25219
25307
|
);
|
|
25220
25308
|
};
|
|
25221
25309
|
|
|
25310
|
+
// src/components/elements/metered-features/UsageByUser.tsx
|
|
25311
|
+
var import_react54 = require("react");
|
|
25312
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
25313
|
+
var COLLAPSED_COUNT = 3;
|
|
25314
|
+
var EXPANDED_COUNT = 20;
|
|
25315
|
+
var toCreditSection = (data) => ({
|
|
25316
|
+
entries: data.entries.map((entry) => ({
|
|
25317
|
+
id: entry.userId,
|
|
25318
|
+
// An entry with no hydrated user record still has an id worth showing —
|
|
25319
|
+
// a blank row identifies nobody.
|
|
25320
|
+
label: entry.user?.name || entry.userId || "",
|
|
25321
|
+
amount: entry.creditsUsed
|
|
25322
|
+
})),
|
|
25323
|
+
total: data.total,
|
|
25324
|
+
totalUsers: data.totalUsers,
|
|
25325
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
|
|
25326
|
+
});
|
|
25327
|
+
var toFeatureSection = (data) => ({
|
|
25328
|
+
entries: data.rows.map((row) => ({
|
|
25329
|
+
id: row.userId,
|
|
25330
|
+
label: row.user?.name || row.userId || "",
|
|
25331
|
+
amount: row.value
|
|
25332
|
+
})),
|
|
25333
|
+
total: data.total,
|
|
25334
|
+
totalUsers: data.totalUsers,
|
|
25335
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
|
|
25336
|
+
});
|
|
25337
|
+
var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
|
|
25338
|
+
var InitialAvatar = ({ label }) => {
|
|
25339
|
+
const { settings } = useEmbed();
|
|
25340
|
+
const isLightBackground = useIsLightBackground();
|
|
25341
|
+
const initial = (label.trim()[0] ?? "?").toUpperCase();
|
|
25342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25343
|
+
Flex,
|
|
25344
|
+
{
|
|
25345
|
+
$alignItems: "center",
|
|
25346
|
+
$justifyContent: "center",
|
|
25347
|
+
$width: "1.75rem",
|
|
25348
|
+
$height: "1.75rem",
|
|
25349
|
+
$flexShrink: 0,
|
|
25350
|
+
$borderRadius: "9999px",
|
|
25351
|
+
$background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
|
|
25352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25353
|
+
Text,
|
|
25354
|
+
{
|
|
25355
|
+
$size: 11,
|
|
25356
|
+
$weight: 500,
|
|
25357
|
+
$color: settings.theme.typography.text.color,
|
|
25358
|
+
children: initial
|
|
25359
|
+
}
|
|
25360
|
+
)
|
|
25361
|
+
}
|
|
25362
|
+
);
|
|
25363
|
+
};
|
|
25364
|
+
var UsageByUser = ({ source, unit }) => {
|
|
25365
|
+
const { t: t3 } = useTranslation();
|
|
25366
|
+
const isLightBackground = useIsLightBackground();
|
|
25367
|
+
const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
|
|
25368
|
+
const [expanded, setExpanded] = (0, import_react54.useState)(false);
|
|
25369
|
+
const [result, setResult] = (0, import_react54.useState)();
|
|
25370
|
+
const [attempt, setAttempt] = (0, import_react54.useState)(0);
|
|
25371
|
+
const { kind, id } = source;
|
|
25372
|
+
const sourceKey = `${kind}:${id}`;
|
|
25373
|
+
const current = result?.sourceKey === sourceKey ? result : void 0;
|
|
25374
|
+
(0, import_react54.useEffect)(() => {
|
|
25375
|
+
let active = true;
|
|
25376
|
+
const apply = (next) => {
|
|
25377
|
+
if (active) {
|
|
25378
|
+
setResult(next);
|
|
25379
|
+
}
|
|
25380
|
+
};
|
|
25381
|
+
const receive = (section) => {
|
|
25382
|
+
if (section) {
|
|
25383
|
+
apply({ sourceKey, section });
|
|
25384
|
+
}
|
|
25385
|
+
};
|
|
25386
|
+
const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
|
|
25387
|
+
if (kind === "credit") {
|
|
25388
|
+
getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25389
|
+
(response) => receive(response && toCreditSection(response.data))
|
|
25390
|
+
).catch(fail);
|
|
25391
|
+
} else {
|
|
25392
|
+
getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25393
|
+
(response) => receive(response && toFeatureSection(response.data))
|
|
25394
|
+
).catch(fail);
|
|
25395
|
+
}
|
|
25396
|
+
return () => {
|
|
25397
|
+
active = false;
|
|
25398
|
+
};
|
|
25399
|
+
}, [
|
|
25400
|
+
attempt,
|
|
25401
|
+
getCreditUsageByUser,
|
|
25402
|
+
getFeatureUsageByUser,
|
|
25403
|
+
id,
|
|
25404
|
+
kind,
|
|
25405
|
+
sourceKey
|
|
25406
|
+
]);
|
|
25407
|
+
const entries = current?.section?.entries;
|
|
25408
|
+
const attributed = (0, import_react54.useMemo)(
|
|
25409
|
+
() => [...entries ?? []].sort((a, b) => b.amount - a.amount),
|
|
25410
|
+
[entries]
|
|
25411
|
+
);
|
|
25412
|
+
const error = current?.error;
|
|
25413
|
+
const total = current?.section?.total ?? 0;
|
|
25414
|
+
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
25415
|
+
const unattributed = current?.section?.unattributed;
|
|
25416
|
+
const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
|
|
25417
|
+
if (error) {
|
|
25418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
25419
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t3("Usage by user") }),
|
|
25420
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t3("There was a problem retrieving usage by user.") }),
|
|
25421
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25422
|
+
Button,
|
|
25423
|
+
{
|
|
25424
|
+
type: "button",
|
|
25425
|
+
onClick: () => setAttempt((prev) => prev + 1),
|
|
25426
|
+
$size: "sm",
|
|
25427
|
+
$variant: "ghost",
|
|
25428
|
+
$fullWidth: false,
|
|
25429
|
+
children: t3("Try again")
|
|
25430
|
+
}
|
|
25431
|
+
)
|
|
25432
|
+
] });
|
|
25433
|
+
}
|
|
25434
|
+
if (attributed.length === 0 && !unattributed) {
|
|
25435
|
+
return null;
|
|
25436
|
+
}
|
|
25437
|
+
const visible = attributed.slice(
|
|
25438
|
+
0,
|
|
25439
|
+
expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
|
|
25440
|
+
);
|
|
25441
|
+
const remaining = Math.max(totalUsers - visible.length, 0);
|
|
25442
|
+
const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
|
|
25443
|
+
const hiddenUsers = Math.max(
|
|
25444
|
+
expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
|
|
25445
|
+
0
|
|
25446
|
+
);
|
|
25447
|
+
const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
|
|
25448
|
+
const expandLabel = totalUsers > EXPANDED_COUNT ? t3("Show top X users", { count: EXPANDED_COUNT }) : hiddenUsers > 0 ? t3("Show all X users", { count: totalUsers }) : t3("Show all");
|
|
25449
|
+
const row = (key, label, amount, muted) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
|
|
25450
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(InitialAvatar, { label: muted ? "?" : label }),
|
|
25451
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25452
|
+
Text,
|
|
25453
|
+
{
|
|
25454
|
+
display: "text",
|
|
25455
|
+
$color: muted ? mutedColor(isLightBackground) : void 0,
|
|
25456
|
+
children: label
|
|
25457
|
+
}
|
|
25458
|
+
) }),
|
|
25459
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25460
|
+
Text,
|
|
25461
|
+
{
|
|
25462
|
+
display: "text",
|
|
25463
|
+
$align: "right",
|
|
25464
|
+
$color: mutedColor(isLightBackground),
|
|
25465
|
+
children: formatAmount(amount)
|
|
25466
|
+
}
|
|
25467
|
+
)
|
|
25468
|
+
] }, key);
|
|
25469
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
25470
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t3("Usage by user") }),
|
|
25471
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t3("X used by your team this period", {
|
|
25472
|
+
amount: formatAmount(total)
|
|
25473
|
+
}) }) }),
|
|
25474
|
+
visible.map(
|
|
25475
|
+
(entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
|
|
25476
|
+
),
|
|
25477
|
+
expanded && unattributed && row("unattributed", t3("Unattributed"), unattributed.amount, true),
|
|
25478
|
+
expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t3("plus X more", { count: remaining }) }) }),
|
|
25479
|
+
shouldShowToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
25480
|
+
ExpandListToggle,
|
|
25481
|
+
{
|
|
25482
|
+
isExpanded: expanded,
|
|
25483
|
+
onToggle: () => setExpanded((prev) => !prev),
|
|
25484
|
+
expandLabel,
|
|
25485
|
+
collapseLabel: t3("Show fewer"),
|
|
25486
|
+
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
|
|
25487
|
+
$marginTop: "0.25rem"
|
|
25488
|
+
}
|
|
25489
|
+
)
|
|
25490
|
+
] });
|
|
25491
|
+
};
|
|
25492
|
+
UsageByUser.displayName = "UsageByUser";
|
|
25493
|
+
|
|
25222
25494
|
// src/components/elements/metered-features/styles.ts
|
|
25223
25495
|
var import_styled_components22 = __toESM(require_styled_components_cjs());
|
|
25224
25496
|
var Container2 = import_styled_components22.styled.div`
|
|
@@ -25238,7 +25510,7 @@ var Container2 = import_styled_components22.styled.div`
|
|
|
25238
25510
|
`;
|
|
25239
25511
|
|
|
25240
25512
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
25241
|
-
var
|
|
25513
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
25242
25514
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
25243
25515
|
const { t: t3 } = useTranslation();
|
|
25244
25516
|
const { data } = useEmbed();
|
|
@@ -25275,9 +25547,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
25275
25547
|
})
|
|
25276
25548
|
);
|
|
25277
25549
|
}
|
|
25278
|
-
return /* @__PURE__ */ (0,
|
|
25550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { display: fontStyle, children: [
|
|
25279
25551
|
acc.join(" \u2022 "),
|
|
25280
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
25552
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25281
25553
|
HardLimitTooltip,
|
|
25282
25554
|
{
|
|
25283
25555
|
feature: entitlement.feature,
|
|
@@ -25307,19 +25579,22 @@ function resolveDesignProps4(props) {
|
|
|
25307
25579
|
isVisible: props.usage?.isVisible ?? true,
|
|
25308
25580
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
25309
25581
|
},
|
|
25582
|
+
usageByUser: {
|
|
25583
|
+
isVisible: props.usageByUser?.isVisible ?? true
|
|
25584
|
+
},
|
|
25310
25585
|
// there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
|
|
25311
25586
|
visibleFeatures: props.visibleFeatures
|
|
25312
25587
|
};
|
|
25313
25588
|
}
|
|
25314
|
-
var MeteredFeatures = (0,
|
|
25589
|
+
var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, ref) => {
|
|
25315
25590
|
const props = resolveDesignProps4(rest);
|
|
25316
|
-
const elementsRef = (0,
|
|
25591
|
+
const elementsRef = (0, import_react55.useRef)([]);
|
|
25317
25592
|
const shouldWrapChildren = useWrapChildren(elementsRef);
|
|
25318
25593
|
const { t: t3 } = useTranslation();
|
|
25319
25594
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
25320
25595
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
25321
25596
|
const isLightBackground = useIsLightBackground();
|
|
25322
|
-
const meteredFeatures = (0,
|
|
25597
|
+
const meteredFeatures = (0, import_react55.useMemo)(() => {
|
|
25323
25598
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
25324
25599
|
(acc, id) => {
|
|
25325
25600
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -25336,7 +25611,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25336
25611
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
25337
25612
|
);
|
|
25338
25613
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
25339
|
-
const creditGroups = (0,
|
|
25614
|
+
const creditGroups = (0, import_react55.useMemo)(
|
|
25340
25615
|
() => withEmptyPlanCreditBalances(
|
|
25341
25616
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
25342
25617
|
listPlanCredits(
|
|
@@ -25347,11 +25622,11 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25347
25622
|
),
|
|
25348
25623
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
25349
25624
|
);
|
|
25350
|
-
const planCreditCompositions = (0,
|
|
25625
|
+
const planCreditCompositions = (0, import_react55.useMemo)(
|
|
25351
25626
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
25352
25627
|
[data?.company?.plan?.includedCreditGrants]
|
|
25353
25628
|
);
|
|
25354
|
-
const resolveLicenseQuantity = (0,
|
|
25629
|
+
const resolveLicenseQuantity = (0, import_react55.useCallback)(
|
|
25355
25630
|
(licenseId) => {
|
|
25356
25631
|
const allocation = findLicenseSource(
|
|
25357
25632
|
data?.featureUsage?.features ?? [],
|
|
@@ -25361,17 +25636,17 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25361
25636
|
},
|
|
25362
25637
|
[data?.featureUsage?.features]
|
|
25363
25638
|
);
|
|
25364
|
-
const purchasableCreditIds = (0,
|
|
25639
|
+
const purchasableCreditIds = (0, import_react55.useMemo)(
|
|
25365
25640
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
25366
25641
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
25367
25642
|
);
|
|
25368
|
-
const [expandedCreditIds, setExpandedCreditIds] = (0,
|
|
25643
|
+
const [expandedCreditIds, setExpandedCreditIds] = (0, import_react55.useState)(
|
|
25369
25644
|
() => /* @__PURE__ */ new Set()
|
|
25370
25645
|
);
|
|
25371
|
-
const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0,
|
|
25646
|
+
const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react55.useState)(
|
|
25372
25647
|
() => /* @__PURE__ */ new Set()
|
|
25373
25648
|
);
|
|
25374
|
-
const toggleFullLedger = (0,
|
|
25649
|
+
const toggleFullLedger = (0, import_react55.useCallback)((id) => {
|
|
25375
25650
|
setFullLedgerCreditIds((prev) => {
|
|
25376
25651
|
const next = new Set(prev);
|
|
25377
25652
|
if (next.has(id)) {
|
|
@@ -25382,7 +25657,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25382
25657
|
return next;
|
|
25383
25658
|
});
|
|
25384
25659
|
}, []);
|
|
25385
|
-
const toggleBalanceDetails = (0,
|
|
25660
|
+
const toggleBalanceDetails = (0, import_react55.useCallback)((id) => {
|
|
25386
25661
|
setExpandedCreditIds((prev) => {
|
|
25387
25662
|
const next = new Set(prev);
|
|
25388
25663
|
if (next.has(id)) {
|
|
@@ -25408,7 +25683,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25408
25683
|
const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
|
|
25409
25684
|
const canCheckout = data?.capabilities?.checkout ?? false;
|
|
25410
25685
|
const showCredits = data?.displaySettings?.showCredits ?? true;
|
|
25411
|
-
return /* @__PURE__ */ (0,
|
|
25686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Container2, { ref, className, children: [
|
|
25412
25687
|
meteredFeatures.reduce((acc, entitlement, index) => {
|
|
25413
25688
|
if (!entitlement.feature) {
|
|
25414
25689
|
return acc;
|
|
@@ -25419,9 +25694,9 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25419
25694
|
});
|
|
25420
25695
|
const { limit } = usageDetails;
|
|
25421
25696
|
acc.push(
|
|
25422
|
-
/* @__PURE__ */ (0,
|
|
25423
|
-
/* @__PURE__ */ (0,
|
|
25424
|
-
props.icon.isVisible && /* @__PURE__ */ (0,
|
|
25697
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
25698
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
|
|
25699
|
+
props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25425
25700
|
Icon3,
|
|
25426
25701
|
{
|
|
25427
25702
|
name: feature.icon,
|
|
@@ -25430,8 +25705,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25430
25705
|
rounded: true
|
|
25431
25706
|
}
|
|
25432
25707
|
),
|
|
25433
|
-
/* @__PURE__ */ (0,
|
|
25434
|
-
/* @__PURE__ */ (0,
|
|
25708
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25709
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25435
25710
|
Flex,
|
|
25436
25711
|
{
|
|
25437
25712
|
ref: (el) => {
|
|
@@ -25442,31 +25717,31 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25442
25717
|
$flexWrap: "wrap",
|
|
25443
25718
|
$gap: "1rem",
|
|
25444
25719
|
children: [
|
|
25445
|
-
/* @__PURE__ */ (0,
|
|
25446
|
-
/* @__PURE__ */ (0,
|
|
25447
|
-
props.description.isVisible && feature.description && /* @__PURE__ */ (0,
|
|
25720
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25721
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
25722
|
+
props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
25448
25723
|
] }),
|
|
25449
|
-
/* @__PURE__ */ (0,
|
|
25724
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25450
25725
|
Box,
|
|
25451
25726
|
{
|
|
25452
25727
|
$flexBasis: "min-content",
|
|
25453
25728
|
$flexGrow: 1,
|
|
25454
25729
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
25455
25730
|
children: [
|
|
25456
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
25457
|
-
typeof limit === "number" && /* @__PURE__ */ (0,
|
|
25731
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25732
|
+
typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25458
25733
|
formatNumber(limit),
|
|
25459
25734
|
" "
|
|
25460
25735
|
] }),
|
|
25461
25736
|
getFeatureName(feature, limit)
|
|
25462
|
-
] }) : typeof usage === "number" && /* @__PURE__ */ (0,
|
|
25737
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25463
25738
|
formatNumber(usage),
|
|
25464
25739
|
" ",
|
|
25465
25740
|
getFeatureName(feature, usage),
|
|
25466
25741
|
" ",
|
|
25467
25742
|
t3("used")
|
|
25468
25743
|
] }) }) }),
|
|
25469
|
-
props.allocation.isVisible && /* @__PURE__ */ (0,
|
|
25744
|
+
props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25470
25745
|
Limit,
|
|
25471
25746
|
{
|
|
25472
25747
|
entitlement,
|
|
@@ -25480,8 +25755,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25480
25755
|
]
|
|
25481
25756
|
}
|
|
25482
25757
|
),
|
|
25483
|
-
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0,
|
|
25484
|
-
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
25758
|
+
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Meter, { entitlement }),
|
|
25759
|
+
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25485
25760
|
Button,
|
|
25486
25761
|
{
|
|
25487
25762
|
type: "button",
|
|
@@ -25494,13 +25769,24 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25494
25769
|
)
|
|
25495
25770
|
] })
|
|
25496
25771
|
] }),
|
|
25497
|
-
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0,
|
|
25772
|
+
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25498
25773
|
PriceDetails,
|
|
25499
25774
|
{
|
|
25500
25775
|
entitlement,
|
|
25501
25776
|
usageDetails,
|
|
25502
25777
|
period
|
|
25503
25778
|
}
|
|
25779
|
+
),
|
|
25780
|
+
props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
|
|
25781
|
+
// they are denominated in the feature's own unit — the same one
|
|
25782
|
+
// the usage line above uses. A credit-burndown feature's credit
|
|
25783
|
+
// spend is broken down separately, under its credit.
|
|
25784
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25785
|
+
UsageByUser,
|
|
25786
|
+
{
|
|
25787
|
+
source: { kind: "feature", id: feature.id },
|
|
25788
|
+
unit: feature
|
|
25789
|
+
}
|
|
25504
25790
|
)
|
|
25505
25791
|
] }, index)
|
|
25506
25792
|
);
|
|
@@ -25514,9 +25800,9 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25514
25800
|
const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
|
|
25515
25801
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
25516
25802
|
const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
|
|
25517
|
-
return /* @__PURE__ */ (0,
|
|
25518
|
-
/* @__PURE__ */ (0,
|
|
25519
|
-
props.icon.isVisible && /* @__PURE__ */ (0,
|
|
25803
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
25804
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
|
|
25805
|
+
props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25520
25806
|
Icon3,
|
|
25521
25807
|
{
|
|
25522
25808
|
name: credit.icon,
|
|
@@ -25525,13 +25811,13 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25525
25811
|
rounded: true
|
|
25526
25812
|
}
|
|
25527
25813
|
),
|
|
25528
|
-
/* @__PURE__ */ (0,
|
|
25529
|
-
/* @__PURE__ */ (0,
|
|
25530
|
-
/* @__PURE__ */ (0,
|
|
25531
|
-
props.description.isVisible && credit.description && /* @__PURE__ */ (0,
|
|
25814
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25815
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25816
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
25817
|
+
props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
25532
25818
|
] }) }),
|
|
25533
|
-
/* @__PURE__ */ (0,
|
|
25534
|
-
props.usage.isVisible && /* @__PURE__ */ (0,
|
|
25819
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
|
|
25820
|
+
props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: t3("X units remaining", {
|
|
25535
25821
|
// Balances burn at rates with up to 10 decimal
|
|
25536
25822
|
// places, so a small remainder must not round to 0.
|
|
25537
25823
|
amount: formatNumber(credit.total.remaining, {
|
|
@@ -25542,7 +25828,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25542
25828
|
credit.total.remaining
|
|
25543
25829
|
)
|
|
25544
25830
|
}) }) }),
|
|
25545
|
-
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0,
|
|
25831
|
+
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25546
25832
|
Button,
|
|
25547
25833
|
{
|
|
25548
25834
|
type: "button",
|
|
@@ -25595,7 +25881,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25595
25881
|
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
25596
25882
|
return (
|
|
25597
25883
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
25598
|
-
/* @__PURE__ */ (0,
|
|
25884
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25599
25885
|
Text,
|
|
25600
25886
|
{
|
|
25601
25887
|
style: { opacity: 0.54 },
|
|
@@ -25608,7 +25894,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25608
25894
|
period: shortenPeriod(composition.period),
|
|
25609
25895
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25610
25896
|
}),
|
|
25611
|
-
renewalDate && /* @__PURE__ */ (0,
|
|
25897
|
+
renewalDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25612
25898
|
" ",
|
|
25613
25899
|
t3("Renews on the day", {
|
|
25614
25900
|
day: formatOrdinal(renewalDate.getDate())
|
|
@@ -25621,12 +25907,12 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25621
25907
|
})()
|
|
25622
25908
|
] })
|
|
25623
25909
|
] }),
|
|
25624
|
-
hasGrants && /* @__PURE__ */ (0,
|
|
25910
|
+
hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25625
25911
|
Box,
|
|
25626
25912
|
{
|
|
25627
25913
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
25628
25914
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
25629
|
-
children: /* @__PURE__ */ (0,
|
|
25915
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
25630
25916
|
TransitionBox,
|
|
25631
25917
|
{
|
|
25632
25918
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -25634,22 +25920,22 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25634
25920
|
children: [
|
|
25635
25921
|
visibleGrants.map((grant, index2) => {
|
|
25636
25922
|
const padding = getRowPadding(index2);
|
|
25637
|
-
return /* @__PURE__ */ (0,
|
|
25638
|
-
/* @__PURE__ */ (0,
|
|
25923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25924
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("X items included in plan", {
|
|
25639
25925
|
amount: grant.quantity,
|
|
25640
25926
|
item: getFeatureName(
|
|
25641
25927
|
credit,
|
|
25642
25928
|
grant.quantity
|
|
25643
25929
|
)
|
|
25644
25930
|
}) }) }),
|
|
25645
|
-
/* @__PURE__ */ (0,
|
|
25931
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25646
25932
|
Box,
|
|
25647
25933
|
{
|
|
25648
25934
|
$display: "table-cell",
|
|
25649
25935
|
$padding: padding,
|
|
25650
25936
|
$textAlign: "right",
|
|
25651
25937
|
$whiteSpace: "nowrap",
|
|
25652
|
-
children: grant.expiresAt && /* @__PURE__ */ (0,
|
|
25938
|
+
children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("Resets", {
|
|
25653
25939
|
date: toPrettyDate(
|
|
25654
25940
|
modifyDate(grant.expiresAt, 1),
|
|
25655
25941
|
{ month: "short" }
|
|
@@ -25657,15 +25943,15 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25657
25943
|
}) })
|
|
25658
25944
|
}
|
|
25659
25945
|
)
|
|
25660
|
-
] }) : /* @__PURE__ */ (0,
|
|
25661
|
-
/* @__PURE__ */ (0,
|
|
25946
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
25947
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item bundle", {
|
|
25662
25948
|
amount: grant.quantity,
|
|
25663
25949
|
item: getFeatureName(credit, 1),
|
|
25664
25950
|
createdAt: toPrettyDate(
|
|
25665
25951
|
grant.createdAt,
|
|
25666
25952
|
{ month: "short" }
|
|
25667
25953
|
)
|
|
25668
|
-
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0,
|
|
25954
|
+
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item auto-topup", {
|
|
25669
25955
|
amount: grant.quantity,
|
|
25670
25956
|
item: getFeatureName(
|
|
25671
25957
|
credit,
|
|
@@ -25675,7 +25961,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25675
25961
|
grant.createdAt,
|
|
25676
25962
|
{ month: "short" }
|
|
25677
25963
|
)
|
|
25678
|
-
}) }) : /* @__PURE__ */ (0,
|
|
25964
|
+
}) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t3("X item grant", {
|
|
25679
25965
|
amount: grant.quantity,
|
|
25680
25966
|
item: getFeatureName(
|
|
25681
25967
|
credit,
|
|
@@ -25686,14 +25972,14 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25686
25972
|
{ month: "short" }
|
|
25687
25973
|
)
|
|
25688
25974
|
}) }) }) }),
|
|
25689
|
-
/* @__PURE__ */ (0,
|
|
25975
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25690
25976
|
Box,
|
|
25691
25977
|
{
|
|
25692
25978
|
$display: "table-cell",
|
|
25693
25979
|
$padding: padding,
|
|
25694
25980
|
$textAlign: "right",
|
|
25695
25981
|
$whiteSpace: "nowrap",
|
|
25696
|
-
children: grant.expiresAt && /* @__PURE__ */ (0,
|
|
25982
|
+
children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t3("Expires", {
|
|
25697
25983
|
date: toPrettyDate(
|
|
25698
25984
|
modifyDate(grant.expiresAt, 1),
|
|
25699
25985
|
{ month: "short" }
|
|
@@ -25703,8 +25989,8 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25703
25989
|
)
|
|
25704
25990
|
] }) }, grant.id);
|
|
25705
25991
|
}),
|
|
25706
|
-
canExpandLedger && /* @__PURE__ */ (0,
|
|
25707
|
-
/* @__PURE__ */ (0,
|
|
25992
|
+
canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $display: "table-row", children: [
|
|
25993
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25708
25994
|
ExpandListToggle,
|
|
25709
25995
|
{
|
|
25710
25996
|
isExpanded: showAllGrants,
|
|
@@ -25713,7 +25999,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25713
25999
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25714
26000
|
}
|
|
25715
26001
|
) }),
|
|
25716
|
-
/* @__PURE__ */ (0,
|
|
26002
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25717
26003
|
Box,
|
|
25718
26004
|
{
|
|
25719
26005
|
$display: "table-cell",
|
|
@@ -25726,7 +26012,7 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25726
26012
|
)
|
|
25727
26013
|
}
|
|
25728
26014
|
),
|
|
25729
|
-
hasGrants && /* @__PURE__ */ (0,
|
|
26015
|
+
hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
25730
26016
|
ExpandListToggle,
|
|
25731
26017
|
{
|
|
25732
26018
|
isExpanded,
|
|
@@ -25735,6 +26021,13 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25735
26021
|
collapseLabel: t3("Hide balance details"),
|
|
25736
26022
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25737
26023
|
}
|
|
26024
|
+
),
|
|
26025
|
+
props.usageByUser.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
26026
|
+
UsageByUser,
|
|
26027
|
+
{
|
|
26028
|
+
source: { kind: "credit", id: credit.id },
|
|
26029
|
+
unit: credit
|
|
26030
|
+
}
|
|
25738
26031
|
)
|
|
25739
26032
|
] }, index);
|
|
25740
26033
|
})
|
|
@@ -25743,11 +26036,11 @@ var MeteredFeatures = (0, import_react54.forwardRef)(({ className, ...rest }, re
|
|
|
25743
26036
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
25744
26037
|
|
|
25745
26038
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25746
|
-
var
|
|
26039
|
+
var import_react57 = require("react");
|
|
25747
26040
|
|
|
25748
26041
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
25749
|
-
var
|
|
25750
|
-
var
|
|
26042
|
+
var import_react56 = require("react");
|
|
26043
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
25751
26044
|
var PaymentElement2 = ({
|
|
25752
26045
|
iconName,
|
|
25753
26046
|
iconTitle,
|
|
@@ -25755,8 +26048,8 @@ var PaymentElement2 = ({
|
|
|
25755
26048
|
paymentLast4
|
|
25756
26049
|
}) => {
|
|
25757
26050
|
const { settings } = useEmbed();
|
|
25758
|
-
return /* @__PURE__ */ (0,
|
|
25759
|
-
iconName && /* @__PURE__ */ (0,
|
|
26051
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
26052
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25760
26053
|
Icon3,
|
|
25761
26054
|
{
|
|
25762
26055
|
name: iconName,
|
|
@@ -25764,15 +26057,15 @@ var PaymentElement2 = ({
|
|
|
25764
26057
|
color: settings.theme.typography.text.color
|
|
25765
26058
|
}
|
|
25766
26059
|
),
|
|
25767
|
-
(label || paymentLast4) && /* @__PURE__ */ (0,
|
|
25768
|
-
label && /* @__PURE__ */ (0,
|
|
26060
|
+
(label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
|
|
26061
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
|
|
25769
26062
|
" ",
|
|
25770
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
26063
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
|
|
25771
26064
|
] })
|
|
25772
26065
|
] });
|
|
25773
26066
|
};
|
|
25774
26067
|
var EmptyPaymentElement = () => {
|
|
25775
|
-
return /* @__PURE__ */ (0,
|
|
26068
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
|
|
25776
26069
|
};
|
|
25777
26070
|
var getPaymentMethodData = ({
|
|
25778
26071
|
accountLast4,
|
|
@@ -25852,12 +26145,12 @@ var PaymentMethodElement = ({
|
|
|
25852
26145
|
const isLightBackground = useIsLightBackground();
|
|
25853
26146
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
25854
26147
|
const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
|
|
25855
|
-
return /* @__PURE__ */ (0,
|
|
25856
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
25857
|
-
/* @__PURE__ */ (0,
|
|
25858
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0,
|
|
26148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
26149
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
26150
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { display: props.header.fontStyle, children: t3("Payment Details") }),
|
|
26151
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t3("Expires in X months", { months: monthsToExpiration }) : t3("Expired") })
|
|
25859
26152
|
] }),
|
|
25860
|
-
/* @__PURE__ */ (0,
|
|
26153
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
25861
26154
|
Flex,
|
|
25862
26155
|
{
|
|
25863
26156
|
$justifyContent: "space-between",
|
|
@@ -25866,8 +26159,8 @@ var PaymentMethodElement = ({
|
|
|
25866
26159
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
25867
26160
|
$borderRadius: "9999px",
|
|
25868
26161
|
children: [
|
|
25869
|
-
paymentMethod ? /* @__PURE__ */ (0,
|
|
25870
|
-
onRemove && /* @__PURE__ */ (0,
|
|
26162
|
+
paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EmptyPaymentElement, {}),
|
|
26163
|
+
onRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25871
26164
|
Text,
|
|
25872
26165
|
{
|
|
25873
26166
|
onClick: onRemove,
|
|
@@ -25877,7 +26170,7 @@ var PaymentMethodElement = ({
|
|
|
25877
26170
|
children: t3("Remove")
|
|
25878
26171
|
}
|
|
25879
26172
|
),
|
|
25880
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0,
|
|
26173
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25881
26174
|
Text,
|
|
25882
26175
|
{
|
|
25883
26176
|
onClick: onEdit,
|
|
@@ -25890,8 +26183,8 @@ var PaymentMethodElement = ({
|
|
|
25890
26183
|
]
|
|
25891
26184
|
}
|
|
25892
26185
|
),
|
|
25893
|
-
hasCustomFields && /* @__PURE__ */ (0,
|
|
25894
|
-
/* @__PURE__ */ (0,
|
|
26186
|
+
hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
|
|
26187
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25895
26188
|
Text,
|
|
25896
26189
|
{
|
|
25897
26190
|
$size: 12,
|
|
@@ -25899,7 +26192,7 @@ var PaymentMethodElement = ({
|
|
|
25899
26192
|
children: field.name
|
|
25900
26193
|
}
|
|
25901
26194
|
),
|
|
25902
|
-
/* @__PURE__ */ (0,
|
|
26195
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25903
26196
|
"span",
|
|
25904
26197
|
{
|
|
25905
26198
|
style: {
|
|
@@ -25920,7 +26213,7 @@ var PaymentListElement = ({
|
|
|
25920
26213
|
const { settings } = useEmbed();
|
|
25921
26214
|
const isLightBackground = useIsLightBackground();
|
|
25922
26215
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
25923
|
-
const expirationDate = (0,
|
|
26216
|
+
const expirationDate = (0, import_react56.useMemo)(() => {
|
|
25924
26217
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
25925
26218
|
if (!cardExpMonth || !cardExpYear) {
|
|
25926
26219
|
return;
|
|
@@ -25931,7 +26224,7 @@ var PaymentListElement = ({
|
|
|
25931
26224
|
}
|
|
25932
26225
|
return `${cardExpMonth}/${formatedYear}`;
|
|
25933
26226
|
}, [paymentMethod]);
|
|
25934
|
-
return /* @__PURE__ */ (0,
|
|
26227
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
25935
26228
|
Flex,
|
|
25936
26229
|
{
|
|
25937
26230
|
$flexDirection: "row",
|
|
@@ -25943,7 +26236,7 @@ var PaymentListElement = ({
|
|
|
25943
26236
|
$borderStyle: "solid",
|
|
25944
26237
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
25945
26238
|
children: [
|
|
25946
|
-
iconName && /* @__PURE__ */ (0,
|
|
26239
|
+
iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25947
26240
|
Icon3,
|
|
25948
26241
|
{
|
|
25949
26242
|
name: iconName,
|
|
@@ -25951,20 +26244,20 @@ var PaymentListElement = ({
|
|
|
25951
26244
|
color: settings.theme.typography.text.color
|
|
25952
26245
|
}
|
|
25953
26246
|
),
|
|
25954
|
-
(label || paymentLast4) && /* @__PURE__ */ (0,
|
|
25955
|
-
label && /* @__PURE__ */ (0,
|
|
26247
|
+
(label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
|
|
26248
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
|
|
25956
26249
|
" ",
|
|
25957
|
-
paymentLast4 && /* @__PURE__ */ (0,
|
|
26250
|
+
paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
|
|
25958
26251
|
] }),
|
|
25959
|
-
expirationDate && /* @__PURE__ */ (0,
|
|
26252
|
+
expirationDate && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25960
26253
|
Box,
|
|
25961
26254
|
{
|
|
25962
26255
|
$flexGrow: 1,
|
|
25963
26256
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
25964
|
-
children: /* @__PURE__ */ (0,
|
|
26257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
|
|
25965
26258
|
}
|
|
25966
26259
|
),
|
|
25967
|
-
/* @__PURE__ */ (0,
|
|
26260
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25968
26261
|
Text,
|
|
25969
26262
|
{
|
|
25970
26263
|
onClick: () => {
|
|
@@ -25977,7 +26270,7 @@ var PaymentListElement = ({
|
|
|
25977
26270
|
children: t("Set default")
|
|
25978
26271
|
}
|
|
25979
26272
|
) }),
|
|
25980
|
-
/* @__PURE__ */ (0,
|
|
26273
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
25981
26274
|
Icon3,
|
|
25982
26275
|
{
|
|
25983
26276
|
tabIndex: 0,
|
|
@@ -25999,7 +26292,7 @@ var PaymentListElement = ({
|
|
|
25999
26292
|
};
|
|
26000
26293
|
|
|
26001
26294
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
26002
|
-
var
|
|
26295
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
26003
26296
|
var resolveDesignProps5 = (props) => {
|
|
26004
26297
|
return {
|
|
26005
26298
|
header: {
|
|
@@ -26012,10 +26305,10 @@ var resolveDesignProps5 = (props) => {
|
|
|
26012
26305
|
}
|
|
26013
26306
|
};
|
|
26014
26307
|
};
|
|
26015
|
-
var PaymentMethod = (0,
|
|
26308
|
+
var PaymentMethod = (0, import_react57.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
26016
26309
|
const props = resolveDesignProps5(rest);
|
|
26017
26310
|
const { data, setLayout } = useEmbed();
|
|
26018
|
-
const { paymentMethod, monthsToExpiration } = (0,
|
|
26311
|
+
const { paymentMethod, monthsToExpiration } = (0, import_react57.useMemo)(() => {
|
|
26019
26312
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
26020
26313
|
let monthsToExpiration2;
|
|
26021
26314
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -26034,7 +26327,7 @@ var PaymentMethod = (0, import_react56.forwardRef)(({ children, className, porta
|
|
|
26034
26327
|
monthsToExpiration: monthsToExpiration2
|
|
26035
26328
|
};
|
|
26036
26329
|
}, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
|
|
26037
|
-
return /* @__PURE__ */ (0,
|
|
26330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
26038
26331
|
PaymentMethodElement,
|
|
26039
26332
|
{
|
|
26040
26333
|
customCheckoutFields: data?.customCheckoutFields,
|
|
@@ -26219,8 +26512,8 @@ var loadStripe = function loadStripe2() {
|
|
|
26219
26512
|
};
|
|
26220
26513
|
|
|
26221
26514
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
26222
|
-
var
|
|
26223
|
-
var
|
|
26515
|
+
var import_react58 = require("react");
|
|
26516
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
26224
26517
|
var resolveDesignProps6 = () => {
|
|
26225
26518
|
return {
|
|
26226
26519
|
header: {
|
|
@@ -26248,7 +26541,7 @@ var PaymentMethodDetails = ({
|
|
|
26248
26541
|
updatePaymentMethod,
|
|
26249
26542
|
deletePaymentMethod
|
|
26250
26543
|
} = useEmbed();
|
|
26251
|
-
const { defaultPaymentMethod, paymentMethods, subscription } = (0,
|
|
26544
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react58.useMemo)(() => {
|
|
26252
26545
|
return {
|
|
26253
26546
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
26254
26547
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -26261,13 +26554,13 @@ var PaymentMethodDetails = ({
|
|
|
26261
26554
|
]);
|
|
26262
26555
|
const isLightBackground = useIsLightBackground();
|
|
26263
26556
|
const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
|
|
26264
|
-
const [isLoading, setIsLoading] = (0,
|
|
26265
|
-
const [error, setError] = (0,
|
|
26266
|
-
const [showPaymentForm, setShowPaymentForm] = (0,
|
|
26267
|
-
const [stripe, setStripe] = (0,
|
|
26268
|
-
const [setupIntent, setSetupIntent] = (0,
|
|
26269
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0,
|
|
26270
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] = (0,
|
|
26557
|
+
const [isLoading, setIsLoading] = (0, import_react58.useState)(!initialPaymentMethod);
|
|
26558
|
+
const [error, setError] = (0, import_react58.useState)();
|
|
26559
|
+
const [showPaymentForm, setShowPaymentForm] = (0, import_react58.useState)(false);
|
|
26560
|
+
const [stripe, setStripe] = (0, import_react58.useState)(null);
|
|
26561
|
+
const [setupIntent, setSetupIntent] = (0, import_react58.useState)();
|
|
26562
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react58.useState)(false);
|
|
26563
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react58.useState)(initialPaymentMethod);
|
|
26271
26564
|
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
26272
26565
|
stripe,
|
|
26273
26566
|
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
@@ -26280,7 +26573,7 @@ var PaymentMethodDetails = ({
|
|
|
26280
26573
|
},
|
|
26281
26574
|
autoConfirm: true
|
|
26282
26575
|
});
|
|
26283
|
-
const monthsToExpiration = (0,
|
|
26576
|
+
const monthsToExpiration = (0, import_react58.useMemo)(() => {
|
|
26284
26577
|
let expiration;
|
|
26285
26578
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
26286
26579
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -26303,8 +26596,8 @@ var PaymentMethodDetails = ({
|
|
|
26303
26596
|
const toggleShowPaymentMethods = () => {
|
|
26304
26597
|
setShowDifferentPaymentMethods((prev) => !prev);
|
|
26305
26598
|
};
|
|
26306
|
-
const locale = (0,
|
|
26307
|
-
const initializeStripe = (0,
|
|
26599
|
+
const locale = (0, import_react58.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
|
|
26600
|
+
const initializeStripe = (0, import_react58.useCallback)(() => {
|
|
26308
26601
|
if (stripe || !setupIntent) {
|
|
26309
26602
|
return;
|
|
26310
26603
|
}
|
|
@@ -26327,7 +26620,7 @@ var PaymentMethodDetails = ({
|
|
|
26327
26620
|
setShowPaymentForm(false);
|
|
26328
26621
|
});
|
|
26329
26622
|
}, [t3, stripe, setupIntent, locale]);
|
|
26330
|
-
const initializePaymentMethod = (0,
|
|
26623
|
+
const initializePaymentMethod = (0, import_react58.useCallback)(() => {
|
|
26331
26624
|
const pending = createSetupIntent() ?? Promise.resolve(void 0);
|
|
26332
26625
|
return pending.then((response) => {
|
|
26333
26626
|
if (response) {
|
|
@@ -26342,7 +26635,7 @@ var PaymentMethodDetails = ({
|
|
|
26342
26635
|
setIsLoading(false);
|
|
26343
26636
|
});
|
|
26344
26637
|
}, [t3, createSetupIntent]);
|
|
26345
|
-
const handleUpdatePaymentMethod = (0,
|
|
26638
|
+
const handleUpdatePaymentMethod = (0, import_react58.useCallback)(
|
|
26346
26639
|
async (paymentMethodId) => {
|
|
26347
26640
|
try {
|
|
26348
26641
|
setIsLoading(true);
|
|
@@ -26364,7 +26657,7 @@ var PaymentMethodDetails = ({
|
|
|
26364
26657
|
},
|
|
26365
26658
|
[t3, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
|
|
26366
26659
|
);
|
|
26367
|
-
const handleDeletePaymentMethod = (0,
|
|
26660
|
+
const handleDeletePaymentMethod = (0, import_react58.useCallback)(
|
|
26368
26661
|
async (paymentMethodId) => {
|
|
26369
26662
|
try {
|
|
26370
26663
|
setIsLoading(true);
|
|
@@ -26380,10 +26673,10 @@ var PaymentMethodDetails = ({
|
|
|
26380
26673
|
},
|
|
26381
26674
|
[t3, deletePaymentMethod]
|
|
26382
26675
|
);
|
|
26383
|
-
(0,
|
|
26676
|
+
(0, import_react58.useEffect)(() => {
|
|
26384
26677
|
initializeStripe();
|
|
26385
26678
|
}, [initializeStripe]);
|
|
26386
|
-
(0,
|
|
26679
|
+
(0, import_react58.useEffect)(() => {
|
|
26387
26680
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
26388
26681
|
initializePaymentMethod();
|
|
26389
26682
|
}
|
|
@@ -26393,7 +26686,7 @@ var PaymentMethodDetails = ({
|
|
|
26393
26686
|
showPaymentForm,
|
|
26394
26687
|
initializePaymentMethod
|
|
26395
26688
|
]);
|
|
26396
|
-
return /* @__PURE__ */ (0,
|
|
26689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
26397
26690
|
Flex,
|
|
26398
26691
|
{
|
|
26399
26692
|
$position: "relative",
|
|
@@ -26401,7 +26694,7 @@ var PaymentMethodDetails = ({
|
|
|
26401
26694
|
$flexGrow: 1,
|
|
26402
26695
|
$gap: "1.5rem",
|
|
26403
26696
|
children: [
|
|
26404
|
-
/* @__PURE__ */ (0,
|
|
26697
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26405
26698
|
Flex,
|
|
26406
26699
|
{
|
|
26407
26700
|
$position: "absolute",
|
|
@@ -26410,7 +26703,7 @@ var PaymentMethodDetails = ({
|
|
|
26410
26703
|
$alignItems: "center",
|
|
26411
26704
|
$width: "100%",
|
|
26412
26705
|
$height: "100%",
|
|
26413
|
-
children: /* @__PURE__ */ (0,
|
|
26706
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26414
26707
|
Loader,
|
|
26415
26708
|
{
|
|
26416
26709
|
$color: settings.theme.primary,
|
|
@@ -26420,7 +26713,7 @@ var PaymentMethodDetails = ({
|
|
|
26420
26713
|
)
|
|
26421
26714
|
}
|
|
26422
26715
|
),
|
|
26423
|
-
/* @__PURE__ */ (0,
|
|
26716
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
26424
26717
|
Flex,
|
|
26425
26718
|
{
|
|
26426
26719
|
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
@@ -26437,7 +26730,7 @@ var PaymentMethodDetails = ({
|
|
|
26437
26730
|
}
|
|
26438
26731
|
},
|
|
26439
26732
|
children: [
|
|
26440
|
-
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0,
|
|
26733
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
26441
26734
|
import_react_stripe_js2.Elements,
|
|
26442
26735
|
{
|
|
26443
26736
|
stripe,
|
|
@@ -26468,7 +26761,7 @@ var PaymentMethodDetails = ({
|
|
|
26468
26761
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
26469
26762
|
},
|
|
26470
26763
|
children: [
|
|
26471
|
-
/* @__PURE__ */ (0,
|
|
26764
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26472
26765
|
PaymentForm,
|
|
26473
26766
|
{
|
|
26474
26767
|
financeData,
|
|
@@ -26479,7 +26772,7 @@ var PaymentMethodDetails = ({
|
|
|
26479
26772
|
}
|
|
26480
26773
|
}
|
|
26481
26774
|
),
|
|
26482
|
-
currentPaymentMethod && /* @__PURE__ */ (0,
|
|
26775
|
+
currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26483
26776
|
Text,
|
|
26484
26777
|
{
|
|
26485
26778
|
onClick: focusExistingPaymentMethods,
|
|
@@ -26492,8 +26785,8 @@ var PaymentMethodDetails = ({
|
|
|
26492
26785
|
) })
|
|
26493
26786
|
]
|
|
26494
26787
|
}
|
|
26495
|
-
) : /* @__PURE__ */ (0,
|
|
26496
|
-
/* @__PURE__ */ (0,
|
|
26788
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
26789
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26497
26790
|
PaymentMethodElement,
|
|
26498
26791
|
{
|
|
26499
26792
|
paymentMethod: currentPaymentMethod,
|
|
@@ -26506,8 +26799,8 @@ var PaymentMethodDetails = ({
|
|
|
26506
26799
|
...props
|
|
26507
26800
|
}
|
|
26508
26801
|
),
|
|
26509
|
-
paymentMethods.length > 0 && /* @__PURE__ */ (0,
|
|
26510
|
-
/* @__PURE__ */ (0,
|
|
26802
|
+
paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
26803
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26511
26804
|
Text,
|
|
26512
26805
|
{
|
|
26513
26806
|
onClick: toggleShowPaymentMethods,
|
|
@@ -26518,7 +26811,7 @@ var PaymentMethodDetails = ({
|
|
|
26518
26811
|
children: t3("Choose different payment method")
|
|
26519
26812
|
}
|
|
26520
26813
|
),
|
|
26521
|
-
/* @__PURE__ */ (0,
|
|
26814
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26522
26815
|
Icon3,
|
|
26523
26816
|
{
|
|
26524
26817
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
|
|
@@ -26526,10 +26819,10 @@ var PaymentMethodDetails = ({
|
|
|
26526
26819
|
}
|
|
26527
26820
|
)
|
|
26528
26821
|
] }),
|
|
26529
|
-
showDifferentPaymentMethods && /* @__PURE__ */ (0,
|
|
26530
|
-
paymentMethods.length > 1 && /* @__PURE__ */ (0,
|
|
26822
|
+
showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
26823
|
+
paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
26531
26824
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
26532
|
-
) || []).map((paymentMethod) => /* @__PURE__ */ (0,
|
|
26825
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26533
26826
|
PaymentListElement,
|
|
26534
26827
|
{
|
|
26535
26828
|
paymentMethod,
|
|
@@ -26538,7 +26831,7 @@ var PaymentMethodDetails = ({
|
|
|
26538
26831
|
},
|
|
26539
26832
|
paymentMethod.id
|
|
26540
26833
|
)) }),
|
|
26541
|
-
/* @__PURE__ */ (0,
|
|
26834
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
26542
26835
|
Button,
|
|
26543
26836
|
{
|
|
26544
26837
|
type: "button",
|
|
@@ -26553,7 +26846,7 @@ var PaymentMethodDetails = ({
|
|
|
26553
26846
|
)
|
|
26554
26847
|
] })
|
|
26555
26848
|
] }),
|
|
26556
|
-
!isLoading && error && /* @__PURE__ */ (0,
|
|
26849
|
+
!isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
26557
26850
|
]
|
|
26558
26851
|
}
|
|
26559
26852
|
)
|
|
@@ -26563,13 +26856,13 @@ var PaymentMethodDetails = ({
|
|
|
26563
26856
|
};
|
|
26564
26857
|
|
|
26565
26858
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26566
|
-
var
|
|
26859
|
+
var import_react60 = require("react");
|
|
26567
26860
|
|
|
26568
26861
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
26569
|
-
var
|
|
26862
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
26570
26863
|
var AddOn = ({ addOn, currency, period, layout }) => {
|
|
26571
26864
|
const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
|
|
26572
|
-
return /* @__PURE__ */ (0,
|
|
26865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
26573
26866
|
Flex,
|
|
26574
26867
|
{
|
|
26575
26868
|
$justifyContent: "space-between",
|
|
@@ -26577,10 +26870,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26577
26870
|
$flexWrap: "wrap",
|
|
26578
26871
|
$gap: "1rem",
|
|
26579
26872
|
children: [
|
|
26580
|
-
/* @__PURE__ */ (0,
|
|
26581
|
-
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0,
|
|
26873
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
26874
|
+
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
|
|
26582
26875
|
formatCurrency(addOn.planPrice, currency),
|
|
26583
|
-
/* @__PURE__ */ (0,
|
|
26876
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
|
|
26584
26877
|
] })
|
|
26585
26878
|
]
|
|
26586
26879
|
}
|
|
@@ -26588,8 +26881,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26588
26881
|
};
|
|
26589
26882
|
|
|
26590
26883
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
26591
|
-
var
|
|
26592
|
-
var
|
|
26884
|
+
var import_react59 = require("react");
|
|
26885
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
26593
26886
|
var UsageDetails2 = ({
|
|
26594
26887
|
entitlement,
|
|
26595
26888
|
period,
|
|
@@ -26604,40 +26897,40 @@ var UsageDetails2 = ({
|
|
|
26604
26897
|
billingPrice,
|
|
26605
26898
|
limit,
|
|
26606
26899
|
cost = 0
|
|
26607
|
-
} = (0,
|
|
26900
|
+
} = (0, import_react59.useMemo)(
|
|
26608
26901
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26609
26902
|
showWarningThresholdAsLimit
|
|
26610
26903
|
}),
|
|
26611
26904
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26612
26905
|
);
|
|
26613
|
-
const description = (0,
|
|
26906
|
+
const description = (0, import_react59.useMemo)(() => {
|
|
26614
26907
|
const acc = [];
|
|
26615
26908
|
let index = 0;
|
|
26616
26909
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
26617
|
-
acc.push(/* @__PURE__ */ (0,
|
|
26910
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
|
|
26618
26911
|
t3("Additional"),
|
|
26619
26912
|
": "
|
|
26620
26913
|
] }, index));
|
|
26621
26914
|
index += 1;
|
|
26622
26915
|
}
|
|
26623
26916
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
26624
|
-
acc.push(/* @__PURE__ */ (0,
|
|
26917
|
+
acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react59.Fragment, { children: t3("Tier-based") }, index));
|
|
26625
26918
|
index += 1;
|
|
26626
26919
|
}
|
|
26627
26920
|
const { price } = getEntitlementPrice(entitlement, period, currency) || {};
|
|
26628
26921
|
if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
|
|
26629
26922
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
26630
26923
|
acc.push(
|
|
26631
|
-
/* @__PURE__ */ (0,
|
|
26924
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
|
|
26632
26925
|
formatCurrency(price, billingPrice?.currency),
|
|
26633
|
-
/* @__PURE__ */ (0,
|
|
26926
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
|
|
26634
26927
|
"/",
|
|
26635
|
-
packageSize > 1 && /* @__PURE__ */ (0,
|
|
26928
|
+
packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26636
26929
|
packageSize,
|
|
26637
26930
|
" "
|
|
26638
26931
|
] }),
|
|
26639
26932
|
getFeatureName(entitlement.feature, packageSize),
|
|
26640
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
26933
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26641
26934
|
"/",
|
|
26642
26935
|
shortenPeriod(period)
|
|
26643
26936
|
] })
|
|
@@ -26648,7 +26941,7 @@ var UsageDetails2 = ({
|
|
|
26648
26941
|
}
|
|
26649
26942
|
if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
26650
26943
|
acc.push(
|
|
26651
|
-
/* @__PURE__ */ (0,
|
|
26944
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react59.Fragment, { children: [
|
|
26652
26945
|
formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
|
|
26653
26946
|
" ",
|
|
26654
26947
|
getFeatureName(
|
|
@@ -26676,7 +26969,7 @@ var UsageDetails2 = ({
|
|
|
26676
26969
|
return null;
|
|
26677
26970
|
}
|
|
26678
26971
|
const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
|
|
26679
|
-
return /* @__PURE__ */ (0,
|
|
26972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
26680
26973
|
Flex,
|
|
26681
26974
|
{
|
|
26682
26975
|
$justifyContent: "space-between",
|
|
@@ -26684,13 +26977,13 @@ var UsageDetails2 = ({
|
|
|
26684
26977
|
$flexWrap: "wrap",
|
|
26685
26978
|
$gap: "0.5rem",
|
|
26686
26979
|
children: [
|
|
26687
|
-
/* @__PURE__ */ (0,
|
|
26980
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26688
26981
|
quantity,
|
|
26689
26982
|
" ",
|
|
26690
26983
|
getFeatureName(entitlement.feature, quantity, true)
|
|
26691
26984
|
] }) : entitlement.feature.name }),
|
|
26692
|
-
/* @__PURE__ */ (0,
|
|
26693
|
-
description.length > 0 && /* @__PURE__ */ (0,
|
|
26985
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { children: [
|
|
26986
|
+
description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26694
26987
|
Text,
|
|
26695
26988
|
{
|
|
26696
26989
|
style: { opacity: 0.54 },
|
|
@@ -26701,15 +26994,15 @@ var UsageDetails2 = ({
|
|
|
26701
26994
|
),
|
|
26702
26995
|
// only show cost for pay-in-advance entitlements
|
|
26703
26996
|
// `description` will include price for other price behaviors
|
|
26704
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
26997
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
26705
26998
|
" ",
|
|
26706
26999
|
formatCurrency(cost, billingPrice?.currency),
|
|
26707
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
27000
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
|
|
26708
27001
|
"/",
|
|
26709
27002
|
shortenPeriod(period)
|
|
26710
27003
|
] })
|
|
26711
27004
|
] }),
|
|
26712
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0,
|
|
27005
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26713
27006
|
PricingTiersTooltip,
|
|
26714
27007
|
{
|
|
26715
27008
|
feature: entitlement.feature,
|
|
@@ -26719,7 +27012,7 @@ var UsageDetails2 = ({
|
|
|
26719
27012
|
tiersMode: billingPrice?.tiersMode ?? void 0
|
|
26720
27013
|
}
|
|
26721
27014
|
),
|
|
26722
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
27015
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
26723
27016
|
HardLimitTooltip,
|
|
26724
27017
|
{
|
|
26725
27018
|
feature: entitlement.feature,
|
|
@@ -26733,7 +27026,7 @@ var UsageDetails2 = ({
|
|
|
26733
27026
|
};
|
|
26734
27027
|
|
|
26735
27028
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26736
|
-
var
|
|
27029
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
26737
27030
|
var resolveDesignProps7 = (props) => {
|
|
26738
27031
|
return {
|
|
26739
27032
|
header: {
|
|
@@ -26762,7 +27055,7 @@ var resolveDesignProps7 = (props) => {
|
|
|
26762
27055
|
}
|
|
26763
27056
|
};
|
|
26764
27057
|
};
|
|
26765
|
-
var PlanManager = (0,
|
|
27058
|
+
var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal, ...rest }, ref) => {
|
|
26766
27059
|
const props = resolveDesignProps7(rest);
|
|
26767
27060
|
const { t: t3 } = useTranslation();
|
|
26768
27061
|
const { data, settings, setCheckoutState, setLayout } = useEmbed();
|
|
@@ -26781,7 +27074,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26781
27074
|
showCredits,
|
|
26782
27075
|
showZeroPriceAsFree,
|
|
26783
27076
|
trialPaymentMethodRequired
|
|
26784
|
-
} = (0,
|
|
27077
|
+
} = (0, import_react60.useMemo)(() => {
|
|
26785
27078
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
26786
27079
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
26787
27080
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -26841,15 +27134,15 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26841
27134
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
26842
27135
|
data?.trialPaymentMethodRequired
|
|
26843
27136
|
]);
|
|
26844
|
-
const usageBasedEntitlements = (0,
|
|
27137
|
+
const usageBasedEntitlements = (0, import_react60.useMemo)(
|
|
26845
27138
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
26846
27139
|
[featureUsage]
|
|
26847
27140
|
);
|
|
26848
|
-
const planCreditCompositions = (0,
|
|
27141
|
+
const planCreditCompositions = (0, import_react60.useMemo)(
|
|
26849
27142
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
26850
27143
|
[currentPlan?.includedCreditGrants]
|
|
26851
27144
|
);
|
|
26852
|
-
const resolveLicenseQuantity = (0,
|
|
27145
|
+
const resolveLicenseQuantity = (0, import_react60.useMemo)(() => {
|
|
26853
27146
|
return (licenseId) => {
|
|
26854
27147
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
26855
27148
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -26872,7 +27165,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26872
27165
|
subscriptionCurrency,
|
|
26873
27166
|
willSubscriptionCancel,
|
|
26874
27167
|
isTrialSubscription
|
|
26875
|
-
} = (0,
|
|
27168
|
+
} = (0, import_react60.useMemo)(() => {
|
|
26876
27169
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
26877
27170
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
26878
27171
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -26885,7 +27178,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26885
27178
|
};
|
|
26886
27179
|
}, [billingSubscription]);
|
|
26887
27180
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
26888
|
-
const { isFreePlan, isUsageBasedPlan } = (0,
|
|
27181
|
+
const { isFreePlan, isUsageBasedPlan } = (0, import_react60.useMemo)(() => {
|
|
26889
27182
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
26890
27183
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
26891
27184
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -26893,8 +27186,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26893
27186
|
const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
|
|
26894
27187
|
(grant) => isSelfServiceAutoTopupAvailable(grant)
|
|
26895
27188
|
) ?? false;
|
|
26896
|
-
return /* @__PURE__ */ (0,
|
|
26897
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
27189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
27190
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26898
27191
|
Notice,
|
|
26899
27192
|
{
|
|
26900
27193
|
as: Flex,
|
|
@@ -26904,8 +27197,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26904
27197
|
$textAlign: "center",
|
|
26905
27198
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26906
27199
|
children: [
|
|
26907
|
-
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0,
|
|
26908
|
-
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0,
|
|
27200
|
+
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Trial ends in", trialEnd) }),
|
|
27201
|
+
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26909
27202
|
Text,
|
|
26910
27203
|
{
|
|
26911
27204
|
as: "p",
|
|
@@ -26919,7 +27212,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26919
27212
|
)
|
|
26920
27213
|
]
|
|
26921
27214
|
}
|
|
26922
|
-
) : willSubscriptionCancel ? /* @__PURE__ */ (0,
|
|
27215
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26923
27216
|
Notice,
|
|
26924
27217
|
{
|
|
26925
27218
|
as: Flex,
|
|
@@ -26929,8 +27222,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26929
27222
|
$textAlign: "center",
|
|
26930
27223
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26931
27224
|
children: [
|
|
26932
|
-
/* @__PURE__ */ (0,
|
|
26933
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0,
|
|
27225
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Subscription canceled") }),
|
|
27226
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26934
27227
|
Text,
|
|
26935
27228
|
{
|
|
26936
27229
|
as: "p",
|
|
@@ -26945,7 +27238,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26945
27238
|
)
|
|
26946
27239
|
]
|
|
26947
27240
|
}
|
|
26948
|
-
) : customPlanBilling ? /* @__PURE__ */ (0,
|
|
27241
|
+
) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26949
27242
|
Notice,
|
|
26950
27243
|
{
|
|
26951
27244
|
as: Flex,
|
|
@@ -26955,19 +27248,19 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26955
27248
|
$textAlign: "center",
|
|
26956
27249
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26957
27250
|
children: [
|
|
26958
|
-
/* @__PURE__ */ (0,
|
|
27251
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment", {
|
|
26959
27252
|
plan: customPlanBilling.planName ?? t3("your plan")
|
|
26960
27253
|
}) : t3("Custom plan payment due", {
|
|
26961
27254
|
plan: customPlanBilling.planName ?? t3("your plan"),
|
|
26962
27255
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26963
27256
|
}) }),
|
|
26964
|
-
/* @__PURE__ */ (0,
|
|
27257
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t3("Custom plan awaiting payment description", {
|
|
26965
27258
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26966
27259
|
}) : t3("Custom plan payment due description", {
|
|
26967
27260
|
plan: customPlanBilling.planName ?? t3("your plan"),
|
|
26968
27261
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26969
27262
|
}) }),
|
|
26970
|
-
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0,
|
|
27263
|
+
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26971
27264
|
Button,
|
|
26972
27265
|
{
|
|
26973
27266
|
as: "a",
|
|
@@ -26981,7 +27274,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26981
27274
|
)
|
|
26982
27275
|
]
|
|
26983
27276
|
}
|
|
26984
|
-
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0,
|
|
27277
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
26985
27278
|
Notice,
|
|
26986
27279
|
{
|
|
26987
27280
|
as: Flex,
|
|
@@ -26991,10 +27284,10 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
26991
27284
|
$textAlign: "center",
|
|
26992
27285
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26993
27286
|
children: [
|
|
26994
|
-
/* @__PURE__ */ (0,
|
|
27287
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t3("Downgrade to plan scheduled", {
|
|
26995
27288
|
plan: data.company.scheduledDowngrade.toPlanName
|
|
26996
27289
|
}) }),
|
|
26997
|
-
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0,
|
|
27290
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
26998
27291
|
Text,
|
|
26999
27292
|
{
|
|
27000
27293
|
as: "p",
|
|
@@ -27010,7 +27303,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27010
27303
|
]
|
|
27011
27304
|
}
|
|
27012
27305
|
),
|
|
27013
|
-
/* @__PURE__ */ (0,
|
|
27306
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27014
27307
|
Element,
|
|
27015
27308
|
{
|
|
27016
27309
|
as: Flex,
|
|
@@ -27019,19 +27312,19 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27019
27312
|
$flexDirection: "column",
|
|
27020
27313
|
$gap: "2rem",
|
|
27021
27314
|
children: [
|
|
27022
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */ (0,
|
|
27315
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27023
27316
|
Flex,
|
|
27024
27317
|
{
|
|
27025
27318
|
$justifyContent: "space-between",
|
|
27026
27319
|
$alignItems: "center",
|
|
27027
27320
|
$gap: "1rem",
|
|
27028
27321
|
children: [
|
|
27029
|
-
/* @__PURE__ */ (0,
|
|
27030
|
-
/* @__PURE__ */ (0,
|
|
27031
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0,
|
|
27322
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
27323
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
|
|
27324
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
27032
27325
|
] }),
|
|
27033
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0,
|
|
27034
|
-
/* @__PURE__ */ (0,
|
|
27326
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Box, { children: [
|
|
27327
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27035
27328
|
Text,
|
|
27036
27329
|
{
|
|
27037
27330
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -27041,7 +27334,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27041
27334
|
)
|
|
27042
27335
|
}
|
|
27043
27336
|
),
|
|
27044
|
-
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0,
|
|
27337
|
+
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
|
|
27045
27338
|
"/",
|
|
27046
27339
|
shortenPeriod(currentPlanPeriod)
|
|
27047
27340
|
] }) })
|
|
@@ -27049,8 +27342,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27049
27342
|
]
|
|
27050
27343
|
}
|
|
27051
27344
|
),
|
|
27052
|
-
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0,
|
|
27053
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27345
|
+
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27346
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27054
27347
|
Text,
|
|
27055
27348
|
{
|
|
27056
27349
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27058,7 +27351,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27058
27351
|
children: t3("Add-ons")
|
|
27059
27352
|
}
|
|
27060
27353
|
),
|
|
27061
|
-
/* @__PURE__ */ (0,
|
|
27354
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27062
27355
|
AddOn,
|
|
27063
27356
|
{
|
|
27064
27357
|
addOn,
|
|
@@ -27069,8 +27362,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27069
27362
|
addOnIndex
|
|
27070
27363
|
)) })
|
|
27071
27364
|
] }),
|
|
27072
|
-
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
27073
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27365
|
+
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27366
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27074
27367
|
Text,
|
|
27075
27368
|
{
|
|
27076
27369
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27078,8 +27371,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27078
27371
|
children: t3("Usage-based")
|
|
27079
27372
|
}
|
|
27080
27373
|
),
|
|
27081
|
-
/* @__PURE__ */ (0,
|
|
27082
|
-
return /* @__PURE__ */ (0,
|
|
27374
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
27375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27083
27376
|
UsageDetails2,
|
|
27084
27377
|
{
|
|
27085
27378
|
entitlement,
|
|
@@ -27092,8 +27385,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27092
27385
|
);
|
|
27093
27386
|
}) })
|
|
27094
27387
|
] }),
|
|
27095
|
-
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0,
|
|
27096
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27388
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27389
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27097
27390
|
Text,
|
|
27098
27391
|
{
|
|
27099
27392
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27101,7 +27394,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27101
27394
|
children: t3("Credits in plan")
|
|
27102
27395
|
}
|
|
27103
27396
|
),
|
|
27104
|
-
/* @__PURE__ */ (0,
|
|
27397
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
|
|
27105
27398
|
const planCreditGrant = currentPlan?.includedCreditGrants.find(
|
|
27106
27399
|
(grant) => grant.creditId === group.id
|
|
27107
27400
|
);
|
|
@@ -27124,13 +27417,13 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27124
27417
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
27125
27418
|
const creditPeriod = composition.period ?? subscriptionInterval;
|
|
27126
27419
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
27127
|
-
return /* @__PURE__ */ (0,
|
|
27420
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27128
27421
|
Flex,
|
|
27129
27422
|
{
|
|
27130
27423
|
$flexDirection: "column",
|
|
27131
27424
|
$gap: "0.25rem",
|
|
27132
27425
|
children: [
|
|
27133
|
-
/* @__PURE__ */ (0,
|
|
27426
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27134
27427
|
Flex,
|
|
27135
27428
|
{
|
|
27136
27429
|
$justifyContent: "space-between",
|
|
@@ -27138,7 +27431,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27138
27431
|
$flexWrap: "wrap",
|
|
27139
27432
|
$gap: "0.5rem",
|
|
27140
27433
|
children: [
|
|
27141
|
-
/* @__PURE__ */ (0,
|
|
27434
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
27142
27435
|
t3("X credits per license", {
|
|
27143
27436
|
amount: perLicenseGrant.amount,
|
|
27144
27437
|
creditName: getFeatureName(
|
|
@@ -27147,7 +27440,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27147
27440
|
),
|
|
27148
27441
|
licenseName: getFeatureName(licenseFeature, 1)
|
|
27149
27442
|
}),
|
|
27150
|
-
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0,
|
|
27443
|
+
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
27151
27444
|
" ",
|
|
27152
27445
|
t3("Plus X credits per period", {
|
|
27153
27446
|
amount: composition.fixedQuantity,
|
|
@@ -27158,18 +27451,18 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27158
27451
|
period: t3(creditPeriod)
|
|
27159
27452
|
})
|
|
27160
27453
|
] })
|
|
27161
|
-
] }) : /* @__PURE__ */ (0,
|
|
27454
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
27162
27455
|
group.total.value,
|
|
27163
27456
|
" ",
|
|
27164
27457
|
getFeatureName(group, group.total.value),
|
|
27165
27458
|
" ",
|
|
27166
|
-
subscriptionInterval && /* @__PURE__ */ (0,
|
|
27459
|
+
subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
|
|
27167
27460
|
t3("per"),
|
|
27168
27461
|
" ",
|
|
27169
27462
|
t3(subscriptionInterval)
|
|
27170
27463
|
] })
|
|
27171
27464
|
] }) }),
|
|
27172
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27465
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27173
27466
|
Text,
|
|
27174
27467
|
{
|
|
27175
27468
|
style: { opacity: 0.54 },
|
|
@@ -27179,7 +27472,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27179
27472
|
group.total.used,
|
|
27180
27473
|
" ",
|
|
27181
27474
|
t3("used"),
|
|
27182
|
-
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0,
|
|
27475
|
+
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27183
27476
|
AutoTopupNotice,
|
|
27184
27477
|
{
|
|
27185
27478
|
thresholdCredits,
|
|
@@ -27192,7 +27485,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27192
27485
|
]
|
|
27193
27486
|
}
|
|
27194
27487
|
),
|
|
27195
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0,
|
|
27488
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27196
27489
|
Text,
|
|
27197
27490
|
{
|
|
27198
27491
|
style: { opacity: 0.54 },
|
|
@@ -27233,7 +27526,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27233
27526
|
groupIndex
|
|
27234
27527
|
);
|
|
27235
27528
|
}) }),
|
|
27236
|
-
planCredits.canExpand && /* @__PURE__ */ (0,
|
|
27529
|
+
planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27237
27530
|
ExpandListToggle,
|
|
27238
27531
|
{
|
|
27239
27532
|
isExpanded: planCredits.isExpanded,
|
|
@@ -27242,7 +27535,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27242
27535
|
$marginTop: "0.5rem"
|
|
27243
27536
|
}
|
|
27244
27537
|
),
|
|
27245
|
-
hasAutoTopupSelfService && /* @__PURE__ */ (0,
|
|
27538
|
+
hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27246
27539
|
Flex,
|
|
27247
27540
|
{
|
|
27248
27541
|
$justifyContent: "space-between",
|
|
@@ -27252,8 +27545,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27252
27545
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
27253
27546
|
$borderRadius: "0.5rem",
|
|
27254
27547
|
children: [
|
|
27255
|
-
/* @__PURE__ */ (0,
|
|
27256
|
-
/* @__PURE__ */ (0,
|
|
27548
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27549
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: t3("Auto top-up") }),
|
|
27257
27550
|
currentPlan?.includedCreditGrants.reduce(
|
|
27258
27551
|
(acc, grant) => {
|
|
27259
27552
|
if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -27262,7 +27555,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27262
27555
|
const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
|
|
27263
27556
|
if (!autoTopupEnabled) {
|
|
27264
27557
|
acc.push(
|
|
27265
|
-
/* @__PURE__ */ (0,
|
|
27558
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t3("Auto top-up disabled for token", {
|
|
27266
27559
|
unit: getFeatureName(grant.credit, 1)
|
|
27267
27560
|
}) }, grant.id)
|
|
27268
27561
|
);
|
|
@@ -27272,7 +27565,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27272
27565
|
const autoTopupAmount = getAutoTopupAmount(grant);
|
|
27273
27566
|
if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
|
|
27274
27567
|
acc.push(
|
|
27275
|
-
/* @__PURE__ */ (0,
|
|
27568
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t3("Adds X tokens when Y remaining in balance", {
|
|
27276
27569
|
unit: getFeatureName(
|
|
27277
27570
|
grant.credit,
|
|
27278
27571
|
autoTopupAmount
|
|
@@ -27287,7 +27580,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27287
27580
|
[]
|
|
27288
27581
|
)
|
|
27289
27582
|
] }),
|
|
27290
|
-
/* @__PURE__ */ (0,
|
|
27583
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27291
27584
|
Button,
|
|
27292
27585
|
{
|
|
27293
27586
|
type: "button",
|
|
@@ -27304,8 +27597,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27304
27597
|
}
|
|
27305
27598
|
)
|
|
27306
27599
|
] }),
|
|
27307
|
-
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0,
|
|
27308
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27600
|
+
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27601
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27309
27602
|
Text,
|
|
27310
27603
|
{
|
|
27311
27604
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27313,9 +27606,9 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27313
27606
|
children: t3("Top-ups")
|
|
27314
27607
|
}
|
|
27315
27608
|
),
|
|
27316
|
-
/* @__PURE__ */ (0,
|
|
27609
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
|
|
27317
27610
|
const bundle = group?.bundleId ? creditBundles.find((b) => b.id === group.bundleId) : void 0;
|
|
27318
|
-
return /* @__PURE__ */ (0,
|
|
27611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27319
27612
|
Flex,
|
|
27320
27613
|
{
|
|
27321
27614
|
$justifyContent: "space-between",
|
|
@@ -27323,8 +27616,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27323
27616
|
$flexWrap: "wrap",
|
|
27324
27617
|
$gap: "0.5rem",
|
|
27325
27618
|
children: [
|
|
27326
|
-
bundle ? /* @__PURE__ */ (0,
|
|
27327
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27619
|
+
bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27620
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
27328
27621
|
"(",
|
|
27329
27622
|
group.grants.length,
|
|
27330
27623
|
")",
|
|
@@ -27336,8 +27629,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27336
27629
|
" ",
|
|
27337
27630
|
getFeatureName(group, group.quantity),
|
|
27338
27631
|
")"
|
|
27339
|
-
] }) : /* @__PURE__ */ (0,
|
|
27340
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27632
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27633
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
27341
27634
|
"(",
|
|
27342
27635
|
group.grants.length,
|
|
27343
27636
|
")",
|
|
@@ -27347,7 +27640,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27347
27640
|
" ",
|
|
27348
27641
|
getFeatureName(group, group.quantity)
|
|
27349
27642
|
] }),
|
|
27350
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27643
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27351
27644
|
Text,
|
|
27352
27645
|
{
|
|
27353
27646
|
style: { opacity: 0.54 },
|
|
@@ -27365,7 +27658,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27365
27658
|
groupIndex
|
|
27366
27659
|
);
|
|
27367
27660
|
}) }),
|
|
27368
|
-
autoTopupCredits.canExpand && /* @__PURE__ */ (0,
|
|
27661
|
+
autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27369
27662
|
ExpandListToggle,
|
|
27370
27663
|
{
|
|
27371
27664
|
isExpanded: autoTopupCredits.isExpanded,
|
|
@@ -27375,8 +27668,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27375
27668
|
}
|
|
27376
27669
|
)
|
|
27377
27670
|
] }),
|
|
27378
|
-
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0,
|
|
27379
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27671
|
+
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27672
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27380
27673
|
Text,
|
|
27381
27674
|
{
|
|
27382
27675
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27384,9 +27677,9 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27384
27677
|
children: t3("Credit bundles")
|
|
27385
27678
|
}
|
|
27386
27679
|
),
|
|
27387
|
-
/* @__PURE__ */ (0,
|
|
27680
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
|
|
27388
27681
|
const bundle = group?.bundleId ? creditBundles.find((b) => b.id === group.bundleId) : void 0;
|
|
27389
|
-
return /* @__PURE__ */ (0,
|
|
27682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27390
27683
|
Flex,
|
|
27391
27684
|
{
|
|
27392
27685
|
$justifyContent: "space-between",
|
|
@@ -27394,8 +27687,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27394
27687
|
$flexWrap: "wrap",
|
|
27395
27688
|
$gap: "0.5rem",
|
|
27396
27689
|
children: [
|
|
27397
|
-
bundle ? /* @__PURE__ */ (0,
|
|
27398
|
-
group.grants.length > 1 && /* @__PURE__ */ (0,
|
|
27690
|
+
bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27691
|
+
group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
|
|
27399
27692
|
"(",
|
|
27400
27693
|
group.grants.length,
|
|
27401
27694
|
")",
|
|
@@ -27407,12 +27700,12 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27407
27700
|
" ",
|
|
27408
27701
|
getFeatureName(group, group.quantity),
|
|
27409
27702
|
")"
|
|
27410
|
-
] }) : /* @__PURE__ */ (0,
|
|
27703
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27411
27704
|
group.quantity,
|
|
27412
27705
|
" ",
|
|
27413
27706
|
getFeatureName(group, group.quantity)
|
|
27414
27707
|
] }),
|
|
27415
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27708
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27416
27709
|
Text,
|
|
27417
27710
|
{
|
|
27418
27711
|
style: { opacity: 0.54 },
|
|
@@ -27430,7 +27723,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27430
27723
|
groupIndex
|
|
27431
27724
|
);
|
|
27432
27725
|
}) }),
|
|
27433
|
-
bundleCredits.canExpand && /* @__PURE__ */ (0,
|
|
27726
|
+
bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27434
27727
|
ExpandListToggle,
|
|
27435
27728
|
{
|
|
27436
27729
|
isExpanded: bundleCredits.isExpanded,
|
|
@@ -27440,8 +27733,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27440
27733
|
}
|
|
27441
27734
|
)
|
|
27442
27735
|
] }),
|
|
27443
|
-
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0,
|
|
27444
|
-
props.addOns.showLabel && /* @__PURE__ */ (0,
|
|
27736
|
+
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27737
|
+
props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27445
27738
|
Text,
|
|
27446
27739
|
{
|
|
27447
27740
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27449,8 +27742,8 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27449
27742
|
children: t3("Promotional credits")
|
|
27450
27743
|
}
|
|
27451
27744
|
),
|
|
27452
|
-
/* @__PURE__ */ (0,
|
|
27453
|
-
return /* @__PURE__ */ (0,
|
|
27745
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
|
|
27746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27454
27747
|
Flex,
|
|
27455
27748
|
{
|
|
27456
27749
|
$justifyContent: "space-between",
|
|
@@ -27458,12 +27751,12 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27458
27751
|
$flexWrap: "wrap",
|
|
27459
27752
|
$gap: "0.5rem",
|
|
27460
27753
|
children: [
|
|
27461
|
-
/* @__PURE__ */ (0,
|
|
27754
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
|
|
27462
27755
|
group.quantity,
|
|
27463
27756
|
" ",
|
|
27464
27757
|
getFeatureName(group, group.quantity)
|
|
27465
27758
|
] }),
|
|
27466
|
-
group.total.used > 0 && /* @__PURE__ */ (0,
|
|
27759
|
+
group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
27467
27760
|
Text,
|
|
27468
27761
|
{
|
|
27469
27762
|
style: { opacity: 0.54 },
|
|
@@ -27481,7 +27774,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27481
27774
|
groupIndex
|
|
27482
27775
|
);
|
|
27483
27776
|
}) }),
|
|
27484
|
-
promotionalCredits.canExpand && /* @__PURE__ */ (0,
|
|
27777
|
+
promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27485
27778
|
ExpandListToggle,
|
|
27486
27779
|
{
|
|
27487
27780
|
isExpanded: promotionalCredits.isExpanded,
|
|
@@ -27491,7 +27784,7 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27491
27784
|
}
|
|
27492
27785
|
)
|
|
27493
27786
|
] }),
|
|
27494
|
-
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0,
|
|
27787
|
+
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
27495
27788
|
Button,
|
|
27496
27789
|
{
|
|
27497
27790
|
type: "button",
|
|
@@ -27512,11 +27805,11 @@ var PlanManager = (0, import_react59.forwardRef)(({ children, className, portal,
|
|
|
27512
27805
|
PlanManager.displayName = "PlanManager";
|
|
27513
27806
|
|
|
27514
27807
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
27515
|
-
var
|
|
27808
|
+
var import_react63 = require("react");
|
|
27516
27809
|
|
|
27517
27810
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
27518
|
-
var
|
|
27519
|
-
var
|
|
27811
|
+
var import_react61 = require("react");
|
|
27812
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
27520
27813
|
function renderMeteredEntitlementPricing2({
|
|
27521
27814
|
priceBehavior,
|
|
27522
27815
|
softLimit,
|
|
@@ -27528,7 +27821,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
27528
27821
|
isTiered
|
|
27529
27822
|
}) {
|
|
27530
27823
|
if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
|
|
27531
|
-
return /* @__PURE__ */ (0,
|
|
27824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27532
27825
|
"Additional: ",
|
|
27533
27826
|
formatCurrency(price, currency),
|
|
27534
27827
|
"/",
|
|
@@ -27539,13 +27832,13 @@ function renderMeteredEntitlementPricing2({
|
|
|
27539
27832
|
] });
|
|
27540
27833
|
}
|
|
27541
27834
|
if (isTiered) {
|
|
27542
|
-
return /* @__PURE__ */ (0,
|
|
27835
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: "Tier-based pricing" });
|
|
27543
27836
|
}
|
|
27544
27837
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
|
|
27545
|
-
return /* @__PURE__ */ (0,
|
|
27838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27546
27839
|
formatCurrency(price, currency),
|
|
27547
27840
|
"/",
|
|
27548
|
-
packageSize > 1 && /* @__PURE__ */ (0,
|
|
27841
|
+
packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27549
27842
|
packageSize,
|
|
27550
27843
|
" "
|
|
27551
27844
|
] }),
|
|
@@ -27571,7 +27864,7 @@ var AddOn2 = ({
|
|
|
27571
27864
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
27572
27865
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
27573
27866
|
const isLightBackground = useIsLightBackground();
|
|
27574
|
-
const { currentAddOns, canCheckout, isStandalone } = (0,
|
|
27867
|
+
const { currentAddOns, canCheckout, isStandalone } = (0, import_react61.useMemo)(() => {
|
|
27575
27868
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
27576
27869
|
return {
|
|
27577
27870
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -27614,7 +27907,7 @@ var AddOn2 = ({
|
|
|
27614
27907
|
isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
|
|
27615
27908
|
};
|
|
27616
27909
|
}) || [];
|
|
27617
|
-
return /* @__PURE__ */ (0,
|
|
27910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27618
27911
|
Flex,
|
|
27619
27912
|
{
|
|
27620
27913
|
as: "li",
|
|
@@ -27634,7 +27927,7 @@ var AddOn2 = ({
|
|
|
27634
27927
|
$boxShadow: cardBoxShadow
|
|
27635
27928
|
},
|
|
27636
27929
|
children: [
|
|
27637
|
-
/* @__PURE__ */ (0,
|
|
27930
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27638
27931
|
Flex,
|
|
27639
27932
|
{
|
|
27640
27933
|
$flexDirection: "column",
|
|
@@ -27645,7 +27938,7 @@ var AddOn2 = ({
|
|
|
27645
27938
|
$borderStyle: "solid",
|
|
27646
27939
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27647
27940
|
children: [
|
|
27648
|
-
/* @__PURE__ */ (0,
|
|
27941
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27649
27942
|
Text,
|
|
27650
27943
|
{
|
|
27651
27944
|
as: "h3",
|
|
@@ -27654,22 +27947,22 @@ var AddOn2 = ({
|
|
|
27654
27947
|
children: addOn.name
|
|
27655
27948
|
}
|
|
27656
27949
|
) }),
|
|
27657
|
-
layout.addOns.showDescription && /* @__PURE__ */ (0,
|
|
27658
|
-
/* @__PURE__ */ (0,
|
|
27950
|
+
layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
27951
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27659
27952
|
Text,
|
|
27660
27953
|
{
|
|
27661
27954
|
"data-testid": "sch-addon-price",
|
|
27662
27955
|
display: layout.plans.name.fontStyle,
|
|
27663
|
-
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t3("Usage-based") : /* @__PURE__ */ (0,
|
|
27956
|
+
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t3("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
27664
27957
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
27665
|
-
/* @__PURE__ */ (0,
|
|
27958
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("sub", { children: [
|
|
27666
27959
|
"/",
|
|
27667
27960
|
selectedPeriod
|
|
27668
27961
|
] })
|
|
27669
27962
|
] })
|
|
27670
27963
|
}
|
|
27671
27964
|
) }),
|
|
27672
|
-
isActiveAddOn && /* @__PURE__ */ (0,
|
|
27965
|
+
isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27673
27966
|
Flex,
|
|
27674
27967
|
{
|
|
27675
27968
|
"data-testid": "sch-addon-active",
|
|
@@ -27679,7 +27972,7 @@ var AddOn2 = ({
|
|
|
27679
27972
|
$backgroundColor: settings.theme.primary,
|
|
27680
27973
|
$borderRadius: "9999px",
|
|
27681
27974
|
$padding: "0.125rem 0.85rem",
|
|
27682
|
-
children: /* @__PURE__ */ (0,
|
|
27975
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27683
27976
|
Text,
|
|
27684
27977
|
{
|
|
27685
27978
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27692,7 +27985,7 @@ var AddOn2 = ({
|
|
|
27692
27985
|
]
|
|
27693
27986
|
}
|
|
27694
27987
|
),
|
|
27695
|
-
/* @__PURE__ */ (0,
|
|
27988
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27696
27989
|
Flex,
|
|
27697
27990
|
{
|
|
27698
27991
|
$flexDirection: "column",
|
|
@@ -27701,7 +27994,7 @@ var AddOn2 = ({
|
|
|
27701
27994
|
$flexGrow: 1,
|
|
27702
27995
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27703
27996
|
children: [
|
|
27704
|
-
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0,
|
|
27997
|
+
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27705
27998
|
Flex,
|
|
27706
27999
|
{
|
|
27707
28000
|
as: "ul",
|
|
@@ -27713,7 +28006,7 @@ var AddOn2 = ({
|
|
|
27713
28006
|
$listStyle: "none",
|
|
27714
28007
|
children: displayableEntitlements.map((entitlement, idx) => {
|
|
27715
28008
|
if (entitlement.isUnlimited) {
|
|
27716
|
-
return /* @__PURE__ */ (0,
|
|
28009
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27717
28010
|
Flex,
|
|
27718
28011
|
{
|
|
27719
28012
|
as: "li",
|
|
@@ -27722,8 +28015,8 @@ var AddOn2 = ({
|
|
|
27722
28015
|
$alignItems: "center",
|
|
27723
28016
|
$gap: "1rem",
|
|
27724
28017
|
children: [
|
|
27725
|
-
/* @__PURE__ */ (0,
|
|
27726
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
28018
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
|
|
28019
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27727
28020
|
Icon3,
|
|
27728
28021
|
{
|
|
27729
28022
|
name: entitlement.feature.icon,
|
|
@@ -27732,16 +28025,16 @@ var AddOn2 = ({
|
|
|
27732
28025
|
rounded: true
|
|
27733
28026
|
}
|
|
27734
28027
|
),
|
|
27735
|
-
entitlement.feature && /* @__PURE__ */ (0,
|
|
28028
|
+
entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27736
28029
|
Flex,
|
|
27737
28030
|
{
|
|
27738
28031
|
$flexDirection: "column",
|
|
27739
28032
|
$justifyContent: "center",
|
|
27740
|
-
children: /* @__PURE__ */ (0,
|
|
28033
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: getFeatureName(entitlement.feature) })
|
|
27741
28034
|
}
|
|
27742
28035
|
)
|
|
27743
28036
|
] }),
|
|
27744
|
-
/* @__PURE__ */ (0,
|
|
28037
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27745
28038
|
Text,
|
|
27746
28039
|
{
|
|
27747
28040
|
style: { opacity: 0.54 },
|
|
@@ -27756,7 +28049,7 @@ var AddOn2 = ({
|
|
|
27756
28049
|
);
|
|
27757
28050
|
}
|
|
27758
28051
|
const meteredEntitlement = entitlement;
|
|
27759
|
-
return /* @__PURE__ */ (0,
|
|
28052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
27760
28053
|
Flex,
|
|
27761
28054
|
{
|
|
27762
28055
|
as: "li",
|
|
@@ -27766,8 +28059,8 @@ var AddOn2 = ({
|
|
|
27766
28059
|
$gap: "1rem",
|
|
27767
28060
|
$listStyle: "none",
|
|
27768
28061
|
children: [
|
|
27769
|
-
/* @__PURE__ */ (0,
|
|
27770
|
-
meteredEntitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
28062
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
|
|
28063
|
+
meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27771
28064
|
Icon3,
|
|
27772
28065
|
{
|
|
27773
28066
|
"data-testid": "sch-feature-icon",
|
|
@@ -27777,9 +28070,9 @@ var AddOn2 = ({
|
|
|
27777
28070
|
rounded: true
|
|
27778
28071
|
}
|
|
27779
28072
|
),
|
|
27780
|
-
/* @__PURE__ */ (0,
|
|
28073
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
|
|
27781
28074
|
] }),
|
|
27782
|
-
/* @__PURE__ */ (0,
|
|
28075
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27783
28076
|
Text,
|
|
27784
28077
|
{
|
|
27785
28078
|
style: { opacity: 0.54 },
|
|
@@ -27795,7 +28088,7 @@ var AddOn2 = ({
|
|
|
27795
28088
|
})
|
|
27796
28089
|
}
|
|
27797
28090
|
),
|
|
27798
|
-
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
28091
|
+
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
27799
28092
|
Button,
|
|
27800
28093
|
{
|
|
27801
28094
|
type: "button",
|
|
@@ -27834,10 +28127,10 @@ var AddOn2 = ({
|
|
|
27834
28127
|
};
|
|
27835
28128
|
|
|
27836
28129
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27837
|
-
var
|
|
28130
|
+
var import_react62 = require("react");
|
|
27838
28131
|
|
|
27839
28132
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
27840
|
-
var
|
|
28133
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
27841
28134
|
var Entitlement2 = ({
|
|
27842
28135
|
entitlement,
|
|
27843
28136
|
sharedProps,
|
|
@@ -27871,8 +28164,8 @@ var Entitlement2 = ({
|
|
|
27871
28164
|
entitlement,
|
|
27872
28165
|
credits
|
|
27873
28166
|
);
|
|
27874
|
-
return /* @__PURE__ */ (0,
|
|
27875
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0,
|
|
28167
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
|
|
28168
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27876
28169
|
Icon3,
|
|
27877
28170
|
{
|
|
27878
28171
|
"data-testid": "sch-feature-icon",
|
|
@@ -27882,31 +28175,31 @@ var Entitlement2 = ({
|
|
|
27882
28175
|
rounded: true
|
|
27883
28176
|
}
|
|
27884
28177
|
),
|
|
27885
|
-
entitlement.feature?.name && /* @__PURE__ */ (0,
|
|
27886
|
-
/* @__PURE__ */ (0,
|
|
27887
|
-
/* @__PURE__ */ (0,
|
|
28178
|
+
entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28179
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
28180
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27888
28181
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27889
28182
|
" ",
|
|
27890
28183
|
t3("per"),
|
|
27891
28184
|
" ",
|
|
27892
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ (0,
|
|
28185
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27893
28186
|
formatNumber(entitlementPackageSize),
|
|
27894
28187
|
" "
|
|
27895
28188
|
] }),
|
|
27896
28189
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
27897
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0,
|
|
28190
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27898
28191
|
" ",
|
|
27899
28192
|
t3("per"),
|
|
27900
28193
|
" ",
|
|
27901
28194
|
selectedPeriod
|
|
27902
28195
|
] })
|
|
27903
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0,
|
|
28196
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27904
28197
|
TieredPricingDetails,
|
|
27905
28198
|
{
|
|
27906
28199
|
entitlement,
|
|
27907
28200
|
period: selectedPeriod
|
|
27908
28201
|
}
|
|
27909
|
-
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0,
|
|
28202
|
+
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27910
28203
|
formatConsumptionRate(entitlement.consumptionRate),
|
|
27911
28204
|
" ",
|
|
27912
28205
|
getFeatureName(
|
|
@@ -27917,7 +28210,7 @@ var Entitlement2 = ({
|
|
|
27917
28210
|
t3("per"),
|
|
27918
28211
|
" ",
|
|
27919
28212
|
getFeatureName(entitlement.feature, 1)
|
|
27920
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0,
|
|
28213
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: creditBasedEntitlementLimit?.period ? t3("Up to X units per period", {
|
|
27921
28214
|
amount: formatNumber(creditBasedEntitlementLimit.limit),
|
|
27922
28215
|
units: getFeatureName(
|
|
27923
28216
|
entitlement.feature,
|
|
@@ -27930,25 +28223,25 @@ var Entitlement2 = ({
|
|
|
27930
28223
|
entitlement.feature,
|
|
27931
28224
|
creditBasedEntitlementLimit.limit
|
|
27932
28225
|
)
|
|
27933
|
-
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0,
|
|
28226
|
+
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27934
28227
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t3("Unlimited", {
|
|
27935
28228
|
item: getFeatureName(entitlement.feature)
|
|
27936
|
-
}) : /* @__PURE__ */ (0,
|
|
27937
|
-
typeof limit === "number" && /* @__PURE__ */ (0,
|
|
28229
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
28230
|
+
typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27938
28231
|
formatNumber(limit),
|
|
27939
28232
|
" "
|
|
27940
28233
|
] }),
|
|
27941
28234
|
getFeatureName(entitlement.feature, limit)
|
|
27942
28235
|
] }),
|
|
27943
|
-
metricPeriodName && /* @__PURE__ */ (0,
|
|
28236
|
+
metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27944
28237
|
" ",
|
|
27945
28238
|
t3("per"),
|
|
27946
28239
|
" ",
|
|
27947
28240
|
t3(metricPeriodName)
|
|
27948
28241
|
] })
|
|
27949
28242
|
] }) : entitlement.feature.name }),
|
|
27950
|
-
/* @__PURE__ */ (0,
|
|
27951
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0,
|
|
28243
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Text, { children: [
|
|
28244
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
27952
28245
|
Text,
|
|
27953
28246
|
{
|
|
27954
28247
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27958,7 +28251,7 @@ var Entitlement2 = ({
|
|
|
27958
28251
|
" ",
|
|
27959
28252
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27960
28253
|
"/",
|
|
27961
|
-
entitlementPackageSize > 1 && /* @__PURE__ */ (0,
|
|
28254
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27962
28255
|
formatNumber(entitlementPackageSize),
|
|
27963
28256
|
" "
|
|
27964
28257
|
] }),
|
|
@@ -27966,14 +28259,14 @@ var Entitlement2 = ({
|
|
|
27966
28259
|
entitlement.feature,
|
|
27967
28260
|
entitlementPackageSize
|
|
27968
28261
|
),
|
|
27969
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0,
|
|
28262
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
27970
28263
|
"/",
|
|
27971
28264
|
shortenPeriod(selectedPeriod)
|
|
27972
28265
|
] })
|
|
27973
28266
|
]
|
|
27974
28267
|
}
|
|
27975
|
-
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0,
|
|
27976
|
-
/* @__PURE__ */ (0,
|
|
28268
|
+
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
|
|
28269
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27977
28270
|
Text,
|
|
27978
28271
|
{
|
|
27979
28272
|
style: { opacity: 0.54 },
|
|
@@ -27982,7 +28275,7 @@ var Entitlement2 = ({
|
|
|
27982
28275
|
children: t3("Tier-based")
|
|
27983
28276
|
}
|
|
27984
28277
|
),
|
|
27985
|
-
/* @__PURE__ */ (0,
|
|
28278
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27986
28279
|
PricingTiersTooltip,
|
|
27987
28280
|
{
|
|
27988
28281
|
feature: entitlement.feature,
|
|
@@ -27993,14 +28286,14 @@ var Entitlement2 = ({
|
|
|
27993
28286
|
}
|
|
27994
28287
|
)
|
|
27995
28288
|
] }),
|
|
27996
|
-
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0,
|
|
28289
|
+
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
27997
28290
|
HardLimitTooltip,
|
|
27998
28291
|
{
|
|
27999
28292
|
feature: entitlement.feature,
|
|
28000
28293
|
limit: entitlement.valueNumeric
|
|
28001
28294
|
}
|
|
28002
28295
|
),
|
|
28003
|
-
entitlement.billingThreshold && /* @__PURE__ */ (0,
|
|
28296
|
+
entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
28004
28297
|
BillingThresholdTooltip,
|
|
28005
28298
|
{
|
|
28006
28299
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -28008,7 +28301,7 @@ var Entitlement2 = ({
|
|
|
28008
28301
|
)
|
|
28009
28302
|
] })
|
|
28010
28303
|
] }),
|
|
28011
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0,
|
|
28304
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
28012
28305
|
Text,
|
|
28013
28306
|
{
|
|
28014
28307
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -28021,7 +28314,7 @@ var Entitlement2 = ({
|
|
|
28021
28314
|
};
|
|
28022
28315
|
|
|
28023
28316
|
// src/components/elements/pricing-table/Plan.tsx
|
|
28024
|
-
var
|
|
28317
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
28025
28318
|
var Plan2 = ({
|
|
28026
28319
|
plan,
|
|
28027
28320
|
index,
|
|
@@ -28035,7 +28328,7 @@ var Plan2 = ({
|
|
|
28035
28328
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
28036
28329
|
const isLightBackground = useIsLightBackground();
|
|
28037
28330
|
const trialEnd = useTrialEnd();
|
|
28038
|
-
const [entitlementVisibility, setEntitlementVisibility] = (0,
|
|
28331
|
+
const [entitlementVisibility, setEntitlementVisibility] = (0, import_react62.useState)({});
|
|
28039
28332
|
const handleToggleShowAll = (id) => {
|
|
28040
28333
|
setEntitlementVisibility((prev) => {
|
|
28041
28334
|
const updated = !(prev[id] ?? false);
|
|
@@ -28064,7 +28357,7 @@ var Plan2 = ({
|
|
|
28064
28357
|
const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
|
|
28065
28358
|
const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
|
|
28066
28359
|
const isExpanded = entitlementVisibility[plan.id] ?? false;
|
|
28067
|
-
return /* @__PURE__ */ (0,
|
|
28360
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28068
28361
|
Flex,
|
|
28069
28362
|
{
|
|
28070
28363
|
as: "li",
|
|
@@ -28084,7 +28377,7 @@ var Plan2 = ({
|
|
|
28084
28377
|
$boxShadow: cardBoxShadow
|
|
28085
28378
|
},
|
|
28086
28379
|
children: [
|
|
28087
|
-
/* @__PURE__ */ (0,
|
|
28380
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28088
28381
|
Flex,
|
|
28089
28382
|
{
|
|
28090
28383
|
$flexDirection: "column",
|
|
@@ -28095,7 +28388,7 @@ var Plan2 = ({
|
|
|
28095
28388
|
$borderStyle: "solid",
|
|
28096
28389
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
28097
28390
|
children: [
|
|
28098
|
-
/* @__PURE__ */ (0,
|
|
28391
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28099
28392
|
Text,
|
|
28100
28393
|
{
|
|
28101
28394
|
as: "h3",
|
|
@@ -28104,8 +28397,8 @@ var Plan2 = ({
|
|
|
28104
28397
|
children: plan.name
|
|
28105
28398
|
}
|
|
28106
28399
|
) }),
|
|
28107
|
-
layout.plans.description.isVisible && /* @__PURE__ */ (0,
|
|
28108
|
-
/* @__PURE__ */ (0,
|
|
28400
|
+
layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
28401
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28109
28402
|
Text,
|
|
28110
28403
|
{
|
|
28111
28404
|
"data-testid": "sch-plan-price",
|
|
@@ -28121,14 +28414,14 @@ var Plan2 = ({
|
|
|
28121
28414
|
currency: planCurrency,
|
|
28122
28415
|
testSignificantDigits: false
|
|
28123
28416
|
}) : formatCurrency(planPrice ?? 0, planCurrency),
|
|
28124
|
-
!plan.custom && !isFreePlan && /* @__PURE__ */ (0,
|
|
28417
|
+
!plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("sub", { children: [
|
|
28125
28418
|
"/",
|
|
28126
28419
|
showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t3("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t3("month, billed quarterly") : t3(selectedPeriod)
|
|
28127
28420
|
] })
|
|
28128
28421
|
]
|
|
28129
28422
|
}
|
|
28130
28423
|
) }),
|
|
28131
|
-
showCredits && credits.length > 0 && /* @__PURE__ */ (0,
|
|
28424
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28132
28425
|
Flex,
|
|
28133
28426
|
{
|
|
28134
28427
|
as: "ul",
|
|
@@ -28140,8 +28433,8 @@ var Plan2 = ({
|
|
|
28140
28433
|
$margin: 0,
|
|
28141
28434
|
$listStyle: "none",
|
|
28142
28435
|
children: credits.map((credit, idx) => {
|
|
28143
|
-
return /* @__PURE__ */ (0,
|
|
28144
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0,
|
|
28436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
|
|
28437
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28145
28438
|
Icon3,
|
|
28146
28439
|
{
|
|
28147
28440
|
"data-testid": "sch-feature-icon",
|
|
@@ -28151,13 +28444,13 @@ var Plan2 = ({
|
|
|
28151
28444
|
rounded: true
|
|
28152
28445
|
}
|
|
28153
28446
|
),
|
|
28154
|
-
credit.name && /* @__PURE__ */ (0,
|
|
28447
|
+
credit.name && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28155
28448
|
Flex,
|
|
28156
28449
|
{
|
|
28157
28450
|
$flexDirection: "column",
|
|
28158
28451
|
$justifyContent: "center",
|
|
28159
28452
|
$gap: "0.5rem",
|
|
28160
|
-
children: /* @__PURE__ */ (0,
|
|
28453
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28161
28454
|
PlanCreditText,
|
|
28162
28455
|
{
|
|
28163
28456
|
credit,
|
|
@@ -28170,7 +28463,7 @@ var Plan2 = ({
|
|
|
28170
28463
|
})
|
|
28171
28464
|
}
|
|
28172
28465
|
),
|
|
28173
|
-
isActivePlan && /* @__PURE__ */ (0,
|
|
28466
|
+
isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28174
28467
|
Flex,
|
|
28175
28468
|
{
|
|
28176
28469
|
"data-testid": "sch-plan-active",
|
|
@@ -28180,7 +28473,7 @@ var Plan2 = ({
|
|
|
28180
28473
|
$backgroundColor: settings.theme.primary,
|
|
28181
28474
|
$borderRadius: "9999px",
|
|
28182
28475
|
$padding: "0.125rem 0.85rem",
|
|
28183
|
-
children: /* @__PURE__ */ (0,
|
|
28476
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28184
28477
|
Text,
|
|
28185
28478
|
{
|
|
28186
28479
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28193,7 +28486,7 @@ var Plan2 = ({
|
|
|
28193
28486
|
]
|
|
28194
28487
|
}
|
|
28195
28488
|
),
|
|
28196
|
-
/* @__PURE__ */ (0,
|
|
28489
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28197
28490
|
Flex,
|
|
28198
28491
|
{
|
|
28199
28492
|
$flexDirection: "column",
|
|
@@ -28202,7 +28495,7 @@ var Plan2 = ({
|
|
|
28202
28495
|
$gap: `${cardPadding}rem`,
|
|
28203
28496
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
28204
28497
|
children: [
|
|
28205
|
-
layout.plans.showEntitlements && /* @__PURE__ */ (0,
|
|
28498
|
+
layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28206
28499
|
Flex,
|
|
28207
28500
|
{
|
|
28208
28501
|
as: "ul",
|
|
@@ -28213,14 +28506,14 @@ var Plan2 = ({
|
|
|
28213
28506
|
$margin: 0,
|
|
28214
28507
|
$listStyle: "none",
|
|
28215
28508
|
children: [
|
|
28216
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0,
|
|
28509
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { children: t3("Everything in", {
|
|
28217
28510
|
plan: plans[index - 1].name
|
|
28218
28511
|
}) }) }),
|
|
28219
28512
|
(plan.entitlements ?? []).reduce(
|
|
28220
28513
|
(acc, entitlement, idx) => {
|
|
28221
28514
|
if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
|
|
28222
28515
|
acc.push(
|
|
28223
|
-
/* @__PURE__ */ (0,
|
|
28516
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28224
28517
|
Entitlement2,
|
|
28225
28518
|
{
|
|
28226
28519
|
entitlement,
|
|
@@ -28238,7 +28531,7 @@ var Plan2 = ({
|
|
|
28238
28531
|
},
|
|
28239
28532
|
[]
|
|
28240
28533
|
),
|
|
28241
|
-
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0,
|
|
28534
|
+
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28242
28535
|
ExpandListToggle,
|
|
28243
28536
|
{
|
|
28244
28537
|
as: "li",
|
|
@@ -28253,7 +28546,7 @@ var Plan2 = ({
|
|
|
28253
28546
|
]
|
|
28254
28547
|
}
|
|
28255
28548
|
),
|
|
28256
|
-
isActivePlan ? /* @__PURE__ */ (0,
|
|
28549
|
+
isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
|
|
28257
28550
|
Flex,
|
|
28258
28551
|
{
|
|
28259
28552
|
$justifyContent: "center",
|
|
@@ -28261,7 +28554,7 @@ var Plan2 = ({
|
|
|
28261
28554
|
$gap: "0.25rem",
|
|
28262
28555
|
$padding: "0.625rem 0",
|
|
28263
28556
|
children: [
|
|
28264
|
-
/* @__PURE__ */ (0,
|
|
28557
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28265
28558
|
Icon3,
|
|
28266
28559
|
{
|
|
28267
28560
|
name: "check-rounded",
|
|
@@ -28269,11 +28562,11 @@ var Plan2 = ({
|
|
|
28269
28562
|
color: settings.theme.primary
|
|
28270
28563
|
}
|
|
28271
28564
|
),
|
|
28272
|
-
/* @__PURE__ */ (0,
|
|
28565
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { $size: 15, $leading: "none", children: t3("Current plan") })
|
|
28273
28566
|
]
|
|
28274
28567
|
}
|
|
28275
|
-
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0,
|
|
28276
|
-
/* @__PURE__ */ (0,
|
|
28568
|
+
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28569
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
28277
28570
|
Button,
|
|
28278
28571
|
{
|
|
28279
28572
|
type: "button",
|
|
@@ -28311,10 +28604,10 @@ var Plan2 = ({
|
|
|
28311
28604
|
}
|
|
28312
28605
|
},
|
|
28313
28606
|
$fullWidth: true,
|
|
28314
|
-
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t3("Talk to support") : !plan.valid ? /* @__PURE__ */ (0,
|
|
28607
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t3("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { as: Box, $align: "center", children: t3("Over plan limit") }) : t3("Choose plan")
|
|
28315
28608
|
}
|
|
28316
28609
|
),
|
|
28317
|
-
!plan.valid && /* @__PURE__ */ (0,
|
|
28610
|
+
!plan.valid && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UsageViolationText, { violations: plan.usageViolations })
|
|
28318
28611
|
] })
|
|
28319
28612
|
]
|
|
28320
28613
|
}
|
|
@@ -28325,7 +28618,7 @@ var Plan2 = ({
|
|
|
28325
28618
|
};
|
|
28326
28619
|
|
|
28327
28620
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
28328
|
-
var
|
|
28621
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
28329
28622
|
var resolveDesignProps8 = (props) => {
|
|
28330
28623
|
return {
|
|
28331
28624
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -28368,11 +28661,11 @@ var resolveDesignProps8 = (props) => {
|
|
|
28368
28661
|
}
|
|
28369
28662
|
};
|
|
28370
28663
|
};
|
|
28371
|
-
var PricingTable = (0,
|
|
28664
|
+
var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref) => {
|
|
28372
28665
|
const props = resolveDesignProps8(rest);
|
|
28373
28666
|
const { t: t3 } = useTranslation();
|
|
28374
28667
|
const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
|
|
28375
|
-
const getCallToActionTarget = (0,
|
|
28668
|
+
const getCallToActionTarget = (0, import_react63.useCallback)(
|
|
28376
28669
|
(url, target) => {
|
|
28377
28670
|
if (target) {
|
|
28378
28671
|
return target;
|
|
@@ -28390,11 +28683,11 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28390
28683
|
},
|
|
28391
28684
|
[]
|
|
28392
28685
|
);
|
|
28393
|
-
const [selectedPeriod, setSelectedPeriod] = (0,
|
|
28686
|
+
const [selectedPeriod, setSelectedPeriod] = (0, import_react63.useState)(
|
|
28394
28687
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
|
|
28395
28688
|
);
|
|
28396
28689
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
28397
|
-
const [selectedCurrency, setSelectedCurrency] = (0,
|
|
28690
|
+
const [selectedCurrency, setSelectedCurrency] = (0, import_react63.useState)(
|
|
28398
28691
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
28399
28692
|
);
|
|
28400
28693
|
if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
|
|
@@ -28412,25 +28705,25 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28412
28705
|
} = useAvailablePlans(selectedPeriod, {
|
|
28413
28706
|
useSelectedPeriod: showPeriodToggle
|
|
28414
28707
|
});
|
|
28415
|
-
const plans = (0,
|
|
28708
|
+
const plans = (0, import_react63.useMemo)(
|
|
28416
28709
|
() => hasCurrency ? allPlans.filter(
|
|
28417
28710
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
28418
28711
|
) : allPlans,
|
|
28419
28712
|
[allPlans, hasCurrency, selectedCurrency]
|
|
28420
28713
|
);
|
|
28421
|
-
const addOns = (0,
|
|
28714
|
+
const addOns = (0, import_react63.useMemo)(
|
|
28422
28715
|
() => hasCurrency ? allAddOns.filter(
|
|
28423
28716
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
28424
28717
|
) : allAddOns,
|
|
28425
28718
|
[allAddOns, hasCurrency, selectedCurrency]
|
|
28426
28719
|
);
|
|
28427
|
-
(0,
|
|
28720
|
+
(0, import_react63.useEffect)(() => {
|
|
28428
28721
|
if (typeof data?.component === "undefined") {
|
|
28429
28722
|
hydratePublic();
|
|
28430
28723
|
}
|
|
28431
28724
|
}, [data?.component, hydratePublic]);
|
|
28432
28725
|
if (isPending) {
|
|
28433
|
-
return /* @__PURE__ */ (0,
|
|
28726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28434
28727
|
Flex,
|
|
28435
28728
|
{
|
|
28436
28729
|
$width: "100%",
|
|
@@ -28438,12 +28731,12 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28438
28731
|
$alignItems: "center",
|
|
28439
28732
|
$justifyContent: "center",
|
|
28440
28733
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
28441
|
-
children: /* @__PURE__ */ (0,
|
|
28734
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
|
|
28442
28735
|
}
|
|
28443
28736
|
);
|
|
28444
28737
|
}
|
|
28445
28738
|
if (hasNoUsableCurrency) {
|
|
28446
|
-
return /* @__PURE__ */ (0,
|
|
28739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
|
|
28447
28740
|
}
|
|
28448
28741
|
const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
|
|
28449
28742
|
const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
|
|
@@ -28451,8 +28744,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28451
28744
|
rest.callToActionUrl,
|
|
28452
28745
|
rest.callToActionTarget
|
|
28453
28746
|
);
|
|
28454
|
-
const Wrapper = typeof data?.component === "undefined" ? Container :
|
|
28455
|
-
return /* @__PURE__ */ (0,
|
|
28747
|
+
const Wrapper = typeof data?.component === "undefined" ? Container : import_react63.Fragment;
|
|
28748
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
28456
28749
|
FussyChild,
|
|
28457
28750
|
{
|
|
28458
28751
|
ref,
|
|
@@ -28462,8 +28755,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28462
28755
|
$flexDirection: "column",
|
|
28463
28756
|
$gap: "2rem",
|
|
28464
28757
|
children: [
|
|
28465
|
-
/* @__PURE__ */ (0,
|
|
28466
|
-
/* @__PURE__ */ (0,
|
|
28758
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Box, { children: [
|
|
28759
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
28467
28760
|
Flex,
|
|
28468
28761
|
{
|
|
28469
28762
|
$flexDirection: "column",
|
|
@@ -28478,7 +28771,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28478
28771
|
}
|
|
28479
28772
|
},
|
|
28480
28773
|
children: [
|
|
28481
|
-
/* @__PURE__ */ (0,
|
|
28774
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28482
28775
|
Text,
|
|
28483
28776
|
{
|
|
28484
28777
|
as: "h2",
|
|
@@ -28487,8 +28780,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28487
28780
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t3("Plans")
|
|
28488
28781
|
}
|
|
28489
28782
|
),
|
|
28490
|
-
/* @__PURE__ */ (0,
|
|
28491
|
-
showCurrencySelector && /* @__PURE__ */ (0,
|
|
28783
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
|
|
28784
|
+
showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28492
28785
|
CurrencyToggle,
|
|
28493
28786
|
{
|
|
28494
28787
|
currencies,
|
|
@@ -28496,7 +28789,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28496
28789
|
onSelect: setSelectedCurrency
|
|
28497
28790
|
}
|
|
28498
28791
|
),
|
|
28499
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0,
|
|
28792
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28500
28793
|
PeriodToggle,
|
|
28501
28794
|
{
|
|
28502
28795
|
options: periods,
|
|
@@ -28513,7 +28806,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28513
28806
|
]
|
|
28514
28807
|
}
|
|
28515
28808
|
),
|
|
28516
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0,
|
|
28809
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28517
28810
|
Box,
|
|
28518
28811
|
{
|
|
28519
28812
|
as: "ul",
|
|
@@ -28526,7 +28819,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28526
28819
|
$listStyle: "none",
|
|
28527
28820
|
children: plans.map((plan, index, self2) => {
|
|
28528
28821
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28529
|
-
return /* @__PURE__ */ (0,
|
|
28822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28530
28823
|
Plan2,
|
|
28531
28824
|
{
|
|
28532
28825
|
plan,
|
|
@@ -28548,14 +28841,14 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28548
28841
|
}
|
|
28549
28842
|
)
|
|
28550
28843
|
] }),
|
|
28551
|
-
/* @__PURE__ */ (0,
|
|
28552
|
-
props.header.isVisible && /* @__PURE__ */ (0,
|
|
28844
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
|
|
28845
|
+
props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28553
28846
|
Flex,
|
|
28554
28847
|
{
|
|
28555
28848
|
$justifyContent: "space-between",
|
|
28556
28849
|
$alignItems: "center",
|
|
28557
28850
|
$marginBottom: "1rem",
|
|
28558
|
-
children: /* @__PURE__ */ (0,
|
|
28851
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28559
28852
|
Text,
|
|
28560
28853
|
{
|
|
28561
28854
|
as: "h2",
|
|
@@ -28566,7 +28859,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28566
28859
|
)
|
|
28567
28860
|
}
|
|
28568
28861
|
),
|
|
28569
|
-
/* @__PURE__ */ (0,
|
|
28862
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28570
28863
|
Box,
|
|
28571
28864
|
{
|
|
28572
28865
|
as: "ul",
|
|
@@ -28578,7 +28871,7 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28578
28871
|
$listStyle: "none",
|
|
28579
28872
|
children: addOns.map((addOn, index) => {
|
|
28580
28873
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28581
|
-
return /* @__PURE__ */ (0,
|
|
28874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
28582
28875
|
AddOn2,
|
|
28583
28876
|
{
|
|
28584
28877
|
addOn,
|
|
@@ -28605,8 +28898,8 @@ var PricingTable = (0, import_react62.forwardRef)(({ className, ...rest }, ref)
|
|
|
28605
28898
|
PricingTable.displayName = "PricingTable";
|
|
28606
28899
|
|
|
28607
28900
|
// src/components/elements/text/Text.tsx
|
|
28608
|
-
var
|
|
28609
|
-
var
|
|
28901
|
+
var import_react64 = require("react");
|
|
28902
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
28610
28903
|
var resolveDesignProps9 = (props) => {
|
|
28611
28904
|
return {
|
|
28612
28905
|
text: {
|
|
@@ -28616,9 +28909,9 @@ var resolveDesignProps9 = (props) => {
|
|
|
28616
28909
|
}
|
|
28617
28910
|
};
|
|
28618
28911
|
};
|
|
28619
|
-
var TextElement = (0,
|
|
28912
|
+
var TextElement = (0, import_react64.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
28620
28913
|
const props = resolveDesignProps9(rest);
|
|
28621
|
-
return /* @__PURE__ */ (0,
|
|
28914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
28622
28915
|
Text,
|
|
28623
28916
|
{
|
|
28624
28917
|
display: props.text.fontStyle,
|
|
@@ -28631,8 +28924,8 @@ var TextElement = (0, import_react63.forwardRef)(({ children, className, ...rest
|
|
|
28631
28924
|
TextElement.displayName = "Text";
|
|
28632
28925
|
|
|
28633
28926
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28634
|
-
var
|
|
28635
|
-
var
|
|
28927
|
+
var import_react65 = require("react");
|
|
28928
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
28636
28929
|
var buttonStyles = {
|
|
28637
28930
|
primary: {
|
|
28638
28931
|
color: "primary",
|
|
@@ -28658,17 +28951,17 @@ var resolveDesignProps10 = (props) => {
|
|
|
28658
28951
|
}
|
|
28659
28952
|
};
|
|
28660
28953
|
};
|
|
28661
|
-
var UnsubscribeButton = (0,
|
|
28954
|
+
var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, ...rest }, ref) => {
|
|
28662
28955
|
const props = resolveDesignProps10(rest);
|
|
28663
28956
|
const { t: t3 } = useTranslation();
|
|
28664
28957
|
const { data, setLayout } = useEmbed();
|
|
28665
|
-
const hasActiveSubscription = (0,
|
|
28958
|
+
const hasActiveSubscription = (0, import_react65.useMemo)(() => {
|
|
28666
28959
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28667
28960
|
}, [data?.subscription]);
|
|
28668
28961
|
if (!hasActiveSubscription) {
|
|
28669
28962
|
return null;
|
|
28670
28963
|
}
|
|
28671
|
-
return /* @__PURE__ */ (0,
|
|
28964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
28672
28965
|
Element,
|
|
28673
28966
|
{
|
|
28674
28967
|
as: Flex,
|
|
@@ -28676,7 +28969,7 @@ var UnsubscribeButton = (0, import_react64.forwardRef)(({ children, className, .
|
|
|
28676
28969
|
className,
|
|
28677
28970
|
$flexDirection: "column",
|
|
28678
28971
|
$gap: "2rem",
|
|
28679
|
-
children: /* @__PURE__ */ (0,
|
|
28972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
28680
28973
|
Button,
|
|
28681
28974
|
{
|
|
28682
28975
|
type: "button",
|
|
@@ -28697,8 +28990,8 @@ var UnsubscribeButton = (0, import_react64.forwardRef)(({ children, className, .
|
|
|
28697
28990
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
28698
28991
|
|
|
28699
28992
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
28700
|
-
var
|
|
28701
|
-
var
|
|
28993
|
+
var import_react66 = require("react");
|
|
28994
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
28702
28995
|
function resolveDesignProps11(props) {
|
|
28703
28996
|
return {
|
|
28704
28997
|
header: {
|
|
@@ -28717,15 +29010,15 @@ function resolveDesignProps11(props) {
|
|
|
28717
29010
|
}
|
|
28718
29011
|
};
|
|
28719
29012
|
}
|
|
28720
|
-
var UpcomingBill = (0,
|
|
29013
|
+
var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref) => {
|
|
28721
29014
|
const props = resolveDesignProps11(rest);
|
|
28722
29015
|
const { t: t3 } = useTranslation();
|
|
28723
29016
|
const { data, settings, getUpcomingInvoice } = useEmbed();
|
|
28724
29017
|
const isLightBackground = useIsLightBackground();
|
|
28725
|
-
const [isLoading, setIsLoading] = (0,
|
|
28726
|
-
const [error, setError] = (0,
|
|
28727
|
-
const [upcomingInvoice, setUpcomingInvoice] = (0,
|
|
28728
|
-
const discounts = (0,
|
|
29018
|
+
const [isLoading, setIsLoading] = (0, import_react66.useState)(false);
|
|
29019
|
+
const [error, setError] = (0, import_react66.useState)();
|
|
29020
|
+
const [upcomingInvoice, setUpcomingInvoice] = (0, import_react66.useState)(data?.upcomingInvoice);
|
|
29021
|
+
const discounts = (0, import_react66.useMemo)(() => {
|
|
28729
29022
|
return (data?.subscription?.discounts || []).filter(
|
|
28730
29023
|
(discount) => (
|
|
28731
29024
|
// Only surface discounts that are currently active and actually
|
|
@@ -28743,7 +29036,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28743
29036
|
durationInMonths: discount.durationInMonths ?? void 0
|
|
28744
29037
|
}));
|
|
28745
29038
|
}, [data?.subscription?.discounts]);
|
|
28746
|
-
const getInvoice = (0,
|
|
29039
|
+
const getInvoice = (0, import_react66.useCallback)(async () => {
|
|
28747
29040
|
if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
|
|
28748
29041
|
try {
|
|
28749
29042
|
setError(void 0);
|
|
@@ -28759,15 +29052,15 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28759
29052
|
}
|
|
28760
29053
|
}
|
|
28761
29054
|
}, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
|
|
28762
|
-
(0,
|
|
29055
|
+
(0, import_react66.useEffect)(() => {
|
|
28763
29056
|
getInvoice();
|
|
28764
29057
|
}, [getInvoice]);
|
|
28765
|
-
(0,
|
|
29058
|
+
(0, import_react66.useEffect)(() => {
|
|
28766
29059
|
if (data?.upcomingInvoice) {
|
|
28767
29060
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
28768
29061
|
}
|
|
28769
29062
|
}, [data?.upcomingInvoice]);
|
|
28770
|
-
const { currency, applied, remaining } = (0,
|
|
29063
|
+
const { currency, applied, remaining } = (0, import_react66.useMemo)(() => {
|
|
28771
29064
|
const currency2 = upcomingInvoice?.currency;
|
|
28772
29065
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
28773
29066
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -28786,9 +29079,9 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28786
29079
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
28787
29080
|
return null;
|
|
28788
29081
|
}
|
|
28789
|
-
return /* @__PURE__ */ (0,
|
|
28790
|
-
/* @__PURE__ */ (0,
|
|
28791
|
-
error ? /* @__PURE__ */ (0,
|
|
29082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Element, { ref, className, children: [
|
|
29083
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
29084
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28792
29085
|
Flex,
|
|
28793
29086
|
{
|
|
28794
29087
|
as: TransitionBox,
|
|
@@ -28797,8 +29090,8 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28797
29090
|
$alignItems: "center",
|
|
28798
29091
|
$gap: "1rem",
|
|
28799
29092
|
children: [
|
|
28800
|
-
/* @__PURE__ */ (0,
|
|
28801
|
-
/* @__PURE__ */ (0,
|
|
29093
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t3("There was a problem retrieving your upcoming invoice.") }),
|
|
29094
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28802
29095
|
Button,
|
|
28803
29096
|
{
|
|
28804
29097
|
type: "button",
|
|
@@ -28811,28 +29104,28 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28811
29104
|
)
|
|
28812
29105
|
]
|
|
28813
29106
|
}
|
|
28814
|
-
) : !isLoading && /* @__PURE__ */ (0,
|
|
28815
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0,
|
|
29107
|
+
) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
29108
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Text, { display: props.header.fontStyle, children: [
|
|
28816
29109
|
props.header.prefix,
|
|
28817
29110
|
" ",
|
|
28818
29111
|
toPrettyDate(upcomingInvoice.dueDate)
|
|
28819
29112
|
] }),
|
|
28820
|
-
/* @__PURE__ */ (0,
|
|
29113
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28821
29114
|
Flex,
|
|
28822
29115
|
{
|
|
28823
29116
|
$justifyContent: "space-between",
|
|
28824
29117
|
$alignItems: "start",
|
|
28825
29118
|
$gap: "1rem",
|
|
28826
29119
|
children: [
|
|
28827
|
-
props.price.isVisible && /* @__PURE__ */ (0,
|
|
29120
|
+
props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
|
|
28828
29121
|
upcomingInvoice.amountDue,
|
|
28829
29122
|
upcomingInvoice.currency
|
|
28830
29123
|
) }),
|
|
28831
|
-
/* @__PURE__ */ (0,
|
|
29124
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t3("Estimated bill") }) })
|
|
28832
29125
|
]
|
|
28833
29126
|
}
|
|
28834
29127
|
),
|
|
28835
|
-
hasApplied && /* @__PURE__ */ (0,
|
|
29128
|
+
hasApplied && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28836
29129
|
Flex,
|
|
28837
29130
|
{
|
|
28838
29131
|
as: TransitionBox,
|
|
@@ -28840,12 +29133,12 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28840
29133
|
$alignItems: "start",
|
|
28841
29134
|
$gap: "1rem",
|
|
28842
29135
|
children: [
|
|
28843
|
-
/* @__PURE__ */ (0,
|
|
28844
|
-
/* @__PURE__ */ (0,
|
|
29136
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Applied balance towards next invoice") }),
|
|
29137
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(-applied, currency) })
|
|
28845
29138
|
]
|
|
28846
29139
|
}
|
|
28847
29140
|
),
|
|
28848
|
-
hasBalance && /* @__PURE__ */ (0,
|
|
29141
|
+
hasBalance && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28849
29142
|
Flex,
|
|
28850
29143
|
{
|
|
28851
29144
|
as: TransitionBox,
|
|
@@ -28853,20 +29146,20 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28853
29146
|
$alignItems: "start",
|
|
28854
29147
|
$gap: "1rem",
|
|
28855
29148
|
children: [
|
|
28856
|
-
/* @__PURE__ */ (0,
|
|
28857
|
-
/* @__PURE__ */ (0,
|
|
29149
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Remaining balance after next invoice") }),
|
|
29150
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(remaining, currency) })
|
|
28858
29151
|
]
|
|
28859
29152
|
}
|
|
28860
29153
|
),
|
|
28861
|
-
discounts.length > 0 && /* @__PURE__ */ (0,
|
|
29154
|
+
discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28862
29155
|
Flex,
|
|
28863
29156
|
{
|
|
28864
29157
|
$justifyContent: "space-between",
|
|
28865
29158
|
$alignItems: "start",
|
|
28866
29159
|
$gap: "1rem",
|
|
28867
29160
|
children: [
|
|
28868
|
-
/* @__PURE__ */ (0,
|
|
28869
|
-
/* @__PURE__ */ (0,
|
|
29161
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t3("Discount") }),
|
|
29162
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28870
29163
|
Flex,
|
|
28871
29164
|
{
|
|
28872
29165
|
$flexDirection: "column",
|
|
@@ -28882,13 +29175,13 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28882
29175
|
discount?.currency
|
|
28883
29176
|
)
|
|
28884
29177
|
});
|
|
28885
|
-
return /* @__PURE__ */ (0,
|
|
29178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
|
|
28886
29179
|
Flex,
|
|
28887
29180
|
{
|
|
28888
29181
|
$alignItems: "center",
|
|
28889
29182
|
$gap: "0.5rem",
|
|
28890
29183
|
children: [
|
|
28891
|
-
discount.customerFacingCode && /* @__PURE__ */ (0,
|
|
29184
|
+
discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28892
29185
|
Flex,
|
|
28893
29186
|
{
|
|
28894
29187
|
$alignItems: "center",
|
|
@@ -28897,7 +29190,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28897
29190
|
$borderStyle: "solid",
|
|
28898
29191
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
28899
29192
|
$borderRadius: "0.3125rem",
|
|
28900
|
-
children: /* @__PURE__ */ (0,
|
|
29193
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
28901
29194
|
Text,
|
|
28902
29195
|
{
|
|
28903
29196
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28907,7 +29200,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28907
29200
|
)
|
|
28908
29201
|
}
|
|
28909
29202
|
),
|
|
28910
|
-
/* @__PURE__ */ (0,
|
|
29203
|
+
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t3("Discount for months", {
|
|
28911
29204
|
discount: label,
|
|
28912
29205
|
count: discount.durationInMonths
|
|
28913
29206
|
}) : label }) })
|
|
@@ -28921,7 +29214,7 @@ var UpcomingBill = (0, import_react65.forwardRef)(({ className, ...rest }, ref)
|
|
|
28921
29214
|
]
|
|
28922
29215
|
}
|
|
28923
29216
|
)
|
|
28924
|
-
] }) : /* @__PURE__ */ (0,
|
|
29217
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading2", children: t3("No upcoming invoice") }) })
|
|
28925
29218
|
] });
|
|
28926
29219
|
});
|
|
28927
29220
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -31557,11 +31850,11 @@ function inflate(input, options = {}) {
|
|
|
31557
31850
|
}
|
|
31558
31851
|
|
|
31559
31852
|
// src/components/embed/Embed.tsx
|
|
31560
|
-
var
|
|
31853
|
+
var import_react68 = require("react");
|
|
31561
31854
|
var import_styled_components23 = __toESM(require_styled_components_cjs());
|
|
31562
31855
|
|
|
31563
31856
|
// src/components/embed/renderer.ts
|
|
31564
|
-
var
|
|
31857
|
+
var import_react67 = require("react");
|
|
31565
31858
|
var components = {
|
|
31566
31859
|
Root,
|
|
31567
31860
|
Viewport,
|
|
@@ -31625,7 +31918,7 @@ function createRenderer(options) {
|
|
|
31625
31918
|
const { className, ...rest } = props;
|
|
31626
31919
|
const resolvedProps = component === "div" ? rest : props;
|
|
31627
31920
|
const resolvedChildren = children.map(renderNode);
|
|
31628
|
-
return (0,
|
|
31921
|
+
return (0, import_react67.createElement)(
|
|
31629
31922
|
component,
|
|
31630
31923
|
{
|
|
31631
31924
|
key: index,
|
|
@@ -31638,11 +31931,11 @@ function createRenderer(options) {
|
|
|
31638
31931
|
}
|
|
31639
31932
|
|
|
31640
31933
|
// src/components/embed/Embed.tsx
|
|
31641
|
-
var
|
|
31934
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
31642
31935
|
var renderer = createRenderer();
|
|
31643
31936
|
var Loading = () => {
|
|
31644
31937
|
const { settings } = useEmbed();
|
|
31645
|
-
return /* @__PURE__ */ (0,
|
|
31938
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
31646
31939
|
Flex,
|
|
31647
31940
|
{
|
|
31648
31941
|
$width: "100%",
|
|
@@ -31650,13 +31943,13 @@ var Loading = () => {
|
|
|
31650
31943
|
$alignItems: "center",
|
|
31651
31944
|
$justifyContent: "center",
|
|
31652
31945
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
31653
|
-
children: /* @__PURE__ */ (0,
|
|
31946
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
|
|
31654
31947
|
}
|
|
31655
31948
|
);
|
|
31656
31949
|
};
|
|
31657
31950
|
var Error2 = ({ message }) => {
|
|
31658
31951
|
const { settings } = useEmbed();
|
|
31659
|
-
return /* @__PURE__ */ (0,
|
|
31952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
31660
31953
|
Flex,
|
|
31661
31954
|
{
|
|
31662
31955
|
$flexDirection: "column",
|
|
@@ -31667,14 +31960,14 @@ var Error2 = ({ message }) => {
|
|
|
31667
31960
|
$alignItems: "center",
|
|
31668
31961
|
$justifyContent: "center",
|
|
31669
31962
|
children: [
|
|
31670
|
-
/* @__PURE__ */ (0,
|
|
31671
|
-
/* @__PURE__ */ (0,
|
|
31963
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { display: "heading1", children: "Error" }) }),
|
|
31964
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: message }) })
|
|
31672
31965
|
]
|
|
31673
31966
|
}
|
|
31674
31967
|
);
|
|
31675
31968
|
};
|
|
31676
31969
|
var SchematicEmbed = ({ id, accessToken }) => {
|
|
31677
|
-
const theme = (0,
|
|
31970
|
+
const theme = (0, import_react68.useContext)(import_styled_components23.ThemeContext);
|
|
31678
31971
|
const {
|
|
31679
31972
|
data,
|
|
31680
31973
|
error,
|
|
@@ -31686,7 +31979,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31686
31979
|
setBuilderSettings
|
|
31687
31980
|
} = useEmbed();
|
|
31688
31981
|
const compressedAst = data?.component?.ast;
|
|
31689
|
-
const { children, parsedSettings, parseError } = (0,
|
|
31982
|
+
const { children, parsedSettings, parseError } = (0, import_react68.useMemo)(() => {
|
|
31690
31983
|
let children2 = null;
|
|
31691
31984
|
let parsedSettings2 = null;
|
|
31692
31985
|
let parseError2 = null;
|
|
@@ -31718,22 +32011,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31718
32011
|
parseError: parseError2
|
|
31719
32012
|
};
|
|
31720
32013
|
}, [compressedAst]);
|
|
31721
|
-
(0,
|
|
32014
|
+
(0, import_react68.useEffect)(() => {
|
|
31722
32015
|
if (accessToken) {
|
|
31723
32016
|
setAccessToken(accessToken);
|
|
31724
32017
|
}
|
|
31725
32018
|
}, [accessToken, setAccessToken]);
|
|
31726
|
-
(0,
|
|
32019
|
+
(0, import_react68.useEffect)(() => {
|
|
31727
32020
|
if (id && stale) {
|
|
31728
32021
|
hydrateComponent(id);
|
|
31729
32022
|
}
|
|
31730
32023
|
}, [id, hydrateComponent, stale]);
|
|
31731
|
-
(0,
|
|
32024
|
+
(0, import_react68.useEffect)(() => {
|
|
31732
32025
|
if (parsedSettings) {
|
|
31733
32026
|
setBuilderSettings(parsedSettings);
|
|
31734
32027
|
}
|
|
31735
32028
|
}, [parsedSettings, setBuilderSettings]);
|
|
31736
|
-
(0,
|
|
32029
|
+
(0, import_react68.useEffect)(() => {
|
|
31737
32030
|
if (parseError) {
|
|
31738
32031
|
setError(parseError);
|
|
31739
32032
|
}
|
|
@@ -31742,13 +32035,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31742
32035
|
return stub();
|
|
31743
32036
|
}
|
|
31744
32037
|
if (error) {
|
|
31745
|
-
return /* @__PURE__ */ (0,
|
|
32038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: error.message });
|
|
31746
32039
|
}
|
|
31747
32040
|
if (accessToken?.length === 0) {
|
|
31748
|
-
return /* @__PURE__ */ (0,
|
|
32041
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: "Please provide an access token." });
|
|
31749
32042
|
}
|
|
31750
32043
|
if (!accessToken?.startsWith("token_")) {
|
|
31751
|
-
return /* @__PURE__ */ (0,
|
|
32044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
31752
32045
|
Error2,
|
|
31753
32046
|
{
|
|
31754
32047
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -31756,7 +32049,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31756
32049
|
);
|
|
31757
32050
|
}
|
|
31758
32051
|
if (isPending) {
|
|
31759
|
-
return /* @__PURE__ */ (0,
|
|
32052
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {});
|
|
31760
32053
|
}
|
|
31761
|
-
return /* @__PURE__ */ (0,
|
|
32054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {}) });
|
|
31762
32055
|
};
|