@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.
@@ -76,6 +76,7 @@ var init_tokens = __esm({
76
76
  "--schematic-line-height-heading": "1.2",
77
77
  "--schematic-meter-track": ld("#f2f4f7", "#26282d"),
78
78
  "--schematic-muted": ld("#8a8a8a", "#a1a1a1"),
79
+ "--schematic-positive": ld("#1a7f37", "#3fb950"),
79
80
  "--schematic-primary": ld("#000000", "#ffffff"),
80
81
  "--schematic-primary-contrast": ld("#ffffff", "#000000"),
81
82
  "--schematic-radius": "0.625rem",
@@ -505,13 +506,14 @@ var init_PaymentMethodForm = __esm({
505
506
  // src/elements/index.ts
506
507
  var index_exports = {};
507
508
  __export(index_exports, {
508
- BillingDataProvider: () => import_schematic_react14.BillingDataProvider,
509
+ BillingDataProvider: () => import_schematic_react15.BillingDataProvider,
509
510
  Checkout: () => Checkout,
510
511
  CheckoutLauncherProvider: () => CheckoutLauncherProvider,
511
- CheckoutProblemCode: () => import_schematic_react14.CheckoutProblemCode,
512
+ CheckoutProblemCode: () => import_schematic_react15.CheckoutProblemCode,
513
+ CreditLog: () => CreditLog,
512
514
  CreditUsage: () => CreditUsage,
513
515
  DEFAULT_STRINGS: () => DEFAULT_STRINGS,
514
- FEATURE_USER_USAGE_LIMIT: () => import_schematic_react14.FEATURE_USER_USAGE_LIMIT,
516
+ FEATURE_USER_USAGE_LIMIT: () => import_schematic_react15.FEATURE_USER_USAGE_LIMIT,
515
517
  Icon: () => Icon,
516
518
  IncludedFeatures: () => IncludedFeatures,
517
519
  Invoices: () => Invoices,
@@ -520,7 +522,7 @@ __export(index_exports, {
520
522
  PlanManager: () => PlanManager,
521
523
  PricingTable: () => PricingTable,
522
524
  SCHEMATIC_TOKENS: () => SCHEMATIC_TOKENS,
523
- SchematicI18nProvider: () => import_schematic_react14.SchematicI18nProvider,
525
+ SchematicI18nProvider: () => import_schematic_react15.SchematicI18nProvider,
524
526
  SchematicStyles: () => SchematicStyles,
525
527
  Tooltip: () => Tooltip,
526
528
  UnsubscribeButton: () => UnsubscribeButton,
@@ -529,11 +531,12 @@ __export(index_exports, {
529
531
  cartReducer: () => cartReducer,
530
532
  catalogName: () => catalogName,
531
533
  catalogPriceName: () => catalogPriceName,
532
- checkoutProblemsOf: () => import_schematic_react14.checkoutProblemsOf,
534
+ checkoutProblemsOf: () => import_schematic_react15.checkoutProblemsOf,
533
535
  checkoutSelectionFor: () => checkoutSelectionFor,
534
536
  checkoutSelections: () => checkoutSelections,
535
537
  currentTier: () => currentTier,
536
538
  deriveCheckout: () => deriveCheckout,
539
+ deriveCreditLog: () => deriveCreditLog,
537
540
  deriveCreditUsage: () => deriveCreditUsage,
538
541
  deriveIncludedFeatures: () => deriveIncludedFeatures,
539
542
  deriveInvoiceList: () => deriveInvoiceList,
@@ -547,6 +550,7 @@ __export(index_exports, {
547
550
  formatConsumptionRate: () => formatConsumptionRate,
548
551
  formatCurrency: () => formatCurrency,
549
552
  formatDate: () => formatDate,
553
+ formatDateTime: () => formatDateTime,
550
554
  formatMonthYear: () => formatMonthYear,
551
555
  formatNumber: () => formatNumber,
552
556
  formatPercent: () => formatPercent,
@@ -568,31 +572,32 @@ __export(index_exports, {
568
572
  tierRanges: () => tierRanges,
569
573
  unitPrice: () => unitPrice,
570
574
  usageLimit: () => usageLimit,
571
- useCatalog: () => import_schematic_react14.useCatalog,
572
- useCheckout: () => import_schematic_react14.useCheckout,
575
+ useCatalog: () => import_schematic_react15.useCatalog,
576
+ useCheckout: () => import_schematic_react15.useCheckout,
573
577
  useCheckoutLauncher: () => useCheckoutLauncher,
574
- useCompany: () => import_schematic_react14.useCompany,
575
- useCreditBalances: () => import_schematic_react14.useCreditBalances,
576
- useCreditUserUsage: () => import_schematic_react14.useCreditUserUsage,
577
- useFeatureUsage: () => import_schematic_react14.useFeatureUsage,
578
- useFeatureUserUsage: () => import_schematic_react14.useFeatureUserUsage,
579
- useInvalidateBillingData: () => import_schematic_react14.useInvalidateBillingData,
580
- useInvoices: () => import_schematic_react14.useInvoices,
581
- usePaymentMethods: () => import_schematic_react14.usePaymentMethods,
578
+ useCompany: () => import_schematic_react15.useCompany,
579
+ useCreditBalances: () => import_schematic_react15.useCreditBalances,
580
+ useCreditLedger: () => import_schematic_react15.useCreditLedger,
581
+ useCreditUserUsage: () => import_schematic_react15.useCreditUserUsage,
582
+ useFeatureUsage: () => import_schematic_react15.useFeatureUsage,
583
+ useFeatureUserUsage: () => import_schematic_react15.useFeatureUserUsage,
584
+ useInvalidateBillingData: () => import_schematic_react15.useInvalidateBillingData,
585
+ useInvoices: () => import_schematic_react15.useInvoices,
586
+ usePaymentMethods: () => import_schematic_react15.usePaymentMethods,
582
587
  useResolvedLocale: () => useResolvedLocale,
583
- useSchematicI18n: () => import_schematic_react14.useSchematicI18n,
584
- useSchematicLocale: () => import_schematic_react14.useSchematicLocale,
585
- useSchematicStrings: () => import_schematic_react14.useSchematicStrings,
586
- useSchematicTranslate: () => import_schematic_react14.useSchematicTranslate,
587
- useSetupIntent: () => import_schematic_react14.useSetupIntent,
588
- useTaxIds: () => import_schematic_react14.useTaxIds,
588
+ useSchematicI18n: () => import_schematic_react15.useSchematicI18n,
589
+ useSchematicLocale: () => import_schematic_react15.useSchematicLocale,
590
+ useSchematicStrings: () => import_schematic_react15.useSchematicStrings,
591
+ useSchematicTranslate: () => import_schematic_react15.useSchematicTranslate,
592
+ useSetupIntent: () => import_schematic_react15.useSetupIntent,
593
+ useTaxIds: () => import_schematic_react15.useTaxIds,
589
594
  useTranslator: () => useTranslator,
590
- useUnsubscribe: () => import_schematic_react14.useUnsubscribe,
591
- useUpcomingInvoice: () => import_schematic_react14.useUpcomingInvoice,
595
+ useUnsubscribe: () => import_schematic_react15.useUnsubscribe,
596
+ useUpcomingInvoice: () => import_schematic_react15.useUpcomingInvoice,
592
597
  viewerLocale: () => viewerLocale
593
598
  });
594
599
  module.exports = __toCommonJS(index_exports);
595
- var import_schematic_react14 = require("@schematichq/schematic-react");
600
+ var import_schematic_react15 = require("@schematichq/schematic-react");
596
601
 
597
602
  // src/elements/model/errors.ts
598
603
  function httpStatus(error) {
@@ -1078,6 +1083,16 @@ function formatDate(date, locale, options) {
1078
1083
  ...options
1079
1084
  }).format(date);
1080
1085
  }
1086
+ function formatDateTime(date, locale, options = {}) {
1087
+ if (usableDate(date) === void 0) {
1088
+ return "";
1089
+ }
1090
+ return new Intl.DateTimeFormat(usableLocale(locale), {
1091
+ ...options.timeOnly === true ? {} : { month: "short", day: "numeric" },
1092
+ hour: "numeric",
1093
+ minute: "2-digit"
1094
+ }).format(date);
1095
+ }
1081
1096
  function formatShortDate(date, locale) {
1082
1097
  if (usableDate(date) === void 0) {
1083
1098
  return "";
@@ -1131,6 +1146,16 @@ function isEnglish(locale) {
1131
1146
  function orNull(value) {
1132
1147
  return value === void 0 || value === null || value === "" ? null : value;
1133
1148
  }
1149
+ var RESET_PERIOD = {
1150
+ daily: "day",
1151
+ weekly: "week",
1152
+ monthly: "month",
1153
+ quarterly: "quarter",
1154
+ yearly: "year"
1155
+ };
1156
+ function resetPeriod(cadence) {
1157
+ return cadence === void 0 || cadence === null ? null : RESET_PERIOD[cadence] ?? null;
1158
+ }
1134
1159
 
1135
1160
  // src/elements/model/invoices.ts
1136
1161
  function linkableURL(url) {
@@ -1430,6 +1455,10 @@ function planCurrencies(plan) {
1430
1455
  }
1431
1456
  return [...currencies];
1432
1457
  }
1458
+ function pricedIn(plan, currency) {
1459
+ const currencies = planCurrencies(plan);
1460
+ return currencies.length === 0 || currencies.includes(currency.toLowerCase());
1461
+ }
1433
1462
  function isPayInAdvance(entitlement) {
1434
1463
  return entitlement.priceBehavior === "pay_in_advance";
1435
1464
  }
@@ -1496,7 +1525,9 @@ function initialCart({
1496
1525
  if (selection.planId === null) {
1497
1526
  planId = void 0;
1498
1527
  } else if (selection.planId !== void 0) {
1499
- planId = catalog.plans.some((p) => p.id === selection.planId) ? selection.planId : void 0;
1528
+ planId = catalog.plans.some(
1529
+ (p) => p.id === selection.planId && pricedIn(p, currency)
1530
+ ) ? selection.planId : void 0;
1500
1531
  } else {
1501
1532
  planId = catalog.plans.find(
1502
1533
  (p) => p.current && !(p.isTrialable && p.companyCanTrial)
@@ -2152,9 +2183,7 @@ function deriveCheckout(input) {
2152
2183
  selectable: periodOptions.length > 1 && display?.showPeriodToggle !== false,
2153
2184
  savings: plan === void 0 ? null : periodSavings(plan, cart, locale)
2154
2185
  },
2155
- plans: catalog.plans.map(
2156
- (p) => planRow(p, cart, locale, p.id === plan?.id)
2157
- ),
2186
+ plans: catalog.plans.filter((p) => pricedIn(p, cart.currency)).map((p) => planRow(p, cart, locale, p.id === plan?.id)),
2158
2187
  customPlan: customPlanOf(catalog),
2159
2188
  downgradeContact: catalog.preventSelfServiceDowngradeUrl ? {
2160
2189
  url: catalog.preventSelfServiceDowngradeUrl,
@@ -2231,6 +2260,121 @@ function parseOptInText(text) {
2231
2260
  return segments;
2232
2261
  }
2233
2262
 
2263
+ // src/elements/model/creditLog.ts
2264
+ function deriveCreditLog(page, options) {
2265
+ const now = options.now ?? /* @__PURE__ */ new Date();
2266
+ const rows = page.entries.map((entry) => logRow(entry, options.locale, now));
2267
+ const first = rows[0]?.source.credit;
2268
+ const single = first !== void 0 && rows.every((row) => row.creditId === first.id);
2269
+ return {
2270
+ rows,
2271
+ credit: single ? { id: first.id, name: featureName(first, 2, options.locale) } : null,
2272
+ hasMore: page.nextCursor !== void 0
2273
+ };
2274
+ }
2275
+ function logRow(entry, locale, now) {
2276
+ const at = usableDate(entry.eventAt) ?? null;
2277
+ const day = at === null ? null : relativeDay(at, now);
2278
+ const { kind, action: action2, subject, who } = describe(entry);
2279
+ const magnitude = Math.abs(entry.amount);
2280
+ return {
2281
+ id: entry.id,
2282
+ kind,
2283
+ action: action2,
2284
+ subject,
2285
+ who,
2286
+ amount: entry.amount,
2287
+ amountText: formatCredits(magnitude, locale),
2288
+ positive: entry.amount > 0,
2289
+ unit: featureName(
2290
+ {
2291
+ name: entry.credit.name,
2292
+ singularName: entry.credit.singularName,
2293
+ pluralName: entry.credit.pluralName
2294
+ },
2295
+ magnitude,
2296
+ locale
2297
+ ),
2298
+ creditId: entry.credit.id,
2299
+ creditName: featureName(entry.credit, 2, locale),
2300
+ at,
2301
+ day,
2302
+ whenText: at === null ? "" : formatDateTime(at, locale, { timeOnly: day !== null }),
2303
+ timeText: at === null ? "" : formatDateTime(at, locale, { timeOnly: true }),
2304
+ source: entry
2305
+ };
2306
+ }
2307
+ function describe(entry) {
2308
+ switch (entry.kind) {
2309
+ case "grant":
2310
+ return describeGrant(entry);
2311
+ case "zero_out":
2312
+ return {
2313
+ kind: "expiry",
2314
+ action: EXPIRY_ACTION[entry.zeroedOutReason ?? ""] ?? "removed",
2315
+ subject: null,
2316
+ who: grantSource(entry)
2317
+ };
2318
+ default: {
2319
+ const user = entry.user;
2320
+ const userWho = user === void 0 || user === null || user.name === "" ? null : { kind: "user", name: user.name };
2321
+ const feature = entry.feature?.name ?? null;
2322
+ if (entry.usageReason === "manual_adjustment") {
2323
+ return {
2324
+ kind: entry.amount > 0 ? "reversal" : "draw",
2325
+ action: "usageAdjustment",
2326
+ subject: null,
2327
+ who: userWho ?? { kind: "manual" }
2328
+ };
2329
+ }
2330
+ return entry.amount > 0 ? { kind: "reversal", action: "refund", subject: feature, who: userWho } : { kind: "draw", action: "usage", subject: feature, who: userWho };
2331
+ }
2332
+ }
2333
+ }
2334
+ function describeGrant(entry) {
2335
+ const bundle = entry.bundle?.name ?? null;
2336
+ const who = grantSource(entry);
2337
+ switch (entry.grantReason) {
2338
+ case "billing_credit_auto_topup":
2339
+ return { kind: "topup", action: "autoTopup", subject: bundle, who };
2340
+ case "purchased":
2341
+ return { kind: "topup", action: "purchase", subject: bundle, who };
2342
+ case "free":
2343
+ return { kind: "grant", action: "freeGrant", subject: null, who };
2344
+ case "adjustment":
2345
+ return { kind: "grant", action: "adjustmentGrant", subject: null, who };
2346
+ case "rollover":
2347
+ return { kind: "grant", action: "rollover", subject: null, who };
2348
+ default:
2349
+ return { kind: "grant", action: "planGrant", subject: null, who };
2350
+ }
2351
+ }
2352
+ var EXPIRY_ACTION = {
2353
+ expired: "expired",
2354
+ license_retired: "licenseRetired",
2355
+ manual: "removed",
2356
+ plan_change: "planChange",
2357
+ plan_period_reset: "reset"
2358
+ };
2359
+ function grantSource(entry) {
2360
+ switch (entry.grantReason) {
2361
+ case "billing_credit_auto_topup":
2362
+ return { kind: "autoTopup" };
2363
+ case "purchased":
2364
+ return { kind: "purchase" };
2365
+ case "free":
2366
+ case "adjustment":
2367
+ return { kind: "manual" };
2368
+ default:
2369
+ return { kind: "plan" };
2370
+ }
2371
+ }
2372
+ function relativeDay(at, now) {
2373
+ const startOf = (date) => new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
2374
+ const days = Math.round((startOf(now) - startOf(at)) / 864e5);
2375
+ return days === 0 ? "today" : days === 1 ? "yesterday" : null;
2376
+ }
2377
+
2234
2378
  // src/elements/model/creditUsage.ts
2235
2379
  function deriveCreditUsage(balances, options) {
2236
2380
  const ordered = options.visibleCredits === void 0 ? balances : options.visibleCredits.flatMap((id) => {
@@ -2994,7 +3138,7 @@ function planCredits(company, balances, locale) {
2994
3138
  kind: "total",
2995
3139
  amount: formatCredits(value, locale),
2996
3140
  creditName: featureName(unit, value, locale),
2997
- period: subscriptionPeriod2
3141
+ period: resetPeriod(grants[0].renewalPeriod) ?? subscriptionPeriod2
2998
3142
  } : {
2999
3143
  kind: "perLicense",
3000
3144
  amount: formatCredits(composition.perLicenseAmount, locale),
@@ -3158,9 +3302,11 @@ function derivePricingTable(view, options) {
3158
3302
  const { catalog } = view;
3159
3303
  const plans = catalog.plans;
3160
3304
  const addOns = catalog.addOns;
3161
- const currencies = unique([...plans, ...addOns].flatMap(currenciesOf));
3305
+ const locked = options.company?.subscription?.currency?.toLowerCase() || void 0;
3306
+ const offered = unique([...plans, ...addOns].flatMap(currenciesOf));
3307
+ const currencies = locked === void 0 ? offered : [locked];
3162
3308
  const defaultCurrency = catalog.defaultCurrency?.toLowerCase();
3163
- const currency = pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3309
+ const currency = locked ?? pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3164
3310
  const priced = (plan) => supportsCurrency(plan, currency);
3165
3311
  const periods = PERIODS.filter(
3166
3312
  (period2) => [...plans, ...addOns].filter(priced).some((plan) => periodsOf(plan).includes(period2))
@@ -3606,15 +3752,6 @@ function customPlanOf2(plan) {
3606
3752
  function asPeriod(value) {
3607
3753
  return value === "month" || value === "quarter" || value === "year" ? value : null;
3608
3754
  }
3609
- var RESET_PERIOD = {
3610
- daily: "day",
3611
- weekly: "week",
3612
- monthly: "month",
3613
- yearly: "year"
3614
- };
3615
- function resetPeriod(cadence) {
3616
- return cadence === void 0 || cadence === null ? null : RESET_PERIOD[cadence] ?? null;
3617
- }
3618
3755
  var METRIC_PERIOD = {
3619
3756
  current_day: "day",
3620
3757
  current_week: "week",
@@ -3798,6 +3935,43 @@ var DEFAULT_STRINGS = {
3798
3935
  creditUsagePerLicense: "{{quantity}} {{licenseName}} \xD7 {{perUnit}}",
3799
3936
  creditUsageCompanyGrant: "{{amount}} company grant",
3800
3937
  creditUsageRenewsOn: "Renews on the {{day}}.",
3938
+ creditLogLoading: "Loading credit activity",
3939
+ creditLogHeader: "Credit activity",
3940
+ creditLogError: "There was a problem retrieving your credit activity.",
3941
+ creditLogUnavailable: "Credit activity is not available for this account.",
3942
+ creditLogEmpty: "No credit activity yet",
3943
+ creditLogSeeMore: "See full log",
3944
+ creditLogSeeLess: "See less",
3945
+ creditLogSeeAll: "See all",
3946
+ creditLogLoadMore: "Load more",
3947
+ creditLogToday: "Today, {{time}}",
3948
+ creditLogYesterday: "Yesterday, {{time}}",
3949
+ creditLogColumnDate: "Date",
3950
+ creditLogColumnActivity: "Activity",
3951
+ creditLogColumnCredit: "Credit",
3952
+ creditLogColumnBy: "By",
3953
+ creditLogColumnAmount: "Amount",
3954
+ creditLogActionUsage: "Usage",
3955
+ creditLogActionRefund: "Refund: {{feature}}",
3956
+ creditLogActionRefundUnnamed: "Refund",
3957
+ creditLogActionUsageAdjustment: "Usage adjustment",
3958
+ creditLogActionAutoTopup: "Auto top-up, {{bundle}}",
3959
+ creditLogActionAutoTopupUnnamed: "Auto top-up",
3960
+ creditLogActionPurchase: "Purchased {{bundle}}",
3961
+ creditLogActionPurchaseUnnamed: "Credits purchased",
3962
+ creditLogActionPlanGrant: "Plan grant",
3963
+ creditLogActionFreeGrant: "Free credits",
3964
+ creditLogActionAdjustmentGrant: "Credit adjustment",
3965
+ creditLogActionRollover: "Rolled over",
3966
+ creditLogActionExpired: "Unused grant expired",
3967
+ creditLogActionReset: "Unused credits reset",
3968
+ creditLogActionPlanChange: "Removed on plan change",
3969
+ creditLogActionLicenseRetired: "Removed with license",
3970
+ creditLogActionRemoved: "Credits removed",
3971
+ creditLogWhoAutoTopup: "Auto top-up",
3972
+ creditLogWhoPurchase: "Purchase",
3973
+ creditLogWhoPlan: "Plan",
3974
+ creditLogWhoManual: "Manual",
3801
3975
  planManagerLoading: "Loading your plan",
3802
3976
  planManagerError: "There was a problem retrieving your plan.",
3803
3977
  planManagerUnavailable: "Your plan is not available for this account.",
@@ -4624,6 +4798,197 @@ var checkoutCss = `
4624
4798
  }
4625
4799
  `;
4626
4800
 
4801
+ // src/elements/styles/credit-log.ts
4802
+ var creditLogCss = `
4803
+ .schematic-credit-log {
4804
+ display: flex;
4805
+ flex-direction: column;
4806
+ }
4807
+
4808
+ .schematic-credit-log__list {
4809
+ display: flex;
4810
+ flex-direction: column;
4811
+ gap: calc(var(--schematic-space) / 2);
4812
+ list-style: none;
4813
+ margin: 0;
4814
+ padding: 0;
4815
+ }
4816
+
4817
+ .schematic-credit-log__row {
4818
+ align-items: baseline;
4819
+ display: flex;
4820
+ gap: var(--schematic-space);
4821
+ justify-content: space-between;
4822
+ }
4823
+
4824
+ .schematic-credit-log__what {
4825
+ display: flex;
4826
+ flex-direction: column;
4827
+ gap: 0.125rem;
4828
+ min-width: 0;
4829
+ }
4830
+
4831
+ .schematic-credit-log__amount {
4832
+ font-variant-numeric: tabular-nums;
4833
+ margin-inline-start: auto;
4834
+ text-align: end;
4835
+ white-space: nowrap;
4836
+ }
4837
+
4838
+ .schematic-credit-log__amount--positive {
4839
+ color: var(--schematic-positive);
4840
+ }
4841
+
4842
+ .schematic-credit-log__toggle {
4843
+ align-items: center;
4844
+ display: inline-flex;
4845
+ gap: calc(var(--schematic-space) / 2);
4846
+ }
4847
+
4848
+ .schematic-credit-log__toggle .schematic-chevron {
4849
+ margin-inline-start: -0.333rem;
4850
+ }
4851
+
4852
+ .schematic-credit-log__scroll {
4853
+ container-type: inline-size;
4854
+ overflow-x: auto;
4855
+ }
4856
+
4857
+ .schematic-credit-log__table {
4858
+ border-collapse: collapse;
4859
+ width: 100%;
4860
+ }
4861
+
4862
+ .schematic-credit-log__heading {
4863
+ border-bottom: 1px solid var(--schematic-card-divider);
4864
+ color: var(--schematic-muted);
4865
+ font-weight: 500;
4866
+ padding: 0 var(--schematic-space) calc(var(--schematic-space) / 2) 0;
4867
+ text-align: start;
4868
+ }
4869
+
4870
+ .schematic-credit-log__cell {
4871
+ padding: calc(var(--schematic-space) / 2) var(--schematic-space)
4872
+ calc(var(--schematic-space) / 2) 0;
4873
+ vertical-align: baseline;
4874
+ }
4875
+
4876
+ /* A long name, such as a user named by an ID, wraps rather than widening its
4877
+ column, and stops at two lines like the date. */
4878
+ .schematic-credit-log__truncate {
4879
+ -webkit-box-orient: vertical;
4880
+ color: inherit;
4881
+ display: -webkit-box;
4882
+ font-size: inherit;
4883
+ -webkit-line-clamp: 2;
4884
+ line-clamp: 2;
4885
+ overflow: hidden;
4886
+ overflow-wrap: anywhere;
4887
+ }
4888
+
4889
+ .schematic-credit-log__when {
4890
+ white-space: nowrap;
4891
+ }
4892
+
4893
+ .schematic-credit-log__action,
4894
+ .schematic-credit-log__detail {
4895
+ overflow-wrap: anywhere;
4896
+ }
4897
+
4898
+ .schematic-credit-log__heading.schematic-credit-log__amount-heading,
4899
+ .schematic-credit-log__cell.schematic-credit-log__amount-cell {
4900
+ padding-inline-end: 0;
4901
+ text-align: end;
4902
+ }
4903
+
4904
+ /* A narrow card stacks each row: what happened and the amount, then when,
4905
+ who and which credit beneath. */
4906
+ @container (max-width: 30rem) {
4907
+ .schematic-credit-log__heading-row {
4908
+ display: none;
4909
+ }
4910
+
4911
+ .schematic-credit-log__table-row {
4912
+ column-gap: 0.25em;
4913
+ display: grid;
4914
+ grid-template-areas:
4915
+ "activity activity activity amount"
4916
+ "date by credit credit";
4917
+ grid-template-columns: auto fit-content(40%) minmax(0, 1fr) auto;
4918
+ padding: calc(var(--schematic-space) / 2) 0;
4919
+ }
4920
+
4921
+ .schematic-credit-log__cell {
4922
+ display: block;
4923
+ padding: 0;
4924
+ }
4925
+
4926
+ .schematic-credit-log__activity {
4927
+ grid-area: activity;
4928
+ }
4929
+
4930
+ .schematic-credit-log__cell.schematic-credit-log__amount-cell {
4931
+ grid-area: amount;
4932
+ padding-inline-start: var(--schematic-space);
4933
+ }
4934
+
4935
+ .schematic-credit-log__date,
4936
+ .schematic-credit-log__by,
4937
+ .schematic-credit-log__credit {
4938
+ font-size: 0.75rem;
4939
+ }
4940
+
4941
+ .schematic-credit-log__date {
4942
+ grid-area: date;
4943
+ }
4944
+
4945
+ .schematic-credit-log__by {
4946
+ grid-area: by;
4947
+ }
4948
+
4949
+ .schematic-credit-log__credit {
4950
+ grid-area: credit;
4951
+ }
4952
+
4953
+ .schematic-credit-log__by,
4954
+ .schematic-credit-log__credit {
4955
+ align-items: baseline;
4956
+ display: flex;
4957
+ gap: 0.25em;
4958
+ min-width: 0;
4959
+ }
4960
+
4961
+ .schematic-credit-log__by::before,
4962
+ .schematic-credit-log__credit::before {
4963
+ content: "\xB7";
4964
+ }
4965
+
4966
+ .schematic-credit-log__by.schematic-credit-log__by--none {
4967
+ display: none;
4968
+ }
4969
+ }
4970
+
4971
+ .schematic-credit-log__actions {
4972
+ align-items: center;
4973
+ display: flex;
4974
+ gap: var(--schematic-space);
4975
+ margin-top: var(--schematic-space);
4976
+ }
4977
+
4978
+ .schematic-credit-log__empty {
4979
+ margin: 0;
4980
+ padding: calc(var(--schematic-space) / 2) 0;
4981
+ }
4982
+
4983
+ .schematic-credit-log .schematic-skeleton__cell[data-column="action"] {
4984
+ width: 9rem;
4985
+ }
4986
+
4987
+ .schematic-credit-log .schematic-skeleton__cell[data-column="amount"] {
4988
+ width: 5rem;
4989
+ }
4990
+ `;
4991
+
4627
4992
  // src/elements/styles/credit-usage.ts
4628
4993
  var creditUsageCss = `
4629
4994
  .schematic-credit-usage__credits {
@@ -6707,6 +7072,7 @@ ${tooltipCss}
6707
7072
  ${includedFeaturesCss}
6708
7073
  ${meteredFeaturesCss}
6709
7074
  ${creditUsageCss}
7075
+ ${creditLogCss}
6710
7076
  ${planManagerCss}
6711
7077
  ${pricingTableCss}
6712
7078
  ${unsubscribeCss}
@@ -9293,13 +9659,386 @@ function useCheckoutLauncher() {
9293
9659
  return (0, import_react8.useContext)(LauncherContext) ?? detached;
9294
9660
  }
9295
9661
 
9296
- // src/elements/CreditUsage.tsx
9662
+ // src/elements/CreditLog.tsx
9297
9663
  var import_schematic_react6 = require("@schematichq/schematic-react");
9298
- var import_react11 = require("react");
9299
-
9300
- // src/elements/usage.tsx
9301
9664
  var import_react10 = require("react");
9302
9665
  var import_jsx_runtime11 = require("react/jsx-runtime");
9666
+ var SKELETON_ROWS = 3;
9667
+ var ACTION_KEY = {
9668
+ adjustmentGrant: "creditLogActionAdjustmentGrant",
9669
+ autoTopup: "creditLogActionAutoTopup",
9670
+ expired: "creditLogActionExpired",
9671
+ freeGrant: "creditLogActionFreeGrant",
9672
+ licenseRetired: "creditLogActionLicenseRetired",
9673
+ planChange: "creditLogActionPlanChange",
9674
+ planGrant: "creditLogActionPlanGrant",
9675
+ purchase: "creditLogActionPurchase",
9676
+ refund: "creditLogActionRefund",
9677
+ removed: "creditLogActionRemoved",
9678
+ reset: "creditLogActionReset",
9679
+ rollover: "creditLogActionRollover",
9680
+ usage: "creditLogActionUsage",
9681
+ usageAdjustment: "creditLogActionUsageAdjustment"
9682
+ };
9683
+ var UNNAMED_KEY = {
9684
+ autoTopup: "creditLogActionAutoTopupUnnamed",
9685
+ purchase: "creditLogActionPurchaseUnnamed",
9686
+ refund: "creditLogActionRefundUnnamed"
9687
+ };
9688
+ var WHO_KEY = {
9689
+ autoTopup: "creditLogWhoAutoTopup",
9690
+ manual: "creditLogWhoManual",
9691
+ plan: "creditLogWhoPlan",
9692
+ purchase: "creditLogWhoPurchase"
9693
+ };
9694
+ function CreditLog({
9695
+ className,
9696
+ credits,
9697
+ headingLevel = 2,
9698
+ limit = 3,
9699
+ locale: localeProp,
9700
+ onSeeAll,
9701
+ seeAllTarget,
9702
+ seeAllUrl,
9703
+ showGrants = true,
9704
+ showHeader = true,
9705
+ showUser = true,
9706
+ strings
9707
+ }) {
9708
+ const query = (0, import_react10.useMemo)(
9709
+ () => ({
9710
+ ...credits === void 0 ? {} : { credits },
9711
+ ...showGrants ? {} : { includeGrants: false }
9712
+ }),
9713
+ [credits, showGrants]
9714
+ );
9715
+ const {
9716
+ data: page,
9717
+ error,
9718
+ isPending,
9719
+ loadMore,
9720
+ refetch
9721
+ } = (0, import_schematic_react6.useCreditLedger)(query);
9722
+ const locale = useResolvedLocale(localeProp);
9723
+ const t = useTranslator(strings, localeProp);
9724
+ const [full, setFull] = (0, import_react10.useState)(false);
9725
+ const log = (0, import_react10.useMemo)(
9726
+ () => page === void 0 ? void 0 : deriveCreditLog(page, { locale }),
9727
+ [locale, page]
9728
+ );
9729
+ const headingId = (0, import_react10.useId)();
9730
+ const Heading = `h${headingLevel}`;
9731
+ const rows = log?.rows ?? [];
9732
+ const showCredit = log?.credit === null || !showHeader;
9733
+ const hasMoreRows = rows.length > limit || log?.hasMore === true;
9734
+ const handedOff = onSeeAll !== void 0 || seeAllUrl !== void 0;
9735
+ const label = showHeader ? void 0 : t("creditLogHeader");
9736
+ const labelledBy = showHeader ? headingId : void 0;
9737
+ const unavailable = log === void 0 && httpStatus(error) === 404;
9738
+ const errorMessage = error === void 0 ? void 0 : unavailable ? t("creditLogUnavailable") : t("creditLogError");
9739
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9740
+ StatusFrame,
9741
+ {
9742
+ className: cx("schematic-card", "schematic-credit-log", className),
9743
+ error,
9744
+ errorMessage,
9745
+ hasData: log !== void 0,
9746
+ isPending,
9747
+ loadingLabel: t("creditLogLoading"),
9748
+ onRetry: refetch,
9749
+ retryText: t("retry"),
9750
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9751
+ CreditLogSkeleton,
9752
+ {
9753
+ rows: Math.max(1, Math.min(limit, SKELETON_ROWS)),
9754
+ showHeader
9755
+ }
9756
+ ),
9757
+ children: log !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
9758
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-header", children: [
9759
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Heading, { className: "schematic-header__title", id: headingId, children: t("creditLogHeader") }),
9760
+ log.credit !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted schematic-small schematic-credit-log__credit-name", children: log.credit.name })
9761
+ ] }),
9762
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "schematic-muted schematic-credit-log__empty", children: t("creditLogEmpty") }) : full ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
9763
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9764
+ "div",
9765
+ {
9766
+ "aria-label": label,
9767
+ "aria-labelledby": labelledBy,
9768
+ className: "schematic-credit-log__scroll",
9769
+ role: "region",
9770
+ tabIndex: 0,
9771
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9772
+ "table",
9773
+ {
9774
+ className: "schematic-small schematic-credit-log__table",
9775
+ "aria-label": label,
9776
+ "aria-labelledby": labelledBy,
9777
+ children: [
9778
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("tr", { className: "schematic-credit-log__heading-row", children: [
9779
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "schematic-credit-log__heading", scope: "col", children: t("creditLogColumnDate") }),
9780
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("th", { className: "schematic-credit-log__heading", scope: "col", children: t("creditLogColumnActivity") }),
9781
+ showUser && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9782
+ "th",
9783
+ {
9784
+ className: "schematic-credit-log__heading",
9785
+ scope: "col",
9786
+ children: t("creditLogColumnBy")
9787
+ }
9788
+ ),
9789
+ showCredit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9790
+ "th",
9791
+ {
9792
+ className: "schematic-credit-log__heading",
9793
+ scope: "col",
9794
+ children: t("creditLogColumnCredit")
9795
+ }
9796
+ ),
9797
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9798
+ "th",
9799
+ {
9800
+ className: "schematic-credit-log__heading schematic-credit-log__amount-heading",
9801
+ scope: "col",
9802
+ children: t("creditLogColumnAmount")
9803
+ }
9804
+ )
9805
+ ] }) }),
9806
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("tbody", { children: rows.map((row) => {
9807
+ const who = whoText(row.who, t);
9808
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9809
+ "tr",
9810
+ {
9811
+ className: "schematic-credit-log__table-row",
9812
+ "data-testid": "schematic-credit-log-entry",
9813
+ children: [
9814
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "schematic-muted schematic-credit-log__cell schematic-credit-log__date", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(WhenText, { row, t }) }),
9815
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "schematic-credit-log__cell schematic-credit-log__activity", children: actionText(row, t) }),
9816
+ showUser && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9817
+ "td",
9818
+ {
9819
+ className: cx(
9820
+ "schematic-muted",
9821
+ "schematic-credit-log__cell",
9822
+ "schematic-credit-log__by",
9823
+ who === void 0 && "schematic-credit-log__by--none"
9824
+ ),
9825
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Truncated, { text: who ?? "\u2014" })
9826
+ }
9827
+ ),
9828
+ showCredit && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "schematic-muted schematic-credit-log__cell schematic-credit-log__credit", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Truncated, { text: row.creditName }) }),
9829
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("td", { className: "schematic-credit-log__cell schematic-credit-log__amount-cell", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Amount, { row }) })
9830
+ ]
9831
+ },
9832
+ row.id
9833
+ );
9834
+ }) })
9835
+ ]
9836
+ }
9837
+ )
9838
+ }
9839
+ ),
9840
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-credit-log__actions", children: [
9841
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9842
+ Toggle,
9843
+ {
9844
+ expanded: true,
9845
+ label: t("creditLogSeeLess"),
9846
+ onClick: () => setFull(false)
9847
+ }
9848
+ ),
9849
+ log.hasMore && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9850
+ "button",
9851
+ {
9852
+ className: "schematic-link-button schematic-credit-log__load-more",
9853
+ disabled: isPending,
9854
+ type: "button",
9855
+ onClick: () => void loadMore(),
9856
+ children: t("creditLogLoadMore")
9857
+ }
9858
+ )
9859
+ ] })
9860
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
9861
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9862
+ "ul",
9863
+ {
9864
+ className: "schematic-credit-log__list",
9865
+ "aria-label": label,
9866
+ "aria-labelledby": labelledBy,
9867
+ children: rows.slice(0, limit).map((row) => {
9868
+ const detail = [
9869
+ whenText(row, t),
9870
+ showUser ? whoText(row.who, t) : void 0,
9871
+ showCredit ? row.creditName : void 0
9872
+ ].filter((part) => part !== void 0 && part !== "");
9873
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9874
+ "li",
9875
+ {
9876
+ className: "schematic-credit-log__row",
9877
+ "data-testid": "schematic-credit-log-entry",
9878
+ children: [
9879
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "schematic-credit-log__what", children: [
9880
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-credit-log__action", children: actionText(row, t) }),
9881
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted schematic-small schematic-credit-log__detail", children: detail.join(" \xB7 ") })
9882
+ ] }),
9883
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Amount, { row })
9884
+ ]
9885
+ },
9886
+ row.id
9887
+ );
9888
+ })
9889
+ }
9890
+ ),
9891
+ hasMoreRows && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "schematic-credit-log__actions", children: handedOff ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9892
+ SeeAll,
9893
+ {
9894
+ label: t("creditLogSeeAll"),
9895
+ onSeeAll,
9896
+ seeAllTarget,
9897
+ seeAllUrl
9898
+ }
9899
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9900
+ Toggle,
9901
+ {
9902
+ expanded: false,
9903
+ label: t("creditLogSeeMore"),
9904
+ onClick: () => setFull(true)
9905
+ }
9906
+ ) })
9907
+ ] })
9908
+ ] })
9909
+ }
9910
+ );
9911
+ }
9912
+ function Toggle({
9913
+ expanded,
9914
+ label,
9915
+ onClick
9916
+ }) {
9917
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
9918
+ "button",
9919
+ {
9920
+ "aria-expanded": expanded,
9921
+ className: "schematic-link-button schematic-credit-log__toggle",
9922
+ type: "button",
9923
+ onClick,
9924
+ children: [
9925
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9926
+ "i",
9927
+ {
9928
+ "aria-hidden": "true",
9929
+ className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9930
+ }
9931
+ ),
9932
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-link-button__label", children: label })
9933
+ ]
9934
+ }
9935
+ );
9936
+ }
9937
+ function SeeAll({
9938
+ label,
9939
+ onSeeAll,
9940
+ seeAllTarget,
9941
+ seeAllUrl
9942
+ }) {
9943
+ if (onSeeAll === void 0) {
9944
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9945
+ "a",
9946
+ {
9947
+ className: "schematic-link-button schematic-credit-log__see-all-link",
9948
+ href: seeAllUrl,
9949
+ rel: seeAllTarget === "_blank" ? "noreferrer" : void 0,
9950
+ target: seeAllTarget,
9951
+ children: label
9952
+ }
9953
+ );
9954
+ }
9955
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9956
+ "button",
9957
+ {
9958
+ className: "schematic-link-button schematic-credit-log__see-all-button",
9959
+ type: "button",
9960
+ onClick: onSeeAll,
9961
+ children: label
9962
+ }
9963
+ );
9964
+ }
9965
+ function Truncated({ text }) {
9966
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-credit-log__truncate", title: text, children: text });
9967
+ }
9968
+ function Amount({ row }) {
9969
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
9970
+ "span",
9971
+ {
9972
+ className: cx(
9973
+ "schematic-credit-log__amount",
9974
+ row.positive && "schematic-credit-log__amount--positive"
9975
+ ),
9976
+ children: `${row.positive ? "+" : "\u2212"}${row.amountText}`
9977
+ }
9978
+ );
9979
+ }
9980
+ function actionText(row, t) {
9981
+ if (row.action === "usage") {
9982
+ return row.subject ?? t("creditLogActionUsage");
9983
+ }
9984
+ const unnamed = UNNAMED_KEY[row.action];
9985
+ if (row.subject === null && unnamed !== void 0) {
9986
+ return t(unnamed);
9987
+ }
9988
+ return t(ACTION_KEY[row.action], {
9989
+ bundle: row.subject,
9990
+ feature: row.subject
9991
+ });
9992
+ }
9993
+ function whenText(row, t) {
9994
+ if (row.day === "today") {
9995
+ return t("creditLogToday", { time: row.whenText });
9996
+ }
9997
+ if (row.day === "yesterday") {
9998
+ return t("creditLogYesterday", { time: row.whenText });
9999
+ }
10000
+ return row.whenText;
10001
+ }
10002
+ function WhenText({ row, t }) {
10003
+ const text = whenText(row, t);
10004
+ const at = row.timeText === "" ? -1 : text.lastIndexOf(row.timeText);
10005
+ if (at <= 0) {
10006
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-credit-log__when", children: text });
10007
+ }
10008
+ const day = text.slice(0, at);
10009
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
10010
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-credit-log__when", children: day.trimEnd() }),
10011
+ day.slice(day.trimEnd().length) || "\u200B",
10012
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-credit-log__when", children: text.slice(at) })
10013
+ ] });
10014
+ }
10015
+ function whoText(who, t) {
10016
+ if (who === null) {
10017
+ return void 0;
10018
+ }
10019
+ return who.kind === "user" ? who.name : t(WHO_KEY[who.kind]);
10020
+ }
10021
+ function CreditLogSkeleton({
10022
+ rows,
10023
+ showHeader
10024
+ }) {
10025
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-skeleton", children: [
10026
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "schematic-skeleton__heading" }),
10027
+ Array.from({ length: rows }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-skeleton__row", children: [
10028
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "action" }),
10029
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "amount" })
10030
+ ] }, row))
10031
+ ] });
10032
+ }
10033
+ CreditLog.resources = ["creditLedger"];
10034
+
10035
+ // src/elements/CreditUsage.tsx
10036
+ var import_schematic_react7 = require("@schematichq/schematic-react");
10037
+ var import_react12 = require("react");
10038
+
10039
+ // src/elements/usage.tsx
10040
+ var import_react11 = require("react");
10041
+ var import_jsx_runtime12 = require("react/jsx-runtime");
9303
10042
  var COLLAPSED_USER_COUNT = 3;
9304
10043
  var EXPANDED_USER_COUNT = 20;
9305
10044
  function shortPeriod(period, t) {
@@ -9325,16 +10064,16 @@ function PriceTiers({
9325
10064
  }) {
9326
10065
  const perPeriod2 = period === null ? void 0 : shortPeriod(period, t);
9327
10066
  const money = (amount) => formatCurrency(amount, currency, locale);
9328
- const perUnit = (amount) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
10067
+ const perUnit = (amount) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9329
10068
  money(amount),
9330
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
10069
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
9331
10070
  "/",
9332
10071
  unit
9333
10072
  ] })
9334
10073
  ] });
9335
- const flat = (amount) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
10074
+ const flat = (amount) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9336
10075
  money(amount),
9337
- perPeriod2 !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
10076
+ perPeriod2 !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
9338
10077
  "/",
9339
10078
  perPeriod2
9340
10079
  ] })
@@ -9346,21 +10085,21 @@ function PriceTiers({
9346
10085
  if (flatPrice !== 0 && perUnitPrice === 0) {
9347
10086
  return flat(flatPrice);
9348
10087
  }
9349
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
10088
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
9350
10089
  perUnit(perUnitPrice),
9351
10090
  " + ",
9352
10091
  flat(flatPrice)
9353
10092
  ] });
9354
10093
  };
9355
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "schematic-tiers", children: [
9356
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-tiers__tier", children: [
9357
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("dt", { className: "schematic-tiers__range", children: [
10094
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("span", { className: "schematic-tiers", children: [
10095
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-tiers__tier", children: [
10096
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("dt", { className: "schematic-tiers__range", children: [
9358
10097
  formatNumber(tier.from, locale),
9359
10098
  tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${formatNumber(tier.to, locale)}` : ""
9360
10099
  ] }),
9361
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
10100
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
9362
10101
  ] }, tier.from)) }),
9363
- mode !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-tiers__mode", children: mode === "volume" ? t("usageTiersVolume") : t("usageTiersGraduated") })
10102
+ mode !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-tiers__mode", children: mode === "volume" ? t("usageTiersVolume") : t("usageTiersGraduated") })
9364
10103
  ] });
9365
10104
  }
9366
10105
  function UserBreakdown({
@@ -9372,17 +10111,17 @@ function UserBreakdown({
9372
10111
  t,
9373
10112
  unit
9374
10113
  }) {
9375
- const [expanded, setExpanded] = (0, import_react10.useState)(false);
9376
- const users = (0, import_react10.useMemo)(
10114
+ const [expanded, setExpanded] = (0, import_react11.useState)(false);
10115
+ const users = (0, import_react11.useMemo)(
9377
10116
  () => [...breakdown?.users ?? []].sort((a, b) => b.amount - a.amount),
9378
10117
  [breakdown?.users]
9379
10118
  );
9380
10119
  const amount = (value) => `${formatAmount?.(value) ?? formatNumber(value, locale)} ${featureName(unit, value, locale)}`;
9381
10120
  if (breakdown === void 0 && error !== void 0) {
9382
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-usage-by-user", role: "alert", children: [
9383
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9384
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-error", children: t("usageByUserError") }),
9385
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10121
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-usage-by-user", role: "alert", children: [
10122
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
10123
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-error", children: t("usageByUserError") }),
10124
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9386
10125
  "button",
9387
10126
  {
9388
10127
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-status__retry",
@@ -9413,9 +10152,9 @@ function UserBreakdown({
9413
10152
  count: breakdown.count,
9414
10153
  shown: formatNumber(breakdown.count, locale)
9415
10154
  }) : t("usageByUserShowAll");
9416
- const user = (key, label, value, muted = false) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { className: "schematic-usage-by-user__user", children: [
9417
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "schematic-usage-by-user__avatar", children: muted ? "?" : (label.trim()[0] ?? "?").toUpperCase() }),
9418
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10155
+ const user = (key, label, value, muted = false) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { className: "schematic-usage-by-user__user", children: [
10156
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { "aria-hidden": "true", className: "schematic-usage-by-user__avatar", children: muted ? "?" : (label.trim()[0] ?? "?").toUpperCase() }),
10157
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9419
10158
  "span",
9420
10159
  {
9421
10160
  className: cx(
@@ -9425,12 +10164,12 @@ function UserBreakdown({
9425
10164
  children: label
9426
10165
  }
9427
10166
  ),
9428
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted schematic-usage-by-user__amount", children: amount(value) })
10167
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-muted schematic-usage-by-user__amount", children: amount(value) })
9429
10168
  ] }, key);
9430
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-usage-by-user", children: [
9431
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9432
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted", children: t("usageByUserTotal", { amount: amount(breakdown.total) }) }),
9433
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("ul", { className: "schematic-usage-by-user__list", children: [
10169
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-usage-by-user", children: [
10170
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
10171
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-muted", children: t("usageByUserTotal", { amount: amount(breakdown.total) }) }),
10172
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("ul", { className: "schematic-usage-by-user__list", children: [
9434
10173
  visible.map((entry) => user(entry.id, entry.label, entry.amount)),
9435
10174
  expanded && unattributed !== null && user(
9436
10175
  "unattributed",
@@ -9439,11 +10178,11 @@ function UserBreakdown({
9439
10178
  true
9440
10179
  )
9441
10180
  ] }),
9442
- expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted", children: t("usageByUserMore", {
10181
+ expanded && remaining > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-muted", children: t("usageByUserMore", {
9443
10182
  count: remaining,
9444
10183
  shown: formatNumber(remaining, locale)
9445
10184
  }) }),
9446
- (hidden > 0 || unattributed !== null) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
10185
+ (hidden > 0 || unattributed !== null) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9447
10186
  "button",
9448
10187
  {
9449
10188
  "aria-expanded": expanded,
@@ -9451,14 +10190,14 @@ function UserBreakdown({
9451
10190
  type: "button",
9452
10191
  onClick: () => setExpanded((value) => !value),
9453
10192
  children: [
9454
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10193
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9455
10194
  "i",
9456
10195
  {
9457
10196
  "aria-hidden": "true",
9458
10197
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9459
10198
  }
9460
10199
  ),
9461
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("usageByUserShowFewer") : expandLabel })
10200
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("usageByUserShowFewer") : expandLabel })
9462
10201
  ]
9463
10202
  }
9464
10203
  )
@@ -9466,7 +10205,7 @@ function UserBreakdown({
9466
10205
  }
9467
10206
 
9468
10207
  // src/elements/CreditUsage.tsx
9469
- var import_jsx_runtime12 = require("react/jsx-runtime");
10208
+ var import_jsx_runtime13 = require("react/jsx-runtime");
9470
10209
  var VISIBLE_GRANT_COUNT = 3;
9471
10210
  var GRANT_KEY = {
9472
10211
  autoTopup: "creditUsageGrantAutoTopup",
@@ -9490,10 +10229,10 @@ function CreditUsage({
9490
10229
  strings,
9491
10230
  visibleCredits
9492
10231
  }) {
9493
- const { data: balances, error, isPending, refetch } = (0, import_schematic_react6.useCreditBalances)();
10232
+ const { data: balances, error, isPending, refetch } = (0, import_schematic_react7.useCreditBalances)();
9494
10233
  const locale = useResolvedLocale(localeProp);
9495
10234
  const t = useTranslator(strings, localeProp);
9496
- const credits = (0, import_react11.useMemo)(
10235
+ const credits = (0, import_react12.useMemo)(
9497
10236
  () => balances === void 0 ? [] : deriveCreditUsage(balances, { locale, visibleCredits }),
9498
10237
  [balances, locale, visibleCredits]
9499
10238
  );
@@ -9504,7 +10243,7 @@ function CreditUsage({
9504
10243
  }
9505
10244
  const Heading = `h${headingLevel}`;
9506
10245
  const CreditHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
9507
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10246
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9508
10247
  StatusFrame,
9509
10248
  {
9510
10249
  className: cx("schematic-credit-usage", className),
@@ -9515,25 +10254,25 @@ function CreditUsage({
9515
10254
  loadingLabel: t("creditUsageLoading"),
9516
10255
  onRetry: refetch,
9517
10256
  retryText: t("retry"),
9518
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreditUsageSkeleton, { showHeader }),
10257
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CreditUsageSkeleton, { showHeader }),
9519
10258
  children: [
9520
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { className: "schematic-header__title", children: t("creditUsageHeader") }) }),
9521
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-credit-usage__credits", children: credits.map((credit) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10259
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { className: "schematic-header__title", children: t("creditUsageHeader") }) }),
10260
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-credit-usage__credits", children: credits.map((credit) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9522
10261
  "section",
9523
10262
  {
9524
10263
  "aria-label": credit.name,
9525
10264
  className: "schematic-card schematic-credit-usage__credit",
9526
10265
  "data-testid": "schematic-credit",
9527
10266
  children: [
9528
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__main", children: [
9529
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-credit-usage__icon", children: credit.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Icon, { name: credit.icon }) }),
9530
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__body", children: [
9531
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__title", children: [
9532
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
9533
- showDescription && credit.description !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "schematic-muted", children: credit.description })
10267
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__main", children: [
10268
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-credit-usage__icon", children: credit.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: credit.icon }) }),
10269
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__body", children: [
10270
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__title", children: [
10271
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
10272
+ showDescription && credit.description !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "schematic-muted", children: credit.description })
9534
10273
  ] }),
9535
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__balance", children: [
9536
- showUsage && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10274
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__balance", children: [
10275
+ showUsage && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9537
10276
  "span",
9538
10277
  {
9539
10278
  className: "schematic-credit-usage__remaining",
@@ -9541,7 +10280,7 @@ function CreditUsage({
9541
10280
  children: t("creditUsageRemaining", credit.remaining)
9542
10281
  }
9543
10282
  ),
9544
- credit.purchasable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10283
+ credit.purchasable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9545
10284
  BuyMore,
9546
10285
  {
9547
10286
  credit,
@@ -9552,10 +10291,10 @@ function CreditUsage({
9552
10291
  }
9553
10292
  )
9554
10293
  ] }),
9555
- credit.composition !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "schematic-muted schematic-small schematic-credit-usage__composition", children: compositionText(credit, t) })
10294
+ credit.composition !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "schematic-muted schematic-small schematic-credit-usage__composition", children: compositionText(credit, t) })
9556
10295
  ] })
9557
10296
  ] }),
9558
- credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10297
+ credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9559
10298
  Ledger,
9560
10299
  {
9561
10300
  credit,
@@ -9564,7 +10303,7 @@ function CreditUsage({
9564
10303
  t
9565
10304
  }
9566
10305
  ),
9567
- showUsageByUser && credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreditUserBreakdown, { credit, locale, t })
10306
+ showUsageByUser && credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CreditUserBreakdown, { credit, locale, t })
9568
10307
  ]
9569
10308
  },
9570
10309
  credit.creditId
@@ -9598,28 +10337,28 @@ function Ledger({
9598
10337
  showExpiration,
9599
10338
  t
9600
10339
  }) {
9601
- const [open, setOpen] = (0, import_react11.useState)(false);
9602
- const [all, setAll] = (0, import_react11.useState)(false);
10340
+ const [open, setOpen] = (0, import_react12.useState)(false);
10341
+ const [all, setAll] = (0, import_react12.useState)(false);
9603
10342
  const rows = all ? credit.ledger : credit.ledger.slice(0, VISIBLE_GRANT_COUNT);
9604
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__ledger", children: [
9605
- open && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__grants", children: [
9606
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "schematic-credit-usage__grant-list", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10343
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__ledger", children: [
10344
+ open && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-credit-usage__grants", children: [
10345
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "schematic-credit-usage__grant-list", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9607
10346
  "li",
9608
10347
  {
9609
10348
  className: "schematic-credit-usage__grant",
9610
10349
  "data-testid": "schematic-credit-grant",
9611
10350
  children: [
9612
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-credit-usage__grant-text", children: t(GRANT_KEY[row.kind], {
10351
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-credit-usage__grant-text", children: t(GRANT_KEY[row.kind], {
9613
10352
  amount: row.amount,
9614
10353
  createdAt: row.createdAt,
9615
10354
  item: row.item
9616
10355
  }) }),
9617
- showExpiration && row.date !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-credit-usage__grant-date", children: row.date.kind === "resets" ? t("creditUsageResets", { date: row.date.text }) : t("creditUsageExpires", { date: row.date.text }) })
10356
+ showExpiration && row.date !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-credit-usage__grant-date", children: row.date.kind === "resets" ? t("creditUsageResets", { date: row.date.text }) : t("creditUsageExpires", { date: row.date.text }) })
9618
10357
  ]
9619
10358
  },
9620
10359
  row.id
9621
10360
  )) }),
9622
- credit.ledger.length > VISIBLE_GRANT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10361
+ credit.ledger.length > VISIBLE_GRANT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9623
10362
  "button",
9624
10363
  {
9625
10364
  "aria-expanded": all,
@@ -9627,21 +10366,21 @@ function Ledger({
9627
10366
  type: "button",
9628
10367
  onClick: () => setAll((value) => !value),
9629
10368
  children: [
9630
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10369
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9631
10370
  "i",
9632
10371
  {
9633
10372
  "aria-hidden": "true",
9634
10373
  className: `schematic-icon schematic-icon--${all ? "chevron-up" : "chevron-down"} schematic-chevron`
9635
10374
  }
9636
10375
  ),
9637
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-link-button__label", children: all ? t("creditUsageHideAll") : t("creditUsageSeeAll", {
10376
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-link-button__label", children: all ? t("creditUsageHideAll") : t("creditUsageSeeAll", {
9638
10377
  total: formatNumber(credit.ledger.length, locale)
9639
10378
  }) })
9640
10379
  ]
9641
10380
  }
9642
10381
  )
9643
10382
  ] }),
9644
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10383
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9645
10384
  "button",
9646
10385
  {
9647
10386
  "aria-expanded": open,
@@ -9652,14 +10391,14 @@ function Ledger({
9652
10391
  setAll(false);
9653
10392
  },
9654
10393
  children: [
9655
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10394
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9656
10395
  "i",
9657
10396
  {
9658
10397
  "aria-hidden": "true",
9659
10398
  className: `schematic-icon schematic-icon--${open ? "chevron-up" : "chevron-down"} schematic-chevron`
9660
10399
  }
9661
10400
  ),
9662
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-link-button__label", children: open ? t("creditUsageHideDetails") : t("creditUsageSeeDetails") })
10401
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-link-button__label", children: open ? t("creditUsageHideDetails") : t("creditUsageSeeDetails") })
9663
10402
  ]
9664
10403
  }
9665
10404
  )
@@ -9673,7 +10412,7 @@ function BuyMore({
9673
10412
  url
9674
10413
  }) {
9675
10414
  if (onBuyMore !== void 0) {
9676
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10415
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9677
10416
  "button",
9678
10417
  {
9679
10418
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9684,7 +10423,7 @@ function BuyMore({
9684
10423
  );
9685
10424
  }
9686
10425
  if (url !== void 0) {
9687
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10426
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9688
10427
  "a",
9689
10428
  {
9690
10429
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9701,8 +10440,8 @@ function CreditUserBreakdown({
9701
10440
  locale,
9702
10441
  t
9703
10442
  }) {
9704
- const { data, error, refetch } = (0, import_schematic_react6.useCreditUserUsage)(credit.creditId);
9705
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10443
+ const { data, error, refetch } = (0, import_schematic_react7.useCreditUserUsage)(credit.creditId);
10444
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9706
10445
  UserBreakdown,
9707
10446
  {
9708
10447
  breakdown: data === void 0 ? void 0 : {
@@ -9725,20 +10464,20 @@ function CreditUserBreakdown({
9725
10464
  );
9726
10465
  }
9727
10466
  function CreditUsageSkeleton({ showHeader }) {
9728
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-skeleton", children: [
9729
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__heading" }),
9730
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-skeleton__row", children: [
9731
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9732
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "remaining" })
10467
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton", children: [
10468
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__heading" }),
10469
+ [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton__row", children: [
10470
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10471
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "remaining" })
9733
10472
  ] }, index))
9734
10473
  ] });
9735
10474
  }
9736
10475
  CreditUsage.resources = ["creditBalances"];
9737
10476
 
9738
10477
  // src/elements/IncludedFeatures.tsx
9739
- var import_schematic_react7 = require("@schematichq/schematic-react");
9740
- var import_react12 = require("react");
9741
- var import_jsx_runtime13 = require("react/jsx-runtime");
10478
+ var import_schematic_react8 = require("@schematichq/schematic-react");
10479
+ var import_react13 = require("react");
10480
+ var import_jsx_runtime14 = require("react/jsx-runtime");
9742
10481
  var VISIBLE_FEATURE_COUNT = 4;
9743
10482
  function IncludedFeatures({
9744
10483
  className,
@@ -9756,11 +10495,11 @@ function IncludedFeatures({
9756
10495
  strings,
9757
10496
  visibleFeatures
9758
10497
  }) {
9759
- const { data: features, error, isPending, refetch } = (0, import_schematic_react7.useFeatureUsage)();
10498
+ const { data: features, error, isPending, refetch } = (0, import_schematic_react8.useFeatureUsage)();
9760
10499
  const locale = useResolvedLocale(localeProp);
9761
10500
  const t = useTranslator(strings, localeProp);
9762
- const [expanded, setExpanded] = (0, import_react12.useState)(false);
9763
- const rows = (0, import_react12.useMemo)(
10501
+ const [expanded, setExpanded] = (0, import_react13.useState)(false);
10502
+ const rows = (0, import_react13.useMemo)(
9764
10503
  () => features === void 0 ? [] : deriveIncludedFeatures(features, {
9765
10504
  locale,
9766
10505
  showCredits,
@@ -9780,7 +10519,7 @@ function IncludedFeatures({
9780
10519
  const shown = canExpand && !expanded ? rows.slice(0, VISIBLE_FEATURE_COUNT) : rows;
9781
10520
  const unavailable = features === void 0 && httpStatus(error) === 404;
9782
10521
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("includedFeaturesUnavailable") : t("includedFeaturesError");
9783
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10522
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9784
10523
  StatusFrame,
9785
10524
  {
9786
10525
  className: cx("schematic-card", "schematic-included-features", className),
@@ -9791,26 +10530,26 @@ function IncludedFeatures({
9791
10530
  loadingLabel: t("includedFeaturesLoading"),
9792
10531
  onRetry: refetch,
9793
10532
  retryText: t("retry"),
9794
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IncludedFeaturesSkeleton, { showHeader }),
10533
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IncludedFeaturesSkeleton, { showHeader }),
9795
10534
  children: [
9796
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
9797
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10535
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
10536
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9798
10537
  "li",
9799
10538
  {
9800
10539
  className: "schematic-included-features__row",
9801
10540
  "data-testid": "schematic-included-feature",
9802
10541
  children: [
9803
- showIcon && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10542
+ showIcon && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9804
10543
  Icon,
9805
10544
  {
9806
10545
  className: "schematic-included-features__icon",
9807
10546
  name: row.icon
9808
10547
  }
9809
10548
  ),
9810
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-included-features__details", children: [
9811
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-included-features__name", children: row.name }),
9812
- showDescription && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-muted schematic-small", children: row.description }),
9813
- row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10549
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-included-features__details", children: [
10550
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-included-features__name", children: row.name }),
10551
+ showDescription && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-muted schematic-small", children: row.description }),
10552
+ row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9814
10553
  "span",
9815
10554
  {
9816
10555
  className: "schematic-muted schematic-small",
@@ -9822,9 +10561,9 @@ function IncludedFeatures({
9822
10561
  },
9823
10562
  `${credits.creditName}-${index}`
9824
10563
  )),
9825
- showExpiration && row.expiresAt !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
10564
+ showExpiration && row.expiresAt !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
9826
10565
  ] }),
9827
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10566
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9828
10567
  UsageDetails,
9829
10568
  {
9830
10569
  row,
@@ -9839,7 +10578,7 @@ function IncludedFeatures({
9839
10578
  },
9840
10579
  row.featureId
9841
10580
  )) }),
9842
- canExpand && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10581
+ canExpand && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9843
10582
  "button",
9844
10583
  {
9845
10584
  "aria-expanded": expanded,
@@ -9847,14 +10586,14 @@ function IncludedFeatures({
9847
10586
  type: "button",
9848
10587
  onClick: () => setExpanded((value) => !value),
9849
10588
  children: [
9850
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10589
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9851
10590
  "i",
9852
10591
  {
9853
10592
  "aria-hidden": "true",
9854
10593
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9855
10594
  }
9856
10595
  ),
9857
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
10596
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
9858
10597
  ]
9859
10598
  }
9860
10599
  )
@@ -9874,17 +10613,17 @@ function UsageDetails({
9874
10613
  if (row.entitlement === null && usage === null) {
9875
10614
  return null;
9876
10615
  }
9877
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-included-features__usage", children: [
9878
- showEntitlement && row.entitlement !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "schematic-included-features__entitlement", children: [
10616
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-included-features__usage", children: [
10617
+ showEntitlement && row.entitlement !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "schematic-included-features__entitlement", children: [
9879
10618
  entitlementText2(row.entitlement, t),
9880
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10619
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
9881
10620
  amount: row.hardLimit.amount,
9882
10621
  units: row.hardLimit.units
9883
10622
  }) })
9884
10623
  ] }),
9885
- showUsage && usage !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
10624
+ showUsage && usage !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
9886
10625
  usage,
9887
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10626
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9888
10627
  PriceTiers,
9889
10628
  {
9890
10629
  currency: row.tiers.currency,
@@ -9959,19 +10698,19 @@ function segmentText(segment, t) {
9959
10698
  }
9960
10699
  }
9961
10700
  function IncludedFeaturesSkeleton({ showHeader }) {
9962
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton", children: [
9963
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__heading" }),
9964
- [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton__row", children: [
9965
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9966
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
10701
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-skeleton", children: [
10702
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__heading" }),
10703
+ [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-skeleton__row", children: [
10704
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10705
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
9967
10706
  ] }, index))
9968
10707
  ] });
9969
10708
  }
9970
10709
  IncludedFeatures.resources = ["featureUsage"];
9971
10710
 
9972
10711
  // src/elements/Invoices.tsx
9973
- var import_schematic_react8 = require("@schematichq/schematic-react");
9974
- var import_react13 = require("react");
10712
+ var import_schematic_react9 = require("@schematichq/schematic-react");
10713
+ var import_react14 = require("react");
9975
10714
 
9976
10715
  // src/utils/invoiceLink.ts
9977
10716
  function openInvoiceLink(event, storedUrl, fetchUrl) {
@@ -9993,8 +10732,8 @@ function openInvoiceLink(event, storedUrl, fetchUrl) {
9993
10732
  }
9994
10733
 
9995
10734
  // src/elements/Invoices.tsx
9996
- var import_jsx_runtime14 = require("react/jsx-runtime");
9997
- var SKELETON_ROWS = 4;
10735
+ var import_jsx_runtime15 = require("react/jsx-runtime");
10736
+ var SKELETON_ROWS2 = 4;
9998
10737
  function Invoices({
9999
10738
  className,
10000
10739
  collapsible = true,
@@ -10014,15 +10753,15 @@ function Invoices({
10014
10753
  isPending,
10015
10754
  loadMore,
10016
10755
  refetch
10017
- } = (0, import_schematic_react8.useInvoices)(query);
10756
+ } = (0, import_schematic_react9.useInvoices)(query);
10018
10757
  const locale = useResolvedLocale(localeProp);
10019
10758
  const t = useTranslator(strings, localeProp);
10020
- const [expanded, setExpanded] = (0, import_react13.useState)(false);
10021
- const list = (0, import_react13.useMemo)(
10759
+ const [expanded, setExpanded] = (0, import_react14.useState)(false);
10760
+ const list = (0, import_react14.useMemo)(
10022
10761
  () => page === void 0 ? void 0 : deriveInvoiceList(page, { locale }),
10023
10762
  [locale, page]
10024
10763
  );
10025
- const headingId = (0, import_react13.useId)();
10764
+ const headingId = (0, import_react14.useId)();
10026
10765
  const rows = list?.rows ?? [];
10027
10766
  const canCollapse = collapsible && rows.length > limit;
10028
10767
  const showingAll = !canCollapse || expanded;
@@ -10034,7 +10773,7 @@ function Invoices({
10034
10773
  );
10035
10774
  const unavailable = list === void 0 && httpStatus(error) === 404;
10036
10775
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("invoicesUnavailable") : t("invoicesError");
10037
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10776
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10038
10777
  StatusFrame,
10039
10778
  {
10040
10779
  className: cx("schematic-card", "schematic-invoices", className),
@@ -10045,30 +10784,30 @@ function Invoices({
10045
10784
  loadingLabel: t("invoicesLoading"),
10046
10785
  onRetry: refetch,
10047
10786
  retryText: t("retry"),
10048
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10787
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10049
10788
  InvoicesSkeleton,
10050
10789
  {
10051
10790
  columns: columns2,
10052
- rows: Math.max(1, Math.min(limit, SKELETON_ROWS)),
10791
+ rows: Math.max(1, Math.min(limit, SKELETON_ROWS2)),
10053
10792
  showHeader
10054
10793
  }
10055
10794
  ),
10056
- children: list !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
10057
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
10058
- rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10795
+ children: list !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
10796
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
10797
+ rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10059
10798
  "ul",
10060
10799
  {
10061
10800
  className: "schematic-invoices__list",
10062
10801
  "aria-label": showHeader ? void 0 : t("invoicesHeader"),
10063
10802
  "aria-labelledby": showHeader ? headingId : void 0,
10064
- children: visible.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
10803
+ children: visible.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10065
10804
  "li",
10066
10805
  {
10067
10806
  className: "schematic-invoices__row",
10068
10807
  "data-testid": "schematic-invoice",
10069
10808
  children: [
10070
- showDate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InvoiceDate, { row, t, fetchLink }) }),
10071
- showAmount && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10809
+ showDate && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(InvoiceDate, { row, t, fetchLink }) }),
10810
+ showAmount && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10072
10811
  "span",
10073
10812
  {
10074
10813
  className: cx(
@@ -10085,8 +10824,8 @@ function Invoices({
10085
10824
  ))
10086
10825
  }
10087
10826
  ),
10088
- (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-invoices__actions", children: [
10089
- canCollapse && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
10827
+ (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-invoices__actions", children: [
10828
+ canCollapse && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10090
10829
  "button",
10091
10830
  {
10092
10831
  "aria-expanded": expanded,
@@ -10094,7 +10833,7 @@ function Invoices({
10094
10833
  type: "button",
10095
10834
  onClick: () => setExpanded((value) => !value),
10096
10835
  children: [
10097
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10836
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10098
10837
  "i",
10099
10838
  {
10100
10839
  "aria-hidden": "true",
@@ -10106,11 +10845,11 @@ function Invoices({
10106
10845
  )
10107
10846
  }
10108
10847
  ),
10109
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
10848
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
10110
10849
  ]
10111
10850
  }
10112
10851
  ),
10113
- showingAll && list.hasMore && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10852
+ showingAll && list.hasMore && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10114
10853
  "button",
10115
10854
  {
10116
10855
  className: "schematic-link-button schematic-invoices__load-more",
@@ -10133,9 +10872,9 @@ function InvoicesSkeleton({
10133
10872
  rows,
10134
10873
  showHeader
10135
10874
  }) {
10136
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-skeleton", children: [
10137
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__heading" }),
10138
- Array.from({ length: rows }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__row", children: columns2.map((column) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10875
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-skeleton", children: [
10876
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__heading" }),
10877
+ Array.from({ length: rows }, (_, row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__row", children: columns2.map((column) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10139
10878
  "div",
10140
10879
  {
10141
10880
  className: "schematic-skeleton__cell",
@@ -10152,10 +10891,10 @@ function InvoiceDate({
10152
10891
  }) {
10153
10892
  const { url } = row;
10154
10893
  if (url === null) {
10155
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-invoices__date-text", children: row.dateText });
10894
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-invoices__date-text", children: row.dateText });
10156
10895
  }
10157
10896
  const label = row.dateText === "" ? t("invoicesUndated") : row.dateText;
10158
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10897
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10159
10898
  "a",
10160
10899
  {
10161
10900
  className: "schematic-invoices__link",
@@ -10172,9 +10911,9 @@ function InvoiceDate({
10172
10911
  Invoices.resources = ["invoices"];
10173
10912
 
10174
10913
  // src/elements/MeteredFeatures.tsx
10175
- var import_schematic_react9 = require("@schematichq/schematic-react");
10176
- var import_react14 = require("react");
10177
- var import_jsx_runtime15 = require("react/jsx-runtime");
10914
+ var import_schematic_react10 = require("@schematichq/schematic-react");
10915
+ var import_react15 = require("react");
10916
+ var import_jsx_runtime16 = require("react/jsx-runtime");
10178
10917
  function MeteredFeatures({
10179
10918
  addMoreTarget,
10180
10919
  addMoreUrl,
@@ -10195,10 +10934,10 @@ function MeteredFeatures({
10195
10934
  strings,
10196
10935
  visibleFeatures
10197
10936
  }) {
10198
- const { data: features, error, isPending, refetch } = (0, import_schematic_react9.useFeatureUsage)();
10937
+ const { data: features, error, isPending, refetch } = (0, import_schematic_react10.useFeatureUsage)();
10199
10938
  const locale = useResolvedLocale(localeProp);
10200
10939
  const t = useTranslator(strings, localeProp);
10201
- const rows = (0, import_react14.useMemo)(
10940
+ const rows = (0, import_react15.useMemo)(
10202
10941
  () => features === void 0 ? [] : deriveMeteredFeatures(features, {
10203
10942
  locale,
10204
10943
  showCredits,
@@ -10220,7 +10959,7 @@ function MeteredFeatures({
10220
10959
  }
10221
10960
  const Heading = `h${headingLevel}`;
10222
10961
  const NameHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
10223
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10962
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
10224
10963
  StatusFrame,
10225
10964
  {
10226
10965
  className: cx("schematic-metered-features", className),
@@ -10231,26 +10970,26 @@ function MeteredFeatures({
10231
10970
  loadingLabel: t("meteredFeaturesLoading"),
10232
10971
  onRetry: refetch,
10233
10972
  retryText: t("retry"),
10234
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MeteredFeaturesSkeleton, { showHeader }),
10973
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MeteredFeaturesSkeleton, { showHeader }),
10235
10974
  children: [
10236
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Heading, { className: "schematic-header__title", children: t("meteredFeaturesHeader") }) }),
10237
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ul", { className: "schematic-metered-features__list", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10975
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { className: "schematic-header__title", children: t("meteredFeaturesHeader") }) }),
10976
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "schematic-metered-features__list", children: rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
10238
10977
  "li",
10239
10978
  {
10240
10979
  className: "schematic-card schematic-metered-features__feature",
10241
10980
  "data-testid": "schematic-metered-feature",
10242
10981
  children: [
10243
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__main", children: [
10244
- showIcon && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-metered-features__icon", children: row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Icon, { name: row.icon }) }),
10245
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__body", children: [
10246
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__top", children: [
10247
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__title", children: [
10248
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
10249
- showDescription && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "schematic-muted", children: row.description })
10982
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__main", children: [
10983
+ showIcon && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-metered-features__icon", children: row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: row.icon }) }),
10984
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__body", children: [
10985
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__top", children: [
10986
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__title", children: [
10987
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
10988
+ showDescription && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-muted", children: row.description })
10250
10989
  ] }),
10251
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__figures", children: [
10252
- showUsage && row.headline !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
10253
- showAllocation && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10990
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__figures", children: [
10991
+ showUsage && row.headline !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
10992
+ showAllocation && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10254
10993
  LimitLine,
10255
10994
  {
10256
10995
  row,
@@ -10260,8 +10999,8 @@ function MeteredFeatures({
10260
10999
  )
10261
11000
  ] })
10262
11001
  ] }),
10263
- showMeter && row.meter !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Meter, { meter: row.meter }),
10264
- row.canAddMore && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11002
+ showMeter && row.meter !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Meter, { meter: row.meter }),
11003
+ row.canAddMore && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10265
11004
  AddMore,
10266
11005
  {
10267
11006
  label: t("meteredFeaturesAddMore"),
@@ -10272,8 +11011,8 @@ function MeteredFeatures({
10272
11011
  )
10273
11012
  ] })
10274
11013
  ] }),
10275
- showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UsageByUser, { locale, row, t }),
10276
- row.priceDetails !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11014
+ showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(UsageByUser, { locale, row, t }),
11015
+ row.priceDetails !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10277
11016
  PriceDetails,
10278
11017
  {
10279
11018
  details: row.priceDetails,
@@ -10337,9 +11076,9 @@ function LimitLine({
10337
11076
  if (parts.length === 0) {
10338
11077
  return null;
10339
11078
  }
10340
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-muted schematic-metered-features__limit", children: [
11079
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-muted schematic-metered-features__limit", children: [
10341
11080
  parts.join(" \u2022 "),
10342
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11081
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10343
11082
  amount: row.hardLimit.amount,
10344
11083
  units: row.hardLimit.units
10345
11084
  }) })
@@ -10353,8 +11092,8 @@ var METER_TONE_CLASS = {
10353
11092
  overage: "schematic-meter--overage"
10354
11093
  };
10355
11094
  function Meter({ meter: meter2 }) {
10356
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__meter", children: [
10357
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11095
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__meter", children: [
11096
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10358
11097
  "div",
10359
11098
  {
10360
11099
  "aria-valuemax": meter2.total,
@@ -10363,7 +11102,7 @@ function Meter({ meter: meter2 }) {
10363
11102
  className: cx("schematic-meter", METER_TONE_CLASS[meter2.tone]),
10364
11103
  "data-tone": meter2.tone,
10365
11104
  role: "meter",
10366
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11105
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10367
11106
  "div",
10368
11107
  {
10369
11108
  className: "schematic-meter__fill",
@@ -10372,7 +11111,7 @@ function Meter({ meter: meter2 }) {
10372
11111
  )
10373
11112
  }
10374
11113
  ),
10375
- meter2.total > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-metered-features__meter-label", children: [
11114
+ meter2.total > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-metered-features__meter-label", children: [
10376
11115
  meter2.valueText,
10377
11116
  "/",
10378
11117
  meter2.totalText
@@ -10386,7 +11125,7 @@ function AddMore({
10386
11125
  url
10387
11126
  }) {
10388
11127
  if (onAddMore !== void 0) {
10389
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11128
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10390
11129
  "button",
10391
11130
  {
10392
11131
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10397,7 +11136,7 @@ function AddMore({
10397
11136
  );
10398
11137
  }
10399
11138
  if (url !== void 0) {
10400
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11139
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10401
11140
  "a",
10402
11141
  {
10403
11142
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10417,38 +11156,38 @@ function PriceDetails({
10417
11156
  }) {
10418
11157
  const period = details.period === null ? void 0 : shortPeriod(details.period, t);
10419
11158
  if (details.kind === "overage") {
10420
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
10421
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-metered-features__price-label", children: [
11159
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
11160
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-metered-features__price-label", children: [
10422
11161
  t("meteredFeaturesAdditional"),
10423
11162
  ": ",
10424
11163
  details.unitPrice,
10425
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11164
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10426
11165
  "/",
10427
11166
  details.packageSize !== null && `${details.packageSize} `,
10428
11167
  details.units,
10429
11168
  period !== void 0 && `/${period}`
10430
11169
  ] })
10431
11170
  ] }),
10432
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-metered-features__price-cost", children: [
11171
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-metered-features__price-cost", children: [
10433
11172
  details.overage.amount,
10434
11173
  " ",
10435
11174
  details.overage.units,
10436
11175
  " \xB7 ",
10437
11176
  details.overage.cost,
10438
- period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11177
+ period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10439
11178
  "/",
10440
11179
  period
10441
11180
  ] })
10442
11181
  ] })
10443
11182
  ] });
10444
11183
  }
10445
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
10446
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-metered-features__price-label", children: [
11184
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
11185
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-metered-features__price-label", children: [
10447
11186
  t("meteredFeaturesTier"),
10448
11187
  ": ",
10449
11188
  details.from,
10450
11189
  details.to === null ? "+" : details.to !== details.from ? `\u2013${details.to}` : "",
10451
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11190
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10452
11191
  PriceTiers,
10453
11192
  {
10454
11193
  currency: details.tiers.currency,
@@ -10461,9 +11200,9 @@ function PriceDetails({
10461
11200
  }
10462
11201
  ) })
10463
11202
  ] }),
10464
- details.cost !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "schematic-metered-features__price-cost", children: [
11203
+ details.cost !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-metered-features__price-cost", children: [
10465
11204
  details.cost,
10466
- period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11205
+ period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10467
11206
  "/",
10468
11207
  period
10469
11208
  ] })
@@ -10475,8 +11214,8 @@ function UsageByUser({
10475
11214
  row,
10476
11215
  t
10477
11216
  }) {
10478
- const { data, error, refetch } = (0, import_schematic_react9.useFeatureUserUsage)(row.featureId);
10479
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11217
+ const { data, error, refetch } = (0, import_schematic_react10.useFeatureUserUsage)(row.featureId);
11218
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10480
11219
  UserBreakdown,
10481
11220
  {
10482
11221
  breakdown: data === void 0 ? void 0 : {
@@ -10498,20 +11237,20 @@ function UsageByUser({
10498
11237
  );
10499
11238
  }
10500
11239
  function MeteredFeaturesSkeleton({ showHeader }) {
10501
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-skeleton", children: [
10502
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__heading" }),
10503
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-skeleton__row", children: [
10504
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10505
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
11240
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton", children: [
11241
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__heading" }),
11242
+ [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton__row", children: [
11243
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11244
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
10506
11245
  ] }, index))
10507
11246
  ] });
10508
11247
  }
10509
11248
  MeteredFeatures.resources = ["featureUsage"];
10510
11249
 
10511
11250
  // src/elements/PlanManager.tsx
10512
- var import_schematic_react10 = require("@schematichq/schematic-react");
10513
- var import_react15 = require("react");
10514
- var import_jsx_runtime16 = require("react/jsx-runtime");
11251
+ var import_schematic_react11 = require("@schematichq/schematic-react");
11252
+ var import_react16 = require("react");
11253
+ var import_jsx_runtime17 = require("react/jsx-runtime");
10515
11254
  var VISIBLE_CREDIT_COUNT = 3;
10516
11255
  var UNIT_KEY = {
10517
11256
  day: "planManagerDays",
@@ -10548,20 +11287,20 @@ function PlanManager({
10548
11287
  showZeroPriceAsFree = false,
10549
11288
  strings
10550
11289
  }) {
10551
- const company = (0, import_schematic_react10.useCompany)();
10552
- const usage = (0, import_schematic_react10.useFeatureUsage)();
10553
- const credits = (0, import_schematic_react10.useCreditBalances)();
11290
+ const company = (0, import_schematic_react11.useCompany)();
11291
+ const usage = (0, import_schematic_react11.useFeatureUsage)();
11292
+ const credits = (0, import_schematic_react11.useCreditBalances)();
10554
11293
  const locale = useResolvedLocale(localeProp);
10555
11294
  const t = useTranslator(strings, localeProp);
10556
11295
  const creditsFailed = credits.data === void 0 && credits.error !== void 0;
10557
- const [creditsHaveFailed, setCreditsHaveFailed] = (0, import_react15.useState)(false);
11296
+ const [creditsHaveFailed, setCreditsHaveFailed] = (0, import_react16.useState)(false);
10558
11297
  if (creditsFailed && !creditsHaveFailed) {
10559
11298
  setCreditsHaveFailed(true);
10560
11299
  } else if (!creditsFailed && creditsHaveFailed && (credits.data !== void 0 || company.data === void 0 || usage.data === void 0)) {
10561
11300
  setCreditsHaveFailed(false);
10562
11301
  }
10563
11302
  const creditsSettled = !showCredits || credits.data !== void 0 || creditsHaveFailed;
10564
- const view = (0, import_react15.useMemo)(
11303
+ const view = (0, import_react16.useMemo)(
10565
11304
  () => company.data === void 0 || usage.data === void 0 || !creditsSettled ? void 0 : derivePlanManager(
10566
11305
  {
10567
11306
  company: company.data,
@@ -10599,7 +11338,7 @@ function PlanManager({
10599
11338
  }
10600
11339
  };
10601
11340
  const Heading = `h${headingLevel}`;
10602
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11341
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10603
11342
  StatusFrame,
10604
11343
  {
10605
11344
  className: cx("schematic-plan-manager", className),
@@ -10610,30 +11349,30 @@ function PlanManager({
10610
11349
  loadingLabel: t("planManagerLoading"),
10611
11350
  onRetry: retry,
10612
11351
  retryText: t("retry"),
10613
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlanManagerSkeleton, {}),
10614
- children: view !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
10615
- showNotice && view.notice !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Notice, { locale, notice: view.notice, t }),
10616
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-card schematic-plan-manager__card", children: [
10617
- showHeader && view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__plan", children: [
10618
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__title", children: [
10619
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
10620
- showDescription && view.plan.description !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-plan-manager__description", children: view.plan.description })
11352
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlanManagerSkeleton, {}),
11353
+ children: view !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
11354
+ showNotice && view.notice !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Notice, { locale, notice: view.notice, t }),
11355
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-card schematic-plan-manager__card", children: [
11356
+ showHeader && view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__plan", children: [
11357
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__title", children: [
11358
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
11359
+ showDescription && view.plan.description !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-plan-manager__description", children: view.plan.description })
10621
11360
  ] }),
10622
- showPrice && view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Price2, { price: view.plan.price, t })
11361
+ showPrice && view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Price2, { price: view.plan.price, t })
10623
11362
  ] }),
10624
- showAddOns && view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Section, { label: t("planManagerAddOns"), showLabel: showLabels, children: view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { className: "schematic-plan-manager__row", children: [
10625
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: addOn.name }),
10626
- addOn.price !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-plan-manager__price-value", children: [
11363
+ showAddOns && view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Section, { label: t("planManagerAddOns"), showLabel: showLabels, children: view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-plan-manager__row", children: [
11364
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-manager__item", children: addOn.name }),
11365
+ addOn.price !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-plan-manager__price-value", children: [
10627
11366
  addOn.price.amount,
10628
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PeriodSuffix, { period: addOn.price.period, t })
11367
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PeriodSuffix, { period: addOn.price.period, t })
10629
11368
  ] })
10630
11369
  ] }, addOn.id)) }),
10631
- showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11370
+ showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10632
11371
  Section,
10633
11372
  {
10634
11373
  label: t("planManagerUsageBased"),
10635
11374
  showLabel: showLabels,
10636
- children: view.usageBased.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11375
+ children: view.usageBased.map((row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10637
11376
  UsageBasedItem,
10638
11377
  {
10639
11378
  locale,
@@ -10645,7 +11384,7 @@ function PlanManager({
10645
11384
  ))
10646
11385
  }
10647
11386
  ),
10648
- showCredits && credits.data === void 0 && creditsHaveFailed && (credits.error !== void 0 || credits.isPending) && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11387
+ showCredits && credits.data === void 0 && creditsHaveFailed && (credits.error !== void 0 || credits.isPending) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10649
11388
  StatusFrame,
10650
11389
  {
10651
11390
  className: "schematic-plan-manager__section",
@@ -10659,11 +11398,11 @@ function PlanManager({
10659
11398
  children: null
10660
11399
  }
10661
11400
  ),
10662
- showCredits && view.planCredits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10663
- Truncated,
11401
+ showCredits && view.planCredits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11402
+ Truncated2,
10664
11403
  {
10665
11404
  locale,
10666
- after: view.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11405
+ after: view.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10667
11406
  AutoTopupBox,
10668
11407
  {
10669
11408
  lines: view.autoTopup.lines,
@@ -10677,43 +11416,43 @@ function PlanManager({
10677
11416
  rows: view.planCredits,
10678
11417
  showLabel: showLabels,
10679
11418
  t,
10680
- children: (row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlanCreditItem, { row, t }, row.creditId)
11419
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PlanCreditItem, { row, t }, row.creditId)
10681
11420
  }
10682
11421
  ),
10683
- showCredits && view.topUps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10684
- Truncated,
11422
+ showCredits && view.topUps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11423
+ Truncated2,
10685
11424
  {
10686
11425
  locale,
10687
11426
  label: t("planManagerTopUps"),
10688
11427
  rows: view.topUps,
10689
11428
  showLabel: showLabels,
10690
11429
  t,
10691
- children: (row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CreditGroupItem, { countAlways: true, row, t }, row.key)
11430
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreditGroupItem, { countAlways: true, row, t }, row.key)
10692
11431
  }
10693
11432
  ),
10694
- showCredits && view.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10695
- Truncated,
11433
+ showCredits && view.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11434
+ Truncated2,
10696
11435
  {
10697
11436
  locale,
10698
11437
  label: t("planManagerCreditBundles"),
10699
11438
  rows: view.bundles,
10700
11439
  showLabel: showLabels,
10701
11440
  t,
10702
- children: (row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CreditGroupItem, { row, t }, row.key)
11441
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreditGroupItem, { row, t }, row.key)
10703
11442
  }
10704
11443
  ),
10705
- showCredits && view.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10706
- Truncated,
11444
+ showCredits && view.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11445
+ Truncated2,
10707
11446
  {
10708
11447
  locale,
10709
11448
  label: t("planManagerPromotionalCredits"),
10710
11449
  rows: view.promotional,
10711
11450
  showLabel: showLabels,
10712
11451
  t,
10713
- children: (row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CreditGroupItem, { plain: true, row, t }, row.key)
11452
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CreditGroupItem, { plain: true, row, t }, row.key)
10714
11453
  }
10715
11454
  ),
10716
- view.canChangePlan && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11455
+ view.canChangePlan && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10717
11456
  Cta,
10718
11457
  {
10719
11458
  className: "schematic-cta schematic-plan-manager__change-plan",
@@ -10770,16 +11509,16 @@ function Notice({
10770
11509
  if (title === null && body === null) {
10771
11510
  return null;
10772
11511
  }
10773
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11512
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10774
11513
  "div",
10775
11514
  {
10776
11515
  className: "schematic-plan-manager__notice",
10777
11516
  "data-kind": notice2.kind,
10778
11517
  role: "status",
10779
11518
  children: [
10780
- title !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-plan-manager__notice-title", children: title }),
10781
- body !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
10782
- payUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11519
+ title !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-plan-manager__notice-title", children: title }),
11520
+ body !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
11521
+ payUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10783
11522
  "a",
10784
11523
  {
10785
11524
  className: "schematic-cta schematic-plan-manager__pay-now",
@@ -10794,14 +11533,14 @@ function Notice({
10794
11533
  );
10795
11534
  }
10796
11535
  function Price2({ price, t }) {
10797
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__price", children: [
11536
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__price", children: [
10798
11537
  price.kind === "usageBased" ? t("planManagerUsageBased") : price.kind === "free" ? t("planManagerFree") : price.amount,
10799
- price.kind === "amount" && price.period !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PeriodSuffix, { period: price.period, t })
11538
+ price.kind === "amount" && price.period !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PeriodSuffix, { period: price.period, t })
10800
11539
  ] });
10801
11540
  }
10802
11541
  function PeriodSuffix({ period, t }) {
10803
11542
  const short = shortPeriod(period, t);
10804
- return short === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
11543
+ return short === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { children: [
10805
11544
  "/",
10806
11545
  short
10807
11546
  ] });
@@ -10811,12 +11550,12 @@ function Section({
10811
11550
  label,
10812
11551
  showLabel
10813
11552
  }) {
10814
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10815
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10816
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "schematic-plan-manager__rows", children })
11553
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
11554
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
11555
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "schematic-plan-manager__rows", children })
10817
11556
  ] });
10818
11557
  }
10819
- function Truncated({
11558
+ function Truncated2({
10820
11559
  after,
10821
11560
  children,
10822
11561
  label,
@@ -10825,12 +11564,12 @@ function Truncated({
10825
11564
  showLabel,
10826
11565
  t
10827
11566
  }) {
10828
- const [expanded, setExpanded] = (0, import_react15.useState)(false);
11567
+ const [expanded, setExpanded] = (0, import_react16.useState)(false);
10829
11568
  const shown = expanded ? rows : rows.slice(0, VISIBLE_CREDIT_COUNT);
10830
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10831
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10832
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
10833
- rows.length > VISIBLE_CREDIT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11569
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
11570
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
11571
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
11572
+ rows.length > VISIBLE_CREDIT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10834
11573
  "button",
10835
11574
  {
10836
11575
  "aria-expanded": expanded,
@@ -10838,14 +11577,14 @@ function Truncated({
10838
11577
  type: "button",
10839
11578
  onClick: () => setExpanded((value) => !value),
10840
11579
  children: [
10841
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11580
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10842
11581
  "i",
10843
11582
  {
10844
11583
  "aria-hidden": "true",
10845
11584
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
10846
11585
  }
10847
11586
  ),
10848
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("planManagerHideAll") : t("planManagerSeeAll", {
11587
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("planManagerHideAll") : t("planManagerSeeAll", {
10849
11588
  total: formatNumber(rows.length, locale)
10850
11589
  }) })
10851
11590
  ]
@@ -10870,9 +11609,9 @@ function UsageBasedItem({
10870
11609
  if (row.unitPrice !== null) {
10871
11610
  const short = row.unitPrice.period === null ? void 0 : shortPeriod(row.unitPrice.period, t);
10872
11611
  details.push(
10873
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
11612
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
10874
11613
  row.unitPrice.cost,
10875
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
11614
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { children: [
10876
11615
  "/",
10877
11616
  row.unitPrice.packageSize !== null && `${row.unitPrice.packageSize} `,
10878
11617
  row.unitPrice.units,
@@ -10887,23 +11626,23 @@ function UsageBasedItem({
10887
11626
  );
10888
11627
  }
10889
11628
  const costPeriod = row.cost?.period === null || row.cost === null ? void 0 : shortPeriod(row.cost.period, t);
10890
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11629
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10891
11630
  "li",
10892
11631
  {
10893
11632
  className: "schematic-plan-manager__row",
10894
11633
  "data-testid": "schematic-usage-based",
10895
11634
  children: [
10896
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
10897
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-plan-manager__detail", children: [
10898
- details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-small", children: details }),
10899
- row.cost !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
11635
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
11636
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-plan-manager__detail", children: [
11637
+ details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-small", children: details }),
11638
+ row.cost !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
10900
11639
  row.cost.amount,
10901
- costPeriod !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
11640
+ costPeriod !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { children: [
10902
11641
  "/",
10903
11642
  costPeriod
10904
11643
  ] })
10905
11644
  ] }),
10906
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11645
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10907
11646
  PriceTiers,
10908
11647
  {
10909
11648
  currency: row.tiers.currency,
@@ -10915,7 +11654,7 @@ function UsageBasedItem({
10915
11654
  unit: row.tiers.unit
10916
11655
  }
10917
11656
  ) }),
10918
- showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11657
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
10919
11658
  amount: row.hardLimit.amount,
10920
11659
  units: row.hardLimit.units
10921
11660
  }) })
@@ -10927,14 +11666,14 @@ function UsageBasedItem({
10927
11666
  function PlanCreditItem({ row, t }) {
10928
11667
  const text = row.text;
10929
11668
  const composition = row.composition;
10930
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11669
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10931
11670
  "li",
10932
11671
  {
10933
11672
  className: "schematic-plan-manager__row schematic-plan-manager__row--stacked",
10934
11673
  "data-testid": "schematic-plan-credit",
10935
11674
  children: [
10936
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__row-main", children: [
10937
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: text.kind === "perLicense" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
11675
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__row-main", children: [
11676
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-manager__item", children: text.kind === "perLicense" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
10938
11677
  t("planManagerCreditsPerLicense", {
10939
11678
  amount: text.amount,
10940
11679
  creditName: text.creditName,
@@ -10953,15 +11692,15 @@ function PlanCreditItem({ row, t }) {
10953
11692
  creditName: text.creditName,
10954
11693
  period: periodWord(text.period, t)
10955
11694
  }) }),
10956
- row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: [
11695
+ row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: [
10957
11696
  t("planManagerUsed", { amount: row.used }),
10958
- row.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Tooltip, { label: t("planManagerAutoTopup"), children: t("planManagerAutoTopupTip", {
11697
+ row.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: t("planManagerAutoTopup"), children: t("planManagerAutoTopupTip", {
10959
11698
  amount: row.autoTopup.amount,
10960
11699
  threshold: row.autoTopup.threshold
10961
11700
  }) })
10962
11701
  ] })
10963
11702
  ] }),
10964
- composition !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-small", children: t(
11703
+ composition !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-small", children: t(
10965
11704
  composition.fixed === null ? "planManagerLicensesTimesCredits" : "planManagerLicensesTimesCreditsPlusCompany",
10966
11705
  {
10967
11706
  creditName: composition.creditName,
@@ -10986,21 +11725,21 @@ function CreditGroupItem({
10986
11725
  const named = !plain && row.bundleName !== null;
10987
11726
  const showCount = !plain && row.count > 1 && (named || countAlways);
10988
11727
  const amount = `${row.quantity} ${row.creditName}`;
10989
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11728
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10990
11729
  "li",
10991
11730
  {
10992
11731
  className: "schematic-plan-manager__row",
10993
11732
  "data-testid": "schematic-credit-group",
10994
11733
  children: [
10995
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-plan-manager__item", children: [
10996
- showCount && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-muted", children: [
11734
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-plan-manager__item", children: [
11735
+ showCount && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-muted", children: [
10997
11736
  "(",
10998
11737
  row.count,
10999
11738
  ") "
11000
11739
  ] }),
11001
11740
  named ? `${row.bundleName} (${amount})` : amount
11002
11741
  ] }),
11003
- row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: t("planManagerUsed", { amount: row.used }) })
11742
+ row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: t("planManagerUsed", { amount: row.used }) })
11004
11743
  ]
11005
11744
  }
11006
11745
  );
@@ -11012,16 +11751,16 @@ function AutoTopupBox({
11012
11751
  target,
11013
11752
  url
11014
11753
  }) {
11015
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__auto-topup", children: [
11016
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
11017
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
11018
- lines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: line.kind === "disabled" ? t("planManagerAutoTopupDisabled", { unit: line.unit }) : t("planManagerAutoTopupAdds", {
11754
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__auto-topup", children: [
11755
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
11756
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
11757
+ lines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: line.kind === "disabled" ? t("planManagerAutoTopupDisabled", { unit: line.unit }) : t("planManagerAutoTopupAdds", {
11019
11758
  amount: line.amount,
11020
11759
  threshold: line.threshold,
11021
11760
  unit: line.unit
11022
11761
  }) }, line.creditId))
11023
11762
  ] }),
11024
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11763
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11025
11764
  Cta,
11026
11765
  {
11027
11766
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-plan-manager__edit",
@@ -11041,10 +11780,10 @@ function Cta({
11041
11780
  url
11042
11781
  }) {
11043
11782
  if (onClick !== void 0) {
11044
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { className, type: "button", onClick, children: label });
11783
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className, type: "button", onClick, children: label });
11045
11784
  }
11046
11785
  if (url !== void 0) {
11047
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { className, href: url, target, children: label });
11786
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("a", { className, href: url, target, children: label });
11048
11787
  }
11049
11788
  return null;
11050
11789
  }
@@ -11053,20 +11792,20 @@ function periodWord(period, t) {
11053
11792
  return key === void 0 ? period : t(key);
11054
11793
  }
11055
11794
  function PlanManagerSkeleton() {
11056
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton", children: [
11057
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__heading" }),
11058
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton__row", children: [
11059
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11060
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11795
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton", children: [
11796
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__heading" }),
11797
+ [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton__row", children: [
11798
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11799
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11061
11800
  ] }, index))
11062
11801
  ] });
11063
11802
  }
11064
11803
  PlanManager.resources = ["company", "featureUsage", "creditBalances"];
11065
11804
 
11066
11805
  // src/elements/PricingTable.tsx
11067
- var import_schematic_react11 = require("@schematichq/schematic-react");
11068
- var import_react16 = require("react");
11069
- var import_jsx_runtime17 = require("react/jsx-runtime");
11806
+ var import_schematic_react12 = require("@schematichq/schematic-react");
11807
+ var import_react17 = require("react");
11808
+ var import_jsx_runtime18 = require("react/jsx-runtime");
11070
11809
  var VISIBLE_ENTITLEMENT_COUNT = 4;
11071
11810
  var CARD_HEADING = {
11072
11811
  1: "h2",
@@ -11118,17 +11857,17 @@ function PricingTable({
11118
11857
  showZeroPriceAsFree = false,
11119
11858
  strings
11120
11859
  }) {
11121
- const catalog = (0, import_schematic_react11.useCatalog)(catalogId === void 0 ? {} : { catalogId });
11122
- const company = (0, import_schematic_react11.useCompany)();
11860
+ const catalog = (0, import_schematic_react12.useCatalog)(catalogId === void 0 ? {} : { catalogId });
11861
+ const company = (0, import_schematic_react12.useCompany)();
11123
11862
  const locale = useResolvedLocale(localeProp);
11124
11863
  const t = useTranslator(strings, localeProp);
11125
- const [chosenPeriod, setChosenPeriod] = (0, import_react16.useState)(defaultPeriod);
11126
- const [chosenCurrency, setChosenCurrency] = (0, import_react16.useState)(defaultCurrency);
11864
+ const [chosenPeriod, setChosenPeriod] = (0, import_react17.useState)(defaultPeriod);
11865
+ const [chosenCurrency, setChosenCurrency] = (0, import_react17.useState)(defaultCurrency);
11127
11866
  const askedPeriod = periodProp ?? chosenPeriod;
11128
11867
  const askedCurrency = currencyProp ?? chosenCurrency;
11129
11868
  const companyMode = catalog.data?.source === "company";
11130
11869
  const companySettled = !companyMode || company.data !== void 0 || company.error !== void 0;
11131
- const view = (0, import_react16.useMemo)(
11870
+ const view = (0, import_react17.useMemo)(
11132
11871
  () => catalog.data === void 0 || !companySettled ? void 0 : derivePricingTable(catalog.data, {
11133
11872
  locale,
11134
11873
  period: askedPeriod,
@@ -11183,7 +11922,7 @@ function PricingTable({
11183
11922
  };
11184
11923
  const plansShown = showPlans && view !== void 0 && (view.plans.length > 0 || view.customPlan !== null);
11185
11924
  const addOnsShown = showAddOns && view !== void 0 && view.addOns.length > 0;
11186
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11925
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11187
11926
  StatusFrame,
11188
11927
  {
11189
11928
  className: cx("schematic-pricing-table", className),
@@ -11194,10 +11933,10 @@ function PricingTable({
11194
11933
  loadingLabel: t("pricingTableLoading"),
11195
11934
  onRetry: catalog.refetch,
11196
11935
  retryText: t("retry"),
11197
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PricingTableSkeleton, {}),
11198
- children: view !== void 0 && shared !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
11199
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11200
- (plansShown || addOnsShown) && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11936
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PricingTableSkeleton, {}),
11937
+ children: view !== void 0 && shared !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
11938
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11939
+ (plansShown || addOnsShown) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11201
11940
  Controls,
11202
11941
  {
11203
11942
  currencies: showCurrencySelector ? view.currencies : [],
@@ -11212,13 +11951,13 @@ function PricingTable({
11212
11951
  t
11213
11952
  }
11214
11953
  ),
11215
- plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
11954
+ plansShown && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11216
11955
  "ul",
11217
11956
  {
11218
11957
  "aria-label": t("pricingTablePlans"),
11219
11958
  className: "schematic-pricing-table__plans",
11220
11959
  children: [
11221
- view.plans.map((plan, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11960
+ view.plans.map((plan, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11222
11961
  Card2,
11223
11962
  {
11224
11963
  card: plan,
@@ -11228,7 +11967,7 @@ function PricingTable({
11228
11967
  },
11229
11968
  plan.id
11230
11969
  )),
11231
- view.customPlan !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11970
+ view.customPlan !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11232
11971
  CustomPlanCard2,
11233
11972
  {
11234
11973
  customPlan: view.customPlan,
@@ -11238,10 +11977,10 @@ function PricingTable({
11238
11977
  ]
11239
11978
  }
11240
11979
  ),
11241
- addOnsShown && !plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AddOnList, { shared })
11980
+ addOnsShown && !plansShown && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AddOnList, { shared })
11242
11981
  ] }),
11243
- addOnsShown && plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11244
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11982
+ addOnsShown && plansShown && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11983
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11245
11984
  SectionHeading,
11246
11985
  {
11247
11986
  className: "schematic-pricing-table__heading",
@@ -11249,19 +11988,19 @@ function PricingTable({
11249
11988
  children: t("pricingTableAddOns")
11250
11989
  }
11251
11990
  ),
11252
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AddOnList, { shared })
11991
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AddOnList, { shared })
11253
11992
  ] })
11254
11993
  ] })
11255
11994
  }
11256
11995
  );
11257
11996
  }
11258
11997
  function AddOnList({ shared }) {
11259
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11998
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11260
11999
  "ul",
11261
12000
  {
11262
12001
  "aria-label": shared.t("pricingTableAddOns"),
11263
12002
  className: "schematic-pricing-table__plans",
11264
- children: shared.view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12003
+ children: shared.view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11265
12004
  Card2,
11266
12005
  {
11267
12006
  card: addOn,
@@ -11280,7 +12019,7 @@ function SectionHeading({
11280
12019
  level
11281
12020
  }) {
11282
12021
  const Heading = `h${level}`;
11283
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Heading, { className, children });
12022
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { className, children });
11284
12023
  }
11285
12024
  function Controls({
11286
12025
  currencies,
@@ -11299,8 +12038,8 @@ function Controls({
11299
12038
  if (heading === null && !showCurrencies && !showPeriods) {
11300
12039
  return null;
11301
12040
  }
11302
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-pricing-table__header", children: [
11303
- heading !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12041
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-pricing-table__header", children: [
12042
+ heading !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11304
12043
  SectionHeading,
11305
12044
  {
11306
12045
  className: "schematic-pricing-table__heading",
@@ -11308,15 +12047,15 @@ function Controls({
11308
12047
  children: heading
11309
12048
  }
11310
12049
  ),
11311
- (showCurrencies || showPeriods) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-pricing-table__controls", children: [
11312
- showCurrencies && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12050
+ (showCurrencies || showPeriods) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-pricing-table__controls", children: [
12051
+ showCurrencies && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11313
12052
  "select",
11314
12053
  {
11315
12054
  "aria-label": t("pricingTableCurrency"),
11316
12055
  className: "schematic-select",
11317
12056
  value: currency,
11318
12057
  onChange: (event) => onCurrency(event.target.value),
11319
- children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12058
+ children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11320
12059
  "option",
11321
12060
  {
11322
12061
  className: "schematic-select__option",
@@ -11327,14 +12066,14 @@ function Controls({
11327
12066
  ))
11328
12067
  }
11329
12068
  ),
11330
- showPeriods && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12069
+ showPeriods && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11331
12070
  "div",
11332
12071
  {
11333
12072
  "aria-label": t("pricingTablePeriod"),
11334
12073
  className: "schematic-toggle",
11335
12074
  role: "group",
11336
12075
  children: periods.map((option) => {
11337
- const button = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12076
+ const button = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11338
12077
  "button",
11339
12078
  {
11340
12079
  "aria-pressed": option === period,
@@ -11353,9 +12092,9 @@ function Controls({
11353
12092
  if (saved === void 0 || option === "month") {
11354
12093
  return button;
11355
12094
  }
11356
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-toggle__tip", children: [
12095
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "schematic-toggle__tip", children: [
11357
12096
  button,
11358
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12097
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11359
12098
  "span",
11360
12099
  {
11361
12100
  className: "schematic-tooltip__content schematic-toggle__tip-content",
@@ -11380,11 +12119,11 @@ function Card2({
11380
12119
  shared
11381
12120
  }) {
11382
12121
  const { headingLevel, t, view } = shared;
11383
- const [expanded, setExpanded] = (0, import_react16.useState)(false);
11384
- const listId = (0, import_react16.useId)();
12122
+ const [expanded, setExpanded] = (0, import_react17.useState)(false);
12123
+ const listId = (0, import_react17.useId)();
11385
12124
  const Name = CARD_HEADING[headingLevel];
11386
12125
  const entitlements = expanded ? card2.entitlements : card2.entitlements.slice(0, VISIBLE_ENTITLEMENT_COUNT);
11387
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
12126
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11388
12127
  "li",
11389
12128
  {
11390
12129
  className: cx(
@@ -11394,11 +12133,11 @@ function Card2({
11394
12133
  ),
11395
12134
  "data-plan-id": card2.id,
11396
12135
  children: [
11397
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__header", children: [
11398
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Name, { className: "schematic-plan-card__name", children: card2.name }),
11399
- shared.showDescription && card2.description !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-plan-card__description", children: card2.description }),
11400
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Price3, { price: card2.price, t }),
11401
- shared.showCredits && card2.credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: "schematic-plan-card__credits", children: card2.credits.map((credit) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12136
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__header", children: [
12137
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Name, { className: "schematic-plan-card__name", children: card2.name }),
12138
+ shared.showDescription && card2.description !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "schematic-plan-card__description", children: card2.description }),
12139
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Price3, { price: card2.price, t }),
12140
+ shared.showCredits && card2.credits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("ul", { className: "schematic-plan-card__credits", children: card2.credits.map((credit) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11402
12141
  CreditItem,
11403
12142
  {
11404
12143
  credit,
@@ -11407,16 +12146,16 @@ function Card2({
11407
12146
  },
11408
12147
  `${credit.creditId}:${credit.perLicense ?? ""}`
11409
12148
  )) }),
11410
- card2.active && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-badge schematic-plan-card__badge", children: kind === "plan" && view.trialDaysLeft !== null ? t("pricingTableTrialLeft", {
12149
+ card2.active && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-badge schematic-plan-card__badge", children: kind === "plan" && view.trialDaysLeft !== null ? t("pricingTableTrialLeft", {
11411
12150
  count: view.trialDaysLeft.count,
11412
12151
  days: view.trialDaysLeft.days
11413
12152
  }) : t("pricingTableActive") })
11414
12153
  ] }),
11415
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__body", children: [
11416
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__features", children: [
11417
- shared.showEntitlements && card2.entitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("ul", { className: "schematic-plan-card__entitlements", id: listId, children: [
11418
- inclusion !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: "schematic-plan-card__inclusion", children: t("pricingTableEverythingIn", { plan: inclusion }) }),
11419
- entitlements.map((row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12154
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__body", children: [
12155
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__features", children: [
12156
+ shared.showEntitlements && card2.entitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("ul", { className: "schematic-plan-card__entitlements", id: listId, children: [
12157
+ inclusion !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { className: "schematic-plan-card__inclusion", children: t("pricingTableEverythingIn", { plan: inclusion }) }),
12158
+ entitlements.map((row) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11420
12159
  EntitlementItem,
11421
12160
  {
11422
12161
  row,
@@ -11425,7 +12164,7 @@ function Card2({
11425
12164
  row.featureId
11426
12165
  ))
11427
12166
  ] }),
11428
- shared.showEntitlements && card2.entitlements.length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
12167
+ shared.showEntitlements && card2.entitlements.length > VISIBLE_ENTITLEMENT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11429
12168
  "button",
11430
12169
  {
11431
12170
  "aria-controls": listId,
@@ -11434,19 +12173,19 @@ function Card2({
11434
12173
  type: "button",
11435
12174
  onClick: () => setExpanded((value) => !value),
11436
12175
  children: [
11437
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12176
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11438
12177
  "i",
11439
12178
  {
11440
12179
  "aria-hidden": "true",
11441
12180
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
11442
12181
  }
11443
12182
  ),
11444
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("pricingTableHideAll") : t("pricingTableSeeAll") })
12183
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("pricingTableHideAll") : t("pricingTableSeeAll") })
11445
12184
  ]
11446
12185
  }
11447
12186
  )
11448
12187
  ] }),
11449
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Action, { card: card2, kind, shared })
12188
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Action, { card: card2, kind, shared })
11450
12189
  ] })
11451
12190
  ]
11452
12191
  }
@@ -11454,9 +12193,9 @@ function Card2({
11454
12193
  }
11455
12194
  function Price3({ price, t }) {
11456
12195
  const per = price.kind === "amount" && price.period !== null ? periodWord2(price.period, t) : void 0;
11457
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__price", children: [
12196
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__price", children: [
11458
12197
  priceText2(price, t),
11459
- per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { className: "schematic-plan-card__period", children: [
12198
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { className: "schematic-plan-card__period", children: [
11460
12199
  "/",
11461
12200
  per
11462
12201
  ] })
@@ -11496,11 +12235,11 @@ function CreditItem({
11496
12235
  amount: credit.amount,
11497
12236
  creditName: credit.creditName
11498
12237
  });
11499
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-plan-card__credit", children: [
11500
- showIcon && credit.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "schematic-plan-card__icon", name: credit.icon }),
11501
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__feature", children: [
11502
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-card__feature-text", children: text }),
11503
- credit.plus !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-muted schematic-plan-card__detail", children: credit.plus.period === null ? t("pricingTableCreditsPlus", {
12238
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "schematic-plan-card__credit", children: [
12239
+ showIcon && credit.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "schematic-plan-card__icon", name: credit.icon }),
12240
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__feature", children: [
12241
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-plan-card__feature-text", children: text }),
12242
+ credit.plus !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted schematic-plan-card__detail", children: credit.plus.period === null ? t("pricingTableCreditsPlus", {
11504
12243
  amount: credit.plus.amount,
11505
12244
  creditName: credit.plus.creditName
11506
12245
  }) : t("pricingTableCreditsPlusPerPeriod", {
@@ -11516,16 +12255,16 @@ function EntitlementItem({
11516
12255
  shared
11517
12256
  }) {
11518
12257
  const { locale, t } = shared;
11519
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-plan-card__entitlement", children: [
11520
- shared.showFeatureIcons && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "schematic-plan-card__icon", name: row.icon }),
11521
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__feature", children: [
11522
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-card__feature-text", children: entitlementText3(row, t) }),
11523
- (row.detail !== null || shared.showHardLimit && row.hardLimit !== null) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "schematic-muted schematic-plan-card__detail", children: [
12258
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "schematic-plan-card__entitlement", children: [
12259
+ shared.showFeatureIcons && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Icon, { className: "schematic-plan-card__icon", name: row.icon }),
12260
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__feature", children: [
12261
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-plan-card__feature-text", children: entitlementText3(row, t) }),
12262
+ (row.detail !== null || shared.showHardLimit && row.hardLimit !== null) && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "schematic-muted schematic-plan-card__detail", children: [
11524
12263
  row.detail?.kind === "overage" && t("pricingTableThen", {
11525
12264
  price: unitPrice2(row.detail, t)
11526
12265
  }),
11527
12266
  row.detail?.kind === "tiered" && t("pricingTableTierBased"),
11528
- row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12267
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11529
12268
  PriceTiers,
11530
12269
  {
11531
12270
  currency: row.tiers.currency,
@@ -11537,12 +12276,12 @@ function EntitlementItem({
11537
12276
  unit: row.tiers.unit
11538
12277
  }
11539
12278
  ) }),
11540
- shared.showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
12279
+ shared.showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
11541
12280
  amount: row.hardLimit.amount,
11542
12281
  units: row.hardLimit.units
11543
12282
  }) })
11544
12283
  ] }),
11545
- shared.showFeatureDescriptions && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-muted schematic-small schematic-plan-card__feature-description", children: row.description })
12284
+ shared.showFeatureDescriptions && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "schematic-muted schematic-small schematic-plan-card__feature-description", children: row.description })
11546
12285
  ] })
11547
12286
  ] });
11548
12287
  }
@@ -11610,8 +12349,8 @@ function Action({
11610
12349
  upgrade: true
11611
12350
  };
11612
12351
  if (action2.kind === "current") {
11613
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__current", children: [
11614
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12352
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__current", children: [
12353
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11615
12354
  "i",
11616
12355
  {
11617
12356
  "aria-hidden": "true",
@@ -11626,7 +12365,7 @@ function Action({
11626
12365
  if (link === void 0 && shared.onSelectPlan === void 0) {
11627
12366
  return null;
11628
12367
  }
11629
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12368
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11630
12369
  CallToAction,
11631
12370
  {
11632
12371
  className: "schematic-cta",
@@ -11636,7 +12375,7 @@ function Action({
11636
12375
  );
11637
12376
  }
11638
12377
  if (action2.kind === "downgradeBlocked") {
11639
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12378
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11640
12379
  CallToAction,
11641
12380
  {
11642
12381
  className: "schematic-cta schematic-cta--outline",
@@ -11666,8 +12405,8 @@ function Action({
11666
12405
  action2.kind === "remove" && "schematic-cta--ghost",
11667
12406
  action2.kind === "change" && "schematic-cta--outline"
11668
12407
  );
11669
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__action", children: [
11670
- shared.onSelectPlan !== void 0 || disabled ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12408
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__action", children: [
12409
+ shared.onSelectPlan !== void 0 || disabled ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11671
12410
  "button",
11672
12411
  {
11673
12412
  className,
@@ -11676,7 +12415,7 @@ function Action({
11676
12415
  onClick: select,
11677
12416
  children: label
11678
12417
  }
11679
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12418
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11680
12419
  "a",
11681
12420
  {
11682
12421
  className,
@@ -11685,7 +12424,7 @@ function Action({
11685
12424
  children: label
11686
12425
  }
11687
12426
  ),
11688
- action2.kind === "overLimit" && action2.violations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-muted schematic-small schematic-plan-card__violations", children: t("pricingTableOverLimitDetail", {
12427
+ action2.kind === "overLimit" && action2.violations.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "schematic-muted schematic-small schematic-plan-card__violations", children: t("pricingTableOverLimitDetail", {
11689
12428
  features: conjunction(
11690
12429
  action2.violations.map((violation) => violation.featureName),
11691
12430
  locale
@@ -11707,7 +12446,7 @@ function CallToAction({
11707
12446
  link,
11708
12447
  text
11709
12448
  }) {
11710
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-plan-card__action", children: link === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { className, disabled: true, type: "button", children: text }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12449
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-plan-card__action", children: link === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { className, disabled: true, type: "button", children: text }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11711
12450
  "a",
11712
12451
  {
11713
12452
  className,
@@ -11724,12 +12463,12 @@ function CustomPlanCard2({
11724
12463
  }) {
11725
12464
  const { headingLevel, t } = shared;
11726
12465
  const Name = CARD_HEADING[headingLevel];
11727
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-card schematic-plan-card schematic-plan-card--custom", children: [
11728
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__header", children: [
11729
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Name, { className: "schematic-plan-card__name", children: t("pricingTableCustomPlan") }),
11730
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-plan-card__price", children: customPlan.priceText ?? t("pricingTableCustomPrice") })
12466
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("li", { className: "schematic-card schematic-plan-card schematic-plan-card--custom", children: [
12467
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-plan-card__header", children: [
12468
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Name, { className: "schematic-plan-card__name", children: t("pricingTableCustomPlan") }),
12469
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-plan-card__price", children: customPlan.priceText ?? t("pricingTableCustomPrice") })
11731
12470
  ] }),
11732
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-plan-card__body", children: customPlan.ctaUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-plan-card__action", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12471
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-plan-card__body", children: customPlan.ctaUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-plan-card__action", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11733
12472
  "a",
11734
12473
  {
11735
12474
  className: "schematic-cta",
@@ -11750,20 +12489,20 @@ function periodWord2(period, t) {
11750
12489
  return key === void 0 ? period : t(key);
11751
12490
  }
11752
12491
  function PricingTableSkeleton() {
11753
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton", children: [
11754
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__heading" }),
11755
- [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton__row", children: [
11756
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11757
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "price" })
12492
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-skeleton", children: [
12493
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-skeleton__heading" }),
12494
+ [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-skeleton__row", children: [
12495
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
12496
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "price" })
11758
12497
  ] }, index))
11759
12498
  ] });
11760
12499
  }
11761
12500
  PricingTable.resources = ["catalog", "publicCatalog", "company"];
11762
12501
 
11763
12502
  // src/elements/UnsubscribeButton.tsx
11764
- var import_schematic_react12 = require("@schematichq/schematic-react");
11765
- var import_react17 = require("react");
11766
- var import_jsx_runtime18 = require("react/jsx-runtime");
12503
+ var import_schematic_react13 = require("@schematichq/schematic-react");
12504
+ var import_react18 = require("react");
12505
+ var import_jsx_runtime19 = require("react/jsx-runtime");
11767
12506
  var TOTAL_KEY = {
11768
12507
  quarter: "unsubscribeQuarterlyTotal",
11769
12508
  year: "unsubscribeYearlyTotal"
@@ -11777,14 +12516,14 @@ function UnsubscribeButton({
11777
12516
  onUnsubscribed,
11778
12517
  strings
11779
12518
  }) {
11780
- const company = (0, import_schematic_react12.useCompany)();
11781
- const usage = (0, import_schematic_react12.useFeatureUsage)();
11782
- const { isMutating, unsubscribe } = (0, import_schematic_react12.useUnsubscribe)();
12519
+ const company = (0, import_schematic_react13.useCompany)();
12520
+ const usage = (0, import_schematic_react13.useFeatureUsage)();
12521
+ const { isMutating, unsubscribe } = (0, import_schematic_react13.useUnsubscribe)();
11783
12522
  const locale = useResolvedLocale(localeProp);
11784
12523
  const t = useTranslator(strings, localeProp);
11785
- const [open, setOpen] = (0, import_react17.useState)(false);
11786
- const [failed, setFailed] = (0, import_react17.useState)(false);
11787
- const view = (0, import_react17.useMemo)(
12524
+ const [open, setOpen] = (0, import_react18.useState)(false);
12525
+ const [failed, setFailed] = (0, import_react18.useState)(false);
12526
+ const view = (0, import_react18.useMemo)(
11788
12527
  () => company.data === void 0 || usage.data === void 0 ? void 0 : deriveUnsubscribe(company.data, usage.data, { locale }),
11789
12528
  [company.data, locale, usage.data]
11790
12529
  );
@@ -11793,7 +12532,7 @@ function UnsubscribeButton({
11793
12532
  if (error === void 0) {
11794
12533
  return null;
11795
12534
  }
11796
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12535
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11797
12536
  StatusFrame,
11798
12537
  {
11799
12538
  className: cx("schematic-card", "schematic-unsubscribe", className),
@@ -11833,7 +12572,7 @@ function UnsubscribeButton({
11833
12572
  onUnsubscribed?.();
11834
12573
  };
11835
12574
  const per = shortPeriod(view.period, t);
11836
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
12575
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11837
12576
  "div",
11838
12577
  {
11839
12578
  className: cx(
@@ -11843,7 +12582,7 @@ function UnsubscribeButton({
11843
12582
  className
11844
12583
  ),
11845
12584
  children: [
11846
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12585
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11847
12586
  "button",
11848
12587
  {
11849
12588
  className: "schematic-cta schematic-unsubscribe__open",
@@ -11855,7 +12594,7 @@ function UnsubscribeButton({
11855
12594
  children: t("unsubscribeButton")
11856
12595
  }
11857
12596
  ),
11858
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12597
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11859
12598
  Dialog,
11860
12599
  {
11861
12600
  className: "schematic-unsubscribe__dialog",
@@ -11863,10 +12602,10 @@ function UnsubscribeButton({
11863
12602
  open,
11864
12603
  title: t("unsubscribeTitle"),
11865
12604
  onClose: close,
11866
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__columns", children: [
11867
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__summary", children: [
11868
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
11869
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12605
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__columns", children: [
12606
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__summary", children: [
12607
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
12608
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11870
12609
  ManagePlan,
11871
12610
  {
11872
12611
  onClick: onManagePlan,
@@ -11876,44 +12615,44 @@ function UnsubscribeButton({
11876
12615
  }
11877
12616
  )
11878
12617
  ] }),
11879
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__sidebar", children: [
11880
- view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
11881
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
11882
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
11883
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
11884
- view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
12618
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__sidebar", children: [
12619
+ view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
12620
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
12621
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
12622
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
12623
+ view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
11885
12624
  view.plan.price,
11886
- per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
12625
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
11887
12626
  "/",
11888
12627
  per
11889
12628
  ] })
11890
12629
  ] })
11891
12630
  ] })
11892
12631
  ] }),
11893
- view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
11894
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
11895
- view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
11896
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
11897
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
12632
+ view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
12633
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
12634
+ view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
12635
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
12636
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
11898
12637
  addOn.price,
11899
- !addOn.oneTime && per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
12638
+ !addOn.oneTime && per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
11900
12639
  "/",
11901
12640
  per
11902
12641
  ] })
11903
12642
  ] })
11904
12643
  ] }, addOn.id))
11905
12644
  ] }),
11906
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
11907
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
11908
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { children: [
12645
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
12646
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
12647
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { children: [
11909
12648
  view.total,
11910
- per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
12649
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
11911
12650
  "/",
11912
12651
  per
11913
12652
  ] })
11914
12653
  ] })
11915
12654
  ] }),
11916
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12655
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11917
12656
  "button",
11918
12657
  {
11919
12658
  className: "schematic-cta schematic-unsubscribe__confirm",
@@ -11923,7 +12662,7 @@ function UnsubscribeButton({
11923
12662
  children: t("unsubscribeConfirm")
11924
12663
  }
11925
12664
  ),
11926
- failed && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "schematic-error", role: "alert", children: t("unsubscribeFailed") })
12665
+ failed && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "schematic-error", role: "alert", children: t("unsubscribeFailed") })
11927
12666
  ] })
11928
12667
  ] })
11929
12668
  }
@@ -11942,9 +12681,9 @@ function ManagePlan({
11942
12681
  return null;
11943
12682
  }
11944
12683
  const label = t("unsubscribeManagePlan");
11945
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__manage", children: [
11946
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: t("unsubscribeNotReady") }),
11947
- onClick !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12684
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-unsubscribe__manage", children: [
12685
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: t("unsubscribeNotReady") }),
12686
+ onClick !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11948
12687
  "button",
11949
12688
  {
11950
12689
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11952,7 +12691,7 @@ function ManagePlan({
11952
12691
  onClick,
11953
12692
  children: label
11954
12693
  }
11955
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12694
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11956
12695
  "a",
11957
12696
  {
11958
12697
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11966,9 +12705,9 @@ function ManagePlan({
11966
12705
  UnsubscribeButton.resources = ["company", "featureUsage"];
11967
12706
 
11968
12707
  // src/elements/UpcomingBill.tsx
11969
- var import_schematic_react13 = require("@schematichq/schematic-react");
11970
- var import_react18 = require("react");
11971
- var import_jsx_runtime19 = require("react/jsx-runtime");
12708
+ var import_schematic_react14 = require("@schematichq/schematic-react");
12709
+ var import_react19 = require("react");
12710
+ var import_jsx_runtime20 = require("react/jsx-runtime");
11972
12711
  function UpcomingBill({
11973
12712
  className,
11974
12713
  headingLevel = 2,
@@ -11979,10 +12718,10 @@ function UpcomingBill({
11979
12718
  showHeader = true,
11980
12719
  strings
11981
12720
  }) {
11982
- const { data: invoice, error, isPending, refetch } = (0, import_schematic_react13.useUpcomingInvoice)();
12721
+ const { data: invoice, error, isPending, refetch } = (0, import_schematic_react14.useUpcomingInvoice)();
11983
12722
  const locale = useResolvedLocale(localeProp);
11984
12723
  const t = useTranslator(strings, localeProp);
11985
- const bill = (0, import_react18.useMemo)(
12724
+ const bill = (0, import_react19.useMemo)(
11986
12725
  () => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
11987
12726
  [invoice, locale]
11988
12727
  );
@@ -11991,7 +12730,7 @@ function UpcomingBill({
11991
12730
  const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
11992
12731
  const unavailable = invoice === void 0 && httpStatus(error) === 404;
11993
12732
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
11994
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12733
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
11995
12734
  StatusFrame,
11996
12735
  {
11997
12736
  className: cx("schematic-card", "schematic-upcoming-bill", className),
@@ -12002,11 +12741,11 @@ function UpcomingBill({
12002
12741
  loadingLabel: t("upcomingBillLoading"),
12003
12742
  onRetry: refetch,
12004
12743
  retryText: t("retry"),
12005
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(UpcomingBillSkeleton, { showHeader }),
12006
- children: bill === null ? invoice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
12007
- showHeader && bill.dueAt !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
12008
- showAmount && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-upcoming-bill__amount", children: [
12009
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12744
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UpcomingBillSkeleton, { showHeader }),
12745
+ children: bill === null ? invoice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
12746
+ showHeader && bill.dueAt !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
12747
+ showAmount && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "schematic-upcoming-bill__amount", children: [
12748
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
12010
12749
  "span",
12011
12750
  {
12012
12751
  className: "schematic-upcoming-bill__total",
@@ -12014,46 +12753,46 @@ function UpcomingBill({
12014
12753
  children: bill.amountDueText
12015
12754
  }
12016
12755
  ),
12017
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
12756
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
12018
12757
  ] }),
12019
- (balanceRows || discountRow) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-upcoming-bill__rows", children: [
12020
- balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12758
+ (balanceRows || discountRow) && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "schematic-upcoming-bill__rows", children: [
12759
+ balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12021
12760
  "div",
12022
12761
  {
12023
12762
  className: "schematic-row schematic-upcoming-bill__balance-applied",
12024
12763
  "data-testid": "schematic-balance-applied",
12025
12764
  children: [
12026
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
12027
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
12765
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
12766
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
12028
12767
  ]
12029
12768
  }
12030
12769
  ),
12031
- balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12770
+ balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12032
12771
  "div",
12033
12772
  {
12034
12773
  className: "schematic-row schematic-upcoming-bill__balance-remaining",
12035
12774
  "data-testid": "schematic-balance-remaining",
12036
12775
  children: [
12037
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
12038
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
12776
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
12777
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
12039
12778
  ]
12040
12779
  }
12041
12780
  ),
12042
- discountRow && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12781
+ discountRow && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12043
12782
  "div",
12044
12783
  {
12045
12784
  className: "schematic-row schematic-upcoming-bill__discount-row",
12046
12785
  "data-testid": "schematic-discounts",
12047
12786
  children: [
12048
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
12049
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12787
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
12788
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12050
12789
  "li",
12051
12790
  {
12052
12791
  className: "schematic-upcoming-bill__discount",
12053
12792
  "data-testid": "schematic-discount",
12054
12793
  children: [
12055
- discount.code !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
12056
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
12794
+ discount.code !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
12795
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
12057
12796
  ]
12058
12797
  },
12059
12798
  `${discount.couponName}-${index}`
@@ -12067,10 +12806,10 @@ function UpcomingBill({
12067
12806
  );
12068
12807
  }
12069
12808
  function UpcomingBillSkeleton({ showHeader }) {
12070
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-skeleton", children: [
12071
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__heading" }),
12072
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
12073
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
12809
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "schematic-skeleton", children: [
12810
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-skeleton__heading" }),
12811
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
12812
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
12074
12813
  ] });
12075
12814
  }
12076
12815
  function discountText(discount, t) {