@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
|
@@ -1717,7 +1717,7 @@ var require_debounce = __commonJS({
|
|
|
1717
1717
|
var FUNC_ERROR_TEXT = "Expected a function";
|
|
1718
1718
|
var nativeMax = Math.max;
|
|
1719
1719
|
var nativeMin = Math.min;
|
|
1720
|
-
function
|
|
1720
|
+
function debounce6(func, wait, options) {
|
|
1721
1721
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
1722
1722
|
if (typeof func != "function") {
|
|
1723
1723
|
throw new TypeError(FUNC_ERROR_TEXT);
|
|
@@ -1798,7 +1798,7 @@ var require_debounce = __commonJS({
|
|
|
1798
1798
|
debounced.flush = flush;
|
|
1799
1799
|
return debounced;
|
|
1800
1800
|
}
|
|
1801
|
-
module.exports =
|
|
1801
|
+
module.exports = debounce6;
|
|
1802
1802
|
}
|
|
1803
1803
|
});
|
|
1804
1804
|
|
|
@@ -1957,6 +1957,8 @@ var initialContext = {
|
|
|
1957
1957
|
getUpcomingInvoice: stub,
|
|
1958
1958
|
getCustomerBalance: stub,
|
|
1959
1959
|
listInvoices: stub,
|
|
1960
|
+
getCreditUsageByUser: stub,
|
|
1961
|
+
getFeatureUsageByUser: stub,
|
|
1960
1962
|
createSetupIntent: stub,
|
|
1961
1963
|
updatePaymentMethod: stub,
|
|
1962
1964
|
deletePaymentMethod: stub,
|
|
@@ -5248,6 +5250,18 @@ var en_default = {
|
|
|
5248
5250
|
"month, billed yearly": "month, billed yearly",
|
|
5249
5251
|
"month, billed quarterly": "month, billed quarterly",
|
|
5250
5252
|
purchased: "purchased {{date}}",
|
|
5253
|
+
"Usage by user": "Usage by user",
|
|
5254
|
+
"X used by your team this period": "{{amount}} used by your team this period",
|
|
5255
|
+
"Show all X users_one": "Show all {{count}} user",
|
|
5256
|
+
"Show all X users_other": "Show all {{count}} users",
|
|
5257
|
+
"Show top X users_one": "Show top {{count}} user",
|
|
5258
|
+
"Show top X users_other": "Show top {{count}} users",
|
|
5259
|
+
"Show all": "Show all",
|
|
5260
|
+
"Show fewer": "Show fewer",
|
|
5261
|
+
Unattributed: "Unattributed",
|
|
5262
|
+
"There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
|
|
5263
|
+
"plus X more_one": "plus {{count}} more",
|
|
5264
|
+
"plus X more_other": "plus {{count}} more",
|
|
5251
5265
|
usage: {
|
|
5252
5266
|
limited: "{{amount}} of {{allocation}} used",
|
|
5253
5267
|
unlimited: "{{amount}} used"
|
|
@@ -6978,7 +6992,7 @@ var Icon = ({ name, className = "", ...rest }) => {
|
|
|
6978
6992
|
};
|
|
6979
6993
|
|
|
6980
6994
|
// src/context/EmbedProvider.tsx
|
|
6981
|
-
var
|
|
6995
|
+
var import_debounce2 = __toESM(require_debounce());
|
|
6982
6996
|
var import_merge3 = __toESM(require_merge());
|
|
6983
6997
|
import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useReducer, useRef as useRef2 } from "react";
|
|
6984
6998
|
|
|
@@ -13247,6 +13261,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
|
|
|
13247
13261
|
}
|
|
13248
13262
|
return cost;
|
|
13249
13263
|
}
|
|
13264
|
+
function calculateQuantityCost(billingPrice, quantity) {
|
|
13265
|
+
if (!billingPrice) {
|
|
13266
|
+
return 0;
|
|
13267
|
+
}
|
|
13268
|
+
if (isTieredPrice(billingPrice)) {
|
|
13269
|
+
return calculateTieredCost(
|
|
13270
|
+
quantity,
|
|
13271
|
+
billingPrice.priceTier,
|
|
13272
|
+
billingPrice.tiersMode
|
|
13273
|
+
);
|
|
13274
|
+
}
|
|
13275
|
+
return quantity * billingPrice.price;
|
|
13276
|
+
}
|
|
13250
13277
|
function getEntitlementCost(entitlement, period = "month", currency) {
|
|
13251
13278
|
const resolvedPeriod = period ?? "month";
|
|
13252
13279
|
const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
|
|
@@ -14311,6 +14338,20 @@ function modifyDate(date, days) {
|
|
|
14311
14338
|
return copy3;
|
|
14312
14339
|
}
|
|
14313
14340
|
|
|
14341
|
+
// src/utils/debounce.ts
|
|
14342
|
+
var import_debounce = __toESM(require_debounce());
|
|
14343
|
+
function debounceByKey(fn, wait, settings) {
|
|
14344
|
+
const debouncedByKey = /* @__PURE__ */ new Map();
|
|
14345
|
+
return (key, ...args) => {
|
|
14346
|
+
let debounced = debouncedByKey.get(key);
|
|
14347
|
+
if (!debounced) {
|
|
14348
|
+
debounced = (0, import_debounce.default)(fn, wait, settings);
|
|
14349
|
+
debouncedByKey.set(key, debounced);
|
|
14350
|
+
}
|
|
14351
|
+
return debounced(key, ...args);
|
|
14352
|
+
};
|
|
14353
|
+
}
|
|
14354
|
+
|
|
14314
14355
|
// src/utils/string.ts
|
|
14315
14356
|
var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
14316
14357
|
"BIF",
|
|
@@ -15314,7 +15355,7 @@ var reducer = (state, action) => {
|
|
|
15314
15355
|
// src/context/EmbedProvider.tsx
|
|
15315
15356
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
15316
15357
|
var getCustomHeaders = (sessionId) => ({
|
|
15317
|
-
"X-Schematic-Components-Version": "2.25.
|
|
15358
|
+
"X-Schematic-Components-Version": "2.25.2",
|
|
15318
15359
|
"X-Schematic-Session-ID": sessionId
|
|
15319
15360
|
});
|
|
15320
15361
|
var normalizeCurrencyFilter = (filter2) => {
|
|
@@ -15425,7 +15466,7 @@ var EmbedProvider = ({
|
|
|
15425
15466
|
}
|
|
15426
15467
|
}, [publicApi]);
|
|
15427
15468
|
const debouncedHydratePublic = useMemo2(
|
|
15428
|
-
() => (0,
|
|
15469
|
+
() => (0, import_debounce2.default)(
|
|
15429
15470
|
hydratePublic,
|
|
15430
15471
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15431
15472
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15451,7 +15492,7 @@ var EmbedProvider = ({
|
|
|
15451
15492
|
}
|
|
15452
15493
|
}, [checkoutApi]);
|
|
15453
15494
|
const debouncedHydrate = useMemo2(
|
|
15454
|
-
() => (0,
|
|
15495
|
+
() => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15455
15496
|
[hydrate]
|
|
15456
15497
|
);
|
|
15457
15498
|
const hydrateComponent = useCallback2(
|
|
@@ -15478,7 +15519,7 @@ var EmbedProvider = ({
|
|
|
15478
15519
|
[checkoutApi]
|
|
15479
15520
|
);
|
|
15480
15521
|
const debouncedHydrateComponent = useMemo2(
|
|
15481
|
-
() => (0,
|
|
15522
|
+
() => (0, import_debounce2.default)(
|
|
15482
15523
|
hydrateComponent,
|
|
15483
15524
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15484
15525
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15502,7 +15543,7 @@ var EmbedProvider = ({
|
|
|
15502
15543
|
}
|
|
15503
15544
|
}, []);
|
|
15504
15545
|
const debouncedHydrateExternal = useMemo2(
|
|
15505
|
-
() => (0,
|
|
15546
|
+
() => (0, import_debounce2.default)(
|
|
15506
15547
|
hydrateExternal,
|
|
15507
15548
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15508
15549
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15513,7 +15554,7 @@ var EmbedProvider = ({
|
|
|
15513
15554
|
return checkoutApi?.createSetupIntent();
|
|
15514
15555
|
}, [checkoutApi]);
|
|
15515
15556
|
const debouncedCreateSetupIntent = useMemo2(
|
|
15516
|
-
() => (0,
|
|
15557
|
+
() => (0, import_debounce2.default)(
|
|
15517
15558
|
createSetupIntent,
|
|
15518
15559
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15519
15560
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15536,7 +15577,7 @@ var EmbedProvider = ({
|
|
|
15536
15577
|
[checkoutApi]
|
|
15537
15578
|
);
|
|
15538
15579
|
const debouncedUpdatePaymentMethod = useMemo2(
|
|
15539
|
-
() => (0,
|
|
15580
|
+
() => (0, import_debounce2.default)(
|
|
15540
15581
|
updatePaymentMethod,
|
|
15541
15582
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15542
15583
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15559,7 +15600,7 @@ var EmbedProvider = ({
|
|
|
15559
15600
|
[checkoutApi]
|
|
15560
15601
|
);
|
|
15561
15602
|
const debouncedDeletePaymentMethod = useMemo2(
|
|
15562
|
-
() => (0,
|
|
15603
|
+
() => (0, import_debounce2.default)(
|
|
15563
15604
|
deletePaymentMethod,
|
|
15564
15605
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15565
15606
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15582,7 +15623,7 @@ var EmbedProvider = ({
|
|
|
15582
15623
|
[checkoutApi]
|
|
15583
15624
|
);
|
|
15584
15625
|
const debouncedCheckout = useMemo2(
|
|
15585
|
-
() => (0,
|
|
15626
|
+
() => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15586
15627
|
[checkout]
|
|
15587
15628
|
);
|
|
15588
15629
|
const previewCheckout = useCallback2(
|
|
@@ -15602,7 +15643,7 @@ var EmbedProvider = ({
|
|
|
15602
15643
|
return response;
|
|
15603
15644
|
}, [checkoutApi]);
|
|
15604
15645
|
const debouncedUnsubscribe = useMemo2(
|
|
15605
|
-
() => (0,
|
|
15646
|
+
() => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15606
15647
|
[unsubscribe]
|
|
15607
15648
|
);
|
|
15608
15649
|
const updateCustomFieldValues = useCallback2(
|
|
@@ -15646,7 +15687,7 @@ var EmbedProvider = ({
|
|
|
15646
15687
|
[checkoutApi]
|
|
15647
15688
|
);
|
|
15648
15689
|
const debouncedGetUpcomingInvoice = useMemo2(
|
|
15649
|
-
() => (0,
|
|
15690
|
+
() => (0, import_debounce2.default)(
|
|
15650
15691
|
getUpcomingInvoice,
|
|
15651
15692
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15652
15693
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15657,7 +15698,7 @@ var EmbedProvider = ({
|
|
|
15657
15698
|
return checkoutApi?.fetchCustomerBalance();
|
|
15658
15699
|
}, [checkoutApi]);
|
|
15659
15700
|
const debouncedGetCustomerBalance = useMemo2(
|
|
15660
|
-
() => (0,
|
|
15701
|
+
() => (0, import_debounce2.default)(
|
|
15661
15702
|
getCustomerBalance,
|
|
15662
15703
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
15663
15704
|
LEADING_DEBOUNCE_SETTINGS
|
|
@@ -15668,9 +15709,37 @@ var EmbedProvider = ({
|
|
|
15668
15709
|
return checkoutApi?.listInvoices();
|
|
15669
15710
|
}, [checkoutApi]);
|
|
15670
15711
|
const debouncedListInvoices = useMemo2(
|
|
15671
|
-
() => (0,
|
|
15712
|
+
() => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
|
|
15672
15713
|
[listInvoices]
|
|
15673
15714
|
);
|
|
15715
|
+
const getCreditUsageByUser = useCallback2(
|
|
15716
|
+
async (billingCreditId, limit) => {
|
|
15717
|
+
return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
|
|
15718
|
+
},
|
|
15719
|
+
[checkoutApi]
|
|
15720
|
+
);
|
|
15721
|
+
const debouncedGetCreditUsageByUser = useMemo2(
|
|
15722
|
+
() => debounceByKey(
|
|
15723
|
+
getCreditUsageByUser,
|
|
15724
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15725
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15726
|
+
),
|
|
15727
|
+
[getCreditUsageByUser]
|
|
15728
|
+
);
|
|
15729
|
+
const getFeatureUsageByUser = useCallback2(
|
|
15730
|
+
async (featureId, limit) => {
|
|
15731
|
+
return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
|
|
15732
|
+
},
|
|
15733
|
+
[checkoutApi]
|
|
15734
|
+
);
|
|
15735
|
+
const debouncedGetFeatureUsageByUser = useMemo2(
|
|
15736
|
+
() => debounceByKey(
|
|
15737
|
+
getFeatureUsageByUser,
|
|
15738
|
+
FETCH_DEBOUNCE_TIMEOUT,
|
|
15739
|
+
LEADING_DEBOUNCE_SETTINGS
|
|
15740
|
+
),
|
|
15741
|
+
[getFeatureUsageByUser]
|
|
15742
|
+
);
|
|
15674
15743
|
const setError = useCallback2(
|
|
15675
15744
|
(error) => {
|
|
15676
15745
|
debug(error.message);
|
|
@@ -15836,6 +15905,8 @@ var EmbedProvider = ({
|
|
|
15836
15905
|
getUpcomingInvoice: debouncedGetUpcomingInvoice,
|
|
15837
15906
|
getCustomerBalance: debouncedGetCustomerBalance,
|
|
15838
15907
|
listInvoices: debouncedListInvoices,
|
|
15908
|
+
getCreditUsageByUser: debouncedGetCreditUsageByUser,
|
|
15909
|
+
getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
|
|
15839
15910
|
finishCheckout,
|
|
15840
15911
|
setError,
|
|
15841
15912
|
setAccessToken,
|
|
@@ -17234,7 +17305,7 @@ var Toggle = Tt.input.attrs({ type: "checkbox" })`
|
|
|
17234
17305
|
`;
|
|
17235
17306
|
|
|
17236
17307
|
// src/components/ui/tooltip/Tooltip.tsx
|
|
17237
|
-
var
|
|
17308
|
+
var import_debounce3 = __toESM(require_debounce());
|
|
17238
17309
|
import {
|
|
17239
17310
|
cloneElement as cloneElement2,
|
|
17240
17311
|
useCallback as useCallback7,
|
|
@@ -17424,7 +17495,7 @@ var Tooltip = ({
|
|
|
17424
17495
|
}, [portal, position2]);
|
|
17425
17496
|
useLayoutEffect3(() => {
|
|
17426
17497
|
updateCoords();
|
|
17427
|
-
const handleResize = (0,
|
|
17498
|
+
const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
|
|
17428
17499
|
window.addEventListener("resize", handleResize);
|
|
17429
17500
|
window.addEventListener("scroll", handleResize, true);
|
|
17430
17501
|
return () => {
|
|
@@ -17581,7 +17652,7 @@ var Root = forwardRef6(
|
|
|
17581
17652
|
Root.displayName = "Root";
|
|
17582
17653
|
|
|
17583
17654
|
// src/components/layout/viewport/Viewport.tsx
|
|
17584
|
-
var
|
|
17655
|
+
var import_debounce5 = __toESM(require_debounce());
|
|
17585
17656
|
import { forwardRef as forwardRef8, useLayoutEffect as useLayoutEffect8, useRef as useRef11, useState as useState16 } from "react";
|
|
17586
17657
|
import { createPortal as createPortal3 } from "react-dom";
|
|
17587
17658
|
|
|
@@ -18529,11 +18600,10 @@ var Quantity = ({
|
|
|
18529
18600
|
children: [
|
|
18530
18601
|
/* @__PURE__ */ jsx20(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs11(Text, { children: [
|
|
18531
18602
|
formatCurrency(
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
) : (price ?? 0) * entitlement.quantity,
|
|
18603
|
+
calculateQuantityCost(
|
|
18604
|
+
entitlementBillingPrice,
|
|
18605
|
+
entitlement.quantity
|
|
18606
|
+
),
|
|
18537
18607
|
currency
|
|
18538
18608
|
),
|
|
18539
18609
|
/* @__PURE__ */ jsxs11("sub", { children: [
|
|
@@ -19410,7 +19480,7 @@ var Checkout = ({
|
|
|
19410
19480
|
};
|
|
19411
19481
|
|
|
19412
19482
|
// src/components/shared/checkout-dialog/CheckoutDialog.tsx
|
|
19413
|
-
var
|
|
19483
|
+
var import_debounce4 = __toESM(require_debounce());
|
|
19414
19484
|
import {
|
|
19415
19485
|
useCallback as useCallback8,
|
|
19416
19486
|
useEffect as useEffect4,
|
|
@@ -20219,7 +20289,7 @@ var CheckoutDialog = ({ top }) => {
|
|
|
20219
20289
|
}, [handlePreviewCheckout]);
|
|
20220
20290
|
const debouncedPreviewCheckoutRef = useRef6(null);
|
|
20221
20291
|
useEffect4(() => {
|
|
20222
|
-
const debounced = (0,
|
|
20292
|
+
const debounced = (0, import_debounce4.default)(
|
|
20223
20293
|
(updates) => handlePreviewCheckoutRef.current(updates),
|
|
20224
20294
|
FETCH_DEBOUNCE_TIMEOUT,
|
|
20225
20295
|
TRAILING_DEBOUNCE_SETTINGS
|
|
@@ -22342,6 +22412,29 @@ var EntitlementRow = (props) => {
|
|
|
22342
22412
|
tiersMode
|
|
22343
22413
|
} = entitlementPrice || {};
|
|
22344
22414
|
const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
|
|
22415
|
+
const tierLabel = /* @__PURE__ */ jsxs30(
|
|
22416
|
+
Text,
|
|
22417
|
+
{
|
|
22418
|
+
style: { opacity: 0.54 },
|
|
22419
|
+
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22420
|
+
$color: settings.theme.typography.text.color,
|
|
22421
|
+
children: [
|
|
22422
|
+
t4("Tier-based"),
|
|
22423
|
+
/* @__PURE__ */ jsx41(
|
|
22424
|
+
PricingTiersTooltip,
|
|
22425
|
+
{
|
|
22426
|
+
portal,
|
|
22427
|
+
feature,
|
|
22428
|
+
period: planPeriod,
|
|
22429
|
+
currency,
|
|
22430
|
+
priceTiers,
|
|
22431
|
+
tiersMode: tiersMode ?? void 0,
|
|
22432
|
+
position: "left"
|
|
22433
|
+
}
|
|
22434
|
+
)
|
|
22435
|
+
]
|
|
22436
|
+
}
|
|
22437
|
+
);
|
|
22345
22438
|
return /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22346
22439
|
/* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22347
22440
|
quantity,
|
|
@@ -22352,13 +22445,24 @@ var EntitlementRow = (props) => {
|
|
|
22352
22445
|
" ",
|
|
22353
22446
|
getFeatureName(feature, softLimit)
|
|
22354
22447
|
] }) : feature.name }) }),
|
|
22355
|
-
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance
|
|
22356
|
-
|
|
22357
|
-
|
|
22358
|
-
|
|
22359
|
-
|
|
22448
|
+
/* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
|
|
22449
|
+
// A tiered scheme still resolves to a fixed amount at the chosen
|
|
22450
|
+
// quantity, so the row shows it alongside the tier breakdown
|
|
22451
|
+
// rather than leaving the charge unpriced.
|
|
22452
|
+
/* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
|
|
22453
|
+
/* @__PURE__ */ jsxs30(Text, { children: [
|
|
22454
|
+
formatCurrency(
|
|
22455
|
+
calculateQuantityCost(entitlementPrice, quantity),
|
|
22456
|
+
currency
|
|
22457
|
+
),
|
|
22458
|
+
/* @__PURE__ */ jsxs30("sub", { children: [
|
|
22459
|
+
"/",
|
|
22460
|
+
shortenPeriod(planPeriod)
|
|
22461
|
+
] })
|
|
22462
|
+
] }),
|
|
22463
|
+
tiered && tierLabel
|
|
22360
22464
|
] })
|
|
22361
|
-
|
|
22465
|
+
) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs30(Text, { children: [
|
|
22362
22466
|
priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ jsxs30(Fragment15, { children: [
|
|
22363
22467
|
t4("then"),
|
|
22364
22468
|
" "
|
|
@@ -22376,29 +22480,7 @@ var EntitlementRow = (props) => {
|
|
|
22376
22480
|
shortenPeriod(planPeriod)
|
|
22377
22481
|
] })
|
|
22378
22482
|
] })
|
|
22379
|
-
] }) :
|
|
22380
|
-
Text,
|
|
22381
|
-
{
|
|
22382
|
-
style: { opacity: 0.54 },
|
|
22383
|
-
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
22384
|
-
$color: settings.theme.typography.text.color,
|
|
22385
|
-
children: [
|
|
22386
|
-
t4("Tier-based"),
|
|
22387
|
-
/* @__PURE__ */ jsx41(
|
|
22388
|
-
PricingTiersTooltip,
|
|
22389
|
-
{
|
|
22390
|
-
portal,
|
|
22391
|
-
feature,
|
|
22392
|
-
period: planPeriod,
|
|
22393
|
-
currency,
|
|
22394
|
-
priceTiers,
|
|
22395
|
-
tiersMode: tiersMode ?? void 0,
|
|
22396
|
-
position: "left"
|
|
22397
|
-
}
|
|
22398
|
-
)
|
|
22399
|
-
]
|
|
22400
|
-
}
|
|
22401
|
-
) })
|
|
22483
|
+
] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
|
|
22402
22484
|
] });
|
|
22403
22485
|
}
|
|
22404
22486
|
};
|
|
@@ -22594,12 +22676,18 @@ var SubscriptionSidebar = forwardRef7(
|
|
|
22594
22676
|
}, 0);
|
|
22595
22677
|
total += addOnCost;
|
|
22596
22678
|
const payInAdvanceCost = payInAdvanceEntitlements.reduce(
|
|
22597
|
-
(sum, entitlement) => sum +
|
|
22679
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22680
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22681
|
+
entitlement.quantity
|
|
22682
|
+
),
|
|
22598
22683
|
0
|
|
22599
22684
|
);
|
|
22600
22685
|
total += payInAdvanceCost;
|
|
22601
22686
|
const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
|
|
22602
|
-
(sum, entitlement) => sum +
|
|
22687
|
+
(sum, entitlement) => sum + calculateQuantityCost(
|
|
22688
|
+
getEntitlementPrice(entitlement, planPeriod, currency),
|
|
22689
|
+
entitlement.quantity
|
|
22690
|
+
),
|
|
22603
22691
|
0
|
|
22604
22692
|
);
|
|
22605
22693
|
total += addOnPayInAdvanceCost;
|
|
@@ -24062,7 +24150,7 @@ var Viewport = forwardRef8(
|
|
|
24062
24150
|
const [top, setTop] = useState16(0);
|
|
24063
24151
|
useLayoutEffect8(() => {
|
|
24064
24152
|
const element = portalRef.current;
|
|
24065
|
-
const setModalY = (0,
|
|
24153
|
+
const setModalY = (0, import_debounce5.default)(() => {
|
|
24066
24154
|
const value = Math.abs(
|
|
24067
24155
|
(element === document.body ? window.scrollY : element.scrollTop) ?? 0
|
|
24068
24156
|
);
|
|
@@ -24776,7 +24864,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
|
|
|
24776
24864
|
Invoices.displayName = "Invoices";
|
|
24777
24865
|
|
|
24778
24866
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24779
|
-
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as
|
|
24867
|
+
import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo28, useRef as useRef12, useState as useState19 } from "react";
|
|
24780
24868
|
|
|
24781
24869
|
// src/components/elements/metered-features/Meter.tsx
|
|
24782
24870
|
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
@@ -24904,6 +24992,190 @@ var PriceDetails = ({
|
|
|
24904
24992
|
);
|
|
24905
24993
|
};
|
|
24906
24994
|
|
|
24995
|
+
// src/components/elements/metered-features/UsageByUser.tsx
|
|
24996
|
+
import { useEffect as useEffect7, useMemo as useMemo27, useState as useState18 } from "react";
|
|
24997
|
+
import { jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
24998
|
+
var COLLAPSED_COUNT = 3;
|
|
24999
|
+
var EXPANDED_COUNT = 20;
|
|
25000
|
+
var toCreditSection = (data) => ({
|
|
25001
|
+
entries: data.entries.map((entry) => ({
|
|
25002
|
+
id: entry.userId,
|
|
25003
|
+
// An entry with no hydrated user record still has an id worth showing —
|
|
25004
|
+
// a blank row identifies nobody.
|
|
25005
|
+
label: entry.user?.name || entry.userId || "",
|
|
25006
|
+
amount: entry.creditsUsed
|
|
25007
|
+
})),
|
|
25008
|
+
total: data.total,
|
|
25009
|
+
totalUsers: data.totalUsers,
|
|
25010
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
|
|
25011
|
+
});
|
|
25012
|
+
var toFeatureSection = (data) => ({
|
|
25013
|
+
entries: data.rows.map((row) => ({
|
|
25014
|
+
id: row.userId,
|
|
25015
|
+
label: row.user?.name || row.userId || "",
|
|
25016
|
+
amount: row.value
|
|
25017
|
+
})),
|
|
25018
|
+
total: data.total,
|
|
25019
|
+
totalUsers: data.totalUsers,
|
|
25020
|
+
unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
|
|
25021
|
+
});
|
|
25022
|
+
var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
|
|
25023
|
+
var InitialAvatar = ({ label }) => {
|
|
25024
|
+
const { settings } = useEmbed();
|
|
25025
|
+
const isLightBackground = useIsLightBackground();
|
|
25026
|
+
const initial = (label.trim()[0] ?? "?").toUpperCase();
|
|
25027
|
+
return /* @__PURE__ */ jsx55(
|
|
25028
|
+
Flex,
|
|
25029
|
+
{
|
|
25030
|
+
$alignItems: "center",
|
|
25031
|
+
$justifyContent: "center",
|
|
25032
|
+
$width: "1.75rem",
|
|
25033
|
+
$height: "1.75rem",
|
|
25034
|
+
$flexShrink: 0,
|
|
25035
|
+
$borderRadius: "9999px",
|
|
25036
|
+
$background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
|
|
25037
|
+
children: /* @__PURE__ */ jsx55(
|
|
25038
|
+
Text,
|
|
25039
|
+
{
|
|
25040
|
+
$size: 11,
|
|
25041
|
+
$weight: 500,
|
|
25042
|
+
$color: settings.theme.typography.text.color,
|
|
25043
|
+
children: initial
|
|
25044
|
+
}
|
|
25045
|
+
)
|
|
25046
|
+
}
|
|
25047
|
+
);
|
|
25048
|
+
};
|
|
25049
|
+
var UsageByUser = ({ source, unit }) => {
|
|
25050
|
+
const { t: t4 } = useTranslation();
|
|
25051
|
+
const isLightBackground = useIsLightBackground();
|
|
25052
|
+
const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
|
|
25053
|
+
const [expanded, setExpanded] = useState18(false);
|
|
25054
|
+
const [result, setResult] = useState18();
|
|
25055
|
+
const [attempt, setAttempt] = useState18(0);
|
|
25056
|
+
const { kind, id } = source;
|
|
25057
|
+
const sourceKey = `${kind}:${id}`;
|
|
25058
|
+
const current = result?.sourceKey === sourceKey ? result : void 0;
|
|
25059
|
+
useEffect7(() => {
|
|
25060
|
+
let active = true;
|
|
25061
|
+
const apply = (next2) => {
|
|
25062
|
+
if (active) {
|
|
25063
|
+
setResult(next2);
|
|
25064
|
+
}
|
|
25065
|
+
};
|
|
25066
|
+
const receive = (section) => {
|
|
25067
|
+
if (section) {
|
|
25068
|
+
apply({ sourceKey, section });
|
|
25069
|
+
}
|
|
25070
|
+
};
|
|
25071
|
+
const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
|
|
25072
|
+
if (kind === "credit") {
|
|
25073
|
+
getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25074
|
+
(response) => receive(response && toCreditSection(response.data))
|
|
25075
|
+
).catch(fail);
|
|
25076
|
+
} else {
|
|
25077
|
+
getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
|
|
25078
|
+
(response) => receive(response && toFeatureSection(response.data))
|
|
25079
|
+
).catch(fail);
|
|
25080
|
+
}
|
|
25081
|
+
return () => {
|
|
25082
|
+
active = false;
|
|
25083
|
+
};
|
|
25084
|
+
}, [
|
|
25085
|
+
attempt,
|
|
25086
|
+
getCreditUsageByUser,
|
|
25087
|
+
getFeatureUsageByUser,
|
|
25088
|
+
id,
|
|
25089
|
+
kind,
|
|
25090
|
+
sourceKey
|
|
25091
|
+
]);
|
|
25092
|
+
const entries = current?.section?.entries;
|
|
25093
|
+
const attributed = useMemo27(
|
|
25094
|
+
() => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
|
|
25095
|
+
[entries]
|
|
25096
|
+
);
|
|
25097
|
+
const error = current?.error;
|
|
25098
|
+
const total = current?.section?.total ?? 0;
|
|
25099
|
+
const totalUsers = current?.section?.totalUsers ?? 0;
|
|
25100
|
+
const unattributed = current?.section?.unattributed;
|
|
25101
|
+
const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
|
|
25102
|
+
if (error) {
|
|
25103
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
|
|
25104
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25105
|
+
/* @__PURE__ */ jsx55(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
|
|
25106
|
+
/* @__PURE__ */ jsx55(
|
|
25107
|
+
Button,
|
|
25108
|
+
{
|
|
25109
|
+
type: "button",
|
|
25110
|
+
onClick: () => setAttempt((prev2) => prev2 + 1),
|
|
25111
|
+
$size: "sm",
|
|
25112
|
+
$variant: "ghost",
|
|
25113
|
+
$fullWidth: false,
|
|
25114
|
+
children: t4("Try again")
|
|
25115
|
+
}
|
|
25116
|
+
)
|
|
25117
|
+
] });
|
|
25118
|
+
}
|
|
25119
|
+
if (attributed.length === 0 && !unattributed) {
|
|
25120
|
+
return null;
|
|
25121
|
+
}
|
|
25122
|
+
const visible = attributed.slice(
|
|
25123
|
+
0,
|
|
25124
|
+
expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
|
|
25125
|
+
);
|
|
25126
|
+
const remaining = Math.max(totalUsers - visible.length, 0);
|
|
25127
|
+
const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
|
|
25128
|
+
const hiddenUsers = Math.max(
|
|
25129
|
+
expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
|
|
25130
|
+
0
|
|
25131
|
+
);
|
|
25132
|
+
const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
|
|
25133
|
+
const expandLabel = totalUsers > EXPANDED_COUNT ? t4("Show top X users", { count: EXPANDED_COUNT }) : hiddenUsers > 0 ? t4("Show all X users", { count: totalUsers }) : t4("Show all");
|
|
25134
|
+
const row = (key, label, amount, muted) => /* @__PURE__ */ jsxs41(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
|
|
25135
|
+
/* @__PURE__ */ jsx55(InitialAvatar, { label: muted ? "?" : label }),
|
|
25136
|
+
/* @__PURE__ */ jsx55(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ jsx55(
|
|
25137
|
+
Text,
|
|
25138
|
+
{
|
|
25139
|
+
display: "text",
|
|
25140
|
+
$color: muted ? mutedColor(isLightBackground) : void 0,
|
|
25141
|
+
children: label
|
|
25142
|
+
}
|
|
25143
|
+
) }),
|
|
25144
|
+
/* @__PURE__ */ jsx55(
|
|
25145
|
+
Text,
|
|
25146
|
+
{
|
|
25147
|
+
display: "text",
|
|
25148
|
+
$align: "right",
|
|
25149
|
+
$color: mutedColor(isLightBackground),
|
|
25150
|
+
children: formatAmount(amount)
|
|
25151
|
+
}
|
|
25152
|
+
)
|
|
25153
|
+
] }, key);
|
|
25154
|
+
return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
|
|
25155
|
+
/* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
|
|
25156
|
+
/* @__PURE__ */ jsx55(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
|
|
25157
|
+
amount: formatAmount(total)
|
|
25158
|
+
}) }) }),
|
|
25159
|
+
visible.map(
|
|
25160
|
+
(entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
|
|
25161
|
+
),
|
|
25162
|
+
expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
|
|
25163
|
+
expanded && remaining > 0 && /* @__PURE__ */ jsx55(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("plus X more", { count: remaining }) }) }),
|
|
25164
|
+
shouldShowToggle && /* @__PURE__ */ jsx55(
|
|
25165
|
+
ExpandListToggle,
|
|
25166
|
+
{
|
|
25167
|
+
isExpanded: expanded,
|
|
25168
|
+
onToggle: () => setExpanded((prev2) => !prev2),
|
|
25169
|
+
expandLabel,
|
|
25170
|
+
collapseLabel: t4("Show fewer"),
|
|
25171
|
+
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
|
|
25172
|
+
$marginTop: "0.25rem"
|
|
25173
|
+
}
|
|
25174
|
+
)
|
|
25175
|
+
] });
|
|
25176
|
+
};
|
|
25177
|
+
UsageByUser.displayName = "UsageByUser";
|
|
25178
|
+
|
|
24907
25179
|
// src/components/elements/metered-features/styles.ts
|
|
24908
25180
|
var Container2 = Tt.div`
|
|
24909
25181
|
display: flex;
|
|
@@ -24922,7 +25194,7 @@ var Container2 = Tt.div`
|
|
|
24922
25194
|
`;
|
|
24923
25195
|
|
|
24924
25196
|
// src/components/elements/metered-features/MeteredFeatures.tsx
|
|
24925
|
-
import { Fragment as Fragment23, jsx as
|
|
25197
|
+
import { Fragment as Fragment23, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
24926
25198
|
var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
24927
25199
|
const { t: t4 } = useTranslation();
|
|
24928
25200
|
const { data } = useEmbed();
|
|
@@ -24959,9 +25231,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
|
|
|
24959
25231
|
})
|
|
24960
25232
|
);
|
|
24961
25233
|
}
|
|
24962
|
-
return /* @__PURE__ */
|
|
25234
|
+
return /* @__PURE__ */ jsxs42(Text, { display: fontStyle, children: [
|
|
24963
25235
|
acc.join(" \u2022 "),
|
|
24964
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
25236
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx56(
|
|
24965
25237
|
HardLimitTooltip,
|
|
24966
25238
|
{
|
|
24967
25239
|
feature: entitlement.feature,
|
|
@@ -24991,6 +25263,9 @@ function resolveDesignProps4(props) {
|
|
|
24991
25263
|
isVisible: props.usage?.isVisible ?? true,
|
|
24992
25264
|
fontStyle: props.usage?.fontStyle ?? "heading5"
|
|
24993
25265
|
},
|
|
25266
|
+
usageByUser: {
|
|
25267
|
+
isVisible: props.usageByUser?.isVisible ?? true
|
|
25268
|
+
},
|
|
24994
25269
|
// there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
|
|
24995
25270
|
visibleFeatures: props.visibleFeatures
|
|
24996
25271
|
};
|
|
@@ -25003,7 +25278,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25003
25278
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
25004
25279
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
25005
25280
|
const isLightBackground = useIsLightBackground();
|
|
25006
|
-
const meteredFeatures =
|
|
25281
|
+
const meteredFeatures = useMemo28(() => {
|
|
25007
25282
|
const orderedFeatureUsage = props.visibleFeatures?.reduce(
|
|
25008
25283
|
(acc, id) => {
|
|
25009
25284
|
const mappedFeatureUsage = data?.featureUsage?.features.find(
|
|
@@ -25020,7 +25295,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25020
25295
|
({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
|
|
25021
25296
|
);
|
|
25022
25297
|
}, [props.visibleFeatures, data?.featureUsage?.features]);
|
|
25023
|
-
const creditGroups =
|
|
25298
|
+
const creditGroups = useMemo28(
|
|
25024
25299
|
() => withEmptyPlanCreditBalances(
|
|
25025
25300
|
aggregateActiveGrantsByCredit(data?.creditGrants || []),
|
|
25026
25301
|
listPlanCredits(
|
|
@@ -25031,7 +25306,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25031
25306
|
),
|
|
25032
25307
|
[data?.creditGrants, data?.featureUsage?.features, data?.company]
|
|
25033
25308
|
);
|
|
25034
|
-
const planCreditCompositions =
|
|
25309
|
+
const planCreditCompositions = useMemo28(
|
|
25035
25310
|
() => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
|
|
25036
25311
|
[data?.company?.plan?.includedCreditGrants]
|
|
25037
25312
|
);
|
|
@@ -25045,14 +25320,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25045
25320
|
},
|
|
25046
25321
|
[data?.featureUsage?.features]
|
|
25047
25322
|
);
|
|
25048
|
-
const purchasableCreditIds =
|
|
25323
|
+
const purchasableCreditIds = useMemo28(
|
|
25049
25324
|
() => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
|
|
25050
25325
|
[data?.creditBundles, data?.company?.plan?.id]
|
|
25051
25326
|
);
|
|
25052
|
-
const [expandedCreditIds, setExpandedCreditIds] =
|
|
25327
|
+
const [expandedCreditIds, setExpandedCreditIds] = useState19(
|
|
25053
25328
|
() => /* @__PURE__ */ new Set()
|
|
25054
25329
|
);
|
|
25055
|
-
const [fullLedgerCreditIds, setFullLedgerCreditIds] =
|
|
25330
|
+
const [fullLedgerCreditIds, setFullLedgerCreditIds] = useState19(
|
|
25056
25331
|
() => /* @__PURE__ */ new Set()
|
|
25057
25332
|
);
|
|
25058
25333
|
const toggleFullLedger = useCallback14((id) => {
|
|
@@ -25092,7 +25367,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25092
25367
|
const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
|
|
25093
25368
|
const canCheckout = data?.capabilities?.checkout ?? false;
|
|
25094
25369
|
const showCredits = data?.displaySettings?.showCredits ?? true;
|
|
25095
|
-
return /* @__PURE__ */
|
|
25370
|
+
return /* @__PURE__ */ jsxs42(Container2, { ref, className, children: [
|
|
25096
25371
|
meteredFeatures.reduce((acc, entitlement, index) => {
|
|
25097
25372
|
if (!entitlement.feature) {
|
|
25098
25373
|
return acc;
|
|
@@ -25103,9 +25378,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25103
25378
|
});
|
|
25104
25379
|
const { limit } = usageDetails;
|
|
25105
25380
|
acc.push(
|
|
25106
|
-
/* @__PURE__ */
|
|
25107
|
-
/* @__PURE__ */
|
|
25108
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25381
|
+
/* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
|
|
25382
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25383
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
25109
25384
|
Icon3,
|
|
25110
25385
|
{
|
|
25111
25386
|
name: feature.icon,
|
|
@@ -25114,8 +25389,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25114
25389
|
rounded: true
|
|
25115
25390
|
}
|
|
25116
25391
|
),
|
|
25117
|
-
/* @__PURE__ */
|
|
25118
|
-
/* @__PURE__ */
|
|
25392
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25393
|
+
/* @__PURE__ */ jsxs42(
|
|
25119
25394
|
Flex,
|
|
25120
25395
|
{
|
|
25121
25396
|
ref: (el) => {
|
|
@@ -25126,31 +25401,31 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25126
25401
|
$flexWrap: "wrap",
|
|
25127
25402
|
$gap: "1rem",
|
|
25128
25403
|
children: [
|
|
25129
|
-
/* @__PURE__ */
|
|
25130
|
-
/* @__PURE__ */
|
|
25131
|
-
props.description.isVisible && feature.description && /* @__PURE__ */
|
|
25404
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25405
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: feature.name }) }),
|
|
25406
|
+
props.description.isVisible && feature.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: feature.description }) })
|
|
25132
25407
|
] }),
|
|
25133
|
-
/* @__PURE__ */
|
|
25408
|
+
/* @__PURE__ */ jsxs42(
|
|
25134
25409
|
Box,
|
|
25135
25410
|
{
|
|
25136
25411
|
$flexBasis: "min-content",
|
|
25137
25412
|
$flexGrow: 1,
|
|
25138
25413
|
$textAlign: shouldWrapChildren ? "left" : "right",
|
|
25139
25414
|
children: [
|
|
25140
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
25141
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
25415
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25416
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25142
25417
|
formatNumber(limit),
|
|
25143
25418
|
" "
|
|
25144
25419
|
] }),
|
|
25145
25420
|
getFeatureName(feature, limit)
|
|
25146
|
-
] }) : typeof usage === "number" && /* @__PURE__ */
|
|
25421
|
+
] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25147
25422
|
formatNumber(usage),
|
|
25148
25423
|
" ",
|
|
25149
25424
|
getFeatureName(feature, usage),
|
|
25150
25425
|
" ",
|
|
25151
25426
|
t4("used")
|
|
25152
25427
|
] }) }) }),
|
|
25153
|
-
props.allocation.isVisible && /* @__PURE__ */
|
|
25428
|
+
props.allocation.isVisible && /* @__PURE__ */ jsx56(
|
|
25154
25429
|
Limit,
|
|
25155
25430
|
{
|
|
25156
25431
|
entitlement,
|
|
@@ -25164,8 +25439,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25164
25439
|
]
|
|
25165
25440
|
}
|
|
25166
25441
|
),
|
|
25167
|
-
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */
|
|
25168
|
-
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
25442
|
+
props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ jsx56(Meter, { entitlement }),
|
|
25443
|
+
canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsx56(
|
|
25169
25444
|
Button,
|
|
25170
25445
|
{
|
|
25171
25446
|
type: "button",
|
|
@@ -25178,13 +25453,24 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25178
25453
|
)
|
|
25179
25454
|
] })
|
|
25180
25455
|
] }),
|
|
25181
|
-
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */
|
|
25456
|
+
(priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ jsx56(
|
|
25182
25457
|
PriceDetails,
|
|
25183
25458
|
{
|
|
25184
25459
|
entitlement,
|
|
25185
25460
|
usageDetails,
|
|
25186
25461
|
period
|
|
25187
25462
|
}
|
|
25463
|
+
),
|
|
25464
|
+
props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
|
|
25465
|
+
// they are denominated in the feature's own unit — the same one
|
|
25466
|
+
// the usage line above uses. A credit-burndown feature's credit
|
|
25467
|
+
// spend is broken down separately, under its credit.
|
|
25468
|
+
/* @__PURE__ */ jsx56(
|
|
25469
|
+
UsageByUser,
|
|
25470
|
+
{
|
|
25471
|
+
source: { kind: "feature", id: feature.id },
|
|
25472
|
+
unit: feature
|
|
25473
|
+
}
|
|
25188
25474
|
)
|
|
25189
25475
|
] }, index)
|
|
25190
25476
|
);
|
|
@@ -25198,9 +25484,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25198
25484
|
const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
|
|
25199
25485
|
const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
|
|
25200
25486
|
const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
|
|
25201
|
-
return /* @__PURE__ */
|
|
25202
|
-
/* @__PURE__ */
|
|
25203
|
-
props.icon.isVisible && /* @__PURE__ */
|
|
25487
|
+
return /* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
|
|
25488
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
|
|
25489
|
+
props.icon.isVisible && /* @__PURE__ */ jsx56(
|
|
25204
25490
|
Icon3,
|
|
25205
25491
|
{
|
|
25206
25492
|
name: credit.icon,
|
|
@@ -25209,13 +25495,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25209
25495
|
rounded: true
|
|
25210
25496
|
}
|
|
25211
25497
|
),
|
|
25212
|
-
/* @__PURE__ */
|
|
25213
|
-
/* @__PURE__ */
|
|
25214
|
-
/* @__PURE__ */
|
|
25215
|
-
props.description.isVisible && credit.description && /* @__PURE__ */
|
|
25498
|
+
/* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
|
|
25499
|
+
/* @__PURE__ */ jsx56(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
|
|
25500
|
+
/* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: credit.name }) }),
|
|
25501
|
+
props.description.isVisible && credit.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: credit.description }) })
|
|
25216
25502
|
] }) }),
|
|
25217
|
-
/* @__PURE__ */
|
|
25218
|
-
props.usage.isVisible && /* @__PURE__ */
|
|
25503
|
+
/* @__PURE__ */ jsxs42(Flex, { $gap: "1rem", $alignItems: "center", children: [
|
|
25504
|
+
props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
|
|
25219
25505
|
// Balances burn at rates with up to 10 decimal
|
|
25220
25506
|
// places, so a small remainder must not round to 0.
|
|
25221
25507
|
amount: formatNumber(credit.total.remaining, {
|
|
@@ -25226,7 +25512,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25226
25512
|
credit.total.remaining
|
|
25227
25513
|
)
|
|
25228
25514
|
}) }) }),
|
|
25229
|
-
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */
|
|
25515
|
+
canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx56(
|
|
25230
25516
|
Button,
|
|
25231
25517
|
{
|
|
25232
25518
|
type: "button",
|
|
@@ -25279,7 +25565,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25279
25565
|
const renewalDate = data?.upcomingInvoice?.dueDate;
|
|
25280
25566
|
return (
|
|
25281
25567
|
// Pulled up against the balance line despite the column's 2rem gap
|
|
25282
|
-
/* @__PURE__ */
|
|
25568
|
+
/* @__PURE__ */ jsx56(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
|
|
25283
25569
|
Text,
|
|
25284
25570
|
{
|
|
25285
25571
|
style: { opacity: 0.54 },
|
|
@@ -25292,7 +25578,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25292
25578
|
period: shortenPeriod(composition.period),
|
|
25293
25579
|
composition: ` \u2014 ${parts.join(" + ")}`
|
|
25294
25580
|
}),
|
|
25295
|
-
renewalDate && /* @__PURE__ */
|
|
25581
|
+
renewalDate && /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25296
25582
|
" ",
|
|
25297
25583
|
t4("Renews on the day", {
|
|
25298
25584
|
day: formatOrdinal(renewalDate.getDate())
|
|
@@ -25305,12 +25591,12 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25305
25591
|
})()
|
|
25306
25592
|
] })
|
|
25307
25593
|
] }),
|
|
25308
|
-
hasGrants && /* @__PURE__ */
|
|
25594
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25309
25595
|
Box,
|
|
25310
25596
|
{
|
|
25311
25597
|
$width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
|
|
25312
25598
|
$margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
25313
|
-
children: /* @__PURE__ */
|
|
25599
|
+
children: /* @__PURE__ */ jsxs42(
|
|
25314
25600
|
TransitionBox,
|
|
25315
25601
|
{
|
|
25316
25602
|
$backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
|
|
@@ -25318,22 +25604,22 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25318
25604
|
children: [
|
|
25319
25605
|
visibleGrants.map((grant, index2) => {
|
|
25320
25606
|
const padding = getRowPadding(index2);
|
|
25321
|
-
return /* @__PURE__ */
|
|
25322
|
-
/* @__PURE__ */
|
|
25607
|
+
return /* @__PURE__ */ jsx56(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25608
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: t4("X items included in plan", {
|
|
25323
25609
|
amount: grant.quantity,
|
|
25324
25610
|
item: getFeatureName(
|
|
25325
25611
|
credit,
|
|
25326
25612
|
grant.quantity
|
|
25327
25613
|
)
|
|
25328
25614
|
}) }) }),
|
|
25329
|
-
/* @__PURE__ */
|
|
25615
|
+
/* @__PURE__ */ jsx56(
|
|
25330
25616
|
Box,
|
|
25331
25617
|
{
|
|
25332
25618
|
$display: "table-cell",
|
|
25333
25619
|
$padding: padding,
|
|
25334
25620
|
$textAlign: "right",
|
|
25335
25621
|
$whiteSpace: "nowrap",
|
|
25336
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25622
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Resets", {
|
|
25337
25623
|
date: toPrettyDate(
|
|
25338
25624
|
modifyDate(grant.expiresAt, 1),
|
|
25339
25625
|
{ month: "short" }
|
|
@@ -25341,15 +25627,15 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25341
25627
|
}) })
|
|
25342
25628
|
}
|
|
25343
25629
|
)
|
|
25344
|
-
] }) : /* @__PURE__ */
|
|
25345
|
-
/* @__PURE__ */
|
|
25630
|
+
] }) : /* @__PURE__ */ jsxs42(Fragment23, { children: [
|
|
25631
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item bundle", {
|
|
25346
25632
|
amount: grant.quantity,
|
|
25347
25633
|
item: getFeatureName(credit, 1),
|
|
25348
25634
|
createdAt: toPrettyDate(
|
|
25349
25635
|
grant.createdAt,
|
|
25350
25636
|
{ month: "short" }
|
|
25351
25637
|
)
|
|
25352
|
-
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */
|
|
25638
|
+
}) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item auto-topup", {
|
|
25353
25639
|
amount: grant.quantity,
|
|
25354
25640
|
item: getFeatureName(
|
|
25355
25641
|
credit,
|
|
@@ -25359,7 +25645,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25359
25645
|
grant.createdAt,
|
|
25360
25646
|
{ month: "short" }
|
|
25361
25647
|
)
|
|
25362
|
-
}) }) : /* @__PURE__ */
|
|
25648
|
+
}) }) : /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item grant", {
|
|
25363
25649
|
amount: grant.quantity,
|
|
25364
25650
|
item: getFeatureName(
|
|
25365
25651
|
credit,
|
|
@@ -25370,14 +25656,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25370
25656
|
{ month: "short" }
|
|
25371
25657
|
)
|
|
25372
25658
|
}) }) }) }),
|
|
25373
|
-
/* @__PURE__ */
|
|
25659
|
+
/* @__PURE__ */ jsx56(
|
|
25374
25660
|
Box,
|
|
25375
25661
|
{
|
|
25376
25662
|
$display: "table-cell",
|
|
25377
25663
|
$padding: padding,
|
|
25378
25664
|
$textAlign: "right",
|
|
25379
25665
|
$whiteSpace: "nowrap",
|
|
25380
|
-
children: grant.expiresAt && /* @__PURE__ */
|
|
25666
|
+
children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Expires", {
|
|
25381
25667
|
date: toPrettyDate(
|
|
25382
25668
|
modifyDate(grant.expiresAt, 1),
|
|
25383
25669
|
{ month: "short" }
|
|
@@ -25387,8 +25673,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25387
25673
|
)
|
|
25388
25674
|
] }) }, grant.id);
|
|
25389
25675
|
}),
|
|
25390
|
-
canExpandLedger && /* @__PURE__ */
|
|
25391
|
-
/* @__PURE__ */
|
|
25676
|
+
canExpandLedger && /* @__PURE__ */ jsxs42(Box, { $display: "table-row", children: [
|
|
25677
|
+
/* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ jsx56(
|
|
25392
25678
|
ExpandListToggle,
|
|
25393
25679
|
{
|
|
25394
25680
|
isExpanded: showAllGrants,
|
|
@@ -25397,7 +25683,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25397
25683
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25398
25684
|
}
|
|
25399
25685
|
) }),
|
|
25400
|
-
/* @__PURE__ */
|
|
25686
|
+
/* @__PURE__ */ jsx56(
|
|
25401
25687
|
Box,
|
|
25402
25688
|
{
|
|
25403
25689
|
$display: "table-cell",
|
|
@@ -25410,7 +25696,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25410
25696
|
)
|
|
25411
25697
|
}
|
|
25412
25698
|
),
|
|
25413
|
-
hasGrants && /* @__PURE__ */
|
|
25699
|
+
hasGrants && /* @__PURE__ */ jsx56(
|
|
25414
25700
|
ExpandListToggle,
|
|
25415
25701
|
{
|
|
25416
25702
|
isExpanded,
|
|
@@ -25419,6 +25705,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25419
25705
|
collapseLabel: t4("Hide balance details"),
|
|
25420
25706
|
iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
|
|
25421
25707
|
}
|
|
25708
|
+
),
|
|
25709
|
+
props.usageByUser.isVisible && /* @__PURE__ */ jsx56(
|
|
25710
|
+
UsageByUser,
|
|
25711
|
+
{
|
|
25712
|
+
source: { kind: "credit", id: credit.id },
|
|
25713
|
+
unit: credit
|
|
25714
|
+
}
|
|
25422
25715
|
)
|
|
25423
25716
|
] }, index);
|
|
25424
25717
|
})
|
|
@@ -25427,11 +25720,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
|
|
|
25427
25720
|
MeteredFeatures.displayName = "MeteredFeatures";
|
|
25428
25721
|
|
|
25429
25722
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25430
|
-
import { forwardRef as forwardRef13, useMemo as
|
|
25723
|
+
import { forwardRef as forwardRef13, useMemo as useMemo30 } from "react";
|
|
25431
25724
|
|
|
25432
25725
|
// src/components/elements/payment-method/PaymentMethodElement.tsx
|
|
25433
|
-
import { useMemo as
|
|
25434
|
-
import { jsx as
|
|
25726
|
+
import { useMemo as useMemo29 } from "react";
|
|
25727
|
+
import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
25435
25728
|
var PaymentElement2 = ({
|
|
25436
25729
|
iconName,
|
|
25437
25730
|
iconTitle,
|
|
@@ -25439,8 +25732,8 @@ var PaymentElement2 = ({
|
|
|
25439
25732
|
paymentLast4
|
|
25440
25733
|
}) => {
|
|
25441
25734
|
const { settings } = useEmbed();
|
|
25442
|
-
return /* @__PURE__ */
|
|
25443
|
-
iconName && /* @__PURE__ */
|
|
25735
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
|
|
25736
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25444
25737
|
Icon3,
|
|
25445
25738
|
{
|
|
25446
25739
|
name: iconName,
|
|
@@ -25448,15 +25741,15 @@ var PaymentElement2 = ({
|
|
|
25448
25741
|
color: settings.theme.typography.text.color
|
|
25449
25742
|
}
|
|
25450
25743
|
),
|
|
25451
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25452
|
-
label && /* @__PURE__ */
|
|
25744
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25745
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25453
25746
|
" ",
|
|
25454
|
-
paymentLast4 && /* @__PURE__ */
|
|
25747
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25455
25748
|
] })
|
|
25456
25749
|
] });
|
|
25457
25750
|
};
|
|
25458
25751
|
var EmptyPaymentElement = () => {
|
|
25459
|
-
return /* @__PURE__ */
|
|
25752
|
+
return /* @__PURE__ */ jsx57(Text, { children: /* @__PURE__ */ jsx57(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx57(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx57(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
|
|
25460
25753
|
};
|
|
25461
25754
|
var getPaymentMethodData = ({
|
|
25462
25755
|
accountLast4,
|
|
@@ -25536,12 +25829,12 @@ var PaymentMethodElement = ({
|
|
|
25536
25829
|
const isLightBackground = useIsLightBackground();
|
|
25537
25830
|
const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
|
|
25538
25831
|
const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
|
|
25539
|
-
return /* @__PURE__ */
|
|
25540
|
-
props.header.isVisible && /* @__PURE__ */
|
|
25541
|
-
/* @__PURE__ */
|
|
25542
|
-
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */
|
|
25832
|
+
return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
|
|
25833
|
+
props.header.isVisible && /* @__PURE__ */ jsxs43(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
|
|
25834
|
+
/* @__PURE__ */ jsx57(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
|
|
25835
|
+
props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx57(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
|
|
25543
25836
|
] }),
|
|
25544
|
-
/* @__PURE__ */
|
|
25837
|
+
/* @__PURE__ */ jsxs43(
|
|
25545
25838
|
Flex,
|
|
25546
25839
|
{
|
|
25547
25840
|
$justifyContent: "space-between",
|
|
@@ -25550,8 +25843,8 @@ var PaymentMethodElement = ({
|
|
|
25550
25843
|
$padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
|
|
25551
25844
|
$borderRadius: "9999px",
|
|
25552
25845
|
children: [
|
|
25553
|
-
paymentMethod ? /* @__PURE__ */
|
|
25554
|
-
onRemove && /* @__PURE__ */
|
|
25846
|
+
paymentMethod ? /* @__PURE__ */ jsx57(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx57(EmptyPaymentElement, {}),
|
|
25847
|
+
onRemove && /* @__PURE__ */ jsx57(
|
|
25555
25848
|
Text,
|
|
25556
25849
|
{
|
|
25557
25850
|
onClick: onRemove,
|
|
@@ -25561,7 +25854,7 @@ var PaymentMethodElement = ({
|
|
|
25561
25854
|
children: t4("Remove")
|
|
25562
25855
|
}
|
|
25563
25856
|
),
|
|
25564
|
-
props.functions.allowEdit && onEdit && /* @__PURE__ */
|
|
25857
|
+
props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx57(
|
|
25565
25858
|
Text,
|
|
25566
25859
|
{
|
|
25567
25860
|
onClick: onEdit,
|
|
@@ -25574,8 +25867,8 @@ var PaymentMethodElement = ({
|
|
|
25574
25867
|
]
|
|
25575
25868
|
}
|
|
25576
25869
|
),
|
|
25577
|
-
hasCustomFields && /* @__PURE__ */
|
|
25578
|
-
/* @__PURE__ */
|
|
25870
|
+
hasCustomFields && /* @__PURE__ */ jsx57(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
|
|
25871
|
+
/* @__PURE__ */ jsx57(
|
|
25579
25872
|
Text,
|
|
25580
25873
|
{
|
|
25581
25874
|
$size: 12,
|
|
@@ -25583,7 +25876,7 @@ var PaymentMethodElement = ({
|
|
|
25583
25876
|
children: field.name
|
|
25584
25877
|
}
|
|
25585
25878
|
),
|
|
25586
|
-
/* @__PURE__ */
|
|
25879
|
+
/* @__PURE__ */ jsx57(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ jsx57(
|
|
25587
25880
|
"span",
|
|
25588
25881
|
{
|
|
25589
25882
|
style: {
|
|
@@ -25604,7 +25897,7 @@ var PaymentListElement = ({
|
|
|
25604
25897
|
const { settings } = useEmbed();
|
|
25605
25898
|
const isLightBackground = useIsLightBackground();
|
|
25606
25899
|
const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
|
|
25607
|
-
const expirationDate =
|
|
25900
|
+
const expirationDate = useMemo29(() => {
|
|
25608
25901
|
const { cardExpMonth, cardExpYear } = paymentMethod;
|
|
25609
25902
|
if (!cardExpMonth || !cardExpYear) {
|
|
25610
25903
|
return;
|
|
@@ -25615,7 +25908,7 @@ var PaymentListElement = ({
|
|
|
25615
25908
|
}
|
|
25616
25909
|
return `${cardExpMonth}/${formatedYear}`;
|
|
25617
25910
|
}, [paymentMethod]);
|
|
25618
|
-
return /* @__PURE__ */
|
|
25911
|
+
return /* @__PURE__ */ jsxs43(
|
|
25619
25912
|
Flex,
|
|
25620
25913
|
{
|
|
25621
25914
|
$flexDirection: "row",
|
|
@@ -25627,7 +25920,7 @@ var PaymentListElement = ({
|
|
|
25627
25920
|
$borderStyle: "solid",
|
|
25628
25921
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
25629
25922
|
children: [
|
|
25630
|
-
iconName && /* @__PURE__ */
|
|
25923
|
+
iconName && /* @__PURE__ */ jsx57(
|
|
25631
25924
|
Icon3,
|
|
25632
25925
|
{
|
|
25633
25926
|
name: iconName,
|
|
@@ -25635,20 +25928,20 @@ var PaymentListElement = ({
|
|
|
25635
25928
|
color: settings.theme.typography.text.color
|
|
25636
25929
|
}
|
|
25637
25930
|
),
|
|
25638
|
-
(label || paymentLast4) && /* @__PURE__ */
|
|
25639
|
-
label && /* @__PURE__ */
|
|
25931
|
+
(label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
|
|
25932
|
+
label && /* @__PURE__ */ jsx57(Text, { children: label }),
|
|
25640
25933
|
" ",
|
|
25641
|
-
paymentLast4 && /* @__PURE__ */
|
|
25934
|
+
paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
|
|
25642
25935
|
] }),
|
|
25643
|
-
expirationDate && /* @__PURE__ */
|
|
25936
|
+
expirationDate && /* @__PURE__ */ jsx57(
|
|
25644
25937
|
Box,
|
|
25645
25938
|
{
|
|
25646
25939
|
$flexGrow: 1,
|
|
25647
25940
|
$color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
|
|
25648
|
-
children: /* @__PURE__ */
|
|
25941
|
+
children: /* @__PURE__ */ jsx57(Text, { children: t("Expires", { date: expirationDate }) })
|
|
25649
25942
|
}
|
|
25650
25943
|
),
|
|
25651
|
-
/* @__PURE__ */
|
|
25944
|
+
/* @__PURE__ */ jsx57(Box, { children: /* @__PURE__ */ jsx57(
|
|
25652
25945
|
Text,
|
|
25653
25946
|
{
|
|
25654
25947
|
onClick: () => {
|
|
@@ -25661,7 +25954,7 @@ var PaymentListElement = ({
|
|
|
25661
25954
|
children: t("Set default")
|
|
25662
25955
|
}
|
|
25663
25956
|
) }),
|
|
25664
|
-
/* @__PURE__ */
|
|
25957
|
+
/* @__PURE__ */ jsx57(
|
|
25665
25958
|
Icon3,
|
|
25666
25959
|
{
|
|
25667
25960
|
tabIndex: 0,
|
|
@@ -25683,7 +25976,7 @@ var PaymentListElement = ({
|
|
|
25683
25976
|
};
|
|
25684
25977
|
|
|
25685
25978
|
// src/components/elements/payment-method/PaymentMethod.tsx
|
|
25686
|
-
import { jsx as
|
|
25979
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
25687
25980
|
var resolveDesignProps5 = (props) => {
|
|
25688
25981
|
return {
|
|
25689
25982
|
header: {
|
|
@@ -25699,7 +25992,7 @@ var resolveDesignProps5 = (props) => {
|
|
|
25699
25992
|
var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
|
|
25700
25993
|
const props = resolveDesignProps5(rest);
|
|
25701
25994
|
const { data, setLayout } = useEmbed();
|
|
25702
|
-
const { paymentMethod, monthsToExpiration } =
|
|
25995
|
+
const { paymentMethod, monthsToExpiration } = useMemo30(() => {
|
|
25703
25996
|
const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
|
|
25704
25997
|
let monthsToExpiration2;
|
|
25705
25998
|
if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
|
|
@@ -25718,7 +26011,7 @@ var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = tru
|
|
|
25718
26011
|
monthsToExpiration: monthsToExpiration2
|
|
25719
26012
|
};
|
|
25720
26013
|
}, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
|
|
25721
|
-
return /* @__PURE__ */
|
|
26014
|
+
return /* @__PURE__ */ jsx58(Element, { ref, className, children: /* @__PURE__ */ jsx58(
|
|
25722
26015
|
PaymentMethodElement,
|
|
25723
26016
|
{
|
|
25724
26017
|
customCheckoutFields: data?.customCheckoutFields,
|
|
@@ -25903,8 +26196,8 @@ var loadStripe = function loadStripe2() {
|
|
|
25903
26196
|
};
|
|
25904
26197
|
|
|
25905
26198
|
// src/components/elements/payment-method/PaymentMethodDetails.tsx
|
|
25906
|
-
import { useCallback as useCallback15, useEffect as
|
|
25907
|
-
import { jsx as
|
|
26199
|
+
import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo31, useState as useState20 } from "react";
|
|
26200
|
+
import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
25908
26201
|
var resolveDesignProps6 = () => {
|
|
25909
26202
|
return {
|
|
25910
26203
|
header: {
|
|
@@ -25932,7 +26225,7 @@ var PaymentMethodDetails = ({
|
|
|
25932
26225
|
updatePaymentMethod,
|
|
25933
26226
|
deletePaymentMethod
|
|
25934
26227
|
} = useEmbed();
|
|
25935
|
-
const { defaultPaymentMethod, paymentMethods, subscription } =
|
|
26228
|
+
const { defaultPaymentMethod, paymentMethods, subscription } = useMemo31(() => {
|
|
25936
26229
|
return {
|
|
25937
26230
|
defaultPaymentMethod: data?.company?.defaultPaymentMethod,
|
|
25938
26231
|
paymentMethods: data?.company?.paymentMethods || [],
|
|
@@ -25945,13 +26238,13 @@ var PaymentMethodDetails = ({
|
|
|
25945
26238
|
]);
|
|
25946
26239
|
const isLightBackground = useIsLightBackground();
|
|
25947
26240
|
const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
|
|
25948
|
-
const [isLoading, setIsLoading] =
|
|
25949
|
-
const [error, setError] =
|
|
25950
|
-
const [showPaymentForm, setShowPaymentForm] =
|
|
25951
|
-
const [stripe, setStripe] =
|
|
25952
|
-
const [setupIntent, setSetupIntent] =
|
|
25953
|
-
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] =
|
|
25954
|
-
const [currentPaymentMethod, setCurrentPaymentMethod] =
|
|
26241
|
+
const [isLoading, setIsLoading] = useState20(!initialPaymentMethod);
|
|
26242
|
+
const [error, setError] = useState20();
|
|
26243
|
+
const [showPaymentForm, setShowPaymentForm] = useState20(false);
|
|
26244
|
+
const [stripe, setStripe] = useState20(null);
|
|
26245
|
+
const [setupIntent, setSetupIntent] = useState20();
|
|
26246
|
+
const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState20(false);
|
|
26247
|
+
const [currentPaymentMethod, setCurrentPaymentMethod] = useState20(initialPaymentMethod);
|
|
25955
26248
|
const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
|
|
25956
26249
|
stripe,
|
|
25957
26250
|
clientSecret: confirmPaymentIntentProps?.clientSecret,
|
|
@@ -25964,7 +26257,7 @@ var PaymentMethodDetails = ({
|
|
|
25964
26257
|
},
|
|
25965
26258
|
autoConfirm: true
|
|
25966
26259
|
});
|
|
25967
|
-
const monthsToExpiration =
|
|
26260
|
+
const monthsToExpiration = useMemo31(() => {
|
|
25968
26261
|
let expiration;
|
|
25969
26262
|
if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
|
|
25970
26263
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -25987,7 +26280,7 @@ var PaymentMethodDetails = ({
|
|
|
25987
26280
|
const toggleShowPaymentMethods = () => {
|
|
25988
26281
|
setShowDifferentPaymentMethods((prev2) => !prev2);
|
|
25989
26282
|
};
|
|
25990
|
-
const locale =
|
|
26283
|
+
const locale = useMemo31(() => stripeLocale(i18n.language), [i18n.language]);
|
|
25991
26284
|
const initializeStripe = useCallback15(() => {
|
|
25992
26285
|
if (stripe || !setupIntent) {
|
|
25993
26286
|
return;
|
|
@@ -26064,10 +26357,10 @@ var PaymentMethodDetails = ({
|
|
|
26064
26357
|
},
|
|
26065
26358
|
[t4, deletePaymentMethod]
|
|
26066
26359
|
);
|
|
26067
|
-
|
|
26360
|
+
useEffect8(() => {
|
|
26068
26361
|
initializeStripe();
|
|
26069
26362
|
}, [initializeStripe]);
|
|
26070
|
-
|
|
26363
|
+
useEffect8(() => {
|
|
26071
26364
|
if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
|
|
26072
26365
|
initializePaymentMethod();
|
|
26073
26366
|
}
|
|
@@ -26077,7 +26370,7 @@ var PaymentMethodDetails = ({
|
|
|
26077
26370
|
showPaymentForm,
|
|
26078
26371
|
initializePaymentMethod
|
|
26079
26372
|
]);
|
|
26080
|
-
return /* @__PURE__ */
|
|
26373
|
+
return /* @__PURE__ */ jsxs44(
|
|
26081
26374
|
Flex,
|
|
26082
26375
|
{
|
|
26083
26376
|
$position: "relative",
|
|
@@ -26085,7 +26378,7 @@ var PaymentMethodDetails = ({
|
|
|
26085
26378
|
$flexGrow: 1,
|
|
26086
26379
|
$gap: "1.5rem",
|
|
26087
26380
|
children: [
|
|
26088
|
-
/* @__PURE__ */
|
|
26381
|
+
/* @__PURE__ */ jsx59(
|
|
26089
26382
|
Flex,
|
|
26090
26383
|
{
|
|
26091
26384
|
$position: "absolute",
|
|
@@ -26094,7 +26387,7 @@ var PaymentMethodDetails = ({
|
|
|
26094
26387
|
$alignItems: "center",
|
|
26095
26388
|
$width: "100%",
|
|
26096
26389
|
$height: "100%",
|
|
26097
|
-
children: /* @__PURE__ */
|
|
26390
|
+
children: /* @__PURE__ */ jsx59(
|
|
26098
26391
|
Loader,
|
|
26099
26392
|
{
|
|
26100
26393
|
$color: settings.theme.primary,
|
|
@@ -26104,7 +26397,7 @@ var PaymentMethodDetails = ({
|
|
|
26104
26397
|
)
|
|
26105
26398
|
}
|
|
26106
26399
|
),
|
|
26107
|
-
/* @__PURE__ */
|
|
26400
|
+
/* @__PURE__ */ jsxs44(
|
|
26108
26401
|
Flex,
|
|
26109
26402
|
{
|
|
26110
26403
|
$zIndex: isLoading || isConfirmingPayment ? 0 : 1,
|
|
@@ -26121,7 +26414,7 @@ var PaymentMethodDetails = ({
|
|
|
26121
26414
|
}
|
|
26122
26415
|
},
|
|
26123
26416
|
children: [
|
|
26124
|
-
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */
|
|
26417
|
+
setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs44(
|
|
26125
26418
|
Elements,
|
|
26126
26419
|
{
|
|
26127
26420
|
stripe,
|
|
@@ -26152,7 +26445,7 @@ var PaymentMethodDetails = ({
|
|
|
26152
26445
|
clientSecret: setupIntent?.setupIntentClientSecret
|
|
26153
26446
|
},
|
|
26154
26447
|
children: [
|
|
26155
|
-
/* @__PURE__ */
|
|
26448
|
+
/* @__PURE__ */ jsx59(
|
|
26156
26449
|
PaymentForm,
|
|
26157
26450
|
{
|
|
26158
26451
|
financeData,
|
|
@@ -26163,7 +26456,7 @@ var PaymentMethodDetails = ({
|
|
|
26163
26456
|
}
|
|
26164
26457
|
}
|
|
26165
26458
|
),
|
|
26166
|
-
currentPaymentMethod && /* @__PURE__ */
|
|
26459
|
+
currentPaymentMethod && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(
|
|
26167
26460
|
Text,
|
|
26168
26461
|
{
|
|
26169
26462
|
onClick: focusExistingPaymentMethods,
|
|
@@ -26176,8 +26469,8 @@ var PaymentMethodDetails = ({
|
|
|
26176
26469
|
) })
|
|
26177
26470
|
]
|
|
26178
26471
|
}
|
|
26179
|
-
) : /* @__PURE__ */
|
|
26180
|
-
/* @__PURE__ */
|
|
26472
|
+
) : /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", children: [
|
|
26473
|
+
/* @__PURE__ */ jsx59(
|
|
26181
26474
|
PaymentMethodElement,
|
|
26182
26475
|
{
|
|
26183
26476
|
paymentMethod: currentPaymentMethod,
|
|
@@ -26190,8 +26483,8 @@ var PaymentMethodDetails = ({
|
|
|
26190
26483
|
...props
|
|
26191
26484
|
}
|
|
26192
26485
|
),
|
|
26193
|
-
paymentMethods.length > 0 && /* @__PURE__ */
|
|
26194
|
-
/* @__PURE__ */
|
|
26486
|
+
paymentMethods.length > 0 && /* @__PURE__ */ jsxs44(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
|
|
26487
|
+
/* @__PURE__ */ jsx59(
|
|
26195
26488
|
Text,
|
|
26196
26489
|
{
|
|
26197
26490
|
onClick: toggleShowPaymentMethods,
|
|
@@ -26202,7 +26495,7 @@ var PaymentMethodDetails = ({
|
|
|
26202
26495
|
children: t4("Choose different payment method")
|
|
26203
26496
|
}
|
|
26204
26497
|
),
|
|
26205
|
-
/* @__PURE__ */
|
|
26498
|
+
/* @__PURE__ */ jsx59(
|
|
26206
26499
|
Icon3,
|
|
26207
26500
|
{
|
|
26208
26501
|
name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
|
|
@@ -26210,10 +26503,10 @@ var PaymentMethodDetails = ({
|
|
|
26210
26503
|
}
|
|
26211
26504
|
)
|
|
26212
26505
|
] }),
|
|
26213
|
-
showDifferentPaymentMethods && /* @__PURE__ */
|
|
26214
|
-
paymentMethods.length > 1 && /* @__PURE__ */
|
|
26506
|
+
showDifferentPaymentMethods && /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
|
|
26507
|
+
paymentMethods.length > 1 && /* @__PURE__ */ jsx59(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
|
|
26215
26508
|
(paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
|
|
26216
|
-
) || []).map((paymentMethod) => /* @__PURE__ */
|
|
26509
|
+
) || []).map((paymentMethod) => /* @__PURE__ */ jsx59(
|
|
26217
26510
|
PaymentListElement,
|
|
26218
26511
|
{
|
|
26219
26512
|
paymentMethod,
|
|
@@ -26222,7 +26515,7 @@ var PaymentMethodDetails = ({
|
|
|
26222
26515
|
},
|
|
26223
26516
|
paymentMethod.id
|
|
26224
26517
|
)) }),
|
|
26225
|
-
/* @__PURE__ */
|
|
26518
|
+
/* @__PURE__ */ jsx59(
|
|
26226
26519
|
Button,
|
|
26227
26520
|
{
|
|
26228
26521
|
type: "button",
|
|
@@ -26237,7 +26530,7 @@ var PaymentMethodDetails = ({
|
|
|
26237
26530
|
)
|
|
26238
26531
|
] })
|
|
26239
26532
|
] }),
|
|
26240
|
-
!isLoading && error && /* @__PURE__ */
|
|
26533
|
+
!isLoading && error && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(Text, { $weight: 500, $color: "#DB6669", children: error }) })
|
|
26241
26534
|
]
|
|
26242
26535
|
}
|
|
26243
26536
|
)
|
|
@@ -26247,13 +26540,13 @@ var PaymentMethodDetails = ({
|
|
|
26247
26540
|
};
|
|
26248
26541
|
|
|
26249
26542
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26250
|
-
import { forwardRef as forwardRef14, useMemo as
|
|
26543
|
+
import { forwardRef as forwardRef14, useMemo as useMemo33 } from "react";
|
|
26251
26544
|
|
|
26252
26545
|
// src/components/elements/plan-manager/AddOn.tsx
|
|
26253
|
-
import { jsx as
|
|
26546
|
+
import { jsx as jsx60, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
26254
26547
|
var AddOn = ({ addOn, currency, period, layout }) => {
|
|
26255
26548
|
const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
|
|
26256
|
-
return /* @__PURE__ */
|
|
26549
|
+
return /* @__PURE__ */ jsxs45(
|
|
26257
26550
|
Flex,
|
|
26258
26551
|
{
|
|
26259
26552
|
$justifyContent: "space-between",
|
|
@@ -26261,10 +26554,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26261
26554
|
$flexWrap: "wrap",
|
|
26262
26555
|
$gap: "1rem",
|
|
26263
26556
|
children: [
|
|
26264
|
-
/* @__PURE__ */
|
|
26265
|
-
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */
|
|
26557
|
+
/* @__PURE__ */ jsx60(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
|
|
26558
|
+
typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs45(Text, { children: [
|
|
26266
26559
|
formatCurrency(addOn.planPrice, currency),
|
|
26267
|
-
/* @__PURE__ */
|
|
26560
|
+
/* @__PURE__ */ jsx60("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
|
|
26268
26561
|
] })
|
|
26269
26562
|
]
|
|
26270
26563
|
}
|
|
@@ -26272,8 +26565,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
|
|
|
26272
26565
|
};
|
|
26273
26566
|
|
|
26274
26567
|
// src/components/elements/plan-manager/UsageDetails.tsx
|
|
26275
|
-
import { Fragment as Fragment24, useMemo as
|
|
26276
|
-
import { Fragment as Fragment25, jsx as
|
|
26568
|
+
import { Fragment as Fragment24, useMemo as useMemo32 } from "react";
|
|
26569
|
+
import { Fragment as Fragment25, jsx as jsx61, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
26277
26570
|
var UsageDetails2 = ({
|
|
26278
26571
|
entitlement,
|
|
26279
26572
|
period,
|
|
@@ -26288,40 +26581,40 @@ var UsageDetails2 = ({
|
|
|
26288
26581
|
billingPrice,
|
|
26289
26582
|
limit,
|
|
26290
26583
|
cost = 0
|
|
26291
|
-
} =
|
|
26584
|
+
} = useMemo32(
|
|
26292
26585
|
() => getUsageDetails(entitlement, period, currency, {
|
|
26293
26586
|
showWarningThresholdAsLimit
|
|
26294
26587
|
}),
|
|
26295
26588
|
[entitlement, period, currency, showWarningThresholdAsLimit]
|
|
26296
26589
|
);
|
|
26297
|
-
const description =
|
|
26590
|
+
const description = useMemo32(() => {
|
|
26298
26591
|
const acc = [];
|
|
26299
26592
|
let index = 0;
|
|
26300
26593
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
|
|
26301
|
-
acc.push(/* @__PURE__ */
|
|
26594
|
+
acc.push(/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26302
26595
|
t4("Additional"),
|
|
26303
26596
|
": "
|
|
26304
26597
|
] }, index));
|
|
26305
26598
|
index += 1;
|
|
26306
26599
|
}
|
|
26307
26600
|
if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
|
|
26308
|
-
acc.push(/* @__PURE__ */
|
|
26601
|
+
acc.push(/* @__PURE__ */ jsx61(Fragment24, { children: t4("Tier-based") }, index));
|
|
26309
26602
|
index += 1;
|
|
26310
26603
|
}
|
|
26311
26604
|
const { price } = getEntitlementPrice(entitlement, period, currency) || {};
|
|
26312
26605
|
if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
|
|
26313
26606
|
const packageSize = billingPrice?.packageSize ?? 1;
|
|
26314
26607
|
acc.push(
|
|
26315
|
-
/* @__PURE__ */
|
|
26608
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26316
26609
|
formatCurrency(price, billingPrice?.currency),
|
|
26317
|
-
/* @__PURE__ */
|
|
26610
|
+
/* @__PURE__ */ jsxs46("sub", { children: [
|
|
26318
26611
|
"/",
|
|
26319
|
-
packageSize > 1 && /* @__PURE__ */
|
|
26612
|
+
packageSize > 1 && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26320
26613
|
packageSize,
|
|
26321
26614
|
" "
|
|
26322
26615
|
] }),
|
|
26323
26616
|
getFeatureName(entitlement.feature, packageSize),
|
|
26324
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26617
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26325
26618
|
"/",
|
|
26326
26619
|
shortenPeriod(period)
|
|
26327
26620
|
] })
|
|
@@ -26332,7 +26625,7 @@ var UsageDetails2 = ({
|
|
|
26332
26625
|
}
|
|
26333
26626
|
if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
|
|
26334
26627
|
acc.push(
|
|
26335
|
-
/* @__PURE__ */
|
|
26628
|
+
/* @__PURE__ */ jsxs46(Fragment24, { children: [
|
|
26336
26629
|
formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
|
|
26337
26630
|
" ",
|
|
26338
26631
|
getFeatureName(
|
|
@@ -26360,7 +26653,7 @@ var UsageDetails2 = ({
|
|
|
26360
26653
|
return null;
|
|
26361
26654
|
}
|
|
26362
26655
|
const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
|
|
26363
|
-
return /* @__PURE__ */
|
|
26656
|
+
return /* @__PURE__ */ jsxs46(
|
|
26364
26657
|
Flex,
|
|
26365
26658
|
{
|
|
26366
26659
|
$justifyContent: "space-between",
|
|
@@ -26368,13 +26661,13 @@ var UsageDetails2 = ({
|
|
|
26368
26661
|
$flexWrap: "wrap",
|
|
26369
26662
|
$gap: "0.5rem",
|
|
26370
26663
|
children: [
|
|
26371
|
-
/* @__PURE__ */
|
|
26664
|
+
/* @__PURE__ */ jsx61(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26372
26665
|
quantity,
|
|
26373
26666
|
" ",
|
|
26374
26667
|
getFeatureName(entitlement.feature, quantity, true)
|
|
26375
26668
|
] }) : entitlement.feature.name }),
|
|
26376
|
-
/* @__PURE__ */
|
|
26377
|
-
description.length > 0 && /* @__PURE__ */
|
|
26669
|
+
/* @__PURE__ */ jsxs46(Text, { children: [
|
|
26670
|
+
description.length > 0 && /* @__PURE__ */ jsx61(
|
|
26378
26671
|
Text,
|
|
26379
26672
|
{
|
|
26380
26673
|
style: { opacity: 0.54 },
|
|
@@ -26385,15 +26678,15 @@ var UsageDetails2 = ({
|
|
|
26385
26678
|
),
|
|
26386
26679
|
// only show cost for pay-in-advance entitlements
|
|
26387
26680
|
// `description` will include price for other price behaviors
|
|
26388
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
26681
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs46(Fragment25, { children: [
|
|
26389
26682
|
" ",
|
|
26390
26683
|
formatCurrency(cost, billingPrice?.currency),
|
|
26391
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
26684
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46("sub", { children: [
|
|
26392
26685
|
"/",
|
|
26393
26686
|
shortenPeriod(period)
|
|
26394
26687
|
] })
|
|
26395
26688
|
] }),
|
|
26396
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */
|
|
26689
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ jsx61(
|
|
26397
26690
|
PricingTiersTooltip,
|
|
26398
26691
|
{
|
|
26399
26692
|
feature: entitlement.feature,
|
|
@@ -26403,7 +26696,7 @@ var UsageDetails2 = ({
|
|
|
26403
26696
|
tiersMode: billingPrice?.tiersMode ?? void 0
|
|
26404
26697
|
}
|
|
26405
26698
|
),
|
|
26406
|
-
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
26699
|
+
entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx61(
|
|
26407
26700
|
HardLimitTooltip,
|
|
26408
26701
|
{
|
|
26409
26702
|
feature: entitlement.feature,
|
|
@@ -26417,7 +26710,7 @@ var UsageDetails2 = ({
|
|
|
26417
26710
|
};
|
|
26418
26711
|
|
|
26419
26712
|
// src/components/elements/plan-manager/PlanManager.tsx
|
|
26420
|
-
import { Fragment as Fragment26, jsx as
|
|
26713
|
+
import { Fragment as Fragment26, jsx as jsx62, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
26421
26714
|
var resolveDesignProps7 = (props) => {
|
|
26422
26715
|
return {
|
|
26423
26716
|
header: {
|
|
@@ -26465,7 +26758,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26465
26758
|
showCredits,
|
|
26466
26759
|
showZeroPriceAsFree,
|
|
26467
26760
|
trialPaymentMethodRequired
|
|
26468
|
-
} =
|
|
26761
|
+
} = useMemo33(() => {
|
|
26469
26762
|
const planCreditOrder = /* @__PURE__ */ new Map();
|
|
26470
26763
|
(data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
|
|
26471
26764
|
if (!planCreditOrder.has(grant.creditId)) {
|
|
@@ -26525,15 +26818,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26525
26818
|
data?.displaySettings?.showZeroPriceAsFree,
|
|
26526
26819
|
data?.trialPaymentMethodRequired
|
|
26527
26820
|
]);
|
|
26528
|
-
const usageBasedEntitlements =
|
|
26821
|
+
const usageBasedEntitlements = useMemo33(
|
|
26529
26822
|
() => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
|
|
26530
26823
|
[featureUsage]
|
|
26531
26824
|
);
|
|
26532
|
-
const planCreditCompositions =
|
|
26825
|
+
const planCreditCompositions = useMemo33(
|
|
26533
26826
|
() => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
|
|
26534
26827
|
[currentPlan?.includedCreditGrants]
|
|
26535
26828
|
);
|
|
26536
|
-
const resolveLicenseQuantity =
|
|
26829
|
+
const resolveLicenseQuantity = useMemo33(() => {
|
|
26537
26830
|
return (licenseId) => {
|
|
26538
26831
|
const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
|
|
26539
26832
|
return typeof allocation === "number" ? allocation : void 0;
|
|
@@ -26556,7 +26849,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26556
26849
|
subscriptionCurrency,
|
|
26557
26850
|
willSubscriptionCancel,
|
|
26558
26851
|
isTrialSubscription
|
|
26559
|
-
} =
|
|
26852
|
+
} = useMemo33(() => {
|
|
26560
26853
|
const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
|
|
26561
26854
|
const subscriptionCurrency2 = billingSubscription?.currency;
|
|
26562
26855
|
const isTrialSubscription2 = billingSubscription?.status === "trialing";
|
|
@@ -26569,7 +26862,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26569
26862
|
};
|
|
26570
26863
|
}, [billingSubscription]);
|
|
26571
26864
|
const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
|
|
26572
|
-
const { isFreePlan, isUsageBasedPlan } =
|
|
26865
|
+
const { isFreePlan, isUsageBasedPlan } = useMemo33(() => {
|
|
26573
26866
|
const isFreePlan2 = currentPlan?.planPrice === 0;
|
|
26574
26867
|
const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
|
|
26575
26868
|
return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
|
|
@@ -26577,8 +26870,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26577
26870
|
const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
|
|
26578
26871
|
(grant) => isSelfServiceAutoTopupAvailable(grant)
|
|
26579
26872
|
) ?? false;
|
|
26580
|
-
return /* @__PURE__ */
|
|
26581
|
-
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */
|
|
26873
|
+
return /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26874
|
+
isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26582
26875
|
Notice,
|
|
26583
26876
|
{
|
|
26584
26877
|
as: Flex,
|
|
@@ -26588,8 +26881,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26588
26881
|
$textAlign: "center",
|
|
26589
26882
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26590
26883
|
children: [
|
|
26591
|
-
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */
|
|
26592
|
-
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */
|
|
26884
|
+
typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
|
|
26885
|
+
(trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ jsx62(
|
|
26593
26886
|
Text,
|
|
26594
26887
|
{
|
|
26595
26888
|
as: "p",
|
|
@@ -26603,7 +26896,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26603
26896
|
)
|
|
26604
26897
|
]
|
|
26605
26898
|
}
|
|
26606
|
-
) : willSubscriptionCancel ? /* @__PURE__ */
|
|
26899
|
+
) : willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
|
|
26607
26900
|
Notice,
|
|
26608
26901
|
{
|
|
26609
26902
|
as: Flex,
|
|
@@ -26613,8 +26906,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26613
26906
|
$textAlign: "center",
|
|
26614
26907
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26615
26908
|
children: [
|
|
26616
|
-
/* @__PURE__ */
|
|
26617
|
-
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */
|
|
26909
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
|
|
26910
|
+
typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx62(
|
|
26618
26911
|
Text,
|
|
26619
26912
|
{
|
|
26620
26913
|
as: "p",
|
|
@@ -26629,7 +26922,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26629
26922
|
)
|
|
26630
26923
|
]
|
|
26631
26924
|
}
|
|
26632
|
-
) : customPlanBilling ? /* @__PURE__ */
|
|
26925
|
+
) : customPlanBilling ? /* @__PURE__ */ jsxs47(
|
|
26633
26926
|
Notice,
|
|
26634
26927
|
{
|
|
26635
26928
|
as: Flex,
|
|
@@ -26639,19 +26932,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26639
26932
|
$textAlign: "center",
|
|
26640
26933
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26641
26934
|
children: [
|
|
26642
|
-
/* @__PURE__ */
|
|
26935
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
|
|
26643
26936
|
plan: customPlanBilling.planName ?? t4("your plan")
|
|
26644
26937
|
}) : t4("Custom plan payment due", {
|
|
26645
26938
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26646
26939
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26647
26940
|
}) }),
|
|
26648
|
-
/* @__PURE__ */
|
|
26941
|
+
/* @__PURE__ */ jsx62(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
|
|
26649
26942
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26650
26943
|
}) : t4("Custom plan payment due description", {
|
|
26651
26944
|
plan: customPlanBilling.planName ?? t4("your plan"),
|
|
26652
26945
|
date: toPrettyDate(customPlanBilling.deadline)
|
|
26653
26946
|
}) }),
|
|
26654
|
-
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */
|
|
26947
|
+
customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ jsx62(
|
|
26655
26948
|
Button,
|
|
26656
26949
|
{
|
|
26657
26950
|
as: "a",
|
|
@@ -26665,7 +26958,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26665
26958
|
)
|
|
26666
26959
|
]
|
|
26667
26960
|
}
|
|
26668
|
-
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */
|
|
26961
|
+
) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs47(
|
|
26669
26962
|
Notice,
|
|
26670
26963
|
{
|
|
26671
26964
|
as: Flex,
|
|
@@ -26675,10 +26968,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26675
26968
|
$textAlign: "center",
|
|
26676
26969
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26677
26970
|
children: [
|
|
26678
|
-
/* @__PURE__ */
|
|
26971
|
+
/* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
|
|
26679
26972
|
plan: data.company.scheduledDowngrade.toPlanName
|
|
26680
26973
|
}) }),
|
|
26681
|
-
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */
|
|
26974
|
+
typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx62(
|
|
26682
26975
|
Text,
|
|
26683
26976
|
{
|
|
26684
26977
|
as: "p",
|
|
@@ -26694,7 +26987,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26694
26987
|
]
|
|
26695
26988
|
}
|
|
26696
26989
|
),
|
|
26697
|
-
/* @__PURE__ */
|
|
26990
|
+
/* @__PURE__ */ jsxs47(
|
|
26698
26991
|
Element,
|
|
26699
26992
|
{
|
|
26700
26993
|
as: Flex,
|
|
@@ -26703,19 +26996,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26703
26996
|
$flexDirection: "column",
|
|
26704
26997
|
$gap: "2rem",
|
|
26705
26998
|
children: [
|
|
26706
|
-
props.header.isVisible && currentPlan && /* @__PURE__ */
|
|
26999
|
+
props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs47(
|
|
26707
27000
|
Flex,
|
|
26708
27001
|
{
|
|
26709
27002
|
$justifyContent: "space-between",
|
|
26710
27003
|
$alignItems: "center",
|
|
26711
27004
|
$gap: "1rem",
|
|
26712
27005
|
children: [
|
|
26713
|
-
/* @__PURE__ */
|
|
26714
|
-
/* @__PURE__ */
|
|
26715
|
-
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */
|
|
27006
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
27007
|
+
/* @__PURE__ */ jsx62(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
|
|
27008
|
+
props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx62(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
|
|
26716
27009
|
] }),
|
|
26717
|
-
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */
|
|
26718
|
-
/* @__PURE__ */
|
|
27010
|
+
props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsxs47(Box, { children: [
|
|
27011
|
+
/* @__PURE__ */ jsx62(
|
|
26719
27012
|
Text,
|
|
26720
27013
|
{
|
|
26721
27014
|
display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
|
|
@@ -26725,7 +27018,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26725
27018
|
)
|
|
26726
27019
|
}
|
|
26727
27020
|
),
|
|
26728
|
-
!isFreePlan && currentPlanPeriod && /* @__PURE__ */
|
|
27021
|
+
!isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx62(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
|
|
26729
27022
|
"/",
|
|
26730
27023
|
shortenPeriod(currentPlanPeriod)
|
|
26731
27024
|
] }) })
|
|
@@ -26733,8 +27026,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26733
27026
|
]
|
|
26734
27027
|
}
|
|
26735
27028
|
),
|
|
26736
|
-
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */
|
|
26737
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27029
|
+
props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27030
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26738
27031
|
Text,
|
|
26739
27032
|
{
|
|
26740
27033
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26742,7 +27035,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26742
27035
|
children: t4("Add-ons")
|
|
26743
27036
|
}
|
|
26744
27037
|
),
|
|
26745
|
-
/* @__PURE__ */
|
|
27038
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx62(
|
|
26746
27039
|
AddOn,
|
|
26747
27040
|
{
|
|
26748
27041
|
addOn,
|
|
@@ -26753,8 +27046,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26753
27046
|
addOnIndex
|
|
26754
27047
|
)) })
|
|
26755
27048
|
] }),
|
|
26756
|
-
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */
|
|
26757
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27049
|
+
props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27050
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26758
27051
|
Text,
|
|
26759
27052
|
{
|
|
26760
27053
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26762,8 +27055,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26762
27055
|
children: t4("Usage-based")
|
|
26763
27056
|
}
|
|
26764
27057
|
),
|
|
26765
|
-
/* @__PURE__ */
|
|
26766
|
-
return /* @__PURE__ */
|
|
27058
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
|
|
27059
|
+
return /* @__PURE__ */ jsx62(
|
|
26767
27060
|
UsageDetails2,
|
|
26768
27061
|
{
|
|
26769
27062
|
entitlement,
|
|
@@ -26776,8 +27069,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26776
27069
|
);
|
|
26777
27070
|
}) })
|
|
26778
27071
|
] }),
|
|
26779
|
-
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */
|
|
26780
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27072
|
+
props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27073
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26781
27074
|
Text,
|
|
26782
27075
|
{
|
|
26783
27076
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26785,7 +27078,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26785
27078
|
children: t4("Credits in plan")
|
|
26786
27079
|
}
|
|
26787
27080
|
),
|
|
26788
|
-
/* @__PURE__ */
|
|
27081
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
|
|
26789
27082
|
const planCreditGrant = currentPlan?.includedCreditGrants.find(
|
|
26790
27083
|
(grant) => grant.creditId === group.id
|
|
26791
27084
|
);
|
|
@@ -26808,13 +27101,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26808
27101
|
const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
|
|
26809
27102
|
const creditPeriod = composition.period ?? subscriptionInterval;
|
|
26810
27103
|
const showPerLicense = !!perLicenseGrant && !!licenseFeature;
|
|
26811
|
-
return /* @__PURE__ */
|
|
27104
|
+
return /* @__PURE__ */ jsxs47(
|
|
26812
27105
|
Flex,
|
|
26813
27106
|
{
|
|
26814
27107
|
$flexDirection: "column",
|
|
26815
27108
|
$gap: "0.25rem",
|
|
26816
27109
|
children: [
|
|
26817
|
-
/* @__PURE__ */
|
|
27110
|
+
/* @__PURE__ */ jsxs47(
|
|
26818
27111
|
Flex,
|
|
26819
27112
|
{
|
|
26820
27113
|
$justifyContent: "space-between",
|
|
@@ -26822,7 +27115,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26822
27115
|
$flexWrap: "wrap",
|
|
26823
27116
|
$gap: "0.5rem",
|
|
26824
27117
|
children: [
|
|
26825
|
-
/* @__PURE__ */
|
|
27118
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26826
27119
|
t4("X credits per license", {
|
|
26827
27120
|
amount: perLicenseGrant.amount,
|
|
26828
27121
|
creditName: getFeatureName(
|
|
@@ -26831,7 +27124,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26831
27124
|
),
|
|
26832
27125
|
licenseName: getFeatureName(licenseFeature, 1)
|
|
26833
27126
|
}),
|
|
26834
|
-
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */
|
|
27127
|
+
composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26835
27128
|
" ",
|
|
26836
27129
|
t4("Plus X credits per period", {
|
|
26837
27130
|
amount: composition.fixedQuantity,
|
|
@@ -26842,18 +27135,18 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26842
27135
|
period: t4(creditPeriod)
|
|
26843
27136
|
})
|
|
26844
27137
|
] })
|
|
26845
|
-
] }) : /* @__PURE__ */
|
|
27138
|
+
] }) : /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26846
27139
|
group.total.value,
|
|
26847
27140
|
" ",
|
|
26848
27141
|
getFeatureName(group, group.total.value),
|
|
26849
27142
|
" ",
|
|
26850
|
-
subscriptionInterval && /* @__PURE__ */
|
|
27143
|
+
subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment26, { children: [
|
|
26851
27144
|
t4("per"),
|
|
26852
27145
|
" ",
|
|
26853
27146
|
t4(subscriptionInterval)
|
|
26854
27147
|
] })
|
|
26855
27148
|
] }) }),
|
|
26856
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27149
|
+
group.total.used > 0 && /* @__PURE__ */ jsx62(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ jsxs47(
|
|
26857
27150
|
Text,
|
|
26858
27151
|
{
|
|
26859
27152
|
style: { opacity: 0.54 },
|
|
@@ -26863,7 +27156,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26863
27156
|
group.total.used,
|
|
26864
27157
|
" ",
|
|
26865
27158
|
t4("used"),
|
|
26866
|
-
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */
|
|
27159
|
+
hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ jsx62(
|
|
26867
27160
|
AutoTopupNotice,
|
|
26868
27161
|
{
|
|
26869
27162
|
thresholdCredits,
|
|
@@ -26876,7 +27169,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26876
27169
|
]
|
|
26877
27170
|
}
|
|
26878
27171
|
),
|
|
26879
|
-
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */
|
|
27172
|
+
showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx62(
|
|
26880
27173
|
Text,
|
|
26881
27174
|
{
|
|
26882
27175
|
style: { opacity: 0.54 },
|
|
@@ -26917,7 +27210,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26917
27210
|
groupIndex
|
|
26918
27211
|
);
|
|
26919
27212
|
}) }),
|
|
26920
|
-
planCredits.canExpand && /* @__PURE__ */
|
|
27213
|
+
planCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
26921
27214
|
ExpandListToggle,
|
|
26922
27215
|
{
|
|
26923
27216
|
isExpanded: planCredits.isExpanded,
|
|
@@ -26926,7 +27219,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26926
27219
|
$marginTop: "0.5rem"
|
|
26927
27220
|
}
|
|
26928
27221
|
),
|
|
26929
|
-
hasAutoTopupSelfService && /* @__PURE__ */
|
|
27222
|
+
hasAutoTopupSelfService && /* @__PURE__ */ jsxs47(
|
|
26930
27223
|
Flex,
|
|
26931
27224
|
{
|
|
26932
27225
|
$justifyContent: "space-between",
|
|
@@ -26936,8 +27229,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26936
27229
|
$backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
|
|
26937
27230
|
$borderRadius: "0.5rem",
|
|
26938
27231
|
children: [
|
|
26939
|
-
/* @__PURE__ */
|
|
26940
|
-
/* @__PURE__ */
|
|
27232
|
+
/* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27233
|
+
/* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
|
|
26941
27234
|
currentPlan?.includedCreditGrants.reduce(
|
|
26942
27235
|
(acc, grant) => {
|
|
26943
27236
|
if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
|
|
@@ -26946,7 +27239,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26946
27239
|
const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
|
|
26947
27240
|
if (!autoTopupEnabled) {
|
|
26948
27241
|
acc.push(
|
|
26949
|
-
/* @__PURE__ */
|
|
27242
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
|
|
26950
27243
|
unit: getFeatureName(grant.credit, 1)
|
|
26951
27244
|
}) }, grant.id)
|
|
26952
27245
|
);
|
|
@@ -26956,7 +27249,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26956
27249
|
const autoTopupAmount = getAutoTopupAmount(grant);
|
|
26957
27250
|
if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
|
|
26958
27251
|
acc.push(
|
|
26959
|
-
/* @__PURE__ */
|
|
27252
|
+
/* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
|
|
26960
27253
|
unit: getFeatureName(
|
|
26961
27254
|
grant.credit,
|
|
26962
27255
|
autoTopupAmount
|
|
@@ -26971,7 +27264,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26971
27264
|
[]
|
|
26972
27265
|
)
|
|
26973
27266
|
] }),
|
|
26974
|
-
/* @__PURE__ */
|
|
27267
|
+
/* @__PURE__ */ jsx62(
|
|
26975
27268
|
Button,
|
|
26976
27269
|
{
|
|
26977
27270
|
type: "button",
|
|
@@ -26988,8 +27281,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26988
27281
|
}
|
|
26989
27282
|
)
|
|
26990
27283
|
] }),
|
|
26991
|
-
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */
|
|
26992
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27284
|
+
props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27285
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
26993
27286
|
Text,
|
|
26994
27287
|
{
|
|
26995
27288
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -26997,9 +27290,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
26997
27290
|
children: t4("Top-ups")
|
|
26998
27291
|
}
|
|
26999
27292
|
),
|
|
27000
|
-
/* @__PURE__ */
|
|
27293
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
|
|
27001
27294
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
27002
|
-
return /* @__PURE__ */
|
|
27295
|
+
return /* @__PURE__ */ jsxs47(
|
|
27003
27296
|
Flex,
|
|
27004
27297
|
{
|
|
27005
27298
|
$justifyContent: "space-between",
|
|
@@ -27007,8 +27300,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27007
27300
|
$flexWrap: "wrap",
|
|
27008
27301
|
$gap: "0.5rem",
|
|
27009
27302
|
children: [
|
|
27010
|
-
bundle ? /* @__PURE__ */
|
|
27011
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27303
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27304
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
27012
27305
|
"(",
|
|
27013
27306
|
group.grants.length,
|
|
27014
27307
|
")",
|
|
@@ -27020,8 +27313,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27020
27313
|
" ",
|
|
27021
27314
|
getFeatureName(group, group.quantity),
|
|
27022
27315
|
")"
|
|
27023
|
-
] }) : /* @__PURE__ */
|
|
27024
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27316
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27317
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
27025
27318
|
"(",
|
|
27026
27319
|
group.grants.length,
|
|
27027
27320
|
")",
|
|
@@ -27031,7 +27324,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27031
27324
|
" ",
|
|
27032
27325
|
getFeatureName(group, group.quantity)
|
|
27033
27326
|
] }),
|
|
27034
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27327
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27035
27328
|
Text,
|
|
27036
27329
|
{
|
|
27037
27330
|
style: { opacity: 0.54 },
|
|
@@ -27049,7 +27342,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27049
27342
|
groupIndex
|
|
27050
27343
|
);
|
|
27051
27344
|
}) }),
|
|
27052
|
-
autoTopupCredits.canExpand && /* @__PURE__ */
|
|
27345
|
+
autoTopupCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
27053
27346
|
ExpandListToggle,
|
|
27054
27347
|
{
|
|
27055
27348
|
isExpanded: autoTopupCredits.isExpanded,
|
|
@@ -27059,8 +27352,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27059
27352
|
}
|
|
27060
27353
|
)
|
|
27061
27354
|
] }),
|
|
27062
|
-
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */
|
|
27063
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27355
|
+
props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27356
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
27064
27357
|
Text,
|
|
27065
27358
|
{
|
|
27066
27359
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27068,9 +27361,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27068
27361
|
children: t4("Credit bundles")
|
|
27069
27362
|
}
|
|
27070
27363
|
),
|
|
27071
|
-
/* @__PURE__ */
|
|
27364
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
|
|
27072
27365
|
const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
|
|
27073
|
-
return /* @__PURE__ */
|
|
27366
|
+
return /* @__PURE__ */ jsxs47(
|
|
27074
27367
|
Flex,
|
|
27075
27368
|
{
|
|
27076
27369
|
$justifyContent: "space-between",
|
|
@@ -27078,8 +27371,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27078
27371
|
$flexWrap: "wrap",
|
|
27079
27372
|
$gap: "0.5rem",
|
|
27080
27373
|
children: [
|
|
27081
|
-
bundle ? /* @__PURE__ */
|
|
27082
|
-
group.grants.length > 1 && /* @__PURE__ */
|
|
27374
|
+
bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27375
|
+
group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
|
|
27083
27376
|
"(",
|
|
27084
27377
|
group.grants.length,
|
|
27085
27378
|
")",
|
|
@@ -27091,12 +27384,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27091
27384
|
" ",
|
|
27092
27385
|
getFeatureName(group, group.quantity),
|
|
27093
27386
|
")"
|
|
27094
|
-
] }) : /* @__PURE__ */
|
|
27387
|
+
] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27095
27388
|
group.quantity,
|
|
27096
27389
|
" ",
|
|
27097
27390
|
getFeatureName(group, group.quantity)
|
|
27098
27391
|
] }),
|
|
27099
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27392
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27100
27393
|
Text,
|
|
27101
27394
|
{
|
|
27102
27395
|
style: { opacity: 0.54 },
|
|
@@ -27114,7 +27407,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27114
27407
|
groupIndex
|
|
27115
27408
|
);
|
|
27116
27409
|
}) }),
|
|
27117
|
-
bundleCredits.canExpand && /* @__PURE__ */
|
|
27410
|
+
bundleCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
27118
27411
|
ExpandListToggle,
|
|
27119
27412
|
{
|
|
27120
27413
|
isExpanded: bundleCredits.isExpanded,
|
|
@@ -27124,8 +27417,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27124
27417
|
}
|
|
27125
27418
|
)
|
|
27126
27419
|
] }),
|
|
27127
|
-
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */
|
|
27128
|
-
props.addOns.showLabel && /* @__PURE__ */
|
|
27420
|
+
props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27421
|
+
props.addOns.showLabel && /* @__PURE__ */ jsx62(
|
|
27129
27422
|
Text,
|
|
27130
27423
|
{
|
|
27131
27424
|
$color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
|
|
@@ -27133,8 +27426,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27133
27426
|
children: t4("Promotional credits")
|
|
27134
27427
|
}
|
|
27135
27428
|
),
|
|
27136
|
-
/* @__PURE__ */
|
|
27137
|
-
return /* @__PURE__ */
|
|
27429
|
+
/* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
|
|
27430
|
+
return /* @__PURE__ */ jsxs47(
|
|
27138
27431
|
Flex,
|
|
27139
27432
|
{
|
|
27140
27433
|
$justifyContent: "space-between",
|
|
@@ -27142,12 +27435,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27142
27435
|
$flexWrap: "wrap",
|
|
27143
27436
|
$gap: "0.5rem",
|
|
27144
27437
|
children: [
|
|
27145
|
-
/* @__PURE__ */
|
|
27438
|
+
/* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
|
|
27146
27439
|
group.quantity,
|
|
27147
27440
|
" ",
|
|
27148
27441
|
getFeatureName(group, group.quantity)
|
|
27149
27442
|
] }),
|
|
27150
|
-
group.total.used > 0 && /* @__PURE__ */
|
|
27443
|
+
group.total.used > 0 && /* @__PURE__ */ jsxs47(
|
|
27151
27444
|
Text,
|
|
27152
27445
|
{
|
|
27153
27446
|
style: { opacity: 0.54 },
|
|
@@ -27165,7 +27458,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27165
27458
|
groupIndex
|
|
27166
27459
|
);
|
|
27167
27460
|
}) }),
|
|
27168
|
-
promotionalCredits.canExpand && /* @__PURE__ */
|
|
27461
|
+
promotionalCredits.canExpand && /* @__PURE__ */ jsx62(
|
|
27169
27462
|
ExpandListToggle,
|
|
27170
27463
|
{
|
|
27171
27464
|
isExpanded: promotionalCredits.isExpanded,
|
|
@@ -27175,7 +27468,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
|
|
|
27175
27468
|
}
|
|
27176
27469
|
)
|
|
27177
27470
|
] }),
|
|
27178
|
-
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */
|
|
27471
|
+
canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ jsx62(
|
|
27179
27472
|
Button,
|
|
27180
27473
|
{
|
|
27181
27474
|
type: "button",
|
|
@@ -27200,14 +27493,14 @@ import {
|
|
|
27200
27493
|
Fragment as Fragment29,
|
|
27201
27494
|
forwardRef as forwardRef15,
|
|
27202
27495
|
useCallback as useCallback16,
|
|
27203
|
-
useEffect as
|
|
27204
|
-
useMemo as
|
|
27205
|
-
useState as
|
|
27496
|
+
useEffect as useEffect9,
|
|
27497
|
+
useMemo as useMemo35,
|
|
27498
|
+
useState as useState22
|
|
27206
27499
|
} from "react";
|
|
27207
27500
|
|
|
27208
27501
|
// src/components/elements/pricing-table/AddOn.tsx
|
|
27209
|
-
import { useMemo as
|
|
27210
|
-
import { Fragment as Fragment27, jsx as
|
|
27502
|
+
import { useMemo as useMemo34 } from "react";
|
|
27503
|
+
import { Fragment as Fragment27, jsx as jsx63, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
27211
27504
|
function renderMeteredEntitlementPricing2({
|
|
27212
27505
|
priceBehavior,
|
|
27213
27506
|
softLimit,
|
|
@@ -27219,7 +27512,7 @@ function renderMeteredEntitlementPricing2({
|
|
|
27219
27512
|
isTiered
|
|
27220
27513
|
}) {
|
|
27221
27514
|
if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
|
|
27222
|
-
return /* @__PURE__ */
|
|
27515
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27223
27516
|
"Additional: ",
|
|
27224
27517
|
formatCurrency(price, currency),
|
|
27225
27518
|
"/",
|
|
@@ -27230,13 +27523,13 @@ function renderMeteredEntitlementPricing2({
|
|
|
27230
27523
|
] });
|
|
27231
27524
|
}
|
|
27232
27525
|
if (isTiered) {
|
|
27233
|
-
return /* @__PURE__ */
|
|
27526
|
+
return /* @__PURE__ */ jsx63(Fragment27, { children: "Tier-based pricing" });
|
|
27234
27527
|
}
|
|
27235
27528
|
if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
|
|
27236
|
-
return /* @__PURE__ */
|
|
27529
|
+
return /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27237
27530
|
formatCurrency(price, currency),
|
|
27238
27531
|
"/",
|
|
27239
|
-
packageSize > 1 && /* @__PURE__ */
|
|
27532
|
+
packageSize > 1 && /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27240
27533
|
packageSize,
|
|
27241
27534
|
" "
|
|
27242
27535
|
] }),
|
|
@@ -27262,7 +27555,7 @@ var AddOn2 = ({
|
|
|
27262
27555
|
const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
|
|
27263
27556
|
const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
|
|
27264
27557
|
const isLightBackground = useIsLightBackground();
|
|
27265
|
-
const { currentAddOns, canCheckout, isStandalone } =
|
|
27558
|
+
const { currentAddOns, canCheckout, isStandalone } = useMemo34(() => {
|
|
27266
27559
|
const isStandalone2 = typeof data?.component === "undefined";
|
|
27267
27560
|
return {
|
|
27268
27561
|
currentAddOns: data?.company?.addOns || [],
|
|
@@ -27305,7 +27598,7 @@ var AddOn2 = ({
|
|
|
27305
27598
|
isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
|
|
27306
27599
|
};
|
|
27307
27600
|
}) || [];
|
|
27308
|
-
return /* @__PURE__ */
|
|
27601
|
+
return /* @__PURE__ */ jsxs48(
|
|
27309
27602
|
Flex,
|
|
27310
27603
|
{
|
|
27311
27604
|
as: "li",
|
|
@@ -27325,7 +27618,7 @@ var AddOn2 = ({
|
|
|
27325
27618
|
$boxShadow: cardBoxShadow
|
|
27326
27619
|
},
|
|
27327
27620
|
children: [
|
|
27328
|
-
/* @__PURE__ */
|
|
27621
|
+
/* @__PURE__ */ jsxs48(
|
|
27329
27622
|
Flex,
|
|
27330
27623
|
{
|
|
27331
27624
|
$flexDirection: "column",
|
|
@@ -27336,7 +27629,7 @@ var AddOn2 = ({
|
|
|
27336
27629
|
$borderStyle: "solid",
|
|
27337
27630
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27338
27631
|
children: [
|
|
27339
|
-
/* @__PURE__ */
|
|
27632
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27340
27633
|
Text,
|
|
27341
27634
|
{
|
|
27342
27635
|
as: "h3",
|
|
@@ -27345,22 +27638,22 @@ var AddOn2 = ({
|
|
|
27345
27638
|
children: addOn.name
|
|
27346
27639
|
}
|
|
27347
27640
|
) }),
|
|
27348
|
-
layout.addOns.showDescription && /* @__PURE__ */
|
|
27349
|
-
/* @__PURE__ */
|
|
27641
|
+
layout.addOns.showDescription && /* @__PURE__ */ jsx63(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx63(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
|
|
27642
|
+
/* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
|
|
27350
27643
|
Text,
|
|
27351
27644
|
{
|
|
27352
27645
|
"data-testid": "sch-addon-price",
|
|
27353
27646
|
display: layout.plans.name.fontStyle,
|
|
27354
|
-
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */
|
|
27647
|
+
children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ jsxs48(Fragment27, { children: [
|
|
27355
27648
|
formatCurrency(addOnPrice ?? 0, addOnCurrency),
|
|
27356
|
-
/* @__PURE__ */
|
|
27649
|
+
/* @__PURE__ */ jsxs48("sub", { children: [
|
|
27357
27650
|
"/",
|
|
27358
27651
|
selectedPeriod
|
|
27359
27652
|
] })
|
|
27360
27653
|
] })
|
|
27361
27654
|
}
|
|
27362
27655
|
) }),
|
|
27363
|
-
isActiveAddOn && /* @__PURE__ */
|
|
27656
|
+
isActiveAddOn && /* @__PURE__ */ jsx63(
|
|
27364
27657
|
Flex,
|
|
27365
27658
|
{
|
|
27366
27659
|
"data-testid": "sch-addon-active",
|
|
@@ -27370,7 +27663,7 @@ var AddOn2 = ({
|
|
|
27370
27663
|
$backgroundColor: settings.theme.primary,
|
|
27371
27664
|
$borderRadius: "9999px",
|
|
27372
27665
|
$padding: "0.125rem 0.85rem",
|
|
27373
|
-
children: /* @__PURE__ */
|
|
27666
|
+
children: /* @__PURE__ */ jsx63(
|
|
27374
27667
|
Text,
|
|
27375
27668
|
{
|
|
27376
27669
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27383,7 +27676,7 @@ var AddOn2 = ({
|
|
|
27383
27676
|
]
|
|
27384
27677
|
}
|
|
27385
27678
|
),
|
|
27386
|
-
/* @__PURE__ */
|
|
27679
|
+
/* @__PURE__ */ jsxs48(
|
|
27387
27680
|
Flex,
|
|
27388
27681
|
{
|
|
27389
27682
|
$flexDirection: "column",
|
|
@@ -27392,7 +27685,7 @@ var AddOn2 = ({
|
|
|
27392
27685
|
$flexGrow: 1,
|
|
27393
27686
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27394
27687
|
children: [
|
|
27395
|
-
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */
|
|
27688
|
+
layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ jsx63(
|
|
27396
27689
|
Flex,
|
|
27397
27690
|
{
|
|
27398
27691
|
as: "ul",
|
|
@@ -27404,7 +27697,7 @@ var AddOn2 = ({
|
|
|
27404
27697
|
$listStyle: "none",
|
|
27405
27698
|
children: displayableEntitlements.map((entitlement, idx) => {
|
|
27406
27699
|
if (entitlement.isUnlimited) {
|
|
27407
|
-
return /* @__PURE__ */
|
|
27700
|
+
return /* @__PURE__ */ jsxs48(
|
|
27408
27701
|
Flex,
|
|
27409
27702
|
{
|
|
27410
27703
|
as: "li",
|
|
@@ -27413,8 +27706,8 @@ var AddOn2 = ({
|
|
|
27413
27706
|
$alignItems: "center",
|
|
27414
27707
|
$gap: "1rem",
|
|
27415
27708
|
children: [
|
|
27416
|
-
/* @__PURE__ */
|
|
27417
|
-
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27709
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27710
|
+
layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27418
27711
|
Icon3,
|
|
27419
27712
|
{
|
|
27420
27713
|
name: entitlement.feature.icon,
|
|
@@ -27423,16 +27716,16 @@ var AddOn2 = ({
|
|
|
27423
27716
|
rounded: true
|
|
27424
27717
|
}
|
|
27425
27718
|
),
|
|
27426
|
-
entitlement.feature && /* @__PURE__ */
|
|
27719
|
+
entitlement.feature && /* @__PURE__ */ jsx63(
|
|
27427
27720
|
Flex,
|
|
27428
27721
|
{
|
|
27429
27722
|
$flexDirection: "column",
|
|
27430
27723
|
$justifyContent: "center",
|
|
27431
|
-
children: /* @__PURE__ */
|
|
27724
|
+
children: /* @__PURE__ */ jsx63(Text, { children: getFeatureName(entitlement.feature) })
|
|
27432
27725
|
}
|
|
27433
27726
|
)
|
|
27434
27727
|
] }),
|
|
27435
|
-
/* @__PURE__ */
|
|
27728
|
+
/* @__PURE__ */ jsx63(
|
|
27436
27729
|
Text,
|
|
27437
27730
|
{
|
|
27438
27731
|
style: { opacity: 0.54 },
|
|
@@ -27447,7 +27740,7 @@ var AddOn2 = ({
|
|
|
27447
27740
|
);
|
|
27448
27741
|
}
|
|
27449
27742
|
const meteredEntitlement = entitlement;
|
|
27450
|
-
return /* @__PURE__ */
|
|
27743
|
+
return /* @__PURE__ */ jsxs48(
|
|
27451
27744
|
Flex,
|
|
27452
27745
|
{
|
|
27453
27746
|
as: "li",
|
|
@@ -27457,8 +27750,8 @@ var AddOn2 = ({
|
|
|
27457
27750
|
$gap: "1rem",
|
|
27458
27751
|
$listStyle: "none",
|
|
27459
27752
|
children: [
|
|
27460
|
-
/* @__PURE__ */
|
|
27461
|
-
meteredEntitlement.feature?.icon && /* @__PURE__ */
|
|
27753
|
+
/* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
|
|
27754
|
+
meteredEntitlement.feature?.icon && /* @__PURE__ */ jsx63(
|
|
27462
27755
|
Icon3,
|
|
27463
27756
|
{
|
|
27464
27757
|
"data-testid": "sch-feature-icon",
|
|
@@ -27468,9 +27761,9 @@ var AddOn2 = ({
|
|
|
27468
27761
|
rounded: true
|
|
27469
27762
|
}
|
|
27470
27763
|
),
|
|
27471
|
-
/* @__PURE__ */
|
|
27764
|
+
/* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ jsx63(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
|
|
27472
27765
|
] }),
|
|
27473
|
-
/* @__PURE__ */
|
|
27766
|
+
/* @__PURE__ */ jsx63(
|
|
27474
27767
|
Text,
|
|
27475
27768
|
{
|
|
27476
27769
|
style: { opacity: 0.54 },
|
|
@@ -27486,7 +27779,7 @@ var AddOn2 = ({
|
|
|
27486
27779
|
})
|
|
27487
27780
|
}
|
|
27488
27781
|
),
|
|
27489
|
-
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27782
|
+
sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ jsx63(
|
|
27490
27783
|
Button,
|
|
27491
27784
|
{
|
|
27492
27785
|
type: "button",
|
|
@@ -27525,10 +27818,10 @@ var AddOn2 = ({
|
|
|
27525
27818
|
};
|
|
27526
27819
|
|
|
27527
27820
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27528
|
-
import { useState as
|
|
27821
|
+
import { useState as useState21 } from "react";
|
|
27529
27822
|
|
|
27530
27823
|
// src/components/elements/pricing-table/Entitlement.tsx
|
|
27531
|
-
import { Fragment as Fragment28, jsx as
|
|
27824
|
+
import { Fragment as Fragment28, jsx as jsx64, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
27532
27825
|
var Entitlement2 = ({
|
|
27533
27826
|
entitlement,
|
|
27534
27827
|
sharedProps,
|
|
@@ -27562,8 +27855,8 @@ var Entitlement2 = ({
|
|
|
27562
27855
|
entitlement,
|
|
27563
27856
|
credits
|
|
27564
27857
|
);
|
|
27565
|
-
return /* @__PURE__ */
|
|
27566
|
-
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */
|
|
27858
|
+
return /* @__PURE__ */ jsxs49(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
|
|
27859
|
+
layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx64(
|
|
27567
27860
|
Icon3,
|
|
27568
27861
|
{
|
|
27569
27862
|
"data-testid": "sch-feature-icon",
|
|
@@ -27573,31 +27866,31 @@ var Entitlement2 = ({
|
|
|
27573
27866
|
rounded: true
|
|
27574
27867
|
}
|
|
27575
27868
|
),
|
|
27576
|
-
entitlement.feature?.name && /* @__PURE__ */
|
|
27577
|
-
/* @__PURE__ */
|
|
27578
|
-
/* @__PURE__ */
|
|
27869
|
+
entitlement.feature?.name && /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
27870
|
+
/* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
|
|
27871
|
+
/* @__PURE__ */ jsx64(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27579
27872
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27580
27873
|
" ",
|
|
27581
27874
|
t4("per"),
|
|
27582
27875
|
" ",
|
|
27583
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27876
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27584
27877
|
formatNumber(entitlementPackageSize),
|
|
27585
27878
|
" "
|
|
27586
27879
|
] }),
|
|
27587
27880
|
getFeatureName(entitlement.feature, entitlementPackageSize),
|
|
27588
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */
|
|
27881
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27589
27882
|
" ",
|
|
27590
27883
|
t4("per"),
|
|
27591
27884
|
" ",
|
|
27592
27885
|
selectedPeriod
|
|
27593
27886
|
] })
|
|
27594
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */
|
|
27887
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ jsx64(
|
|
27595
27888
|
TieredPricingDetails,
|
|
27596
27889
|
{
|
|
27597
27890
|
entitlement,
|
|
27598
27891
|
period: selectedPeriod
|
|
27599
27892
|
}
|
|
27600
|
-
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */
|
|
27893
|
+
) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27601
27894
|
formatConsumptionRate(entitlement.consumptionRate),
|
|
27602
27895
|
" ",
|
|
27603
27896
|
getFeatureName(
|
|
@@ -27608,7 +27901,7 @@ var Entitlement2 = ({
|
|
|
27608
27901
|
t4("per"),
|
|
27609
27902
|
" ",
|
|
27610
27903
|
getFeatureName(entitlement.feature, 1)
|
|
27611
|
-
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */
|
|
27904
|
+
] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx64(Fragment28, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
|
|
27612
27905
|
amount: formatNumber(creditBasedEntitlementLimit.limit),
|
|
27613
27906
|
units: getFeatureName(
|
|
27614
27907
|
entitlement.feature,
|
|
@@ -27621,25 +27914,25 @@ var Entitlement2 = ({
|
|
|
27621
27914
|
entitlement.feature,
|
|
27622
27915
|
creditBasedEntitlementLimit.limit
|
|
27623
27916
|
)
|
|
27624
|
-
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */
|
|
27917
|
+
}) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27625
27918
|
entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
|
|
27626
27919
|
item: getFeatureName(entitlement.feature)
|
|
27627
|
-
}) : /* @__PURE__ */
|
|
27628
|
-
typeof limit === "number" && /* @__PURE__ */
|
|
27920
|
+
}) : /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27921
|
+
typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27629
27922
|
formatNumber(limit),
|
|
27630
27923
|
" "
|
|
27631
27924
|
] }),
|
|
27632
27925
|
getFeatureName(entitlement.feature, limit)
|
|
27633
27926
|
] }),
|
|
27634
|
-
metricPeriodName && /* @__PURE__ */
|
|
27927
|
+
metricPeriodName && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27635
27928
|
" ",
|
|
27636
27929
|
t4("per"),
|
|
27637
27930
|
" ",
|
|
27638
27931
|
t4(metricPeriodName)
|
|
27639
27932
|
] })
|
|
27640
27933
|
] }) : entitlement.feature.name }),
|
|
27641
|
-
/* @__PURE__ */
|
|
27642
|
-
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */
|
|
27934
|
+
/* @__PURE__ */ jsxs49(Text, { children: [
|
|
27935
|
+
entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsx64(Fragment28, { children: /* @__PURE__ */ jsxs49(
|
|
27643
27936
|
Text,
|
|
27644
27937
|
{
|
|
27645
27938
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27649,7 +27942,7 @@ var Entitlement2 = ({
|
|
|
27649
27942
|
" ",
|
|
27650
27943
|
formatCurrency(entitlementPrice, entitlementCurrency),
|
|
27651
27944
|
"/",
|
|
27652
|
-
entitlementPackageSize > 1 && /* @__PURE__ */
|
|
27945
|
+
entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27653
27946
|
formatNumber(entitlementPackageSize),
|
|
27654
27947
|
" "
|
|
27655
27948
|
] }),
|
|
@@ -27657,14 +27950,14 @@ var Entitlement2 = ({
|
|
|
27657
27950
|
entitlement.feature,
|
|
27658
27951
|
entitlementPackageSize
|
|
27659
27952
|
),
|
|
27660
|
-
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */
|
|
27953
|
+
entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27661
27954
|
"/",
|
|
27662
27955
|
shortenPeriod(selectedPeriod)
|
|
27663
27956
|
] })
|
|
27664
27957
|
]
|
|
27665
27958
|
}
|
|
27666
|
-
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */
|
|
27667
|
-
/* @__PURE__ */
|
|
27959
|
+
) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs49(Fragment28, { children: [
|
|
27960
|
+
/* @__PURE__ */ jsx64(
|
|
27668
27961
|
Text,
|
|
27669
27962
|
{
|
|
27670
27963
|
style: { opacity: 0.54 },
|
|
@@ -27673,7 +27966,7 @@ var Entitlement2 = ({
|
|
|
27673
27966
|
children: t4("Tier-based")
|
|
27674
27967
|
}
|
|
27675
27968
|
),
|
|
27676
|
-
/* @__PURE__ */
|
|
27969
|
+
/* @__PURE__ */ jsx64(
|
|
27677
27970
|
PricingTiersTooltip,
|
|
27678
27971
|
{
|
|
27679
27972
|
feature: entitlement.feature,
|
|
@@ -27684,14 +27977,14 @@ var Entitlement2 = ({
|
|
|
27684
27977
|
}
|
|
27685
27978
|
)
|
|
27686
27979
|
] }),
|
|
27687
|
-
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */
|
|
27980
|
+
entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx64(
|
|
27688
27981
|
HardLimitTooltip,
|
|
27689
27982
|
{
|
|
27690
27983
|
feature: entitlement.feature,
|
|
27691
27984
|
limit: entitlement.valueNumeric
|
|
27692
27985
|
}
|
|
27693
27986
|
),
|
|
27694
|
-
entitlement.billingThreshold && /* @__PURE__ */
|
|
27987
|
+
entitlement.billingThreshold && /* @__PURE__ */ jsx64(
|
|
27695
27988
|
BillingThresholdTooltip,
|
|
27696
27989
|
{
|
|
27697
27990
|
billingThreshold: entitlement.billingThreshold
|
|
@@ -27699,7 +27992,7 @@ var Entitlement2 = ({
|
|
|
27699
27992
|
)
|
|
27700
27993
|
] })
|
|
27701
27994
|
] }),
|
|
27702
|
-
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */
|
|
27995
|
+
layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx64(
|
|
27703
27996
|
Text,
|
|
27704
27997
|
{
|
|
27705
27998
|
$size: 0.875 * settings.theme.typography.text.fontSize,
|
|
@@ -27712,7 +28005,7 @@ var Entitlement2 = ({
|
|
|
27712
28005
|
};
|
|
27713
28006
|
|
|
27714
28007
|
// src/components/elements/pricing-table/Plan.tsx
|
|
27715
|
-
import { jsx as
|
|
28008
|
+
import { jsx as jsx65, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
27716
28009
|
var Plan2 = ({
|
|
27717
28010
|
plan,
|
|
27718
28011
|
index,
|
|
@@ -27726,7 +28019,7 @@ var Plan2 = ({
|
|
|
27726
28019
|
const { data, settings, setCheckoutState } = useEmbed();
|
|
27727
28020
|
const isLightBackground = useIsLightBackground();
|
|
27728
28021
|
const trialEnd = useTrialEnd();
|
|
27729
|
-
const [entitlementVisibility, setEntitlementVisibility] =
|
|
28022
|
+
const [entitlementVisibility, setEntitlementVisibility] = useState21({});
|
|
27730
28023
|
const handleToggleShowAll = (id) => {
|
|
27731
28024
|
setEntitlementVisibility((prev2) => {
|
|
27732
28025
|
const updated = !(prev2[id] ?? false);
|
|
@@ -27755,7 +28048,7 @@ var Plan2 = ({
|
|
|
27755
28048
|
const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
|
|
27756
28049
|
const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
|
|
27757
28050
|
const isExpanded = entitlementVisibility[plan.id] ?? false;
|
|
27758
|
-
return /* @__PURE__ */
|
|
28051
|
+
return /* @__PURE__ */ jsxs50(
|
|
27759
28052
|
Flex,
|
|
27760
28053
|
{
|
|
27761
28054
|
as: "li",
|
|
@@ -27775,7 +28068,7 @@ var Plan2 = ({
|
|
|
27775
28068
|
$boxShadow: cardBoxShadow
|
|
27776
28069
|
},
|
|
27777
28070
|
children: [
|
|
27778
|
-
/* @__PURE__ */
|
|
28071
|
+
/* @__PURE__ */ jsxs50(
|
|
27779
28072
|
Flex,
|
|
27780
28073
|
{
|
|
27781
28074
|
$flexDirection: "column",
|
|
@@ -27786,7 +28079,7 @@ var Plan2 = ({
|
|
|
27786
28079
|
$borderStyle: "solid",
|
|
27787
28080
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
|
|
27788
28081
|
children: [
|
|
27789
|
-
/* @__PURE__ */
|
|
28082
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsx65(
|
|
27790
28083
|
Text,
|
|
27791
28084
|
{
|
|
27792
28085
|
as: "h3",
|
|
@@ -27795,8 +28088,8 @@ var Plan2 = ({
|
|
|
27795
28088
|
children: plan.name
|
|
27796
28089
|
}
|
|
27797
28090
|
) }),
|
|
27798
|
-
layout.plans.description.isVisible && /* @__PURE__ */
|
|
27799
|
-
/* @__PURE__ */
|
|
28091
|
+
layout.plans.description.isVisible && /* @__PURE__ */ jsx65(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx65(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
|
|
28092
|
+
/* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsxs50(
|
|
27800
28093
|
Text,
|
|
27801
28094
|
{
|
|
27802
28095
|
"data-testid": "sch-plan-price",
|
|
@@ -27812,14 +28105,14 @@ var Plan2 = ({
|
|
|
27812
28105
|
currency: planCurrency,
|
|
27813
28106
|
testSignificantDigits: false
|
|
27814
28107
|
}) : formatCurrency(planPrice ?? 0, planCurrency),
|
|
27815
|
-
!plan.custom && !isFreePlan && /* @__PURE__ */
|
|
28108
|
+
!plan.custom && !isFreePlan && /* @__PURE__ */ jsxs50("sub", { children: [
|
|
27816
28109
|
"/",
|
|
27817
28110
|
showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
|
|
27818
28111
|
] })
|
|
27819
28112
|
]
|
|
27820
28113
|
}
|
|
27821
28114
|
) }),
|
|
27822
|
-
showCredits && credits.length > 0 && /* @__PURE__ */
|
|
28115
|
+
showCredits && credits.length > 0 && /* @__PURE__ */ jsx65(
|
|
27823
28116
|
Flex,
|
|
27824
28117
|
{
|
|
27825
28118
|
as: "ul",
|
|
@@ -27831,8 +28124,8 @@ var Plan2 = ({
|
|
|
27831
28124
|
$margin: 0,
|
|
27832
28125
|
$listStyle: "none",
|
|
27833
28126
|
children: credits.map((credit, idx) => {
|
|
27834
|
-
return /* @__PURE__ */
|
|
27835
|
-
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */
|
|
28127
|
+
return /* @__PURE__ */ jsxs50(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
|
|
28128
|
+
layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx65(
|
|
27836
28129
|
Icon3,
|
|
27837
28130
|
{
|
|
27838
28131
|
"data-testid": "sch-feature-icon",
|
|
@@ -27842,13 +28135,13 @@ var Plan2 = ({
|
|
|
27842
28135
|
rounded: true
|
|
27843
28136
|
}
|
|
27844
28137
|
),
|
|
27845
|
-
credit.name && /* @__PURE__ */
|
|
28138
|
+
credit.name && /* @__PURE__ */ jsx65(
|
|
27846
28139
|
Flex,
|
|
27847
28140
|
{
|
|
27848
28141
|
$flexDirection: "column",
|
|
27849
28142
|
$justifyContent: "center",
|
|
27850
28143
|
$gap: "0.5rem",
|
|
27851
|
-
children: /* @__PURE__ */
|
|
28144
|
+
children: /* @__PURE__ */ jsx65(
|
|
27852
28145
|
PlanCreditText,
|
|
27853
28146
|
{
|
|
27854
28147
|
credit,
|
|
@@ -27861,7 +28154,7 @@ var Plan2 = ({
|
|
|
27861
28154
|
})
|
|
27862
28155
|
}
|
|
27863
28156
|
),
|
|
27864
|
-
isActivePlan && /* @__PURE__ */
|
|
28157
|
+
isActivePlan && /* @__PURE__ */ jsx65(
|
|
27865
28158
|
Flex,
|
|
27866
28159
|
{
|
|
27867
28160
|
"data-testid": "sch-plan-active",
|
|
@@ -27871,7 +28164,7 @@ var Plan2 = ({
|
|
|
27871
28164
|
$backgroundColor: settings.theme.primary,
|
|
27872
28165
|
$borderRadius: "9999px",
|
|
27873
28166
|
$padding: "0.125rem 0.85rem",
|
|
27874
|
-
children: /* @__PURE__ */
|
|
28167
|
+
children: /* @__PURE__ */ jsx65(
|
|
27875
28168
|
Text,
|
|
27876
28169
|
{
|
|
27877
28170
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -27884,7 +28177,7 @@ var Plan2 = ({
|
|
|
27884
28177
|
]
|
|
27885
28178
|
}
|
|
27886
28179
|
),
|
|
27887
|
-
/* @__PURE__ */
|
|
28180
|
+
/* @__PURE__ */ jsxs50(
|
|
27888
28181
|
Flex,
|
|
27889
28182
|
{
|
|
27890
28183
|
$flexDirection: "column",
|
|
@@ -27893,7 +28186,7 @@ var Plan2 = ({
|
|
|
27893
28186
|
$gap: `${cardPadding}rem`,
|
|
27894
28187
|
$padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
|
|
27895
28188
|
children: [
|
|
27896
|
-
layout.plans.showEntitlements && /* @__PURE__ */
|
|
28189
|
+
layout.plans.showEntitlements && /* @__PURE__ */ jsxs50(
|
|
27897
28190
|
Flex,
|
|
27898
28191
|
{
|
|
27899
28192
|
as: "ul",
|
|
@@ -27904,14 +28197,14 @@ var Plan2 = ({
|
|
|
27904
28197
|
$margin: 0,
|
|
27905
28198
|
$listStyle: "none",
|
|
27906
28199
|
children: [
|
|
27907
|
-
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */
|
|
28200
|
+
layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx65(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx65(Text, { children: t4("Everything in", {
|
|
27908
28201
|
plan: plans[index - 1].name
|
|
27909
28202
|
}) }) }),
|
|
27910
28203
|
(plan.entitlements ?? []).reduce(
|
|
27911
28204
|
(acc, entitlement, idx) => {
|
|
27912
28205
|
if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
|
|
27913
28206
|
acc.push(
|
|
27914
|
-
/* @__PURE__ */
|
|
28207
|
+
/* @__PURE__ */ jsx65(
|
|
27915
28208
|
Entitlement2,
|
|
27916
28209
|
{
|
|
27917
28210
|
entitlement,
|
|
@@ -27929,7 +28222,7 @@ var Plan2 = ({
|
|
|
27929
28222
|
},
|
|
27930
28223
|
[]
|
|
27931
28224
|
),
|
|
27932
|
-
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */
|
|
28225
|
+
(plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsx65(
|
|
27933
28226
|
ExpandListToggle,
|
|
27934
28227
|
{
|
|
27935
28228
|
as: "li",
|
|
@@ -27944,7 +28237,7 @@ var Plan2 = ({
|
|
|
27944
28237
|
]
|
|
27945
28238
|
}
|
|
27946
28239
|
),
|
|
27947
|
-
isActivePlan ? /* @__PURE__ */
|
|
28240
|
+
isActivePlan ? /* @__PURE__ */ jsxs50(
|
|
27948
28241
|
Flex,
|
|
27949
28242
|
{
|
|
27950
28243
|
$justifyContent: "center",
|
|
@@ -27952,7 +28245,7 @@ var Plan2 = ({
|
|
|
27952
28245
|
$gap: "0.25rem",
|
|
27953
28246
|
$padding: "0.625rem 0",
|
|
27954
28247
|
children: [
|
|
27955
|
-
/* @__PURE__ */
|
|
28248
|
+
/* @__PURE__ */ jsx65(
|
|
27956
28249
|
Icon3,
|
|
27957
28250
|
{
|
|
27958
28251
|
name: "check-rounded",
|
|
@@ -27960,11 +28253,11 @@ var Plan2 = ({
|
|
|
27960
28253
|
color: settings.theme.primary
|
|
27961
28254
|
}
|
|
27962
28255
|
),
|
|
27963
|
-
/* @__PURE__ */
|
|
28256
|
+
/* @__PURE__ */ jsx65(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
|
|
27964
28257
|
]
|
|
27965
28258
|
}
|
|
27966
|
-
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */
|
|
27967
|
-
/* @__PURE__ */
|
|
28259
|
+
) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs50(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
|
|
28260
|
+
/* @__PURE__ */ jsx65(
|
|
27968
28261
|
Button,
|
|
27969
28262
|
{
|
|
27970
28263
|
type: "button",
|
|
@@ -28002,10 +28295,10 @@ var Plan2 = ({
|
|
|
28002
28295
|
}
|
|
28003
28296
|
},
|
|
28004
28297
|
$fullWidth: true,
|
|
28005
|
-
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */
|
|
28298
|
+
children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ jsx65(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
|
|
28006
28299
|
}
|
|
28007
28300
|
),
|
|
28008
|
-
!plan.valid && /* @__PURE__ */
|
|
28301
|
+
!plan.valid && /* @__PURE__ */ jsx65(UsageViolationText, { violations: plan.usageViolations })
|
|
28009
28302
|
] })
|
|
28010
28303
|
]
|
|
28011
28304
|
}
|
|
@@ -28016,7 +28309,7 @@ var Plan2 = ({
|
|
|
28016
28309
|
};
|
|
28017
28310
|
|
|
28018
28311
|
// src/components/elements/pricing-table/PricingTable.tsx
|
|
28019
|
-
import { Fragment as Fragment30, jsx as
|
|
28312
|
+
import { Fragment as Fragment30, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
28020
28313
|
var resolveDesignProps8 = (props) => {
|
|
28021
28314
|
return {
|
|
28022
28315
|
showPeriodToggle: props.showPeriodToggle ?? true,
|
|
@@ -28081,11 +28374,11 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28081
28374
|
},
|
|
28082
28375
|
[]
|
|
28083
28376
|
);
|
|
28084
|
-
const [selectedPeriod, setSelectedPeriod] =
|
|
28377
|
+
const [selectedPeriod, setSelectedPeriod] = useState22(
|
|
28085
28378
|
() => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
|
|
28086
28379
|
);
|
|
28087
28380
|
const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
|
|
28088
|
-
const [selectedCurrency, setSelectedCurrency] =
|
|
28381
|
+
const [selectedCurrency, setSelectedCurrency] = useState22(
|
|
28089
28382
|
() => currencies[0] ?? DEFAULT_CURRENCY
|
|
28090
28383
|
);
|
|
28091
28384
|
if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
|
|
@@ -28103,25 +28396,25 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28103
28396
|
} = useAvailablePlans(selectedPeriod, {
|
|
28104
28397
|
useSelectedPeriod: showPeriodToggle
|
|
28105
28398
|
});
|
|
28106
|
-
const plans =
|
|
28399
|
+
const plans = useMemo35(
|
|
28107
28400
|
() => hasCurrency ? allPlans.filter(
|
|
28108
28401
|
(plan) => planSupportsCurrency(plan, selectedCurrency)
|
|
28109
28402
|
) : allPlans,
|
|
28110
28403
|
[allPlans, hasCurrency, selectedCurrency]
|
|
28111
28404
|
);
|
|
28112
|
-
const addOns =
|
|
28405
|
+
const addOns = useMemo35(
|
|
28113
28406
|
() => hasCurrency ? allAddOns.filter(
|
|
28114
28407
|
(addOn) => planSupportsCurrency(addOn, selectedCurrency)
|
|
28115
28408
|
) : allAddOns,
|
|
28116
28409
|
[allAddOns, hasCurrency, selectedCurrency]
|
|
28117
28410
|
);
|
|
28118
|
-
|
|
28411
|
+
useEffect9(() => {
|
|
28119
28412
|
if (typeof data?.component === "undefined") {
|
|
28120
28413
|
hydratePublic();
|
|
28121
28414
|
}
|
|
28122
28415
|
}, [data?.component, hydratePublic]);
|
|
28123
28416
|
if (isPending) {
|
|
28124
|
-
return /* @__PURE__ */
|
|
28417
|
+
return /* @__PURE__ */ jsx66(
|
|
28125
28418
|
Flex,
|
|
28126
28419
|
{
|
|
28127
28420
|
$width: "100%",
|
|
@@ -28129,12 +28422,12 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28129
28422
|
$alignItems: "center",
|
|
28130
28423
|
$justifyContent: "center",
|
|
28131
28424
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
28132
|
-
children: /* @__PURE__ */
|
|
28425
|
+
children: /* @__PURE__ */ jsx66(Loader, { "aria-label": "loading", $size: "2xl" })
|
|
28133
28426
|
}
|
|
28134
28427
|
);
|
|
28135
28428
|
}
|
|
28136
28429
|
if (hasNoUsableCurrency) {
|
|
28137
|
-
return /* @__PURE__ */
|
|
28430
|
+
return /* @__PURE__ */ jsx66(Container, { children: /* @__PURE__ */ jsx66(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ jsx66(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
|
|
28138
28431
|
}
|
|
28139
28432
|
const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
|
|
28140
28433
|
const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
|
|
@@ -28143,7 +28436,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28143
28436
|
rest.callToActionTarget
|
|
28144
28437
|
);
|
|
28145
28438
|
const Wrapper = typeof data?.component === "undefined" ? Container : Fragment29;
|
|
28146
|
-
return /* @__PURE__ */
|
|
28439
|
+
return /* @__PURE__ */ jsx66(Wrapper, { children: /* @__PURE__ */ jsxs51(
|
|
28147
28440
|
FussyChild,
|
|
28148
28441
|
{
|
|
28149
28442
|
ref,
|
|
@@ -28153,8 +28446,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28153
28446
|
$flexDirection: "column",
|
|
28154
28447
|
$gap: "2rem",
|
|
28155
28448
|
children: [
|
|
28156
|
-
/* @__PURE__ */
|
|
28157
|
-
/* @__PURE__ */
|
|
28449
|
+
/* @__PURE__ */ jsxs51(Box, { children: [
|
|
28450
|
+
/* @__PURE__ */ jsxs51(
|
|
28158
28451
|
Flex,
|
|
28159
28452
|
{
|
|
28160
28453
|
$flexDirection: "column",
|
|
@@ -28169,7 +28462,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28169
28462
|
}
|
|
28170
28463
|
},
|
|
28171
28464
|
children: [
|
|
28172
|
-
/* @__PURE__ */
|
|
28465
|
+
/* @__PURE__ */ jsx66(
|
|
28173
28466
|
Text,
|
|
28174
28467
|
{
|
|
28175
28468
|
as: "h2",
|
|
@@ -28178,8 +28471,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28178
28471
|
children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
|
|
28179
28472
|
}
|
|
28180
28473
|
),
|
|
28181
|
-
/* @__PURE__ */
|
|
28182
|
-
showCurrencySelector && /* @__PURE__ */
|
|
28474
|
+
/* @__PURE__ */ jsxs51(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
|
|
28475
|
+
showCurrencySelector && /* @__PURE__ */ jsx66(
|
|
28183
28476
|
CurrencyToggle,
|
|
28184
28477
|
{
|
|
28185
28478
|
currencies,
|
|
@@ -28187,7 +28480,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28187
28480
|
onSelect: setSelectedCurrency
|
|
28188
28481
|
}
|
|
28189
28482
|
),
|
|
28190
|
-
showPeriodToggle && periods.length > 1 && /* @__PURE__ */
|
|
28483
|
+
showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx66(
|
|
28191
28484
|
PeriodToggle,
|
|
28192
28485
|
{
|
|
28193
28486
|
options: periods,
|
|
@@ -28204,7 +28497,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28204
28497
|
]
|
|
28205
28498
|
}
|
|
28206
28499
|
),
|
|
28207
|
-
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */
|
|
28500
|
+
props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx66(
|
|
28208
28501
|
Box,
|
|
28209
28502
|
{
|
|
28210
28503
|
as: "ul",
|
|
@@ -28217,7 +28510,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28217
28510
|
$listStyle: "none",
|
|
28218
28511
|
children: plans.map((plan, index, self2) => {
|
|
28219
28512
|
const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28220
|
-
return /* @__PURE__ */
|
|
28513
|
+
return /* @__PURE__ */ jsx66(
|
|
28221
28514
|
Plan2,
|
|
28222
28515
|
{
|
|
28223
28516
|
plan,
|
|
@@ -28239,14 +28532,14 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28239
28532
|
}
|
|
28240
28533
|
)
|
|
28241
28534
|
] }),
|
|
28242
|
-
/* @__PURE__ */
|
|
28243
|
-
props.header.isVisible && /* @__PURE__ */
|
|
28535
|
+
/* @__PURE__ */ jsx66(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs51(Fragment30, { children: [
|
|
28536
|
+
props.header.isVisible && /* @__PURE__ */ jsx66(
|
|
28244
28537
|
Flex,
|
|
28245
28538
|
{
|
|
28246
28539
|
$justifyContent: "space-between",
|
|
28247
28540
|
$alignItems: "center",
|
|
28248
28541
|
$marginBottom: "1rem",
|
|
28249
|
-
children: /* @__PURE__ */
|
|
28542
|
+
children: /* @__PURE__ */ jsx66(
|
|
28250
28543
|
Text,
|
|
28251
28544
|
{
|
|
28252
28545
|
as: "h2",
|
|
@@ -28257,7 +28550,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28257
28550
|
)
|
|
28258
28551
|
}
|
|
28259
28552
|
),
|
|
28260
|
-
/* @__PURE__ */
|
|
28553
|
+
/* @__PURE__ */ jsx66(
|
|
28261
28554
|
Box,
|
|
28262
28555
|
{
|
|
28263
28556
|
as: "ul",
|
|
@@ -28269,7 +28562,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
|
|
|
28269
28562
|
$listStyle: "none",
|
|
28270
28563
|
children: addOns.map((addOn, index) => {
|
|
28271
28564
|
const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
|
|
28272
|
-
return /* @__PURE__ */
|
|
28565
|
+
return /* @__PURE__ */ jsx66(
|
|
28273
28566
|
AddOn2,
|
|
28274
28567
|
{
|
|
28275
28568
|
addOn,
|
|
@@ -28297,7 +28590,7 @@ PricingTable.displayName = "PricingTable";
|
|
|
28297
28590
|
|
|
28298
28591
|
// src/components/elements/text/Text.tsx
|
|
28299
28592
|
import { forwardRef as forwardRef16 } from "react";
|
|
28300
|
-
import { jsx as
|
|
28593
|
+
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
28301
28594
|
var resolveDesignProps9 = (props) => {
|
|
28302
28595
|
return {
|
|
28303
28596
|
text: {
|
|
@@ -28309,7 +28602,7 @@ var resolveDesignProps9 = (props) => {
|
|
|
28309
28602
|
};
|
|
28310
28603
|
var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
28311
28604
|
const props = resolveDesignProps9(rest);
|
|
28312
|
-
return /* @__PURE__ */
|
|
28605
|
+
return /* @__PURE__ */ jsx67(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx67(
|
|
28313
28606
|
Text,
|
|
28314
28607
|
{
|
|
28315
28608
|
display: props.text.fontStyle,
|
|
@@ -28322,8 +28615,8 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
|
|
|
28322
28615
|
TextElement.displayName = "Text";
|
|
28323
28616
|
|
|
28324
28617
|
// src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
|
|
28325
|
-
import { forwardRef as forwardRef17, useMemo as
|
|
28326
|
-
import { jsx as
|
|
28618
|
+
import { forwardRef as forwardRef17, useMemo as useMemo36 } from "react";
|
|
28619
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
28327
28620
|
var buttonStyles = {
|
|
28328
28621
|
primary: {
|
|
28329
28622
|
color: "primary",
|
|
@@ -28353,13 +28646,13 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28353
28646
|
const props = resolveDesignProps10(rest);
|
|
28354
28647
|
const { t: t4 } = useTranslation();
|
|
28355
28648
|
const { data, setLayout } = useEmbed();
|
|
28356
|
-
const hasActiveSubscription =
|
|
28649
|
+
const hasActiveSubscription = useMemo36(() => {
|
|
28357
28650
|
return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
|
|
28358
28651
|
}, [data?.subscription]);
|
|
28359
28652
|
if (!hasActiveSubscription) {
|
|
28360
28653
|
return null;
|
|
28361
28654
|
}
|
|
28362
|
-
return /* @__PURE__ */
|
|
28655
|
+
return /* @__PURE__ */ jsx68(
|
|
28363
28656
|
Element,
|
|
28364
28657
|
{
|
|
28365
28658
|
as: Flex,
|
|
@@ -28367,7 +28660,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28367
28660
|
className,
|
|
28368
28661
|
$flexDirection: "column",
|
|
28369
28662
|
$gap: "2rem",
|
|
28370
|
-
children: /* @__PURE__ */
|
|
28663
|
+
children: /* @__PURE__ */ jsx68(
|
|
28371
28664
|
Button,
|
|
28372
28665
|
{
|
|
28373
28666
|
type: "button",
|
|
@@ -28388,8 +28681,8 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
|
|
|
28388
28681
|
UnsubscribeButton.displayName = "UnsubscribeButton";
|
|
28389
28682
|
|
|
28390
28683
|
// src/components/elements/upcoming-bill/UpcomingBill.tsx
|
|
28391
|
-
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as
|
|
28392
|
-
import { jsx as
|
|
28684
|
+
import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo37, useState as useState23 } from "react";
|
|
28685
|
+
import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
28393
28686
|
function resolveDesignProps11(props) {
|
|
28394
28687
|
return {
|
|
28395
28688
|
header: {
|
|
@@ -28413,10 +28706,10 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28413
28706
|
const { t: t4 } = useTranslation();
|
|
28414
28707
|
const { data, settings, getUpcomingInvoice } = useEmbed();
|
|
28415
28708
|
const isLightBackground = useIsLightBackground();
|
|
28416
|
-
const [isLoading, setIsLoading] =
|
|
28417
|
-
const [error, setError] =
|
|
28418
|
-
const [upcomingInvoice, setUpcomingInvoice] =
|
|
28419
|
-
const discounts =
|
|
28709
|
+
const [isLoading, setIsLoading] = useState23(false);
|
|
28710
|
+
const [error, setError] = useState23();
|
|
28711
|
+
const [upcomingInvoice, setUpcomingInvoice] = useState23(data?.upcomingInvoice);
|
|
28712
|
+
const discounts = useMemo37(() => {
|
|
28420
28713
|
return (data?.subscription?.discounts || []).filter(
|
|
28421
28714
|
(discount) => (
|
|
28422
28715
|
// Only surface discounts that are currently active and actually
|
|
@@ -28450,15 +28743,15 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28450
28743
|
}
|
|
28451
28744
|
}
|
|
28452
28745
|
}, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
|
|
28453
|
-
|
|
28746
|
+
useEffect10(() => {
|
|
28454
28747
|
getInvoice();
|
|
28455
28748
|
}, [getInvoice]);
|
|
28456
|
-
|
|
28749
|
+
useEffect10(() => {
|
|
28457
28750
|
if (data?.upcomingInvoice) {
|
|
28458
28751
|
setUpcomingInvoice(data.upcomingInvoice);
|
|
28459
28752
|
}
|
|
28460
28753
|
}, [data?.upcomingInvoice]);
|
|
28461
|
-
const { currency, applied, remaining } =
|
|
28754
|
+
const { currency, applied, remaining } = useMemo37(() => {
|
|
28462
28755
|
const currency2 = upcomingInvoice?.currency;
|
|
28463
28756
|
const startingBalance = upcomingInvoice?.startingBalance ?? 0;
|
|
28464
28757
|
const endingBalance = upcomingInvoice?.endingBalance ?? 0;
|
|
@@ -28477,9 +28770,9 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28477
28770
|
if (!data?.subscription || data.subscription.cancelAt) {
|
|
28478
28771
|
return null;
|
|
28479
28772
|
}
|
|
28480
|
-
return /* @__PURE__ */
|
|
28481
|
-
/* @__PURE__ */
|
|
28482
|
-
error ? /* @__PURE__ */
|
|
28773
|
+
return /* @__PURE__ */ jsxs52(Element, { ref, className, children: [
|
|
28774
|
+
/* @__PURE__ */ jsx69(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx69(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
|
|
28775
|
+
error ? /* @__PURE__ */ jsxs52(
|
|
28483
28776
|
Flex,
|
|
28484
28777
|
{
|
|
28485
28778
|
as: TransitionBox,
|
|
@@ -28488,8 +28781,8 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28488
28781
|
$alignItems: "center",
|
|
28489
28782
|
$gap: "1rem",
|
|
28490
28783
|
children: [
|
|
28491
|
-
/* @__PURE__ */
|
|
28492
|
-
/* @__PURE__ */
|
|
28784
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
|
|
28785
|
+
/* @__PURE__ */ jsx69(
|
|
28493
28786
|
Button,
|
|
28494
28787
|
{
|
|
28495
28788
|
type: "button",
|
|
@@ -28502,28 +28795,28 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28502
28795
|
)
|
|
28503
28796
|
]
|
|
28504
28797
|
}
|
|
28505
|
-
) : !isLoading && /* @__PURE__ */
|
|
28506
|
-
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */
|
|
28798
|
+
) : !isLoading && /* @__PURE__ */ jsx69(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
|
|
28799
|
+
props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
|
|
28507
28800
|
props.header.prefix,
|
|
28508
28801
|
" ",
|
|
28509
28802
|
toPrettyDate(upcomingInvoice.dueDate)
|
|
28510
28803
|
] }),
|
|
28511
|
-
/* @__PURE__ */
|
|
28804
|
+
/* @__PURE__ */ jsxs52(
|
|
28512
28805
|
Flex,
|
|
28513
28806
|
{
|
|
28514
28807
|
$justifyContent: "space-between",
|
|
28515
28808
|
$alignItems: "start",
|
|
28516
28809
|
$gap: "1rem",
|
|
28517
28810
|
children: [
|
|
28518
|
-
props.price.isVisible && /* @__PURE__ */
|
|
28811
|
+
props.price.isVisible && /* @__PURE__ */ jsx69(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
|
|
28519
28812
|
upcomingInvoice.amountDue,
|
|
28520
28813
|
upcomingInvoice.currency
|
|
28521
28814
|
) }),
|
|
28522
|
-
/* @__PURE__ */
|
|
28815
|
+
/* @__PURE__ */ jsx69(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx69(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
|
|
28523
28816
|
]
|
|
28524
28817
|
}
|
|
28525
28818
|
),
|
|
28526
|
-
hasApplied && /* @__PURE__ */
|
|
28819
|
+
hasApplied && /* @__PURE__ */ jsxs52(
|
|
28527
28820
|
Flex,
|
|
28528
28821
|
{
|
|
28529
28822
|
as: TransitionBox,
|
|
@@ -28531,12 +28824,12 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28531
28824
|
$alignItems: "start",
|
|
28532
28825
|
$gap: "1rem",
|
|
28533
28826
|
children: [
|
|
28534
|
-
/* @__PURE__ */
|
|
28535
|
-
/* @__PURE__ */
|
|
28827
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
|
|
28828
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(-applied, currency) })
|
|
28536
28829
|
]
|
|
28537
28830
|
}
|
|
28538
28831
|
),
|
|
28539
|
-
hasBalance && /* @__PURE__ */
|
|
28832
|
+
hasBalance && /* @__PURE__ */ jsxs52(
|
|
28540
28833
|
Flex,
|
|
28541
28834
|
{
|
|
28542
28835
|
as: TransitionBox,
|
|
@@ -28544,20 +28837,20 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28544
28837
|
$alignItems: "start",
|
|
28545
28838
|
$gap: "1rem",
|
|
28546
28839
|
children: [
|
|
28547
|
-
/* @__PURE__ */
|
|
28548
|
-
/* @__PURE__ */
|
|
28840
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
|
|
28841
|
+
/* @__PURE__ */ jsx69(Text, { children: formatCurrency(remaining, currency) })
|
|
28549
28842
|
]
|
|
28550
28843
|
}
|
|
28551
28844
|
),
|
|
28552
|
-
discounts.length > 0 && /* @__PURE__ */
|
|
28845
|
+
discounts.length > 0 && /* @__PURE__ */ jsxs52(
|
|
28553
28846
|
Flex,
|
|
28554
28847
|
{
|
|
28555
28848
|
$justifyContent: "space-between",
|
|
28556
28849
|
$alignItems: "start",
|
|
28557
28850
|
$gap: "1rem",
|
|
28558
28851
|
children: [
|
|
28559
|
-
/* @__PURE__ */
|
|
28560
|
-
/* @__PURE__ */
|
|
28852
|
+
/* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Discount") }),
|
|
28853
|
+
/* @__PURE__ */ jsx69(
|
|
28561
28854
|
Flex,
|
|
28562
28855
|
{
|
|
28563
28856
|
$flexDirection: "column",
|
|
@@ -28573,13 +28866,13 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28573
28866
|
discount?.currency
|
|
28574
28867
|
)
|
|
28575
28868
|
});
|
|
28576
|
-
return /* @__PURE__ */
|
|
28869
|
+
return /* @__PURE__ */ jsxs52(
|
|
28577
28870
|
Flex,
|
|
28578
28871
|
{
|
|
28579
28872
|
$alignItems: "center",
|
|
28580
28873
|
$gap: "0.5rem",
|
|
28581
28874
|
children: [
|
|
28582
|
-
discount.customerFacingCode && /* @__PURE__ */
|
|
28875
|
+
discount.customerFacingCode && /* @__PURE__ */ jsx69(
|
|
28583
28876
|
Flex,
|
|
28584
28877
|
{
|
|
28585
28878
|
$alignItems: "center",
|
|
@@ -28588,7 +28881,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28588
28881
|
$borderStyle: "solid",
|
|
28589
28882
|
$borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
|
|
28590
28883
|
$borderRadius: "0.3125rem",
|
|
28591
|
-
children: /* @__PURE__ */
|
|
28884
|
+
children: /* @__PURE__ */ jsx69(
|
|
28592
28885
|
Text,
|
|
28593
28886
|
{
|
|
28594
28887
|
$size: 0.75 * settings.theme.typography.text.fontSize,
|
|
@@ -28598,7 +28891,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28598
28891
|
)
|
|
28599
28892
|
}
|
|
28600
28893
|
),
|
|
28601
|
-
/* @__PURE__ */
|
|
28894
|
+
/* @__PURE__ */ jsx69(Box, { children: /* @__PURE__ */ jsx69(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
|
|
28602
28895
|
discount: label,
|
|
28603
28896
|
count: discount.durationInMonths
|
|
28604
28897
|
}) : label }) })
|
|
@@ -28612,7 +28905,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
|
|
|
28612
28905
|
]
|
|
28613
28906
|
}
|
|
28614
28907
|
)
|
|
28615
|
-
] }) : /* @__PURE__ */
|
|
28908
|
+
] }) : /* @__PURE__ */ jsx69(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
|
|
28616
28909
|
] });
|
|
28617
28910
|
});
|
|
28618
28911
|
UpcomingBill.displayName = "UpcomingBill";
|
|
@@ -31248,7 +31541,7 @@ function inflate(input, options = {}) {
|
|
|
31248
31541
|
}
|
|
31249
31542
|
|
|
31250
31543
|
// src/components/embed/Embed.tsx
|
|
31251
|
-
import { useContext as useContext6, useEffect as
|
|
31544
|
+
import { useContext as useContext6, useEffect as useEffect11, useMemo as useMemo38 } from "react";
|
|
31252
31545
|
|
|
31253
31546
|
// src/components/embed/renderer.ts
|
|
31254
31547
|
import { createElement as createElement5 } from "react";
|
|
@@ -31328,11 +31621,11 @@ function createRenderer(options) {
|
|
|
31328
31621
|
}
|
|
31329
31622
|
|
|
31330
31623
|
// src/components/embed/Embed.tsx
|
|
31331
|
-
import { jsx as
|
|
31624
|
+
import { jsx as jsx70, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
31332
31625
|
var renderer = createRenderer();
|
|
31333
31626
|
var Loading = () => {
|
|
31334
31627
|
const { settings } = useEmbed();
|
|
31335
|
-
return /* @__PURE__ */
|
|
31628
|
+
return /* @__PURE__ */ jsx70(
|
|
31336
31629
|
Flex,
|
|
31337
31630
|
{
|
|
31338
31631
|
$width: "100%",
|
|
@@ -31340,13 +31633,13 @@ var Loading = () => {
|
|
|
31340
31633
|
$alignItems: "center",
|
|
31341
31634
|
$justifyContent: "center",
|
|
31342
31635
|
$padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
|
|
31343
|
-
children: /* @__PURE__ */
|
|
31636
|
+
children: /* @__PURE__ */ jsx70(Loader, { $color: settings.theme.primary, $size: "2xl" })
|
|
31344
31637
|
}
|
|
31345
31638
|
);
|
|
31346
31639
|
};
|
|
31347
31640
|
var Error2 = ({ message }) => {
|
|
31348
31641
|
const { settings } = useEmbed();
|
|
31349
|
-
return /* @__PURE__ */
|
|
31642
|
+
return /* @__PURE__ */ jsxs53(
|
|
31350
31643
|
Flex,
|
|
31351
31644
|
{
|
|
31352
31645
|
$flexDirection: "column",
|
|
@@ -31357,8 +31650,8 @@ var Error2 = ({ message }) => {
|
|
|
31357
31650
|
$alignItems: "center",
|
|
31358
31651
|
$justifyContent: "center",
|
|
31359
31652
|
children: [
|
|
31360
|
-
/* @__PURE__ */
|
|
31361
|
-
/* @__PURE__ */
|
|
31653
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { display: "heading1", children: "Error" }) }),
|
|
31654
|
+
/* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { children: message }) })
|
|
31362
31655
|
]
|
|
31363
31656
|
}
|
|
31364
31657
|
);
|
|
@@ -31376,7 +31669,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31376
31669
|
setBuilderSettings
|
|
31377
31670
|
} = useEmbed();
|
|
31378
31671
|
const compressedAst = data?.component?.ast;
|
|
31379
|
-
const { children, parsedSettings, parseError } =
|
|
31672
|
+
const { children, parsedSettings, parseError } = useMemo38(() => {
|
|
31380
31673
|
let children2 = null;
|
|
31381
31674
|
let parsedSettings2 = null;
|
|
31382
31675
|
let parseError2 = null;
|
|
@@ -31408,22 +31701,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31408
31701
|
parseError: parseError2
|
|
31409
31702
|
};
|
|
31410
31703
|
}, [compressedAst]);
|
|
31411
|
-
|
|
31704
|
+
useEffect11(() => {
|
|
31412
31705
|
if (accessToken) {
|
|
31413
31706
|
setAccessToken(accessToken);
|
|
31414
31707
|
}
|
|
31415
31708
|
}, [accessToken, setAccessToken]);
|
|
31416
|
-
|
|
31709
|
+
useEffect11(() => {
|
|
31417
31710
|
if (id && stale) {
|
|
31418
31711
|
hydrateComponent(id);
|
|
31419
31712
|
}
|
|
31420
31713
|
}, [id, hydrateComponent, stale]);
|
|
31421
|
-
|
|
31714
|
+
useEffect11(() => {
|
|
31422
31715
|
if (parsedSettings) {
|
|
31423
31716
|
setBuilderSettings(parsedSettings);
|
|
31424
31717
|
}
|
|
31425
31718
|
}, [parsedSettings, setBuilderSettings]);
|
|
31426
|
-
|
|
31719
|
+
useEffect11(() => {
|
|
31427
31720
|
if (parseError) {
|
|
31428
31721
|
setError(parseError);
|
|
31429
31722
|
}
|
|
@@ -31432,13 +31725,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31432
31725
|
return stub();
|
|
31433
31726
|
}
|
|
31434
31727
|
if (error) {
|
|
31435
|
-
return /* @__PURE__ */
|
|
31728
|
+
return /* @__PURE__ */ jsx70(Error2, { message: error.message });
|
|
31436
31729
|
}
|
|
31437
31730
|
if (accessToken?.length === 0) {
|
|
31438
|
-
return /* @__PURE__ */
|
|
31731
|
+
return /* @__PURE__ */ jsx70(Error2, { message: "Please provide an access token." });
|
|
31439
31732
|
}
|
|
31440
31733
|
if (!accessToken?.startsWith("token_")) {
|
|
31441
|
-
return /* @__PURE__ */
|
|
31734
|
+
return /* @__PURE__ */ jsx70(
|
|
31442
31735
|
Error2,
|
|
31443
31736
|
{
|
|
31444
31737
|
message: 'Invalid access token; your temporary access token will start with "token_".'
|
|
@@ -31446,9 +31739,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
|
|
|
31446
31739
|
);
|
|
31447
31740
|
}
|
|
31448
31741
|
if (isPending) {
|
|
31449
|
-
return /* @__PURE__ */
|
|
31742
|
+
return /* @__PURE__ */ jsx70(Loading, {});
|
|
31450
31743
|
}
|
|
31451
|
-
return /* @__PURE__ */
|
|
31744
|
+
return /* @__PURE__ */ jsx70(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ jsx70(Loading, {}) });
|
|
31452
31745
|
};
|
|
31453
31746
|
export {
|
|
31454
31747
|
AddOns,
|