@schematichq/schematic-components 2.38.0 → 2.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,6 +54,7 @@ var init_tokens = __esm({
54
54
  "--schematic-line-height-heading": "1.2",
55
55
  "--schematic-meter-track": ld("#f2f4f7", "#26282d"),
56
56
  "--schematic-muted": ld("#8a8a8a", "#a1a1a1"),
57
+ "--schematic-positive": ld("#1a7f37", "#3fb950"),
57
58
  "--schematic-primary": ld("#000000", "#ffffff"),
58
59
  "--schematic-primary-contrast": ld("#ffffff", "#000000"),
59
60
  "--schematic-radius": "0.625rem",
@@ -491,6 +492,7 @@ import {
491
492
  useCheckout as useCheckout2,
492
493
  useCompany as useCompany5,
493
494
  useCreditBalances as useCreditBalances3,
495
+ useCreditLedger as useCreditLedger2,
494
496
  useCreditUserUsage as useCreditUserUsage2,
495
497
  useFeatureUsage as useFeatureUsage6,
496
498
  useFeatureUserUsage as useFeatureUserUsage2,
@@ -991,6 +993,16 @@ function formatDate(date, locale, options) {
991
993
  ...options
992
994
  }).format(date);
993
995
  }
996
+ function formatDateTime(date, locale, options = {}) {
997
+ if (usableDate(date) === void 0) {
998
+ return "";
999
+ }
1000
+ return new Intl.DateTimeFormat(usableLocale(locale), {
1001
+ ...options.timeOnly === true ? {} : { month: "short", day: "numeric" },
1002
+ hour: "numeric",
1003
+ minute: "2-digit"
1004
+ }).format(date);
1005
+ }
994
1006
  function formatShortDate(date, locale) {
995
1007
  if (usableDate(date) === void 0) {
996
1008
  return "";
@@ -1044,6 +1056,16 @@ function isEnglish(locale) {
1044
1056
  function orNull(value) {
1045
1057
  return value === void 0 || value === null || value === "" ? null : value;
1046
1058
  }
1059
+ var RESET_PERIOD = {
1060
+ daily: "day",
1061
+ weekly: "week",
1062
+ monthly: "month",
1063
+ quarterly: "quarter",
1064
+ yearly: "year"
1065
+ };
1066
+ function resetPeriod(cadence) {
1067
+ return cadence === void 0 || cadence === null ? null : RESET_PERIOD[cadence] ?? null;
1068
+ }
1047
1069
 
1048
1070
  // src/elements/model/invoices.ts
1049
1071
  function linkableURL(url) {
@@ -1343,6 +1365,10 @@ function planCurrencies(plan) {
1343
1365
  }
1344
1366
  return [...currencies];
1345
1367
  }
1368
+ function pricedIn(plan, currency) {
1369
+ const currencies = planCurrencies(plan);
1370
+ return currencies.length === 0 || currencies.includes(currency.toLowerCase());
1371
+ }
1346
1372
  function isPayInAdvance(entitlement) {
1347
1373
  return entitlement.priceBehavior === "pay_in_advance";
1348
1374
  }
@@ -1409,7 +1435,9 @@ function initialCart({
1409
1435
  if (selection.planId === null) {
1410
1436
  planId = void 0;
1411
1437
  } else if (selection.planId !== void 0) {
1412
- planId = catalog.plans.some((p) => p.id === selection.planId) ? selection.planId : void 0;
1438
+ planId = catalog.plans.some(
1439
+ (p) => p.id === selection.planId && pricedIn(p, currency)
1440
+ ) ? selection.planId : void 0;
1413
1441
  } else {
1414
1442
  planId = catalog.plans.find(
1415
1443
  (p) => p.current && !(p.isTrialable && p.companyCanTrial)
@@ -2065,9 +2093,7 @@ function deriveCheckout(input) {
2065
2093
  selectable: periodOptions.length > 1 && display?.showPeriodToggle !== false,
2066
2094
  savings: plan === void 0 ? null : periodSavings(plan, cart, locale)
2067
2095
  },
2068
- plans: catalog.plans.map(
2069
- (p) => planRow(p, cart, locale, p.id === plan?.id)
2070
- ),
2096
+ plans: catalog.plans.filter((p) => pricedIn(p, cart.currency)).map((p) => planRow(p, cart, locale, p.id === plan?.id)),
2071
2097
  customPlan: customPlanOf(catalog),
2072
2098
  downgradeContact: catalog.preventSelfServiceDowngradeUrl ? {
2073
2099
  url: catalog.preventSelfServiceDowngradeUrl,
@@ -2144,6 +2170,121 @@ function parseOptInText(text) {
2144
2170
  return segments;
2145
2171
  }
2146
2172
 
2173
+ // src/elements/model/creditLog.ts
2174
+ function deriveCreditLog(page, options) {
2175
+ const now = options.now ?? /* @__PURE__ */ new Date();
2176
+ const rows = page.entries.map((entry) => logRow(entry, options.locale, now));
2177
+ const first = rows[0]?.source.credit;
2178
+ const single = first !== void 0 && rows.every((row) => row.creditId === first.id);
2179
+ return {
2180
+ rows,
2181
+ credit: single ? { id: first.id, name: featureName(first, 2, options.locale) } : null,
2182
+ hasMore: page.nextCursor !== void 0
2183
+ };
2184
+ }
2185
+ function logRow(entry, locale, now) {
2186
+ const at = usableDate(entry.eventAt) ?? null;
2187
+ const day = at === null ? null : relativeDay(at, now);
2188
+ const { kind, action: action2, subject, who } = describe(entry);
2189
+ const magnitude = Math.abs(entry.amount);
2190
+ return {
2191
+ id: entry.id,
2192
+ kind,
2193
+ action: action2,
2194
+ subject,
2195
+ who,
2196
+ amount: entry.amount,
2197
+ amountText: formatCredits(magnitude, locale),
2198
+ positive: entry.amount > 0,
2199
+ unit: featureName(
2200
+ {
2201
+ name: entry.credit.name,
2202
+ singularName: entry.credit.singularName,
2203
+ pluralName: entry.credit.pluralName
2204
+ },
2205
+ magnitude,
2206
+ locale
2207
+ ),
2208
+ creditId: entry.credit.id,
2209
+ creditName: featureName(entry.credit, 2, locale),
2210
+ at,
2211
+ day,
2212
+ whenText: at === null ? "" : formatDateTime(at, locale, { timeOnly: day !== null }),
2213
+ timeText: at === null ? "" : formatDateTime(at, locale, { timeOnly: true }),
2214
+ source: entry
2215
+ };
2216
+ }
2217
+ function describe(entry) {
2218
+ switch (entry.kind) {
2219
+ case "grant":
2220
+ return describeGrant(entry);
2221
+ case "zero_out":
2222
+ return {
2223
+ kind: "expiry",
2224
+ action: EXPIRY_ACTION[entry.zeroedOutReason ?? ""] ?? "removed",
2225
+ subject: null,
2226
+ who: grantSource(entry)
2227
+ };
2228
+ default: {
2229
+ const user = entry.user;
2230
+ const userWho = user === void 0 || user === null || user.name === "" ? null : { kind: "user", name: user.name };
2231
+ const feature = entry.feature?.name ?? null;
2232
+ if (entry.usageReason === "manual_adjustment") {
2233
+ return {
2234
+ kind: entry.amount > 0 ? "reversal" : "draw",
2235
+ action: "usageAdjustment",
2236
+ subject: null,
2237
+ who: userWho ?? { kind: "manual" }
2238
+ };
2239
+ }
2240
+ return entry.amount > 0 ? { kind: "reversal", action: "refund", subject: feature, who: userWho } : { kind: "draw", action: "usage", subject: feature, who: userWho };
2241
+ }
2242
+ }
2243
+ }
2244
+ function describeGrant(entry) {
2245
+ const bundle = entry.bundle?.name ?? null;
2246
+ const who = grantSource(entry);
2247
+ switch (entry.grantReason) {
2248
+ case "billing_credit_auto_topup":
2249
+ return { kind: "topup", action: "autoTopup", subject: bundle, who };
2250
+ case "purchased":
2251
+ return { kind: "topup", action: "purchase", subject: bundle, who };
2252
+ case "free":
2253
+ return { kind: "grant", action: "freeGrant", subject: null, who };
2254
+ case "adjustment":
2255
+ return { kind: "grant", action: "adjustmentGrant", subject: null, who };
2256
+ case "rollover":
2257
+ return { kind: "grant", action: "rollover", subject: null, who };
2258
+ default:
2259
+ return { kind: "grant", action: "planGrant", subject: null, who };
2260
+ }
2261
+ }
2262
+ var EXPIRY_ACTION = {
2263
+ expired: "expired",
2264
+ license_retired: "licenseRetired",
2265
+ manual: "removed",
2266
+ plan_change: "planChange",
2267
+ plan_period_reset: "reset"
2268
+ };
2269
+ function grantSource(entry) {
2270
+ switch (entry.grantReason) {
2271
+ case "billing_credit_auto_topup":
2272
+ return { kind: "autoTopup" };
2273
+ case "purchased":
2274
+ return { kind: "purchase" };
2275
+ case "free":
2276
+ case "adjustment":
2277
+ return { kind: "manual" };
2278
+ default:
2279
+ return { kind: "plan" };
2280
+ }
2281
+ }
2282
+ function relativeDay(at, now) {
2283
+ const startOf = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
2284
+ const days = Math.round((startOf(now) - startOf(at)) / 864e5);
2285
+ return days === 0 ? "today" : days === 1 ? "yesterday" : null;
2286
+ }
2287
+
2147
2288
  // src/elements/model/creditUsage.ts
2148
2289
  function deriveCreditUsage(balances, options) {
2149
2290
  const ordered = options.visibleCredits === void 0 ? balances : options.visibleCredits.flatMap((id) => {
@@ -2907,7 +3048,7 @@ function planCredits(company, balances, locale) {
2907
3048
  kind: "total",
2908
3049
  amount: formatCredits(value, locale),
2909
3050
  creditName: featureName(unit, value, locale),
2910
- period: subscriptionPeriod2
3051
+ period: resetPeriod(grants[0].renewalPeriod) ?? subscriptionPeriod2
2911
3052
  } : {
2912
3053
  kind: "perLicense",
2913
3054
  amount: formatCredits(composition.perLicenseAmount, locale),
@@ -3071,9 +3212,11 @@ function derivePricingTable(view, options) {
3071
3212
  const { catalog } = view;
3072
3213
  const plans = catalog.plans;
3073
3214
  const addOns = catalog.addOns;
3074
- const currencies = unique([...plans, ...addOns].flatMap(currenciesOf));
3215
+ const locked = options.company?.subscription?.currency?.toLowerCase() || void 0;
3216
+ const offered = unique([...plans, ...addOns].flatMap(currenciesOf));
3217
+ const currencies = locked === void 0 ? offered : [locked];
3075
3218
  const defaultCurrency = catalog.defaultCurrency?.toLowerCase();
3076
- const currency = pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3219
+ const currency = locked ?? pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3077
3220
  const priced = (plan) => supportsCurrency(plan, currency);
3078
3221
  const periods = PERIODS.filter(
3079
3222
  (period2) => [...plans, ...addOns].filter(priced).some((plan) => periodsOf(plan).includes(period2))
@@ -3519,15 +3662,6 @@ function customPlanOf2(plan) {
3519
3662
  function asPeriod(value) {
3520
3663
  return value === "month" || value === "quarter" || value === "year" ? value : null;
3521
3664
  }
3522
- var RESET_PERIOD = {
3523
- daily: "day",
3524
- weekly: "week",
3525
- monthly: "month",
3526
- yearly: "year"
3527
- };
3528
- function resetPeriod(cadence) {
3529
- return cadence === void 0 || cadence === null ? null : RESET_PERIOD[cadence] ?? null;
3530
- }
3531
3665
  var METRIC_PERIOD = {
3532
3666
  current_day: "day",
3533
3667
  current_week: "week",
@@ -3711,6 +3845,43 @@ var DEFAULT_STRINGS = {
3711
3845
  creditUsagePerLicense: "{{quantity}} {{licenseName}} \xD7 {{perUnit}}",
3712
3846
  creditUsageCompanyGrant: "{{amount}} company grant",
3713
3847
  creditUsageRenewsOn: "Renews on the {{day}}.",
3848
+ creditLogLoading: "Loading credit activity",
3849
+ creditLogHeader: "Credit activity",
3850
+ creditLogError: "There was a problem retrieving your credit activity.",
3851
+ creditLogUnavailable: "Credit activity is not available for this account.",
3852
+ creditLogEmpty: "No credit activity yet",
3853
+ creditLogSeeMore: "See full log",
3854
+ creditLogSeeLess: "See less",
3855
+ creditLogSeeAll: "See all",
3856
+ creditLogLoadMore: "Load more",
3857
+ creditLogToday: "Today, {{time}}",
3858
+ creditLogYesterday: "Yesterday, {{time}}",
3859
+ creditLogColumnDate: "Date",
3860
+ creditLogColumnActivity: "Activity",
3861
+ creditLogColumnCredit: "Credit",
3862
+ creditLogColumnBy: "By",
3863
+ creditLogColumnAmount: "Amount",
3864
+ creditLogActionUsage: "Usage",
3865
+ creditLogActionRefund: "Refund: {{feature}}",
3866
+ creditLogActionRefundUnnamed: "Refund",
3867
+ creditLogActionUsageAdjustment: "Usage adjustment",
3868
+ creditLogActionAutoTopup: "Auto top-up, {{bundle}}",
3869
+ creditLogActionAutoTopupUnnamed: "Auto top-up",
3870
+ creditLogActionPurchase: "Purchased {{bundle}}",
3871
+ creditLogActionPurchaseUnnamed: "Credits purchased",
3872
+ creditLogActionPlanGrant: "Plan grant",
3873
+ creditLogActionFreeGrant: "Free credits",
3874
+ creditLogActionAdjustmentGrant: "Credit adjustment",
3875
+ creditLogActionRollover: "Rolled over",
3876
+ creditLogActionExpired: "Unused grant expired",
3877
+ creditLogActionReset: "Unused credits reset",
3878
+ creditLogActionPlanChange: "Removed on plan change",
3879
+ creditLogActionLicenseRetired: "Removed with license",
3880
+ creditLogActionRemoved: "Credits removed",
3881
+ creditLogWhoAutoTopup: "Auto top-up",
3882
+ creditLogWhoPurchase: "Purchase",
3883
+ creditLogWhoPlan: "Plan",
3884
+ creditLogWhoManual: "Manual",
3714
3885
  planManagerLoading: "Loading your plan",
3715
3886
  planManagerError: "There was a problem retrieving your plan.",
3716
3887
  planManagerUnavailable: "Your plan is not available for this account.",
@@ -4537,6 +4708,197 @@ var checkoutCss = `
4537
4708
  }
4538
4709
  `;
4539
4710
 
4711
+ // src/elements/styles/credit-log.ts
4712
+ var creditLogCss = `
4713
+ .schematic-credit-log {
4714
+ display: flex;
4715
+ flex-direction: column;
4716
+ }
4717
+
4718
+ .schematic-credit-log__list {
4719
+ display: flex;
4720
+ flex-direction: column;
4721
+ gap: calc(var(--schematic-space) / 2);
4722
+ list-style: none;
4723
+ margin: 0;
4724
+ padding: 0;
4725
+ }
4726
+
4727
+ .schematic-credit-log__row {
4728
+ align-items: baseline;
4729
+ display: flex;
4730
+ gap: var(--schematic-space);
4731
+ justify-content: space-between;
4732
+ }
4733
+
4734
+ .schematic-credit-log__what {
4735
+ display: flex;
4736
+ flex-direction: column;
4737
+ gap: 0.125rem;
4738
+ min-width: 0;
4739
+ }
4740
+
4741
+ .schematic-credit-log__amount {
4742
+ font-variant-numeric: tabular-nums;
4743
+ margin-inline-start: auto;
4744
+ text-align: end;
4745
+ white-space: nowrap;
4746
+ }
4747
+
4748
+ .schematic-credit-log__amount--positive {
4749
+ color: var(--schematic-positive);
4750
+ }
4751
+
4752
+ .schematic-credit-log__toggle {
4753
+ align-items: center;
4754
+ display: inline-flex;
4755
+ gap: calc(var(--schematic-space) / 2);
4756
+ }
4757
+
4758
+ .schematic-credit-log__toggle .schematic-chevron {
4759
+ margin-inline-start: -0.333rem;
4760
+ }
4761
+
4762
+ .schematic-credit-log__scroll {
4763
+ container-type: inline-size;
4764
+ overflow-x: auto;
4765
+ }
4766
+
4767
+ .schematic-credit-log__table {
4768
+ border-collapse: collapse;
4769
+ width: 100%;
4770
+ }
4771
+
4772
+ .schematic-credit-log__heading {
4773
+ border-bottom: 1px solid var(--schematic-card-divider);
4774
+ color: var(--schematic-muted);
4775
+ font-weight: 500;
4776
+ padding: 0 var(--schematic-space) calc(var(--schematic-space) / 2) 0;
4777
+ text-align: start;
4778
+ }
4779
+
4780
+ .schematic-credit-log__cell {
4781
+ padding: calc(var(--schematic-space) / 2) var(--schematic-space)
4782
+ calc(var(--schematic-space) / 2) 0;
4783
+ vertical-align: baseline;
4784
+ }
4785
+
4786
+ /* A long name, such as a user named by an ID, wraps rather than widening its
4787
+ column, and stops at two lines like the date. */
4788
+ .schematic-credit-log__truncate {
4789
+ -webkit-box-orient: vertical;
4790
+ color: inherit;
4791
+ display: -webkit-box;
4792
+ font-size: inherit;
4793
+ -webkit-line-clamp: 2;
4794
+ line-clamp: 2;
4795
+ overflow: hidden;
4796
+ overflow-wrap: anywhere;
4797
+ }
4798
+
4799
+ .schematic-credit-log__when {
4800
+ white-space: nowrap;
4801
+ }
4802
+
4803
+ .schematic-credit-log__action,
4804
+ .schematic-credit-log__detail {
4805
+ overflow-wrap: anywhere;
4806
+ }
4807
+
4808
+ .schematic-credit-log__heading.schematic-credit-log__amount-heading,
4809
+ .schematic-credit-log__cell.schematic-credit-log__amount-cell {
4810
+ padding-inline-end: 0;
4811
+ text-align: end;
4812
+ }
4813
+
4814
+ /* A narrow card stacks each row: what happened and the amount, then when,
4815
+ who and which credit beneath. */
4816
+ @container (max-width: 30rem) {
4817
+ .schematic-credit-log__heading-row {
4818
+ display: none;
4819
+ }
4820
+
4821
+ .schematic-credit-log__table-row {
4822
+ column-gap: 0.25em;
4823
+ display: grid;
4824
+ grid-template-areas:
4825
+ "activity activity activity amount"
4826
+ "date by credit credit";
4827
+ grid-template-columns: auto fit-content(40%) minmax(0, 1fr) auto;
4828
+ padding: calc(var(--schematic-space) / 2) 0;
4829
+ }
4830
+
4831
+ .schematic-credit-log__cell {
4832
+ display: block;
4833
+ padding: 0;
4834
+ }
4835
+
4836
+ .schematic-credit-log__activity {
4837
+ grid-area: activity;
4838
+ }
4839
+
4840
+ .schematic-credit-log__cell.schematic-credit-log__amount-cell {
4841
+ grid-area: amount;
4842
+ padding-inline-start: var(--schematic-space);
4843
+ }
4844
+
4845
+ .schematic-credit-log__date,
4846
+ .schematic-credit-log__by,
4847
+ .schematic-credit-log__credit {
4848
+ font-size: 0.75rem;
4849
+ }
4850
+
4851
+ .schematic-credit-log__date {
4852
+ grid-area: date;
4853
+ }
4854
+
4855
+ .schematic-credit-log__by {
4856
+ grid-area: by;
4857
+ }
4858
+
4859
+ .schematic-credit-log__credit {
4860
+ grid-area: credit;
4861
+ }
4862
+
4863
+ .schematic-credit-log__by,
4864
+ .schematic-credit-log__credit {
4865
+ align-items: baseline;
4866
+ display: flex;
4867
+ gap: 0.25em;
4868
+ min-width: 0;
4869
+ }
4870
+
4871
+ .schematic-credit-log__by::before,
4872
+ .schematic-credit-log__credit::before {
4873
+ content: "\xB7";
4874
+ }
4875
+
4876
+ .schematic-credit-log__by.schematic-credit-log__by--none {
4877
+ display: none;
4878
+ }
4879
+ }
4880
+
4881
+ .schematic-credit-log__actions {
4882
+ align-items: center;
4883
+ display: flex;
4884
+ gap: var(--schematic-space);
4885
+ margin-top: var(--schematic-space);
4886
+ }
4887
+
4888
+ .schematic-credit-log__empty {
4889
+ margin: 0;
4890
+ padding: calc(var(--schematic-space) / 2) 0;
4891
+ }
4892
+
4893
+ .schematic-credit-log .schematic-skeleton__cell[data-column="action"] {
4894
+ width: 9rem;
4895
+ }
4896
+
4897
+ .schematic-credit-log .schematic-skeleton__cell[data-column="amount"] {
4898
+ width: 5rem;
4899
+ }
4900
+ `;
4901
+
4540
4902
  // src/elements/styles/credit-usage.ts
4541
4903
  var creditUsageCss = `
4542
4904
  .schematic-credit-usage__credits {
@@ -6620,6 +6982,7 @@ ${tooltipCss}
6620
6982
  ${includedFeaturesCss}
6621
6983
  ${meteredFeaturesCss}
6622
6984
  ${creditUsageCss}
6985
+ ${creditLogCss}
6623
6986
  ${planManagerCss}
6624
6987
  ${pricingTableCss}
6625
6988
  ${unsubscribeCss}
@@ -9240,16 +9603,389 @@ function useCheckoutLauncher() {
9240
9603
  return useContext(LauncherContext) ?? detached;
9241
9604
  }
9242
9605
 
9606
+ // src/elements/CreditLog.tsx
9607
+ import { useCreditLedger } from "@schematichq/schematic-react";
9608
+ import { useId as useId6, useMemo as useMemo4, useState as useState8 } from "react";
9609
+ import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
9610
+ var SKELETON_ROWS = 3;
9611
+ var ACTION_KEY = {
9612
+ adjustmentGrant: "creditLogActionAdjustmentGrant",
9613
+ autoTopup: "creditLogActionAutoTopup",
9614
+ expired: "creditLogActionExpired",
9615
+ freeGrant: "creditLogActionFreeGrant",
9616
+ licenseRetired: "creditLogActionLicenseRetired",
9617
+ planChange: "creditLogActionPlanChange",
9618
+ planGrant: "creditLogActionPlanGrant",
9619
+ purchase: "creditLogActionPurchase",
9620
+ refund: "creditLogActionRefund",
9621
+ removed: "creditLogActionRemoved",
9622
+ reset: "creditLogActionReset",
9623
+ rollover: "creditLogActionRollover",
9624
+ usage: "creditLogActionUsage",
9625
+ usageAdjustment: "creditLogActionUsageAdjustment"
9626
+ };
9627
+ var UNNAMED_KEY = {
9628
+ autoTopup: "creditLogActionAutoTopupUnnamed",
9629
+ purchase: "creditLogActionPurchaseUnnamed",
9630
+ refund: "creditLogActionRefundUnnamed"
9631
+ };
9632
+ var WHO_KEY = {
9633
+ autoTopup: "creditLogWhoAutoTopup",
9634
+ manual: "creditLogWhoManual",
9635
+ plan: "creditLogWhoPlan",
9636
+ purchase: "creditLogWhoPurchase"
9637
+ };
9638
+ function CreditLog({
9639
+ className,
9640
+ credits,
9641
+ headingLevel = 2,
9642
+ limit = 3,
9643
+ locale: localeProp,
9644
+ onSeeAll,
9645
+ seeAllTarget,
9646
+ seeAllUrl,
9647
+ showGrants = true,
9648
+ showHeader = true,
9649
+ showUser = true,
9650
+ strings
9651
+ }) {
9652
+ const query = useMemo4(
9653
+ () => ({
9654
+ ...credits === void 0 ? {} : { credits },
9655
+ ...showGrants ? {} : { includeGrants: false }
9656
+ }),
9657
+ [credits, showGrants]
9658
+ );
9659
+ const {
9660
+ data: page,
9661
+ error,
9662
+ isPending,
9663
+ loadMore,
9664
+ refetch
9665
+ } = useCreditLedger(query);
9666
+ const locale = useResolvedLocale(localeProp);
9667
+ const t = useTranslator(strings, localeProp);
9668
+ const [full, setFull] = useState8(false);
9669
+ const log = useMemo4(
9670
+ () => page === void 0 ? void 0 : deriveCreditLog(page, { locale }),
9671
+ [locale, page]
9672
+ );
9673
+ const headingId = useId6();
9674
+ const Heading = `h${headingLevel}`;
9675
+ const rows = log?.rows ?? [];
9676
+ const showCredit = log?.credit === null || !showHeader;
9677
+ const hasMoreRows = rows.length > limit || log?.hasMore === true;
9678
+ const handedOff = onSeeAll !== void 0 || seeAllUrl !== void 0;
9679
+ const label = showHeader ? void 0 : t("creditLogHeader");
9680
+ const labelledBy = showHeader ? headingId : void 0;
9681
+ const unavailable = log === void 0 && httpStatus(error) === 404;
9682
+ const errorMessage = error === void 0 ? void 0 : unavailable ? t("creditLogUnavailable") : t("creditLogError");
9683
+ return /* @__PURE__ */ jsx10(
9684
+ StatusFrame,
9685
+ {
9686
+ className: cx("schematic-card", "schematic-credit-log", className),
9687
+ error,
9688
+ errorMessage,
9689
+ hasData: log !== void 0,
9690
+ isPending,
9691
+ loadingLabel: t("creditLogLoading"),
9692
+ onRetry: refetch,
9693
+ retryText: t("retry"),
9694
+ skeleton: /* @__PURE__ */ jsx10(
9695
+ CreditLogSkeleton,
9696
+ {
9697
+ rows: Math.max(1, Math.min(limit, SKELETON_ROWS)),
9698
+ showHeader
9699
+ }
9700
+ ),
9701
+ children: log !== void 0 && /* @__PURE__ */ jsxs10(Fragment6, { children: [
9702
+ showHeader && /* @__PURE__ */ jsxs10("div", { className: "schematic-header", children: [
9703
+ /* @__PURE__ */ jsx10(Heading, { className: "schematic-header__title", id: headingId, children: t("creditLogHeader") }),
9704
+ log.credit !== null && /* @__PURE__ */ jsx10("span", { className: "schematic-muted schematic-small schematic-credit-log__credit-name", children: log.credit.name })
9705
+ ] }),
9706
+ rows.length === 0 ? /* @__PURE__ */ jsx10("p", { className: "schematic-muted schematic-credit-log__empty", children: t("creditLogEmpty") }) : full ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
9707
+ /* @__PURE__ */ jsx10(
9708
+ "div",
9709
+ {
9710
+ "aria-label": label,
9711
+ "aria-labelledby": labelledBy,
9712
+ className: "schematic-credit-log__scroll",
9713
+ role: "region",
9714
+ tabIndex: 0,
9715
+ children: /* @__PURE__ */ jsxs10(
9716
+ "table",
9717
+ {
9718
+ className: "schematic-small schematic-credit-log__table",
9719
+ "aria-label": label,
9720
+ "aria-labelledby": labelledBy,
9721
+ children: [
9722
+ /* @__PURE__ */ jsx10("thead", { children: /* @__PURE__ */ jsxs10("tr", { className: "schematic-credit-log__heading-row", children: [
9723
+ /* @__PURE__ */ jsx10("th", { className: "schematic-credit-log__heading", scope: "col", children: t("creditLogColumnDate") }),
9724
+ /* @__PURE__ */ jsx10("th", { className: "schematic-credit-log__heading", scope: "col", children: t("creditLogColumnActivity") }),
9725
+ showUser && /* @__PURE__ */ jsx10(
9726
+ "th",
9727
+ {
9728
+ className: "schematic-credit-log__heading",
9729
+ scope: "col",
9730
+ children: t("creditLogColumnBy")
9731
+ }
9732
+ ),
9733
+ showCredit && /* @__PURE__ */ jsx10(
9734
+ "th",
9735
+ {
9736
+ className: "schematic-credit-log__heading",
9737
+ scope: "col",
9738
+ children: t("creditLogColumnCredit")
9739
+ }
9740
+ ),
9741
+ /* @__PURE__ */ jsx10(
9742
+ "th",
9743
+ {
9744
+ className: "schematic-credit-log__heading schematic-credit-log__amount-heading",
9745
+ scope: "col",
9746
+ children: t("creditLogColumnAmount")
9747
+ }
9748
+ )
9749
+ ] }) }),
9750
+ /* @__PURE__ */ jsx10("tbody", { children: rows.map((row) => {
9751
+ const who = whoText(row.who, t);
9752
+ return /* @__PURE__ */ jsxs10(
9753
+ "tr",
9754
+ {
9755
+ className: "schematic-credit-log__table-row",
9756
+ "data-testid": "schematic-credit-log-entry",
9757
+ children: [
9758
+ /* @__PURE__ */ jsx10("td", { className: "schematic-muted schematic-credit-log__cell schematic-credit-log__date", children: /* @__PURE__ */ jsx10(WhenText, { row, t }) }),
9759
+ /* @__PURE__ */ jsx10("td", { className: "schematic-credit-log__cell schematic-credit-log__activity", children: actionText(row, t) }),
9760
+ showUser && /* @__PURE__ */ jsx10(
9761
+ "td",
9762
+ {
9763
+ className: cx(
9764
+ "schematic-muted",
9765
+ "schematic-credit-log__cell",
9766
+ "schematic-credit-log__by",
9767
+ who === void 0 && "schematic-credit-log__by--none"
9768
+ ),
9769
+ children: /* @__PURE__ */ jsx10(Truncated, { text: who ?? "\u2014" })
9770
+ }
9771
+ ),
9772
+ showCredit && /* @__PURE__ */ jsx10("td", { className: "schematic-muted schematic-credit-log__cell schematic-credit-log__credit", children: /* @__PURE__ */ jsx10(Truncated, { text: row.creditName }) }),
9773
+ /* @__PURE__ */ jsx10("td", { className: "schematic-credit-log__cell schematic-credit-log__amount-cell", children: /* @__PURE__ */ jsx10(Amount, { row }) })
9774
+ ]
9775
+ },
9776
+ row.id
9777
+ );
9778
+ }) })
9779
+ ]
9780
+ }
9781
+ )
9782
+ }
9783
+ ),
9784
+ /* @__PURE__ */ jsxs10("div", { className: "schematic-credit-log__actions", children: [
9785
+ /* @__PURE__ */ jsx10(
9786
+ Toggle,
9787
+ {
9788
+ expanded: true,
9789
+ label: t("creditLogSeeLess"),
9790
+ onClick: () => setFull(false)
9791
+ }
9792
+ ),
9793
+ log.hasMore && /* @__PURE__ */ jsx10(
9794
+ "button",
9795
+ {
9796
+ className: "schematic-link-button schematic-credit-log__load-more",
9797
+ disabled: isPending,
9798
+ type: "button",
9799
+ onClick: () => void loadMore(),
9800
+ children: t("creditLogLoadMore")
9801
+ }
9802
+ )
9803
+ ] })
9804
+ ] }) : /* @__PURE__ */ jsxs10(Fragment6, { children: [
9805
+ /* @__PURE__ */ jsx10(
9806
+ "ul",
9807
+ {
9808
+ className: "schematic-credit-log__list",
9809
+ "aria-label": label,
9810
+ "aria-labelledby": labelledBy,
9811
+ children: rows.slice(0, limit).map((row) => {
9812
+ const detail = [
9813
+ whenText(row, t),
9814
+ showUser ? whoText(row.who, t) : void 0,
9815
+ showCredit ? row.creditName : void 0
9816
+ ].filter((part) => part !== void 0 && part !== "");
9817
+ return /* @__PURE__ */ jsxs10(
9818
+ "li",
9819
+ {
9820
+ className: "schematic-credit-log__row",
9821
+ "data-testid": "schematic-credit-log-entry",
9822
+ children: [
9823
+ /* @__PURE__ */ jsxs10("span", { className: "schematic-credit-log__what", children: [
9824
+ /* @__PURE__ */ jsx10("span", { className: "schematic-credit-log__action", children: actionText(row, t) }),
9825
+ /* @__PURE__ */ jsx10("span", { className: "schematic-muted schematic-small schematic-credit-log__detail", children: detail.join(" \xB7 ") })
9826
+ ] }),
9827
+ /* @__PURE__ */ jsx10(Amount, { row })
9828
+ ]
9829
+ },
9830
+ row.id
9831
+ );
9832
+ })
9833
+ }
9834
+ ),
9835
+ hasMoreRows && /* @__PURE__ */ jsx10("div", { className: "schematic-credit-log__actions", children: handedOff ? /* @__PURE__ */ jsx10(
9836
+ SeeAll,
9837
+ {
9838
+ label: t("creditLogSeeAll"),
9839
+ onSeeAll,
9840
+ seeAllTarget,
9841
+ seeAllUrl
9842
+ }
9843
+ ) : /* @__PURE__ */ jsx10(
9844
+ Toggle,
9845
+ {
9846
+ expanded: false,
9847
+ label: t("creditLogSeeMore"),
9848
+ onClick: () => setFull(true)
9849
+ }
9850
+ ) })
9851
+ ] })
9852
+ ] })
9853
+ }
9854
+ );
9855
+ }
9856
+ function Toggle({
9857
+ expanded,
9858
+ label,
9859
+ onClick
9860
+ }) {
9861
+ return /* @__PURE__ */ jsxs10(
9862
+ "button",
9863
+ {
9864
+ "aria-expanded": expanded,
9865
+ className: "schematic-link-button schematic-credit-log__toggle",
9866
+ type: "button",
9867
+ onClick,
9868
+ children: [
9869
+ /* @__PURE__ */ jsx10(
9870
+ "i",
9871
+ {
9872
+ "aria-hidden": "true",
9873
+ className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9874
+ }
9875
+ ),
9876
+ /* @__PURE__ */ jsx10("span", { className: "schematic-link-button__label", children: label })
9877
+ ]
9878
+ }
9879
+ );
9880
+ }
9881
+ function SeeAll({
9882
+ label,
9883
+ onSeeAll,
9884
+ seeAllTarget,
9885
+ seeAllUrl
9886
+ }) {
9887
+ if (onSeeAll === void 0) {
9888
+ return /* @__PURE__ */ jsx10(
9889
+ "a",
9890
+ {
9891
+ className: "schematic-link-button schematic-credit-log__see-all-link",
9892
+ href: seeAllUrl,
9893
+ rel: seeAllTarget === "_blank" ? "noreferrer" : void 0,
9894
+ target: seeAllTarget,
9895
+ children: label
9896
+ }
9897
+ );
9898
+ }
9899
+ return /* @__PURE__ */ jsx10(
9900
+ "button",
9901
+ {
9902
+ className: "schematic-link-button schematic-credit-log__see-all-button",
9903
+ type: "button",
9904
+ onClick: onSeeAll,
9905
+ children: label
9906
+ }
9907
+ );
9908
+ }
9909
+ function Truncated({ text }) {
9910
+ return /* @__PURE__ */ jsx10("span", { className: "schematic-credit-log__truncate", title: text, children: text });
9911
+ }
9912
+ function Amount({ row }) {
9913
+ return /* @__PURE__ */ jsx10(
9914
+ "span",
9915
+ {
9916
+ className: cx(
9917
+ "schematic-credit-log__amount",
9918
+ row.positive && "schematic-credit-log__amount--positive"
9919
+ ),
9920
+ children: `${row.positive ? "+" : "\u2212"}${row.amountText}`
9921
+ }
9922
+ );
9923
+ }
9924
+ function actionText(row, t) {
9925
+ if (row.action === "usage") {
9926
+ return row.subject ?? t("creditLogActionUsage");
9927
+ }
9928
+ const unnamed = UNNAMED_KEY[row.action];
9929
+ if (row.subject === null && unnamed !== void 0) {
9930
+ return t(unnamed);
9931
+ }
9932
+ return t(ACTION_KEY[row.action], {
9933
+ bundle: row.subject,
9934
+ feature: row.subject
9935
+ });
9936
+ }
9937
+ function whenText(row, t) {
9938
+ if (row.day === "today") {
9939
+ return t("creditLogToday", { time: row.whenText });
9940
+ }
9941
+ if (row.day === "yesterday") {
9942
+ return t("creditLogYesterday", { time: row.whenText });
9943
+ }
9944
+ return row.whenText;
9945
+ }
9946
+ function WhenText({ row, t }) {
9947
+ const text = whenText(row, t);
9948
+ const at = row.timeText === "" ? -1 : text.lastIndexOf(row.timeText);
9949
+ if (at <= 0) {
9950
+ return /* @__PURE__ */ jsx10("span", { className: "schematic-credit-log__when", children: text });
9951
+ }
9952
+ const day = text.slice(0, at);
9953
+ return /* @__PURE__ */ jsxs10(Fragment6, { children: [
9954
+ /* @__PURE__ */ jsx10("span", { className: "schematic-credit-log__when", children: day.trimEnd() }),
9955
+ day.slice(day.trimEnd().length) || "\u200B",
9956
+ /* @__PURE__ */ jsx10("span", { className: "schematic-credit-log__when", children: text.slice(at) })
9957
+ ] });
9958
+ }
9959
+ function whoText(who, t) {
9960
+ if (who === null) {
9961
+ return void 0;
9962
+ }
9963
+ return who.kind === "user" ? who.name : t(WHO_KEY[who.kind]);
9964
+ }
9965
+ function CreditLogSkeleton({
9966
+ rows,
9967
+ showHeader
9968
+ }) {
9969
+ return /* @__PURE__ */ jsxs10("div", { className: "schematic-skeleton", children: [
9970
+ showHeader && /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__heading" }),
9971
+ Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsxs10("div", { className: "schematic-skeleton__row", children: [
9972
+ /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__cell", "data-column": "action" }),
9973
+ /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__cell", "data-column": "amount" })
9974
+ ] }, row))
9975
+ ] });
9976
+ }
9977
+ CreditLog.resources = ["creditLedger"];
9978
+
9243
9979
  // src/elements/CreditUsage.tsx
9244
9980
  import {
9245
9981
  useCreditBalances,
9246
9982
  useCreditUserUsage
9247
9983
  } from "@schematichq/schematic-react";
9248
- import { useMemo as useMemo5, useState as useState9 } from "react";
9984
+ import { useMemo as useMemo6, useState as useState10 } from "react";
9249
9985
 
9250
9986
  // src/elements/usage.tsx
9251
- import { useMemo as useMemo4, useState as useState8 } from "react";
9252
- import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
9987
+ import { useMemo as useMemo5, useState as useState9 } from "react";
9988
+ import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
9253
9989
  var COLLAPSED_USER_COUNT = 3;
9254
9990
  var EXPANDED_USER_COUNT = 20;
9255
9991
  function shortPeriod(period, t) {
@@ -9275,16 +10011,16 @@ function PriceTiers({
9275
10011
  }) {
9276
10012
  const perPeriod2 = period === null ? void 0 : shortPeriod(period, t);
9277
10013
  const money = (amount) => formatCurrency(amount, currency, locale);
9278
- const perUnit = (amount) => /* @__PURE__ */ jsxs10(Fragment6, { children: [
10014
+ const perUnit = (amount) => /* @__PURE__ */ jsxs11(Fragment7, { children: [
9279
10015
  money(amount),
9280
- /* @__PURE__ */ jsxs10("sub", { children: [
10016
+ /* @__PURE__ */ jsxs11("sub", { children: [
9281
10017
  "/",
9282
10018
  unit
9283
10019
  ] })
9284
10020
  ] });
9285
- const flat = (amount) => /* @__PURE__ */ jsxs10(Fragment6, { children: [
10021
+ const flat = (amount) => /* @__PURE__ */ jsxs11(Fragment7, { children: [
9286
10022
  money(amount),
9287
- perPeriod2 !== void 0 && /* @__PURE__ */ jsxs10("sub", { children: [
10023
+ perPeriod2 !== void 0 && /* @__PURE__ */ jsxs11("sub", { children: [
9288
10024
  "/",
9289
10025
  perPeriod2
9290
10026
  ] })
@@ -9296,21 +10032,21 @@ function PriceTiers({
9296
10032
  if (flatPrice !== 0 && perUnitPrice === 0) {
9297
10033
  return flat(flatPrice);
9298
10034
  }
9299
- return /* @__PURE__ */ jsxs10(Fragment6, { children: [
10035
+ return /* @__PURE__ */ jsxs11(Fragment7, { children: [
9300
10036
  perUnit(perUnitPrice),
9301
10037
  " + ",
9302
10038
  flat(flatPrice)
9303
10039
  ] });
9304
10040
  };
9305
- return /* @__PURE__ */ jsxs10("span", { className: "schematic-tiers", children: [
9306
- /* @__PURE__ */ jsx10("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ jsxs10("div", { className: "schematic-tiers__tier", children: [
9307
- /* @__PURE__ */ jsxs10("dt", { className: "schematic-tiers__range", children: [
10041
+ return /* @__PURE__ */ jsxs11("span", { className: "schematic-tiers", children: [
10042
+ /* @__PURE__ */ jsx11("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ jsxs11("div", { className: "schematic-tiers__tier", children: [
10043
+ /* @__PURE__ */ jsxs11("dt", { className: "schematic-tiers__range", children: [
9308
10044
  formatNumber(tier.from, locale),
9309
10045
  tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${formatNumber(tier.to, locale)}` : ""
9310
10046
  ] }),
9311
- /* @__PURE__ */ jsx10("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
10047
+ /* @__PURE__ */ jsx11("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
9312
10048
  ] }, tier.from)) }),
9313
- mode !== null && /* @__PURE__ */ jsx10("span", { className: "schematic-tiers__mode", children: mode === "volume" ? t("usageTiersVolume") : t("usageTiersGraduated") })
10049
+ mode !== null && /* @__PURE__ */ jsx11("span", { className: "schematic-tiers__mode", children: mode === "volume" ? t("usageTiersVolume") : t("usageTiersGraduated") })
9314
10050
  ] });
9315
10051
  }
9316
10052
  function UserBreakdown({
@@ -9322,17 +10058,17 @@ function UserBreakdown({
9322
10058
  t,
9323
10059
  unit
9324
10060
  }) {
9325
- const [expanded, setExpanded] = useState8(false);
9326
- const users = useMemo4(
10061
+ const [expanded, setExpanded] = useState9(false);
10062
+ const users = useMemo5(
9327
10063
  () => [...breakdown?.users ?? []].sort((a, b) => b.amount - a.amount),
9328
10064
  [breakdown?.users]
9329
10065
  );
9330
10066
  const amount = (value) => `${formatAmount?.(value) ?? formatNumber(value, locale)} ${featureName(unit, value, locale)}`;
9331
10067
  if (breakdown === void 0 && error !== void 0) {
9332
- return /* @__PURE__ */ jsxs10("div", { className: "schematic-usage-by-user", role: "alert", children: [
9333
- /* @__PURE__ */ jsx10("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9334
- /* @__PURE__ */ jsx10("span", { className: "schematic-error", children: t("usageByUserError") }),
9335
- /* @__PURE__ */ jsx10(
10068
+ return /* @__PURE__ */ jsxs11("div", { className: "schematic-usage-by-user", role: "alert", children: [
10069
+ /* @__PURE__ */ jsx11("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
10070
+ /* @__PURE__ */ jsx11("span", { className: "schematic-error", children: t("usageByUserError") }),
10071
+ /* @__PURE__ */ jsx11(
9336
10072
  "button",
9337
10073
  {
9338
10074
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-status__retry",
@@ -9363,9 +10099,9 @@ function UserBreakdown({
9363
10099
  count: breakdown.count,
9364
10100
  shown: formatNumber(breakdown.count, locale)
9365
10101
  }) : t("usageByUserShowAll");
9366
- const user = (key, label, value, muted = false) => /* @__PURE__ */ jsxs10("li", { className: "schematic-usage-by-user__user", children: [
9367
- /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "schematic-usage-by-user__avatar", children: muted ? "?" : (label.trim()[0] ?? "?").toUpperCase() }),
9368
- /* @__PURE__ */ jsx10(
10102
+ const user = (key, label, value, muted = false) => /* @__PURE__ */ jsxs11("li", { className: "schematic-usage-by-user__user", children: [
10103
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "schematic-usage-by-user__avatar", children: muted ? "?" : (label.trim()[0] ?? "?").toUpperCase() }),
10104
+ /* @__PURE__ */ jsx11(
9369
10105
  "span",
9370
10106
  {
9371
10107
  className: cx(
@@ -9375,12 +10111,12 @@ function UserBreakdown({
9375
10111
  children: label
9376
10112
  }
9377
10113
  ),
9378
- /* @__PURE__ */ jsx10("span", { className: "schematic-muted schematic-usage-by-user__amount", children: amount(value) })
10114
+ /* @__PURE__ */ jsx11("span", { className: "schematic-muted schematic-usage-by-user__amount", children: amount(value) })
9379
10115
  ] }, key);
9380
- return /* @__PURE__ */ jsxs10("div", { className: "schematic-usage-by-user", children: [
9381
- /* @__PURE__ */ jsx10("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9382
- /* @__PURE__ */ jsx10("span", { className: "schematic-muted", children: t("usageByUserTotal", { amount: amount(breakdown.total) }) }),
9383
- /* @__PURE__ */ jsxs10("ul", { className: "schematic-usage-by-user__list", children: [
10116
+ return /* @__PURE__ */ jsxs11("div", { className: "schematic-usage-by-user", children: [
10117
+ /* @__PURE__ */ jsx11("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
10118
+ /* @__PURE__ */ jsx11("span", { className: "schematic-muted", children: t("usageByUserTotal", { amount: amount(breakdown.total) }) }),
10119
+ /* @__PURE__ */ jsxs11("ul", { className: "schematic-usage-by-user__list", children: [
9384
10120
  visible.map((entry) => user(entry.id, entry.label, entry.amount)),
9385
10121
  expanded && unattributed !== null && user(
9386
10122
  "unattributed",
@@ -9389,11 +10125,11 @@ function UserBreakdown({
9389
10125
  true
9390
10126
  )
9391
10127
  ] }),
9392
- expanded && remaining > 0 && /* @__PURE__ */ jsx10("span", { className: "schematic-muted", children: t("usageByUserMore", {
10128
+ expanded && remaining > 0 && /* @__PURE__ */ jsx11("span", { className: "schematic-muted", children: t("usageByUserMore", {
9393
10129
  count: remaining,
9394
10130
  shown: formatNumber(remaining, locale)
9395
10131
  }) }),
9396
- (hidden > 0 || unattributed !== null) && /* @__PURE__ */ jsxs10(
10132
+ (hidden > 0 || unattributed !== null) && /* @__PURE__ */ jsxs11(
9397
10133
  "button",
9398
10134
  {
9399
10135
  "aria-expanded": expanded,
@@ -9401,14 +10137,14 @@ function UserBreakdown({
9401
10137
  type: "button",
9402
10138
  onClick: () => setExpanded((value) => !value),
9403
10139
  children: [
9404
- /* @__PURE__ */ jsx10(
10140
+ /* @__PURE__ */ jsx11(
9405
10141
  "i",
9406
10142
  {
9407
10143
  "aria-hidden": "true",
9408
10144
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9409
10145
  }
9410
10146
  ),
9411
- /* @__PURE__ */ jsx10("span", { className: "schematic-link-button__label", children: expanded ? t("usageByUserShowFewer") : expandLabel })
10147
+ /* @__PURE__ */ jsx11("span", { className: "schematic-link-button__label", children: expanded ? t("usageByUserShowFewer") : expandLabel })
9412
10148
  ]
9413
10149
  }
9414
10150
  )
@@ -9416,7 +10152,7 @@ function UserBreakdown({
9416
10152
  }
9417
10153
 
9418
10154
  // src/elements/CreditUsage.tsx
9419
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
10155
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
9420
10156
  var VISIBLE_GRANT_COUNT = 3;
9421
10157
  var GRANT_KEY = {
9422
10158
  autoTopup: "creditUsageGrantAutoTopup",
@@ -9443,7 +10179,7 @@ function CreditUsage({
9443
10179
  const { data: balances, error, isPending, refetch } = useCreditBalances();
9444
10180
  const locale = useResolvedLocale(localeProp);
9445
10181
  const t = useTranslator(strings, localeProp);
9446
- const credits = useMemo5(
10182
+ const credits = useMemo6(
9447
10183
  () => balances === void 0 ? [] : deriveCreditUsage(balances, { locale, visibleCredits }),
9448
10184
  [balances, locale, visibleCredits]
9449
10185
  );
@@ -9454,7 +10190,7 @@ function CreditUsage({
9454
10190
  }
9455
10191
  const Heading = `h${headingLevel}`;
9456
10192
  const CreditHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
9457
- return /* @__PURE__ */ jsxs11(
10193
+ return /* @__PURE__ */ jsxs12(
9458
10194
  StatusFrame,
9459
10195
  {
9460
10196
  className: cx("schematic-credit-usage", className),
@@ -9465,25 +10201,25 @@ function CreditUsage({
9465
10201
  loadingLabel: t("creditUsageLoading"),
9466
10202
  onRetry: refetch,
9467
10203
  retryText: t("retry"),
9468
- skeleton: /* @__PURE__ */ jsx11(CreditUsageSkeleton, { showHeader }),
10204
+ skeleton: /* @__PURE__ */ jsx12(CreditUsageSkeleton, { showHeader }),
9469
10205
  children: [
9470
- showHeader && /* @__PURE__ */ jsx11("div", { className: "schematic-header", children: /* @__PURE__ */ jsx11(Heading, { className: "schematic-header__title", children: t("creditUsageHeader") }) }),
9471
- /* @__PURE__ */ jsx11("div", { className: "schematic-credit-usage__credits", children: credits.map((credit) => /* @__PURE__ */ jsxs11(
10206
+ showHeader && /* @__PURE__ */ jsx12("div", { className: "schematic-header", children: /* @__PURE__ */ jsx12(Heading, { className: "schematic-header__title", children: t("creditUsageHeader") }) }),
10207
+ /* @__PURE__ */ jsx12("div", { className: "schematic-credit-usage__credits", children: credits.map((credit) => /* @__PURE__ */ jsxs12(
9472
10208
  "section",
9473
10209
  {
9474
10210
  "aria-label": credit.name,
9475
10211
  className: "schematic-card schematic-credit-usage__credit",
9476
10212
  "data-testid": "schematic-credit",
9477
10213
  children: [
9478
- /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__main", children: [
9479
- showIcon && /* @__PURE__ */ jsx11("span", { className: "schematic-credit-usage__icon", children: credit.icon !== null && /* @__PURE__ */ jsx11(Icon, { name: credit.icon }) }),
9480
- /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__body", children: [
9481
- /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__title", children: [
9482
- /* @__PURE__ */ jsx11(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
9483
- showDescription && credit.description !== null && /* @__PURE__ */ jsx11("p", { className: "schematic-muted", children: credit.description })
10214
+ /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__main", children: [
10215
+ showIcon && /* @__PURE__ */ jsx12("span", { className: "schematic-credit-usage__icon", children: credit.icon !== null && /* @__PURE__ */ jsx12(Icon, { name: credit.icon }) }),
10216
+ /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__body", children: [
10217
+ /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__title", children: [
10218
+ /* @__PURE__ */ jsx12(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
10219
+ showDescription && credit.description !== null && /* @__PURE__ */ jsx12("p", { className: "schematic-muted", children: credit.description })
9484
10220
  ] }),
9485
- /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__balance", children: [
9486
- showUsage && /* @__PURE__ */ jsx11(
10221
+ /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__balance", children: [
10222
+ showUsage && /* @__PURE__ */ jsx12(
9487
10223
  "span",
9488
10224
  {
9489
10225
  className: "schematic-credit-usage__remaining",
@@ -9491,7 +10227,7 @@ function CreditUsage({
9491
10227
  children: t("creditUsageRemaining", credit.remaining)
9492
10228
  }
9493
10229
  ),
9494
- credit.purchasable && /* @__PURE__ */ jsx11(
10230
+ credit.purchasable && /* @__PURE__ */ jsx12(
9495
10231
  BuyMore,
9496
10232
  {
9497
10233
  credit,
@@ -9502,10 +10238,10 @@ function CreditUsage({
9502
10238
  }
9503
10239
  )
9504
10240
  ] }),
9505
- credit.composition !== null && /* @__PURE__ */ jsx11("p", { className: "schematic-muted schematic-small schematic-credit-usage__composition", children: compositionText(credit, t) })
10241
+ credit.composition !== null && /* @__PURE__ */ jsx12("p", { className: "schematic-muted schematic-small schematic-credit-usage__composition", children: compositionText(credit, t) })
9506
10242
  ] })
9507
10243
  ] }),
9508
- credit.ledger.length > 0 && /* @__PURE__ */ jsx11(
10244
+ credit.ledger.length > 0 && /* @__PURE__ */ jsx12(
9509
10245
  Ledger,
9510
10246
  {
9511
10247
  credit,
@@ -9514,7 +10250,7 @@ function CreditUsage({
9514
10250
  t
9515
10251
  }
9516
10252
  ),
9517
- showUsageByUser && credit.ledger.length > 0 && /* @__PURE__ */ jsx11(CreditUserBreakdown, { credit, locale, t })
10253
+ showUsageByUser && credit.ledger.length > 0 && /* @__PURE__ */ jsx12(CreditUserBreakdown, { credit, locale, t })
9518
10254
  ]
9519
10255
  },
9520
10256
  credit.creditId
@@ -9548,28 +10284,28 @@ function Ledger({
9548
10284
  showExpiration,
9549
10285
  t
9550
10286
  }) {
9551
- const [open, setOpen] = useState9(false);
9552
- const [all, setAll] = useState9(false);
10287
+ const [open, setOpen] = useState10(false);
10288
+ const [all, setAll] = useState10(false);
9553
10289
  const rows = all ? credit.ledger : credit.ledger.slice(0, VISIBLE_GRANT_COUNT);
9554
- return /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__ledger", children: [
9555
- open && /* @__PURE__ */ jsxs11("div", { className: "schematic-credit-usage__grants", children: [
9556
- /* @__PURE__ */ jsx11("ul", { className: "schematic-credit-usage__grant-list", children: rows.map((row) => /* @__PURE__ */ jsxs11(
10290
+ return /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__ledger", children: [
10291
+ open && /* @__PURE__ */ jsxs12("div", { className: "schematic-credit-usage__grants", children: [
10292
+ /* @__PURE__ */ jsx12("ul", { className: "schematic-credit-usage__grant-list", children: rows.map((row) => /* @__PURE__ */ jsxs12(
9557
10293
  "li",
9558
10294
  {
9559
10295
  className: "schematic-credit-usage__grant",
9560
10296
  "data-testid": "schematic-credit-grant",
9561
10297
  children: [
9562
- /* @__PURE__ */ jsx11("span", { className: "schematic-credit-usage__grant-text", children: t(GRANT_KEY[row.kind], {
10298
+ /* @__PURE__ */ jsx12("span", { className: "schematic-credit-usage__grant-text", children: t(GRANT_KEY[row.kind], {
9563
10299
  amount: row.amount,
9564
10300
  createdAt: row.createdAt,
9565
10301
  item: row.item
9566
10302
  }) }),
9567
- showExpiration && row.date !== null && /* @__PURE__ */ jsx11("span", { className: "schematic-credit-usage__grant-date", children: row.date.kind === "resets" ? t("creditUsageResets", { date: row.date.text }) : t("creditUsageExpires", { date: row.date.text }) })
10303
+ showExpiration && row.date !== null && /* @__PURE__ */ jsx12("span", { className: "schematic-credit-usage__grant-date", children: row.date.kind === "resets" ? t("creditUsageResets", { date: row.date.text }) : t("creditUsageExpires", { date: row.date.text }) })
9568
10304
  ]
9569
10305
  },
9570
10306
  row.id
9571
10307
  )) }),
9572
- credit.ledger.length > VISIBLE_GRANT_COUNT && /* @__PURE__ */ jsxs11(
10308
+ credit.ledger.length > VISIBLE_GRANT_COUNT && /* @__PURE__ */ jsxs12(
9573
10309
  "button",
9574
10310
  {
9575
10311
  "aria-expanded": all,
@@ -9577,21 +10313,21 @@ function Ledger({
9577
10313
  type: "button",
9578
10314
  onClick: () => setAll((value) => !value),
9579
10315
  children: [
9580
- /* @__PURE__ */ jsx11(
10316
+ /* @__PURE__ */ jsx12(
9581
10317
  "i",
9582
10318
  {
9583
10319
  "aria-hidden": "true",
9584
10320
  className: `schematic-icon schematic-icon--${all ? "chevron-up" : "chevron-down"} schematic-chevron`
9585
10321
  }
9586
10322
  ),
9587
- /* @__PURE__ */ jsx11("span", { className: "schematic-link-button__label", children: all ? t("creditUsageHideAll") : t("creditUsageSeeAll", {
10323
+ /* @__PURE__ */ jsx12("span", { className: "schematic-link-button__label", children: all ? t("creditUsageHideAll") : t("creditUsageSeeAll", {
9588
10324
  total: formatNumber(credit.ledger.length, locale)
9589
10325
  }) })
9590
10326
  ]
9591
10327
  }
9592
10328
  )
9593
10329
  ] }),
9594
- /* @__PURE__ */ jsxs11(
10330
+ /* @__PURE__ */ jsxs12(
9595
10331
  "button",
9596
10332
  {
9597
10333
  "aria-expanded": open,
@@ -9602,14 +10338,14 @@ function Ledger({
9602
10338
  setAll(false);
9603
10339
  },
9604
10340
  children: [
9605
- /* @__PURE__ */ jsx11(
10341
+ /* @__PURE__ */ jsx12(
9606
10342
  "i",
9607
10343
  {
9608
10344
  "aria-hidden": "true",
9609
10345
  className: `schematic-icon schematic-icon--${open ? "chevron-up" : "chevron-down"} schematic-chevron`
9610
10346
  }
9611
10347
  ),
9612
- /* @__PURE__ */ jsx11("span", { className: "schematic-link-button__label", children: open ? t("creditUsageHideDetails") : t("creditUsageSeeDetails") })
10348
+ /* @__PURE__ */ jsx12("span", { className: "schematic-link-button__label", children: open ? t("creditUsageHideDetails") : t("creditUsageSeeDetails") })
9613
10349
  ]
9614
10350
  }
9615
10351
  )
@@ -9623,7 +10359,7 @@ function BuyMore({
9623
10359
  url
9624
10360
  }) {
9625
10361
  if (onBuyMore !== void 0) {
9626
- return /* @__PURE__ */ jsx11(
10362
+ return /* @__PURE__ */ jsx12(
9627
10363
  "button",
9628
10364
  {
9629
10365
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9634,7 +10370,7 @@ function BuyMore({
9634
10370
  );
9635
10371
  }
9636
10372
  if (url !== void 0) {
9637
- return /* @__PURE__ */ jsx11(
10373
+ return /* @__PURE__ */ jsx12(
9638
10374
  "a",
9639
10375
  {
9640
10376
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9652,7 +10388,7 @@ function CreditUserBreakdown({
9652
10388
  t
9653
10389
  }) {
9654
10390
  const { data, error, refetch } = useCreditUserUsage(credit.creditId);
9655
- return /* @__PURE__ */ jsx11(
10391
+ return /* @__PURE__ */ jsx12(
9656
10392
  UserBreakdown,
9657
10393
  {
9658
10394
  breakdown: data === void 0 ? void 0 : {
@@ -9675,11 +10411,11 @@ function CreditUserBreakdown({
9675
10411
  );
9676
10412
  }
9677
10413
  function CreditUsageSkeleton({ showHeader }) {
9678
- return /* @__PURE__ */ jsxs11("div", { className: "schematic-skeleton", children: [
9679
- showHeader && /* @__PURE__ */ jsx11("div", { className: "schematic-skeleton__heading" }),
9680
- [0, 1].map((index) => /* @__PURE__ */ jsxs11("div", { className: "schematic-skeleton__row", children: [
9681
- /* @__PURE__ */ jsx11("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9682
- /* @__PURE__ */ jsx11("div", { className: "schematic-skeleton__cell", "data-column": "remaining" })
10414
+ return /* @__PURE__ */ jsxs12("div", { className: "schematic-skeleton", children: [
10415
+ showHeader && /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__heading" }),
10416
+ [0, 1].map((index) => /* @__PURE__ */ jsxs12("div", { className: "schematic-skeleton__row", children: [
10417
+ /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10418
+ /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__cell", "data-column": "remaining" })
9683
10419
  ] }, index))
9684
10420
  ] });
9685
10421
  }
@@ -9687,8 +10423,8 @@ CreditUsage.resources = ["creditBalances"];
9687
10423
 
9688
10424
  // src/elements/IncludedFeatures.tsx
9689
10425
  import { useFeatureUsage as useFeatureUsage2 } from "@schematichq/schematic-react";
9690
- import { useMemo as useMemo6, useState as useState10 } from "react";
9691
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
10426
+ import { useMemo as useMemo7, useState as useState11 } from "react";
10427
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
9692
10428
  var VISIBLE_FEATURE_COUNT = 4;
9693
10429
  function IncludedFeatures({
9694
10430
  className,
@@ -9709,8 +10445,8 @@ function IncludedFeatures({
9709
10445
  const { data: features, error, isPending, refetch } = useFeatureUsage2();
9710
10446
  const locale = useResolvedLocale(localeProp);
9711
10447
  const t = useTranslator(strings, localeProp);
9712
- const [expanded, setExpanded] = useState10(false);
9713
- const rows = useMemo6(
10448
+ const [expanded, setExpanded] = useState11(false);
10449
+ const rows = useMemo7(
9714
10450
  () => features === void 0 ? [] : deriveIncludedFeatures(features, {
9715
10451
  locale,
9716
10452
  showCredits,
@@ -9730,7 +10466,7 @@ function IncludedFeatures({
9730
10466
  const shown = canExpand && !expanded ? rows.slice(0, VISIBLE_FEATURE_COUNT) : rows;
9731
10467
  const unavailable = features === void 0 && httpStatus(error) === 404;
9732
10468
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("includedFeaturesUnavailable") : t("includedFeaturesError");
9733
- return /* @__PURE__ */ jsxs12(
10469
+ return /* @__PURE__ */ jsxs13(
9734
10470
  StatusFrame,
9735
10471
  {
9736
10472
  className: cx("schematic-card", "schematic-included-features", className),
@@ -9741,26 +10477,26 @@ function IncludedFeatures({
9741
10477
  loadingLabel: t("includedFeaturesLoading"),
9742
10478
  onRetry: refetch,
9743
10479
  retryText: t("retry"),
9744
- skeleton: /* @__PURE__ */ jsx12(IncludedFeaturesSkeleton, { showHeader }),
10480
+ skeleton: /* @__PURE__ */ jsx13(IncludedFeaturesSkeleton, { showHeader }),
9745
10481
  children: [
9746
- showHeader && /* @__PURE__ */ jsx12("div", { className: "schematic-header", children: /* @__PURE__ */ jsx12(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
9747
- /* @__PURE__ */ jsx12("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ jsxs12(
10482
+ showHeader && /* @__PURE__ */ jsx13("div", { className: "schematic-header", children: /* @__PURE__ */ jsx13(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
10483
+ /* @__PURE__ */ jsx13("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ jsxs13(
9748
10484
  "li",
9749
10485
  {
9750
10486
  className: "schematic-included-features__row",
9751
10487
  "data-testid": "schematic-included-feature",
9752
10488
  children: [
9753
- showIcon && row.icon !== null && /* @__PURE__ */ jsx12(
10489
+ showIcon && row.icon !== null && /* @__PURE__ */ jsx13(
9754
10490
  Icon,
9755
10491
  {
9756
10492
  className: "schematic-included-features__icon",
9757
10493
  name: row.icon
9758
10494
  }
9759
10495
  ),
9760
- /* @__PURE__ */ jsxs12("div", { className: "schematic-included-features__details", children: [
9761
- /* @__PURE__ */ jsx12("span", { className: "schematic-included-features__name", children: row.name }),
9762
- showDescription && row.description !== null && /* @__PURE__ */ jsx12("span", { className: "schematic-muted schematic-small", children: row.description }),
9763
- row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ jsx12(
10496
+ /* @__PURE__ */ jsxs13("div", { className: "schematic-included-features__details", children: [
10497
+ /* @__PURE__ */ jsx13("span", { className: "schematic-included-features__name", children: row.name }),
10498
+ showDescription && row.description !== null && /* @__PURE__ */ jsx13("span", { className: "schematic-muted schematic-small", children: row.description }),
10499
+ row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ jsx13(
9764
10500
  "span",
9765
10501
  {
9766
10502
  className: "schematic-muted schematic-small",
@@ -9772,9 +10508,9 @@ function IncludedFeatures({
9772
10508
  },
9773
10509
  `${credits.creditName}-${index}`
9774
10510
  )),
9775
- showExpiration && row.expiresAt !== null && /* @__PURE__ */ jsx12("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
10511
+ showExpiration && row.expiresAt !== null && /* @__PURE__ */ jsx13("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
9776
10512
  ] }),
9777
- /* @__PURE__ */ jsx12(
10513
+ /* @__PURE__ */ jsx13(
9778
10514
  UsageDetails,
9779
10515
  {
9780
10516
  row,
@@ -9789,7 +10525,7 @@ function IncludedFeatures({
9789
10525
  },
9790
10526
  row.featureId
9791
10527
  )) }),
9792
- canExpand && /* @__PURE__ */ jsxs12(
10528
+ canExpand && /* @__PURE__ */ jsxs13(
9793
10529
  "button",
9794
10530
  {
9795
10531
  "aria-expanded": expanded,
@@ -9797,14 +10533,14 @@ function IncludedFeatures({
9797
10533
  type: "button",
9798
10534
  onClick: () => setExpanded((value) => !value),
9799
10535
  children: [
9800
- /* @__PURE__ */ jsx12(
10536
+ /* @__PURE__ */ jsx13(
9801
10537
  "i",
9802
10538
  {
9803
10539
  "aria-hidden": "true",
9804
10540
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9805
10541
  }
9806
10542
  ),
9807
- /* @__PURE__ */ jsx12("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
10543
+ /* @__PURE__ */ jsx13("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
9808
10544
  ]
9809
10545
  }
9810
10546
  )
@@ -9824,17 +10560,17 @@ function UsageDetails({
9824
10560
  if (row.entitlement === null && usage === null) {
9825
10561
  return null;
9826
10562
  }
9827
- return /* @__PURE__ */ jsxs12("div", { className: "schematic-included-features__usage", children: [
9828
- showEntitlement && row.entitlement !== null && /* @__PURE__ */ jsxs12("span", { className: "schematic-included-features__entitlement", children: [
10563
+ return /* @__PURE__ */ jsxs13("div", { className: "schematic-included-features__usage", children: [
10564
+ showEntitlement && row.entitlement !== null && /* @__PURE__ */ jsxs13("span", { className: "schematic-included-features__entitlement", children: [
9829
10565
  entitlementText2(row.entitlement, t),
9830
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx12(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10566
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx13(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
9831
10567
  amount: row.hardLimit.amount,
9832
10568
  units: row.hardLimit.units
9833
10569
  }) })
9834
10570
  ] }),
9835
- showUsage && usage !== null && /* @__PURE__ */ jsxs12("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
10571
+ showUsage && usage !== null && /* @__PURE__ */ jsxs13("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
9836
10572
  usage,
9837
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx12(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx12(
10573
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx13(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx13(
9838
10574
  PriceTiers,
9839
10575
  {
9840
10576
  currency: row.tiers.currency,
@@ -9909,11 +10645,11 @@ function segmentText(segment, t) {
9909
10645
  }
9910
10646
  }
9911
10647
  function IncludedFeaturesSkeleton({ showHeader }) {
9912
- return /* @__PURE__ */ jsxs12("div", { className: "schematic-skeleton", children: [
9913
- showHeader && /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__heading" }),
9914
- [0, 1, 2].map((index) => /* @__PURE__ */ jsxs12("div", { className: "schematic-skeleton__row", children: [
9915
- /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9916
- /* @__PURE__ */ jsx12("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
10648
+ return /* @__PURE__ */ jsxs13("div", { className: "schematic-skeleton", children: [
10649
+ showHeader && /* @__PURE__ */ jsx13("div", { className: "schematic-skeleton__heading" }),
10650
+ [0, 1, 2].map((index) => /* @__PURE__ */ jsxs13("div", { className: "schematic-skeleton__row", children: [
10651
+ /* @__PURE__ */ jsx13("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10652
+ /* @__PURE__ */ jsx13("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
9917
10653
  ] }, index))
9918
10654
  ] });
9919
10655
  }
@@ -9921,7 +10657,7 @@ IncludedFeatures.resources = ["featureUsage"];
9921
10657
 
9922
10658
  // src/elements/Invoices.tsx
9923
10659
  import { useInvoices } from "@schematichq/schematic-react";
9924
- import { useId as useId6, useMemo as useMemo7, useState as useState11 } from "react";
10660
+ import { useId as useId7, useMemo as useMemo8, useState as useState12 } from "react";
9925
10661
 
9926
10662
  // src/utils/invoiceLink.ts
9927
10663
  function openInvoiceLink(event, storedUrl, fetchUrl) {
@@ -9943,8 +10679,8 @@ function openInvoiceLink(event, storedUrl, fetchUrl) {
9943
10679
  }
9944
10680
 
9945
10681
  // src/elements/Invoices.tsx
9946
- import { Fragment as Fragment7, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
9947
- var SKELETON_ROWS = 4;
10682
+ import { Fragment as Fragment8, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
10683
+ var SKELETON_ROWS2 = 4;
9948
10684
  function Invoices({
9949
10685
  className,
9950
10686
  collapsible = true,
@@ -9967,12 +10703,12 @@ function Invoices({
9967
10703
  } = useInvoices(query);
9968
10704
  const locale = useResolvedLocale(localeProp);
9969
10705
  const t = useTranslator(strings, localeProp);
9970
- const [expanded, setExpanded] = useState11(false);
9971
- const list = useMemo7(
10706
+ const [expanded, setExpanded] = useState12(false);
10707
+ const list = useMemo8(
9972
10708
  () => page === void 0 ? void 0 : deriveInvoiceList(page, { locale }),
9973
10709
  [locale, page]
9974
10710
  );
9975
- const headingId = useId6();
10711
+ const headingId = useId7();
9976
10712
  const rows = list?.rows ?? [];
9977
10713
  const canCollapse = collapsible && rows.length > limit;
9978
10714
  const showingAll = !canCollapse || expanded;
@@ -9984,7 +10720,7 @@ function Invoices({
9984
10720
  );
9985
10721
  const unavailable = list === void 0 && httpStatus(error) === 404;
9986
10722
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("invoicesUnavailable") : t("invoicesError");
9987
- return /* @__PURE__ */ jsx13(
10723
+ return /* @__PURE__ */ jsx14(
9988
10724
  StatusFrame,
9989
10725
  {
9990
10726
  className: cx("schematic-card", "schematic-invoices", className),
@@ -9995,30 +10731,30 @@ function Invoices({
9995
10731
  loadingLabel: t("invoicesLoading"),
9996
10732
  onRetry: refetch,
9997
10733
  retryText: t("retry"),
9998
- skeleton: /* @__PURE__ */ jsx13(
10734
+ skeleton: /* @__PURE__ */ jsx14(
9999
10735
  InvoicesSkeleton,
10000
10736
  {
10001
10737
  columns: columns2,
10002
- rows: Math.max(1, Math.min(limit, SKELETON_ROWS)),
10738
+ rows: Math.max(1, Math.min(limit, SKELETON_ROWS2)),
10003
10739
  showHeader
10004
10740
  }
10005
10741
  ),
10006
- children: list !== void 0 && /* @__PURE__ */ jsxs13(Fragment7, { children: [
10007
- showHeader && /* @__PURE__ */ jsx13("div", { className: "schematic-header", children: /* @__PURE__ */ jsx13(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
10008
- rows.length === 0 ? /* @__PURE__ */ jsx13("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ jsx13(
10742
+ children: list !== void 0 && /* @__PURE__ */ jsxs14(Fragment8, { children: [
10743
+ showHeader && /* @__PURE__ */ jsx14("div", { className: "schematic-header", children: /* @__PURE__ */ jsx14(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
10744
+ rows.length === 0 ? /* @__PURE__ */ jsx14("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ jsx14(
10009
10745
  "ul",
10010
10746
  {
10011
10747
  className: "schematic-invoices__list",
10012
10748
  "aria-label": showHeader ? void 0 : t("invoicesHeader"),
10013
10749
  "aria-labelledby": showHeader ? headingId : void 0,
10014
- children: visible.map((row) => /* @__PURE__ */ jsxs13(
10750
+ children: visible.map((row) => /* @__PURE__ */ jsxs14(
10015
10751
  "li",
10016
10752
  {
10017
10753
  className: "schematic-invoices__row",
10018
10754
  "data-testid": "schematic-invoice",
10019
10755
  children: [
10020
- showDate && /* @__PURE__ */ jsx13("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ jsx13(InvoiceDate, { row, t, fetchLink }) }),
10021
- showAmount && /* @__PURE__ */ jsx13(
10756
+ showDate && /* @__PURE__ */ jsx14("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ jsx14(InvoiceDate, { row, t, fetchLink }) }),
10757
+ showAmount && /* @__PURE__ */ jsx14(
10022
10758
  "span",
10023
10759
  {
10024
10760
  className: cx(
@@ -10035,8 +10771,8 @@ function Invoices({
10035
10771
  ))
10036
10772
  }
10037
10773
  ),
10038
- (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ jsxs13("div", { className: "schematic-invoices__actions", children: [
10039
- canCollapse && /* @__PURE__ */ jsxs13(
10774
+ (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ jsxs14("div", { className: "schematic-invoices__actions", children: [
10775
+ canCollapse && /* @__PURE__ */ jsxs14(
10040
10776
  "button",
10041
10777
  {
10042
10778
  "aria-expanded": expanded,
@@ -10044,7 +10780,7 @@ function Invoices({
10044
10780
  type: "button",
10045
10781
  onClick: () => setExpanded((value) => !value),
10046
10782
  children: [
10047
- /* @__PURE__ */ jsx13(
10783
+ /* @__PURE__ */ jsx14(
10048
10784
  "i",
10049
10785
  {
10050
10786
  "aria-hidden": "true",
@@ -10056,11 +10792,11 @@ function Invoices({
10056
10792
  )
10057
10793
  }
10058
10794
  ),
10059
- /* @__PURE__ */ jsx13("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
10795
+ /* @__PURE__ */ jsx14("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
10060
10796
  ]
10061
10797
  }
10062
10798
  ),
10063
- showingAll && list.hasMore && /* @__PURE__ */ jsx13(
10799
+ showingAll && list.hasMore && /* @__PURE__ */ jsx14(
10064
10800
  "button",
10065
10801
  {
10066
10802
  className: "schematic-link-button schematic-invoices__load-more",
@@ -10083,9 +10819,9 @@ function InvoicesSkeleton({
10083
10819
  rows,
10084
10820
  showHeader
10085
10821
  }) {
10086
- return /* @__PURE__ */ jsxs13("div", { className: "schematic-skeleton", children: [
10087
- showHeader && /* @__PURE__ */ jsx13("div", { className: "schematic-skeleton__heading" }),
10088
- Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx13("div", { className: "schematic-skeleton__row", children: columns2.map((column) => /* @__PURE__ */ jsx13(
10822
+ return /* @__PURE__ */ jsxs14("div", { className: "schematic-skeleton", children: [
10823
+ showHeader && /* @__PURE__ */ jsx14("div", { className: "schematic-skeleton__heading" }),
10824
+ Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx14("div", { className: "schematic-skeleton__row", children: columns2.map((column) => /* @__PURE__ */ jsx14(
10089
10825
  "div",
10090
10826
  {
10091
10827
  className: "schematic-skeleton__cell",
@@ -10102,10 +10838,10 @@ function InvoiceDate({
10102
10838
  }) {
10103
10839
  const { url } = row;
10104
10840
  if (url === null) {
10105
- return /* @__PURE__ */ jsx13("span", { className: "schematic-invoices__date-text", children: row.dateText });
10841
+ return /* @__PURE__ */ jsx14("span", { className: "schematic-invoices__date-text", children: row.dateText });
10106
10842
  }
10107
10843
  const label = row.dateText === "" ? t("invoicesUndated") : row.dateText;
10108
- return /* @__PURE__ */ jsx13(
10844
+ return /* @__PURE__ */ jsx14(
10109
10845
  "a",
10110
10846
  {
10111
10847
  className: "schematic-invoices__link",
@@ -10126,8 +10862,8 @@ import {
10126
10862
  useFeatureUsage as useFeatureUsage3,
10127
10863
  useFeatureUserUsage
10128
10864
  } from "@schematichq/schematic-react";
10129
- import { useMemo as useMemo8 } from "react";
10130
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
10865
+ import { useMemo as useMemo9 } from "react";
10866
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
10131
10867
  function MeteredFeatures({
10132
10868
  addMoreTarget,
10133
10869
  addMoreUrl,
@@ -10151,7 +10887,7 @@ function MeteredFeatures({
10151
10887
  const { data: features, error, isPending, refetch } = useFeatureUsage3();
10152
10888
  const locale = useResolvedLocale(localeProp);
10153
10889
  const t = useTranslator(strings, localeProp);
10154
- const rows = useMemo8(
10890
+ const rows = useMemo9(
10155
10891
  () => features === void 0 ? [] : deriveMeteredFeatures(features, {
10156
10892
  locale,
10157
10893
  showCredits,
@@ -10173,7 +10909,7 @@ function MeteredFeatures({
10173
10909
  }
10174
10910
  const Heading = `h${headingLevel}`;
10175
10911
  const NameHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
10176
- return /* @__PURE__ */ jsxs14(
10912
+ return /* @__PURE__ */ jsxs15(
10177
10913
  StatusFrame,
10178
10914
  {
10179
10915
  className: cx("schematic-metered-features", className),
@@ -10184,26 +10920,26 @@ function MeteredFeatures({
10184
10920
  loadingLabel: t("meteredFeaturesLoading"),
10185
10921
  onRetry: refetch,
10186
10922
  retryText: t("retry"),
10187
- skeleton: /* @__PURE__ */ jsx14(MeteredFeaturesSkeleton, { showHeader }),
10923
+ skeleton: /* @__PURE__ */ jsx15(MeteredFeaturesSkeleton, { showHeader }),
10188
10924
  children: [
10189
- showHeader && /* @__PURE__ */ jsx14("div", { className: "schematic-header", children: /* @__PURE__ */ jsx14(Heading, { className: "schematic-header__title", children: t("meteredFeaturesHeader") }) }),
10190
- /* @__PURE__ */ jsx14("ul", { className: "schematic-metered-features__list", children: rows.map((row) => /* @__PURE__ */ jsxs14(
10925
+ showHeader && /* @__PURE__ */ jsx15("div", { className: "schematic-header", children: /* @__PURE__ */ jsx15(Heading, { className: "schematic-header__title", children: t("meteredFeaturesHeader") }) }),
10926
+ /* @__PURE__ */ jsx15("ul", { className: "schematic-metered-features__list", children: rows.map((row) => /* @__PURE__ */ jsxs15(
10191
10927
  "li",
10192
10928
  {
10193
10929
  className: "schematic-card schematic-metered-features__feature",
10194
10930
  "data-testid": "schematic-metered-feature",
10195
10931
  children: [
10196
- /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__main", children: [
10197
- showIcon && /* @__PURE__ */ jsx14("span", { className: "schematic-metered-features__icon", children: row.icon !== null && /* @__PURE__ */ jsx14(Icon, { name: row.icon }) }),
10198
- /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__body", children: [
10199
- /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__top", children: [
10200
- /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__title", children: [
10201
- /* @__PURE__ */ jsx14(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
10202
- showDescription && row.description !== null && /* @__PURE__ */ jsx14("p", { className: "schematic-muted", children: row.description })
10932
+ /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__main", children: [
10933
+ showIcon && /* @__PURE__ */ jsx15("span", { className: "schematic-metered-features__icon", children: row.icon !== null && /* @__PURE__ */ jsx15(Icon, { name: row.icon }) }),
10934
+ /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__body", children: [
10935
+ /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__top", children: [
10936
+ /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__title", children: [
10937
+ /* @__PURE__ */ jsx15(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
10938
+ showDescription && row.description !== null && /* @__PURE__ */ jsx15("p", { className: "schematic-muted", children: row.description })
10203
10939
  ] }),
10204
- /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__figures", children: [
10205
- showUsage && row.headline !== null && /* @__PURE__ */ jsx14("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
10206
- showAllocation && /* @__PURE__ */ jsx14(
10940
+ /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__figures", children: [
10941
+ showUsage && row.headline !== null && /* @__PURE__ */ jsx15("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
10942
+ showAllocation && /* @__PURE__ */ jsx15(
10207
10943
  LimitLine,
10208
10944
  {
10209
10945
  row,
@@ -10213,8 +10949,8 @@ function MeteredFeatures({
10213
10949
  )
10214
10950
  ] })
10215
10951
  ] }),
10216
- showMeter && row.meter !== null && /* @__PURE__ */ jsx14(Meter, { meter: row.meter }),
10217
- row.canAddMore && /* @__PURE__ */ jsx14(
10952
+ showMeter && row.meter !== null && /* @__PURE__ */ jsx15(Meter, { meter: row.meter }),
10953
+ row.canAddMore && /* @__PURE__ */ jsx15(
10218
10954
  AddMore,
10219
10955
  {
10220
10956
  label: t("meteredFeaturesAddMore"),
@@ -10225,8 +10961,8 @@ function MeteredFeatures({
10225
10961
  )
10226
10962
  ] })
10227
10963
  ] }),
10228
- showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ jsx14(UsageByUser, { locale, row, t }),
10229
- row.priceDetails !== null && /* @__PURE__ */ jsx14(
10964
+ showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ jsx15(UsageByUser, { locale, row, t }),
10965
+ row.priceDetails !== null && /* @__PURE__ */ jsx15(
10230
10966
  PriceDetails,
10231
10967
  {
10232
10968
  details: row.priceDetails,
@@ -10290,9 +11026,9 @@ function LimitLine({
10290
11026
  if (parts.length === 0) {
10291
11027
  return null;
10292
11028
  }
10293
- return /* @__PURE__ */ jsxs14("span", { className: "schematic-muted schematic-metered-features__limit", children: [
11029
+ return /* @__PURE__ */ jsxs15("span", { className: "schematic-muted schematic-metered-features__limit", children: [
10294
11030
  parts.join(" \u2022 "),
10295
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx14(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11031
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx15(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10296
11032
  amount: row.hardLimit.amount,
10297
11033
  units: row.hardLimit.units
10298
11034
  }) })
@@ -10306,8 +11042,8 @@ var METER_TONE_CLASS = {
10306
11042
  overage: "schematic-meter--overage"
10307
11043
  };
10308
11044
  function Meter({ meter: meter2 }) {
10309
- return /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__meter", children: [
10310
- /* @__PURE__ */ jsx14(
11045
+ return /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__meter", children: [
11046
+ /* @__PURE__ */ jsx15(
10311
11047
  "div",
10312
11048
  {
10313
11049
  "aria-valuemax": meter2.total,
@@ -10316,7 +11052,7 @@ function Meter({ meter: meter2 }) {
10316
11052
  className: cx("schematic-meter", METER_TONE_CLASS[meter2.tone]),
10317
11053
  "data-tone": meter2.tone,
10318
11054
  role: "meter",
10319
- children: /* @__PURE__ */ jsx14(
11055
+ children: /* @__PURE__ */ jsx15(
10320
11056
  "div",
10321
11057
  {
10322
11058
  className: "schematic-meter__fill",
@@ -10325,7 +11061,7 @@ function Meter({ meter: meter2 }) {
10325
11061
  )
10326
11062
  }
10327
11063
  ),
10328
- meter2.total > 0 && /* @__PURE__ */ jsxs14("span", { className: "schematic-metered-features__meter-label", children: [
11064
+ meter2.total > 0 && /* @__PURE__ */ jsxs15("span", { className: "schematic-metered-features__meter-label", children: [
10329
11065
  meter2.valueText,
10330
11066
  "/",
10331
11067
  meter2.totalText
@@ -10339,7 +11075,7 @@ function AddMore({
10339
11075
  url
10340
11076
  }) {
10341
11077
  if (onAddMore !== void 0) {
10342
- return /* @__PURE__ */ jsx14(
11078
+ return /* @__PURE__ */ jsx15(
10343
11079
  "button",
10344
11080
  {
10345
11081
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10350,7 +11086,7 @@ function AddMore({
10350
11086
  );
10351
11087
  }
10352
11088
  if (url !== void 0) {
10353
- return /* @__PURE__ */ jsx14(
11089
+ return /* @__PURE__ */ jsx15(
10354
11090
  "a",
10355
11091
  {
10356
11092
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10370,38 +11106,38 @@ function PriceDetails({
10370
11106
  }) {
10371
11107
  const period = details.period === null ? void 0 : shortPeriod(details.period, t);
10372
11108
  if (details.kind === "overage") {
10373
- return /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__price-details", children: [
10374
- /* @__PURE__ */ jsxs14("span", { className: "schematic-metered-features__price-label", children: [
11109
+ return /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__price-details", children: [
11110
+ /* @__PURE__ */ jsxs15("span", { className: "schematic-metered-features__price-label", children: [
10375
11111
  t("meteredFeaturesAdditional"),
10376
11112
  ": ",
10377
11113
  details.unitPrice,
10378
- /* @__PURE__ */ jsxs14("sub", { children: [
11114
+ /* @__PURE__ */ jsxs15("sub", { children: [
10379
11115
  "/",
10380
11116
  details.packageSize !== null && `${details.packageSize} `,
10381
11117
  details.units,
10382
11118
  period !== void 0 && `/${period}`
10383
11119
  ] })
10384
11120
  ] }),
10385
- /* @__PURE__ */ jsxs14("span", { className: "schematic-metered-features__price-cost", children: [
11121
+ /* @__PURE__ */ jsxs15("span", { className: "schematic-metered-features__price-cost", children: [
10386
11122
  details.overage.amount,
10387
11123
  " ",
10388
11124
  details.overage.units,
10389
11125
  " \xB7 ",
10390
11126
  details.overage.cost,
10391
- period !== void 0 && /* @__PURE__ */ jsxs14("sub", { children: [
11127
+ period !== void 0 && /* @__PURE__ */ jsxs15("sub", { children: [
10392
11128
  "/",
10393
11129
  period
10394
11130
  ] })
10395
11131
  ] })
10396
11132
  ] });
10397
11133
  }
10398
- return /* @__PURE__ */ jsxs14("div", { className: "schematic-metered-features__price-details", children: [
10399
- /* @__PURE__ */ jsxs14("span", { className: "schematic-metered-features__price-label", children: [
11134
+ return /* @__PURE__ */ jsxs15("div", { className: "schematic-metered-features__price-details", children: [
11135
+ /* @__PURE__ */ jsxs15("span", { className: "schematic-metered-features__price-label", children: [
10400
11136
  t("meteredFeaturesTier"),
10401
11137
  ": ",
10402
11138
  details.from,
10403
11139
  details.to === null ? "+" : details.to !== details.from ? `\u2013${details.to}` : "",
10404
- /* @__PURE__ */ jsx14(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx14(
11140
+ /* @__PURE__ */ jsx15(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx15(
10405
11141
  PriceTiers,
10406
11142
  {
10407
11143
  currency: details.tiers.currency,
@@ -10414,9 +11150,9 @@ function PriceDetails({
10414
11150
  }
10415
11151
  ) })
10416
11152
  ] }),
10417
- details.cost !== null && /* @__PURE__ */ jsxs14("span", { className: "schematic-metered-features__price-cost", children: [
11153
+ details.cost !== null && /* @__PURE__ */ jsxs15("span", { className: "schematic-metered-features__price-cost", children: [
10418
11154
  details.cost,
10419
- period !== void 0 && /* @__PURE__ */ jsxs14("sub", { children: [
11155
+ period !== void 0 && /* @__PURE__ */ jsxs15("sub", { children: [
10420
11156
  "/",
10421
11157
  period
10422
11158
  ] })
@@ -10429,7 +11165,7 @@ function UsageByUser({
10429
11165
  t
10430
11166
  }) {
10431
11167
  const { data, error, refetch } = useFeatureUserUsage(row.featureId);
10432
- return /* @__PURE__ */ jsx14(
11168
+ return /* @__PURE__ */ jsx15(
10433
11169
  UserBreakdown,
10434
11170
  {
10435
11171
  breakdown: data === void 0 ? void 0 : {
@@ -10451,11 +11187,11 @@ function UsageByUser({
10451
11187
  );
10452
11188
  }
10453
11189
  function MeteredFeaturesSkeleton({ showHeader }) {
10454
- return /* @__PURE__ */ jsxs14("div", { className: "schematic-skeleton", children: [
10455
- showHeader && /* @__PURE__ */ jsx14("div", { className: "schematic-skeleton__heading" }),
10456
- [0, 1].map((index) => /* @__PURE__ */ jsxs14("div", { className: "schematic-skeleton__row", children: [
10457
- /* @__PURE__ */ jsx14("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10458
- /* @__PURE__ */ jsx14("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
11190
+ return /* @__PURE__ */ jsxs15("div", { className: "schematic-skeleton", children: [
11191
+ showHeader && /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__heading" }),
11192
+ [0, 1].map((index) => /* @__PURE__ */ jsxs15("div", { className: "schematic-skeleton__row", children: [
11193
+ /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11194
+ /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
10459
11195
  ] }, index))
10460
11196
  ] });
10461
11197
  }
@@ -10467,8 +11203,8 @@ import {
10467
11203
  useCreditBalances as useCreditBalances2,
10468
11204
  useFeatureUsage as useFeatureUsage4
10469
11205
  } from "@schematichq/schematic-react";
10470
- import { useMemo as useMemo9, useState as useState12 } from "react";
10471
- import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
11206
+ import { useMemo as useMemo10, useState as useState13 } from "react";
11207
+ import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
10472
11208
  var VISIBLE_CREDIT_COUNT = 3;
10473
11209
  var UNIT_KEY = {
10474
11210
  day: "planManagerDays",
@@ -10511,14 +11247,14 @@ function PlanManager({
10511
11247
  const locale = useResolvedLocale(localeProp);
10512
11248
  const t = useTranslator(strings, localeProp);
10513
11249
  const creditsFailed = credits.data === void 0 && credits.error !== void 0;
10514
- const [creditsHaveFailed, setCreditsHaveFailed] = useState12(false);
11250
+ const [creditsHaveFailed, setCreditsHaveFailed] = useState13(false);
10515
11251
  if (creditsFailed && !creditsHaveFailed) {
10516
11252
  setCreditsHaveFailed(true);
10517
11253
  } else if (!creditsFailed && creditsHaveFailed && (credits.data !== void 0 || company.data === void 0 || usage.data === void 0)) {
10518
11254
  setCreditsHaveFailed(false);
10519
11255
  }
10520
11256
  const creditsSettled = !showCredits || credits.data !== void 0 || creditsHaveFailed;
10521
- const view = useMemo9(
11257
+ const view = useMemo10(
10522
11258
  () => company.data === void 0 || usage.data === void 0 || !creditsSettled ? void 0 : derivePlanManager(
10523
11259
  {
10524
11260
  company: company.data,
@@ -10556,7 +11292,7 @@ function PlanManager({
10556
11292
  }
10557
11293
  };
10558
11294
  const Heading = `h${headingLevel}`;
10559
- return /* @__PURE__ */ jsx15(
11295
+ return /* @__PURE__ */ jsx16(
10560
11296
  StatusFrame,
10561
11297
  {
10562
11298
  className: cx("schematic-plan-manager", className),
@@ -10567,30 +11303,30 @@ function PlanManager({
10567
11303
  loadingLabel: t("planManagerLoading"),
10568
11304
  onRetry: retry,
10569
11305
  retryText: t("retry"),
10570
- skeleton: /* @__PURE__ */ jsx15(PlanManagerSkeleton, {}),
10571
- children: view !== void 0 && /* @__PURE__ */ jsxs15(Fragment8, { children: [
10572
- showNotice && view.notice !== null && /* @__PURE__ */ jsx15(Notice, { locale, notice: view.notice, t }),
10573
- /* @__PURE__ */ jsxs15("div", { className: "schematic-card schematic-plan-manager__card", children: [
10574
- showHeader && view.plan !== null && /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__plan", children: [
10575
- /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__title", children: [
10576
- /* @__PURE__ */ jsx15(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
10577
- showDescription && view.plan.description !== null && /* @__PURE__ */ jsx15("p", { className: "schematic-plan-manager__description", children: view.plan.description })
11306
+ skeleton: /* @__PURE__ */ jsx16(PlanManagerSkeleton, {}),
11307
+ children: view !== void 0 && /* @__PURE__ */ jsxs16(Fragment9, { children: [
11308
+ showNotice && view.notice !== null && /* @__PURE__ */ jsx16(Notice, { locale, notice: view.notice, t }),
11309
+ /* @__PURE__ */ jsxs16("div", { className: "schematic-card schematic-plan-manager__card", children: [
11310
+ showHeader && view.plan !== null && /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__plan", children: [
11311
+ /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__title", children: [
11312
+ /* @__PURE__ */ jsx16(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
11313
+ showDescription && view.plan.description !== null && /* @__PURE__ */ jsx16("p", { className: "schematic-plan-manager__description", children: view.plan.description })
10578
11314
  ] }),
10579
- showPrice && view.plan.price !== null && /* @__PURE__ */ jsx15(Price2, { price: view.plan.price, t })
11315
+ showPrice && view.plan.price !== null && /* @__PURE__ */ jsx16(Price2, { price: view.plan.price, t })
10580
11316
  ] }),
10581
- showAddOns && view.addOns.length > 0 && /* @__PURE__ */ jsx15(Section, { label: t("planManagerAddOns"), showLabel: showLabels, children: view.addOns.map((addOn) => /* @__PURE__ */ jsxs15("li", { className: "schematic-plan-manager__row", children: [
10582
- /* @__PURE__ */ jsx15("span", { className: "schematic-plan-manager__item", children: addOn.name }),
10583
- addOn.price !== null && /* @__PURE__ */ jsxs15("span", { className: "schematic-plan-manager__price-value", children: [
11317
+ showAddOns && view.addOns.length > 0 && /* @__PURE__ */ jsx16(Section, { label: t("planManagerAddOns"), showLabel: showLabels, children: view.addOns.map((addOn) => /* @__PURE__ */ jsxs16("li", { className: "schematic-plan-manager__row", children: [
11318
+ /* @__PURE__ */ jsx16("span", { className: "schematic-plan-manager__item", children: addOn.name }),
11319
+ addOn.price !== null && /* @__PURE__ */ jsxs16("span", { className: "schematic-plan-manager__price-value", children: [
10584
11320
  addOn.price.amount,
10585
- /* @__PURE__ */ jsx15(PeriodSuffix, { period: addOn.price.period, t })
11321
+ /* @__PURE__ */ jsx16(PeriodSuffix, { period: addOn.price.period, t })
10586
11322
  ] })
10587
11323
  ] }, addOn.id)) }),
10588
- showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ jsx15(
11324
+ showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ jsx16(
10589
11325
  Section,
10590
11326
  {
10591
11327
  label: t("planManagerUsageBased"),
10592
11328
  showLabel: showLabels,
10593
- children: view.usageBased.map((row) => /* @__PURE__ */ jsx15(
11329
+ children: view.usageBased.map((row) => /* @__PURE__ */ jsx16(
10594
11330
  UsageBasedItem,
10595
11331
  {
10596
11332
  locale,
@@ -10602,7 +11338,7 @@ function PlanManager({
10602
11338
  ))
10603
11339
  }
10604
11340
  ),
10605
- showCredits && credits.data === void 0 && creditsHaveFailed && (credits.error !== void 0 || credits.isPending) && /* @__PURE__ */ jsx15(
11341
+ showCredits && credits.data === void 0 && creditsHaveFailed && (credits.error !== void 0 || credits.isPending) && /* @__PURE__ */ jsx16(
10606
11342
  StatusFrame,
10607
11343
  {
10608
11344
  className: "schematic-plan-manager__section",
@@ -10616,11 +11352,11 @@ function PlanManager({
10616
11352
  children: null
10617
11353
  }
10618
11354
  ),
10619
- showCredits && view.planCredits.length > 0 && /* @__PURE__ */ jsx15(
10620
- Truncated,
11355
+ showCredits && view.planCredits.length > 0 && /* @__PURE__ */ jsx16(
11356
+ Truncated2,
10621
11357
  {
10622
11358
  locale,
10623
- after: view.autoTopup !== null && /* @__PURE__ */ jsx15(
11359
+ after: view.autoTopup !== null && /* @__PURE__ */ jsx16(
10624
11360
  AutoTopupBox,
10625
11361
  {
10626
11362
  lines: view.autoTopup.lines,
@@ -10634,43 +11370,43 @@ function PlanManager({
10634
11370
  rows: view.planCredits,
10635
11371
  showLabel: showLabels,
10636
11372
  t,
10637
- children: (row) => /* @__PURE__ */ jsx15(PlanCreditItem, { row, t }, row.creditId)
11373
+ children: (row) => /* @__PURE__ */ jsx16(PlanCreditItem, { row, t }, row.creditId)
10638
11374
  }
10639
11375
  ),
10640
- showCredits && view.topUps.length > 0 && /* @__PURE__ */ jsx15(
10641
- Truncated,
11376
+ showCredits && view.topUps.length > 0 && /* @__PURE__ */ jsx16(
11377
+ Truncated2,
10642
11378
  {
10643
11379
  locale,
10644
11380
  label: t("planManagerTopUps"),
10645
11381
  rows: view.topUps,
10646
11382
  showLabel: showLabels,
10647
11383
  t,
10648
- children: (row) => /* @__PURE__ */ jsx15(CreditGroupItem, { countAlways: true, row, t }, row.key)
11384
+ children: (row) => /* @__PURE__ */ jsx16(CreditGroupItem, { countAlways: true, row, t }, row.key)
10649
11385
  }
10650
11386
  ),
10651
- showCredits && view.bundles.length > 0 && /* @__PURE__ */ jsx15(
10652
- Truncated,
11387
+ showCredits && view.bundles.length > 0 && /* @__PURE__ */ jsx16(
11388
+ Truncated2,
10653
11389
  {
10654
11390
  locale,
10655
11391
  label: t("planManagerCreditBundles"),
10656
11392
  rows: view.bundles,
10657
11393
  showLabel: showLabels,
10658
11394
  t,
10659
- children: (row) => /* @__PURE__ */ jsx15(CreditGroupItem, { row, t }, row.key)
11395
+ children: (row) => /* @__PURE__ */ jsx16(CreditGroupItem, { row, t }, row.key)
10660
11396
  }
10661
11397
  ),
10662
- showCredits && view.promotional.length > 0 && /* @__PURE__ */ jsx15(
10663
- Truncated,
11398
+ showCredits && view.promotional.length > 0 && /* @__PURE__ */ jsx16(
11399
+ Truncated2,
10664
11400
  {
10665
11401
  locale,
10666
11402
  label: t("planManagerPromotionalCredits"),
10667
11403
  rows: view.promotional,
10668
11404
  showLabel: showLabels,
10669
11405
  t,
10670
- children: (row) => /* @__PURE__ */ jsx15(CreditGroupItem, { plain: true, row, t }, row.key)
11406
+ children: (row) => /* @__PURE__ */ jsx16(CreditGroupItem, { plain: true, row, t }, row.key)
10671
11407
  }
10672
11408
  ),
10673
- view.canChangePlan && /* @__PURE__ */ jsx15(
11409
+ view.canChangePlan && /* @__PURE__ */ jsx16(
10674
11410
  Cta,
10675
11411
  {
10676
11412
  className: "schematic-cta schematic-plan-manager__change-plan",
@@ -10727,16 +11463,16 @@ function Notice({
10727
11463
  if (title === null && body === null) {
10728
11464
  return null;
10729
11465
  }
10730
- return /* @__PURE__ */ jsxs15(
11466
+ return /* @__PURE__ */ jsxs16(
10731
11467
  "div",
10732
11468
  {
10733
11469
  className: "schematic-plan-manager__notice",
10734
11470
  "data-kind": notice2.kind,
10735
11471
  role: "status",
10736
11472
  children: [
10737
- title !== null && /* @__PURE__ */ jsx15("p", { className: "schematic-plan-manager__notice-title", children: title }),
10738
- body !== null && /* @__PURE__ */ jsx15("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
10739
- payUrl !== null && /* @__PURE__ */ jsx15(
11473
+ title !== null && /* @__PURE__ */ jsx16("p", { className: "schematic-plan-manager__notice-title", children: title }),
11474
+ body !== null && /* @__PURE__ */ jsx16("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
11475
+ payUrl !== null && /* @__PURE__ */ jsx16(
10740
11476
  "a",
10741
11477
  {
10742
11478
  className: "schematic-cta schematic-plan-manager__pay-now",
@@ -10751,14 +11487,14 @@ function Notice({
10751
11487
  );
10752
11488
  }
10753
11489
  function Price2({ price, t }) {
10754
- return /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__price", children: [
11490
+ return /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__price", children: [
10755
11491
  price.kind === "usageBased" ? t("planManagerUsageBased") : price.kind === "free" ? t("planManagerFree") : price.amount,
10756
- price.kind === "amount" && price.period !== null && /* @__PURE__ */ jsx15(PeriodSuffix, { period: price.period, t })
11492
+ price.kind === "amount" && price.period !== null && /* @__PURE__ */ jsx16(PeriodSuffix, { period: price.period, t })
10757
11493
  ] });
10758
11494
  }
10759
11495
  function PeriodSuffix({ period, t }) {
10760
11496
  const short = shortPeriod(period, t);
10761
- return short === void 0 ? null : /* @__PURE__ */ jsxs15("sub", { children: [
11497
+ return short === void 0 ? null : /* @__PURE__ */ jsxs16("sub", { children: [
10762
11498
  "/",
10763
11499
  short
10764
11500
  ] });
@@ -10768,12 +11504,12 @@ function Section({
10768
11504
  label,
10769
11505
  showLabel
10770
11506
  }) {
10771
- return /* @__PURE__ */ jsxs15("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10772
- showLabel && /* @__PURE__ */ jsx15("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10773
- /* @__PURE__ */ jsx15("ul", { className: "schematic-plan-manager__rows", children })
11507
+ return /* @__PURE__ */ jsxs16("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
11508
+ showLabel && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
11509
+ /* @__PURE__ */ jsx16("ul", { className: "schematic-plan-manager__rows", children })
10774
11510
  ] });
10775
11511
  }
10776
- function Truncated({
11512
+ function Truncated2({
10777
11513
  after,
10778
11514
  children,
10779
11515
  label,
@@ -10782,12 +11518,12 @@ function Truncated({
10782
11518
  showLabel,
10783
11519
  t
10784
11520
  }) {
10785
- const [expanded, setExpanded] = useState12(false);
11521
+ const [expanded, setExpanded] = useState13(false);
10786
11522
  const shown = expanded ? rows : rows.slice(0, VISIBLE_CREDIT_COUNT);
10787
- return /* @__PURE__ */ jsxs15("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10788
- showLabel && /* @__PURE__ */ jsx15("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10789
- /* @__PURE__ */ jsx15("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
10790
- rows.length > VISIBLE_CREDIT_COUNT && /* @__PURE__ */ jsxs15(
11523
+ return /* @__PURE__ */ jsxs16("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
11524
+ showLabel && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
11525
+ /* @__PURE__ */ jsx16("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
11526
+ rows.length > VISIBLE_CREDIT_COUNT && /* @__PURE__ */ jsxs16(
10791
11527
  "button",
10792
11528
  {
10793
11529
  "aria-expanded": expanded,
@@ -10795,14 +11531,14 @@ function Truncated({
10795
11531
  type: "button",
10796
11532
  onClick: () => setExpanded((value) => !value),
10797
11533
  children: [
10798
- /* @__PURE__ */ jsx15(
11534
+ /* @__PURE__ */ jsx16(
10799
11535
  "i",
10800
11536
  {
10801
11537
  "aria-hidden": "true",
10802
11538
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
10803
11539
  }
10804
11540
  ),
10805
- /* @__PURE__ */ jsx15("span", { className: "schematic-link-button__label", children: expanded ? t("planManagerHideAll") : t("planManagerSeeAll", {
11541
+ /* @__PURE__ */ jsx16("span", { className: "schematic-link-button__label", children: expanded ? t("planManagerHideAll") : t("planManagerSeeAll", {
10806
11542
  total: formatNumber(rows.length, locale)
10807
11543
  }) })
10808
11544
  ]
@@ -10827,9 +11563,9 @@ function UsageBasedItem({
10827
11563
  if (row.unitPrice !== null) {
10828
11564
  const short = row.unitPrice.period === null ? void 0 : shortPeriod(row.unitPrice.period, t);
10829
11565
  details.push(
10830
- /* @__PURE__ */ jsxs15("span", { children: [
11566
+ /* @__PURE__ */ jsxs16("span", { children: [
10831
11567
  row.unitPrice.cost,
10832
- /* @__PURE__ */ jsxs15("sub", { children: [
11568
+ /* @__PURE__ */ jsxs16("sub", { children: [
10833
11569
  "/",
10834
11570
  row.unitPrice.packageSize !== null && `${row.unitPrice.packageSize} `,
10835
11571
  row.unitPrice.units,
@@ -10844,23 +11580,23 @@ function UsageBasedItem({
10844
11580
  );
10845
11581
  }
10846
11582
  const costPeriod = row.cost?.period === null || row.cost === null ? void 0 : shortPeriod(row.cost.period, t);
10847
- return /* @__PURE__ */ jsxs15(
11583
+ return /* @__PURE__ */ jsxs16(
10848
11584
  "li",
10849
11585
  {
10850
11586
  className: "schematic-plan-manager__row",
10851
11587
  "data-testid": "schematic-usage-based",
10852
11588
  children: [
10853
- /* @__PURE__ */ jsx15("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
10854
- /* @__PURE__ */ jsxs15("span", { className: "schematic-plan-manager__detail", children: [
10855
- details.length > 0 && /* @__PURE__ */ jsx15("span", { className: "schematic-muted schematic-small", children: details }),
10856
- row.cost !== null && /* @__PURE__ */ jsxs15("span", { children: [
11589
+ /* @__PURE__ */ jsx16("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
11590
+ /* @__PURE__ */ jsxs16("span", { className: "schematic-plan-manager__detail", children: [
11591
+ details.length > 0 && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-small", children: details }),
11592
+ row.cost !== null && /* @__PURE__ */ jsxs16("span", { children: [
10857
11593
  row.cost.amount,
10858
- costPeriod !== void 0 && /* @__PURE__ */ jsxs15("sub", { children: [
11594
+ costPeriod !== void 0 && /* @__PURE__ */ jsxs16("sub", { children: [
10859
11595
  "/",
10860
11596
  costPeriod
10861
11597
  ] })
10862
11598
  ] }),
10863
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx15(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx15(
11599
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx16(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx16(
10864
11600
  PriceTiers,
10865
11601
  {
10866
11602
  currency: row.tiers.currency,
@@ -10872,7 +11608,7 @@ function UsageBasedItem({
10872
11608
  unit: row.tiers.unit
10873
11609
  }
10874
11610
  ) }),
10875
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx15(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11611
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx16(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10876
11612
  amount: row.hardLimit.amount,
10877
11613
  units: row.hardLimit.units
10878
11614
  }) })
@@ -10884,14 +11620,14 @@ function UsageBasedItem({
10884
11620
  function PlanCreditItem({ row, t }) {
10885
11621
  const text = row.text;
10886
11622
  const composition = row.composition;
10887
- return /* @__PURE__ */ jsxs15(
11623
+ return /* @__PURE__ */ jsxs16(
10888
11624
  "li",
10889
11625
  {
10890
11626
  className: "schematic-plan-manager__row schematic-plan-manager__row--stacked",
10891
11627
  "data-testid": "schematic-plan-credit",
10892
11628
  children: [
10893
- /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__row-main", children: [
10894
- /* @__PURE__ */ jsx15("span", { className: "schematic-plan-manager__item", children: text.kind === "perLicense" ? /* @__PURE__ */ jsxs15(Fragment8, { children: [
11629
+ /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__row-main", children: [
11630
+ /* @__PURE__ */ jsx16("span", { className: "schematic-plan-manager__item", children: text.kind === "perLicense" ? /* @__PURE__ */ jsxs16(Fragment9, { children: [
10895
11631
  t("planManagerCreditsPerLicense", {
10896
11632
  amount: text.amount,
10897
11633
  creditName: text.creditName,
@@ -10910,15 +11646,15 @@ function PlanCreditItem({ row, t }) {
10910
11646
  creditName: text.creditName,
10911
11647
  period: periodWord(text.period, t)
10912
11648
  }) }),
10913
- row.used !== null && /* @__PURE__ */ jsxs15("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: [
11649
+ row.used !== null && /* @__PURE__ */ jsxs16("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: [
10914
11650
  t("planManagerUsed", { amount: row.used }),
10915
- row.autoTopup !== null && /* @__PURE__ */ jsx15(Tooltip, { label: t("planManagerAutoTopup"), children: t("planManagerAutoTopupTip", {
11651
+ row.autoTopup !== null && /* @__PURE__ */ jsx16(Tooltip, { label: t("planManagerAutoTopup"), children: t("planManagerAutoTopupTip", {
10916
11652
  amount: row.autoTopup.amount,
10917
11653
  threshold: row.autoTopup.threshold
10918
11654
  }) })
10919
11655
  ] })
10920
11656
  ] }),
10921
- composition !== null && /* @__PURE__ */ jsx15("span", { className: "schematic-muted schematic-small", children: t(
11657
+ composition !== null && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-small", children: t(
10922
11658
  composition.fixed === null ? "planManagerLicensesTimesCredits" : "planManagerLicensesTimesCreditsPlusCompany",
10923
11659
  {
10924
11660
  creditName: composition.creditName,
@@ -10943,21 +11679,21 @@ function CreditGroupItem({
10943
11679
  const named = !plain && row.bundleName !== null;
10944
11680
  const showCount = !plain && row.count > 1 && (named || countAlways);
10945
11681
  const amount = `${row.quantity} ${row.creditName}`;
10946
- return /* @__PURE__ */ jsxs15(
11682
+ return /* @__PURE__ */ jsxs16(
10947
11683
  "li",
10948
11684
  {
10949
11685
  className: "schematic-plan-manager__row",
10950
11686
  "data-testid": "schematic-credit-group",
10951
11687
  children: [
10952
- /* @__PURE__ */ jsxs15("span", { className: "schematic-plan-manager__item", children: [
10953
- showCount && /* @__PURE__ */ jsxs15("span", { className: "schematic-muted", children: [
11688
+ /* @__PURE__ */ jsxs16("span", { className: "schematic-plan-manager__item", children: [
11689
+ showCount && /* @__PURE__ */ jsxs16("span", { className: "schematic-muted", children: [
10954
11690
  "(",
10955
11691
  row.count,
10956
11692
  ") "
10957
11693
  ] }),
10958
11694
  named ? `${row.bundleName} (${amount})` : amount
10959
11695
  ] }),
10960
- row.used !== null && /* @__PURE__ */ jsx15("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: t("planManagerUsed", { amount: row.used }) })
11696
+ row.used !== null && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: t("planManagerUsed", { amount: row.used }) })
10961
11697
  ]
10962
11698
  }
10963
11699
  );
@@ -10969,16 +11705,16 @@ function AutoTopupBox({
10969
11705
  target,
10970
11706
  url
10971
11707
  }) {
10972
- return /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__auto-topup", children: [
10973
- /* @__PURE__ */ jsxs15("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
10974
- /* @__PURE__ */ jsx15("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
10975
- lines.map((line) => /* @__PURE__ */ jsx15("span", { children: line.kind === "disabled" ? t("planManagerAutoTopupDisabled", { unit: line.unit }) : t("planManagerAutoTopupAdds", {
11708
+ return /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__auto-topup", children: [
11709
+ /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
11710
+ /* @__PURE__ */ jsx16("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
11711
+ lines.map((line) => /* @__PURE__ */ jsx16("span", { children: line.kind === "disabled" ? t("planManagerAutoTopupDisabled", { unit: line.unit }) : t("planManagerAutoTopupAdds", {
10976
11712
  amount: line.amount,
10977
11713
  threshold: line.threshold,
10978
11714
  unit: line.unit
10979
11715
  }) }, line.creditId))
10980
11716
  ] }),
10981
- /* @__PURE__ */ jsx15(
11717
+ /* @__PURE__ */ jsx16(
10982
11718
  Cta,
10983
11719
  {
10984
11720
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-plan-manager__edit",
@@ -10998,10 +11734,10 @@ function Cta({
10998
11734
  url
10999
11735
  }) {
11000
11736
  if (onClick !== void 0) {
11001
- return /* @__PURE__ */ jsx15("button", { className, type: "button", onClick, children: label });
11737
+ return /* @__PURE__ */ jsx16("button", { className, type: "button", onClick, children: label });
11002
11738
  }
11003
11739
  if (url !== void 0) {
11004
- return /* @__PURE__ */ jsx15("a", { className, href: url, target, children: label });
11740
+ return /* @__PURE__ */ jsx16("a", { className, href: url, target, children: label });
11005
11741
  }
11006
11742
  return null;
11007
11743
  }
@@ -11010,11 +11746,11 @@ function periodWord(period, t) {
11010
11746
  return key === void 0 ? period : t(key);
11011
11747
  }
11012
11748
  function PlanManagerSkeleton() {
11013
- return /* @__PURE__ */ jsxs15("div", { className: "schematic-skeleton", children: [
11014
- /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__heading" }),
11015
- [0, 1].map((index) => /* @__PURE__ */ jsxs15("div", { className: "schematic-skeleton__row", children: [
11016
- /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11017
- /* @__PURE__ */ jsx15("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11749
+ return /* @__PURE__ */ jsxs16("div", { className: "schematic-skeleton", children: [
11750
+ /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__heading" }),
11751
+ [0, 1].map((index) => /* @__PURE__ */ jsxs16("div", { className: "schematic-skeleton__row", children: [
11752
+ /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11753
+ /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11018
11754
  ] }, index))
11019
11755
  ] });
11020
11756
  }
@@ -11022,8 +11758,8 @@ PlanManager.resources = ["company", "featureUsage", "creditBalances"];
11022
11758
 
11023
11759
  // src/elements/PricingTable.tsx
11024
11760
  import { useCatalog as useCatalog2, useCompany as useCompany3 } from "@schematichq/schematic-react";
11025
- import { useId as useId7, useMemo as useMemo10, useState as useState13 } from "react";
11026
- import { Fragment as Fragment9, jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
11761
+ import { useId as useId8, useMemo as useMemo11, useState as useState14 } from "react";
11762
+ import { Fragment as Fragment10, jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
11027
11763
  var VISIBLE_ENTITLEMENT_COUNT = 4;
11028
11764
  var CARD_HEADING = {
11029
11765
  1: "h2",
@@ -11079,13 +11815,13 @@ function PricingTable({
11079
11815
  const company = useCompany3();
11080
11816
  const locale = useResolvedLocale(localeProp);
11081
11817
  const t = useTranslator(strings, localeProp);
11082
- const [chosenPeriod, setChosenPeriod] = useState13(defaultPeriod);
11083
- const [chosenCurrency, setChosenCurrency] = useState13(defaultCurrency);
11818
+ const [chosenPeriod, setChosenPeriod] = useState14(defaultPeriod);
11819
+ const [chosenCurrency, setChosenCurrency] = useState14(defaultCurrency);
11084
11820
  const askedPeriod = periodProp ?? chosenPeriod;
11085
11821
  const askedCurrency = currencyProp ?? chosenCurrency;
11086
11822
  const companyMode = catalog.data?.source === "company";
11087
11823
  const companySettled = !companyMode || company.data !== void 0 || company.error !== void 0;
11088
- const view = useMemo10(
11824
+ const view = useMemo11(
11089
11825
  () => catalog.data === void 0 || !companySettled ? void 0 : derivePricingTable(catalog.data, {
11090
11826
  locale,
11091
11827
  period: askedPeriod,
@@ -11140,7 +11876,7 @@ function PricingTable({
11140
11876
  };
11141
11877
  const plansShown = showPlans && view !== void 0 && (view.plans.length > 0 || view.customPlan !== null);
11142
11878
  const addOnsShown = showAddOns && view !== void 0 && view.addOns.length > 0;
11143
- return /* @__PURE__ */ jsx16(
11879
+ return /* @__PURE__ */ jsx17(
11144
11880
  StatusFrame,
11145
11881
  {
11146
11882
  className: cx("schematic-pricing-table", className),
@@ -11151,10 +11887,10 @@ function PricingTable({
11151
11887
  loadingLabel: t("pricingTableLoading"),
11152
11888
  onRetry: catalog.refetch,
11153
11889
  retryText: t("retry"),
11154
- skeleton: /* @__PURE__ */ jsx16(PricingTableSkeleton, {}),
11155
- children: view !== void 0 && shared !== void 0 && /* @__PURE__ */ jsxs16(Fragment9, { children: [
11156
- /* @__PURE__ */ jsxs16("section", { className: "schematic-pricing-table__section", children: [
11157
- (plansShown || addOnsShown) && /* @__PURE__ */ jsx16(
11890
+ skeleton: /* @__PURE__ */ jsx17(PricingTableSkeleton, {}),
11891
+ children: view !== void 0 && shared !== void 0 && /* @__PURE__ */ jsxs17(Fragment10, { children: [
11892
+ /* @__PURE__ */ jsxs17("section", { className: "schematic-pricing-table__section", children: [
11893
+ (plansShown || addOnsShown) && /* @__PURE__ */ jsx17(
11158
11894
  Controls,
11159
11895
  {
11160
11896
  currencies: showCurrencySelector ? view.currencies : [],
@@ -11169,13 +11905,13 @@ function PricingTable({
11169
11905
  t
11170
11906
  }
11171
11907
  ),
11172
- plansShown && /* @__PURE__ */ jsxs16(
11908
+ plansShown && /* @__PURE__ */ jsxs17(
11173
11909
  "ul",
11174
11910
  {
11175
11911
  "aria-label": t("pricingTablePlans"),
11176
11912
  className: "schematic-pricing-table__plans",
11177
11913
  children: [
11178
- view.plans.map((plan, index) => /* @__PURE__ */ jsx16(
11914
+ view.plans.map((plan, index) => /* @__PURE__ */ jsx17(
11179
11915
  Card2,
11180
11916
  {
11181
11917
  card: plan,
@@ -11185,7 +11921,7 @@ function PricingTable({
11185
11921
  },
11186
11922
  plan.id
11187
11923
  )),
11188
- view.customPlan !== null && /* @__PURE__ */ jsx16(
11924
+ view.customPlan !== null && /* @__PURE__ */ jsx17(
11189
11925
  CustomPlanCard2,
11190
11926
  {
11191
11927
  customPlan: view.customPlan,
@@ -11195,10 +11931,10 @@ function PricingTable({
11195
11931
  ]
11196
11932
  }
11197
11933
  ),
11198
- addOnsShown && !plansShown && /* @__PURE__ */ jsx16(AddOnList, { shared })
11934
+ addOnsShown && !plansShown && /* @__PURE__ */ jsx17(AddOnList, { shared })
11199
11935
  ] }),
11200
- addOnsShown && plansShown && /* @__PURE__ */ jsxs16("section", { className: "schematic-pricing-table__section", children: [
11201
- showHeader && /* @__PURE__ */ jsx16(
11936
+ addOnsShown && plansShown && /* @__PURE__ */ jsxs17("section", { className: "schematic-pricing-table__section", children: [
11937
+ showHeader && /* @__PURE__ */ jsx17(
11202
11938
  SectionHeading,
11203
11939
  {
11204
11940
  className: "schematic-pricing-table__heading",
@@ -11206,19 +11942,19 @@ function PricingTable({
11206
11942
  children: t("pricingTableAddOns")
11207
11943
  }
11208
11944
  ),
11209
- /* @__PURE__ */ jsx16(AddOnList, { shared })
11945
+ /* @__PURE__ */ jsx17(AddOnList, { shared })
11210
11946
  ] })
11211
11947
  ] })
11212
11948
  }
11213
11949
  );
11214
11950
  }
11215
11951
  function AddOnList({ shared }) {
11216
- return /* @__PURE__ */ jsx16(
11952
+ return /* @__PURE__ */ jsx17(
11217
11953
  "ul",
11218
11954
  {
11219
11955
  "aria-label": shared.t("pricingTableAddOns"),
11220
11956
  className: "schematic-pricing-table__plans",
11221
- children: shared.view.addOns.map((addOn) => /* @__PURE__ */ jsx16(
11957
+ children: shared.view.addOns.map((addOn) => /* @__PURE__ */ jsx17(
11222
11958
  Card2,
11223
11959
  {
11224
11960
  card: addOn,
@@ -11237,7 +11973,7 @@ function SectionHeading({
11237
11973
  level
11238
11974
  }) {
11239
11975
  const Heading = `h${level}`;
11240
- return /* @__PURE__ */ jsx16(Heading, { className, children });
11976
+ return /* @__PURE__ */ jsx17(Heading, { className, children });
11241
11977
  }
11242
11978
  function Controls({
11243
11979
  currencies,
@@ -11256,8 +11992,8 @@ function Controls({
11256
11992
  if (heading === null && !showCurrencies && !showPeriods) {
11257
11993
  return null;
11258
11994
  }
11259
- return /* @__PURE__ */ jsxs16("div", { className: "schematic-pricing-table__header", children: [
11260
- heading !== null && /* @__PURE__ */ jsx16(
11995
+ return /* @__PURE__ */ jsxs17("div", { className: "schematic-pricing-table__header", children: [
11996
+ heading !== null && /* @__PURE__ */ jsx17(
11261
11997
  SectionHeading,
11262
11998
  {
11263
11999
  className: "schematic-pricing-table__heading",
@@ -11265,15 +12001,15 @@ function Controls({
11265
12001
  children: heading
11266
12002
  }
11267
12003
  ),
11268
- (showCurrencies || showPeriods) && /* @__PURE__ */ jsxs16("div", { className: "schematic-pricing-table__controls", children: [
11269
- showCurrencies && /* @__PURE__ */ jsx16(
12004
+ (showCurrencies || showPeriods) && /* @__PURE__ */ jsxs17("div", { className: "schematic-pricing-table__controls", children: [
12005
+ showCurrencies && /* @__PURE__ */ jsx17(
11270
12006
  "select",
11271
12007
  {
11272
12008
  "aria-label": t("pricingTableCurrency"),
11273
12009
  className: "schematic-select",
11274
12010
  value: currency,
11275
12011
  onChange: (event) => onCurrency(event.target.value),
11276
- children: currencies.map((code) => /* @__PURE__ */ jsx16(
12012
+ children: currencies.map((code) => /* @__PURE__ */ jsx17(
11277
12013
  "option",
11278
12014
  {
11279
12015
  className: "schematic-select__option",
@@ -11284,14 +12020,14 @@ function Controls({
11284
12020
  ))
11285
12021
  }
11286
12022
  ),
11287
- showPeriods && /* @__PURE__ */ jsx16(
12023
+ showPeriods && /* @__PURE__ */ jsx17(
11288
12024
  "div",
11289
12025
  {
11290
12026
  "aria-label": t("pricingTablePeriod"),
11291
12027
  className: "schematic-toggle",
11292
12028
  role: "group",
11293
12029
  children: periods.map((option) => {
11294
- const button = /* @__PURE__ */ jsx16(
12030
+ const button = /* @__PURE__ */ jsx17(
11295
12031
  "button",
11296
12032
  {
11297
12033
  "aria-pressed": option === period,
@@ -11310,9 +12046,9 @@ function Controls({
11310
12046
  if (saved === void 0 || option === "month") {
11311
12047
  return button;
11312
12048
  }
11313
- return /* @__PURE__ */ jsxs16("span", { className: "schematic-toggle__tip", children: [
12049
+ return /* @__PURE__ */ jsxs17("span", { className: "schematic-toggle__tip", children: [
11314
12050
  button,
11315
- /* @__PURE__ */ jsx16(
12051
+ /* @__PURE__ */ jsx17(
11316
12052
  "span",
11317
12053
  {
11318
12054
  className: "schematic-tooltip__content schematic-toggle__tip-content",
@@ -11337,11 +12073,11 @@ function Card2({
11337
12073
  shared
11338
12074
  }) {
11339
12075
  const { headingLevel, t, view } = shared;
11340
- const [expanded, setExpanded] = useState13(false);
11341
- const listId = useId7();
12076
+ const [expanded, setExpanded] = useState14(false);
12077
+ const listId = useId8();
11342
12078
  const Name = CARD_HEADING[headingLevel];
11343
12079
  const entitlements = expanded ? card2.entitlements : card2.entitlements.slice(0, VISIBLE_ENTITLEMENT_COUNT);
11344
- return /* @__PURE__ */ jsxs16(
12080
+ return /* @__PURE__ */ jsxs17(
11345
12081
  "li",
11346
12082
  {
11347
12083
  className: cx(
@@ -11351,11 +12087,11 @@ function Card2({
11351
12087
  ),
11352
12088
  "data-plan-id": card2.id,
11353
12089
  children: [
11354
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__header", children: [
11355
- /* @__PURE__ */ jsx16(Name, { className: "schematic-plan-card__name", children: card2.name }),
11356
- shared.showDescription && card2.description !== null && /* @__PURE__ */ jsx16("p", { className: "schematic-plan-card__description", children: card2.description }),
11357
- /* @__PURE__ */ jsx16(Price3, { price: card2.price, t }),
11358
- shared.showCredits && card2.credits.length > 0 && /* @__PURE__ */ jsx16("ul", { className: "schematic-plan-card__credits", children: card2.credits.map((credit) => /* @__PURE__ */ jsx16(
12090
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__header", children: [
12091
+ /* @__PURE__ */ jsx17(Name, { className: "schematic-plan-card__name", children: card2.name }),
12092
+ shared.showDescription && card2.description !== null && /* @__PURE__ */ jsx17("p", { className: "schematic-plan-card__description", children: card2.description }),
12093
+ /* @__PURE__ */ jsx17(Price3, { price: card2.price, t }),
12094
+ shared.showCredits && card2.credits.length > 0 && /* @__PURE__ */ jsx17("ul", { className: "schematic-plan-card__credits", children: card2.credits.map((credit) => /* @__PURE__ */ jsx17(
11359
12095
  CreditItem,
11360
12096
  {
11361
12097
  credit,
@@ -11364,16 +12100,16 @@ function Card2({
11364
12100
  },
11365
12101
  `${credit.creditId}:${credit.perLicense ?? ""}`
11366
12102
  )) }),
11367
- card2.active && /* @__PURE__ */ jsx16("span", { className: "schematic-badge schematic-plan-card__badge", children: kind === "plan" && view.trialDaysLeft !== null ? t("pricingTableTrialLeft", {
12103
+ card2.active && /* @__PURE__ */ jsx17("span", { className: "schematic-badge schematic-plan-card__badge", children: kind === "plan" && view.trialDaysLeft !== null ? t("pricingTableTrialLeft", {
11368
12104
  count: view.trialDaysLeft.count,
11369
12105
  days: view.trialDaysLeft.days
11370
12106
  }) : t("pricingTableActive") })
11371
12107
  ] }),
11372
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__body", children: [
11373
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__features", children: [
11374
- shared.showEntitlements && card2.entitlements.length > 0 && /* @__PURE__ */ jsxs16("ul", { className: "schematic-plan-card__entitlements", id: listId, children: [
11375
- inclusion !== null && /* @__PURE__ */ jsx16("li", { className: "schematic-plan-card__inclusion", children: t("pricingTableEverythingIn", { plan: inclusion }) }),
11376
- entitlements.map((row) => /* @__PURE__ */ jsx16(
12108
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__body", children: [
12109
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__features", children: [
12110
+ shared.showEntitlements && card2.entitlements.length > 0 && /* @__PURE__ */ jsxs17("ul", { className: "schematic-plan-card__entitlements", id: listId, children: [
12111
+ inclusion !== null && /* @__PURE__ */ jsx17("li", { className: "schematic-plan-card__inclusion", children: t("pricingTableEverythingIn", { plan: inclusion }) }),
12112
+ entitlements.map((row) => /* @__PURE__ */ jsx17(
11377
12113
  EntitlementItem,
11378
12114
  {
11379
12115
  row,
@@ -11382,7 +12118,7 @@ function Card2({
11382
12118
  row.featureId
11383
12119
  ))
11384
12120
  ] }),
11385
- shared.showEntitlements && card2.entitlements.length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs16(
12121
+ shared.showEntitlements && card2.entitlements.length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ jsxs17(
11386
12122
  "button",
11387
12123
  {
11388
12124
  "aria-controls": listId,
@@ -11391,19 +12127,19 @@ function Card2({
11391
12127
  type: "button",
11392
12128
  onClick: () => setExpanded((value) => !value),
11393
12129
  children: [
11394
- /* @__PURE__ */ jsx16(
12130
+ /* @__PURE__ */ jsx17(
11395
12131
  "i",
11396
12132
  {
11397
12133
  "aria-hidden": "true",
11398
12134
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
11399
12135
  }
11400
12136
  ),
11401
- /* @__PURE__ */ jsx16("span", { className: "schematic-link-button__label", children: expanded ? t("pricingTableHideAll") : t("pricingTableSeeAll") })
12137
+ /* @__PURE__ */ jsx17("span", { className: "schematic-link-button__label", children: expanded ? t("pricingTableHideAll") : t("pricingTableSeeAll") })
11402
12138
  ]
11403
12139
  }
11404
12140
  )
11405
12141
  ] }),
11406
- /* @__PURE__ */ jsx16(Action, { card: card2, kind, shared })
12142
+ /* @__PURE__ */ jsx17(Action, { card: card2, kind, shared })
11407
12143
  ] })
11408
12144
  ]
11409
12145
  }
@@ -11411,9 +12147,9 @@ function Card2({
11411
12147
  }
11412
12148
  function Price3({ price, t }) {
11413
12149
  const per = price.kind === "amount" && price.period !== null ? periodWord2(price.period, t) : void 0;
11414
- return /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__price", children: [
12150
+ return /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__price", children: [
11415
12151
  priceText2(price, t),
11416
- per !== void 0 && /* @__PURE__ */ jsxs16("sub", { className: "schematic-plan-card__period", children: [
12152
+ per !== void 0 && /* @__PURE__ */ jsxs17("sub", { className: "schematic-plan-card__period", children: [
11417
12153
  "/",
11418
12154
  per
11419
12155
  ] })
@@ -11453,11 +12189,11 @@ function CreditItem({
11453
12189
  amount: credit.amount,
11454
12190
  creditName: credit.creditName
11455
12191
  });
11456
- return /* @__PURE__ */ jsxs16("li", { className: "schematic-plan-card__credit", children: [
11457
- showIcon && credit.icon !== null && /* @__PURE__ */ jsx16(Icon, { className: "schematic-plan-card__icon", name: credit.icon }),
11458
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__feature", children: [
11459
- /* @__PURE__ */ jsx16("span", { className: "schematic-plan-card__feature-text", children: text }),
11460
- credit.plus !== null && /* @__PURE__ */ jsx16("span", { className: "schematic-muted schematic-plan-card__detail", children: credit.plus.period === null ? t("pricingTableCreditsPlus", {
12192
+ return /* @__PURE__ */ jsxs17("li", { className: "schematic-plan-card__credit", children: [
12193
+ showIcon && credit.icon !== null && /* @__PURE__ */ jsx17(Icon, { className: "schematic-plan-card__icon", name: credit.icon }),
12194
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__feature", children: [
12195
+ /* @__PURE__ */ jsx17("span", { className: "schematic-plan-card__feature-text", children: text }),
12196
+ credit.plus !== null && /* @__PURE__ */ jsx17("span", { className: "schematic-muted schematic-plan-card__detail", children: credit.plus.period === null ? t("pricingTableCreditsPlus", {
11461
12197
  amount: credit.plus.amount,
11462
12198
  creditName: credit.plus.creditName
11463
12199
  }) : t("pricingTableCreditsPlusPerPeriod", {
@@ -11473,16 +12209,16 @@ function EntitlementItem({
11473
12209
  shared
11474
12210
  }) {
11475
12211
  const { locale, t } = shared;
11476
- return /* @__PURE__ */ jsxs16("li", { className: "schematic-plan-card__entitlement", children: [
11477
- shared.showFeatureIcons && row.icon !== null && /* @__PURE__ */ jsx16(Icon, { className: "schematic-plan-card__icon", name: row.icon }),
11478
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__feature", children: [
11479
- /* @__PURE__ */ jsx16("span", { className: "schematic-plan-card__feature-text", children: entitlementText3(row, t) }),
11480
- (row.detail !== null || shared.showHardLimit && row.hardLimit !== null) && /* @__PURE__ */ jsxs16("span", { className: "schematic-muted schematic-plan-card__detail", children: [
12212
+ return /* @__PURE__ */ jsxs17("li", { className: "schematic-plan-card__entitlement", children: [
12213
+ shared.showFeatureIcons && row.icon !== null && /* @__PURE__ */ jsx17(Icon, { className: "schematic-plan-card__icon", name: row.icon }),
12214
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__feature", children: [
12215
+ /* @__PURE__ */ jsx17("span", { className: "schematic-plan-card__feature-text", children: entitlementText3(row, t) }),
12216
+ (row.detail !== null || shared.showHardLimit && row.hardLimit !== null) && /* @__PURE__ */ jsxs17("span", { className: "schematic-muted schematic-plan-card__detail", children: [
11481
12217
  row.detail?.kind === "overage" && t("pricingTableThen", {
11482
12218
  price: unitPrice2(row.detail, t)
11483
12219
  }),
11484
12220
  row.detail?.kind === "tiered" && t("pricingTableTierBased"),
11485
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx16(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx16(
12221
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx17(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx17(
11486
12222
  PriceTiers,
11487
12223
  {
11488
12224
  currency: row.tiers.currency,
@@ -11494,12 +12230,12 @@ function EntitlementItem({
11494
12230
  unit: row.tiers.unit
11495
12231
  }
11496
12232
  ) }),
11497
- shared.showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx16(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
12233
+ shared.showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx17(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11498
12234
  amount: row.hardLimit.amount,
11499
12235
  units: row.hardLimit.units
11500
12236
  }) })
11501
12237
  ] }),
11502
- shared.showFeatureDescriptions && row.description !== null && /* @__PURE__ */ jsx16("p", { className: "schematic-muted schematic-small schematic-plan-card__feature-description", children: row.description })
12238
+ shared.showFeatureDescriptions && row.description !== null && /* @__PURE__ */ jsx17("p", { className: "schematic-muted schematic-small schematic-plan-card__feature-description", children: row.description })
11503
12239
  ] })
11504
12240
  ] });
11505
12241
  }
@@ -11567,8 +12303,8 @@ function Action({
11567
12303
  upgrade: true
11568
12304
  };
11569
12305
  if (action2.kind === "current") {
11570
- return /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__current", children: [
11571
- /* @__PURE__ */ jsx16(
12306
+ return /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__current", children: [
12307
+ /* @__PURE__ */ jsx17(
11572
12308
  "i",
11573
12309
  {
11574
12310
  "aria-hidden": "true",
@@ -11583,7 +12319,7 @@ function Action({
11583
12319
  if (link === void 0 && shared.onSelectPlan === void 0) {
11584
12320
  return null;
11585
12321
  }
11586
- return /* @__PURE__ */ jsx16(
12322
+ return /* @__PURE__ */ jsx17(
11587
12323
  CallToAction,
11588
12324
  {
11589
12325
  className: "schematic-cta",
@@ -11593,7 +12329,7 @@ function Action({
11593
12329
  );
11594
12330
  }
11595
12331
  if (action2.kind === "downgradeBlocked") {
11596
- return /* @__PURE__ */ jsx16(
12332
+ return /* @__PURE__ */ jsx17(
11597
12333
  CallToAction,
11598
12334
  {
11599
12335
  className: "schematic-cta schematic-cta--outline",
@@ -11623,8 +12359,8 @@ function Action({
11623
12359
  action2.kind === "remove" && "schematic-cta--ghost",
11624
12360
  action2.kind === "change" && "schematic-cta--outline"
11625
12361
  );
11626
- return /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__action", children: [
11627
- shared.onSelectPlan !== void 0 || disabled ? /* @__PURE__ */ jsx16(
12362
+ return /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__action", children: [
12363
+ shared.onSelectPlan !== void 0 || disabled ? /* @__PURE__ */ jsx17(
11628
12364
  "button",
11629
12365
  {
11630
12366
  className,
@@ -11633,7 +12369,7 @@ function Action({
11633
12369
  onClick: select,
11634
12370
  children: label
11635
12371
  }
11636
- ) : /* @__PURE__ */ jsx16(
12372
+ ) : /* @__PURE__ */ jsx17(
11637
12373
  "a",
11638
12374
  {
11639
12375
  className,
@@ -11642,7 +12378,7 @@ function Action({
11642
12378
  children: label
11643
12379
  }
11644
12380
  ),
11645
- action2.kind === "overLimit" && action2.violations.length > 0 && /* @__PURE__ */ jsx16("p", { className: "schematic-muted schematic-small schematic-plan-card__violations", children: t("pricingTableOverLimitDetail", {
12381
+ action2.kind === "overLimit" && action2.violations.length > 0 && /* @__PURE__ */ jsx17("p", { className: "schematic-muted schematic-small schematic-plan-card__violations", children: t("pricingTableOverLimitDetail", {
11646
12382
  features: conjunction(
11647
12383
  action2.violations.map((violation) => violation.featureName),
11648
12384
  locale
@@ -11664,7 +12400,7 @@ function CallToAction({
11664
12400
  link,
11665
12401
  text
11666
12402
  }) {
11667
- return /* @__PURE__ */ jsx16("div", { className: "schematic-plan-card__action", children: link === void 0 ? /* @__PURE__ */ jsx16("button", { className, disabled: true, type: "button", children: text }) : /* @__PURE__ */ jsx16(
12403
+ return /* @__PURE__ */ jsx17("div", { className: "schematic-plan-card__action", children: link === void 0 ? /* @__PURE__ */ jsx17("button", { className, disabled: true, type: "button", children: text }) : /* @__PURE__ */ jsx17(
11668
12404
  "a",
11669
12405
  {
11670
12406
  className,
@@ -11681,12 +12417,12 @@ function CustomPlanCard2({
11681
12417
  }) {
11682
12418
  const { headingLevel, t } = shared;
11683
12419
  const Name = CARD_HEADING[headingLevel];
11684
- return /* @__PURE__ */ jsxs16("li", { className: "schematic-card schematic-plan-card schematic-plan-card--custom", children: [
11685
- /* @__PURE__ */ jsxs16("div", { className: "schematic-plan-card__header", children: [
11686
- /* @__PURE__ */ jsx16(Name, { className: "schematic-plan-card__name", children: t("pricingTableCustomPlan") }),
11687
- /* @__PURE__ */ jsx16("div", { className: "schematic-plan-card__price", children: customPlan.priceText ?? t("pricingTableCustomPrice") })
12420
+ return /* @__PURE__ */ jsxs17("li", { className: "schematic-card schematic-plan-card schematic-plan-card--custom", children: [
12421
+ /* @__PURE__ */ jsxs17("div", { className: "schematic-plan-card__header", children: [
12422
+ /* @__PURE__ */ jsx17(Name, { className: "schematic-plan-card__name", children: t("pricingTableCustomPlan") }),
12423
+ /* @__PURE__ */ jsx17("div", { className: "schematic-plan-card__price", children: customPlan.priceText ?? t("pricingTableCustomPrice") })
11688
12424
  ] }),
11689
- /* @__PURE__ */ jsx16("div", { className: "schematic-plan-card__body", children: customPlan.ctaUrl !== null && /* @__PURE__ */ jsx16("div", { className: "schematic-plan-card__action", children: /* @__PURE__ */ jsx16(
12425
+ /* @__PURE__ */ jsx17("div", { className: "schematic-plan-card__body", children: customPlan.ctaUrl !== null && /* @__PURE__ */ jsx17("div", { className: "schematic-plan-card__action", children: /* @__PURE__ */ jsx17(
11690
12426
  "a",
11691
12427
  {
11692
12428
  className: "schematic-cta",
@@ -11707,11 +12443,11 @@ function periodWord2(period, t) {
11707
12443
  return key === void 0 ? period : t(key);
11708
12444
  }
11709
12445
  function PricingTableSkeleton() {
11710
- return /* @__PURE__ */ jsxs16("div", { className: "schematic-skeleton", children: [
11711
- /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__heading" }),
11712
- [0, 1, 2].map((index) => /* @__PURE__ */ jsxs16("div", { className: "schematic-skeleton__row", children: [
11713
- /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11714
- /* @__PURE__ */ jsx16("div", { className: "schematic-skeleton__cell", "data-column": "price" })
12446
+ return /* @__PURE__ */ jsxs17("div", { className: "schematic-skeleton", children: [
12447
+ /* @__PURE__ */ jsx17("div", { className: "schematic-skeleton__heading" }),
12448
+ [0, 1, 2].map((index) => /* @__PURE__ */ jsxs17("div", { className: "schematic-skeleton__row", children: [
12449
+ /* @__PURE__ */ jsx17("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
12450
+ /* @__PURE__ */ jsx17("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11715
12451
  ] }, index))
11716
12452
  ] });
11717
12453
  }
@@ -11723,8 +12459,8 @@ import {
11723
12459
  useFeatureUsage as useFeatureUsage5,
11724
12460
  useUnsubscribe
11725
12461
  } from "@schematichq/schematic-react";
11726
- import { useMemo as useMemo11, useState as useState14 } from "react";
11727
- import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
12462
+ import { useMemo as useMemo12, useState as useState15 } from "react";
12463
+ import { jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
11728
12464
  var TOTAL_KEY = {
11729
12465
  quarter: "unsubscribeQuarterlyTotal",
11730
12466
  year: "unsubscribeYearlyTotal"
@@ -11743,9 +12479,9 @@ function UnsubscribeButton({
11743
12479
  const { isMutating, unsubscribe } = useUnsubscribe();
11744
12480
  const locale = useResolvedLocale(localeProp);
11745
12481
  const t = useTranslator(strings, localeProp);
11746
- const [open, setOpen] = useState14(false);
11747
- const [failed, setFailed] = useState14(false);
11748
- const view = useMemo11(
12482
+ const [open, setOpen] = useState15(false);
12483
+ const [failed, setFailed] = useState15(false);
12484
+ const view = useMemo12(
11749
12485
  () => company.data === void 0 || usage.data === void 0 ? void 0 : deriveUnsubscribe(company.data, usage.data, { locale }),
11750
12486
  [company.data, locale, usage.data]
11751
12487
  );
@@ -11754,7 +12490,7 @@ function UnsubscribeButton({
11754
12490
  if (error === void 0) {
11755
12491
  return null;
11756
12492
  }
11757
- return /* @__PURE__ */ jsx17(
12493
+ return /* @__PURE__ */ jsx18(
11758
12494
  StatusFrame,
11759
12495
  {
11760
12496
  className: cx("schematic-card", "schematic-unsubscribe", className),
@@ -11794,7 +12530,7 @@ function UnsubscribeButton({
11794
12530
  onUnsubscribed?.();
11795
12531
  };
11796
12532
  const per = shortPeriod(view.period, t);
11797
- return /* @__PURE__ */ jsxs17(
12533
+ return /* @__PURE__ */ jsxs18(
11798
12534
  "div",
11799
12535
  {
11800
12536
  className: cx(
@@ -11804,7 +12540,7 @@ function UnsubscribeButton({
11804
12540
  className
11805
12541
  ),
11806
12542
  children: [
11807
- /* @__PURE__ */ jsx17(
12543
+ /* @__PURE__ */ jsx18(
11808
12544
  "button",
11809
12545
  {
11810
12546
  className: "schematic-cta schematic-unsubscribe__open",
@@ -11816,7 +12552,7 @@ function UnsubscribeButton({
11816
12552
  children: t("unsubscribeButton")
11817
12553
  }
11818
12554
  ),
11819
- /* @__PURE__ */ jsx17(
12555
+ /* @__PURE__ */ jsx18(
11820
12556
  Dialog,
11821
12557
  {
11822
12558
  className: "schematic-unsubscribe__dialog",
@@ -11824,10 +12560,10 @@ function UnsubscribeButton({
11824
12560
  open,
11825
12561
  title: t("unsubscribeTitle"),
11826
12562
  onClose: close,
11827
- children: /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__columns", children: [
11828
- /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__summary", children: [
11829
- /* @__PURE__ */ jsx17("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
11830
- /* @__PURE__ */ jsx17(
12563
+ children: /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__columns", children: [
12564
+ /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__summary", children: [
12565
+ /* @__PURE__ */ jsx18("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
12566
+ /* @__PURE__ */ jsx18(
11831
12567
  ManagePlan,
11832
12568
  {
11833
12569
  onClick: onManagePlan,
@@ -11837,44 +12573,44 @@ function UnsubscribeButton({
11837
12573
  }
11838
12574
  )
11839
12575
  ] }),
11840
- /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__sidebar", children: [
11841
- view.plan !== null && /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__group", children: [
11842
- /* @__PURE__ */ jsx17("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
11843
- /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__line", children: [
11844
- /* @__PURE__ */ jsx17("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
11845
- view.plan.price !== null && /* @__PURE__ */ jsxs17("span", { children: [
12576
+ /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__sidebar", children: [
12577
+ view.plan !== null && /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__group", children: [
12578
+ /* @__PURE__ */ jsx18("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
12579
+ /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__line", children: [
12580
+ /* @__PURE__ */ jsx18("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
12581
+ view.plan.price !== null && /* @__PURE__ */ jsxs18("span", { children: [
11846
12582
  view.plan.price,
11847
- per !== void 0 && /* @__PURE__ */ jsxs17("sub", { children: [
12583
+ per !== void 0 && /* @__PURE__ */ jsxs18("sub", { children: [
11848
12584
  "/",
11849
12585
  per
11850
12586
  ] })
11851
12587
  ] })
11852
12588
  ] })
11853
12589
  ] }),
11854
- view.addOns.length > 0 && /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__group", children: [
11855
- /* @__PURE__ */ jsx17("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
11856
- view.addOns.map((addOn) => /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__line", children: [
11857
- /* @__PURE__ */ jsx17("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
11858
- /* @__PURE__ */ jsxs17("span", { children: [
12590
+ view.addOns.length > 0 && /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__group", children: [
12591
+ /* @__PURE__ */ jsx18("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
12592
+ view.addOns.map((addOn) => /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__line", children: [
12593
+ /* @__PURE__ */ jsx18("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
12594
+ /* @__PURE__ */ jsxs18("span", { children: [
11859
12595
  addOn.price,
11860
- !addOn.oneTime && per !== void 0 && /* @__PURE__ */ jsxs17("sub", { children: [
12596
+ !addOn.oneTime && per !== void 0 && /* @__PURE__ */ jsxs18("sub", { children: [
11861
12597
  "/",
11862
12598
  per
11863
12599
  ] })
11864
12600
  ] })
11865
12601
  ] }, addOn.id))
11866
12602
  ] }),
11867
- /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
11868
- /* @__PURE__ */ jsx17("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
11869
- /* @__PURE__ */ jsxs17("span", { children: [
12603
+ /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
12604
+ /* @__PURE__ */ jsx18("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
12605
+ /* @__PURE__ */ jsxs18("span", { children: [
11870
12606
  view.total,
11871
- per !== void 0 && /* @__PURE__ */ jsxs17("sub", { children: [
12607
+ per !== void 0 && /* @__PURE__ */ jsxs18("sub", { children: [
11872
12608
  "/",
11873
12609
  per
11874
12610
  ] })
11875
12611
  ] })
11876
12612
  ] }),
11877
- /* @__PURE__ */ jsx17(
12613
+ /* @__PURE__ */ jsx18(
11878
12614
  "button",
11879
12615
  {
11880
12616
  className: "schematic-cta schematic-unsubscribe__confirm",
@@ -11884,7 +12620,7 @@ function UnsubscribeButton({
11884
12620
  children: t("unsubscribeConfirm")
11885
12621
  }
11886
12622
  ),
11887
- failed && /* @__PURE__ */ jsx17("p", { className: "schematic-error", role: "alert", children: t("unsubscribeFailed") })
12623
+ failed && /* @__PURE__ */ jsx18("p", { className: "schematic-error", role: "alert", children: t("unsubscribeFailed") })
11888
12624
  ] })
11889
12625
  ] })
11890
12626
  }
@@ -11903,9 +12639,9 @@ function ManagePlan({
11903
12639
  return null;
11904
12640
  }
11905
12641
  const label = t("unsubscribeManagePlan");
11906
- return /* @__PURE__ */ jsxs17("div", { className: "schematic-unsubscribe__manage", children: [
11907
- /* @__PURE__ */ jsx17("p", { children: t("unsubscribeNotReady") }),
11908
- onClick !== void 0 ? /* @__PURE__ */ jsx17(
12642
+ return /* @__PURE__ */ jsxs18("div", { className: "schematic-unsubscribe__manage", children: [
12643
+ /* @__PURE__ */ jsx18("p", { children: t("unsubscribeNotReady") }),
12644
+ onClick !== void 0 ? /* @__PURE__ */ jsx18(
11909
12645
  "button",
11910
12646
  {
11911
12647
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11913,7 +12649,7 @@ function ManagePlan({
11913
12649
  onClick,
11914
12650
  children: label
11915
12651
  }
11916
- ) : /* @__PURE__ */ jsx17(
12652
+ ) : /* @__PURE__ */ jsx18(
11917
12653
  "a",
11918
12654
  {
11919
12655
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11928,8 +12664,8 @@ UnsubscribeButton.resources = ["company", "featureUsage"];
11928
12664
 
11929
12665
  // src/elements/UpcomingBill.tsx
11930
12666
  import { useUpcomingInvoice } from "@schematichq/schematic-react";
11931
- import { useMemo as useMemo12 } from "react";
11932
- import { Fragment as Fragment10, jsx as jsx18, jsxs as jsxs18 } from "react/jsx-runtime";
12667
+ import { useMemo as useMemo13 } from "react";
12668
+ import { Fragment as Fragment11, jsx as jsx19, jsxs as jsxs19 } from "react/jsx-runtime";
11933
12669
  function UpcomingBill({
11934
12670
  className,
11935
12671
  headingLevel = 2,
@@ -11943,7 +12679,7 @@ function UpcomingBill({
11943
12679
  const { data: invoice, error, isPending, refetch } = useUpcomingInvoice();
11944
12680
  const locale = useResolvedLocale(localeProp);
11945
12681
  const t = useTranslator(strings, localeProp);
11946
- const bill = useMemo12(
12682
+ const bill = useMemo13(
11947
12683
  () => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
11948
12684
  [invoice, locale]
11949
12685
  );
@@ -11952,7 +12688,7 @@ function UpcomingBill({
11952
12688
  const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
11953
12689
  const unavailable = invoice === void 0 && httpStatus(error) === 404;
11954
12690
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
11955
- return /* @__PURE__ */ jsx18(
12691
+ return /* @__PURE__ */ jsx19(
11956
12692
  StatusFrame,
11957
12693
  {
11958
12694
  className: cx("schematic-card", "schematic-upcoming-bill", className),
@@ -11963,11 +12699,11 @@ function UpcomingBill({
11963
12699
  loadingLabel: t("upcomingBillLoading"),
11964
12700
  onRetry: refetch,
11965
12701
  retryText: t("retry"),
11966
- skeleton: /* @__PURE__ */ jsx18(UpcomingBillSkeleton, { showHeader }),
11967
- children: bill === null ? invoice !== void 0 && /* @__PURE__ */ jsx18("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ jsxs18(Fragment10, { children: [
11968
- showHeader && bill.dueAt !== null && /* @__PURE__ */ jsx18("div", { className: "schematic-header", children: /* @__PURE__ */ jsx18(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
11969
- showAmount && /* @__PURE__ */ jsxs18("div", { className: "schematic-upcoming-bill__amount", children: [
11970
- /* @__PURE__ */ jsx18(
12702
+ skeleton: /* @__PURE__ */ jsx19(UpcomingBillSkeleton, { showHeader }),
12703
+ children: bill === null ? invoice !== void 0 && /* @__PURE__ */ jsx19("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ jsxs19(Fragment11, { children: [
12704
+ showHeader && bill.dueAt !== null && /* @__PURE__ */ jsx19("div", { className: "schematic-header", children: /* @__PURE__ */ jsx19(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
12705
+ showAmount && /* @__PURE__ */ jsxs19("div", { className: "schematic-upcoming-bill__amount", children: [
12706
+ /* @__PURE__ */ jsx19(
11971
12707
  "span",
11972
12708
  {
11973
12709
  className: "schematic-upcoming-bill__total",
@@ -11975,46 +12711,46 @@ function UpcomingBill({
11975
12711
  children: bill.amountDueText
11976
12712
  }
11977
12713
  ),
11978
- /* @__PURE__ */ jsx18("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
12714
+ /* @__PURE__ */ jsx19("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
11979
12715
  ] }),
11980
- (balanceRows || discountRow) && /* @__PURE__ */ jsxs18("div", { className: "schematic-upcoming-bill__rows", children: [
11981
- balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ jsxs18(
12716
+ (balanceRows || discountRow) && /* @__PURE__ */ jsxs19("div", { className: "schematic-upcoming-bill__rows", children: [
12717
+ balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ jsxs19(
11982
12718
  "div",
11983
12719
  {
11984
12720
  className: "schematic-row schematic-upcoming-bill__balance-applied",
11985
12721
  "data-testid": "schematic-balance-applied",
11986
12722
  children: [
11987
- /* @__PURE__ */ jsx18("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
11988
- /* @__PURE__ */ jsx18("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
12723
+ /* @__PURE__ */ jsx19("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
12724
+ /* @__PURE__ */ jsx19("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
11989
12725
  ]
11990
12726
  }
11991
12727
  ),
11992
- balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ jsxs18(
12728
+ balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ jsxs19(
11993
12729
  "div",
11994
12730
  {
11995
12731
  className: "schematic-row schematic-upcoming-bill__balance-remaining",
11996
12732
  "data-testid": "schematic-balance-remaining",
11997
12733
  children: [
11998
- /* @__PURE__ */ jsx18("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
11999
- /* @__PURE__ */ jsx18("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
12734
+ /* @__PURE__ */ jsx19("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
12735
+ /* @__PURE__ */ jsx19("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
12000
12736
  ]
12001
12737
  }
12002
12738
  ),
12003
- discountRow && /* @__PURE__ */ jsxs18(
12739
+ discountRow && /* @__PURE__ */ jsxs19(
12004
12740
  "div",
12005
12741
  {
12006
12742
  className: "schematic-row schematic-upcoming-bill__discount-row",
12007
12743
  "data-testid": "schematic-discounts",
12008
12744
  children: [
12009
- /* @__PURE__ */ jsx18("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
12010
- /* @__PURE__ */ jsx18("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ jsxs18(
12745
+ /* @__PURE__ */ jsx19("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
12746
+ /* @__PURE__ */ jsx19("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ jsxs19(
12011
12747
  "li",
12012
12748
  {
12013
12749
  className: "schematic-upcoming-bill__discount",
12014
12750
  "data-testid": "schematic-discount",
12015
12751
  children: [
12016
- discount.code !== null && /* @__PURE__ */ jsx18("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
12017
- /* @__PURE__ */ jsx18("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
12752
+ discount.code !== null && /* @__PURE__ */ jsx19("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
12753
+ /* @__PURE__ */ jsx19("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
12018
12754
  ]
12019
12755
  },
12020
12756
  `${discount.couponName}-${index}`
@@ -12028,10 +12764,10 @@ function UpcomingBill({
12028
12764
  );
12029
12765
  }
12030
12766
  function UpcomingBillSkeleton({ showHeader }) {
12031
- return /* @__PURE__ */ jsxs18("div", { className: "schematic-skeleton", children: [
12032
- showHeader && /* @__PURE__ */ jsx18("div", { className: "schematic-skeleton__heading" }),
12033
- /* @__PURE__ */ jsx18("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx18("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
12034
- /* @__PURE__ */ jsx18("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx18("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
12767
+ return /* @__PURE__ */ jsxs19("div", { className: "schematic-skeleton", children: [
12768
+ showHeader && /* @__PURE__ */ jsx19("div", { className: "schematic-skeleton__heading" }),
12769
+ /* @__PURE__ */ jsx19("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx19("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
12770
+ /* @__PURE__ */ jsx19("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx19("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
12035
12771
  ] });
12036
12772
  }
12037
12773
  function discountText(discount, t) {
@@ -12049,6 +12785,7 @@ export {
12049
12785
  Checkout,
12050
12786
  CheckoutLauncherProvider,
12051
12787
  CheckoutProblemCode,
12788
+ CreditLog,
12052
12789
  CreditUsage,
12053
12790
  DEFAULT_STRINGS,
12054
12791
  FEATURE_USER_USAGE_LIMIT,
@@ -12074,6 +12811,7 @@ export {
12074
12811
  checkoutSelections,
12075
12812
  currentTier,
12076
12813
  deriveCheckout,
12814
+ deriveCreditLog,
12077
12815
  deriveCreditUsage,
12078
12816
  deriveIncludedFeatures,
12079
12817
  deriveInvoiceList,
@@ -12087,6 +12825,7 @@ export {
12087
12825
  formatConsumptionRate,
12088
12826
  formatCurrency,
12089
12827
  formatDate,
12828
+ formatDateTime,
12090
12829
  formatMonthYear,
12091
12830
  formatNumber,
12092
12831
  formatPercent,
@@ -12113,6 +12852,7 @@ export {
12113
12852
  useCheckoutLauncher,
12114
12853
  useCompany5 as useCompany,
12115
12854
  useCreditBalances3 as useCreditBalances,
12855
+ useCreditLedger2 as useCreditLedger,
12116
12856
  useCreditUserUsage2 as useCreditUserUsage,
12117
12857
  useFeatureUsage6 as useFeatureUsage,
12118
12858
  useFeatureUserUsage2 as useFeatureUserUsage,