@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.
@@ -1717,7 +1717,7 @@ var require_debounce = __commonJS({
1717
1717
  var FUNC_ERROR_TEXT = "Expected a function";
1718
1718
  var nativeMax = Math.max;
1719
1719
  var nativeMin = Math.min;
1720
- function debounce5(func, wait, options) {
1720
+ function debounce6(func, wait, options) {
1721
1721
  var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
1722
1722
  if (typeof func != "function") {
1723
1723
  throw new TypeError(FUNC_ERROR_TEXT);
@@ -1798,7 +1798,7 @@ var require_debounce = __commonJS({
1798
1798
  debounced.flush = flush;
1799
1799
  return debounced;
1800
1800
  }
1801
- module.exports = debounce5;
1801
+ module.exports = debounce6;
1802
1802
  }
1803
1803
  });
1804
1804
 
@@ -1957,6 +1957,8 @@ var initialContext = {
1957
1957
  getUpcomingInvoice: stub,
1958
1958
  getCustomerBalance: stub,
1959
1959
  listInvoices: stub,
1960
+ getCreditUsageByUser: stub,
1961
+ getFeatureUsageByUser: stub,
1960
1962
  createSetupIntent: stub,
1961
1963
  updatePaymentMethod: stub,
1962
1964
  deletePaymentMethod: stub,
@@ -5248,6 +5250,18 @@ var en_default = {
5248
5250
  "month, billed yearly": "month, billed yearly",
5249
5251
  "month, billed quarterly": "month, billed quarterly",
5250
5252
  purchased: "purchased {{date}}",
5253
+ "Usage by user": "Usage by user",
5254
+ "X used by your team this period": "{{amount}} used by your team this period",
5255
+ "Show all X users_one": "Show all {{count}} user",
5256
+ "Show all X users_other": "Show all {{count}} users",
5257
+ "Show top X users_one": "Show top {{count}} user",
5258
+ "Show top X users_other": "Show top {{count}} users",
5259
+ "Show all": "Show all",
5260
+ "Show fewer": "Show fewer",
5261
+ Unattributed: "Unattributed",
5262
+ "There was a problem retrieving usage by user.": "There was a problem retrieving usage by user.",
5263
+ "plus X more_one": "plus {{count}} more",
5264
+ "plus X more_other": "plus {{count}} more",
5251
5265
  usage: {
5252
5266
  limited: "{{amount}} of {{allocation}} used",
5253
5267
  unlimited: "{{amount}} used"
@@ -6853,7 +6867,7 @@ var Icon = ({ name, className = "", ...rest }) => {
6853
6867
  };
6854
6868
 
6855
6869
  // src/context/EmbedProvider.tsx
6856
- var import_debounce = __toESM(require_debounce());
6870
+ var import_debounce2 = __toESM(require_debounce());
6857
6871
  var import_merge3 = __toESM(require_merge());
6858
6872
  import { useCallback as useCallback2, useEffect as useEffect2, useMemo as useMemo2, useReducer, useRef as useRef2 } from "react";
6859
6873
 
@@ -13122,6 +13136,19 @@ function calculateTieredCost(quantity, priceTiers, tiersMode) {
13122
13136
  }
13123
13137
  return cost;
13124
13138
  }
13139
+ function calculateQuantityCost(billingPrice, quantity) {
13140
+ if (!billingPrice) {
13141
+ return 0;
13142
+ }
13143
+ if (isTieredPrice(billingPrice)) {
13144
+ return calculateTieredCost(
13145
+ quantity,
13146
+ billingPrice.priceTier,
13147
+ billingPrice.tiersMode
13148
+ );
13149
+ }
13150
+ return quantity * billingPrice.price;
13151
+ }
13125
13152
  function getEntitlementCost(entitlement, period = "month", currency) {
13126
13153
  const resolvedPeriod = period ?? "month";
13127
13154
  const source = currency ? getEntitlementPrice(entitlement, resolvedPeriod, currency) : selectPriceForPeriod(
@@ -14186,6 +14213,20 @@ function modifyDate(date, days) {
14186
14213
  return copy3;
14187
14214
  }
14188
14215
 
14216
+ // src/utils/debounce.ts
14217
+ var import_debounce = __toESM(require_debounce());
14218
+ function debounceByKey(fn, wait, settings) {
14219
+ const debouncedByKey = /* @__PURE__ */ new Map();
14220
+ return (key, ...args) => {
14221
+ let debounced = debouncedByKey.get(key);
14222
+ if (!debounced) {
14223
+ debounced = (0, import_debounce.default)(fn, wait, settings);
14224
+ debouncedByKey.set(key, debounced);
14225
+ }
14226
+ return debounced(key, ...args);
14227
+ };
14228
+ }
14229
+
14189
14230
  // src/utils/string.ts
14190
14231
  var ZERO_DECIMAL_CURRENCIES = /* @__PURE__ */ new Set([
14191
14232
  "BIF",
@@ -15189,7 +15230,7 @@ var reducer = (state, action) => {
15189
15230
  // src/context/EmbedProvider.tsx
15190
15231
  import { jsx as jsx2, jsxs } from "react/jsx-runtime";
15191
15232
  var getCustomHeaders = (sessionId) => ({
15192
- "X-Schematic-Components-Version": "2.25.1",
15233
+ "X-Schematic-Components-Version": "2.25.2",
15193
15234
  "X-Schematic-Session-ID": sessionId
15194
15235
  });
15195
15236
  var normalizeCurrencyFilter = (filter2) => {
@@ -15300,7 +15341,7 @@ var EmbedProvider = ({
15300
15341
  }
15301
15342
  }, [publicApi]);
15302
15343
  const debouncedHydratePublic = useMemo2(
15303
- () => (0, import_debounce.default)(
15344
+ () => (0, import_debounce2.default)(
15304
15345
  hydratePublic,
15305
15346
  FETCH_DEBOUNCE_TIMEOUT,
15306
15347
  LEADING_DEBOUNCE_SETTINGS
@@ -15326,7 +15367,7 @@ var EmbedProvider = ({
15326
15367
  }
15327
15368
  }, [checkoutApi]);
15328
15369
  const debouncedHydrate = useMemo2(
15329
- () => (0, import_debounce.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15370
+ () => (0, import_debounce2.default)(hydrate, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15330
15371
  [hydrate]
15331
15372
  );
15332
15373
  const hydrateComponent = useCallback2(
@@ -15353,7 +15394,7 @@ var EmbedProvider = ({
15353
15394
  [checkoutApi]
15354
15395
  );
15355
15396
  const debouncedHydrateComponent = useMemo2(
15356
- () => (0, import_debounce.default)(
15397
+ () => (0, import_debounce2.default)(
15357
15398
  hydrateComponent,
15358
15399
  FETCH_DEBOUNCE_TIMEOUT,
15359
15400
  LEADING_DEBOUNCE_SETTINGS
@@ -15377,7 +15418,7 @@ var EmbedProvider = ({
15377
15418
  }
15378
15419
  }, []);
15379
15420
  const debouncedHydrateExternal = useMemo2(
15380
- () => (0, import_debounce.default)(
15421
+ () => (0, import_debounce2.default)(
15381
15422
  hydrateExternal,
15382
15423
  FETCH_DEBOUNCE_TIMEOUT,
15383
15424
  LEADING_DEBOUNCE_SETTINGS
@@ -15388,7 +15429,7 @@ var EmbedProvider = ({
15388
15429
  return checkoutApi?.createSetupIntent();
15389
15430
  }, [checkoutApi]);
15390
15431
  const debouncedCreateSetupIntent = useMemo2(
15391
- () => (0, import_debounce.default)(
15432
+ () => (0, import_debounce2.default)(
15392
15433
  createSetupIntent,
15393
15434
  FETCH_DEBOUNCE_TIMEOUT,
15394
15435
  LEADING_DEBOUNCE_SETTINGS
@@ -15411,7 +15452,7 @@ var EmbedProvider = ({
15411
15452
  [checkoutApi]
15412
15453
  );
15413
15454
  const debouncedUpdatePaymentMethod = useMemo2(
15414
- () => (0, import_debounce.default)(
15455
+ () => (0, import_debounce2.default)(
15415
15456
  updatePaymentMethod,
15416
15457
  FETCH_DEBOUNCE_TIMEOUT,
15417
15458
  LEADING_DEBOUNCE_SETTINGS
@@ -15434,7 +15475,7 @@ var EmbedProvider = ({
15434
15475
  [checkoutApi]
15435
15476
  );
15436
15477
  const debouncedDeletePaymentMethod = useMemo2(
15437
- () => (0, import_debounce.default)(
15478
+ () => (0, import_debounce2.default)(
15438
15479
  deletePaymentMethod,
15439
15480
  FETCH_DEBOUNCE_TIMEOUT,
15440
15481
  LEADING_DEBOUNCE_SETTINGS
@@ -15457,7 +15498,7 @@ var EmbedProvider = ({
15457
15498
  [checkoutApi]
15458
15499
  );
15459
15500
  const debouncedCheckout = useMemo2(
15460
- () => (0, import_debounce.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15501
+ () => (0, import_debounce2.default)(checkout, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15461
15502
  [checkout]
15462
15503
  );
15463
15504
  const previewCheckout = useCallback2(
@@ -15477,7 +15518,7 @@ var EmbedProvider = ({
15477
15518
  return response;
15478
15519
  }, [checkoutApi]);
15479
15520
  const debouncedUnsubscribe = useMemo2(
15480
- () => (0, import_debounce.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15521
+ () => (0, import_debounce2.default)(unsubscribe, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15481
15522
  [unsubscribe]
15482
15523
  );
15483
15524
  const updateCustomFieldValues = useCallback2(
@@ -15521,7 +15562,7 @@ var EmbedProvider = ({
15521
15562
  [checkoutApi]
15522
15563
  );
15523
15564
  const debouncedGetUpcomingInvoice = useMemo2(
15524
- () => (0, import_debounce.default)(
15565
+ () => (0, import_debounce2.default)(
15525
15566
  getUpcomingInvoice,
15526
15567
  FETCH_DEBOUNCE_TIMEOUT,
15527
15568
  LEADING_DEBOUNCE_SETTINGS
@@ -15532,7 +15573,7 @@ var EmbedProvider = ({
15532
15573
  return checkoutApi?.fetchCustomerBalance();
15533
15574
  }, [checkoutApi]);
15534
15575
  const debouncedGetCustomerBalance = useMemo2(
15535
- () => (0, import_debounce.default)(
15576
+ () => (0, import_debounce2.default)(
15536
15577
  getCustomerBalance,
15537
15578
  FETCH_DEBOUNCE_TIMEOUT,
15538
15579
  LEADING_DEBOUNCE_SETTINGS
@@ -15543,9 +15584,37 @@ var EmbedProvider = ({
15543
15584
  return checkoutApi?.listInvoices();
15544
15585
  }, [checkoutApi]);
15545
15586
  const debouncedListInvoices = useMemo2(
15546
- () => (0, import_debounce.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15587
+ () => (0, import_debounce2.default)(listInvoices, FETCH_DEBOUNCE_TIMEOUT, LEADING_DEBOUNCE_SETTINGS),
15547
15588
  [listInvoices]
15548
15589
  );
15590
+ const getCreditUsageByUser = useCallback2(
15591
+ async (billingCreditId, limit) => {
15592
+ return checkoutApi?.getCreditUsageByUser({ billingCreditId, limit });
15593
+ },
15594
+ [checkoutApi]
15595
+ );
15596
+ const debouncedGetCreditUsageByUser = useMemo2(
15597
+ () => debounceByKey(
15598
+ getCreditUsageByUser,
15599
+ FETCH_DEBOUNCE_TIMEOUT,
15600
+ LEADING_DEBOUNCE_SETTINGS
15601
+ ),
15602
+ [getCreditUsageByUser]
15603
+ );
15604
+ const getFeatureUsageByUser = useCallback2(
15605
+ async (featureId, limit) => {
15606
+ return checkoutApi?.getFeatureUsageByUser({ featureId, limit });
15607
+ },
15608
+ [checkoutApi]
15609
+ );
15610
+ const debouncedGetFeatureUsageByUser = useMemo2(
15611
+ () => debounceByKey(
15612
+ getFeatureUsageByUser,
15613
+ FETCH_DEBOUNCE_TIMEOUT,
15614
+ LEADING_DEBOUNCE_SETTINGS
15615
+ ),
15616
+ [getFeatureUsageByUser]
15617
+ );
15549
15618
  const setError = useCallback2(
15550
15619
  (error) => {
15551
15620
  debug(error.message);
@@ -15711,6 +15780,8 @@ var EmbedProvider = ({
15711
15780
  getUpcomingInvoice: debouncedGetUpcomingInvoice,
15712
15781
  getCustomerBalance: debouncedGetCustomerBalance,
15713
15782
  listInvoices: debouncedListInvoices,
15783
+ getCreditUsageByUser: debouncedGetCreditUsageByUser,
15784
+ getFeatureUsageByUser: debouncedGetFeatureUsageByUser,
15714
15785
  finishCheckout,
15715
15786
  setError,
15716
15787
  setAccessToken,
@@ -17109,7 +17180,7 @@ var Toggle = gt.input.attrs({ type: "checkbox" })`
17109
17180
  `;
17110
17181
 
17111
17182
  // src/components/ui/tooltip/Tooltip.tsx
17112
- var import_debounce2 = __toESM(require_debounce());
17183
+ var import_debounce3 = __toESM(require_debounce());
17113
17184
  import {
17114
17185
  cloneElement as cloneElement2,
17115
17186
  useCallback as useCallback7,
@@ -17299,7 +17370,7 @@ var Tooltip = ({
17299
17370
  }, [portal, position2]);
17300
17371
  useLayoutEffect3(() => {
17301
17372
  updateCoords();
17302
- const handleResize = (0, import_debounce2.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17373
+ const handleResize = (0, import_debounce3.default)(updateCoords, EVENT_DEBOUNCE_TIMEOUT);
17303
17374
  window.addEventListener("resize", handleResize);
17304
17375
  window.addEventListener("scroll", handleResize, true);
17305
17376
  return () => {
@@ -17456,7 +17527,7 @@ var Root = forwardRef6(
17456
17527
  Root.displayName = "Root";
17457
17528
 
17458
17529
  // src/components/layout/viewport/Viewport.tsx
17459
- var import_debounce4 = __toESM(require_debounce());
17530
+ var import_debounce5 = __toESM(require_debounce());
17460
17531
  import { forwardRef as forwardRef8, useLayoutEffect as useLayoutEffect8, useRef as useRef11, useState as useState16 } from "react";
17461
17532
  import { createPortal as createPortal3 } from "react-dom";
17462
17533
 
@@ -18404,11 +18475,10 @@ var Quantity = ({
18404
18475
  children: [
18405
18476
  /* @__PURE__ */ jsx20(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsxs11(Text, { children: [
18406
18477
  formatCurrency(
18407
- tiered && priceTiers ? calculateTieredCost(
18408
- entitlement.quantity,
18409
- priceTiers,
18410
- tiersMode
18411
- ) : (price ?? 0) * entitlement.quantity,
18478
+ calculateQuantityCost(
18479
+ entitlementBillingPrice,
18480
+ entitlement.quantity
18481
+ ),
18412
18482
  currency
18413
18483
  ),
18414
18484
  /* @__PURE__ */ jsxs11("sub", { children: [
@@ -19285,7 +19355,7 @@ var Checkout = ({
19285
19355
  };
19286
19356
 
19287
19357
  // src/components/shared/checkout-dialog/CheckoutDialog.tsx
19288
- var import_debounce3 = __toESM(require_debounce());
19358
+ var import_debounce4 = __toESM(require_debounce());
19289
19359
  import {
19290
19360
  useCallback as useCallback8,
19291
19361
  useEffect as useEffect4,
@@ -20094,7 +20164,7 @@ var CheckoutDialog = ({ top }) => {
20094
20164
  }, [handlePreviewCheckout]);
20095
20165
  const debouncedPreviewCheckoutRef = useRef6(null);
20096
20166
  useEffect4(() => {
20097
- const debounced = (0, import_debounce3.default)(
20167
+ const debounced = (0, import_debounce4.default)(
20098
20168
  (updates) => handlePreviewCheckoutRef.current(updates),
20099
20169
  FETCH_DEBOUNCE_TIMEOUT,
20100
20170
  TRAILING_DEBOUNCE_SETTINGS
@@ -22217,6 +22287,29 @@ var EntitlementRow = (props) => {
22217
22287
  tiersMode
22218
22288
  } = entitlementPrice || {};
22219
22289
  const tiered = priceBehavior === EntitlementPriceBehavior.PayInAdvance && isTieredPrice(entitlementPrice);
22290
+ const tierLabel = /* @__PURE__ */ jsxs30(
22291
+ Text,
22292
+ {
22293
+ style: { opacity: 0.54 },
22294
+ $size: 0.875 * settings.theme.typography.text.fontSize,
22295
+ $color: settings.theme.typography.text.color,
22296
+ children: [
22297
+ t4("Tier-based"),
22298
+ /* @__PURE__ */ jsx41(
22299
+ PricingTiersTooltip,
22300
+ {
22301
+ portal,
22302
+ feature,
22303
+ period: planPeriod,
22304
+ currency,
22305
+ priceTiers,
22306
+ tiersMode: tiersMode ?? void 0,
22307
+ position: "left"
22308
+ }
22309
+ )
22310
+ ]
22311
+ }
22312
+ );
22220
22313
  return /* @__PURE__ */ jsxs30(Fragment15, { children: [
22221
22314
  /* @__PURE__ */ jsx41(Box, { children: /* @__PURE__ */ jsx41(Text, { display: "heading4", children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs30(Fragment15, { children: [
22222
22315
  quantity,
@@ -22227,13 +22320,24 @@ var EntitlementRow = (props) => {
22227
22320
  " ",
22228
22321
  getFeatureName(feature, softLimit)
22229
22322
  ] }) : feature.name }) }),
22230
- /* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance && !tiered ? /* @__PURE__ */ jsxs30(Text, { children: [
22231
- formatCurrency((price ?? 0) * quantity, currency),
22232
- /* @__PURE__ */ jsxs30("sub", { children: [
22233
- "/",
22234
- shortenPeriod(planPeriod)
22323
+ /* @__PURE__ */ jsx41(Box, { $whiteSpace: "nowrap", $lineHeight: 1, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? (
22324
+ // A tiered scheme still resolves to a fixed amount at the chosen
22325
+ // quantity, so the row shows it alongside the tier breakdown
22326
+ // rather than leaving the charge unpriced.
22327
+ /* @__PURE__ */ jsxs30(Flex, { $flexDirection: "column", $gap: "0.25rem", $alignItems: "end", children: [
22328
+ /* @__PURE__ */ jsxs30(Text, { children: [
22329
+ formatCurrency(
22330
+ calculateQuantityCost(entitlementPrice, quantity),
22331
+ currency
22332
+ ),
22333
+ /* @__PURE__ */ jsxs30("sub", { children: [
22334
+ "/",
22335
+ shortenPeriod(planPeriod)
22336
+ ] })
22337
+ ] }),
22338
+ tiered && tierLabel
22235
22339
  ] })
22236
- ] }) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs30(Text, { children: [
22340
+ ) : priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.Overage ? /* @__PURE__ */ jsxs30(Text, { children: [
22237
22341
  priceBehavior === EntitlementPriceBehavior.Overage && /* @__PURE__ */ jsxs30(Fragment15, { children: [
22238
22342
  t4("then"),
22239
22343
  " "
@@ -22251,29 +22355,7 @@ var EntitlementRow = (props) => {
22251
22355
  shortenPeriod(planPeriod)
22252
22356
  ] })
22253
22357
  ] })
22254
- ] }) : (priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs30(
22255
- Text,
22256
- {
22257
- style: { opacity: 0.54 },
22258
- $size: 0.875 * settings.theme.typography.text.fontSize,
22259
- $color: settings.theme.typography.text.color,
22260
- children: [
22261
- t4("Tier-based"),
22262
- /* @__PURE__ */ jsx41(
22263
- PricingTiersTooltip,
22264
- {
22265
- portal,
22266
- feature,
22267
- period: planPeriod,
22268
- currency,
22269
- priceTiers,
22270
- tiersMode: tiersMode ?? void 0,
22271
- position: "left"
22272
- }
22273
- )
22274
- ]
22275
- }
22276
- ) })
22358
+ ] }) : priceBehavior === EntitlementPriceBehavior.Tier && tierLabel })
22277
22359
  ] });
22278
22360
  }
22279
22361
  };
@@ -22469,12 +22551,18 @@ var SubscriptionSidebar = forwardRef7(
22469
22551
  }, 0);
22470
22552
  total += addOnCost;
22471
22553
  const payInAdvanceCost = payInAdvanceEntitlements.reduce(
22472
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
22554
+ (sum, entitlement) => sum + calculateQuantityCost(
22555
+ getEntitlementPrice(entitlement, planPeriod, currency),
22556
+ entitlement.quantity
22557
+ ),
22473
22558
  0
22474
22559
  );
22475
22560
  total += payInAdvanceCost;
22476
22561
  const addOnPayInAdvanceCost = addOnPayInAdvanceEntitlements.reduce(
22477
- (sum, entitlement) => sum + entitlement.quantity * (getEntitlementPrice(entitlement, planPeriod, currency)?.price ?? 0),
22562
+ (sum, entitlement) => sum + calculateQuantityCost(
22563
+ getEntitlementPrice(entitlement, planPeriod, currency),
22564
+ entitlement.quantity
22565
+ ),
22478
22566
  0
22479
22567
  );
22480
22568
  total += addOnPayInAdvanceCost;
@@ -23937,7 +24025,7 @@ var Viewport = forwardRef8(
23937
24025
  const [top, setTop] = useState16(0);
23938
24026
  useLayoutEffect8(() => {
23939
24027
  const element = portalRef.current;
23940
- const setModalY = (0, import_debounce4.default)(() => {
24028
+ const setModalY = (0, import_debounce5.default)(() => {
23941
24029
  const value = Math.abs(
23942
24030
  (element === document.body ? window.scrollY : element.scrollTop) ?? 0
23943
24031
  );
@@ -24651,7 +24739,7 @@ var Invoices = forwardRef11(({ className, ...rest }, ref) => {
24651
24739
  Invoices.displayName = "Invoices";
24652
24740
 
24653
24741
  // src/components/elements/metered-features/MeteredFeatures.tsx
24654
- import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo27, useRef as useRef12, useState as useState18 } from "react";
24742
+ import { forwardRef as forwardRef12, useCallback as useCallback14, useMemo as useMemo28, useRef as useRef12, useState as useState19 } from "react";
24655
24743
 
24656
24744
  // src/components/elements/metered-features/Meter.tsx
24657
24745
  import { jsx as jsx53 } from "react/jsx-runtime";
@@ -24779,6 +24867,190 @@ var PriceDetails = ({
24779
24867
  );
24780
24868
  };
24781
24869
 
24870
+ // src/components/elements/metered-features/UsageByUser.tsx
24871
+ import { useEffect as useEffect7, useMemo as useMemo27, useState as useState18 } from "react";
24872
+ import { jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
24873
+ var COLLAPSED_COUNT = 3;
24874
+ var EXPANDED_COUNT = 20;
24875
+ var toCreditSection = (data) => ({
24876
+ entries: data.entries.map((entry) => ({
24877
+ id: entry.userId,
24878
+ // An entry with no hydrated user record still has an id worth showing —
24879
+ // a blank row identifies nobody.
24880
+ label: entry.user?.name || entry.userId || "",
24881
+ amount: entry.creditsUsed
24882
+ })),
24883
+ total: data.total,
24884
+ totalUsers: data.totalUsers,
24885
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.creditsUsed } : null
24886
+ });
24887
+ var toFeatureSection = (data) => ({
24888
+ entries: data.rows.map((row) => ({
24889
+ id: row.userId,
24890
+ label: row.user?.name || row.userId || "",
24891
+ amount: row.value
24892
+ })),
24893
+ total: data.total,
24894
+ totalUsers: data.totalUsers,
24895
+ unattributed: data.unattributed ? { id: null, label: "", amount: data.unattributed.value } : null
24896
+ });
24897
+ var mutedColor = (isLight) => isLight ? "hsla(0, 0%, 0%, 0.46)" : "hsla(0, 0%, 100%, 0.46)";
24898
+ var InitialAvatar = ({ label }) => {
24899
+ const { settings } = useEmbed();
24900
+ const isLightBackground = useIsLightBackground();
24901
+ const initial = (label.trim()[0] ?? "?").toUpperCase();
24902
+ return /* @__PURE__ */ jsx55(
24903
+ Flex,
24904
+ {
24905
+ $alignItems: "center",
24906
+ $justifyContent: "center",
24907
+ $width: "1.75rem",
24908
+ $height: "1.75rem",
24909
+ $flexShrink: 0,
24910
+ $borderRadius: "9999px",
24911
+ $background: isLightBackground ? "hsla(0, 0%, 0%, 0.0625)" : "hsla(0, 0%, 100%, 0.15)",
24912
+ children: /* @__PURE__ */ jsx55(
24913
+ Text,
24914
+ {
24915
+ $size: 11,
24916
+ $weight: 500,
24917
+ $color: settings.theme.typography.text.color,
24918
+ children: initial
24919
+ }
24920
+ )
24921
+ }
24922
+ );
24923
+ };
24924
+ var UsageByUser = ({ source, unit }) => {
24925
+ const { t: t4 } = useTranslation();
24926
+ const isLightBackground = useIsLightBackground();
24927
+ const { getCreditUsageByUser, getFeatureUsageByUser } = useEmbed();
24928
+ const [expanded, setExpanded] = useState18(false);
24929
+ const [result, setResult] = useState18();
24930
+ const [attempt, setAttempt] = useState18(0);
24931
+ const { kind, id } = source;
24932
+ const sourceKey = `${kind}:${id}`;
24933
+ const current = result?.sourceKey === sourceKey ? result : void 0;
24934
+ useEffect7(() => {
24935
+ let active = true;
24936
+ const apply = (next2) => {
24937
+ if (active) {
24938
+ setResult(next2);
24939
+ }
24940
+ };
24941
+ const receive = (section) => {
24942
+ if (section) {
24943
+ apply({ sourceKey, section });
24944
+ }
24945
+ };
24946
+ const fail = (err) => apply({ sourceKey, error: isError(err) ? err : ERROR_UNKNOWN });
24947
+ if (kind === "credit") {
24948
+ getCreditUsageByUser(id, EXPANDED_COUNT)?.then(
24949
+ (response) => receive(response && toCreditSection(response.data))
24950
+ ).catch(fail);
24951
+ } else {
24952
+ getFeatureUsageByUser(id, EXPANDED_COUNT)?.then(
24953
+ (response) => receive(response && toFeatureSection(response.data))
24954
+ ).catch(fail);
24955
+ }
24956
+ return () => {
24957
+ active = false;
24958
+ };
24959
+ }, [
24960
+ attempt,
24961
+ getCreditUsageByUser,
24962
+ getFeatureUsageByUser,
24963
+ id,
24964
+ kind,
24965
+ sourceKey
24966
+ ]);
24967
+ const entries = current?.section?.entries;
24968
+ const attributed = useMemo27(
24969
+ () => [...entries ?? []].sort((a2, b2) => b2.amount - a2.amount),
24970
+ [entries]
24971
+ );
24972
+ const error = current?.error;
24973
+ const total = current?.section?.total ?? 0;
24974
+ const totalUsers = current?.section?.totalUsers ?? 0;
24975
+ const unattributed = current?.section?.unattributed;
24976
+ const formatAmount = (amount) => `${formatNumber(amount)} ${getFeatureName(unit, amount)}`;
24977
+ if (error) {
24978
+ return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $alignItems: "flex-start", children: [
24979
+ /* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
24980
+ /* @__PURE__ */ jsx55(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving usage by user.") }),
24981
+ /* @__PURE__ */ jsx55(
24982
+ Button,
24983
+ {
24984
+ type: "button",
24985
+ onClick: () => setAttempt((prev2) => prev2 + 1),
24986
+ $size: "sm",
24987
+ $variant: "ghost",
24988
+ $fullWidth: false,
24989
+ children: t4("Try again")
24990
+ }
24991
+ )
24992
+ ] });
24993
+ }
24994
+ if (attributed.length === 0 && !unattributed) {
24995
+ return null;
24996
+ }
24997
+ const visible = attributed.slice(
24998
+ 0,
24999
+ expanded ? EXPANDED_COUNT : COLLAPSED_COUNT
25000
+ );
25001
+ const remaining = Math.max(totalUsers - visible.length, 0);
25002
+ const expandedUserCount = Math.min(totalUsers, EXPANDED_COUNT);
25003
+ const hiddenUsers = Math.max(
25004
+ expandedUserCount - Math.min(attributed.length, COLLAPSED_COUNT),
25005
+ 0
25006
+ );
25007
+ const shouldShowToggle = hiddenUsers > 0 || Boolean(unattributed);
25008
+ 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");
25009
+ const row = (key, label, amount, muted) => /* @__PURE__ */ jsxs41(Flex, { $alignItems: "center", $gap: "0.75rem", $padding: "0.5rem 0", children: [
25010
+ /* @__PURE__ */ jsx55(InitialAvatar, { label: muted ? "?" : label }),
25011
+ /* @__PURE__ */ jsx55(Box, { $flexGrow: 1, $overflow: "hidden", children: /* @__PURE__ */ jsx55(
25012
+ Text,
25013
+ {
25014
+ display: "text",
25015
+ $color: muted ? mutedColor(isLightBackground) : void 0,
25016
+ children: label
25017
+ }
25018
+ ) }),
25019
+ /* @__PURE__ */ jsx55(
25020
+ Text,
25021
+ {
25022
+ display: "text",
25023
+ $align: "right",
25024
+ $color: mutedColor(isLightBackground),
25025
+ children: formatAmount(amount)
25026
+ }
25027
+ )
25028
+ ] }, key);
25029
+ return /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.25rem", children: [
25030
+ /* @__PURE__ */ jsx55(Text, { display: "heading4", children: t4("Usage by user") }),
25031
+ /* @__PURE__ */ jsx55(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("X used by your team this period", {
25032
+ amount: formatAmount(total)
25033
+ }) }) }),
25034
+ visible.map(
25035
+ (entry, index) => row(entry.id || `row-${index}`, entry.label, entry.amount)
25036
+ ),
25037
+ expanded && unattributed && row("unattributed", t4("Unattributed"), unattributed.amount, true),
25038
+ expanded && remaining > 0 && /* @__PURE__ */ jsx55(Box, { $marginTop: "0.25rem", children: /* @__PURE__ */ jsx55(Text, { display: "text", $color: mutedColor(isLightBackground), children: t4("plus X more", { count: remaining }) }) }),
25039
+ shouldShowToggle && /* @__PURE__ */ jsx55(
25040
+ ExpandListToggle,
25041
+ {
25042
+ isExpanded: expanded,
25043
+ onToggle: () => setExpanded((prev2) => !prev2),
25044
+ expandLabel,
25045
+ collapseLabel: t4("Show fewer"),
25046
+ iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)",
25047
+ $marginTop: "0.25rem"
25048
+ }
25049
+ )
25050
+ ] });
25051
+ };
25052
+ UsageByUser.displayName = "UsageByUser";
25053
+
24782
25054
  // src/components/elements/metered-features/styles.ts
24783
25055
  var Container2 = gt.div`
24784
25056
  display: flex;
@@ -24797,7 +25069,7 @@ var Container2 = gt.div`
24797
25069
  `;
24798
25070
 
24799
25071
  // src/components/elements/metered-features/MeteredFeatures.tsx
24800
- import { Fragment as Fragment23, jsx as jsx55, jsxs as jsxs41 } from "react/jsx-runtime";
25072
+ import { Fragment as Fragment23, jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
24801
25073
  var Limit = ({ entitlement, usageDetails, fontStyle }) => {
24802
25074
  const { t: t4 } = useTranslation();
24803
25075
  const { data } = useEmbed();
@@ -24834,9 +25106,9 @@ var Limit = ({ entitlement, usageDetails, fontStyle }) => {
24834
25106
  })
24835
25107
  );
24836
25108
  }
24837
- return /* @__PURE__ */ jsxs41(Text, { display: fontStyle, children: [
25109
+ return /* @__PURE__ */ jsxs42(Text, { display: fontStyle, children: [
24838
25110
  acc.join(" \u2022 "),
24839
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx55(
25111
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx56(
24840
25112
  HardLimitTooltip,
24841
25113
  {
24842
25114
  feature: entitlement.feature,
@@ -24866,6 +25138,9 @@ function resolveDesignProps4(props) {
24866
25138
  isVisible: props.usage?.isVisible ?? true,
24867
25139
  fontStyle: props.usage?.fontStyle ?? "heading5"
24868
25140
  },
25141
+ usageByUser: {
25142
+ isVisible: props.usageByUser?.isVisible ?? true
25143
+ },
24869
25144
  // there is a typescript bug with `DeepPartial` so we must cast to `string[] | undefined`
24870
25145
  visibleFeatures: props.visibleFeatures
24871
25146
  };
@@ -24878,7 +25153,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24878
25153
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
24879
25154
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
24880
25155
  const isLightBackground = useIsLightBackground();
24881
- const meteredFeatures = useMemo27(() => {
25156
+ const meteredFeatures = useMemo28(() => {
24882
25157
  const orderedFeatureUsage = props.visibleFeatures?.reduce(
24883
25158
  (acc, id) => {
24884
25159
  const mappedFeatureUsage = data?.featureUsage?.features.find(
@@ -24895,7 +25170,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24895
25170
  ({ feature }) => feature?.featureType === FeatureType.Event || feature?.featureType === FeatureType.Trait
24896
25171
  );
24897
25172
  }, [props.visibleFeatures, data?.featureUsage?.features]);
24898
- const creditGroups = useMemo27(
25173
+ const creditGroups = useMemo28(
24899
25174
  () => withEmptyPlanCreditBalances(
24900
25175
  aggregateActiveGrantsByCredit(data?.creditGrants || []),
24901
25176
  listPlanCredits(
@@ -24906,7 +25181,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24906
25181
  ),
24907
25182
  [data?.creditGrants, data?.featureUsage?.features, data?.company]
24908
25183
  );
24909
- const planCreditCompositions = useMemo27(
25184
+ const planCreditCompositions = useMemo28(
24910
25185
  () => groupPlanCreditGrants(data?.company?.plan?.includedCreditGrants ?? []),
24911
25186
  [data?.company?.plan?.includedCreditGrants]
24912
25187
  );
@@ -24920,14 +25195,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24920
25195
  },
24921
25196
  [data?.featureUsage?.features]
24922
25197
  );
24923
- const purchasableCreditIds = useMemo27(
25198
+ const purchasableCreditIds = useMemo28(
24924
25199
  () => getPurchasableCreditIds(data?.creditBundles, data?.company?.plan?.id),
24925
25200
  [data?.creditBundles, data?.company?.plan?.id]
24926
25201
  );
24927
- const [expandedCreditIds, setExpandedCreditIds] = useState18(
25202
+ const [expandedCreditIds, setExpandedCreditIds] = useState19(
24928
25203
  () => /* @__PURE__ */ new Set()
24929
25204
  );
24930
- const [fullLedgerCreditIds, setFullLedgerCreditIds] = useState18(
25205
+ const [fullLedgerCreditIds, setFullLedgerCreditIds] = useState19(
24931
25206
  () => /* @__PURE__ */ new Set()
24932
25207
  );
24933
25208
  const toggleFullLedger = useCallback14((id) => {
@@ -24967,7 +25242,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24967
25242
  const period = getSubscriptionPeriod(data?.company?.billingSubscription) ?? (typeof data?.company?.plan?.planPeriod === "string" ? data.company?.plan?.planPeriod : void 0);
24968
25243
  const canCheckout = data?.capabilities?.checkout ?? false;
24969
25244
  const showCredits = data?.displaySettings?.showCredits ?? true;
24970
- return /* @__PURE__ */ jsxs41(Container2, { ref, className, children: [
25245
+ return /* @__PURE__ */ jsxs42(Container2, { ref, className, children: [
24971
25246
  meteredFeatures.reduce((acc, entitlement, index) => {
24972
25247
  if (!entitlement.feature) {
24973
25248
  return acc;
@@ -24978,9 +25253,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24978
25253
  });
24979
25254
  const { limit } = usageDetails;
24980
25255
  acc.push(
24981
- /* @__PURE__ */ jsxs41(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
24982
- /* @__PURE__ */ jsxs41(Flex, { $gap: "1.5rem", children: [
24983
- props.icon.isVisible && /* @__PURE__ */ jsx55(
25256
+ /* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1.5rem", children: [
25257
+ /* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
25258
+ props.icon.isVisible && /* @__PURE__ */ jsx56(
24984
25259
  Icon3,
24985
25260
  {
24986
25261
  name: feature.icon,
@@ -24989,8 +25264,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
24989
25264
  rounded: true
24990
25265
  }
24991
25266
  ),
24992
- /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
24993
- /* @__PURE__ */ jsxs41(
25267
+ /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25268
+ /* @__PURE__ */ jsxs42(
24994
25269
  Flex,
24995
25270
  {
24996
25271
  ref: (el) => {
@@ -25001,31 +25276,31 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25001
25276
  $flexWrap: "wrap",
25002
25277
  $gap: "1rem",
25003
25278
  children: [
25004
- /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25005
- /* @__PURE__ */ jsx55(Box, { children: /* @__PURE__ */ jsx55(Text, { display: props.header.fontStyle, children: feature.name }) }),
25006
- props.description.isVisible && feature.description && /* @__PURE__ */ jsx55(Box, { children: /* @__PURE__ */ jsx55(Text, { display: props.description.fontStyle, children: feature.description }) })
25279
+ /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25280
+ /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: feature.name }) }),
25281
+ props.description.isVisible && feature.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: feature.description }) })
25007
25282
  ] }),
25008
- /* @__PURE__ */ jsxs41(
25283
+ /* @__PURE__ */ jsxs42(
25009
25284
  Box,
25010
25285
  {
25011
25286
  $flexBasis: "min-content",
25012
25287
  $flexGrow: 1,
25013
25288
  $textAlign: shouldWrapChildren ? "left" : "right",
25014
25289
  children: [
25015
- props.usage.isVisible && /* @__PURE__ */ jsx55(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx55(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs41(Fragment23, { children: [
25016
- typeof limit === "number" && /* @__PURE__ */ jsxs41(Fragment23, { children: [
25290
+ props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: priceBehavior === EntitlementPriceBehavior.PayInAdvance ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
25291
+ typeof limit === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
25017
25292
  formatNumber(limit),
25018
25293
  " "
25019
25294
  ] }),
25020
25295
  getFeatureName(feature, limit)
25021
- ] }) : typeof usage === "number" && /* @__PURE__ */ jsxs41(Fragment23, { children: [
25296
+ ] }) : typeof usage === "number" && /* @__PURE__ */ jsxs42(Fragment23, { children: [
25022
25297
  formatNumber(usage),
25023
25298
  " ",
25024
25299
  getFeatureName(feature, usage),
25025
25300
  " ",
25026
25301
  t4("used")
25027
25302
  ] }) }) }),
25028
- props.allocation.isVisible && /* @__PURE__ */ jsx55(
25303
+ props.allocation.isVisible && /* @__PURE__ */ jsx56(
25029
25304
  Limit,
25030
25305
  {
25031
25306
  entitlement,
@@ -25039,8 +25314,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25039
25314
  ]
25040
25315
  }
25041
25316
  ),
25042
- props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ jsx55(Meter, { entitlement }),
25043
- canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsx55(
25317
+ props.isVisible && priceBehavior !== EntitlementPriceBehavior.PayAsYouGo && priceBehavior !== EntitlementPriceBehavior.CreditBurndown && /* @__PURE__ */ jsx56(Meter, { entitlement }),
25318
+ canCheckout && priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsx56(
25044
25319
  Button,
25045
25320
  {
25046
25321
  type: "button",
@@ -25053,13 +25328,24 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25053
25328
  )
25054
25329
  ] })
25055
25330
  ] }),
25056
- (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ jsx55(
25331
+ (priceBehavior === EntitlementPriceBehavior.Overage || priceBehavior === EntitlementPriceBehavior.Tier) && /* @__PURE__ */ jsx56(
25057
25332
  PriceDetails,
25058
25333
  {
25059
25334
  entitlement,
25060
25335
  usageDetails,
25061
25336
  period
25062
25337
  }
25338
+ ),
25339
+ props.usageByUser.isVisible && feature.featureType === FeatureType.Event && // The per-user amounts come from the feature usage endpoint, so
25340
+ // they are denominated in the feature's own unit — the same one
25341
+ // the usage line above uses. A credit-burndown feature's credit
25342
+ // spend is broken down separately, under its credit.
25343
+ /* @__PURE__ */ jsx56(
25344
+ UsageByUser,
25345
+ {
25346
+ source: { kind: "feature", id: feature.id },
25347
+ unit: feature
25348
+ }
25063
25349
  )
25064
25350
  ] }, index)
25065
25351
  );
@@ -25073,9 +25359,9 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25073
25359
  const visibleGrants = showAllGrants ? credit.grants : credit.grants.slice(0, VISIBLE_CREDIT_COUNT);
25074
25360
  const paddingX = settings.theme.card.padding / TEXT_BASE_SIZE;
25075
25361
  const getRowPadding = (rowIndex) => rowIndex === 0 ? `1rem ${paddingX}rem` : `0 ${paddingX}rem 1rem`;
25076
- return /* @__PURE__ */ jsxs41(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25077
- /* @__PURE__ */ jsxs41(Flex, { $gap: "1.5rem", children: [
25078
- props.icon.isVisible && /* @__PURE__ */ jsx55(
25362
+ return /* @__PURE__ */ jsxs42(Element, { as: Flex, $flexDirection: "column", $gap: "1rem", children: [
25363
+ /* @__PURE__ */ jsxs42(Flex, { $gap: "1.5rem", children: [
25364
+ props.icon.isVisible && /* @__PURE__ */ jsx56(
25079
25365
  Icon3,
25080
25366
  {
25081
25367
  name: credit.icon,
@@ -25084,13 +25370,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25084
25370
  rounded: true
25085
25371
  }
25086
25372
  ),
25087
- /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25088
- /* @__PURE__ */ jsx55(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs41(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25089
- /* @__PURE__ */ jsx55(Box, { children: /* @__PURE__ */ jsx55(Text, { display: props.header.fontStyle, children: credit.name }) }),
25090
- props.description.isVisible && credit.description && /* @__PURE__ */ jsx55(Box, { children: /* @__PURE__ */ jsx55(Text, { display: props.description.fontStyle, children: credit.description }) })
25373
+ /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "2rem", $flexGrow: 1, children: [
25374
+ /* @__PURE__ */ jsx56(Flex, { $flexWrap: "wrap", $gap: "1rem", children: /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.5rem", $flexGrow: 1, children: [
25375
+ /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: credit.name }) }),
25376
+ props.description.isVisible && credit.description && /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(Text, { display: props.description.fontStyle, children: credit.description }) })
25091
25377
  ] }) }),
25092
- /* @__PURE__ */ jsxs41(Flex, { $gap: "1rem", $alignItems: "center", children: [
25093
- props.usage.isVisible && /* @__PURE__ */ jsx55(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx55(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
25378
+ /* @__PURE__ */ jsxs42(Flex, { $gap: "1rem", $alignItems: "center", children: [
25379
+ props.usage.isVisible && /* @__PURE__ */ jsx56(Box, { $flexGrow: 1, $whiteSpace: "nowrap", children: /* @__PURE__ */ jsx56(Text, { display: props.usage.fontStyle, children: t4("X units remaining", {
25094
25380
  // Balances burn at rates with up to 10 decimal
25095
25381
  // places, so a small remainder must not round to 0.
25096
25382
  amount: formatNumber(credit.total.remaining, {
@@ -25101,7 +25387,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25101
25387
  credit.total.remaining
25102
25388
  )
25103
25389
  }) }) }),
25104
- canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx55(
25390
+ canCheckout && purchasableCreditIds.has(credit.id) && /* @__PURE__ */ jsx56(
25105
25391
  Button,
25106
25392
  {
25107
25393
  type: "button",
@@ -25154,7 +25440,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25154
25440
  const renewalDate = data?.upcomingInvoice?.dueDate;
25155
25441
  return (
25156
25442
  // Pulled up against the balance line despite the column's 2rem gap
25157
- /* @__PURE__ */ jsx55(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs41(
25443
+ /* @__PURE__ */ jsx56(Box, { $marginTop: "-1.5rem", children: /* @__PURE__ */ jsxs42(
25158
25444
  Text,
25159
25445
  {
25160
25446
  style: { opacity: 0.54 },
@@ -25167,7 +25453,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25167
25453
  period: shortenPeriod(composition.period),
25168
25454
  composition: ` \u2014 ${parts.join(" + ")}`
25169
25455
  }),
25170
- renewalDate && /* @__PURE__ */ jsxs41(Fragment23, { children: [
25456
+ renewalDate && /* @__PURE__ */ jsxs42(Fragment23, { children: [
25171
25457
  " ",
25172
25458
  t4("Renews on the day", {
25173
25459
  day: formatOrdinal(renewalDate.getDate())
@@ -25180,12 +25466,12 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25180
25466
  })()
25181
25467
  ] })
25182
25468
  ] }),
25183
- hasGrants && /* @__PURE__ */ jsx55(
25469
+ hasGrants && /* @__PURE__ */ jsx56(
25184
25470
  Box,
25185
25471
  {
25186
25472
  $width: `calc(100% + ${2 * settings.theme.card.padding / TEXT_BASE_SIZE}rem)`,
25187
25473
  $margin: `0 0 0 -${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
25188
- children: /* @__PURE__ */ jsxs41(
25474
+ children: /* @__PURE__ */ jsxs42(
25189
25475
  TransitionBox,
25190
25476
  {
25191
25477
  $backgroundColor: isLightBackground ? "hsla(0, 0%, 0%, 0.0375)" : "hsla(0, 0%, 100%, 0.075)",
@@ -25193,22 +25479,22 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25193
25479
  children: [
25194
25480
  visibleGrants.map((grant, index2) => {
25195
25481
  const padding = getRowPadding(index2);
25196
- return /* @__PURE__ */ jsx55(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ jsxs41(Fragment23, { children: [
25197
- /* @__PURE__ */ jsx55(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx55(Text, { children: t4("X items included in plan", {
25482
+ return /* @__PURE__ */ jsx56(Box, { $display: "table-row", children: grant.grantReason === BillingCreditGrantReason.Plan ? /* @__PURE__ */ jsxs42(Fragment23, { children: [
25483
+ /* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: t4("X items included in plan", {
25198
25484
  amount: grant.quantity,
25199
25485
  item: getFeatureName(
25200
25486
  credit,
25201
25487
  grant.quantity
25202
25488
  )
25203
25489
  }) }) }),
25204
- /* @__PURE__ */ jsx55(
25490
+ /* @__PURE__ */ jsx56(
25205
25491
  Box,
25206
25492
  {
25207
25493
  $display: "table-cell",
25208
25494
  $padding: padding,
25209
25495
  $textAlign: "right",
25210
25496
  $whiteSpace: "nowrap",
25211
- children: grant.expiresAt && /* @__PURE__ */ jsx55(Text, { children: t4("Resets", {
25497
+ children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Resets", {
25212
25498
  date: toPrettyDate(
25213
25499
  modifyDate(grant.expiresAt, 1),
25214
25500
  { month: "short" }
@@ -25216,15 +25502,15 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25216
25502
  }) })
25217
25503
  }
25218
25504
  )
25219
- ] }) : /* @__PURE__ */ jsxs41(Fragment23, { children: [
25220
- /* @__PURE__ */ jsx55(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx55(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx55(Fragment23, { children: t4("X item bundle", {
25505
+ ] }) : /* @__PURE__ */ jsxs42(Fragment23, { children: [
25506
+ /* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: padding, children: /* @__PURE__ */ jsx56(Text, { children: grant.grantReason === BillingCreditGrantReason.Purchased ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item bundle", {
25221
25507
  amount: grant.quantity,
25222
25508
  item: getFeatureName(credit, 1),
25223
25509
  createdAt: toPrettyDate(
25224
25510
  grant.createdAt,
25225
25511
  { month: "short" }
25226
25512
  )
25227
- }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ jsx55(Fragment23, { children: t4("X item auto-topup", {
25513
+ }) }) : grant.grantReason === BillingCreditGrantReason.BillingCreditAutoTopup ? /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item auto-topup", {
25228
25514
  amount: grant.quantity,
25229
25515
  item: getFeatureName(
25230
25516
  credit,
@@ -25234,7 +25520,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25234
25520
  grant.createdAt,
25235
25521
  { month: "short" }
25236
25522
  )
25237
- }) }) : /* @__PURE__ */ jsx55(Fragment23, { children: t4("X item grant", {
25523
+ }) }) : /* @__PURE__ */ jsx56(Fragment23, { children: t4("X item grant", {
25238
25524
  amount: grant.quantity,
25239
25525
  item: getFeatureName(
25240
25526
  credit,
@@ -25245,14 +25531,14 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25245
25531
  { month: "short" }
25246
25532
  )
25247
25533
  }) }) }) }),
25248
- /* @__PURE__ */ jsx55(
25534
+ /* @__PURE__ */ jsx56(
25249
25535
  Box,
25250
25536
  {
25251
25537
  $display: "table-cell",
25252
25538
  $padding: padding,
25253
25539
  $textAlign: "right",
25254
25540
  $whiteSpace: "nowrap",
25255
- children: grant.expiresAt && /* @__PURE__ */ jsx55(Text, { children: t4("Expires", {
25541
+ children: grant.expiresAt && /* @__PURE__ */ jsx56(Text, { children: t4("Expires", {
25256
25542
  date: toPrettyDate(
25257
25543
  modifyDate(grant.expiresAt, 1),
25258
25544
  { month: "short" }
@@ -25262,8 +25548,8 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25262
25548
  )
25263
25549
  ] }) }, grant.id);
25264
25550
  }),
25265
- canExpandLedger && /* @__PURE__ */ jsxs41(Box, { $display: "table-row", children: [
25266
- /* @__PURE__ */ jsx55(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ jsx55(
25551
+ canExpandLedger && /* @__PURE__ */ jsxs42(Box, { $display: "table-row", children: [
25552
+ /* @__PURE__ */ jsx56(Box, { $display: "table-cell", $padding: getRowPadding(1), children: /* @__PURE__ */ jsx56(
25267
25553
  ExpandListToggle,
25268
25554
  {
25269
25555
  isExpanded: showAllGrants,
@@ -25272,7 +25558,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25272
25558
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25273
25559
  }
25274
25560
  ) }),
25275
- /* @__PURE__ */ jsx55(
25561
+ /* @__PURE__ */ jsx56(
25276
25562
  Box,
25277
25563
  {
25278
25564
  $display: "table-cell",
@@ -25285,7 +25571,7 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25285
25571
  )
25286
25572
  }
25287
25573
  ),
25288
- hasGrants && /* @__PURE__ */ jsx55(
25574
+ hasGrants && /* @__PURE__ */ jsx56(
25289
25575
  ExpandListToggle,
25290
25576
  {
25291
25577
  isExpanded,
@@ -25294,6 +25580,13 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25294
25580
  collapseLabel: t4("Hide balance details"),
25295
25581
  iconColor: isLightBackground ? "hsla(0, 0%, 0%, 0.8)" : "hsla(0, 0%, 100%, 0.4)"
25296
25582
  }
25583
+ ),
25584
+ props.usageByUser.isVisible && /* @__PURE__ */ jsx56(
25585
+ UsageByUser,
25586
+ {
25587
+ source: { kind: "credit", id: credit.id },
25588
+ unit: credit
25589
+ }
25297
25590
  )
25298
25591
  ] }, index);
25299
25592
  })
@@ -25302,11 +25595,11 @@ var MeteredFeatures = forwardRef12(({ className, ...rest }, ref) => {
25302
25595
  MeteredFeatures.displayName = "MeteredFeatures";
25303
25596
 
25304
25597
  // src/components/elements/payment-method/PaymentMethod.tsx
25305
- import { forwardRef as forwardRef13, useMemo as useMemo29 } from "react";
25598
+ import { forwardRef as forwardRef13, useMemo as useMemo30 } from "react";
25306
25599
 
25307
25600
  // src/components/elements/payment-method/PaymentMethodElement.tsx
25308
- import { useMemo as useMemo28 } from "react";
25309
- import { jsx as jsx56, jsxs as jsxs42 } from "react/jsx-runtime";
25601
+ import { useMemo as useMemo29 } from "react";
25602
+ import { jsx as jsx57, jsxs as jsxs43 } from "react/jsx-runtime";
25310
25603
  var PaymentElement2 = ({
25311
25604
  iconName,
25312
25605
  iconTitle,
@@ -25314,8 +25607,8 @@ var PaymentElement2 = ({
25314
25607
  paymentLast4
25315
25608
  }) => {
25316
25609
  const { settings } = useEmbed();
25317
- return /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
25318
- iconName && /* @__PURE__ */ jsx56(
25610
+ return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "row", $alignItems: "center", $gap: "0.5rem", children: [
25611
+ iconName && /* @__PURE__ */ jsx57(
25319
25612
  Icon3,
25320
25613
  {
25321
25614
  name: iconName,
@@ -25323,15 +25616,15 @@ var PaymentElement2 = ({
25323
25616
  color: settings.theme.typography.text.color
25324
25617
  }
25325
25618
  ),
25326
- (label || paymentLast4) && /* @__PURE__ */ jsxs42(Box, { $flexGrow: 1, children: [
25327
- label && /* @__PURE__ */ jsx56(Text, { children: label }),
25619
+ (label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
25620
+ label && /* @__PURE__ */ jsx57(Text, { children: label }),
25328
25621
  " ",
25329
- paymentLast4 && /* @__PURE__ */ jsx56(Text, { children: paymentLast4 })
25622
+ paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
25330
25623
  ] })
25331
25624
  ] });
25332
25625
  };
25333
25626
  var EmptyPaymentElement = () => {
25334
- return /* @__PURE__ */ jsx56(Text, { children: /* @__PURE__ */ jsx56(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx56(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx56(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
25627
+ return /* @__PURE__ */ jsx57(Text, { children: /* @__PURE__ */ jsx57(Flex, { $flexDirection: "row", $alignItems: "center", children: /* @__PURE__ */ jsx57(Flex, { $alignItems: "center", children: /* @__PURE__ */ jsx57(Box, { $lineHeight: 1, children: t("No payment method added yet") }) }) }) });
25335
25628
  };
25336
25629
  var getPaymentMethodData = ({
25337
25630
  accountLast4,
@@ -25411,12 +25704,12 @@ var PaymentMethodElement = ({
25411
25704
  const isLightBackground = useIsLightBackground();
25412
25705
  const sizeFactor = size === "lg" ? 1.5 : size === "md" ? 1 : 0.5;
25413
25706
  const hasCustomFields = customCheckoutFields && customCheckoutFields.length > 0;
25414
- return /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
25415
- props.header.isVisible && /* @__PURE__ */ jsxs42(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
25416
- /* @__PURE__ */ jsx56(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
25417
- props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx56(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
25707
+ return /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: `${sizeFactor}rem`, children: [
25708
+ props.header.isVisible && /* @__PURE__ */ jsxs43(Flex, { $justifyContent: "space-between", $alignItems: "center", children: [
25709
+ /* @__PURE__ */ jsx57(Text, { display: props.header.fontStyle, children: t4("Payment Details") }),
25710
+ props.functions.showExpiration && typeof monthsToExpiration === "number" && monthsToExpiration < 4 && /* @__PURE__ */ jsx57(Text, { $size: 14, $color: "#DB6769", children: monthsToExpiration > 0 ? t4("Expires in X months", { months: monthsToExpiration }) : t4("Expired") })
25418
25711
  ] }),
25419
- /* @__PURE__ */ jsxs42(
25712
+ /* @__PURE__ */ jsxs43(
25420
25713
  Flex,
25421
25714
  {
25422
25715
  $justifyContent: "space-between",
@@ -25425,8 +25718,8 @@ var PaymentMethodElement = ({
25425
25718
  $padding: `${sizeFactor / 2.25}rem ${sizeFactor}rem`,
25426
25719
  $borderRadius: "9999px",
25427
25720
  children: [
25428
- paymentMethod ? /* @__PURE__ */ jsx56(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx56(EmptyPaymentElement, {}),
25429
- onRemove && /* @__PURE__ */ jsx56(
25721
+ paymentMethod ? /* @__PURE__ */ jsx57(PaymentElement2, { ...getPaymentMethodData(paymentMethod) }) : /* @__PURE__ */ jsx57(EmptyPaymentElement, {}),
25722
+ onRemove && /* @__PURE__ */ jsx57(
25430
25723
  Text,
25431
25724
  {
25432
25725
  onClick: onRemove,
@@ -25436,7 +25729,7 @@ var PaymentMethodElement = ({
25436
25729
  children: t4("Remove")
25437
25730
  }
25438
25731
  ),
25439
- props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx56(
25732
+ props.functions.allowEdit && onEdit && /* @__PURE__ */ jsx57(
25440
25733
  Text,
25441
25734
  {
25442
25735
  onClick: onEdit,
@@ -25449,8 +25742,8 @@ var PaymentMethodElement = ({
25449
25742
  ]
25450
25743
  }
25451
25744
  ),
25452
- hasCustomFields && /* @__PURE__ */ jsx56(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ jsxs42(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
25453
- /* @__PURE__ */ jsx56(
25745
+ hasCustomFields && /* @__PURE__ */ jsx57(Flex, { $flexDirection: "column", $gap: "0.75rem", $marginTop: "0.5rem", children: customCheckoutFields.map((field) => /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: "0.125rem", children: [
25746
+ /* @__PURE__ */ jsx57(
25454
25747
  Text,
25455
25748
  {
25456
25749
  $size: 12,
@@ -25458,7 +25751,7 @@ var PaymentMethodElement = ({
25458
25751
  children: field.name
25459
25752
  }
25460
25753
  ),
25461
- /* @__PURE__ */ jsx56(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ jsx56(
25754
+ /* @__PURE__ */ jsx57(Text, { $size: 14, children: field.value != null && field.value !== "" ? field.value : /* @__PURE__ */ jsx57(
25462
25755
  "span",
25463
25756
  {
25464
25757
  style: {
@@ -25479,7 +25772,7 @@ var PaymentListElement = ({
25479
25772
  const { settings } = useEmbed();
25480
25773
  const isLightBackground = useIsLightBackground();
25481
25774
  const { iconName, iconTitle, label, paymentLast4 } = getPaymentMethodData(paymentMethod);
25482
- const expirationDate = useMemo28(() => {
25775
+ const expirationDate = useMemo29(() => {
25483
25776
  const { cardExpMonth, cardExpYear } = paymentMethod;
25484
25777
  if (!cardExpMonth || !cardExpYear) {
25485
25778
  return;
@@ -25490,7 +25783,7 @@ var PaymentListElement = ({
25490
25783
  }
25491
25784
  return `${cardExpMonth}/${formatedYear}`;
25492
25785
  }, [paymentMethod]);
25493
- return /* @__PURE__ */ jsxs42(
25786
+ return /* @__PURE__ */ jsxs43(
25494
25787
  Flex,
25495
25788
  {
25496
25789
  $flexDirection: "row",
@@ -25502,7 +25795,7 @@ var PaymentListElement = ({
25502
25795
  $borderStyle: "solid",
25503
25796
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
25504
25797
  children: [
25505
- iconName && /* @__PURE__ */ jsx56(
25798
+ iconName && /* @__PURE__ */ jsx57(
25506
25799
  Icon3,
25507
25800
  {
25508
25801
  name: iconName,
@@ -25510,20 +25803,20 @@ var PaymentListElement = ({
25510
25803
  color: settings.theme.typography.text.color
25511
25804
  }
25512
25805
  ),
25513
- (label || paymentLast4) && /* @__PURE__ */ jsxs42(Box, { $flexGrow: 1, children: [
25514
- label && /* @__PURE__ */ jsx56(Text, { children: label }),
25806
+ (label || paymentLast4) && /* @__PURE__ */ jsxs43(Box, { $flexGrow: 1, children: [
25807
+ label && /* @__PURE__ */ jsx57(Text, { children: label }),
25515
25808
  " ",
25516
- paymentLast4 && /* @__PURE__ */ jsx56(Text, { children: paymentLast4 })
25809
+ paymentLast4 && /* @__PURE__ */ jsx57(Text, { children: paymentLast4 })
25517
25810
  ] }),
25518
- expirationDate && /* @__PURE__ */ jsx56(
25811
+ expirationDate && /* @__PURE__ */ jsx57(
25519
25812
  Box,
25520
25813
  {
25521
25814
  $flexGrow: 1,
25522
25815
  $color: isLightBackground ? "hsla(0, 0%, 0%, 0.375)" : "hsla(0, 0%, 100%, 0.375)",
25523
- children: /* @__PURE__ */ jsx56(Text, { children: t("Expires", { date: expirationDate }) })
25816
+ children: /* @__PURE__ */ jsx57(Text, { children: t("Expires", { date: expirationDate }) })
25524
25817
  }
25525
25818
  ),
25526
- /* @__PURE__ */ jsx56(Box, { children: /* @__PURE__ */ jsx56(
25819
+ /* @__PURE__ */ jsx57(Box, { children: /* @__PURE__ */ jsx57(
25527
25820
  Text,
25528
25821
  {
25529
25822
  onClick: () => {
@@ -25536,7 +25829,7 @@ var PaymentListElement = ({
25536
25829
  children: t("Set default")
25537
25830
  }
25538
25831
  ) }),
25539
- /* @__PURE__ */ jsx56(
25832
+ /* @__PURE__ */ jsx57(
25540
25833
  Icon3,
25541
25834
  {
25542
25835
  tabIndex: 0,
@@ -25558,7 +25851,7 @@ var PaymentListElement = ({
25558
25851
  };
25559
25852
 
25560
25853
  // src/components/elements/payment-method/PaymentMethod.tsx
25561
- import { jsx as jsx57 } from "react/jsx-runtime";
25854
+ import { jsx as jsx58 } from "react/jsx-runtime";
25562
25855
  var resolveDesignProps5 = (props) => {
25563
25856
  return {
25564
25857
  header: {
@@ -25574,7 +25867,7 @@ var resolveDesignProps5 = (props) => {
25574
25867
  var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = true, ...rest }, ref) => {
25575
25868
  const props = resolveDesignProps5(rest);
25576
25869
  const { data, setLayout } = useEmbed();
25577
- const { paymentMethod, monthsToExpiration } = useMemo29(() => {
25870
+ const { paymentMethod, monthsToExpiration } = useMemo30(() => {
25578
25871
  const paymentMethod2 = data?.subscription?.paymentMethod || data?.company?.defaultPaymentMethod;
25579
25872
  let monthsToExpiration2;
25580
25873
  if (typeof paymentMethod2?.cardExpYear === "number" && typeof paymentMethod2?.cardExpMonth === "number") {
@@ -25593,7 +25886,7 @@ var PaymentMethod = forwardRef13(({ children, className, portal, allowEdit = tru
25593
25886
  monthsToExpiration: monthsToExpiration2
25594
25887
  };
25595
25888
  }, [data?.company?.defaultPaymentMethod, data?.subscription?.paymentMethod]);
25596
- return /* @__PURE__ */ jsx57(Element, { ref, className, children: /* @__PURE__ */ jsx57(
25889
+ return /* @__PURE__ */ jsx58(Element, { ref, className, children: /* @__PURE__ */ jsx58(
25597
25890
  PaymentMethodElement,
25598
25891
  {
25599
25892
  customCheckoutFields: data?.customCheckoutFields,
@@ -25778,8 +26071,8 @@ var loadStripe = function loadStripe2() {
25778
26071
  };
25779
26072
 
25780
26073
  // src/components/elements/payment-method/PaymentMethodDetails.tsx
25781
- import { useCallback as useCallback15, useEffect as useEffect7, useMemo as useMemo30, useState as useState19 } from "react";
25782
- import { jsx as jsx58, jsxs as jsxs43 } from "react/jsx-runtime";
26074
+ import { useCallback as useCallback15, useEffect as useEffect8, useMemo as useMemo31, useState as useState20 } from "react";
26075
+ import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
25783
26076
  var resolveDesignProps6 = () => {
25784
26077
  return {
25785
26078
  header: {
@@ -25807,7 +26100,7 @@ var PaymentMethodDetails = ({
25807
26100
  updatePaymentMethod,
25808
26101
  deletePaymentMethod
25809
26102
  } = useEmbed();
25810
- const { defaultPaymentMethod, paymentMethods, subscription } = useMemo30(() => {
26103
+ const { defaultPaymentMethod, paymentMethods, subscription } = useMemo31(() => {
25811
26104
  return {
25812
26105
  defaultPaymentMethod: data?.company?.defaultPaymentMethod,
25813
26106
  paymentMethods: data?.company?.paymentMethods || [],
@@ -25820,13 +26113,13 @@ var PaymentMethodDetails = ({
25820
26113
  ]);
25821
26114
  const isLightBackground = useIsLightBackground();
25822
26115
  const initialPaymentMethod = subscription?.paymentMethod || defaultPaymentMethod;
25823
- const [isLoading, setIsLoading] = useState19(!initialPaymentMethod);
25824
- const [error, setError] = useState19();
25825
- const [showPaymentForm, setShowPaymentForm] = useState19(false);
25826
- const [stripe, setStripe] = useState19(null);
25827
- const [setupIntent, setSetupIntent] = useState19();
25828
- const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState19(false);
25829
- const [currentPaymentMethod, setCurrentPaymentMethod] = useState19(initialPaymentMethod);
26116
+ const [isLoading, setIsLoading] = useState20(!initialPaymentMethod);
26117
+ const [error, setError] = useState20();
26118
+ const [showPaymentForm, setShowPaymentForm] = useState20(false);
26119
+ const [stripe, setStripe] = useState20(null);
26120
+ const [setupIntent, setSetupIntent] = useState20();
26121
+ const [showDifferentPaymentMethods, setShowDifferentPaymentMethods] = useState20(false);
26122
+ const [currentPaymentMethod, setCurrentPaymentMethod] = useState20(initialPaymentMethod);
25830
26123
  const { isConfirming: isConfirmingPayment } = usePaymentConfirmation({
25831
26124
  stripe,
25832
26125
  clientSecret: confirmPaymentIntentProps?.clientSecret,
@@ -25839,7 +26132,7 @@ var PaymentMethodDetails = ({
25839
26132
  },
25840
26133
  autoConfirm: true
25841
26134
  });
25842
- const monthsToExpiration = useMemo30(() => {
26135
+ const monthsToExpiration = useMemo31(() => {
25843
26136
  let expiration;
25844
26137
  if (typeof currentPaymentMethod?.cardExpYear === "number" && typeof currentPaymentMethod?.cardExpMonth === "number") {
25845
26138
  const now = /* @__PURE__ */ new Date();
@@ -25862,7 +26155,7 @@ var PaymentMethodDetails = ({
25862
26155
  const toggleShowPaymentMethods = () => {
25863
26156
  setShowDifferentPaymentMethods((prev2) => !prev2);
25864
26157
  };
25865
- const locale = useMemo30(() => stripeLocale(i18n.language), [i18n.language]);
26158
+ const locale = useMemo31(() => stripeLocale(i18n.language), [i18n.language]);
25866
26159
  const initializeStripe = useCallback15(() => {
25867
26160
  if (stripe || !setupIntent) {
25868
26161
  return;
@@ -25939,10 +26232,10 @@ var PaymentMethodDetails = ({
25939
26232
  },
25940
26233
  [t4, deletePaymentMethod]
25941
26234
  );
25942
- useEffect7(() => {
26235
+ useEffect8(() => {
25943
26236
  initializeStripe();
25944
26237
  }, [initializeStripe]);
25945
- useEffect7(() => {
26238
+ useEffect8(() => {
25946
26239
  if (!setupIntent && (!currentPaymentMethod || showPaymentForm)) {
25947
26240
  initializePaymentMethod();
25948
26241
  }
@@ -25952,7 +26245,7 @@ var PaymentMethodDetails = ({
25952
26245
  showPaymentForm,
25953
26246
  initializePaymentMethod
25954
26247
  ]);
25955
- return /* @__PURE__ */ jsxs43(
26248
+ return /* @__PURE__ */ jsxs44(
25956
26249
  Flex,
25957
26250
  {
25958
26251
  $position: "relative",
@@ -25960,7 +26253,7 @@ var PaymentMethodDetails = ({
25960
26253
  $flexGrow: 1,
25961
26254
  $gap: "1.5rem",
25962
26255
  children: [
25963
- /* @__PURE__ */ jsx58(
26256
+ /* @__PURE__ */ jsx59(
25964
26257
  Flex,
25965
26258
  {
25966
26259
  $position: "absolute",
@@ -25969,7 +26262,7 @@ var PaymentMethodDetails = ({
25969
26262
  $alignItems: "center",
25970
26263
  $width: "100%",
25971
26264
  $height: "100%",
25972
- children: /* @__PURE__ */ jsx58(
26265
+ children: /* @__PURE__ */ jsx59(
25973
26266
  Loader,
25974
26267
  {
25975
26268
  $color: settings.theme.primary,
@@ -25979,7 +26272,7 @@ var PaymentMethodDetails = ({
25979
26272
  )
25980
26273
  }
25981
26274
  ),
25982
- /* @__PURE__ */ jsxs43(
26275
+ /* @__PURE__ */ jsxs44(
25983
26276
  Flex,
25984
26277
  {
25985
26278
  $zIndex: isLoading || isConfirmingPayment ? 0 : 1,
@@ -25996,7 +26289,7 @@ var PaymentMethodDetails = ({
25996
26289
  }
25997
26290
  },
25998
26291
  children: [
25999
- setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs43(
26292
+ setupIntent && showPaymentForm && stripe ? /* @__PURE__ */ jsxs44(
26000
26293
  Elements,
26001
26294
  {
26002
26295
  stripe,
@@ -26027,7 +26320,7 @@ var PaymentMethodDetails = ({
26027
26320
  clientSecret: setupIntent?.setupIntentClientSecret
26028
26321
  },
26029
26322
  children: [
26030
- /* @__PURE__ */ jsx58(
26323
+ /* @__PURE__ */ jsx59(
26031
26324
  PaymentForm,
26032
26325
  {
26033
26326
  financeData,
@@ -26038,7 +26331,7 @@ var PaymentMethodDetails = ({
26038
26331
  }
26039
26332
  }
26040
26333
  ),
26041
- currentPaymentMethod && /* @__PURE__ */ jsx58(Box, { children: /* @__PURE__ */ jsx58(
26334
+ currentPaymentMethod && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(
26042
26335
  Text,
26043
26336
  {
26044
26337
  onClick: focusExistingPaymentMethods,
@@ -26051,8 +26344,8 @@ var PaymentMethodDetails = ({
26051
26344
  ) })
26052
26345
  ]
26053
26346
  }
26054
- ) : /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26055
- /* @__PURE__ */ jsx58(
26347
+ ) : /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", children: [
26348
+ /* @__PURE__ */ jsx59(
26056
26349
  PaymentMethodElement,
26057
26350
  {
26058
26351
  paymentMethod: currentPaymentMethod,
@@ -26065,8 +26358,8 @@ var PaymentMethodDetails = ({
26065
26358
  ...props
26066
26359
  }
26067
26360
  ),
26068
- paymentMethods.length > 0 && /* @__PURE__ */ jsxs43(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26069
- /* @__PURE__ */ jsx58(
26361
+ paymentMethods.length > 0 && /* @__PURE__ */ jsxs44(Flex, { $alignItems: "center", $gap: "0.5rem", children: [
26362
+ /* @__PURE__ */ jsx59(
26070
26363
  Text,
26071
26364
  {
26072
26365
  onClick: toggleShowPaymentMethods,
@@ -26077,7 +26370,7 @@ var PaymentMethodDetails = ({
26077
26370
  children: t4("Choose different payment method")
26078
26371
  }
26079
26372
  ),
26080
- /* @__PURE__ */ jsx58(
26373
+ /* @__PURE__ */ jsx59(
26081
26374
  Icon3,
26082
26375
  {
26083
26376
  name: showDifferentPaymentMethods ? "chevron-up" : "chevron-down",
@@ -26085,10 +26378,10 @@ var PaymentMethodDetails = ({
26085
26378
  }
26086
26379
  )
26087
26380
  ] }),
26088
- showDifferentPaymentMethods && /* @__PURE__ */ jsxs43(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26089
- paymentMethods.length > 1 && /* @__PURE__ */ jsx58(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26381
+ showDifferentPaymentMethods && /* @__PURE__ */ jsxs44(Flex, { $flexDirection: "column", $gap: "2rem", $marginTop: "-1rem", children: [
26382
+ paymentMethods.length > 1 && /* @__PURE__ */ jsx59(Flex, { $flexDirection: "column", $overflow: "auto", children: (paymentMethods.filter(
26090
26383
  (paymentMethod) => paymentMethod.id !== currentPaymentMethod?.id
26091
- ) || []).map((paymentMethod) => /* @__PURE__ */ jsx58(
26384
+ ) || []).map((paymentMethod) => /* @__PURE__ */ jsx59(
26092
26385
  PaymentListElement,
26093
26386
  {
26094
26387
  paymentMethod,
@@ -26097,7 +26390,7 @@ var PaymentMethodDetails = ({
26097
26390
  },
26098
26391
  paymentMethod.id
26099
26392
  )) }),
26100
- /* @__PURE__ */ jsx58(
26393
+ /* @__PURE__ */ jsx59(
26101
26394
  Button,
26102
26395
  {
26103
26396
  type: "button",
@@ -26112,7 +26405,7 @@ var PaymentMethodDetails = ({
26112
26405
  )
26113
26406
  ] })
26114
26407
  ] }),
26115
- !isLoading && error && /* @__PURE__ */ jsx58(Box, { children: /* @__PURE__ */ jsx58(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26408
+ !isLoading && error && /* @__PURE__ */ jsx59(Box, { children: /* @__PURE__ */ jsx59(Text, { $weight: 500, $color: "#DB6669", children: error }) })
26116
26409
  ]
26117
26410
  }
26118
26411
  )
@@ -26122,13 +26415,13 @@ var PaymentMethodDetails = ({
26122
26415
  };
26123
26416
 
26124
26417
  // src/components/elements/plan-manager/PlanManager.tsx
26125
- import { forwardRef as forwardRef14, useMemo as useMemo32 } from "react";
26418
+ import { forwardRef as forwardRef14, useMemo as useMemo33 } from "react";
26126
26419
 
26127
26420
  // src/components/elements/plan-manager/AddOn.tsx
26128
- import { jsx as jsx59, jsxs as jsxs44 } from "react/jsx-runtime";
26421
+ import { jsx as jsx60, jsxs as jsxs45 } from "react/jsx-runtime";
26129
26422
  var AddOn = ({ addOn, currency, period, layout }) => {
26130
26423
  const resolvedPeriod = addOn.planPeriod === "one-time" ? addOn.planPeriod : period ?? addOn.planPeriod;
26131
- return /* @__PURE__ */ jsxs44(
26424
+ return /* @__PURE__ */ jsxs45(
26132
26425
  Flex,
26133
26426
  {
26134
26427
  $justifyContent: "space-between",
@@ -26136,10 +26429,10 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26136
26429
  $flexWrap: "wrap",
26137
26430
  $gap: "1rem",
26138
26431
  children: [
26139
- /* @__PURE__ */ jsx59(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26140
- typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs44(Text, { children: [
26432
+ /* @__PURE__ */ jsx60(Text, { display: layout.addOns.fontStyle, children: addOn.name }),
26433
+ typeof addOn.planPrice === "number" && resolvedPeriod && /* @__PURE__ */ jsxs45(Text, { children: [
26141
26434
  formatCurrency(addOn.planPrice, currency),
26142
- /* @__PURE__ */ jsx59("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26435
+ /* @__PURE__ */ jsx60("sub", { children: resolvedPeriod === "one-time" ? shortenPeriod(resolvedPeriod) : `/${shortenPeriod(resolvedPeriod)}` })
26143
26436
  ] })
26144
26437
  ]
26145
26438
  }
@@ -26147,8 +26440,8 @@ var AddOn = ({ addOn, currency, period, layout }) => {
26147
26440
  };
26148
26441
 
26149
26442
  // src/components/elements/plan-manager/UsageDetails.tsx
26150
- import { Fragment as Fragment24, useMemo as useMemo31 } from "react";
26151
- import { Fragment as Fragment25, jsx as jsx60, jsxs as jsxs45 } from "react/jsx-runtime";
26443
+ import { Fragment as Fragment24, useMemo as useMemo32 } from "react";
26444
+ import { Fragment as Fragment25, jsx as jsx61, jsxs as jsxs46 } from "react/jsx-runtime";
26152
26445
  var UsageDetails2 = ({
26153
26446
  entitlement,
26154
26447
  period,
@@ -26163,40 +26456,40 @@ var UsageDetails2 = ({
26163
26456
  billingPrice,
26164
26457
  limit,
26165
26458
  cost = 0
26166
- } = useMemo31(
26459
+ } = useMemo32(
26167
26460
  () => getUsageDetails(entitlement, period, currency, {
26168
26461
  showWarningThresholdAsLimit
26169
26462
  }),
26170
26463
  [entitlement, period, currency, showWarningThresholdAsLimit]
26171
26464
  );
26172
- const description = useMemo31(() => {
26465
+ const description = useMemo32(() => {
26173
26466
  const acc = [];
26174
26467
  let index = 0;
26175
26468
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Overage) {
26176
- acc.push(/* @__PURE__ */ jsxs45(Fragment24, { children: [
26469
+ acc.push(/* @__PURE__ */ jsxs46(Fragment24, { children: [
26177
26470
  t4("Additional"),
26178
26471
  ": "
26179
26472
  ] }, index));
26180
26473
  index += 1;
26181
26474
  }
26182
26475
  if (entitlement.priceBehavior === EntitlementPriceBehavior.Tier) {
26183
- acc.push(/* @__PURE__ */ jsx60(Fragment24, { children: t4("Tier-based") }, index));
26476
+ acc.push(/* @__PURE__ */ jsx61(Fragment24, { children: t4("Tier-based") }, index));
26184
26477
  index += 1;
26185
26478
  }
26186
26479
  const { price } = getEntitlementPrice(entitlement, period, currency) || {};
26187
26480
  if ((entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo || entitlement.priceBehavior === EntitlementPriceBehavior.Overage) && entitlement.feature && typeof price === "number") {
26188
26481
  const packageSize = billingPrice?.packageSize ?? 1;
26189
26482
  acc.push(
26190
- /* @__PURE__ */ jsxs45(Fragment24, { children: [
26483
+ /* @__PURE__ */ jsxs46(Fragment24, { children: [
26191
26484
  formatCurrency(price, billingPrice?.currency),
26192
- /* @__PURE__ */ jsxs45("sub", { children: [
26485
+ /* @__PURE__ */ jsxs46("sub", { children: [
26193
26486
  "/",
26194
- packageSize > 1 && /* @__PURE__ */ jsxs45(Fragment25, { children: [
26487
+ packageSize > 1 && /* @__PURE__ */ jsxs46(Fragment25, { children: [
26195
26488
  packageSize,
26196
26489
  " "
26197
26490
  ] }),
26198
26491
  getFeatureName(entitlement.feature, packageSize),
26199
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs45(Fragment25, { children: [
26492
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46(Fragment25, { children: [
26200
26493
  "/",
26201
26494
  shortenPeriod(period)
26202
26495
  ] })
@@ -26207,7 +26500,7 @@ var UsageDetails2 = ({
26207
26500
  }
26208
26501
  if (showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.planEntitlement?.consumptionRate && entitlement.planEntitlement?.valueCredit) {
26209
26502
  acc.push(
26210
- /* @__PURE__ */ jsxs45(Fragment24, { children: [
26503
+ /* @__PURE__ */ jsxs46(Fragment24, { children: [
26211
26504
  formatConsumptionRate(entitlement.planEntitlement.consumptionRate),
26212
26505
  " ",
26213
26506
  getFeatureName(
@@ -26235,7 +26528,7 @@ var UsageDetails2 = ({
26235
26528
  return null;
26236
26529
  }
26237
26530
  const quantity = entitlement.priceBehavior !== EntitlementPriceBehavior.CreditBurndown ? limit : void 0;
26238
- return /* @__PURE__ */ jsxs45(
26531
+ return /* @__PURE__ */ jsxs46(
26239
26532
  Flex,
26240
26533
  {
26241
26534
  $justifyContent: "space-between",
@@ -26243,13 +26536,13 @@ var UsageDetails2 = ({
26243
26536
  $flexWrap: "wrap",
26244
26537
  $gap: "0.5rem",
26245
26538
  children: [
26246
- /* @__PURE__ */ jsx60(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs45(Fragment25, { children: [
26539
+ /* @__PURE__ */ jsx61(Text, { display: layout.addOns.fontStyle, children: typeof quantity === "number" ? /* @__PURE__ */ jsxs46(Fragment25, { children: [
26247
26540
  quantity,
26248
26541
  " ",
26249
26542
  getFeatureName(entitlement.feature, quantity, true)
26250
26543
  ] }) : entitlement.feature.name }),
26251
- /* @__PURE__ */ jsxs45(Text, { children: [
26252
- description.length > 0 && /* @__PURE__ */ jsx60(
26544
+ /* @__PURE__ */ jsxs46(Text, { children: [
26545
+ description.length > 0 && /* @__PURE__ */ jsx61(
26253
26546
  Text,
26254
26547
  {
26255
26548
  style: { opacity: 0.54 },
@@ -26260,15 +26553,15 @@ var UsageDetails2 = ({
26260
26553
  ),
26261
26554
  // only show cost for pay-in-advance entitlements
26262
26555
  // `description` will include price for other price behaviors
26263
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs45(Fragment25, { children: [
26556
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs46(Fragment25, { children: [
26264
26557
  " ",
26265
26558
  formatCurrency(cost, billingPrice?.currency),
26266
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs45("sub", { children: [
26559
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs46("sub", { children: [
26267
26560
  "/",
26268
26561
  shortenPeriod(period)
26269
26562
  ] })
26270
26563
  ] }),
26271
- entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ jsx60(
26564
+ entitlement.priceBehavior === EntitlementPriceBehavior.Tier && /* @__PURE__ */ jsx61(
26272
26565
  PricingTiersTooltip,
26273
26566
  {
26274
26567
  feature: entitlement.feature,
@@ -26278,7 +26571,7 @@ var UsageDetails2 = ({
26278
26571
  tiersMode: billingPrice?.tiersMode ?? void 0
26279
26572
  }
26280
26573
  ),
26281
- entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx60(
26574
+ entitlementHasHardLimit(entitlement) && entitlement.allocationType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx61(
26282
26575
  HardLimitTooltip,
26283
26576
  {
26284
26577
  feature: entitlement.feature,
@@ -26292,7 +26585,7 @@ var UsageDetails2 = ({
26292
26585
  };
26293
26586
 
26294
26587
  // src/components/elements/plan-manager/PlanManager.tsx
26295
- import { Fragment as Fragment26, jsx as jsx61, jsxs as jsxs46 } from "react/jsx-runtime";
26588
+ import { Fragment as Fragment26, jsx as jsx62, jsxs as jsxs47 } from "react/jsx-runtime";
26296
26589
  var resolveDesignProps7 = (props) => {
26297
26590
  return {
26298
26591
  header: {
@@ -26340,7 +26633,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26340
26633
  showCredits,
26341
26634
  showZeroPriceAsFree,
26342
26635
  trialPaymentMethodRequired
26343
- } = useMemo32(() => {
26636
+ } = useMemo33(() => {
26344
26637
  const planCreditOrder = /* @__PURE__ */ new Map();
26345
26638
  (data?.company?.plan?.includedCreditGrants ?? []).forEach((grant) => {
26346
26639
  if (!planCreditOrder.has(grant.creditId)) {
@@ -26400,15 +26693,15 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26400
26693
  data?.displaySettings?.showZeroPriceAsFree,
26401
26694
  data?.trialPaymentMethodRequired
26402
26695
  ]);
26403
- const usageBasedEntitlements = useMemo32(
26696
+ const usageBasedEntitlements = useMemo33(
26404
26697
  () => featureUsage.filter((usage) => typeof usage.priceBehavior === "string"),
26405
26698
  [featureUsage]
26406
26699
  );
26407
- const planCreditCompositions = useMemo32(
26700
+ const planCreditCompositions = useMemo33(
26408
26701
  () => groupPlanCreditGrants(currentPlan?.includedCreditGrants ?? []),
26409
26702
  [currentPlan?.includedCreditGrants]
26410
26703
  );
26411
- const resolveLicenseQuantity = useMemo32(() => {
26704
+ const resolveLicenseQuantity = useMemo33(() => {
26412
26705
  return (licenseId) => {
26413
26706
  const allocation = findLicenseSource(featureUsage, licenseId)?.allocation;
26414
26707
  return typeof allocation === "number" ? allocation : void 0;
@@ -26431,7 +26724,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26431
26724
  subscriptionCurrency,
26432
26725
  willSubscriptionCancel,
26433
26726
  isTrialSubscription
26434
- } = useMemo32(() => {
26727
+ } = useMemo33(() => {
26435
26728
  const subscriptionInterval2 = getSubscriptionPeriod(billingSubscription) ?? billingSubscription?.interval;
26436
26729
  const subscriptionCurrency2 = billingSubscription?.currency;
26437
26730
  const isTrialSubscription2 = billingSubscription?.status === "trialing";
@@ -26444,7 +26737,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26444
26737
  };
26445
26738
  }, [billingSubscription]);
26446
26739
  const currentPlanPeriod = getSubscriptionPeriod(billingSubscription) ?? currentPlan?.planPeriod ?? void 0;
26447
- const { isFreePlan, isUsageBasedPlan } = useMemo32(() => {
26740
+ const { isFreePlan, isUsageBasedPlan } = useMemo33(() => {
26448
26741
  const isFreePlan2 = currentPlan?.planPrice === 0;
26449
26742
  const isUsageBasedPlan2 = isFreePlan2 && usageBasedEntitlements.length > 0;
26450
26743
  return { isFreePlan: isFreePlan2, isUsageBasedPlan: isUsageBasedPlan2 };
@@ -26452,8 +26745,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26452
26745
  const hasAutoTopupSelfService = currentPlan?.includedCreditGrants.some(
26453
26746
  (grant) => isSelfServiceAutoTopupAvailable(grant)
26454
26747
  ) ?? false;
26455
- return /* @__PURE__ */ jsxs46(Fragment26, { children: [
26456
- isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs46(
26748
+ return /* @__PURE__ */ jsxs47(Fragment26, { children: [
26749
+ isTrialSubscription && !willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
26457
26750
  Notice,
26458
26751
  {
26459
26752
  as: Flex,
@@ -26463,8 +26756,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26463
26756
  $textAlign: "center",
26464
26757
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26465
26758
  children: [
26466
- typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ jsx61(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
26467
- (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ jsx61(
26759
+ typeof trialEnd.endDate !== "undefined" && /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Trial ends in", trialEnd) }),
26760
+ (trialPaymentMethodRequired || postTrialPlan || currentPlan) && /* @__PURE__ */ jsx62(
26468
26761
  Text,
26469
26762
  {
26470
26763
  as: "p",
@@ -26478,7 +26771,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26478
26771
  )
26479
26772
  ]
26480
26773
  }
26481
- ) : willSubscriptionCancel ? /* @__PURE__ */ jsxs46(
26774
+ ) : willSubscriptionCancel ? /* @__PURE__ */ jsxs47(
26482
26775
  Notice,
26483
26776
  {
26484
26777
  as: Flex,
@@ -26488,8 +26781,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26488
26781
  $textAlign: "center",
26489
26782
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26490
26783
  children: [
26491
- /* @__PURE__ */ jsx61(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
26492
- typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx61(
26784
+ /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Subscription canceled") }),
26785
+ typeof billingSubscription?.cancelAt === "number" && /* @__PURE__ */ jsx62(
26493
26786
  Text,
26494
26787
  {
26495
26788
  as: "p",
@@ -26504,7 +26797,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26504
26797
  )
26505
26798
  ]
26506
26799
  }
26507
- ) : customPlanBilling ? /* @__PURE__ */ jsxs46(
26800
+ ) : customPlanBilling ? /* @__PURE__ */ jsxs47(
26508
26801
  Notice,
26509
26802
  {
26510
26803
  as: Flex,
@@ -26514,19 +26807,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26514
26807
  $textAlign: "center",
26515
26808
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26516
26809
  children: [
26517
- /* @__PURE__ */ jsx61(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
26810
+ /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment", {
26518
26811
  plan: customPlanBilling.planName ?? t4("your plan")
26519
26812
  }) : t4("Custom plan payment due", {
26520
26813
  plan: customPlanBilling.planName ?? t4("your plan"),
26521
26814
  date: toPrettyDate(customPlanBilling.deadline)
26522
26815
  }) }),
26523
- /* @__PURE__ */ jsx61(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
26816
+ /* @__PURE__ */ jsx62(Text, { as: "p", $size: 0.8125 * settings.theme.typography.text.fontSize, children: customPlanBilling.isAwaitingActivation ? t4("Custom plan awaiting payment description", {
26524
26817
  date: toPrettyDate(customPlanBilling.deadline)
26525
26818
  }) : t4("Custom plan payment due description", {
26526
26819
  plan: customPlanBilling.planName ?? t4("your plan"),
26527
26820
  date: toPrettyDate(customPlanBilling.deadline)
26528
26821
  }) }),
26529
- customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ jsx61(
26822
+ customPlanBilling.billing.stripeInvoiceUrl && /* @__PURE__ */ jsx62(
26530
26823
  Button,
26531
26824
  {
26532
26825
  as: "a",
@@ -26540,7 +26833,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26540
26833
  )
26541
26834
  ]
26542
26835
  }
26543
- ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs46(
26836
+ ) : data?.company?.scheduledDowngrade?.toPlanName && /* @__PURE__ */ jsxs47(
26544
26837
  Notice,
26545
26838
  {
26546
26839
  as: Flex,
@@ -26550,10 +26843,10 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26550
26843
  $textAlign: "center",
26551
26844
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26552
26845
  children: [
26553
- /* @__PURE__ */ jsx61(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
26846
+ /* @__PURE__ */ jsx62(Text, { as: "h3", display: "heading3", children: t4("Downgrade to plan scheduled", {
26554
26847
  plan: data.company.scheduledDowngrade.toPlanName
26555
26848
  }) }),
26556
- typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx61(
26849
+ typeof billingSubscription?.periodEnd === "number" && /* @__PURE__ */ jsx62(
26557
26850
  Text,
26558
26851
  {
26559
26852
  as: "p",
@@ -26569,7 +26862,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26569
26862
  ]
26570
26863
  }
26571
26864
  ),
26572
- /* @__PURE__ */ jsxs46(
26865
+ /* @__PURE__ */ jsxs47(
26573
26866
  Element,
26574
26867
  {
26575
26868
  as: Flex,
@@ -26578,19 +26871,19 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26578
26871
  $flexDirection: "column",
26579
26872
  $gap: "2rem",
26580
26873
  children: [
26581
- props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs46(
26874
+ props.header.isVisible && currentPlan && /* @__PURE__ */ jsxs47(
26582
26875
  Flex,
26583
26876
  {
26584
26877
  $justifyContent: "space-between",
26585
26878
  $alignItems: "center",
26586
26879
  $gap: "1rem",
26587
26880
  children: [
26588
- /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "1rem", children: [
26589
- /* @__PURE__ */ jsx61(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
26590
- props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx61(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
26881
+ /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "1rem", children: [
26882
+ /* @__PURE__ */ jsx62(Text, { display: props.header.title.fontStyle, $leading: "none", children: currentPlan.name }),
26883
+ props.header.description.isVisible && currentPlan.description && /* @__PURE__ */ jsx62(Text, { display: props.header.description.fontStyle, children: currentPlan.description })
26591
26884
  ] }),
26592
- props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsxs46(Box, { children: [
26593
- /* @__PURE__ */ jsx61(
26885
+ props.header.price.isVisible && typeof currentPlan.planPrice === "number" && /* @__PURE__ */ jsxs47(Box, { children: [
26886
+ /* @__PURE__ */ jsx62(
26594
26887
  Text,
26595
26888
  {
26596
26889
  display: isUsageBasedPlan ? "heading3" : props.header.price.fontStyle,
@@ -26600,7 +26893,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26600
26893
  )
26601
26894
  }
26602
26895
  ),
26603
- !isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx61(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs46("sub", { children: [
26896
+ !isFreePlan && currentPlanPeriod && /* @__PURE__ */ jsx62(Text, { display: props.header.price.fontStyle, children: /* @__PURE__ */ jsxs47("sub", { children: [
26604
26897
  "/",
26605
26898
  shortenPeriod(currentPlanPeriod)
26606
26899
  ] }) })
@@ -26608,8 +26901,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26608
26901
  ]
26609
26902
  }
26610
26903
  ),
26611
- props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26612
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
26904
+ props.addOns.isVisible && currentAddOns.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26905
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
26613
26906
  Text,
26614
26907
  {
26615
26908
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26617,7 +26910,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26617
26910
  children: t4("Add-ons")
26618
26911
  }
26619
26912
  ),
26620
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx61(
26913
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: currentAddOns.map((addOn, addOnIndex) => /* @__PURE__ */ jsx62(
26621
26914
  AddOn,
26622
26915
  {
26623
26916
  addOn,
@@ -26628,8 +26921,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26628
26921
  addOnIndex
26629
26922
  )) })
26630
26923
  ] }),
26631
- props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26632
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
26924
+ props.addOns.isVisible && usageBasedEntitlements.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26925
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
26633
26926
  Text,
26634
26927
  {
26635
26928
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26637,8 +26930,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26637
26930
  children: t4("Usage-based")
26638
26931
  }
26639
26932
  ),
26640
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
26641
- return /* @__PURE__ */ jsx61(
26933
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: usageBasedEntitlements.map((entitlement, entitlementIndex) => {
26934
+ return /* @__PURE__ */ jsx62(
26642
26935
  UsageDetails2,
26643
26936
  {
26644
26937
  entitlement,
@@ -26651,8 +26944,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26651
26944
  );
26652
26945
  }) })
26653
26946
  ] }),
26654
- props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26655
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
26947
+ props.addOns.isVisible && showCredits && creditGroups.plan.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26948
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
26656
26949
  Text,
26657
26950
  {
26658
26951
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26660,7 +26953,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26660
26953
  children: t4("Credits in plan")
26661
26954
  }
26662
26955
  ),
26663
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
26956
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: planCredits.items.map((group, groupIndex) => {
26664
26957
  const planCreditGrant = currentPlan?.includedCreditGrants.find(
26665
26958
  (grant) => grant.creditId === group.id
26666
26959
  );
@@ -26683,13 +26976,13 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26683
26976
  const licenseQuantity = perLicenseGrant?.licenseId ? resolveLicenseQuantity(perLicenseGrant.licenseId) : void 0;
26684
26977
  const creditPeriod = composition.period ?? subscriptionInterval;
26685
26978
  const showPerLicense = !!perLicenseGrant && !!licenseFeature;
26686
- return /* @__PURE__ */ jsxs46(
26979
+ return /* @__PURE__ */ jsxs47(
26687
26980
  Flex,
26688
26981
  {
26689
26982
  $flexDirection: "column",
26690
26983
  $gap: "0.25rem",
26691
26984
  children: [
26692
- /* @__PURE__ */ jsxs46(
26985
+ /* @__PURE__ */ jsxs47(
26693
26986
  Flex,
26694
26987
  {
26695
26988
  $justifyContent: "space-between",
@@ -26697,7 +26990,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26697
26990
  $flexWrap: "wrap",
26698
26991
  $gap: "0.5rem",
26699
26992
  children: [
26700
- /* @__PURE__ */ jsx61(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ jsxs46(Fragment26, { children: [
26993
+ /* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: showPerLicense ? /* @__PURE__ */ jsxs47(Fragment26, { children: [
26701
26994
  t4("X credits per license", {
26702
26995
  amount: perLicenseGrant.amount,
26703
26996
  creditName: getFeatureName(
@@ -26706,7 +26999,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26706
26999
  ),
26707
27000
  licenseName: getFeatureName(licenseFeature, 1)
26708
27001
  }),
26709
- composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs46(Fragment26, { children: [
27002
+ composition.fixedQuantity > 0 && creditPeriod && /* @__PURE__ */ jsxs47(Fragment26, { children: [
26710
27003
  " ",
26711
27004
  t4("Plus X credits per period", {
26712
27005
  amount: composition.fixedQuantity,
@@ -26717,18 +27010,18 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26717
27010
  period: t4(creditPeriod)
26718
27011
  })
26719
27012
  ] })
26720
- ] }) : /* @__PURE__ */ jsxs46(Fragment26, { children: [
27013
+ ] }) : /* @__PURE__ */ jsxs47(Fragment26, { children: [
26721
27014
  group.total.value,
26722
27015
  " ",
26723
27016
  getFeatureName(group, group.total.value),
26724
27017
  " ",
26725
- subscriptionInterval && /* @__PURE__ */ jsxs46(Fragment26, { children: [
27018
+ subscriptionInterval && /* @__PURE__ */ jsxs47(Fragment26, { children: [
26726
27019
  t4("per"),
26727
27020
  " ",
26728
27021
  t4(subscriptionInterval)
26729
27022
  ] })
26730
27023
  ] }) }),
26731
- group.total.used > 0 && /* @__PURE__ */ jsx61(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ jsxs46(
27024
+ group.total.used > 0 && /* @__PURE__ */ jsx62(Flex, { $alignItems: "baseline", children: /* @__PURE__ */ jsxs47(
26732
27025
  Text,
26733
27026
  {
26734
27027
  style: { opacity: 0.54 },
@@ -26738,7 +27031,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26738
27031
  group.total.used,
26739
27032
  " ",
26740
27033
  t4("used"),
26741
- hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ jsx61(
27034
+ hasAutoTopup && planCreditGrant && !isAutoTopupOff(planCreditGrant) && /* @__PURE__ */ jsx62(
26742
27035
  AutoTopupNotice,
26743
27036
  {
26744
27037
  thresholdCredits,
@@ -26751,7 +27044,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26751
27044
  ]
26752
27045
  }
26753
27046
  ),
26754
- showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx61(
27047
+ showPerLicense && typeof licenseQuantity === "number" && typeof resolvedTotal === "number" && creditPeriod && /* @__PURE__ */ jsx62(
26755
27048
  Text,
26756
27049
  {
26757
27050
  style: { opacity: 0.54 },
@@ -26792,7 +27085,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26792
27085
  groupIndex
26793
27086
  );
26794
27087
  }) }),
26795
- planCredits.canExpand && /* @__PURE__ */ jsx61(
27088
+ planCredits.canExpand && /* @__PURE__ */ jsx62(
26796
27089
  ExpandListToggle,
26797
27090
  {
26798
27091
  isExpanded: planCredits.isExpanded,
@@ -26801,7 +27094,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26801
27094
  $marginTop: "0.5rem"
26802
27095
  }
26803
27096
  ),
26804
- hasAutoTopupSelfService && /* @__PURE__ */ jsxs46(
27097
+ hasAutoTopupSelfService && /* @__PURE__ */ jsxs47(
26805
27098
  Flex,
26806
27099
  {
26807
27100
  $justifyContent: "space-between",
@@ -26811,8 +27104,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26811
27104
  $backgroundColor: isLightBackground ? darken(settings.theme.card.background, 0.04) : lighten(settings.theme.card.background, 0.04),
26812
27105
  $borderRadius: "0.5rem",
26813
27106
  children: [
26814
- /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26815
- /* @__PURE__ */ jsx61(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
27107
+ /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27108
+ /* @__PURE__ */ jsx62(Text, { display: props.addOns.fontStyle, children: t4("Auto top-up") }),
26816
27109
  currentPlan?.includedCreditGrants.reduce(
26817
27110
  (acc, grant) => {
26818
27111
  if (!grant.credit || !isSelfServiceAutoTopupAvailable(grant)) {
@@ -26821,7 +27114,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26821
27114
  const autoTopupEnabled = grant.companyAutoTopupEnabled ?? false;
26822
27115
  if (!autoTopupEnabled) {
26823
27116
  acc.push(
26824
- /* @__PURE__ */ jsx61(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
27117
+ /* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Auto top-up disabled for token", {
26825
27118
  unit: getFeatureName(grant.credit, 1)
26826
27119
  }) }, grant.id)
26827
27120
  );
@@ -26831,7 +27124,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26831
27124
  const autoTopupAmount = getAutoTopupAmount(grant);
26832
27125
  if (typeof autoTopupThresholdCredits === "number" && typeof autoTopupAmount === "number") {
26833
27126
  acc.push(
26834
- /* @__PURE__ */ jsx61(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
27127
+ /* @__PURE__ */ jsx62(Text, { $leading: "tight", children: t4("Adds X tokens when Y remaining in balance", {
26835
27128
  unit: getFeatureName(
26836
27129
  grant.credit,
26837
27130
  autoTopupAmount
@@ -26846,7 +27139,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26846
27139
  []
26847
27140
  )
26848
27141
  ] }),
26849
- /* @__PURE__ */ jsx61(
27142
+ /* @__PURE__ */ jsx62(
26850
27143
  Button,
26851
27144
  {
26852
27145
  type: "button",
@@ -26863,8 +27156,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26863
27156
  }
26864
27157
  )
26865
27158
  ] }),
26866
- props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26867
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
27159
+ props.addOns.isVisible && showCredits && creditGroups.autoTopups.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27160
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
26868
27161
  Text,
26869
27162
  {
26870
27163
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26872,9 +27165,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26872
27165
  children: t4("Top-ups")
26873
27166
  }
26874
27167
  ),
26875
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
27168
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: autoTopupCredits.items.map((group, groupIndex) => {
26876
27169
  const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
26877
- return /* @__PURE__ */ jsxs46(
27170
+ return /* @__PURE__ */ jsxs47(
26878
27171
  Flex,
26879
27172
  {
26880
27173
  $justifyContent: "space-between",
@@ -26882,8 +27175,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26882
27175
  $flexWrap: "wrap",
26883
27176
  $gap: "0.5rem",
26884
27177
  children: [
26885
- bundle ? /* @__PURE__ */ jsxs46(Text, { display: props.addOns.fontStyle, children: [
26886
- group.grants.length > 1 && /* @__PURE__ */ jsxs46(Text, { style: { opacity: 0.5 }, children: [
27178
+ bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27179
+ group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
26887
27180
  "(",
26888
27181
  group.grants.length,
26889
27182
  ")",
@@ -26895,8 +27188,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26895
27188
  " ",
26896
27189
  getFeatureName(group, group.quantity),
26897
27190
  ")"
26898
- ] }) : /* @__PURE__ */ jsxs46(Text, { display: props.addOns.fontStyle, children: [
26899
- group.grants.length > 1 && /* @__PURE__ */ jsxs46(Text, { style: { opacity: 0.5 }, children: [
27191
+ ] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27192
+ group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
26900
27193
  "(",
26901
27194
  group.grants.length,
26902
27195
  ")",
@@ -26906,7 +27199,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26906
27199
  " ",
26907
27200
  getFeatureName(group, group.quantity)
26908
27201
  ] }),
26909
- group.total.used > 0 && /* @__PURE__ */ jsxs46(
27202
+ group.total.used > 0 && /* @__PURE__ */ jsxs47(
26910
27203
  Text,
26911
27204
  {
26912
27205
  style: { opacity: 0.54 },
@@ -26924,7 +27217,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26924
27217
  groupIndex
26925
27218
  );
26926
27219
  }) }),
26927
- autoTopupCredits.canExpand && /* @__PURE__ */ jsx61(
27220
+ autoTopupCredits.canExpand && /* @__PURE__ */ jsx62(
26928
27221
  ExpandListToggle,
26929
27222
  {
26930
27223
  isExpanded: autoTopupCredits.isExpanded,
@@ -26934,8 +27227,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26934
27227
  }
26935
27228
  )
26936
27229
  ] }),
26937
- props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
26938
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
27230
+ props.addOns.isVisible && creditGroups.bundles.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27231
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
26939
27232
  Text,
26940
27233
  {
26941
27234
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -26943,9 +27236,9 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26943
27236
  children: t4("Credit bundles")
26944
27237
  }
26945
27238
  ),
26946
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
27239
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: bundleCredits.items.map((group, groupIndex) => {
26947
27240
  const bundle = group?.bundleId ? creditBundles.find((b2) => b2.id === group.bundleId) : void 0;
26948
- return /* @__PURE__ */ jsxs46(
27241
+ return /* @__PURE__ */ jsxs47(
26949
27242
  Flex,
26950
27243
  {
26951
27244
  $justifyContent: "space-between",
@@ -26953,8 +27246,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26953
27246
  $flexWrap: "wrap",
26954
27247
  $gap: "0.5rem",
26955
27248
  children: [
26956
- bundle ? /* @__PURE__ */ jsxs46(Text, { display: props.addOns.fontStyle, children: [
26957
- group.grants.length > 1 && /* @__PURE__ */ jsxs46(Text, { style: { opacity: 0.5 }, children: [
27249
+ bundle ? /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27250
+ group.grants.length > 1 && /* @__PURE__ */ jsxs47(Text, { style: { opacity: 0.5 }, children: [
26958
27251
  "(",
26959
27252
  group.grants.length,
26960
27253
  ")",
@@ -26966,12 +27259,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26966
27259
  " ",
26967
27260
  getFeatureName(group, group.quantity),
26968
27261
  ")"
26969
- ] }) : /* @__PURE__ */ jsxs46(Text, { display: props.addOns.fontStyle, children: [
27262
+ ] }) : /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
26970
27263
  group.quantity,
26971
27264
  " ",
26972
27265
  getFeatureName(group, group.quantity)
26973
27266
  ] }),
26974
- group.total.used > 0 && /* @__PURE__ */ jsxs46(
27267
+ group.total.used > 0 && /* @__PURE__ */ jsxs47(
26975
27268
  Text,
26976
27269
  {
26977
27270
  style: { opacity: 0.54 },
@@ -26989,7 +27282,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26989
27282
  groupIndex
26990
27283
  );
26991
27284
  }) }),
26992
- bundleCredits.canExpand && /* @__PURE__ */ jsx61(
27285
+ bundleCredits.canExpand && /* @__PURE__ */ jsx62(
26993
27286
  ExpandListToggle,
26994
27287
  {
26995
27288
  isExpanded: bundleCredits.isExpanded,
@@ -26999,8 +27292,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
26999
27292
  }
27000
27293
  )
27001
27294
  ] }),
27002
- props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs46(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27003
- props.addOns.showLabel && /* @__PURE__ */ jsx61(
27295
+ props.addOns.isVisible && creditGroups.promotional.length > 0 && /* @__PURE__ */ jsxs47(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27296
+ props.addOns.showLabel && /* @__PURE__ */ jsx62(
27004
27297
  Text,
27005
27298
  {
27006
27299
  $color: isLightBackground ? darken(settings.theme.card.background, 0.46) : lighten(settings.theme.card.background, 0.46),
@@ -27008,8 +27301,8 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27008
27301
  children: t4("Promotional credits")
27009
27302
  }
27010
27303
  ),
27011
- /* @__PURE__ */ jsx61(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27012
- return /* @__PURE__ */ jsxs46(
27304
+ /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "1rem", children: promotionalCredits.items.map((group, groupIndex) => {
27305
+ return /* @__PURE__ */ jsxs47(
27013
27306
  Flex,
27014
27307
  {
27015
27308
  $justifyContent: "space-between",
@@ -27017,12 +27310,12 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27017
27310
  $flexWrap: "wrap",
27018
27311
  $gap: "0.5rem",
27019
27312
  children: [
27020
- /* @__PURE__ */ jsxs46(Text, { display: props.addOns.fontStyle, children: [
27313
+ /* @__PURE__ */ jsxs47(Text, { display: props.addOns.fontStyle, children: [
27021
27314
  group.quantity,
27022
27315
  " ",
27023
27316
  getFeatureName(group, group.quantity)
27024
27317
  ] }),
27025
- group.total.used > 0 && /* @__PURE__ */ jsxs46(
27318
+ group.total.used > 0 && /* @__PURE__ */ jsxs47(
27026
27319
  Text,
27027
27320
  {
27028
27321
  style: { opacity: 0.54 },
@@ -27040,7 +27333,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27040
27333
  groupIndex
27041
27334
  );
27042
27335
  }) }),
27043
- promotionalCredits.canExpand && /* @__PURE__ */ jsx61(
27336
+ promotionalCredits.canExpand && /* @__PURE__ */ jsx62(
27044
27337
  ExpandListToggle,
27045
27338
  {
27046
27339
  isExpanded: promotionalCredits.isExpanded,
@@ -27050,7 +27343,7 @@ var PlanManager = forwardRef14(({ children, className, portal, ...rest }, ref) =
27050
27343
  }
27051
27344
  )
27052
27345
  ] }),
27053
- canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ jsx61(
27346
+ canCheckout && props.callToAction.isVisible && !customPlanBilling?.isAwaitingActivation && /* @__PURE__ */ jsx62(
27054
27347
  Button,
27055
27348
  {
27056
27349
  type: "button",
@@ -27075,14 +27368,14 @@ import {
27075
27368
  Fragment as Fragment29,
27076
27369
  forwardRef as forwardRef15,
27077
27370
  useCallback as useCallback16,
27078
- useEffect as useEffect8,
27079
- useMemo as useMemo34,
27080
- useState as useState21
27371
+ useEffect as useEffect9,
27372
+ useMemo as useMemo35,
27373
+ useState as useState22
27081
27374
  } from "react";
27082
27375
 
27083
27376
  // src/components/elements/pricing-table/AddOn.tsx
27084
- import { useMemo as useMemo33 } from "react";
27085
- import { Fragment as Fragment27, jsx as jsx62, jsxs as jsxs47 } from "react/jsx-runtime";
27377
+ import { useMemo as useMemo34 } from "react";
27378
+ import { Fragment as Fragment27, jsx as jsx63, jsxs as jsxs48 } from "react/jsx-runtime";
27086
27379
  function renderMeteredEntitlementPricing2({
27087
27380
  priceBehavior,
27088
27381
  softLimit,
@@ -27094,7 +27387,7 @@ function renderMeteredEntitlementPricing2({
27094
27387
  isTiered
27095
27388
  }) {
27096
27389
  if (priceBehavior === EntitlementPriceBehavior.Overage && softLimit) {
27097
- return /* @__PURE__ */ jsxs47(Fragment27, { children: [
27390
+ return /* @__PURE__ */ jsxs48(Fragment27, { children: [
27098
27391
  "Additional: ",
27099
27392
  formatCurrency(price, currency),
27100
27393
  "/",
@@ -27105,13 +27398,13 @@ function renderMeteredEntitlementPricing2({
27105
27398
  ] });
27106
27399
  }
27107
27400
  if (isTiered) {
27108
- return /* @__PURE__ */ jsx62(Fragment27, { children: "Tier-based pricing" });
27401
+ return /* @__PURE__ */ jsx63(Fragment27, { children: "Tier-based pricing" });
27109
27402
  }
27110
27403
  if (priceBehavior === EntitlementPriceBehavior.PayAsYouGo || priceBehavior === EntitlementPriceBehavior.PayInAdvance) {
27111
- return /* @__PURE__ */ jsxs47(Fragment27, { children: [
27404
+ return /* @__PURE__ */ jsxs48(Fragment27, { children: [
27112
27405
  formatCurrency(price, currency),
27113
27406
  "/",
27114
- packageSize > 1 && /* @__PURE__ */ jsxs47(Fragment27, { children: [
27407
+ packageSize > 1 && /* @__PURE__ */ jsxs48(Fragment27, { children: [
27115
27408
  packageSize,
27116
27409
  " "
27117
27410
  ] }),
@@ -27137,7 +27430,7 @@ var AddOn2 = ({
27137
27430
  const { data, settings, setCheckoutState, warningThresholdConfig } = useEmbed();
27138
27431
  const showWarningThresholdAsLimit = warningThresholdConfig?.showAsLimit ?? false;
27139
27432
  const isLightBackground = useIsLightBackground();
27140
- const { currentAddOns, canCheckout, isStandalone } = useMemo33(() => {
27433
+ const { currentAddOns, canCheckout, isStandalone } = useMemo34(() => {
27141
27434
  const isStandalone2 = typeof data?.component === "undefined";
27142
27435
  return {
27143
27436
  currentAddOns: data?.company?.addOns || [],
@@ -27180,7 +27473,7 @@ var AddOn2 = ({
27180
27473
  isTiered: entitlement.priceBehavior === EntitlementPriceBehavior.Tier || isTieredPrice(priceData)
27181
27474
  };
27182
27475
  }) || [];
27183
- return /* @__PURE__ */ jsxs47(
27476
+ return /* @__PURE__ */ jsxs48(
27184
27477
  Flex,
27185
27478
  {
27186
27479
  as: "li",
@@ -27200,7 +27493,7 @@ var AddOn2 = ({
27200
27493
  $boxShadow: cardBoxShadow
27201
27494
  },
27202
27495
  children: [
27203
- /* @__PURE__ */ jsxs47(
27496
+ /* @__PURE__ */ jsxs48(
27204
27497
  Flex,
27205
27498
  {
27206
27499
  $flexDirection: "column",
@@ -27211,7 +27504,7 @@ var AddOn2 = ({
27211
27504
  $borderStyle: "solid",
27212
27505
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27213
27506
  children: [
27214
- /* @__PURE__ */ jsx62(Box, { children: /* @__PURE__ */ jsx62(
27507
+ /* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
27215
27508
  Text,
27216
27509
  {
27217
27510
  as: "h3",
@@ -27220,22 +27513,22 @@ var AddOn2 = ({
27220
27513
  children: addOn.name
27221
27514
  }
27222
27515
  ) }),
27223
- layout.addOns.showDescription && /* @__PURE__ */ jsx62(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx62(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27224
- /* @__PURE__ */ jsx62(Box, { children: /* @__PURE__ */ jsx62(
27516
+ layout.addOns.showDescription && /* @__PURE__ */ jsx63(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx63(Text, { display: layout.plans.description.fontStyle, children: addOn.description }) }),
27517
+ /* @__PURE__ */ jsx63(Box, { children: /* @__PURE__ */ jsx63(
27225
27518
  Text,
27226
27519
  {
27227
27520
  "data-testid": "sch-addon-price",
27228
27521
  display: layout.plans.name.fontStyle,
27229
- children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ jsxs47(Fragment27, { children: [
27522
+ children: shouldShowUsageBased2(addOnPrice ?? 0, displayableEntitlements) ? t4("Usage-based") : /* @__PURE__ */ jsxs48(Fragment27, { children: [
27230
27523
  formatCurrency(addOnPrice ?? 0, addOnCurrency),
27231
- /* @__PURE__ */ jsxs47("sub", { children: [
27524
+ /* @__PURE__ */ jsxs48("sub", { children: [
27232
27525
  "/",
27233
27526
  selectedPeriod
27234
27527
  ] })
27235
27528
  ] })
27236
27529
  }
27237
27530
  ) }),
27238
- isActiveAddOn && /* @__PURE__ */ jsx62(
27531
+ isActiveAddOn && /* @__PURE__ */ jsx63(
27239
27532
  Flex,
27240
27533
  {
27241
27534
  "data-testid": "sch-addon-active",
@@ -27245,7 +27538,7 @@ var AddOn2 = ({
27245
27538
  $backgroundColor: settings.theme.primary,
27246
27539
  $borderRadius: "9999px",
27247
27540
  $padding: "0.125rem 0.85rem",
27248
- children: /* @__PURE__ */ jsx62(
27541
+ children: /* @__PURE__ */ jsx63(
27249
27542
  Text,
27250
27543
  {
27251
27544
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -27258,7 +27551,7 @@ var AddOn2 = ({
27258
27551
  ]
27259
27552
  }
27260
27553
  ),
27261
- /* @__PURE__ */ jsxs47(
27554
+ /* @__PURE__ */ jsxs48(
27262
27555
  Flex,
27263
27556
  {
27264
27557
  $flexDirection: "column",
@@ -27267,7 +27560,7 @@ var AddOn2 = ({
27267
27560
  $flexGrow: 1,
27268
27561
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
27269
27562
  children: [
27270
- layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ jsx62(
27563
+ layout.addOns.showEntitlements && displayableEntitlements.length > 0 && /* @__PURE__ */ jsx63(
27271
27564
  Flex,
27272
27565
  {
27273
27566
  as: "ul",
@@ -27279,7 +27572,7 @@ var AddOn2 = ({
27279
27572
  $listStyle: "none",
27280
27573
  children: displayableEntitlements.map((entitlement, idx) => {
27281
27574
  if (entitlement.isUnlimited) {
27282
- return /* @__PURE__ */ jsxs47(
27575
+ return /* @__PURE__ */ jsxs48(
27283
27576
  Flex,
27284
27577
  {
27285
27578
  as: "li",
@@ -27288,8 +27581,8 @@ var AddOn2 = ({
27288
27581
  $alignItems: "center",
27289
27582
  $gap: "1rem",
27290
27583
  children: [
27291
- /* @__PURE__ */ jsxs47(Flex, { $gap: "1rem", children: [
27292
- layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx62(
27584
+ /* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
27585
+ layout.addOns.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx63(
27293
27586
  Icon3,
27294
27587
  {
27295
27588
  name: entitlement.feature.icon,
@@ -27298,16 +27591,16 @@ var AddOn2 = ({
27298
27591
  rounded: true
27299
27592
  }
27300
27593
  ),
27301
- entitlement.feature && /* @__PURE__ */ jsx62(
27594
+ entitlement.feature && /* @__PURE__ */ jsx63(
27302
27595
  Flex,
27303
27596
  {
27304
27597
  $flexDirection: "column",
27305
27598
  $justifyContent: "center",
27306
- children: /* @__PURE__ */ jsx62(Text, { children: getFeatureName(entitlement.feature) })
27599
+ children: /* @__PURE__ */ jsx63(Text, { children: getFeatureName(entitlement.feature) })
27307
27600
  }
27308
27601
  )
27309
27602
  ] }),
27310
- /* @__PURE__ */ jsx62(
27603
+ /* @__PURE__ */ jsx63(
27311
27604
  Text,
27312
27605
  {
27313
27606
  style: { opacity: 0.54 },
@@ -27322,7 +27615,7 @@ var AddOn2 = ({
27322
27615
  );
27323
27616
  }
27324
27617
  const meteredEntitlement = entitlement;
27325
- return /* @__PURE__ */ jsxs47(
27618
+ return /* @__PURE__ */ jsxs48(
27326
27619
  Flex,
27327
27620
  {
27328
27621
  as: "li",
@@ -27332,8 +27625,8 @@ var AddOn2 = ({
27332
27625
  $gap: "1rem",
27333
27626
  $listStyle: "none",
27334
27627
  children: [
27335
- /* @__PURE__ */ jsxs47(Flex, { $gap: "1rem", children: [
27336
- meteredEntitlement.feature?.icon && /* @__PURE__ */ jsx62(
27628
+ /* @__PURE__ */ jsxs48(Flex, { $gap: "1rem", children: [
27629
+ meteredEntitlement.feature?.icon && /* @__PURE__ */ jsx63(
27337
27630
  Icon3,
27338
27631
  {
27339
27632
  "data-testid": "sch-feature-icon",
@@ -27343,9 +27636,9 @@ var AddOn2 = ({
27343
27636
  rounded: true
27344
27637
  }
27345
27638
  ),
27346
- /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ jsx62(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
27639
+ /* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $justifyContent: "center", children: /* @__PURE__ */ jsx63(Text, { children: typeof meteredEntitlement.limit === "number" ? `${meteredEntitlement.limit} ${getEntitlementFeatureName(meteredEntitlement, "units")}` : getEntitlementFeatureName(meteredEntitlement) }) })
27347
27640
  ] }),
27348
- /* @__PURE__ */ jsx62(
27641
+ /* @__PURE__ */ jsx63(
27349
27642
  Text,
27350
27643
  {
27351
27644
  style: { opacity: 0.54 },
@@ -27361,7 +27654,7 @@ var AddOn2 = ({
27361
27654
  })
27362
27655
  }
27363
27656
  ),
27364
- sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx62(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ jsx62(
27657
+ sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsx63(Flex, { $flexDirection: "column", $gap: "0.5rem", children: /* @__PURE__ */ jsx63(
27365
27658
  Button,
27366
27659
  {
27367
27660
  type: "button",
@@ -27400,10 +27693,10 @@ var AddOn2 = ({
27400
27693
  };
27401
27694
 
27402
27695
  // src/components/elements/pricing-table/Plan.tsx
27403
- import { useState as useState20 } from "react";
27696
+ import { useState as useState21 } from "react";
27404
27697
 
27405
27698
  // src/components/elements/pricing-table/Entitlement.tsx
27406
- import { Fragment as Fragment28, jsx as jsx63, jsxs as jsxs48 } from "react/jsx-runtime";
27699
+ import { Fragment as Fragment28, jsx as jsx64, jsxs as jsxs49 } from "react/jsx-runtime";
27407
27700
  var Entitlement2 = ({
27408
27701
  entitlement,
27409
27702
  sharedProps,
@@ -27437,8 +27730,8 @@ var Entitlement2 = ({
27437
27730
  entitlement,
27438
27731
  credits
27439
27732
  );
27440
- return /* @__PURE__ */ jsxs48(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
27441
- layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx63(
27733
+ return /* @__PURE__ */ jsxs49(Flex, { as: "li", $gap: "1rem", style: { listStyle: "none" }, children: [
27734
+ layout.plans.showFeatureIcons && entitlement.feature?.icon && /* @__PURE__ */ jsx64(
27442
27735
  Icon3,
27443
27736
  {
27444
27737
  "data-testid": "sch-feature-icon",
@@ -27448,31 +27741,31 @@ var Entitlement2 = ({
27448
27741
  rounded: true
27449
27742
  }
27450
27743
  ),
27451
- entitlement.feature?.name && /* @__PURE__ */ jsxs48(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27452
- /* @__PURE__ */ jsxs48(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
27453
- /* @__PURE__ */ jsx63(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ jsxs48(Fragment28, { children: [
27744
+ entitlement.feature?.name && /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27745
+ /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $justifyContent: "center", $flexGrow: 1, children: [
27746
+ /* @__PURE__ */ jsx64(Text, { children: typeof entitlementPrice === "number" && !tiered && (entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance || entitlement.priceBehavior === EntitlementPriceBehavior.PayAsYouGo) ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
27454
27747
  formatCurrency(entitlementPrice, entitlementCurrency),
27455
27748
  " ",
27456
27749
  t4("per"),
27457
27750
  " ",
27458
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27751
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27459
27752
  formatNumber(entitlementPackageSize),
27460
27753
  " "
27461
27754
  ] }),
27462
27755
  getFeatureName(entitlement.feature, entitlementPackageSize),
27463
- entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27756
+ entitlement.priceBehavior === EntitlementPriceBehavior.PayInAdvance && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27464
27757
  " ",
27465
27758
  t4("per"),
27466
27759
  " ",
27467
27760
  selectedPeriod
27468
27761
  ] })
27469
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ jsx63(
27762
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered ? /* @__PURE__ */ jsx64(
27470
27763
  TieredPricingDetails,
27471
27764
  {
27472
27765
  entitlement,
27473
27766
  period: selectedPeriod
27474
27767
  }
27475
- ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ jsxs48(Fragment28, { children: [
27768
+ ) : showCredits && entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && entitlement.valueCredit && entitlement.consumptionRate ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
27476
27769
  formatConsumptionRate(entitlement.consumptionRate),
27477
27770
  " ",
27478
27771
  getFeatureName(
@@ -27483,7 +27776,7 @@ var Entitlement2 = ({
27483
27776
  t4("per"),
27484
27777
  " ",
27485
27778
  getFeatureName(entitlement.feature, 1)
27486
- ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx63(Fragment28, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
27779
+ ] }) : entitlement.priceBehavior === EntitlementPriceBehavior.CreditBurndown && creditBasedEntitlementLimit ? /* @__PURE__ */ jsx64(Fragment28, { children: creditBasedEntitlementLimit?.period ? t4("Up to X units per period", {
27487
27780
  amount: formatNumber(creditBasedEntitlementLimit.limit),
27488
27781
  units: getFeatureName(
27489
27782
  entitlement.feature,
@@ -27496,25 +27789,25 @@ var Entitlement2 = ({
27496
27789
  entitlement.feature,
27497
27790
  creditBasedEntitlementLimit.limit
27498
27791
  )
27499
- }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs48(Fragment28, { children: [
27792
+ }) }) : entitlement.valueType === EntitlementValueType.Numeric || entitlement.valueType === EntitlementValueType.Unlimited || entitlement.valueType === EntitlementValueType.Trait ? /* @__PURE__ */ jsxs49(Fragment28, { children: [
27500
27793
  entitlement.valueType === EntitlementValueType.Unlimited && !entitlement.priceBehavior ? t4("Unlimited", {
27501
27794
  item: getFeatureName(entitlement.feature)
27502
- }) : /* @__PURE__ */ jsxs48(Fragment28, { children: [
27503
- typeof limit === "number" && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27795
+ }) : /* @__PURE__ */ jsxs49(Fragment28, { children: [
27796
+ typeof limit === "number" && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27504
27797
  formatNumber(limit),
27505
27798
  " "
27506
27799
  ] }),
27507
27800
  getFeatureName(entitlement.feature, limit)
27508
27801
  ] }),
27509
- metricPeriodName && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27802
+ metricPeriodName && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27510
27803
  " ",
27511
27804
  t4("per"),
27512
27805
  " ",
27513
27806
  t4(metricPeriodName)
27514
27807
  ] })
27515
27808
  ] }) : entitlement.feature.name }),
27516
- /* @__PURE__ */ jsxs48(Text, { children: [
27517
- entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsx63(Fragment28, { children: /* @__PURE__ */ jsxs48(
27809
+ /* @__PURE__ */ jsxs49(Text, { children: [
27810
+ entitlement.priceBehavior === EntitlementPriceBehavior.Overage && typeof entitlementPrice === "number" ? /* @__PURE__ */ jsx64(Fragment28, { children: /* @__PURE__ */ jsxs49(
27518
27811
  Text,
27519
27812
  {
27520
27813
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27524,7 +27817,7 @@ var Entitlement2 = ({
27524
27817
  " ",
27525
27818
  formatCurrency(entitlementPrice, entitlementCurrency),
27526
27819
  "/",
27527
- entitlementPackageSize > 1 && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27820
+ entitlementPackageSize > 1 && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27528
27821
  formatNumber(entitlementPackageSize),
27529
27822
  " "
27530
27823
  ] }),
@@ -27532,14 +27825,14 @@ var Entitlement2 = ({
27532
27825
  entitlement.feature,
27533
27826
  entitlementPackageSize
27534
27827
  ),
27535
- entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27828
+ entitlement.feature.featureType === FeatureType.Trait && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27536
27829
  "/",
27537
27830
  shortenPeriod(selectedPeriod)
27538
27831
  ] })
27539
27832
  ]
27540
27833
  }
27541
- ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs48(Fragment28, { children: [
27542
- /* @__PURE__ */ jsx63(
27834
+ ) }) : (entitlement.priceBehavior === EntitlementPriceBehavior.Tier || tiered) && /* @__PURE__ */ jsxs49(Fragment28, { children: [
27835
+ /* @__PURE__ */ jsx64(
27543
27836
  Text,
27544
27837
  {
27545
27838
  style: { opacity: 0.54 },
@@ -27548,7 +27841,7 @@ var Entitlement2 = ({
27548
27841
  children: t4("Tier-based")
27549
27842
  }
27550
27843
  ),
27551
- /* @__PURE__ */ jsx63(
27844
+ /* @__PURE__ */ jsx64(
27552
27845
  PricingTiersTooltip,
27553
27846
  {
27554
27847
  feature: entitlement.feature,
@@ -27559,14 +27852,14 @@ var Entitlement2 = ({
27559
27852
  }
27560
27853
  )
27561
27854
  ] }),
27562
- entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx63(
27855
+ entitlementHasHardLimit(entitlement) && entitlement.valueType === EntitlementValueType.Numeric && /* @__PURE__ */ jsx64(
27563
27856
  HardLimitTooltip,
27564
27857
  {
27565
27858
  feature: entitlement.feature,
27566
27859
  limit: entitlement.valueNumeric
27567
27860
  }
27568
27861
  ),
27569
- entitlement.billingThreshold && /* @__PURE__ */ jsx63(
27862
+ entitlement.billingThreshold && /* @__PURE__ */ jsx64(
27570
27863
  BillingThresholdTooltip,
27571
27864
  {
27572
27865
  billingThreshold: entitlement.billingThreshold
@@ -27574,7 +27867,7 @@ var Entitlement2 = ({
27574
27867
  )
27575
27868
  ] })
27576
27869
  ] }),
27577
- layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx63(
27870
+ layout.plans.showFeatureDescriptions && entitlement.feature?.description && /* @__PURE__ */ jsx64(
27578
27871
  Text,
27579
27872
  {
27580
27873
  $size: 0.875 * settings.theme.typography.text.fontSize,
@@ -27587,7 +27880,7 @@ var Entitlement2 = ({
27587
27880
  };
27588
27881
 
27589
27882
  // src/components/elements/pricing-table/Plan.tsx
27590
- import { jsx as jsx64, jsxs as jsxs49 } from "react/jsx-runtime";
27883
+ import { jsx as jsx65, jsxs as jsxs50 } from "react/jsx-runtime";
27591
27884
  var Plan2 = ({
27592
27885
  plan,
27593
27886
  index,
@@ -27601,7 +27894,7 @@ var Plan2 = ({
27601
27894
  const { data, settings, setCheckoutState } = useEmbed();
27602
27895
  const isLightBackground = useIsLightBackground();
27603
27896
  const trialEnd = useTrialEnd();
27604
- const [entitlementVisibility, setEntitlementVisibility] = useState20({});
27897
+ const [entitlementVisibility, setEntitlementVisibility] = useState21({});
27605
27898
  const handleToggleShowAll = (id) => {
27606
27899
  setEntitlementVisibility((prev2) => {
27607
27900
  const updated = !(prev2[id] ?? false);
@@ -27630,7 +27923,7 @@ var Plan2 = ({
27630
27923
  const isUsageBasedPlan = isFreePlan && hasUsageBasedEntitlements;
27631
27924
  const headerPriceFontStyle = settings.theme.typography[layout.plans.name.fontStyle];
27632
27925
  const isExpanded = entitlementVisibility[plan.id] ?? false;
27633
- return /* @__PURE__ */ jsxs49(
27926
+ return /* @__PURE__ */ jsxs50(
27634
27927
  Flex,
27635
27928
  {
27636
27929
  as: "li",
@@ -27650,7 +27943,7 @@ var Plan2 = ({
27650
27943
  $boxShadow: cardBoxShadow
27651
27944
  },
27652
27945
  children: [
27653
- /* @__PURE__ */ jsxs49(
27946
+ /* @__PURE__ */ jsxs50(
27654
27947
  Flex,
27655
27948
  {
27656
27949
  $flexDirection: "column",
@@ -27661,7 +27954,7 @@ var Plan2 = ({
27661
27954
  $borderStyle: "solid",
27662
27955
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.175)" : "hsla(0, 0%, 100%, 0.175)",
27663
27956
  children: [
27664
- /* @__PURE__ */ jsx64(Box, { children: /* @__PURE__ */ jsx64(
27957
+ /* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsx65(
27665
27958
  Text,
27666
27959
  {
27667
27960
  as: "h3",
@@ -27670,8 +27963,8 @@ var Plan2 = ({
27670
27963
  children: plan.name
27671
27964
  }
27672
27965
  ) }),
27673
- layout.plans.description.isVisible && /* @__PURE__ */ jsx64(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx64(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
27674
- /* @__PURE__ */ jsx64(Box, { children: /* @__PURE__ */ jsxs49(
27966
+ layout.plans.description.isVisible && /* @__PURE__ */ jsx65(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx65(Text, { display: layout.plans.description.fontStyle, children: plan.description }) }),
27967
+ /* @__PURE__ */ jsx65(Box, { children: /* @__PURE__ */ jsxs50(
27675
27968
  Text,
27676
27969
  {
27677
27970
  "data-testid": "sch-plan-price",
@@ -27687,14 +27980,14 @@ var Plan2 = ({
27687
27980
  currency: planCurrency,
27688
27981
  testSignificantDigits: false
27689
27982
  }) : formatCurrency(planPrice ?? 0, planCurrency),
27690
- !plan.custom && !isFreePlan && /* @__PURE__ */ jsxs49("sub", { children: [
27983
+ !plan.custom && !isFreePlan && /* @__PURE__ */ jsxs50("sub", { children: [
27691
27984
  "/",
27692
27985
  showAsMonthlyPrices && selectedPeriod === BillingProductPriceInterval.Year ? t4("month, billed yearly") : showAsMonthlyPrices && selectedPeriod === "quarter" ? t4("month, billed quarterly") : t4(selectedPeriod)
27693
27986
  ] })
27694
27987
  ]
27695
27988
  }
27696
27989
  ) }),
27697
- showCredits && credits.length > 0 && /* @__PURE__ */ jsx64(
27990
+ showCredits && credits.length > 0 && /* @__PURE__ */ jsx65(
27698
27991
  Flex,
27699
27992
  {
27700
27993
  as: "ul",
@@ -27706,8 +27999,8 @@ var Plan2 = ({
27706
27999
  $margin: 0,
27707
28000
  $listStyle: "none",
27708
28001
  children: credits.map((credit, idx) => {
27709
- return /* @__PURE__ */ jsxs49(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
27710
- layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx64(
28002
+ return /* @__PURE__ */ jsxs50(Flex, { as: "li", $gap: "1rem", $listStyle: "none", children: [
28003
+ layout.plans.showFeatureIcons && credit.icon && /* @__PURE__ */ jsx65(
27711
28004
  Icon3,
27712
28005
  {
27713
28006
  "data-testid": "sch-feature-icon",
@@ -27717,13 +28010,13 @@ var Plan2 = ({
27717
28010
  rounded: true
27718
28011
  }
27719
28012
  ),
27720
- credit.name && /* @__PURE__ */ jsx64(
28013
+ credit.name && /* @__PURE__ */ jsx65(
27721
28014
  Flex,
27722
28015
  {
27723
28016
  $flexDirection: "column",
27724
28017
  $justifyContent: "center",
27725
28018
  $gap: "0.5rem",
27726
- children: /* @__PURE__ */ jsx64(
28019
+ children: /* @__PURE__ */ jsx65(
27727
28020
  PlanCreditText,
27728
28021
  {
27729
28022
  credit,
@@ -27736,7 +28029,7 @@ var Plan2 = ({
27736
28029
  })
27737
28030
  }
27738
28031
  ),
27739
- isActivePlan && /* @__PURE__ */ jsx64(
28032
+ isActivePlan && /* @__PURE__ */ jsx65(
27740
28033
  Flex,
27741
28034
  {
27742
28035
  "data-testid": "sch-plan-active",
@@ -27746,7 +28039,7 @@ var Plan2 = ({
27746
28039
  $backgroundColor: settings.theme.primary,
27747
28040
  $borderRadius: "9999px",
27748
28041
  $padding: "0.125rem 0.85rem",
27749
- children: /* @__PURE__ */ jsx64(
28042
+ children: /* @__PURE__ */ jsx65(
27750
28043
  Text,
27751
28044
  {
27752
28045
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -27759,7 +28052,7 @@ var Plan2 = ({
27759
28052
  ]
27760
28053
  }
27761
28054
  ),
27762
- /* @__PURE__ */ jsxs49(
28055
+ /* @__PURE__ */ jsxs50(
27763
28056
  Flex,
27764
28057
  {
27765
28058
  $flexDirection: "column",
@@ -27768,7 +28061,7 @@ var Plan2 = ({
27768
28061
  $gap: `${cardPadding}rem`,
27769
28062
  $padding: `${0.75 * cardPadding}rem ${cardPadding}rem 0`,
27770
28063
  children: [
27771
- layout.plans.showEntitlements && /* @__PURE__ */ jsxs49(
28064
+ layout.plans.showEntitlements && /* @__PURE__ */ jsxs50(
27772
28065
  Flex,
27773
28066
  {
27774
28067
  as: "ul",
@@ -27779,14 +28072,14 @@ var Plan2 = ({
27779
28072
  $margin: 0,
27780
28073
  $listStyle: "none",
27781
28074
  children: [
27782
- layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx64(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx64(Text, { children: t4("Everything in", {
28075
+ layout.plans.showInclusionText && index > 0 && /* @__PURE__ */ jsx65(Box, { $marginBottom: "1.5rem", children: /* @__PURE__ */ jsx65(Text, { children: t4("Everything in", {
27783
28076
  plan: plans[index - 1].name
27784
28077
  }) }) }),
27785
28078
  (plan.entitlements ?? []).reduce(
27786
28079
  (acc, entitlement, idx) => {
27787
28080
  if (isExpanded || idx < VISIBLE_ENTITLEMENT_COUNT) {
27788
28081
  acc.push(
27789
- /* @__PURE__ */ jsx64(
28082
+ /* @__PURE__ */ jsx65(
27790
28083
  Entitlement2,
27791
28084
  {
27792
28085
  entitlement,
@@ -27804,7 +28097,7 @@ var Plan2 = ({
27804
28097
  },
27805
28098
  []
27806
28099
  ),
27807
- (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsx64(
28100
+ (plan.entitlements ?? []).length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsx65(
27808
28101
  ExpandListToggle,
27809
28102
  {
27810
28103
  as: "li",
@@ -27819,7 +28112,7 @@ var Plan2 = ({
27819
28112
  ]
27820
28113
  }
27821
28114
  ),
27822
- isActivePlan ? /* @__PURE__ */ jsxs49(
28115
+ isActivePlan ? /* @__PURE__ */ jsxs50(
27823
28116
  Flex,
27824
28117
  {
27825
28118
  $justifyContent: "center",
@@ -27827,7 +28120,7 @@ var Plan2 = ({
27827
28120
  $gap: "0.25rem",
27828
28121
  $padding: "0.625rem 0",
27829
28122
  children: [
27830
- /* @__PURE__ */ jsx64(
28123
+ /* @__PURE__ */ jsx65(
27831
28124
  Icon3,
27832
28125
  {
27833
28126
  name: "check-rounded",
@@ -27835,11 +28128,11 @@ var Plan2 = ({
27835
28128
  color: settings.theme.primary
27836
28129
  }
27837
28130
  ),
27838
- /* @__PURE__ */ jsx64(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
28131
+ /* @__PURE__ */ jsx65(Text, { $size: 15, $leading: "none", children: t4("Current plan") })
27839
28132
  ]
27840
28133
  }
27841
- ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs49(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
27842
- /* @__PURE__ */ jsx64(
28134
+ ) : sharedProps.showCallToAction && (layout.upgrade.isVisible || layout.downgrade.isVisible) && /* @__PURE__ */ jsxs50(Flex, { $flexDirection: "column", $gap: "0.5rem", children: [
28135
+ /* @__PURE__ */ jsx65(
27843
28136
  Button,
27844
28137
  {
27845
28138
  type: "button",
@@ -27877,10 +28170,10 @@ var Plan2 = ({
27877
28170
  }
27878
28171
  },
27879
28172
  $fullWidth: true,
27880
- children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ jsx64(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
28173
+ children: plan.custom ? plan.customPlanConfig?.ctaText ?? t4("Talk to support") : !plan.valid ? /* @__PURE__ */ jsx65(Text, { as: Box, $align: "center", children: t4("Over plan limit") }) : t4("Choose plan")
27881
28174
  }
27882
28175
  ),
27883
- !plan.valid && /* @__PURE__ */ jsx64(UsageViolationText, { violations: plan.usageViolations })
28176
+ !plan.valid && /* @__PURE__ */ jsx65(UsageViolationText, { violations: plan.usageViolations })
27884
28177
  ] })
27885
28178
  ]
27886
28179
  }
@@ -27891,7 +28184,7 @@ var Plan2 = ({
27891
28184
  };
27892
28185
 
27893
28186
  // src/components/elements/pricing-table/PricingTable.tsx
27894
- import { Fragment as Fragment30, jsx as jsx65, jsxs as jsxs50 } from "react/jsx-runtime";
28187
+ import { Fragment as Fragment30, jsx as jsx66, jsxs as jsxs51 } from "react/jsx-runtime";
27895
28188
  var resolveDesignProps8 = (props) => {
27896
28189
  return {
27897
28190
  showPeriodToggle: props.showPeriodToggle ?? true,
@@ -27956,11 +28249,11 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
27956
28249
  },
27957
28250
  []
27958
28251
  );
27959
- const [selectedPeriod, setSelectedPeriod] = useState21(
28252
+ const [selectedPeriod, setSelectedPeriod] = useState22(
27960
28253
  () => getSubscriptionPeriod(data?.company?.billingSubscription) || data?.company?.plan?.planPeriod || "month"
27961
28254
  );
27962
28255
  const { currencies, invalidFilterEntries } = useAvailableCurrenciesWithInvalid();
27963
- const [selectedCurrency, setSelectedCurrency] = useState21(
28256
+ const [selectedCurrency, setSelectedCurrency] = useState22(
27964
28257
  () => currencies[0] ?? DEFAULT_CURRENCY
27965
28258
  );
27966
28259
  if (currencies.length > 0 && !currencies.includes(selectedCurrency)) {
@@ -27978,25 +28271,25 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
27978
28271
  } = useAvailablePlans(selectedPeriod, {
27979
28272
  useSelectedPeriod: showPeriodToggle
27980
28273
  });
27981
- const plans = useMemo34(
28274
+ const plans = useMemo35(
27982
28275
  () => hasCurrency ? allPlans.filter(
27983
28276
  (plan) => planSupportsCurrency(plan, selectedCurrency)
27984
28277
  ) : allPlans,
27985
28278
  [allPlans, hasCurrency, selectedCurrency]
27986
28279
  );
27987
- const addOns = useMemo34(
28280
+ const addOns = useMemo35(
27988
28281
  () => hasCurrency ? allAddOns.filter(
27989
28282
  (addOn) => planSupportsCurrency(addOn, selectedCurrency)
27990
28283
  ) : allAddOns,
27991
28284
  [allAddOns, hasCurrency, selectedCurrency]
27992
28285
  );
27993
- useEffect8(() => {
28286
+ useEffect9(() => {
27994
28287
  if (typeof data?.component === "undefined") {
27995
28288
  hydratePublic();
27996
28289
  }
27997
28290
  }, [data?.component, hydratePublic]);
27998
28291
  if (isPending) {
27999
- return /* @__PURE__ */ jsx65(
28292
+ return /* @__PURE__ */ jsx66(
28000
28293
  Flex,
28001
28294
  {
28002
28295
  $width: "100%",
@@ -28004,12 +28297,12 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28004
28297
  $alignItems: "center",
28005
28298
  $justifyContent: "center",
28006
28299
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
28007
- children: /* @__PURE__ */ jsx65(Loader, { "aria-label": "loading", $size: "2xl" })
28300
+ children: /* @__PURE__ */ jsx66(Loader, { "aria-label": "loading", $size: "2xl" })
28008
28301
  }
28009
28302
  );
28010
28303
  }
28011
28304
  if (hasNoUsableCurrency) {
28012
- return /* @__PURE__ */ jsx65(Container, { children: /* @__PURE__ */ jsx65(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ jsx65(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28305
+ return /* @__PURE__ */ jsx66(Container, { children: /* @__PURE__ */ jsx66(Flex, { $justifyContent: "center", $padding: "2rem 0", children: /* @__PURE__ */ jsx66(InvalidCurrencyNotice, { invalidEntries: invalidFilterEntries }) }) });
28013
28306
  }
28014
28307
  const currentPlan = plans.find((plan) => plan.id === data?.company?.plan?.id);
28015
28308
  const showCallToAction = typeof data?.component !== "undefined" || typeof rest.callToActionUrl === "string" || typeof rest.onCallToAction === "function";
@@ -28018,7 +28311,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28018
28311
  rest.callToActionTarget
28019
28312
  );
28020
28313
  const Wrapper = typeof data?.component === "undefined" ? Container : Fragment29;
28021
- return /* @__PURE__ */ jsx65(Wrapper, { children: /* @__PURE__ */ jsxs50(
28314
+ return /* @__PURE__ */ jsx66(Wrapper, { children: /* @__PURE__ */ jsxs51(
28022
28315
  FussyChild,
28023
28316
  {
28024
28317
  ref,
@@ -28028,8 +28321,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28028
28321
  $flexDirection: "column",
28029
28322
  $gap: "2rem",
28030
28323
  children: [
28031
- /* @__PURE__ */ jsxs50(Box, { children: [
28032
- /* @__PURE__ */ jsxs50(
28324
+ /* @__PURE__ */ jsxs51(Box, { children: [
28325
+ /* @__PURE__ */ jsxs51(
28033
28326
  Flex,
28034
28327
  {
28035
28328
  $flexDirection: "column",
@@ -28044,7 +28337,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28044
28337
  }
28045
28338
  },
28046
28339
  children: [
28047
- /* @__PURE__ */ jsx65(
28340
+ /* @__PURE__ */ jsx66(
28048
28341
  Text,
28049
28342
  {
28050
28343
  as: "h2",
@@ -28053,8 +28346,8 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28053
28346
  children: props.header.isVisible && props.plans.isVisible && plans.length > 0 && t4("Plans")
28054
28347
  }
28055
28348
  ),
28056
- /* @__PURE__ */ jsxs50(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28057
- showCurrencySelector && /* @__PURE__ */ jsx65(
28349
+ /* @__PURE__ */ jsxs51(Flex, { $alignItems: "center", $gap: "0.75rem", children: [
28350
+ showCurrencySelector && /* @__PURE__ */ jsx66(
28058
28351
  CurrencyToggle,
28059
28352
  {
28060
28353
  currencies,
@@ -28062,7 +28355,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28062
28355
  onSelect: setSelectedCurrency
28063
28356
  }
28064
28357
  ),
28065
- showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx65(
28358
+ showPeriodToggle && periods.length > 1 && /* @__PURE__ */ jsx66(
28066
28359
  PeriodToggle,
28067
28360
  {
28068
28361
  options: periods,
@@ -28079,7 +28372,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28079
28372
  ]
28080
28373
  }
28081
28374
  ),
28082
- props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx65(
28375
+ props.plans.isVisible && plans.length > 0 && /* @__PURE__ */ jsx66(
28083
28376
  Box,
28084
28377
  {
28085
28378
  as: "ul",
@@ -28092,7 +28385,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28092
28385
  $listStyle: "none",
28093
28386
  children: plans.map((plan, index, self2) => {
28094
28387
  const planPeriod = showPeriodToggle ? selectedPeriod : plan.monthlyPrice ? BillingProductPriceInterval.Month : plan.quarterlyPrice ? "quarter" : plan.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28095
- return /* @__PURE__ */ jsx65(
28388
+ return /* @__PURE__ */ jsx66(
28096
28389
  Plan2,
28097
28390
  {
28098
28391
  plan,
@@ -28114,14 +28407,14 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28114
28407
  }
28115
28408
  )
28116
28409
  ] }),
28117
- /* @__PURE__ */ jsx65(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs50(Fragment30, { children: [
28118
- props.header.isVisible && /* @__PURE__ */ jsx65(
28410
+ /* @__PURE__ */ jsx66(Box, { children: props.addOns.isVisible && addOns.length > 0 && /* @__PURE__ */ jsxs51(Fragment30, { children: [
28411
+ props.header.isVisible && /* @__PURE__ */ jsx66(
28119
28412
  Flex,
28120
28413
  {
28121
28414
  $justifyContent: "space-between",
28122
28415
  $alignItems: "center",
28123
28416
  $marginBottom: "1rem",
28124
- children: /* @__PURE__ */ jsx65(
28417
+ children: /* @__PURE__ */ jsx66(
28125
28418
  Text,
28126
28419
  {
28127
28420
  as: "h2",
@@ -28132,7 +28425,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28132
28425
  )
28133
28426
  }
28134
28427
  ),
28135
- /* @__PURE__ */ jsx65(
28428
+ /* @__PURE__ */ jsx66(
28136
28429
  Box,
28137
28430
  {
28138
28431
  as: "ul",
@@ -28144,7 +28437,7 @@ var PricingTable = forwardRef15(({ className, ...rest }, ref) => {
28144
28437
  $listStyle: "none",
28145
28438
  children: addOns.map((addOn, index) => {
28146
28439
  const addOnPeriod = showPeriodToggle ? selectedPeriod : addOn.monthlyPrice ? BillingProductPriceInterval.Month : addOn.quarterlyPrice ? "quarter" : addOn.yearlyPrice ? BillingProductPriceInterval.Year : BillingProductPriceInterval.Month;
28147
- return /* @__PURE__ */ jsx65(
28440
+ return /* @__PURE__ */ jsx66(
28148
28441
  AddOn2,
28149
28442
  {
28150
28443
  addOn,
@@ -28172,7 +28465,7 @@ PricingTable.displayName = "PricingTable";
28172
28465
 
28173
28466
  // src/components/elements/text/Text.tsx
28174
28467
  import { forwardRef as forwardRef16 } from "react";
28175
- import { jsx as jsx66 } from "react/jsx-runtime";
28468
+ import { jsx as jsx67 } from "react/jsx-runtime";
28176
28469
  var resolveDesignProps9 = (props) => {
28177
28470
  return {
28178
28471
  text: {
@@ -28184,7 +28477,7 @@ var resolveDesignProps9 = (props) => {
28184
28477
  };
28185
28478
  var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
28186
28479
  const props = resolveDesignProps9(rest);
28187
- return /* @__PURE__ */ jsx66(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx66(
28480
+ return /* @__PURE__ */ jsx67(Element, { as: Flex, ref, className, children: /* @__PURE__ */ jsx67(
28188
28481
  Text,
28189
28482
  {
28190
28483
  display: props.text.fontStyle,
@@ -28197,8 +28490,8 @@ var TextElement = forwardRef16(({ children, className, ...rest }, ref) => {
28197
28490
  TextElement.displayName = "Text";
28198
28491
 
28199
28492
  // src/components/elements/unsubscribe-button/UnsubscribeButton.tsx
28200
- import { forwardRef as forwardRef17, useMemo as useMemo35 } from "react";
28201
- import { jsx as jsx67 } from "react/jsx-runtime";
28493
+ import { forwardRef as forwardRef17, useMemo as useMemo36 } from "react";
28494
+ import { jsx as jsx68 } from "react/jsx-runtime";
28202
28495
  var buttonStyles = {
28203
28496
  primary: {
28204
28497
  color: "primary",
@@ -28228,13 +28521,13 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
28228
28521
  const props = resolveDesignProps10(rest);
28229
28522
  const { t: t4 } = useTranslation();
28230
28523
  const { data, setLayout } = useEmbed();
28231
- const hasActiveSubscription = useMemo35(() => {
28524
+ const hasActiveSubscription = useMemo36(() => {
28232
28525
  return data?.subscription && data.subscription.status !== "cancelled" && !data.subscription.cancelAt;
28233
28526
  }, [data?.subscription]);
28234
28527
  if (!hasActiveSubscription) {
28235
28528
  return null;
28236
28529
  }
28237
- return /* @__PURE__ */ jsx67(
28530
+ return /* @__PURE__ */ jsx68(
28238
28531
  Element,
28239
28532
  {
28240
28533
  as: Flex,
@@ -28242,7 +28535,7 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
28242
28535
  className,
28243
28536
  $flexDirection: "column",
28244
28537
  $gap: "2rem",
28245
- children: /* @__PURE__ */ jsx67(
28538
+ children: /* @__PURE__ */ jsx68(
28246
28539
  Button,
28247
28540
  {
28248
28541
  type: "button",
@@ -28263,8 +28556,8 @@ var UnsubscribeButton = forwardRef17(({ children, className, ...rest }, ref) =>
28263
28556
  UnsubscribeButton.displayName = "UnsubscribeButton";
28264
28557
 
28265
28558
  // src/components/elements/upcoming-bill/UpcomingBill.tsx
28266
- import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect9, useMemo as useMemo36, useState as useState22 } from "react";
28267
- import { jsx as jsx68, jsxs as jsxs51 } from "react/jsx-runtime";
28559
+ import { forwardRef as forwardRef18, useCallback as useCallback17, useEffect as useEffect10, useMemo as useMemo37, useState as useState23 } from "react";
28560
+ import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
28268
28561
  function resolveDesignProps11(props) {
28269
28562
  return {
28270
28563
  header: {
@@ -28288,10 +28581,10 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28288
28581
  const { t: t4 } = useTranslation();
28289
28582
  const { data, settings, getUpcomingInvoice } = useEmbed();
28290
28583
  const isLightBackground = useIsLightBackground();
28291
- const [isLoading, setIsLoading] = useState22(false);
28292
- const [error, setError] = useState22();
28293
- const [upcomingInvoice, setUpcomingInvoice] = useState22(data?.upcomingInvoice);
28294
- const discounts = useMemo36(() => {
28584
+ const [isLoading, setIsLoading] = useState23(false);
28585
+ const [error, setError] = useState23();
28586
+ const [upcomingInvoice, setUpcomingInvoice] = useState23(data?.upcomingInvoice);
28587
+ const discounts = useMemo37(() => {
28295
28588
  return (data?.subscription?.discounts || []).filter(
28296
28589
  (discount) => (
28297
28590
  // Only surface discounts that are currently active and actually
@@ -28325,15 +28618,15 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28325
28618
  }
28326
28619
  }
28327
28620
  }, [data?.component?.id, data?.subscription, getUpcomingInvoice]);
28328
- useEffect9(() => {
28621
+ useEffect10(() => {
28329
28622
  getInvoice();
28330
28623
  }, [getInvoice]);
28331
- useEffect9(() => {
28624
+ useEffect10(() => {
28332
28625
  if (data?.upcomingInvoice) {
28333
28626
  setUpcomingInvoice(data.upcomingInvoice);
28334
28627
  }
28335
28628
  }, [data?.upcomingInvoice]);
28336
- const { currency, applied, remaining } = useMemo36(() => {
28629
+ const { currency, applied, remaining } = useMemo37(() => {
28337
28630
  const currency2 = upcomingInvoice?.currency;
28338
28631
  const startingBalance = upcomingInvoice?.startingBalance ?? 0;
28339
28632
  const endingBalance = upcomingInvoice?.endingBalance ?? 0;
@@ -28352,9 +28645,9 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28352
28645
  if (!data?.subscription || data.subscription.cancelAt) {
28353
28646
  return null;
28354
28647
  }
28355
- return /* @__PURE__ */ jsxs51(Element, { ref, className, children: [
28356
- /* @__PURE__ */ jsx68(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx68(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
28357
- error ? /* @__PURE__ */ jsxs51(
28648
+ return /* @__PURE__ */ jsxs52(Element, { ref, className, children: [
28649
+ /* @__PURE__ */ jsx69(Flex, { as: TransitionBox, $justifyContent: "center", $alignItems: "center", children: /* @__PURE__ */ jsx69(Loader, { $color: settings.theme.primary, $isLoading: isLoading }) }),
28650
+ error ? /* @__PURE__ */ jsxs52(
28358
28651
  Flex,
28359
28652
  {
28360
28653
  as: TransitionBox,
@@ -28363,8 +28656,8 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28363
28656
  $alignItems: "center",
28364
28657
  $gap: "1rem",
28365
28658
  children: [
28366
- /* @__PURE__ */ jsx68(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
28367
- /* @__PURE__ */ jsx68(
28659
+ /* @__PURE__ */ jsx69(Text, { $weight: 500, $color: "#DB6669", children: t4("There was a problem retrieving your upcoming invoice.") }),
28660
+ /* @__PURE__ */ jsx69(
28368
28661
  Button,
28369
28662
  {
28370
28663
  type: "button",
@@ -28377,28 +28670,28 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28377
28670
  )
28378
28671
  ]
28379
28672
  }
28380
- ) : !isLoading && /* @__PURE__ */ jsx68(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs51(Flex, { $flexDirection: "column", $gap: "1rem", children: [
28381
- props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs51(Text, { display: props.header.fontStyle, children: [
28673
+ ) : !isLoading && /* @__PURE__ */ jsx69(TransitionBox, { children: upcomingInvoice ? /* @__PURE__ */ jsxs52(Flex, { $flexDirection: "column", $gap: "1rem", children: [
28674
+ props.header.isVisible && upcomingInvoice.dueDate && /* @__PURE__ */ jsxs52(Text, { display: props.header.fontStyle, children: [
28382
28675
  props.header.prefix,
28383
28676
  " ",
28384
28677
  toPrettyDate(upcomingInvoice.dueDate)
28385
28678
  ] }),
28386
- /* @__PURE__ */ jsxs51(
28679
+ /* @__PURE__ */ jsxs52(
28387
28680
  Flex,
28388
28681
  {
28389
28682
  $justifyContent: "space-between",
28390
28683
  $alignItems: "start",
28391
28684
  $gap: "1rem",
28392
28685
  children: [
28393
- props.price.isVisible && /* @__PURE__ */ jsx68(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
28686
+ props.price.isVisible && /* @__PURE__ */ jsx69(Text, { display: props.price.fontStyle, $leading: "none", children: formatCurrency(
28394
28687
  upcomingInvoice.amountDue,
28395
28688
  upcomingInvoice.currency
28396
28689
  ) }),
28397
- /* @__PURE__ */ jsx68(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx68(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
28690
+ /* @__PURE__ */ jsx69(Box, { $maxWidth: "10rem", $textAlign: "right", children: /* @__PURE__ */ jsx69(Text, { display: props.contractEndDate.fontStyle, children: t4("Estimated bill") }) })
28398
28691
  ]
28399
28692
  }
28400
28693
  ),
28401
- hasApplied && /* @__PURE__ */ jsxs51(
28694
+ hasApplied && /* @__PURE__ */ jsxs52(
28402
28695
  Flex,
28403
28696
  {
28404
28697
  as: TransitionBox,
@@ -28406,12 +28699,12 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28406
28699
  $alignItems: "start",
28407
28700
  $gap: "1rem",
28408
28701
  children: [
28409
- /* @__PURE__ */ jsx68(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
28410
- /* @__PURE__ */ jsx68(Text, { children: formatCurrency(-applied, currency) })
28702
+ /* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Applied balance towards next invoice") }),
28703
+ /* @__PURE__ */ jsx69(Text, { children: formatCurrency(-applied, currency) })
28411
28704
  ]
28412
28705
  }
28413
28706
  ),
28414
- hasBalance && /* @__PURE__ */ jsxs51(
28707
+ hasBalance && /* @__PURE__ */ jsxs52(
28415
28708
  Flex,
28416
28709
  {
28417
28710
  as: TransitionBox,
@@ -28419,20 +28712,20 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28419
28712
  $alignItems: "start",
28420
28713
  $gap: "1rem",
28421
28714
  children: [
28422
- /* @__PURE__ */ jsx68(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
28423
- /* @__PURE__ */ jsx68(Text, { children: formatCurrency(remaining, currency) })
28715
+ /* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Remaining balance after next invoice") }),
28716
+ /* @__PURE__ */ jsx69(Text, { children: formatCurrency(remaining, currency) })
28424
28717
  ]
28425
28718
  }
28426
28719
  ),
28427
- discounts.length > 0 && /* @__PURE__ */ jsxs51(
28720
+ discounts.length > 0 && /* @__PURE__ */ jsxs52(
28428
28721
  Flex,
28429
28722
  {
28430
28723
  $justifyContent: "space-between",
28431
28724
  $alignItems: "start",
28432
28725
  $gap: "1rem",
28433
28726
  children: [
28434
- /* @__PURE__ */ jsx68(Text, { $weight: 600, children: t4("Discount") }),
28435
- /* @__PURE__ */ jsx68(
28727
+ /* @__PURE__ */ jsx69(Text, { $weight: 600, children: t4("Discount") }),
28728
+ /* @__PURE__ */ jsx69(
28436
28729
  Flex,
28437
28730
  {
28438
28731
  $flexDirection: "column",
@@ -28448,13 +28741,13 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28448
28741
  discount?.currency
28449
28742
  )
28450
28743
  });
28451
- return /* @__PURE__ */ jsxs51(
28744
+ return /* @__PURE__ */ jsxs52(
28452
28745
  Flex,
28453
28746
  {
28454
28747
  $alignItems: "center",
28455
28748
  $gap: "0.5rem",
28456
28749
  children: [
28457
- discount.customerFacingCode && /* @__PURE__ */ jsx68(
28750
+ discount.customerFacingCode && /* @__PURE__ */ jsx69(
28458
28751
  Flex,
28459
28752
  {
28460
28753
  $alignItems: "center",
@@ -28463,7 +28756,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28463
28756
  $borderStyle: "solid",
28464
28757
  $borderColor: isLightBackground ? "hsla(0, 0%, 0%, 0.15)" : "hsla(0, 0%, 100%, 0.15)",
28465
28758
  $borderRadius: "0.3125rem",
28466
- children: /* @__PURE__ */ jsx68(
28759
+ children: /* @__PURE__ */ jsx69(
28467
28760
  Text,
28468
28761
  {
28469
28762
  $size: 0.75 * settings.theme.typography.text.fontSize,
@@ -28473,7 +28766,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28473
28766
  )
28474
28767
  }
28475
28768
  ),
28476
- /* @__PURE__ */ jsx68(Box, { children: /* @__PURE__ */ jsx68(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
28769
+ /* @__PURE__ */ jsx69(Box, { children: /* @__PURE__ */ jsx69(Text, { children: discount.duration === "repeating" && discount.durationInMonths ? t4("Discount for months", {
28477
28770
  discount: label,
28478
28771
  count: discount.durationInMonths
28479
28772
  }) : label }) })
@@ -28487,7 +28780,7 @@ var UpcomingBill = forwardRef18(({ className, ...rest }, ref) => {
28487
28780
  ]
28488
28781
  }
28489
28782
  )
28490
- ] }) : /* @__PURE__ */ jsx68(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
28783
+ ] }) : /* @__PURE__ */ jsx69(Text, { display: "heading2", children: t4("No upcoming invoice") }) })
28491
28784
  ] });
28492
28785
  });
28493
28786
  UpcomingBill.displayName = "UpcomingBill";
@@ -31123,7 +31416,7 @@ function inflate(input, options = {}) {
31123
31416
  }
31124
31417
 
31125
31418
  // src/components/embed/Embed.tsx
31126
- import { useContext as useContext6, useEffect as useEffect10, useMemo as useMemo37 } from "react";
31419
+ import { useContext as useContext6, useEffect as useEffect11, useMemo as useMemo38 } from "react";
31127
31420
 
31128
31421
  // src/components/embed/renderer.ts
31129
31422
  import { createElement as createElement5 } from "react";
@@ -31203,11 +31496,11 @@ function createRenderer(options) {
31203
31496
  }
31204
31497
 
31205
31498
  // src/components/embed/Embed.tsx
31206
- import { jsx as jsx69, jsxs as jsxs52 } from "react/jsx-runtime";
31499
+ import { jsx as jsx70, jsxs as jsxs53 } from "react/jsx-runtime";
31207
31500
  var renderer = createRenderer();
31208
31501
  var Loading = () => {
31209
31502
  const { settings } = useEmbed();
31210
- return /* @__PURE__ */ jsx69(
31503
+ return /* @__PURE__ */ jsx70(
31211
31504
  Flex,
31212
31505
  {
31213
31506
  $width: "100%",
@@ -31215,13 +31508,13 @@ var Loading = () => {
31215
31508
  $alignItems: "center",
31216
31509
  $justifyContent: "center",
31217
31510
  $padding: `${settings.theme.card.padding / TEXT_BASE_SIZE}rem`,
31218
- children: /* @__PURE__ */ jsx69(Loader, { $color: settings.theme.primary, $size: "2xl" })
31511
+ children: /* @__PURE__ */ jsx70(Loader, { $color: settings.theme.primary, $size: "2xl" })
31219
31512
  }
31220
31513
  );
31221
31514
  };
31222
31515
  var Error2 = ({ message }) => {
31223
31516
  const { settings } = useEmbed();
31224
- return /* @__PURE__ */ jsxs52(
31517
+ return /* @__PURE__ */ jsxs53(
31225
31518
  Flex,
31226
31519
  {
31227
31520
  $flexDirection: "column",
@@ -31232,8 +31525,8 @@ var Error2 = ({ message }) => {
31232
31525
  $alignItems: "center",
31233
31526
  $justifyContent: "center",
31234
31527
  children: [
31235
- /* @__PURE__ */ jsx69(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx69(Text, { display: "heading1", children: "Error" }) }),
31236
- /* @__PURE__ */ jsx69(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx69(Text, { children: message }) })
31528
+ /* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { display: "heading1", children: "Error" }) }),
31529
+ /* @__PURE__ */ jsx70(Box, { $marginBottom: "0.5rem", children: /* @__PURE__ */ jsx70(Text, { children: message }) })
31237
31530
  ]
31238
31531
  }
31239
31532
  );
@@ -31251,7 +31544,7 @@ var SchematicEmbed = ({ id, accessToken }) => {
31251
31544
  setBuilderSettings
31252
31545
  } = useEmbed();
31253
31546
  const compressedAst = data?.component?.ast;
31254
- const { children, parsedSettings, parseError } = useMemo37(() => {
31547
+ const { children, parsedSettings, parseError } = useMemo38(() => {
31255
31548
  let children2 = null;
31256
31549
  let parsedSettings2 = null;
31257
31550
  let parseError2 = null;
@@ -31283,22 +31576,22 @@ var SchematicEmbed = ({ id, accessToken }) => {
31283
31576
  parseError: parseError2
31284
31577
  };
31285
31578
  }, [compressedAst]);
31286
- useEffect10(() => {
31579
+ useEffect11(() => {
31287
31580
  if (accessToken) {
31288
31581
  setAccessToken(accessToken);
31289
31582
  }
31290
31583
  }, [accessToken, setAccessToken]);
31291
- useEffect10(() => {
31584
+ useEffect11(() => {
31292
31585
  if (id && stale) {
31293
31586
  hydrateComponent(id);
31294
31587
  }
31295
31588
  }, [id, hydrateComponent, stale]);
31296
- useEffect10(() => {
31589
+ useEffect11(() => {
31297
31590
  if (parsedSettings) {
31298
31591
  setBuilderSettings(parsedSettings);
31299
31592
  }
31300
31593
  }, [parsedSettings, setBuilderSettings]);
31301
- useEffect10(() => {
31594
+ useEffect11(() => {
31302
31595
  if (parseError) {
31303
31596
  setError(parseError);
31304
31597
  }
@@ -31307,13 +31600,13 @@ var SchematicEmbed = ({ id, accessToken }) => {
31307
31600
  return stub();
31308
31601
  }
31309
31602
  if (error) {
31310
- return /* @__PURE__ */ jsx69(Error2, { message: error.message });
31603
+ return /* @__PURE__ */ jsx70(Error2, { message: error.message });
31311
31604
  }
31312
31605
  if (accessToken?.length === 0) {
31313
- return /* @__PURE__ */ jsx69(Error2, { message: "Please provide an access token." });
31606
+ return /* @__PURE__ */ jsx70(Error2, { message: "Please provide an access token." });
31314
31607
  }
31315
31608
  if (!accessToken?.startsWith("token_")) {
31316
- return /* @__PURE__ */ jsx69(
31609
+ return /* @__PURE__ */ jsx70(
31317
31610
  Error2,
31318
31611
  {
31319
31612
  message: 'Invalid access token; your temporary access token will start with "token_".'
@@ -31321,9 +31614,9 @@ var SchematicEmbed = ({ id, accessToken }) => {
31321
31614
  );
31322
31615
  }
31323
31616
  if (isPending) {
31324
- return /* @__PURE__ */ jsx69(Loading, {});
31617
+ return /* @__PURE__ */ jsx70(Loading, {});
31325
31618
  }
31326
- return /* @__PURE__ */ jsx69(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ jsx69(Loading, {}) });
31619
+ return /* @__PURE__ */ jsx70(Box, { className: "sch-Embed", "data-testid": "sch-embed", children: children ?? /* @__PURE__ */ jsx70(Loading, {}) });
31327
31620
  };
31328
31621
  export {
31329
31622
  AddOns,