@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.
@@ -1723,7 +1723,7 @@ var require_debounce = __commonJS({
1723
1723
  var FUNC_ERROR_TEXT = "Expected a function";
1724
1724
  var nativeMax = Math.max;
1725
1725
  var nativeMin = Math.min;
1726
- function debounce5(func, wait, options) {
1726
+ function debounce6(func, wait, options) {
1727
1727
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1728
1728
  if (typeof func != "function") {
1729
1729
  throw new TypeError(FUNC_ERROR_TEXT);
@@ -1804,7 +1804,7 @@ var require_debounce = __commonJS({
1804
1804
  debounced.flush = flush;
1805
1805
  return debounced;
1806
1806
  }
1807
- module2.exports = debounce5;
1807
+ module2.exports = debounce6;
1808
1808
  }
1809
1809
  });
1810
1810
 
@@ -2051,6 +2051,8 @@ var initialContext = {
2051
2051
  getUpcomingInvoice: stub,
2052
2052
  getCustomerBalance: stub,
2053
2053
  listInvoices: stub,
2054
+ getCreditUsageByUser: stub,
2055
+ getFeatureUsageByUser: stub,
2054
2056
  createSetupIntent: stub,
2055
2057
  updatePaymentMethod: stub,
2056
2058
  deletePaymentMethod: stub,
@@ -5342,6 +5344,18 @@ var en_default = {
5342
5344
  "month, billed yearly": "month, billed yearly",
5343
5345
  "month, billed quarterly": "month, billed quarterly",
5344
5346
  purchased: "purchased {{date}}",
5347
+ "Usage by user": "Usage by user",
5348
+ "X used by your team this period": "{{amount}} used by your team this period",
5349
+ "Show all X users_one": "Show all {{count}} user",
5350
+ "Show all X users_other": "Show all {{count}} users",
5351
+ "Show top X users_one": "Show top {{count}} user",
5352
+ "Show top X users_other": "Show top {{count}} users",
5353
+ "Show all": "Show all",
5354
+ "Show fewer": "Show fewer",
5355
+ Unattributed: "Unattributed",
5356
+ "There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
5357
+ "plus X more_one": "plus {{count}} more",
5358
+ "plus X more_other": "plus {{count}} more",
5345
5359
  usage: {
5346
5360
  limited: "{{amount}} of {{allocation}} used",
5347
5361
  unlimited: "{{amount}} used"
@@ -6947,7 +6961,7 @@ var Icon = ({ name, className = "", ...rest }) => {
6947
6961
  };
6948
6962
 
6949
6963
  // src/context/EmbedProvider.tsx
6950
- var import_debounce = __toESM(require_debounce());
6964
+ var import_debounce2 = __toESM(require_debounce());
6951
6965
  var import_merge3 = __toESM(require_merge());
6952
6966
  var import_react15 = require("react");
6953
6967
 
@@ -13216,6 +13230,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
13216
13230
  }
13217
13231
  return cost;
13218
13232
  }
13233
+ function calculateQuantityCost(billingPrice, quantity) {
13234
+ if (!billingPrice) {
13235
+ return 0;
13236
+ }
13237
+ if (isTieredPrice(billingPrice)) {
13238
+ return calculateTieredCost(
13239
+ quantity,
13240
+ billingPrice.priceTier,
13241
+ billingPrice.tiersMode
13242
+ );
13243
+ }
13244
+ return quantity * billingPrice.price;
13245
+ }
13219
13246
  function getEntitlementCost(entitlement, period = "month", currency) {
13220
13247
  const resolvedPeriod = period ?? "month";
13221
13248
  const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
@@ -14280,6 +14307,20 @@ function modifyDate(date, days) {
14280
14307
  return copy3;
14281
14308
  }
14282
14309
 
14310
+ // src/utils/debounce.ts
14311
+ var import_debounce = __toESM(require_debounce());
14312
+ function debounceByKey(fn, wait, settings) {
14313
+ const debouncedByKey = /* @__PURE__ */ new Map();
14314
+ return (key, ...args) => {
14315
+ let debounced = debouncedByKey.get(key);
14316
+ if (!debounced) {
14317
+ debounced = (0, import_debounce.default)(fn, wait, settings);
14318
+ debouncedByKey.set(key, debounced);
14319
+ }
14320
+ return debounced(key, ...args);
14321
+ };
14322
+ }
14323
+
14283
14324
  // src/utils/string.ts
14284
14325
  var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
14285
14326
  "BIF",
@@ -15283,7 +15324,7 @@ var reducer = (state, action) => {
15283
15324
  // src/context/EmbedProvider.tsx
15284
15325
  var import_jsx_runtime3 = require("react/jsx-runtime");
15285
15326
  var getCustomHeaders = (sessionId) => ({
15286
- "X-Schematic-Components-Version": "2.25.1",
15327
+ "X-Schematic-Components-Version": "2.25.2",
15287
15328
  "X-Schematic-Session-ID": sessionId
15288
15329
  });
15289
15330
  var normalizeCurrencyFilter = (filter2) => {
@@ -15394,7 +15435,7 @@ var EmbedProvider = ({
15394
15435
  }
15395
15436
  }, [publicApi]);
15396
15437
  const debouncedHydratePublic = (0, import_react15.useMemo)(
15397
- () => (0, import_debounce.default)(
15438
+ () => (0, import_debounce2.default)(
15398
15439
  hydratePublic,
15399
15440
  FETCH_DEBOUNCE_TIMEOUT,
15400
15441
  LEADING_DEBOUNCE_SETTINGS
@@ -15420,7 +15461,7 @@ var EmbedProvider = ({
15420
15461
  }
15421
15462
  }, [checkoutApi]);
15422
15463
  const debouncedHydrate = (0, import_react15.useMemo)(
15423
- () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15464
+ () => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15424
15465
  [hydrate]
15425
15466
  );
15426
15467
  const hydrateComponent = (0, import_react15.useCallback)(
@@ -15447,7 +15488,7 @@ var EmbedProvider = ({
15447
15488
  [checkoutApi]
15448
15489
  );
15449
15490
  const debouncedHydrateComponent = (0, import_react15.useMemo)(
15450
- () => (0, import_debounce.default)(
15491
+ () => (0, import_debounce2.default)(
15451
15492
  hydrateComponent,
15452
15493
  FETCH_DEBOUNCE_TIMEOUT,
15453
15494
  LEADING_DEBOUNCE_SETTINGS
@@ -15471,7 +15512,7 @@ var EmbedProvider = ({
15471
15512
  }
15472
15513
  }, []);
15473
15514
  const debouncedHydrateExternal = (0, import_react15.useMemo)(
15474
- () => (0, import_debounce.default)(
15515
+ () => (0, import_debounce2.default)(
15475
15516
  hydrateExternal,
15476
15517
  FETCH_DEBOUNCE_TIMEOUT,
15477
15518
  LEADING_DEBOUNCE_SETTINGS
@@ -15482,7 +15523,7 @@ var EmbedProvider = ({
15482
15523
  return checkoutApi?.createSetupIntent();
15483
15524
  }, [checkoutApi]);
15484
15525
  const debouncedCreateSetupIntent = (0, import_react15.useMemo)(
15485
- () => (0, import_debounce.default)(
15526
+ () => (0, import_debounce2.default)(
15486
15527
  createSetupIntent,
15487
15528
  FETCH_DEBOUNCE_TIMEOUT,
15488
15529
  LEADING_DEBOUNCE_SETTINGS
@@ -15505,7 +15546,7 @@ var EmbedProvider = ({
15505
15546
  [checkoutApi]
15506
15547
  );
15507
15548
  const debouncedUpdatePaymentMethod = (0, import_react15.useMemo)(
15508
- () => (0, import_debounce.default)(
15549
+ () => (0, import_debounce2.default)(
15509
15550
  updatePaymentMethod,
15510
15551
  FETCH_DEBOUNCE_TIMEOUT,
15511
15552
  LEADING_DEBOUNCE_SETTINGS
@@ -15528,7 +15569,7 @@ var EmbedProvider = ({
15528
15569
  [checkoutApi]
15529
15570
  );
15530
15571
  const debouncedDeletePaymentMethod = (0, import_react15.useMemo)(
15531
- () => (0, import_debounce.default)(
15572
+ () => (0, import_debounce2.default)(
15532
15573
  deletePaymentMethod,
15533
15574
  FETCH_DEBOUNCE_TIMEOUT,
15534
15575
  LEADING_DEBOUNCE_SETTINGS
@@ -15551,7 +15592,7 @@ var EmbedProvider = ({
15551
15592
  [checkoutApi]
15552
15593
  );
15553
15594
  const debouncedCheckout = (0, import_react15.useMemo)(
15554
- () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15595
+ () => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15555
15596
  [checkout]
15556
15597
  );
15557
15598
  const previewCheckout = (0, import_react15.useCallback)(
@@ -15571,7 +15612,7 @@ var EmbedProvider = ({
15571
15612
  return response;
15572
15613
  }, [checkoutApi]);
15573
15614
  const debouncedUnsubscribe = (0, import_react15.useMemo)(
15574
- () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15615
+ () => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15575
15616
  [unsubscribe]
15576
15617
  );
15577
15618
  const updateCustomFieldValues = (0, import_react15.useCallback)(
@@ -15615,7 +15656,7 @@ var EmbedProvider = ({
15615
15656
  [checkoutApi]
15616
15657
  );
15617
15658
  const debouncedGetUpcomingInvoice = (0, import_react15.useMemo)(
15618
- () => (0, import_debounce.default)(
15659
+ () => (0, import_debounce2.default)(
15619
15660
  getUpcomingInvoice,
15620
15661
  FETCH_DEBOUNCE_TIMEOUT,
15621
15662
  LEADING_DEBOUNCE_SETTINGS
@@ -15626,7 +15667,7 @@ var EmbedProvider = ({
15626
15667
  return checkoutApi?.fetchCustomerBalance();
15627
15668
  }, [checkoutApi]);
15628
15669
  const debouncedGetCustomerBalance = (0, import_react15.useMemo)(
15629
- () => (0, import_debounce.default)(
15670
+ () => (0, import_debounce2.default)(
15630
15671
  getCustomerBalance,
15631
15672
  FETCH_DEBOUNCE_TIMEOUT,
15632
15673
  LEADING_DEBOUNCE_SETTINGS
@@ -15637,9 +15678,37 @@ var EmbedProvider = ({
15637
15678
  return checkoutApi?.listInvoices();
15638
15679
  }, [checkoutApi]);
15639
15680
  const debouncedListInvoices = (0, import_react15.useMemo)(
15640
- () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15681
+ () => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15641
15682
  [listInvoices]
15642
15683
  );
15684
+ const getCreditUsageByUser = (0, import_react15.useCallback)(
15685
+ async (billingCreditId, limit) => {
15686
+ return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
15687
+ },
15688
+ [checkoutApi]
15689
+ );
15690
+ const debouncedGetCreditUsageByUser = (0, import_react15.useMemo)(
15691
+ () => debounceByKey(
15692
+ getCreditUsageByUser,
15693
+ FETCH_DEBOUNCE_TIMEOUT,
15694
+ LEADING_DEBOUNCE_SETTINGS
15695
+ ),
15696
+ [getCreditUsageByUser]
15697
+ );
15698
+ const getFeatureUsageByUser = (0, import_react15.useCallback)(
15699
+ async (featureId, limit) => {
15700
+ return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
15701
+ },
15702
+ [checkoutApi]
15703
+ );
15704
+ const debouncedGetFeatureUsageByUser = (0, import_react15.useMemo)(
15705
+ () => debounceByKey(
15706
+ getFeatureUsageByUser,
15707
+ FETCH_DEBOUNCE_TIMEOUT,
15708
+ LEADING_DEBOUNCE_SETTINGS
15709
+ ),
15710
+ [getFeatureUsageByUser]
15711
+ );
15643
15712
  const setError = (0, import_react15.useCallback)(
15644
15713
  (error) => {
15645
15714
  debug(error.message);
@@ -15805,6 +15874,8 @@ var EmbedProvider = ({
15805
15874
  getUpcomingInvoice: debouncedGetUpcomingInvoice,
15806
15875
  getCustomerBalance: debouncedGetCustomerBalance,
15807
15876
  listInvoices: debouncedListInvoices,
15877
+ getCreditUsageByUser: debouncedGetCreditUsageByUser,
15878
+ getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
15808
15879
  finishCheckout,
15809
15880
  setError,
15810
15881
  setAccessToken,
@@ -17197,7 +17268,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
17197
17268
  `;
17198
17269
 
17199
17270
  // src/components/ui/tooltip/Tooltip.tsx
17200
- var import_debounce2 = __toESM(require_debounce());
17271
+ var import_debounce3 = __toESM(require_debounce());
17201
17272
  var import_react29 = require("react");
17202
17273
  var import_react_dom = require("react-dom");
17203
17274
 
@@ -17381,7 +17452,7 @@ var Tooltip = ({
17381
17452
  }, [portal, position2]);
17382
17453
  (0, import_react29.useLayoutEffect)(() => {
17383
17454
  updateCoords();
17384
- const handleResize = (0, import_debounce2.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17455
+ const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17385
17456
  window.addEventListener("resize", handleResize);
17386
17457
  window.addEventListener("scroll", handleResize, true);
17387
17458
  return () => {
@@ -17538,7 +17609,7 @@ var Root = (0, import_react32.forwardRef)(
17538
17609
  Root.displayName = "Root";
17539
17610
 
17540
17611
  // src/components/layout/viewport/Viewport.tsx
17541
- var import_debounce4 = __toESM(require_debounce());
17612
+ var import_debounce5 = __toESM(require_debounce());
17542
17613
  var import_react50 = require("react");
17543
17614
  var import_react_dom3 = require("react-dom");
17544
17615
 
@@ -18486,11 +18557,10 @@ var Quantity = ({
18486
18557
  children: [
18487
18558
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Text, { children: [
18488
18559
  formatCurrency(
18489
- tiered && priceTiers ? calculateTieredCost(
18490
- entitlement.quantity,
18491
- priceTiers,
18492
- tiersMode
18493
- ) : (price ?? 0) * entitlement.quantity,
18560
+ calculateQuantityCost(
18561
+ entitlementBillingPrice,
18562
+ entitlement.quantity
18563
+ ),
18494
18564
  currency
18495
18565
  ),
18496
18566
  /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("sub", { children: [
@@ -19367,7 +19437,7 @@ var Checkout = ({
19367
19437
  };
19368
19438
 
19369
19439
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
19370
- var import_debounce3 = __toESM(require_debounce());
19440
+ var import_debounce4 = __toESM(require_debounce());
19371
19441
  var import_react39 = require("react");
19372
19442
 
19373
19443
  // src/components/shared/checkout-dialog/Navigation.tsx
@@ -20169,7 +20239,7 @@ var CheckoutDialog = ({ top }) => {
20169
20239
  }, [handlePreviewCheckout]);
20170
20240
  const debouncedPreviewCheckoutRef = (0, import_react39.useRef)(null);
20171
20241
  (0, import_react39.useEffect)(() => {
20172
- const debounced = (0, import_debounce3.default)(
20242
+ const debounced = (0, import_debounce4.default)(
20173
20243
  (updates) => handlePreviewCheckoutRef.current(updates),
20174
20244
  FETCH_DEBOUNCE_TIMEOUT,
20175
20245
  TRAILING_DEBOUNCE_SETTINGS
@@ -22280,6 +22350,29 @@ var EntitlementRow = (props) => {
22280
22350
  tiersMode
22281
22351
  } = entitlementPrice || {};
22282
22352
  const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
22353
+ const tierLabel = /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
22354
+ Text,
22355
+ {
22356
+ style: { opacity: 0.54 },
22357
+ $size: 0.875 * settings.theme.typography.text.fontSize,
22358
+ $color: settings.theme.typography.text.color,
22359
+ children: [
22360
+ t4("Tier-based"),
22361
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
22362
+ PricingTiersTooltip,
22363
+ {
22364
+ portal,
22365
+ feature,
22366
+ period: planPeriod,
22367
+ currency,
22368
+ priceTiers,
22369
+ tiersMode: tiersMode ?? void 0,
22370
+ position: "left"
22371
+ }
22372
+ )
22373
+ ]
22374
+ }
22375
+ );
22283
22376
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22284
22377
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22285
22378
  quantity,
@@ -22290,13 +22383,24 @@ var EntitlementRow = (props) => {
22290
22383
  " ",
22291
22384
  getFeatureName(feature, softLimit)
22292
22385
  ] }) : feature.name }) }),
22293
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22294
- formatCurrency((price ?? 0) * quantity, currency),
22295
- /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
22296
- "/",
22297
- shortenPeriod(planPeriod)
22386
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
22387
+ // A tiered scheme still resolves to a fixed amount at the chosen
22388
+ // quantity, so the row shows it alongside the tier breakdown
22389
+ // rather than leaving the charge unpriced.
22390
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
22391
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22392
+ formatCurrency(
22393
+ calculateQuantityCost(entitlementPrice, quantity),
22394
+ currency
22395
+ ),
22396
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("sub", { children: [
22397
+ "/",
22398
+ shortenPeriod(planPeriod)
22399
+ ] })
22400
+ ] }),
22401
+ tiered && tierLabel
22298
22402
  ] })
22299
- ] }) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22403
+ ) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(Text, { children: [
22300
22404
  priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
22301
22405
  t4("then"),
22302
22406
  " "
@@ -22314,29 +22418,7 @@ var EntitlementRow = (props) => {
22314
22418
  shortenPeriod(planPeriod)
22315
22419
  ] })
22316
22420
  ] })
22317
- ] }) : (priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
22318
- Text,
22319
- {
22320
- style: { opacity: 0.54 },
22321
- $size: 0.875 * settings.theme.typography.text.fontSize,
22322
- $color: settings.theme.typography.text.color,
22323
- children: [
22324
- t4("Tier-based"),
22325
- /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
22326
- PricingTiersTooltip,
22327
- {
22328
- portal,
22329
- feature,
22330
- period: planPeriod,
22331
- currency,
22332
- priceTiers,
22333
- tiersMode: tiersMode ?? void 0,
22334
- position: "left"
22335
- }
22336
- )
22337
- ]
22338
- }
22339
- ) })
22421
+ ] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
22340
22422
  ] });
22341
22423
  }
22342
22424
  };
@@ -22532,12 +22614,18 @@ var SubscriptionSidebar = (0, import_react47.forwardRef)(
22532
22614
  }, 0);
22533
22615
  total += addOnCost;
22534
22616
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
22535
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
22617
+ (sum, entitlement) => sum + calculateQuantityCost(
22618
+ getEntitlementPrice(entitlement, planPeriod, currency),
22619
+ entitlement.quantity
22620
+ ),
22536
22621
  0
22537
22622
  );
22538
22623
  total += payInAdvanceCost;
22539
22624
  const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
22540
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
22625
+ (sum, entitlement) => sum + calculateQuantityCost(
22626
+ getEntitlementPrice(entitlement, planPeriod, currency),
22627
+ entitlement.quantity
22628
+ ),
22541
22629
  0
22542
22630
  );
22543
22631
  total += addOnPayInAdvanceCost;
@@ -24000,7 +24088,7 @@ var Viewport = (0, import_react50.forwardRef)(
24000
24088
  const [top, setTop] = (0, import_react50.useState)(0);
24001
24089
  (0, import_react50.useLayoutEffect)(() => {
24002
24090
  const element = portalRef.current;
24003
- const setModalY = (0, import_debounce4.default)(() => {
24091
+ const setModalY = (0, import_debounce5.default)(() => {
24004
24092
  const value = Math.abs(
24005
24093
  (element === document.body ? window.scrollY : element.scrollTop) ?? 0
24006
24094
  );
@@ -24714,7 +24802,7 @@ var Invoices = (0, import_react54.forwardRef)(({ className, ...rest }, ref) => {
24714
24802
  Invoices.displayName = "Invoices";
24715
24803
 
24716
24804
  // src/components/elements/metered-features/MeteredFeatures.tsx
24717
- var import_react55 = require("react");
24805
+ var import_react56 = require("react");
24718
24806
 
24719
24807
  // src/components/elements/metered-features/Meter.tsx
24720
24808
  var import_jsx_runtime54 = require("react/jsx-runtime");
@@ -24842,6 +24930,190 @@ var PriceDetails = ({
24842
24930
  );
24843
24931
  };
24844
24932
 
24933
+ // src/components/elements/metered-features/UsageByUser.tsx
24934
+ var import_react55 = require("react");
24935
+ var import_jsx_runtime56 = require("react/jsx-runtime");
24936
+ var COLLAPSED_COUNT = 3;
24937
+ var EXPANDED_COUNT = 20;
24938
+ var toCreditSection = (data) => ({
24939
+ entries: data.entries.map((entry) => ({
24940
+ id: entry.userId,
24941
+ // An entry with no hydrated user record still has an id worth showing —
24942
+ // a blank row identifies nobody.
24943
+ label: entry.user?.name || entry.userId || "",
24944
+ amount: entry.creditsUsed
24945
+ })),
24946
+ total: data.total,
24947
+ totalUsers: data.totalUsers,
24948
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
24949
+ });
24950
+ var toFeatureSection = (data) => ({
24951
+ entries: data.rows.map((row) => ({
24952
+ id: row.userId,
24953
+ label: row.user?.name || row.userId || "",
24954
+ amount: row.value
24955
+ })),
24956
+ total: data.total,
24957
+ totalUsers: data.totalUsers,
24958
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
24959
+ });
24960
+ var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
24961
+ var InitialAvatar = ({ label }) => {
24962
+ const { settings } = useEmbed();
24963
+ const isLightBackground = useIsLightBackground();
24964
+ const initial = (label.trim()[0] ?? "?").toUpperCase();
24965
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24966
+ Flex,
24967
+ {
24968
+ $alignItems: "center",
24969
+ $justifyContent: "center",
24970
+ $width: "1.75rem",
24971
+ $height: "1.75rem",
24972
+ $flexShrink: 0,
24973
+ $borderRadius: "9999px",
24974
+ $background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
24975
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
24976
+ Text,
24977
+ {
24978
+ $size: 11,
24979
+ $weight: 500,
24980
+ $color: settings.theme.typography.text.color,
24981
+ children: initial
24982
+ }
24983
+ )
24984
+ }
24985
+ );
24986
+ };
24987
+ var UsageByUser = ({ source, unit }) => {
24988
+ const { t: t4 } = useTranslation();
24989
+ const isLightBackground = useIsLightBackground();
24990
+ const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
24991
+ const [expanded, setExpanded] = (0, import_react55.useState)(false);
24992
+ const [result, setResult] = (0, import_react55.useState)();
24993
+ const [attempt, setAttempt] = (0, import_react55.useState)(0);
24994
+ const { kind, id } = source;
24995
+ const sourceKey = `${kind}:${id}`;
24996
+ const current = result?.sourceKey === sourceKey ? result : void 0;
24997
+ (0, import_react55.useEffect)(() => {
24998
+ let active = true;
24999
+ const apply = (next2) => {
25000
+ if (active) {
25001
+ setResult(next2);
25002
+ }
25003
+ };
25004
+ const receive = (section) => {
25005
+ if (section) {
25006
+ apply({ sourceKey, section });
25007
+ }
25008
+ };
25009
+ const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
25010
+ if (kind === "credit") {
25011
+ getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
25012
+ (response) => receive(response && toCreditSection(response.data))
25013
+ ).catch(fail);
25014
+ } else {
25015
+ getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
25016
+ (response) => receive(response && toFeatureSection(response.data))
25017
+ ).catch(fail);
25018
+ }
25019
+ return () => {
25020
+ active = false;
25021
+ };
25022
+ }, [
25023
+ attempt,
25024
+ getCreditUsageByUser,
25025
+ getFeatureUsageByUser,
25026
+ id,
25027
+ kind,
25028
+ sourceKey
25029
+ ]);
25030
+ const entries = current?.section?.entries;
25031
+ const attributed = (0, import_react55.useMemo)(
25032
+ () => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
25033
+ [entries]
25034
+ );
25035
+ const error = current?.error;
25036
+ const total = current?.section?.total ?? 0;
25037
+ const totalUsers = current?.section?.totalUsers ?? 0;
25038
+ const unattributed = current?.section?.unattributed;
25039
+ const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
25040
+ if (error) {
25041
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
25042
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t4("Usage by user") }),
25043
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
25044
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25045
+ Button,
25046
+ {
25047
+ type: "button",
25048
+ onClick: () => setAttempt((prev2) => prev2 + 1),
25049
+ $size: "sm",
25050
+ $variant: "ghost",
25051
+ $fullWidth: false,
25052
+ children: t4("Try again")
25053
+ }
25054
+ )
25055
+ ] });
25056
+ }
25057
+ if (attributed.length === 0 && !unattributed) {
25058
+ return null;
25059
+ }
25060
+ const visible = attributed.slice(
25061
+ 0,
25062
+ expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
25063
+ );
25064
+ const remaining = Math.max(totalUsers - visible.length, 0);
25065
+ const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
25066
+ const hiddenUsers = Math.max(
25067
+ expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
25068
+ 0
25069
+ );
25070
+ const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
25071
+ 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");
25072
+ const row = (key, label, amount, muted) => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
25073
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(InitialAvatar, { label: muted ? "?" : label }),
25074
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25075
+ Text,
25076
+ {
25077
+ display: "text",
25078
+ $color: muted ? mutedColor(isLightBackground) : void 0,
25079
+ children: label
25080
+ }
25081
+ ) }),
25082
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25083
+ Text,
25084
+ {
25085
+ display: "text",
25086
+ $align: "right",
25087
+ $color: mutedColor(isLightBackground),
25088
+ children: formatAmount(amount)
25089
+ }
25090
+ )
25091
+ ] }, key);
25092
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
25093
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "heading4", children: t4("Usage by user") }),
25094
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
25095
+ amount: formatAmount(total)
25096
+ }) }) }),
25097
+ visible.map(
25098
+ (entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
25099
+ ),
25100
+ expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
25101
+ expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("plus X more", { count: remaining }) }) }),
25102
+ shouldShowToggle && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25103
+ ExpandListToggle,
25104
+ {
25105
+ isExpanded: expanded,
25106
+ onToggle: () => setExpanded((prev2) => !prev2),
25107
+ expandLabel,
25108
+ collapseLabel: t4("Show fewer"),
25109
+ iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
25110
+ $marginTop: "0.25rem"
25111
+ }
25112
+ )
25113
+ ] });
25114
+ };
25115
+ UsageByUser.displayName = "UsageByUser";
25116
+
24845
25117
  // src/components/elements/metered-features/styles.ts
24846
25118
  var Container2 = gt.div`
24847
25119
  display: flex;
@@ -24860,7 +25132,7 @@ var Container2 = gt.div`
24860
25132
  `;
24861
25133
 
24862
25134
  // src/components/elements/metered-features/MeteredFeatures.tsx
24863
- var import_jsx_runtime56 = require("react/jsx-runtime");
25135
+ var import_jsx_runtime57 = require("react/jsx-runtime");
24864
25136
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
24865
25137
  const { t: t4 } = useTranslation();
24866
25138
  const { data } = useEmbed();
@@ -24897,9 +25169,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
24897
25169
  })
24898
25170
  );
24899
25171
  }
24900
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Text, { display: fontStyle, children: [
25172
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Text, { display: fontStyle, children: [
24901
25173
  acc.join(" \u2022 "),
24902
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25174
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
24903
25175
  HardLimitTooltip,
24904
25176
  {
24905
25177
  feature: entitlement.feature,
@@ -24929,19 +25201,22 @@ function resolveDesignProps4(props) {
24929
25201
  isVisible: props.usage?.isVisible ?? true,
24930
25202
  fontStyle: props.usage?.fontStyle ?? "heading5"
24931
25203
  },
25204
+ usageByUser: {
25205
+ isVisible: props.usageByUser?.isVisible ?? true
25206
+ },
24932
25207
  // there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
24933
25208
  visibleFeatures: props.visibleFeatures
24934
25209
  };
24935
25210
  }
24936
- var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, ref) => {
25211
+ var MeteredFeatures = (0, import_react56.forwardRef)(({ className, ...rest }, ref) => {
24937
25212
  const props = resolveDesignProps4(rest);
24938
- const elementsRef = (0, import_react55.useRef)([]);
25213
+ const elementsRef = (0, import_react56.useRef)([]);
24939
25214
  const shouldWrapChildren = useWrapChildren(elementsRef);
24940
25215
  const { t: t4 } = useTranslation();
24941
25216
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
24942
25217
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
24943
25218
  const isLightBackground = useIsLightBackground();
24944
- const meteredFeatures = (0, import_react55.useMemo)(() => {
25219
+ const meteredFeatures = (0, import_react56.useMemo)(() => {
24945
25220
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
24946
25221
  (acc, id) => {
24947
25222
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -24958,7 +25233,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
24958
25233
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
24959
25234
  );
24960
25235
  }, [props.visibleFeatures, data?.featureUsage?.features]);
24961
- const creditGroups = (0, import_react55.useMemo)(
25236
+ const creditGroups = (0, import_react56.useMemo)(
24962
25237
  () => withEmptyPlanCreditBalances(
24963
25238
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
24964
25239
  listPlanCredits(
@@ -24969,11 +25244,11 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
24969
25244
  ),
24970
25245
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
24971
25246
  );
24972
- const planCreditCompositions = (0, import_react55.useMemo)(
25247
+ const planCreditCompositions = (0, import_react56.useMemo)(
24973
25248
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
24974
25249
  [data?.company?.plan?.includedCreditGrants]
24975
25250
  );
24976
- const resolveLicenseQuantity = (0, import_react55.useCallback)(
25251
+ const resolveLicenseQuantity = (0, import_react56.useCallback)(
24977
25252
  (licenseId) => {
24978
25253
  const allocation = findLicenseSource(
24979
25254
  data?.featureUsage?.features ?? [],
@@ -24983,17 +25258,17 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
24983
25258
  },
24984
25259
  [data?.featureUsage?.features]
24985
25260
  );
24986
- const purchasableCreditIds = (0, import_react55.useMemo)(
25261
+ const purchasableCreditIds = (0, import_react56.useMemo)(
24987
25262
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
24988
25263
  [data?.creditBundles, data?.company?.plan?.id]
24989
25264
  );
24990
- const [expandedCreditIds, setExpandedCreditIds] = (0, import_react55.useState)(
25265
+ const [expandedCreditIds, setExpandedCreditIds] = (0, import_react56.useState)(
24991
25266
  () => /* @__PURE__ */ new Set()
24992
25267
  );
24993
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react55.useState)(
25268
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = (0, import_react56.useState)(
24994
25269
  () => /* @__PURE__ */ new Set()
24995
25270
  );
24996
- const toggleFullLedger = (0, import_react55.useCallback)((id) => {
25271
+ const toggleFullLedger = (0, import_react56.useCallback)((id) => {
24997
25272
  setFullLedgerCreditIds((prev2) => {
24998
25273
  const next2 = new Set(prev2);
24999
25274
  if (next2.has(id)) {
@@ -25004,7 +25279,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25004
25279
  return next2;
25005
25280
  });
25006
25281
  }, []);
25007
- const toggleBalanceDetails = (0, import_react55.useCallback)((id) => {
25282
+ const toggleBalanceDetails = (0, import_react56.useCallback)((id) => {
25008
25283
  setExpandedCreditIds((prev2) => {
25009
25284
  const next2 = new Set(prev2);
25010
25285
  if (next2.has(id)) {
@@ -25030,7 +25305,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25030
25305
  const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
25031
25306
  const canCheckout = data?.capabilities?.checkout ?? false;
25032
25307
  const showCredits = data?.displaySettings?.showCredits ?? true;
25033
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Container2, { ref, className, children: [
25308
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Container2, { ref, className, children: [
25034
25309
  meteredFeatures.reduce((acc, entitlement, index) => {
25035
25310
  if (!entitlement.feature) {
25036
25311
  return acc;
@@ -25041,9 +25316,9 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25041
25316
  });
25042
25317
  const { limit } = usageDetails;
25043
25318
  acc.push(
25044
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
25045
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1.5rem", children: [
25046
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25319
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
25320
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
25321
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25047
25322
  Icon3,
25048
25323
  {
25049
25324
  name: feature.icon,
@@ -25052,8 +25327,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25052
25327
  rounded: true
25053
25328
  }
25054
25329
  ),
25055
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25056
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25330
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25331
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25057
25332
  Flex,
25058
25333
  {
25059
25334
  ref: (el) => {
@@ -25064,31 +25339,31 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25064
25339
  $flexWrap: "wrap",
25065
25340
  $gap: "1rem",
25066
25341
  children: [
25067
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25068
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
25069
- props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
25342
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25343
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: feature.name }) }),
25344
+ props.description.isVisible && feature.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: feature.description }) })
25070
25345
  ] }),
25071
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25346
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25072
25347
  Box,
25073
25348
  {
25074
25349
  $flexBasis: "min-content",
25075
25350
  $flexGrow: 1,
25076
25351
  $textAlign: shouldWrapChildren ? "left" : "right",
25077
25352
  children: [
25078
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25079
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25353
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25354
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25080
25355
  formatNumber(limit),
25081
25356
  " "
25082
25357
  ] }),
25083
25358
  getFeatureName(feature, limit)
25084
- ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25359
+ ] }) : typeof usage === "number" && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25085
25360
  formatNumber(usage),
25086
25361
  " ",
25087
25362
  getFeatureName(feature, usage),
25088
25363
  " ",
25089
25364
  t4("used")
25090
25365
  ] }) }) }),
25091
- props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25366
+ props.allocation.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25092
25367
  Limit,
25093
25368
  {
25094
25369
  entitlement,
@@ -25102,8 +25377,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25102
25377
  ]
25103
25378
  }
25104
25379
  ),
25105
- props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Meter, { entitlement }),
25106
- canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25380
+ props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Meter, { entitlement }),
25381
+ canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25107
25382
  Button,
25108
25383
  {
25109
25384
  type: "button",
@@ -25116,13 +25391,24 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25116
25391
  )
25117
25392
  ] })
25118
25393
  ] }),
25119
- (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25394
+ (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25120
25395
  PriceDetails,
25121
25396
  {
25122
25397
  entitlement,
25123
25398
  usageDetails,
25124
25399
  period
25125
25400
  }
25401
+ ),
25402
+ props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
25403
+ // they are denominated in the feature's own unit — the same one
25404
+ // the usage line above uses. A credit-burndown feature's credit
25405
+ // spend is broken down separately, under its credit.
25406
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25407
+ UsageByUser,
25408
+ {
25409
+ source: { kind: "feature", id: feature.id },
25410
+ unit: feature
25411
+ }
25126
25412
  )
25127
25413
  ] }, index)
25128
25414
  );
@@ -25136,9 +25422,9 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25136
25422
  const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
25137
25423
  const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
25138
25424
  const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
25139
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25140
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1.5rem", children: [
25141
- props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25425
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25426
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1.5rem", children: [
25427
+ props.icon.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25142
25428
  Icon3,
25143
25429
  {
25144
25430
  name: credit.icon,
@@ -25147,13 +25433,13 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25147
25433
  rounded: true
25148
25434
  }
25149
25435
  ),
25150
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25151
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25152
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
25153
- props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
25436
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25437
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25438
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: credit.name }) }),
25439
+ props.description.isVisible && credit.description && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.description.fontStyle, children: credit.description }) })
25154
25440
  ] }) }),
25155
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
25156
- props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
25441
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $gap: "1rem", $alignItems: "center", children: [
25442
+ props.usage.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
25157
25443
  // Balances burn at rates with up to 10 decimal
25158
25444
  // places, so a small remainder must not round to 0.
25159
25445
  amount: formatNumber(credit.total.remaining, {
@@ -25164,7 +25450,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25164
25450
  credit.total.remaining
25165
25451
  )
25166
25452
  }) }) }),
25167
- canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25453
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25168
25454
  Button,
25169
25455
  {
25170
25456
  type: "button",
@@ -25217,7 +25503,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25217
25503
  const renewalDate = data?.upcomingInvoice?.dueDate;
25218
25504
  return (
25219
25505
  // Pulled up against the balance line despite the column's 2rem gap
25220
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25506
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25221
25507
  Text,
25222
25508
  {
25223
25509
  style: { opacity: 0.54 },
@@ -25230,7 +25516,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25230
25516
  period: shortenPeriod(composition.period),
25231
25517
  composition: ` \u2014 ${parts.join(" + ")}`
25232
25518
  }),
25233
- renewalDate && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25519
+ renewalDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25234
25520
  " ",
25235
25521
  t4("Renews on the day", {
25236
25522
  day: formatOrdinal(renewalDate.getDate())
@@ -25243,12 +25529,12 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25243
25529
  })()
25244
25530
  ] })
25245
25531
  ] }),
25246
- hasGrants && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25532
+ hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25247
25533
  Box,
25248
25534
  {
25249
25535
  $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
25250
25536
  $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
25251
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
25537
+ children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25252
25538
  TransitionBox,
25253
25539
  {
25254
25540
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
@@ -25256,22 +25542,22 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25256
25542
  children: [
25257
25543
  visibleGrants.map((grant, index2) => {
25258
25544
  const padding = getRowPadding(index2);
25259
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25260
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t4("X items included in plan", {
25545
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25546
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("X items included in plan", {
25261
25547
  amount: grant.quantity,
25262
25548
  item: getFeatureName(
25263
25549
  credit,
25264
25550
  grant.quantity
25265
25551
  )
25266
25552
  }) }) }),
25267
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25553
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25268
25554
  Box,
25269
25555
  {
25270
25556
  $display: "table-cell",
25271
25557
  $padding: padding,
25272
25558
  $textAlign: "right",
25273
25559
  $whiteSpace: "nowrap",
25274
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t4("Resets", {
25560
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("Resets", {
25275
25561
  date: toPrettyDate(
25276
25562
  modifyDate(grant.expiresAt, 1),
25277
25563
  { month: "short" }
@@ -25279,15 +25565,15 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25279
25565
  }) })
25280
25566
  }
25281
25567
  )
25282
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
25283
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t4("X item bundle", {
25568
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
25569
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item bundle", {
25284
25570
  amount: grant.quantity,
25285
25571
  item: getFeatureName(credit, 1),
25286
25572
  createdAt: toPrettyDate(
25287
25573
  grant.createdAt,
25288
25574
  { month: "short" }
25289
25575
  )
25290
- }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t4("X item auto-topup", {
25576
+ }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item auto-topup", {
25291
25577
  amount: grant.quantity,
25292
25578
  item: getFeatureName(
25293
25579
  credit,
@@ -25297,7 +25583,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25297
25583
  grant.createdAt,
25298
25584
  { month: "short" }
25299
25585
  )
25300
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_jsx_runtime56.Fragment, { children: t4("X item grant", {
25586
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: t4("X item grant", {
25301
25587
  amount: grant.quantity,
25302
25588
  item: getFeatureName(
25303
25589
  credit,
@@ -25308,14 +25594,14 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25308
25594
  { month: "short" }
25309
25595
  )
25310
25596
  }) }) }) }),
25311
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25597
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25312
25598
  Box,
25313
25599
  {
25314
25600
  $display: "table-cell",
25315
25601
  $padding: padding,
25316
25602
  $textAlign: "right",
25317
25603
  $whiteSpace: "nowrap",
25318
- children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Text, { children: t4("Expires", {
25604
+ children: grant.expiresAt && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t4("Expires", {
25319
25605
  date: toPrettyDate(
25320
25606
  modifyDate(grant.expiresAt, 1),
25321
25607
  { month: "short" }
@@ -25325,8 +25611,8 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25325
25611
  )
25326
25612
  ] }) }, grant.id);
25327
25613
  }),
25328
- canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(Box, { $display: "table-row", children: [
25329
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25614
+ canExpandLedger && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $display: "table-row", children: [
25615
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25330
25616
  ExpandListToggle,
25331
25617
  {
25332
25618
  isExpanded: showAllGrants,
@@ -25335,7 +25621,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25335
25621
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25336
25622
  }
25337
25623
  ) }),
25338
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25624
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25339
25625
  Box,
25340
25626
  {
25341
25627
  $display: "table-cell",
@@ -25348,7 +25634,7 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25348
25634
  )
25349
25635
  }
25350
25636
  ),
25351
- hasGrants && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
25637
+ hasGrants && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25352
25638
  ExpandListToggle,
25353
25639
  {
25354
25640
  isExpanded,
@@ -25357,6 +25643,13 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25357
25643
  collapseLabel: t4("Hide balance details"),
25358
25644
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25359
25645
  }
25646
+ ),
25647
+ props.usageByUser.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25648
+ UsageByUser,
25649
+ {
25650
+ source: { kind: "credit", id: credit.id },
25651
+ unit: credit
25652
+ }
25360
25653
  )
25361
25654
  ] }, index);
25362
25655
  })
@@ -25365,11 +25658,11 @@ var MeteredFeatures = (0, import_react55.forwardRef)(({ className, ...rest }, re
25365
25658
  MeteredFeatures.displayName = "MeteredFeatures";
25366
25659
 
25367
25660
  // src/components/elements/payment-method/PaymentMethod.tsx
25368
- var import_react57 = require("react");
25661
+ var import_react58 = require("react");
25369
25662
 
25370
25663
  // src/components/elements/payment-method/PaymentMethodElement.tsx
25371
- var import_react56 = require("react");
25372
- var import_jsx_runtime57 = require("react/jsx-runtime");
25664
+ var import_react57 = require("react");
25665
+ var import_jsx_runtime58 = require("react/jsx-runtime");
25373
25666
  var PaymentElement2 = ({
25374
25667
  iconName,
25375
25668
  iconTitle,
@@ -25377,8 +25670,8 @@ var PaymentElement2 = ({
25377
25670
  paymentLast4
25378
25671
  }) => {
25379
25672
  const { settings } = useEmbed();
25380
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
25381
- iconName && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25673
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
25674
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25382
25675
  Icon3,
25383
25676
  {
25384
25677
  name: iconName,
@@ -25386,15 +25679,15 @@ var PaymentElement2 = ({
25386
25679
  color: settings.theme.typography.text.color
25387
25680
  }
25388
25681
  ),
25389
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $flexGrow: 1, children: [
25390
- label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: label }),
25682
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
25683
+ label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
25391
25684
  " ",
25392
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: paymentLast4 })
25685
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
25393
25686
  ] })
25394
25687
  ] });
25395
25688
  };
25396
25689
  var EmptyPaymentElement = () => {
25397
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
25690
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
25398
25691
  };
25399
25692
  var getPaymentMethodData = ({
25400
25693
  accountLast4,
@@ -25474,12 +25767,12 @@ var PaymentMethodElement = ({
25474
25767
  const isLightBackground = useIsLightBackground();
25475
25768
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
25476
25769
  const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
25477
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
25478
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
25479
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
25480
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
25770
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
25771
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
25772
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
25773
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
25481
25774
  ] }),
25482
- /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25775
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
25483
25776
  Flex,
25484
25777
  {
25485
25778
  $justifyContent: "space-between",
@@ -25488,8 +25781,8 @@ var PaymentMethodElement = ({
25488
25781
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
25489
25782
  $borderRadius: "9999px",
25490
25783
  children: [
25491
- paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(EmptyPaymentElement, {}),
25492
- onRemove && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25784
+ paymentMethod ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(EmptyPaymentElement, {}),
25785
+ onRemove && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25493
25786
  Text,
25494
25787
  {
25495
25788
  onClick: onRemove,
@@ -25499,7 +25792,7 @@ var PaymentMethodElement = ({
25499
25792
  children: t4("Remove")
25500
25793
  }
25501
25794
  ),
25502
- props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25795
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25503
25796
  Text,
25504
25797
  {
25505
25798
  onClick: onEdit,
@@ -25512,8 +25805,8 @@ var PaymentMethodElement = ({
25512
25805
  ]
25513
25806
  }
25514
25807
  ),
25515
- hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
25516
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25808
+ hasCustomFields && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
25809
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25517
25810
  Text,
25518
25811
  {
25519
25812
  $size: 12,
@@ -25521,7 +25814,7 @@ var PaymentMethodElement = ({
25521
25814
  children: field.name
25522
25815
  }
25523
25816
  ),
25524
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25817
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25525
25818
  "span",
25526
25819
  {
25527
25820
  style: {
@@ -25542,7 +25835,7 @@ var PaymentListElement = ({
25542
25835
  const { settings } = useEmbed();
25543
25836
  const isLightBackground = useIsLightBackground();
25544
25837
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
25545
- const expirationDate = (0, import_react56.useMemo)(() => {
25838
+ const expirationDate = (0, import_react57.useMemo)(() => {
25546
25839
  const { cardExpMonth, cardExpYear } = paymentMethod;
25547
25840
  if (!cardExpMonth || !cardExpYear) {
25548
25841
  return;
@@ -25553,7 +25846,7 @@ var PaymentListElement = ({
25553
25846
  }
25554
25847
  return `${cardExpMonth}/${formatedYear}`;
25555
25848
  }, [paymentMethod]);
25556
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
25849
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
25557
25850
  Flex,
25558
25851
  {
25559
25852
  $flexDirection: "row",
@@ -25565,7 +25858,7 @@ var PaymentListElement = ({
25565
25858
  $borderStyle: "solid",
25566
25859
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
25567
25860
  children: [
25568
- iconName && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25861
+ iconName && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25569
25862
  Icon3,
25570
25863
  {
25571
25864
  name: iconName,
@@ -25573,20 +25866,20 @@ var PaymentListElement = ({
25573
25866
  color: settings.theme.typography.text.color
25574
25867
  }
25575
25868
  ),
25576
- (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(Box, { $flexGrow: 1, children: [
25577
- label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: label }),
25869
+ (label || paymentLast4) && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Box, { $flexGrow: 1, children: [
25870
+ label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: label }),
25578
25871
  " ",
25579
- paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: paymentLast4 })
25872
+ paymentLast4 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: paymentLast4 })
25580
25873
  ] }),
25581
- expirationDate && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25874
+ expirationDate && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25582
25875
  Box,
25583
25876
  {
25584
25877
  $flexGrow: 1,
25585
25878
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
25586
- children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
25879
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Text, { children: t("Expires", { date: expirationDate }) })
25587
25880
  }
25588
25881
  ),
25589
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25882
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25590
25883
  Text,
25591
25884
  {
25592
25885
  onClick: () => {
@@ -25599,7 +25892,7 @@ var PaymentListElement = ({
25599
25892
  children: t("Set default")
25600
25893
  }
25601
25894
  ) }),
25602
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
25895
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25603
25896
  Icon3,
25604
25897
  {
25605
25898
  tabIndex: 0,
@@ -25621,7 +25914,7 @@ var PaymentListElement = ({
25621
25914
  };
25622
25915
 
25623
25916
  // src/components/elements/payment-method/PaymentMethod.tsx
25624
- var import_jsx_runtime58 = require("react/jsx-runtime");
25917
+ var import_jsx_runtime59 = require("react/jsx-runtime");
25625
25918
  var resolveDesignProps5 = (props) => {
25626
25919
  return {
25627
25920
  header: {
@@ -25634,10 +25927,10 @@ var resolveDesignProps5 = (props) => {
25634
25927
  }
25635
25928
  };
25636
25929
  };
25637
- var PaymentMethod = (0, import_react57.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
25930
+ var PaymentMethod = (0, import_react58.forwardRef)(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
25638
25931
  const props = resolveDesignProps5(rest);
25639
25932
  const { data, setLayout } = useEmbed();
25640
- const { paymentMethod, monthsToExpiration } = (0, import_react57.useMemo)(() => {
25933
+ const { paymentMethod, monthsToExpiration } = (0, import_react58.useMemo)(() => {
25641
25934
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
25642
25935
  let monthsToExpiration2;
25643
25936
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -25656,7 +25949,7 @@ var PaymentMethod = (0, import_react57.forwardRef)(({ children, className, porta
25656
25949
  monthsToExpiration: monthsToExpiration2
25657
25950
  };
25658
25951
  }, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
25659
- return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
25952
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Element, { ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
25660
25953
  PaymentMethodElement,
25661
25954
  {
25662
25955
  customCheckoutFields: data?.customCheckoutFields,
@@ -25841,8 +26134,8 @@ var loadStripe = function loadStripe2() {
25841
26134
  };
25842
26135
 
25843
26136
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
25844
- var import_react58 = require("react");
25845
- var import_jsx_runtime59 = require("react/jsx-runtime");
26137
+ var import_react59 = require("react");
26138
+ var import_jsx_runtime60 = require("react/jsx-runtime");
25846
26139
  var resolveDesignProps6 = () => {
25847
26140
  return {
25848
26141
  header: {
@@ -25870,7 +26163,7 @@ var PaymentMethodDetails = ({
25870
26163
  updatePaymentMethod,
25871
26164
  deletePaymentMethod
25872
26165
  } = useEmbed();
25873
- const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react58.useMemo)(() => {
26166
+ const { defaultPaymentMethod, paymentMethods, subscription } = (0, import_react59.useMemo)(() => {
25874
26167
  return {
25875
26168
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
25876
26169
  paymentMethods: data?.company?.paymentMethods || [],
@@ -25883,13 +26176,13 @@ var PaymentMethodDetails = ({
25883
26176
  ]);
25884
26177
  const isLightBackground = useIsLightBackground();
25885
26178
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
25886
- const [isLoading, setIsLoading] = (0, import_react58.useState)(!initialPaymentMethod);
25887
- const [error, setError] = (0, import_react58.useState)();
25888
- const [showPaymentForm, setShowPaymentForm] = (0, import_react58.useState)(false);
25889
- const [stripe, setStripe] = (0, import_react58.useState)(null);
25890
- const [setupIntent, setSetupIntent] = (0, import_react58.useState)();
25891
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react58.useState)(false);
25892
- const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react58.useState)(initialPaymentMethod);
26179
+ const [isLoading, setIsLoading] = (0, import_react59.useState)(!initialPaymentMethod);
26180
+ const [error, setError] = (0, import_react59.useState)();
26181
+ const [showPaymentForm, setShowPaymentForm] = (0, import_react59.useState)(false);
26182
+ const [stripe, setStripe] = (0, import_react59.useState)(null);
26183
+ const [setupIntent, setSetupIntent] = (0, import_react59.useState)();
26184
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = (0, import_react59.useState)(false);
26185
+ const [currentPaymentMethod, setCurrentPaymentMethod] = (0, import_react59.useState)(initialPaymentMethod);
25893
26186
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
25894
26187
  stripe,
25895
26188
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -25902,7 +26195,7 @@ var PaymentMethodDetails = ({
25902
26195
  },
25903
26196
  autoConfirm: true
25904
26197
  });
25905
- const monthsToExpiration = (0, import_react58.useMemo)(() => {
26198
+ const monthsToExpiration = (0, import_react59.useMemo)(() => {
25906
26199
  let expiration;
25907
26200
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
25908
26201
  const now = /* @__PURE__ */ new Date();
@@ -25925,8 +26218,8 @@ var PaymentMethodDetails = ({
25925
26218
  const toggleShowPaymentMethods = () => {
25926
26219
  setShowDifferentPaymentMethods((prev2) => !prev2);
25927
26220
  };
25928
- const locale = (0, import_react58.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
25929
- const initializeStripe = (0, import_react58.useCallback)(() => {
26221
+ const locale = (0, import_react59.useMemo)(() => stripeLocale(i18n.language), [i18n.language]);
26222
+ const initializeStripe = (0, import_react59.useCallback)(() => {
25930
26223
  if (stripe || !setupIntent) {
25931
26224
  return;
25932
26225
  }
@@ -25949,7 +26242,7 @@ var PaymentMethodDetails = ({
25949
26242
  setShowPaymentForm(false);
25950
26243
  });
25951
26244
  }, [t4, stripe, setupIntent, locale]);
25952
- const initializePaymentMethod = (0, import_react58.useCallback)(() => {
26245
+ const initializePaymentMethod = (0, import_react59.useCallback)(() => {
25953
26246
  const pending = createSetupIntent() ?? Promise.resolve(void 0);
25954
26247
  return pending.then((response) => {
25955
26248
  if (response) {
@@ -25964,7 +26257,7 @@ var PaymentMethodDetails = ({
25964
26257
  setIsLoading(false);
25965
26258
  });
25966
26259
  }, [t4, createSetupIntent]);
25967
- const handleUpdatePaymentMethod = (0, import_react58.useCallback)(
26260
+ const handleUpdatePaymentMethod = (0, import_react59.useCallback)(
25968
26261
  async (paymentMethodId) => {
25969
26262
  try {
25970
26263
  setIsLoading(true);
@@ -25986,7 +26279,7 @@ var PaymentMethodDetails = ({
25986
26279
  },
25987
26280
  [t4, setPaymentMethodId, updatePaymentMethod, onPaymentMethodSaved]
25988
26281
  );
25989
- const handleDeletePaymentMethod = (0, import_react58.useCallback)(
26282
+ const handleDeletePaymentMethod = (0, import_react59.useCallback)(
25990
26283
  async (paymentMethodId) => {
25991
26284
  try {
25992
26285
  setIsLoading(true);
@@ -26002,10 +26295,10 @@ var PaymentMethodDetails = ({
26002
26295
  },
26003
26296
  [t4, deletePaymentMethod]
26004
26297
  );
26005
- (0, import_react58.useEffect)(() => {
26298
+ (0, import_react59.useEffect)(() => {
26006
26299
  initializeStripe();
26007
26300
  }, [initializeStripe]);
26008
- (0, import_react58.useEffect)(() => {
26301
+ (0, import_react59.useEffect)(() => {
26009
26302
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
26010
26303
  initializePaymentMethod();
26011
26304
  }
@@ -26015,7 +26308,7 @@ var PaymentMethodDetails = ({
26015
26308
  showPaymentForm,
26016
26309
  initializePaymentMethod
26017
26310
  ]);
26018
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26311
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26019
26312
  Flex,
26020
26313
  {
26021
26314
  $position: "relative",
@@ -26023,7 +26316,7 @@ var PaymentMethodDetails = ({
26023
26316
  $flexGrow: 1,
26024
26317
  $gap: "1.5rem",
26025
26318
  children: [
26026
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26319
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26027
26320
  Flex,
26028
26321
  {
26029
26322
  $position: "absolute",
@@ -26032,7 +26325,7 @@ var PaymentMethodDetails = ({
26032
26325
  $alignItems: "center",
26033
26326
  $width: "100%",
26034
26327
  $height: "100%",
26035
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26328
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26036
26329
  Loader,
26037
26330
  {
26038
26331
  $color: settings.theme.primary,
@@ -26042,7 +26335,7 @@ var PaymentMethodDetails = ({
26042
26335
  )
26043
26336
  }
26044
26337
  ),
26045
- /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26338
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26046
26339
  Flex,
26047
26340
  {
26048
26341
  $zIndex: isLoading || isConfirmingPayment ? 0 : 1,
@@ -26059,7 +26352,7 @@ var PaymentMethodDetails = ({
26059
26352
  }
26060
26353
  },
26061
26354
  children: [
26062
- setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
26355
+ setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26063
26356
  import_react_stripe_js2.Elements,
26064
26357
  {
26065
26358
  stripe,
@@ -26090,7 +26383,7 @@ var PaymentMethodDetails = ({
26090
26383
  clientSecret: setupIntent?.setupIntentClientSecret
26091
26384
  },
26092
26385
  children: [
26093
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26386
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26094
26387
  PaymentForm,
26095
26388
  {
26096
26389
  financeData,
@@ -26101,7 +26394,7 @@ var PaymentMethodDetails = ({
26101
26394
  }
26102
26395
  }
26103
26396
  ),
26104
- currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26397
+ currentPaymentMethod && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26105
26398
  Text,
26106
26399
  {
26107
26400
  onClick: focusExistingPaymentMethods,
@@ -26114,8 +26407,8 @@ var PaymentMethodDetails = ({
26114
26407
  ) })
26115
26408
  ]
26116
26409
  }
26117
- ) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26118
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26410
+ ) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26411
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26119
26412
  PaymentMethodElement,
26120
26413
  {
26121
26414
  paymentMethod: currentPaymentMethod,
@@ -26128,8 +26421,8 @@ var PaymentMethodDetails = ({
26128
26421
  ...props
26129
26422
  }
26130
26423
  ),
26131
- paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26132
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26424
+ paymentMethods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26425
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26133
26426
  Text,
26134
26427
  {
26135
26428
  onClick: toggleShowPaymentMethods,
@@ -26140,7 +26433,7 @@ var PaymentMethodDetails = ({
26140
26433
  children: t4("Choose different payment method")
26141
26434
  }
26142
26435
  ),
26143
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26436
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26144
26437
  Icon3,
26145
26438
  {
26146
26439
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
@@ -26148,10 +26441,10 @@ var PaymentMethodDetails = ({
26148
26441
  }
26149
26442
  )
26150
26443
  ] }),
26151
- showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26152
- paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26444
+ showDifferentPaymentMethods && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26445
+ paymentMethods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26153
26446
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
26154
- ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26447
+ ) || []).map((paymentMethod) => /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26155
26448
  PaymentListElement,
26156
26449
  {
26157
26450
  paymentMethod,
@@ -26160,7 +26453,7 @@ var PaymentMethodDetails = ({
26160
26453
  },
26161
26454
  paymentMethod.id
26162
26455
  )) }),
26163
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
26456
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
26164
26457
  Button,
26165
26458
  {
26166
26459
  type: "button",
@@ -26175,7 +26468,7 @@ var PaymentMethodDetails = ({
26175
26468
  )
26176
26469
  ] })
26177
26470
  ] }),
26178
- !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26471
+ !isLoading && error && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26179
26472
  ]
26180
26473
  }
26181
26474
  )
@@ -26185,13 +26478,13 @@ var PaymentMethodDetails = ({
26185
26478
  };
26186
26479
 
26187
26480
  // src/components/elements/plan-manager/PlanManager.tsx
26188
- var import_react60 = require("react");
26481
+ var import_react61 = require("react");
26189
26482
 
26190
26483
  // src/components/elements/plan-manager/AddOn.tsx
26191
- var import_jsx_runtime60 = require("react/jsx-runtime");
26484
+ var import_jsx_runtime61 = require("react/jsx-runtime");
26192
26485
  var AddOn = ({ addOn, currency, period, layout }) => {
26193
26486
  const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
26194
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
26487
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
26195
26488
  Flex,
26196
26489
  {
26197
26490
  $justifyContent: "space-between",
@@ -26199,10 +26492,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26199
26492
  $flexWrap: "wrap",
26200
26493
  $gap: "1rem",
26201
26494
  children: [
26202
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26203
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(Text, { children: [
26495
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26496
+ typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
26204
26497
  formatCurrency(addOn.planPrice, currency),
26205
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26498
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26206
26499
  ] })
26207
26500
  ]
26208
26501
  }
@@ -26210,8 +26503,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26210
26503
  };
26211
26504
 
26212
26505
  // src/components/elements/plan-manager/UsageDetails.tsx
26213
- var import_react59 = require("react");
26214
- var import_jsx_runtime61 = require("react/jsx-runtime");
26506
+ var import_react60 = require("react");
26507
+ var import_jsx_runtime62 = require("react/jsx-runtime");
26215
26508
  var UsageDetails2 = ({
26216
26509
  entitlement,
26217
26510
  period,
@@ -26226,40 +26519,40 @@ var UsageDetails2 = ({
26226
26519
  billingPrice,
26227
26520
  limit,
26228
26521
  cost = 0
26229
- } = (0, import_react59.useMemo)(
26522
+ } = (0, import_react60.useMemo)(
26230
26523
  () => getUsageDetails(entitlement, period, currency, {
26231
26524
  showWarningThresholdAsLimit
26232
26525
  }),
26233
26526
  [entitlement, period, currency, showWarningThresholdAsLimit]
26234
26527
  );
26235
- const description = (0, import_react59.useMemo)(() => {
26528
+ const description = (0, import_react60.useMemo)(() => {
26236
26529
  const acc = [];
26237
26530
  let index = 0;
26238
26531
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
26239
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react59.Fragment, { children: [
26532
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
26240
26533
  t4("Additional"),
26241
26534
  ": "
26242
26535
  ] }, index));
26243
26536
  index += 1;
26244
26537
  }
26245
26538
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
26246
- acc.push(/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_react59.Fragment, { children: t4("Tier-based") }, index));
26539
+ acc.push(/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_react60.Fragment, { children: t4("Tier-based") }, index));
26247
26540
  index += 1;
26248
26541
  }
26249
26542
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
26250
26543
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
26251
26544
  const packageSize = billingPrice?.packageSize ?? 1;
26252
26545
  acc.push(
26253
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react59.Fragment, { children: [
26546
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
26254
26547
  formatCurrency(price, billingPrice?.currency),
26255
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("sub", { children: [
26548
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
26256
26549
  "/",
26257
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26550
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26258
26551
  packageSize,
26259
26552
  " "
26260
26553
  ] }),
26261
26554
  getFeatureName(entitlement.feature, packageSize),
26262
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26555
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26263
26556
  "/",
26264
26557
  shortenPeriod(period)
26265
26558
  ] })
@@ -26270,7 +26563,7 @@ var UsageDetails2 = ({
26270
26563
  }
26271
26564
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
26272
26565
  acc.push(
26273
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_react59.Fragment, { children: [
26566
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_react60.Fragment, { children: [
26274
26567
  formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
26275
26568
  " ",
26276
26569
  getFeatureName(
@@ -26298,7 +26591,7 @@ var UsageDetails2 = ({
26298
26591
  return null;
26299
26592
  }
26300
26593
  const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
26301
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
26594
+ return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26302
26595
  Flex,
26303
26596
  {
26304
26597
  $justifyContent: "space-between",
@@ -26306,13 +26599,13 @@ var UsageDetails2 = ({
26306
26599
  $flexWrap: "wrap",
26307
26600
  $gap: "0.5rem",
26308
26601
  children: [
26309
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26602
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26310
26603
  quantity,
26311
26604
  " ",
26312
26605
  getFeatureName(entitlement.feature, quantity, true)
26313
26606
  ] }) : entitlement.feature.name }),
26314
- /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(Text, { children: [
26315
- description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
26607
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { children: [
26608
+ description.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26316
26609
  Text,
26317
26610
  {
26318
26611
  style: { opacity: 0.54 },
@@ -26323,15 +26616,15 @@ var UsageDetails2 = ({
26323
26616
  ),
26324
26617
  // only show cost for pay-in-advance entitlements
26325
26618
  // `description` will include price for other price behaviors
26326
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
26619
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26327
26620
  " ",
26328
26621
  formatCurrency(cost, billingPrice?.currency),
26329
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("sub", { children: [
26622
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
26330
26623
  "/",
26331
26624
  shortenPeriod(period)
26332
26625
  ] })
26333
26626
  ] }),
26334
- entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
26627
+ entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26335
26628
  PricingTiersTooltip,
26336
26629
  {
26337
26630
  feature: entitlement.feature,
@@ -26341,7 +26634,7 @@ var UsageDetails2 = ({
26341
26634
  tiersMode: billingPrice?.tiersMode ?? void 0
26342
26635
  }
26343
26636
  ),
26344
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
26637
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26345
26638
  HardLimitTooltip,
26346
26639
  {
26347
26640
  feature: entitlement.feature,
@@ -26355,7 +26648,7 @@ var UsageDetails2 = ({
26355
26648
  };
26356
26649
 
26357
26650
  // src/components/elements/plan-manager/PlanManager.tsx
26358
- var import_jsx_runtime62 = require("react/jsx-runtime");
26651
+ var import_jsx_runtime63 = require("react/jsx-runtime");
26359
26652
  var resolveDesignProps7 = (props) => {
26360
26653
  return {
26361
26654
  header: {
@@ -26384,7 +26677,7 @@ var resolveDesignProps7 = (props) => {
26384
26677
  }
26385
26678
  };
26386
26679
  };
26387
- var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal, ...rest }, ref) => {
26680
+ var PlanManager = (0, import_react61.forwardRef)(({ children, className, portal, ...rest }, ref) => {
26388
26681
  const props = resolveDesignProps7(rest);
26389
26682
  const { t: t4 } = useTranslation();
26390
26683
  const { data, settings, setCheckoutState, setLayout } = useEmbed();
@@ -26403,7 +26696,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26403
26696
  showCredits,
26404
26697
  showZeroPriceAsFree,
26405
26698
  trialPaymentMethodRequired
26406
- } = (0, import_react60.useMemo)(() => {
26699
+ } = (0, import_react61.useMemo)(() => {
26407
26700
  const planCreditOrder = /* @__PURE__ */ new Map();
26408
26701
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
26409
26702
  if (!planCreditOrder.has(grant.creditId)) {
@@ -26463,15 +26756,15 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26463
26756
  data?.displaySettings?.showZeroPriceAsFree,
26464
26757
  data?.trialPaymentMethodRequired
26465
26758
  ]);
26466
- const usageBasedEntitlements = (0, import_react60.useMemo)(
26759
+ const usageBasedEntitlements = (0, import_react61.useMemo)(
26467
26760
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
26468
26761
  [featureUsage]
26469
26762
  );
26470
- const planCreditCompositions = (0, import_react60.useMemo)(
26763
+ const planCreditCompositions = (0, import_react61.useMemo)(
26471
26764
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
26472
26765
  [currentPlan?.includedCreditGrants]
26473
26766
  );
26474
- const resolveLicenseQuantity = (0, import_react60.useMemo)(() => {
26767
+ const resolveLicenseQuantity = (0, import_react61.useMemo)(() => {
26475
26768
  return (licenseId) => {
26476
26769
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
26477
26770
  return typeof allocation === "number" ? allocation : void 0;
@@ -26494,7 +26787,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26494
26787
  subscriptionCurrency,
26495
26788
  willSubscriptionCancel,
26496
26789
  isTrialSubscription
26497
- } = (0, import_react60.useMemo)(() => {
26790
+ } = (0, import_react61.useMemo)(() => {
26498
26791
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
26499
26792
  const subscriptionCurrency2 = billingSubscription?.currency;
26500
26793
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -26507,7 +26800,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26507
26800
  };
26508
26801
  }, [billingSubscription]);
26509
26802
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
26510
- const { isFreePlan, isUsageBasedPlan } = (0, import_react60.useMemo)(() => {
26803
+ const { isFreePlan, isUsageBasedPlan } = (0, import_react61.useMemo)(() => {
26511
26804
  const isFreePlan2 = currentPlan?.planPrice === 0;
26512
26805
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
26513
26806
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -26515,8 +26808,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26515
26808
  const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
26516
26809
  (grant) => isSelfServiceAutoTopupAvailable(grant)
26517
26810
  ) ?? false;
26518
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
26519
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26811
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26812
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26520
26813
  Notice,
26521
26814
  {
26522
26815
  as: Flex,
@@ -26526,8 +26819,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26526
26819
  $textAlign: "center",
26527
26820
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26528
26821
  children: [
26529
- typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
26530
- (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26822
+ typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
26823
+ (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26531
26824
  Text,
26532
26825
  {
26533
26826
  as: "p",
@@ -26541,7 +26834,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26541
26834
  )
26542
26835
  ]
26543
26836
  }
26544
- ) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26837
+ ) : willSubscriptionCancel ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26545
26838
  Notice,
26546
26839
  {
26547
26840
  as: Flex,
@@ -26551,8 +26844,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26551
26844
  $textAlign: "center",
26552
26845
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26553
26846
  children: [
26554
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
26555
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26847
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
26848
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26556
26849
  Text,
26557
26850
  {
26558
26851
  as: "p",
@@ -26567,7 +26860,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26567
26860
  )
26568
26861
  ]
26569
26862
  }
26570
- ) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26863
+ ) : customPlanBilling ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26571
26864
  Notice,
26572
26865
  {
26573
26866
  as: Flex,
@@ -26577,19 +26870,19 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26577
26870
  $textAlign: "center",
26578
26871
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26579
26872
  children: [
26580
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
26873
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
26581
26874
  plan: customPlanBilling.planName ?? t4("your plan")
26582
26875
  }) : t4("Custom plan payment due", {
26583
26876
  plan: customPlanBilling.planName ?? t4("your plan"),
26584
26877
  date: toPrettyDate(customPlanBilling.deadline)
26585
26878
  }) }),
26586
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
26879
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
26587
26880
  date: toPrettyDate(customPlanBilling.deadline)
26588
26881
  }) : t4("Custom plan payment due description", {
26589
26882
  plan: customPlanBilling.planName ?? t4("your plan"),
26590
26883
  date: toPrettyDate(customPlanBilling.deadline)
26591
26884
  }) }),
26592
- customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26885
+ customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26593
26886
  Button,
26594
26887
  {
26595
26888
  as: "a",
@@ -26603,7 +26896,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26603
26896
  )
26604
26897
  ]
26605
26898
  }
26606
- ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26899
+ ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26607
26900
  Notice,
26608
26901
  {
26609
26902
  as: Flex,
@@ -26613,10 +26906,10 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
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__ */ (0, import_jsx_runtime62.jsx)(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
26909
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
26617
26910
  plan: data.company.scheduledDowngrade.toPlanName
26618
26911
  }) }),
26619
- typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26912
+ typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26620
26913
  Text,
26621
26914
  {
26622
26915
  as: "p",
@@ -26632,7 +26925,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26632
26925
  ]
26633
26926
  }
26634
26927
  ),
26635
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26928
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26636
26929
  Element,
26637
26930
  {
26638
26931
  as: Flex,
@@ -26641,19 +26934,19 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26641
26934
  $flexDirection: "column",
26642
26935
  $gap: "2rem",
26643
26936
  children: [
26644
- props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
26937
+ props.header.isVisible && currentPlan && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26645
26938
  Flex,
26646
26939
  {
26647
26940
  $justifyContent: "space-between",
26648
26941
  $alignItems: "center",
26649
26942
  $gap: "1rem",
26650
26943
  children: [
26651
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
26652
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
26653
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
26944
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
26945
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
26946
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
26654
26947
  ] }),
26655
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Box, { children: [
26656
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26948
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Box, { children: [
26949
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26657
26950
  Text,
26658
26951
  {
26659
26952
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -26663,7 +26956,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26663
26956
  )
26664
26957
  }
26665
26958
  ),
26666
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("sub", { children: [
26959
+ !isFreePlan && currentPlanPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
26667
26960
  "/",
26668
26961
  shortenPeriod(currentPlanPeriod)
26669
26962
  ] }) })
@@ -26671,8 +26964,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26671
26964
  ]
26672
26965
  }
26673
26966
  ),
26674
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26675
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26967
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26968
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26676
26969
  Text,
26677
26970
  {
26678
26971
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26680,7 +26973,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26680
26973
  children: t4("Add-ons")
26681
26974
  }
26682
26975
  ),
26683
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26976
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26684
26977
  AddOn,
26685
26978
  {
26686
26979
  addOn,
@@ -26691,8 +26984,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26691
26984
  addOnIndex
26692
26985
  )) })
26693
26986
  ] }),
26694
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26695
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26987
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26988
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26696
26989
  Text,
26697
26990
  {
26698
26991
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26700,8 +26993,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26700
26993
  children: t4("Usage-based")
26701
26994
  }
26702
26995
  ),
26703
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
26704
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
26996
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
26997
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26705
26998
  UsageDetails2,
26706
26999
  {
26707
27000
  entitlement,
@@ -26714,8 +27007,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26714
27007
  );
26715
27008
  }) })
26716
27009
  ] }),
26717
- props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26718
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27010
+ props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27011
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26719
27012
  Text,
26720
27013
  {
26721
27014
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26723,7 +27016,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26723
27016
  children: t4("Credits in plan")
26724
27017
  }
26725
27018
  ),
26726
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
27019
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
26727
27020
  const planCreditGrant = currentPlan?.includedCreditGrants.find(
26728
27021
  (grant) => grant.creditId === group.id
26729
27022
  );
@@ -26746,13 +27039,13 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26746
27039
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
26747
27040
  const creditPeriod = composition.period ?? subscriptionInterval;
26748
27041
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
26749
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27042
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26750
27043
  Flex,
26751
27044
  {
26752
27045
  $flexDirection: "column",
26753
27046
  $gap: "0.25rem",
26754
27047
  children: [
26755
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27048
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26756
27049
  Flex,
26757
27050
  {
26758
27051
  $justifyContent: "space-between",
@@ -26760,7 +27053,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26760
27053
  $flexWrap: "wrap",
26761
27054
  $gap: "0.5rem",
26762
27055
  children: [
26763
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27056
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26764
27057
  t4("X credits per license", {
26765
27058
  amount: perLicenseGrant.amount,
26766
27059
  creditName: getFeatureName(
@@ -26769,7 +27062,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26769
27062
  ),
26770
27063
  licenseName: getFeatureName(licenseFeature, 1)
26771
27064
  }),
26772
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27065
+ composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26773
27066
  " ",
26774
27067
  t4("Plus X credits per period", {
26775
27068
  amount: composition.fixedQuantity,
@@ -26780,18 +27073,18 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26780
27073
  period: t4(creditPeriod)
26781
27074
  })
26782
27075
  ] })
26783
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27076
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26784
27077
  group.total.value,
26785
27078
  " ",
26786
27079
  getFeatureName(group, group.total.value),
26787
27080
  " ",
26788
- subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
27081
+ subscriptionInterval && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
26789
27082
  t4("per"),
26790
27083
  " ",
26791
27084
  t4(subscriptionInterval)
26792
27085
  ] })
26793
27086
  ] }) }),
26794
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27087
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26795
27088
  Text,
26796
27089
  {
26797
27090
  style: { opacity: 0.54 },
@@ -26801,7 +27094,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26801
27094
  group.total.used,
26802
27095
  " ",
26803
27096
  t4("used"),
26804
- hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27097
+ hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26805
27098
  AutoTopupNotice,
26806
27099
  {
26807
27100
  thresholdCredits,
@@ -26814,7 +27107,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26814
27107
  ]
26815
27108
  }
26816
27109
  ),
26817
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27110
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26818
27111
  Text,
26819
27112
  {
26820
27113
  style: { opacity: 0.54 },
@@ -26855,7 +27148,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26855
27148
  groupIndex
26856
27149
  );
26857
27150
  }) }),
26858
- planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27151
+ planCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26859
27152
  ExpandListToggle,
26860
27153
  {
26861
27154
  isExpanded: planCredits.isExpanded,
@@ -26864,7 +27157,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26864
27157
  $marginTop: "0.5rem"
26865
27158
  }
26866
27159
  ),
26867
- hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27160
+ hasAutoTopupSelfService && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26868
27161
  Flex,
26869
27162
  {
26870
27163
  $justifyContent: "space-between",
@@ -26874,8 +27167,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26874
27167
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26875
27168
  $borderRadius: "0.5rem",
26876
27169
  children: [
26877
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26878
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
27170
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27171
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
26879
27172
  currentPlan?.includedCreditGrants.reduce(
26880
27173
  (acc, grant) => {
26881
27174
  if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
@@ -26884,7 +27177,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26884
27177
  const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
26885
27178
  if (!autoTopupEnabled) {
26886
27179
  acc.push(
26887
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
27180
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
26888
27181
  unit: getFeatureName(grant.credit, 1)
26889
27182
  }) }, grant.id)
26890
27183
  );
@@ -26894,7 +27187,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26894
27187
  const autoTopupAmount = getAutoTopupAmount(grant);
26895
27188
  if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
26896
27189
  acc.push(
26897
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
27190
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
26898
27191
  unit: getFeatureName(
26899
27192
  grant.credit,
26900
27193
  autoTopupAmount
@@ -26909,7 +27202,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26909
27202
  []
26910
27203
  )
26911
27204
  ] }),
26912
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27205
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26913
27206
  Button,
26914
27207
  {
26915
27208
  type: "button",
@@ -26926,8 +27219,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26926
27219
  }
26927
27220
  )
26928
27221
  ] }),
26929
- props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26930
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27222
+ props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27223
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26931
27224
  Text,
26932
27225
  {
26933
27226
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26935,9 +27228,9 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26935
27228
  children: t4("Top-ups")
26936
27229
  }
26937
27230
  ),
26938
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
27231
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
26939
27232
  const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
26940
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27233
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26941
27234
  Flex,
26942
27235
  {
26943
27236
  $justifyContent: "space-between",
@@ -26945,8 +27238,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26945
27238
  $flexWrap: "wrap",
26946
27239
  $gap: "0.5rem",
26947
27240
  children: [
26948
- bundle ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
26949
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27241
+ bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27242
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
26950
27243
  "(",
26951
27244
  group.grants.length,
26952
27245
  ")",
@@ -26958,8 +27251,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26958
27251
  " ",
26959
27252
  getFeatureName(group, group.quantity),
26960
27253
  ")"
26961
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
26962
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27254
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27255
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
26963
27256
  "(",
26964
27257
  group.grants.length,
26965
27258
  ")",
@@ -26969,7 +27262,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26969
27262
  " ",
26970
27263
  getFeatureName(group, group.quantity)
26971
27264
  ] }),
26972
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27265
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
26973
27266
  Text,
26974
27267
  {
26975
27268
  style: { opacity: 0.54 },
@@ -26987,7 +27280,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26987
27280
  groupIndex
26988
27281
  );
26989
27282
  }) }),
26990
- autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27283
+ autoTopupCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
26991
27284
  ExpandListToggle,
26992
27285
  {
26993
27286
  isExpanded: autoTopupCredits.isExpanded,
@@ -26997,8 +27290,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
26997
27290
  }
26998
27291
  )
26999
27292
  ] }),
27000
- props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27001
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27293
+ props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27294
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27002
27295
  Text,
27003
27296
  {
27004
27297
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27006,9 +27299,9 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27006
27299
  children: t4("Credit bundles")
27007
27300
  }
27008
27301
  ),
27009
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
27302
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
27010
27303
  const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
27011
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27304
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27012
27305
  Flex,
27013
27306
  {
27014
27307
  $justifyContent: "space-between",
@@ -27016,8 +27309,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27016
27309
  $flexWrap: "wrap",
27017
27310
  $gap: "0.5rem",
27018
27311
  children: [
27019
- bundle ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27020
- group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27312
+ bundle ? /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27313
+ group.grants.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { style: { opacity: 0.5 }, children: [
27021
27314
  "(",
27022
27315
  group.grants.length,
27023
27316
  ")",
@@ -27029,12 +27322,12 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27029
27322
  " ",
27030
27323
  getFeatureName(group, group.quantity),
27031
27324
  ")"
27032
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27325
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27033
27326
  group.quantity,
27034
27327
  " ",
27035
27328
  getFeatureName(group, group.quantity)
27036
27329
  ] }),
27037
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27330
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27038
27331
  Text,
27039
27332
  {
27040
27333
  style: { opacity: 0.54 },
@@ -27052,7 +27345,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27052
27345
  groupIndex
27053
27346
  );
27054
27347
  }) }),
27055
- bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27348
+ bundleCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27056
27349
  ExpandListToggle,
27057
27350
  {
27058
27351
  isExpanded: bundleCredits.isExpanded,
@@ -27062,8 +27355,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27062
27355
  }
27063
27356
  )
27064
27357
  ] }),
27065
- props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27066
- props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27358
+ props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27359
+ props.addOns.showLabel && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27067
27360
  Text,
27068
27361
  {
27069
27362
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27071,8 +27364,8 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27071
27364
  children: t4("Promotional credits")
27072
27365
  }
27073
27366
  ),
27074
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27075
- return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27367
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27368
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27076
27369
  Flex,
27077
27370
  {
27078
27371
  $justifyContent: "space-between",
@@ -27080,12 +27373,12 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27080
27373
  $flexWrap: "wrap",
27081
27374
  $gap: "0.5rem",
27082
27375
  children: [
27083
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27376
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Text, { display: props.addOns.fontStyle, children: [
27084
27377
  group.quantity,
27085
27378
  " ",
27086
27379
  getFeatureName(group, group.quantity)
27087
27380
  ] }),
27088
- group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
27381
+ group.total.used > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27089
27382
  Text,
27090
27383
  {
27091
27384
  style: { opacity: 0.54 },
@@ -27103,7 +27396,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27103
27396
  groupIndex
27104
27397
  );
27105
27398
  }) }),
27106
- promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27399
+ promotionalCredits.canExpand && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27107
27400
  ExpandListToggle,
27108
27401
  {
27109
27402
  isExpanded: promotionalCredits.isExpanded,
@@ -27113,7 +27406,7 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27113
27406
  }
27114
27407
  )
27115
27408
  ] }),
27116
- canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
27409
+ canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27117
27410
  Button,
27118
27411
  {
27119
27412
  type: "button",
@@ -27134,11 +27427,11 @@ var PlanManager = (0, import_react60.forwardRef)(({ children, className, portal,
27134
27427
  PlanManager.displayName = "PlanManager";
27135
27428
 
27136
27429
  // src/components/elements/pricing-table/PricingTable.tsx
27137
- var import_react63 = require("react");
27430
+ var import_react64 = require("react");
27138
27431
 
27139
27432
  // src/components/elements/pricing-table/AddOn.tsx
27140
- var import_react61 = require("react");
27141
- var import_jsx_runtime63 = require("react/jsx-runtime");
27433
+ var import_react62 = require("react");
27434
+ var import_jsx_runtime64 = require("react/jsx-runtime");
27142
27435
  function renderMeteredEntitlementPricing2({
27143
27436
  priceBehavior,
27144
27437
  softLimit,
@@ -27150,7 +27443,7 @@ function renderMeteredEntitlementPricing2({
27150
27443
  isTiered
27151
27444
  }) {
27152
27445
  if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
27153
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27446
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27154
27447
  "Additional: ",
27155
27448
  formatCurrency(price, currency),
27156
27449
  "/",
@@ -27161,13 +27454,13 @@ function renderMeteredEntitlementPricing2({
27161
27454
  ] });
27162
27455
  }
27163
27456
  if (isTiered) {
27164
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: "Tier-based pricing" });
27457
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: "Tier-based pricing" });
27165
27458
  }
27166
27459
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
27167
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27460
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27168
27461
  formatCurrency(price, currency),
27169
27462
  "/",
27170
- packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27463
+ packageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27171
27464
  packageSize,
27172
27465
  " "
27173
27466
  ] }),
@@ -27193,7 +27486,7 @@ var AddOn2 = ({
27193
27486
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27194
27487
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27195
27488
  const isLightBackground = useIsLightBackground();
27196
- const { currentAddOns, canCheckout, isStandalone } = (0, import_react61.useMemo)(() => {
27489
+ const { currentAddOns, canCheckout, isStandalone } = (0, import_react62.useMemo)(() => {
27197
27490
  const isStandalone2 = typeof data?.component === "undefined";
27198
27491
  return {
27199
27492
  currentAddOns: data?.company?.addOns || [],
@@ -27236,7 +27529,7 @@ var AddOn2 = ({
27236
27529
  isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
27237
27530
  };
27238
27531
  }) || [];
27239
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27532
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27240
27533
  Flex,
27241
27534
  {
27242
27535
  as: "li",
@@ -27256,7 +27549,7 @@ var AddOn2 = ({
27256
27549
  $boxShadow: cardBoxShadow
27257
27550
  },
27258
27551
  children: [
27259
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27552
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27260
27553
  Flex,
27261
27554
  {
27262
27555
  $flexDirection: "column",
@@ -27267,7 +27560,7 @@ var AddOn2 = ({
27267
27560
  $borderStyle: "solid",
27268
27561
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27269
27562
  children: [
27270
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27563
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27271
27564
  Text,
27272
27565
  {
27273
27566
  as: "h3",
@@ -27276,22 +27569,22 @@ var AddOn2 = ({
27276
27569
  children: addOn.name
27277
27570
  }
27278
27571
  ) }),
27279
- layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27280
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27572
+ layout.addOns.showDescription && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27573
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27281
27574
  Text,
27282
27575
  {
27283
27576
  "data-testid": "sch-addon-price",
27284
27577
  display: layout.plans.name.fontStyle,
27285
- children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(import_jsx_runtime63.Fragment, { children: [
27578
+ children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27286
27579
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
27287
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("sub", { children: [
27580
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("sub", { children: [
27288
27581
  "/",
27289
27582
  selectedPeriod
27290
27583
  ] })
27291
27584
  ] })
27292
27585
  }
27293
27586
  ) }),
27294
- isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27587
+ isActiveAddOn && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27295
27588
  Flex,
27296
27589
  {
27297
27590
  "data-testid": "sch-addon-active",
@@ -27301,7 +27594,7 @@ var AddOn2 = ({
27301
27594
  $backgroundColor: settings.theme.primary,
27302
27595
  $borderRadius: "9999px",
27303
27596
  $padding: "0.125rem 0.85rem",
27304
- children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27597
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27305
27598
  Text,
27306
27599
  {
27307
27600
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -27314,7 +27607,7 @@ var AddOn2 = ({
27314
27607
  ]
27315
27608
  }
27316
27609
  ),
27317
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27610
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27318
27611
  Flex,
27319
27612
  {
27320
27613
  $flexDirection: "column",
@@ -27323,7 +27616,7 @@ var AddOn2 = ({
27323
27616
  $flexGrow: 1,
27324
27617
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
27325
27618
  children: [
27326
- layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27619
+ layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27327
27620
  Flex,
27328
27621
  {
27329
27622
  as: "ul",
@@ -27335,7 +27628,7 @@ var AddOn2 = ({
27335
27628
  $listStyle: "none",
27336
27629
  children: displayableEntitlements.map((entitlement, idx) => {
27337
27630
  if (entitlement.isUnlimited) {
27338
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27631
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27339
27632
  Flex,
27340
27633
  {
27341
27634
  as: "li",
@@ -27344,8 +27637,8 @@ var AddOn2 = ({
27344
27637
  $alignItems: "center",
27345
27638
  $gap: "1rem",
27346
27639
  children: [
27347
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $gap: "1rem", children: [
27348
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27640
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
27641
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27349
27642
  Icon3,
27350
27643
  {
27351
27644
  name: entitlement.feature.icon,
@@ -27354,16 +27647,16 @@ var AddOn2 = ({
27354
27647
  rounded: true
27355
27648
  }
27356
27649
  ),
27357
- entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27650
+ entitlement.feature && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27358
27651
  Flex,
27359
27652
  {
27360
27653
  $flexDirection: "column",
27361
27654
  $justifyContent: "center",
27362
- children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { children: getFeatureName(entitlement.feature) })
27655
+ children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: getFeatureName(entitlement.feature) })
27363
27656
  }
27364
27657
  )
27365
27658
  ] }),
27366
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27659
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27367
27660
  Text,
27368
27661
  {
27369
27662
  style: { opacity: 0.54 },
@@ -27378,7 +27671,7 @@ var AddOn2 = ({
27378
27671
  );
27379
27672
  }
27380
27673
  const meteredEntitlement = entitlement;
27381
- return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
27674
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27382
27675
  Flex,
27383
27676
  {
27384
27677
  as: "li",
@@ -27388,8 +27681,8 @@ var AddOn2 = ({
27388
27681
  $gap: "1rem",
27389
27682
  $listStyle: "none",
27390
27683
  children: [
27391
- /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Flex, { $gap: "1rem", children: [
27392
- meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27684
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $gap: "1rem", children: [
27685
+ meteredEntitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27393
27686
  Icon3,
27394
27687
  {
27395
27688
  "data-testid": "sch-feature-icon",
@@ -27399,9 +27692,9 @@ var AddOn2 = ({
27399
27692
  rounded: true
27400
27693
  }
27401
27694
  ),
27402
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
27695
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
27403
27696
  ] }),
27404
- /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27697
+ /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27405
27698
  Text,
27406
27699
  {
27407
27700
  style: { opacity: 0.54 },
@@ -27417,7 +27710,7 @@ var AddOn2 = ({
27417
27710
  })
27418
27711
  }
27419
27712
  ),
27420
- sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
27713
+ sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27421
27714
  Button,
27422
27715
  {
27423
27716
  type: "button",
@@ -27456,10 +27749,10 @@ var AddOn2 = ({
27456
27749
  };
27457
27750
 
27458
27751
  // src/components/elements/pricing-table/Plan.tsx
27459
- var import_react62 = require("react");
27752
+ var import_react63 = require("react");
27460
27753
 
27461
27754
  // src/components/elements/pricing-table/Entitlement.tsx
27462
- var import_jsx_runtime64 = require("react/jsx-runtime");
27755
+ var import_jsx_runtime65 = require("react/jsx-runtime");
27463
27756
  var Entitlement2 = ({
27464
27757
  entitlement,
27465
27758
  sharedProps,
@@ -27493,8 +27786,8 @@ var Entitlement2 = ({
27493
27786
  entitlement,
27494
27787
  credits
27495
27788
  );
27496
- return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
27497
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27789
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
27790
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27498
27791
  Icon3,
27499
27792
  {
27500
27793
  "data-testid": "sch-feature-icon",
@@ -27504,31 +27797,31 @@ var Entitlement2 = ({
27504
27797
  rounded: true
27505
27798
  }
27506
27799
  ),
27507
- entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27508
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
27509
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27800
+ entitlement.feature?.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27801
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
27802
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27510
27803
  formatCurrency(entitlementPrice, entitlementCurrency),
27511
27804
  " ",
27512
27805
  t4("per"),
27513
27806
  " ",
27514
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27807
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27515
27808
  formatNumber(entitlementPackageSize),
27516
27809
  " "
27517
27810
  ] }),
27518
27811
  getFeatureName(entitlement.feature, entitlementPackageSize),
27519
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27812
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27520
27813
  " ",
27521
27814
  t4("per"),
27522
27815
  " ",
27523
27816
  selectedPeriod
27524
27817
  ] })
27525
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27818
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27526
27819
  TieredPricingDetails,
27527
27820
  {
27528
27821
  entitlement,
27529
27822
  period: selectedPeriod
27530
27823
  }
27531
- ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27824
+ ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27532
27825
  formatConsumptionRate(entitlement.consumptionRate),
27533
27826
  " ",
27534
27827
  getFeatureName(
@@ -27539,7 +27832,7 @@ var Entitlement2 = ({
27539
27832
  t4("per"),
27540
27833
  " ",
27541
27834
  getFeatureName(entitlement.feature, 1)
27542
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
27835
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
27543
27836
  amount: formatNumber(creditBasedEntitlementLimit.limit),
27544
27837
  units: getFeatureName(
27545
27838
  entitlement.feature,
@@ -27552,25 +27845,25 @@ var Entitlement2 = ({
27552
27845
  entitlement.feature,
27553
27846
  creditBasedEntitlementLimit.limit
27554
27847
  )
27555
- }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27848
+ }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27556
27849
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
27557
27850
  item: getFeatureName(entitlement.feature)
27558
- }) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27559
- typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27851
+ }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27852
+ typeof limit === "number" && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27560
27853
  formatNumber(limit),
27561
27854
  " "
27562
27855
  ] }),
27563
27856
  getFeatureName(entitlement.feature, limit)
27564
27857
  ] }),
27565
- metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27858
+ metricPeriodName && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27566
27859
  " ",
27567
27860
  t4("per"),
27568
27861
  " ",
27569
27862
  t4(metricPeriodName)
27570
27863
  ] })
27571
27864
  ] }) : entitlement.feature.name }),
27572
- /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Text, { children: [
27573
- entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_jsx_runtime64.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
27865
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Text, { children: [
27866
+ entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_jsx_runtime65.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
27574
27867
  Text,
27575
27868
  {
27576
27869
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27580,7 +27873,7 @@ var Entitlement2 = ({
27580
27873
  " ",
27581
27874
  formatCurrency(entitlementPrice, entitlementCurrency),
27582
27875
  "/",
27583
- entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27876
+ entitlementPackageSize > 1 && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27584
27877
  formatNumber(entitlementPackageSize),
27585
27878
  " "
27586
27879
  ] }),
@@ -27588,14 +27881,14 @@ var Entitlement2 = ({
27588
27881
  entitlement.feature,
27589
27882
  entitlementPackageSize
27590
27883
  ),
27591
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27884
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27592
27885
  "/",
27593
27886
  shortenPeriod(selectedPeriod)
27594
27887
  ] })
27595
27888
  ]
27596
27889
  }
27597
- ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
27598
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27890
+ ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [
27891
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27599
27892
  Text,
27600
27893
  {
27601
27894
  style: { opacity: 0.54 },
@@ -27604,7 +27897,7 @@ var Entitlement2 = ({
27604
27897
  children: t4("Tier-based")
27605
27898
  }
27606
27899
  ),
27607
- /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27900
+ /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27608
27901
  PricingTiersTooltip,
27609
27902
  {
27610
27903
  feature: entitlement.feature,
@@ -27615,14 +27908,14 @@ var Entitlement2 = ({
27615
27908
  }
27616
27909
  )
27617
27910
  ] }),
27618
- entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27911
+ entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27619
27912
  HardLimitTooltip,
27620
27913
  {
27621
27914
  feature: entitlement.feature,
27622
27915
  limit: entitlement.valueNumeric
27623
27916
  }
27624
27917
  ),
27625
- entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27918
+ entitlement.billingThreshold && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27626
27919
  BillingThresholdTooltip,
27627
27920
  {
27628
27921
  billingThreshold: entitlement.billingThreshold
@@ -27630,7 +27923,7 @@ var Entitlement2 = ({
27630
27923
  )
27631
27924
  ] })
27632
27925
  ] }),
27633
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
27926
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
27634
27927
  Text,
27635
27928
  {
27636
27929
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27643,7 +27936,7 @@ var Entitlement2 = ({
27643
27936
  };
27644
27937
 
27645
27938
  // src/components/elements/pricing-table/Plan.tsx
27646
- var import_jsx_runtime65 = require("react/jsx-runtime");
27939
+ var import_jsx_runtime66 = require("react/jsx-runtime");
27647
27940
  var Plan2 = ({
27648
27941
  plan,
27649
27942
  index,
@@ -27657,7 +27950,7 @@ var Plan2 = ({
27657
27950
  const { data, settings, setCheckoutState } = useEmbed();
27658
27951
  const isLightBackground = useIsLightBackground();
27659
27952
  const trialEnd = useTrialEnd();
27660
- const [entitlementVisibility, setEntitlementVisibility] = (0, import_react62.useState)({});
27953
+ const [entitlementVisibility, setEntitlementVisibility] = (0, import_react63.useState)({});
27661
27954
  const handleToggleShowAll = (id) => {
27662
27955
  setEntitlementVisibility((prev2) => {
27663
27956
  const updated = !(prev2[id] ?? false);
@@ -27686,7 +27979,7 @@ var Plan2 = ({
27686
27979
  const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
27687
27980
  const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
27688
27981
  const isExpanded = entitlementVisibility[plan.id] ?? false;
27689
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
27982
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27690
27983
  Flex,
27691
27984
  {
27692
27985
  as: "li",
@@ -27706,7 +27999,7 @@ var Plan2 = ({
27706
27999
  $boxShadow: cardBoxShadow
27707
28000
  },
27708
28001
  children: [
27709
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28002
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27710
28003
  Flex,
27711
28004
  {
27712
28005
  $flexDirection: "column",
@@ -27717,7 +28010,7 @@ var Plan2 = ({
27717
28010
  $borderStyle: "solid",
27718
28011
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27719
28012
  children: [
27720
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28013
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27721
28014
  Text,
27722
28015
  {
27723
28016
  as: "h3",
@@ -27726,8 +28019,8 @@ var Plan2 = ({
27726
28019
  children: plan.name
27727
28020
  }
27728
28021
  ) }),
27729
- layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
27730
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28022
+ layout.plans.description.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
28023
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27731
28024
  Text,
27732
28025
  {
27733
28026
  "data-testid": "sch-plan-price",
@@ -27743,14 +28036,14 @@ var Plan2 = ({
27743
28036
  currency: planCurrency,
27744
28037
  testSignificantDigits: false
27745
28038
  }) : formatCurrency(planPrice ?? 0, planCurrency),
27746
- !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("sub", { children: [
28039
+ !plan.custom && !isFreePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("sub", { children: [
27747
28040
  "/",
27748
28041
  showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
27749
28042
  ] })
27750
28043
  ]
27751
28044
  }
27752
28045
  ) }),
27753
- showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28046
+ showCredits && credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27754
28047
  Flex,
27755
28048
  {
27756
28049
  as: "ul",
@@ -27762,8 +28055,8 @@ var Plan2 = ({
27762
28055
  $margin: 0,
27763
28056
  $listStyle: "none",
27764
28057
  children: credits.map((credit, idx) => {
27765
- return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
27766
- layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28058
+ return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
28059
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27767
28060
  Icon3,
27768
28061
  {
27769
28062
  "data-testid": "sch-feature-icon",
@@ -27773,13 +28066,13 @@ var Plan2 = ({
27773
28066
  rounded: true
27774
28067
  }
27775
28068
  ),
27776
- credit.name && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28069
+ credit.name && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27777
28070
  Flex,
27778
28071
  {
27779
28072
  $flexDirection: "column",
27780
28073
  $justifyContent: "center",
27781
28074
  $gap: "0.5rem",
27782
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28075
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27783
28076
  PlanCreditText,
27784
28077
  {
27785
28078
  credit,
@@ -27792,7 +28085,7 @@ var Plan2 = ({
27792
28085
  })
27793
28086
  }
27794
28087
  ),
27795
- isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28088
+ isActivePlan && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27796
28089
  Flex,
27797
28090
  {
27798
28091
  "data-testid": "sch-plan-active",
@@ -27802,7 +28095,7 @@ var Plan2 = ({
27802
28095
  $backgroundColor: settings.theme.primary,
27803
28096
  $borderRadius: "9999px",
27804
28097
  $padding: "0.125rem 0.85rem",
27805
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28098
+ children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27806
28099
  Text,
27807
28100
  {
27808
28101
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -27815,7 +28108,7 @@ var Plan2 = ({
27815
28108
  ]
27816
28109
  }
27817
28110
  ),
27818
- /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28111
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27819
28112
  Flex,
27820
28113
  {
27821
28114
  $flexDirection: "column",
@@ -27824,7 +28117,7 @@ var Plan2 = ({
27824
28117
  $gap: `${cardPadding}rem`,
27825
28118
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
27826
28119
  children: [
27827
- layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28120
+ layout.plans.showEntitlements && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27828
28121
  Flex,
27829
28122
  {
27830
28123
  as: "ul",
@@ -27835,14 +28128,14 @@ var Plan2 = ({
27835
28128
  $margin: 0,
27836
28129
  $listStyle: "none",
27837
28130
  children: [
27838
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { children: t4("Everything in", {
28131
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { children: t4("Everything in", {
27839
28132
  plan: plans[index - 1].name
27840
28133
  }) }) }),
27841
28134
  (plan.entitlements ?? []).reduce(
27842
28135
  (acc, entitlement, idx) => {
27843
28136
  if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
27844
28137
  acc.push(
27845
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28138
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27846
28139
  Entitlement2,
27847
28140
  {
27848
28141
  entitlement,
@@ -27860,7 +28153,7 @@ var Plan2 = ({
27860
28153
  },
27861
28154
  []
27862
28155
  ),
27863
- (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28156
+ (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27864
28157
  ExpandListToggle,
27865
28158
  {
27866
28159
  as: "li",
@@ -27875,7 +28168,7 @@ var Plan2 = ({
27875
28168
  ]
27876
28169
  }
27877
28170
  ),
27878
- isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
28171
+ isActivePlan ? /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
27879
28172
  Flex,
27880
28173
  {
27881
28174
  $justifyContent: "center",
@@ -27883,7 +28176,7 @@ var Plan2 = ({
27883
28176
  $gap: "0.25rem",
27884
28177
  $padding: "0.625rem 0",
27885
28178
  children: [
27886
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28179
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27887
28180
  Icon3,
27888
28181
  {
27889
28182
  name: "check-rounded",
@@ -27891,11 +28184,11 @@ var Plan2 = ({
27891
28184
  color: settings.theme.primary
27892
28185
  }
27893
28186
  ),
27894
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
28187
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
27895
28188
  ]
27896
28189
  }
27897
- ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27898
- /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
28190
+ ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
28191
+ /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
27899
28192
  Button,
27900
28193
  {
27901
28194
  type: "button",
@@ -27933,10 +28226,10 @@ var Plan2 = ({
27933
28226
  }
27934
28227
  },
27935
28228
  $fullWidth: true,
27936
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
28229
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
27937
28230
  }
27938
28231
  ),
27939
- !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(UsageViolationText, { violations: plan.usageViolations })
28232
+ !plan.valid && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(UsageViolationText, { violations: plan.usageViolations })
27940
28233
  ] })
27941
28234
  ]
27942
28235
  }
@@ -27947,7 +28240,7 @@ var Plan2 = ({
27947
28240
  };
27948
28241
 
27949
28242
  // src/components/elements/pricing-table/PricingTable.tsx
27950
- var import_jsx_runtime66 = require("react/jsx-runtime");
28243
+ var import_jsx_runtime67 = require("react/jsx-runtime");
27951
28244
  var resolveDesignProps8 = (props) => {
27952
28245
  return {
27953
28246
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -27990,11 +28283,11 @@ var resolveDesignProps8 = (props) => {
27990
28283
  }
27991
28284
  };
27992
28285
  };
27993
- var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref) => {
28286
+ var PricingTable = (0, import_react64.forwardRef)(({ className, ...rest }, ref) => {
27994
28287
  const props = resolveDesignProps8(rest);
27995
28288
  const { t: t4 } = useTranslation();
27996
28289
  const { data, settings, isPending, hydratePublic, currencyFilter } = useEmbed();
27997
- const getCallToActionTarget = (0, import_react63.useCallback)(
28290
+ const getCallToActionTarget = (0, import_react64.useCallback)(
27998
28291
  (url, target) => {
27999
28292
  if (target) {
28000
28293
  return target;
@@ -28012,11 +28305,11 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28012
28305
  },
28013
28306
  []
28014
28307
  );
28015
- const [selectedPeriod, setSelectedPeriod] = (0, import_react63.useState)(
28308
+ const [selectedPeriod, setSelectedPeriod] = (0, import_react64.useState)(
28016
28309
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
28017
28310
  );
28018
28311
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
28019
- const [selectedCurrency, setSelectedCurrency] = (0, import_react63.useState)(
28312
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react64.useState)(
28020
28313
  () => currencies[0] ?? DEFAULT_CURRENCY
28021
28314
  );
28022
28315
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -28034,25 +28327,25 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28034
28327
  } = useAvailablePlans(selectedPeriod, {
28035
28328
  useSelectedPeriod: showPeriodToggle
28036
28329
  });
28037
- const plans = (0, import_react63.useMemo)(
28330
+ const plans = (0, import_react64.useMemo)(
28038
28331
  () => hasCurrency ? allPlans.filter(
28039
28332
  (plan) => planSupportsCurrency(plan, selectedCurrency)
28040
28333
  ) : allPlans,
28041
28334
  [allPlans, hasCurrency, selectedCurrency]
28042
28335
  );
28043
- const addOns = (0, import_react63.useMemo)(
28336
+ const addOns = (0, import_react64.useMemo)(
28044
28337
  () => hasCurrency ? allAddOns.filter(
28045
28338
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
28046
28339
  ) : allAddOns,
28047
28340
  [allAddOns, hasCurrency, selectedCurrency]
28048
28341
  );
28049
- (0, import_react63.useEffect)(() => {
28342
+ (0, import_react64.useEffect)(() => {
28050
28343
  if (typeof data?.component === "undefined") {
28051
28344
  hydratePublic();
28052
28345
  }
28053
28346
  }, [data?.component, hydratePublic]);
28054
28347
  if (isPending) {
28055
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28348
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28056
28349
  Flex,
28057
28350
  {
28058
28351
  $width: "100%",
@@ -28060,12 +28353,12 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28060
28353
  $alignItems: "center",
28061
28354
  $justifyContent: "center",
28062
28355
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
28063
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
28356
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Loader, { "aria-label": "loading", $size: "2xl" })
28064
28357
  }
28065
28358
  );
28066
28359
  }
28067
28360
  if (hasNoUsableCurrency) {
28068
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28361
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Container, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28069
28362
  }
28070
28363
  const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
28071
28364
  const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
@@ -28073,8 +28366,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28073
28366
  rest.callToActionUrl,
28074
28367
  rest.callToActionTarget
28075
28368
  );
28076
- const Wrapper = typeof data?.component === "undefined" ? Container : import_react63.Fragment;
28077
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28369
+ const Wrapper = typeof data?.component === "undefined" ? Container : import_react64.Fragment;
28370
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Wrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
28078
28371
  FussyChild,
28079
28372
  {
28080
28373
  ref,
@@ -28084,8 +28377,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28084
28377
  $flexDirection: "column",
28085
28378
  $gap: "2rem",
28086
28379
  children: [
28087
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Box, { children: [
28088
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(
28380
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Box, { children: [
28381
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
28089
28382
  Flex,
28090
28383
  {
28091
28384
  $flexDirection: "column",
@@ -28100,7 +28393,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28100
28393
  }
28101
28394
  },
28102
28395
  children: [
28103
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28396
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28104
28397
  Text,
28105
28398
  {
28106
28399
  as: "h2",
@@ -28109,8 +28402,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28109
28402
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
28110
28403
  }
28111
28404
  ),
28112
- /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28113
- showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28405
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28406
+ showCurrencySelector && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28114
28407
  CurrencyToggle,
28115
28408
  {
28116
28409
  currencies,
@@ -28118,7 +28411,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28118
28411
  onSelect: setSelectedCurrency
28119
28412
  }
28120
28413
  ),
28121
- showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28414
+ showPeriodToggle && periods.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28122
28415
  PeriodToggle,
28123
28416
  {
28124
28417
  options: periods,
@@ -28135,7 +28428,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28135
28428
  ]
28136
28429
  }
28137
28430
  ),
28138
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28431
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28139
28432
  Box,
28140
28433
  {
28141
28434
  as: "ul",
@@ -28148,7 +28441,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28148
28441
  $listStyle: "none",
28149
28442
  children: plans.map((plan, index, self2) => {
28150
28443
  const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28151
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28444
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28152
28445
  Plan2,
28153
28446
  {
28154
28447
  plan,
@@ -28170,14 +28463,14 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28170
28463
  }
28171
28464
  )
28172
28465
  ] }),
28173
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
28174
- props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28466
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [
28467
+ props.header.isVisible && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28175
28468
  Flex,
28176
28469
  {
28177
28470
  $justifyContent: "space-between",
28178
28471
  $alignItems: "center",
28179
28472
  $marginBottom: "1rem",
28180
- children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28473
+ children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28181
28474
  Text,
28182
28475
  {
28183
28476
  as: "h2",
@@ -28188,7 +28481,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28188
28481
  )
28189
28482
  }
28190
28483
  ),
28191
- /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28484
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28192
28485
  Box,
28193
28486
  {
28194
28487
  as: "ul",
@@ -28200,7 +28493,7 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28200
28493
  $listStyle: "none",
28201
28494
  children: addOns.map((addOn, index) => {
28202
28495
  const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28203
- return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
28496
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28204
28497
  AddOn2,
28205
28498
  {
28206
28499
  addOn,
@@ -28227,8 +28520,8 @@ var PricingTable = (0, import_react63.forwardRef)(({ className, ...rest }, ref)
28227
28520
  PricingTable.displayName = "PricingTable";
28228
28521
 
28229
28522
  // src/components/elements/text/Text.tsx
28230
- var import_react64 = require("react");
28231
- var import_jsx_runtime67 = require("react/jsx-runtime");
28523
+ var import_react65 = require("react");
28524
+ var import_jsx_runtime68 = require("react/jsx-runtime");
28232
28525
  var resolveDesignProps9 = (props) => {
28233
28526
  return {
28234
28527
  text: {
@@ -28238,9 +28531,9 @@ var resolveDesignProps9 = (props) => {
28238
28531
  }
28239
28532
  };
28240
28533
  };
28241
- var TextElement = (0, import_react64.forwardRef)(({ children, className, ...rest }, ref) => {
28534
+ var TextElement = (0, import_react65.forwardRef)(({ children, className, ...rest }, ref) => {
28242
28535
  const props = resolveDesignProps9(rest);
28243
- return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
28536
+ return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Element, { as: Flex, ref, className, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28244
28537
  Text,
28245
28538
  {
28246
28539
  display: props.text.fontStyle,
@@ -28253,8 +28546,8 @@ var TextElement = (0, import_react64.forwardRef)(({ children, className, ...rest
28253
28546
  TextElement.displayName = "Text";
28254
28547
 
28255
28548
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28256
- var import_react65 = require("react");
28257
- var import_jsx_runtime68 = require("react/jsx-runtime");
28549
+ var import_react66 = require("react");
28550
+ var import_jsx_runtime69 = require("react/jsx-runtime");
28258
28551
  var buttonStyles = {
28259
28552
  primary: {
28260
28553
  color: "primary",
@@ -28280,17 +28573,17 @@ var resolveDesignProps10 = (props) => {
28280
28573
  }
28281
28574
  };
28282
28575
  };
28283
- var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, ...rest }, ref) => {
28576
+ var UnsubscribeButton = (0, import_react66.forwardRef)(({ children, className, ...rest }, ref) => {
28284
28577
  const props = resolveDesignProps10(rest);
28285
28578
  const { t: t4 } = useTranslation();
28286
28579
  const { data, setLayout } = useEmbed();
28287
- const hasActiveSubscription = (0, import_react65.useMemo)(() => {
28580
+ const hasActiveSubscription = (0, import_react66.useMemo)(() => {
28288
28581
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
28289
28582
  }, [data?.subscription]);
28290
28583
  if (!hasActiveSubscription) {
28291
28584
  return null;
28292
28585
  }
28293
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28586
+ return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28294
28587
  Element,
28295
28588
  {
28296
28589
  as: Flex,
@@ -28298,7 +28591,7 @@ var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, .
28298
28591
  className,
28299
28592
  $flexDirection: "column",
28300
28593
  $gap: "2rem",
28301
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
28594
+ children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28302
28595
  Button,
28303
28596
  {
28304
28597
  type: "button",
@@ -28319,8 +28612,8 @@ var UnsubscribeButton = (0, import_react65.forwardRef)(({ children, className, .
28319
28612
  UnsubscribeButton.displayName = "UnsubscribeButton";
28320
28613
 
28321
28614
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
28322
- var import_react66 = require("react");
28323
- var import_jsx_runtime69 = require("react/jsx-runtime");
28615
+ var import_react67 = require("react");
28616
+ var import_jsx_runtime70 = require("react/jsx-runtime");
28324
28617
  function resolveDesignProps11(props) {
28325
28618
  return {
28326
28619
  header: {
@@ -28339,15 +28632,15 @@ function resolveDesignProps11(props) {
28339
28632
  }
28340
28633
  };
28341
28634
  }
28342
- var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref) => {
28635
+ var UpcomingBill = (0, import_react67.forwardRef)(({ className, ...rest }, ref) => {
28343
28636
  const props = resolveDesignProps11(rest);
28344
28637
  const { t: t4 } = useTranslation();
28345
28638
  const { data, settings, getUpcomingInvoice } = useEmbed();
28346
28639
  const isLightBackground = useIsLightBackground();
28347
- const [isLoading, setIsLoading] = (0, import_react66.useState)(false);
28348
- const [error, setError] = (0, import_react66.useState)();
28349
- const [upcomingInvoice, setUpcomingInvoice] = (0, import_react66.useState)(data?.upcomingInvoice);
28350
- const discounts = (0, import_react66.useMemo)(() => {
28640
+ const [isLoading, setIsLoading] = (0, import_react67.useState)(false);
28641
+ const [error, setError] = (0, import_react67.useState)();
28642
+ const [upcomingInvoice, setUpcomingInvoice] = (0, import_react67.useState)(data?.upcomingInvoice);
28643
+ const discounts = (0, import_react67.useMemo)(() => {
28351
28644
  return (data?.subscription?.discounts || []).filter(
28352
28645
  (discount) => (
28353
28646
  // Only surface discounts that are currently active and actually
@@ -28365,7 +28658,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28365
28658
  durationInMonths: discount.durationInMonths ?? void 0
28366
28659
  }));
28367
28660
  }, [data?.subscription?.discounts]);
28368
- const getInvoice = (0, import_react66.useCallback)(async () => {
28661
+ const getInvoice = (0, import_react67.useCallback)(async () => {
28369
28662
  if (data?.component?.id && data?.subscription && !data.subscription.cancelAt) {
28370
28663
  try {
28371
28664
  setError(void 0);
@@ -28381,15 +28674,15 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28381
28674
  }
28382
28675
  }
28383
28676
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
28384
- (0, import_react66.useEffect)(() => {
28677
+ (0, import_react67.useEffect)(() => {
28385
28678
  getInvoice();
28386
28679
  }, [getInvoice]);
28387
- (0, import_react66.useEffect)(() => {
28680
+ (0, import_react67.useEffect)(() => {
28388
28681
  if (data?.upcomingInvoice) {
28389
28682
  setUpcomingInvoice(data.upcomingInvoice);
28390
28683
  }
28391
28684
  }, [data?.upcomingInvoice]);
28392
- const { currency, applied, remaining } = (0, import_react66.useMemo)(() => {
28685
+ const { currency, applied, remaining } = (0, import_react67.useMemo)(() => {
28393
28686
  const currency2 = upcomingInvoice?.currency;
28394
28687
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
28395
28688
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -28408,9 +28701,9 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28408
28701
  if (!data?.subscription || data.subscription.cancelAt) {
28409
28702
  return null;
28410
28703
  }
28411
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Element, { ref, className, children: [
28412
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
28413
- error ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28704
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Element, { ref, className, children: [
28705
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
28706
+ error ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28414
28707
  Flex,
28415
28708
  {
28416
28709
  as: TransitionBox,
@@ -28419,8 +28712,8 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28419
28712
  $alignItems: "center",
28420
28713
  $gap: "1rem",
28421
28714
  children: [
28422
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
28423
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28715
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
28716
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28424
28717
  Button,
28425
28718
  {
28426
28719
  type: "button",
@@ -28433,28 +28726,28 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28433
28726
  )
28434
28727
  ]
28435
28728
  }
28436
- ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
28437
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(Text, { display: props.header.fontStyle, children: [
28729
+ ) : !isLoading && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Flex, { $flexDirection: "column", $gap: "1rem", children: [
28730
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Text, { display: props.header.fontStyle, children: [
28438
28731
  props.header.prefix,
28439
28732
  " ",
28440
28733
  toPrettyDate(upcomingInvoice.dueDate)
28441
28734
  ] }),
28442
- /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28735
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28443
28736
  Flex,
28444
28737
  {
28445
28738
  $justifyContent: "space-between",
28446
28739
  $alignItems: "start",
28447
28740
  $gap: "1rem",
28448
28741
  children: [
28449
- props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
28742
+ props.price.isVisible && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
28450
28743
  upcomingInvoice.amountDue,
28451
28744
  upcomingInvoice.currency
28452
28745
  ) }),
28453
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
28746
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
28454
28747
  ]
28455
28748
  }
28456
28749
  ),
28457
- hasApplied && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28750
+ hasApplied && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28458
28751
  Flex,
28459
28752
  {
28460
28753
  as: TransitionBox,
@@ -28462,12 +28755,12 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28462
28755
  $alignItems: "start",
28463
28756
  $gap: "1rem",
28464
28757
  children: [
28465
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
28466
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: formatCurrency(-applied, currency) })
28758
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
28759
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(-applied, currency) })
28467
28760
  ]
28468
28761
  }
28469
28762
  ),
28470
- hasBalance && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28763
+ hasBalance && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28471
28764
  Flex,
28472
28765
  {
28473
28766
  as: TransitionBox,
@@ -28475,20 +28768,20 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28475
28768
  $alignItems: "start",
28476
28769
  $gap: "1rem",
28477
28770
  children: [
28478
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
28479
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: formatCurrency(remaining, currency) })
28771
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
28772
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: formatCurrency(remaining, currency) })
28480
28773
  ]
28481
28774
  }
28482
28775
  ),
28483
- discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28776
+ discounts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28484
28777
  Flex,
28485
28778
  {
28486
28779
  $justifyContent: "space-between",
28487
28780
  $alignItems: "start",
28488
28781
  $gap: "1rem",
28489
28782
  children: [
28490
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { $weight: 600, children: t4("Discount") }),
28491
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28783
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { $weight: 600, children: t4("Discount") }),
28784
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28492
28785
  Flex,
28493
28786
  {
28494
28787
  $flexDirection: "column",
@@ -28504,13 +28797,13 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28504
28797
  discount?.currency
28505
28798
  )
28506
28799
  });
28507
- return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
28800
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
28508
28801
  Flex,
28509
28802
  {
28510
28803
  $alignItems: "center",
28511
28804
  $gap: "0.5rem",
28512
28805
  children: [
28513
- discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28806
+ discount.customerFacingCode && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28514
28807
  Flex,
28515
28808
  {
28516
28809
  $alignItems: "center",
@@ -28519,7 +28812,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28519
28812
  $borderStyle: "solid",
28520
28813
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
28521
28814
  $borderRadius: "0.3125rem",
28522
- children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
28815
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
28523
28816
  Text,
28524
28817
  {
28525
28818
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -28529,7 +28822,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28529
28822
  )
28530
28823
  }
28531
28824
  ),
28532
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
28825
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
28533
28826
  discount: label,
28534
28827
  count: discount.durationInMonths
28535
28828
  }) : label }) })
@@ -28543,7 +28836,7 @@ var UpcomingBill = (0, import_react66.forwardRef)(({ className, ...rest }, ref)
28543
28836
  ]
28544
28837
  }
28545
28838
  )
28546
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
28839
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
28547
28840
  ] });
28548
28841
  });
28549
28842
  UpcomingBill.displayName = "UpcomingBill";
@@ -31179,10 +31472,10 @@ function inflate(input, options = {}) {
31179
31472
  }
31180
31473
 
31181
31474
  // src/components/embed/Embed.tsx
31182
- var import_react68 = require("react");
31475
+ var import_react69 = require("react");
31183
31476
 
31184
31477
  // src/components/embed/renderer.ts
31185
- var import_react67 = require("react");
31478
+ var import_react68 = require("react");
31186
31479
  var components = {
31187
31480
  Root,
31188
31481
  Viewport,
@@ -31246,7 +31539,7 @@ function createRenderer(options) {
31246
31539
  const { className, ...rest } = props;
31247
31540
  const resolvedProps = component === "div" ? rest : props;
31248
31541
  const resolvedChildren = children.map(renderNode);
31249
- return (0, import_react67.createElement)(
31542
+ return (0, import_react68.createElement)(
31250
31543
  component,
31251
31544
  {
31252
31545
  key: index,
@@ -31259,11 +31552,11 @@ function createRenderer(options) {
31259
31552
  }
31260
31553
 
31261
31554
  // src/components/embed/Embed.tsx
31262
- var import_jsx_runtime70 = require("react/jsx-runtime");
31555
+ var import_jsx_runtime71 = require("react/jsx-runtime");
31263
31556
  var renderer = createRenderer();
31264
31557
  var Loading = () => {
31265
31558
  const { settings } = useEmbed();
31266
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
31559
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
31267
31560
  Flex,
31268
31561
  {
31269
31562
  $width: "100%",
@@ -31271,13 +31564,13 @@ var Loading = () => {
31271
31564
  $alignItems: "center",
31272
31565
  $justifyContent: "center",
31273
31566
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
31274
- children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
31567
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loader, { $color: settings.theme.primary, $size: "2xl" })
31275
31568
  }
31276
31569
  );
31277
31570
  };
31278
31571
  var Error2 = ({ message }) => {
31279
31572
  const { settings } = useEmbed();
31280
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(
31573
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
31281
31574
  Flex,
31282
31575
  {
31283
31576
  $flexDirection: "column",
@@ -31288,14 +31581,14 @@ var Error2 = ({ message }) => {
31288
31581
  $alignItems: "center",
31289
31582
  $justifyContent: "center",
31290
31583
  children: [
31291
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { display: "heading1", children: "Error" }) }),
31292
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Text, { children: message }) })
31584
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { display: "heading1", children: "Error" }) }),
31585
+ /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Text, { children: message }) })
31293
31586
  ]
31294
31587
  }
31295
31588
  );
31296
31589
  };
31297
31590
  var SchematicEmbed = ({ id, accessToken }) => {
31298
- const theme = (0, import_react68.useContext)(nt);
31591
+ const theme = (0, import_react69.useContext)(nt);
31299
31592
  const {
31300
31593
  data,
31301
31594
  error,
@@ -31307,7 +31600,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31307
31600
  setBuilderSettings
31308
31601
  } = useEmbed();
31309
31602
  const compressedAst = data?.component?.ast;
31310
- const { children, parsedSettings, parseError } = (0, import_react68.useMemo)(() => {
31603
+ const { children, parsedSettings, parseError } = (0, import_react69.useMemo)(() => {
31311
31604
  let children2 = null;
31312
31605
  let parsedSettings2 = null;
31313
31606
  let parseError2 = null;
@@ -31339,22 +31632,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
31339
31632
  parseError: parseError2
31340
31633
  };
31341
31634
  }, [compressedAst]);
31342
- (0, import_react68.useEffect)(() => {
31635
+ (0, import_react69.useEffect)(() => {
31343
31636
  if (accessToken) {
31344
31637
  setAccessToken(accessToken);
31345
31638
  }
31346
31639
  }, [accessToken, setAccessToken]);
31347
- (0, import_react68.useEffect)(() => {
31640
+ (0, import_react69.useEffect)(() => {
31348
31641
  if (id && stale) {
31349
31642
  hydrateComponent(id);
31350
31643
  }
31351
31644
  }, [id, hydrateComponent, stale]);
31352
- (0, import_react68.useEffect)(() => {
31645
+ (0, import_react69.useEffect)(() => {
31353
31646
  if (parsedSettings) {
31354
31647
  setBuilderSettings(parsedSettings);
31355
31648
  }
31356
31649
  }, [parsedSettings, setBuilderSettings]);
31357
- (0, import_react68.useEffect)(() => {
31650
+ (0, import_react69.useEffect)(() => {
31358
31651
  if (parseError) {
31359
31652
  setError(parseError);
31360
31653
  }
@@ -31363,13 +31656,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
31363
31656
  return stub();
31364
31657
  }
31365
31658
  if (error) {
31366
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Error2, { message: error.message });
31659
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: error.message });
31367
31660
  }
31368
31661
  if (accessToken?.length === 0) {
31369
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Error2, { message: "Please provide an access token." });
31662
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Error2, { message: "Please provide an access token." });
31370
31663
  }
31371
31664
  if (!accessToken?.startsWith("token_")) {
31372
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
31665
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
31373
31666
  Error2,
31374
31667
  {
31375
31668
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -31377,7 +31670,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31377
31670
  );
31378
31671
  }
31379
31672
  if (isPending) {
31380
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loading, {});
31673
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {});
31381
31674
  }
31382
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Loading, {}) });
31675
+ return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Loading, {}) });
31383
31676
  };