@schematichq/schematic-components 2.37.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",
@@ -146,7 +147,8 @@ var PaymentMethodForm_exports = {};
146
147
  __export(PaymentMethodForm_exports, {
147
148
  PaymentMethodForm: () => PaymentMethodForm,
148
149
  default: () => PaymentMethodForm_default,
149
- resolveAppearance: () => resolveAppearance
150
+ resolveAppearance: () => resolveAppearance,
151
+ resolved: () => resolved
150
152
  });
151
153
  function orUndefined(value) {
152
154
  return value === void 0 || value === "" ? void 0 : value;
@@ -504,13 +506,14 @@ var init_PaymentMethodForm = __esm({
504
506
  // src/elements/index.ts
505
507
  var index_exports = {};
506
508
  __export(index_exports, {
507
- BillingDataProvider: () => import_schematic_react14.BillingDataProvider,
509
+ BillingDataProvider: () => import_schematic_react15.BillingDataProvider,
508
510
  Checkout: () => Checkout,
509
511
  CheckoutLauncherProvider: () => CheckoutLauncherProvider,
510
- CheckoutProblemCode: () => import_schematic_react14.CheckoutProblemCode,
512
+ CheckoutProblemCode: () => import_schematic_react15.CheckoutProblemCode,
513
+ CreditLog: () => CreditLog,
511
514
  CreditUsage: () => CreditUsage,
512
515
  DEFAULT_STRINGS: () => DEFAULT_STRINGS,
513
- FEATURE_USER_USAGE_LIMIT: () => import_schematic_react14.FEATURE_USER_USAGE_LIMIT,
516
+ FEATURE_USER_USAGE_LIMIT: () => import_schematic_react15.FEATURE_USER_USAGE_LIMIT,
514
517
  Icon: () => Icon,
515
518
  IncludedFeatures: () => IncludedFeatures,
516
519
  Invoices: () => Invoices,
@@ -519,7 +522,7 @@ __export(index_exports, {
519
522
  PlanManager: () => PlanManager,
520
523
  PricingTable: () => PricingTable,
521
524
  SCHEMATIC_TOKENS: () => SCHEMATIC_TOKENS,
522
- SchematicI18nProvider: () => import_schematic_react14.SchematicI18nProvider,
525
+ SchematicI18nProvider: () => import_schematic_react15.SchematicI18nProvider,
523
526
  SchematicStyles: () => SchematicStyles,
524
527
  Tooltip: () => Tooltip,
525
528
  UnsubscribeButton: () => UnsubscribeButton,
@@ -528,11 +531,12 @@ __export(index_exports, {
528
531
  cartReducer: () => cartReducer,
529
532
  catalogName: () => catalogName,
530
533
  catalogPriceName: () => catalogPriceName,
531
- checkoutProblemsOf: () => import_schematic_react14.checkoutProblemsOf,
534
+ checkoutProblemsOf: () => import_schematic_react15.checkoutProblemsOf,
532
535
  checkoutSelectionFor: () => checkoutSelectionFor,
533
536
  checkoutSelections: () => checkoutSelections,
534
537
  currentTier: () => currentTier,
535
538
  deriveCheckout: () => deriveCheckout,
539
+ deriveCreditLog: () => deriveCreditLog,
536
540
  deriveCreditUsage: () => deriveCreditUsage,
537
541
  deriveIncludedFeatures: () => deriveIncludedFeatures,
538
542
  deriveInvoiceList: () => deriveInvoiceList,
@@ -546,6 +550,7 @@ __export(index_exports, {
546
550
  formatConsumptionRate: () => formatConsumptionRate,
547
551
  formatCurrency: () => formatCurrency,
548
552
  formatDate: () => formatDate,
553
+ formatDateTime: () => formatDateTime,
549
554
  formatMonthYear: () => formatMonthYear,
550
555
  formatNumber: () => formatNumber,
551
556
  formatPercent: () => formatPercent,
@@ -567,31 +572,32 @@ __export(index_exports, {
567
572
  tierRanges: () => tierRanges,
568
573
  unitPrice: () => unitPrice,
569
574
  usageLimit: () => usageLimit,
570
- useCatalog: () => import_schematic_react14.useCatalog,
571
- useCheckout: () => import_schematic_react14.useCheckout,
575
+ useCatalog: () => import_schematic_react15.useCatalog,
576
+ useCheckout: () => import_schematic_react15.useCheckout,
572
577
  useCheckoutLauncher: () => useCheckoutLauncher,
573
- useCompany: () => import_schematic_react14.useCompany,
574
- useCreditBalances: () => import_schematic_react14.useCreditBalances,
575
- useCreditUserUsage: () => import_schematic_react14.useCreditUserUsage,
576
- useFeatureUsage: () => import_schematic_react14.useFeatureUsage,
577
- useFeatureUserUsage: () => import_schematic_react14.useFeatureUserUsage,
578
- useInvalidateBillingData: () => import_schematic_react14.useInvalidateBillingData,
579
- useInvoices: () => import_schematic_react14.useInvoices,
580
- 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,
581
587
  useResolvedLocale: () => useResolvedLocale,
582
- useSchematicI18n: () => import_schematic_react14.useSchematicI18n,
583
- useSchematicLocale: () => import_schematic_react14.useSchematicLocale,
584
- useSchematicStrings: () => import_schematic_react14.useSchematicStrings,
585
- useSchematicTranslate: () => import_schematic_react14.useSchematicTranslate,
586
- useSetupIntent: () => import_schematic_react14.useSetupIntent,
587
- 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,
588
594
  useTranslator: () => useTranslator,
589
- useUnsubscribe: () => import_schematic_react14.useUnsubscribe,
590
- useUpcomingInvoice: () => import_schematic_react14.useUpcomingInvoice,
595
+ useUnsubscribe: () => import_schematic_react15.useUnsubscribe,
596
+ useUpcomingInvoice: () => import_schematic_react15.useUpcomingInvoice,
591
597
  viewerLocale: () => viewerLocale
592
598
  });
593
599
  module.exports = __toCommonJS(index_exports);
594
- var import_schematic_react14 = require("@schematichq/schematic-react");
600
+ var import_schematic_react15 = require("@schematichq/schematic-react");
595
601
 
596
602
  // src/elements/model/errors.ts
597
603
  function httpStatus(error) {
@@ -1077,6 +1083,16 @@ function formatDate(date, locale, options) {
1077
1083
  ...options
1078
1084
  }).format(date);
1079
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
+ }
1080
1096
  function formatShortDate(date, locale) {
1081
1097
  if (usableDate(date) === void 0) {
1082
1098
  return "";
@@ -1130,6 +1146,16 @@ function isEnglish(locale) {
1130
1146
  function orNull(value) {
1131
1147
  return value === void 0 || value === null || value === "" ? null : value;
1132
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
+ }
1133
1159
 
1134
1160
  // src/elements/model/invoices.ts
1135
1161
  function linkableURL(url) {
@@ -1429,6 +1455,10 @@ function planCurrencies(plan) {
1429
1455
  }
1430
1456
  return [...currencies];
1431
1457
  }
1458
+ function pricedIn(plan, currency) {
1459
+ const currencies = planCurrencies(plan);
1460
+ return currencies.length === 0 || currencies.includes(currency.toLowerCase());
1461
+ }
1432
1462
  function isPayInAdvance(entitlement) {
1433
1463
  return entitlement.priceBehavior === "pay_in_advance";
1434
1464
  }
@@ -1495,7 +1525,9 @@ function initialCart({
1495
1525
  if (selection.planId === null) {
1496
1526
  planId = void 0;
1497
1527
  } else if (selection.planId !== void 0) {
1498
- 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;
1499
1531
  } else {
1500
1532
  planId = catalog.plans.find(
1501
1533
  (p) => p.current && !(p.isTrialable && p.companyCanTrial)
@@ -1955,7 +1987,7 @@ function prorationBlock(detail, input) {
1955
1987
  return {
1956
1988
  key: `${line.kind}:${line.planId ?? line.priceId ?? ""}:${index}`,
1957
1989
  kind: line.kind,
1958
- name: catalogName(catalog, line.planId) ?? catalogPriceName(catalog, line.priceId) ?? (line.planId != null && current !== void 0 && current.id === line.planId ? current.name : null),
1990
+ name: catalogName(catalog, line.planId) ?? catalogPriceName(catalog, line.priceId) ?? (line.planId != null && current != null && current.id === line.planId ? current.name : null),
1959
1991
  periodText: start !== void 0 && end !== void 0 ? formatShortDateRange(start, end, locale) : null,
1960
1992
  amountText: money(line.amount)
1961
1993
  };
@@ -1972,7 +2004,7 @@ function prorationBlock(detail, input) {
1972
2004
  }
1973
2005
  function customPlanOf(catalog) {
1974
2006
  const cta = catalog.customPlanCta;
1975
- if (cta === void 0) {
2007
+ if (cta == null) {
1976
2008
  return null;
1977
2009
  }
1978
2010
  const custom = {
@@ -2151,9 +2183,7 @@ function deriveCheckout(input) {
2151
2183
  selectable: periodOptions.length > 1 && display?.showPeriodToggle !== false,
2152
2184
  savings: plan === void 0 ? null : periodSavings(plan, cart, locale)
2153
2185
  },
2154
- plans: catalog.plans.map(
2155
- (p) => planRow(p, cart, locale, p.id === plan?.id)
2156
- ),
2186
+ plans: catalog.plans.filter((p) => pricedIn(p, cart.currency)).map((p) => planRow(p, cart, locale, p.id === plan?.id)),
2157
2187
  customPlan: customPlanOf(catalog),
2158
2188
  downgradeContact: catalog.preventSelfServiceDowngradeUrl ? {
2159
2189
  url: catalog.preventSelfServiceDowngradeUrl,
@@ -2178,7 +2208,7 @@ function deriveCheckout(input) {
2178
2208
  enabled: choice.enabled ?? topup.companyEnabled ?? topup.enabled,
2179
2209
  thresholdCredits: choice.thresholdCredits ?? topup.companyThresholdCredits ?? topup.thresholdCredits ?? null,
2180
2210
  amount,
2181
- costText: amount === null || unit === void 0 ? null : priceText(unit, locale, amount)
2211
+ costText: amount === null || unit == null ? null : priceText(unit, locale, amount)
2182
2212
  };
2183
2213
  }),
2184
2214
  lines,
@@ -2230,6 +2260,121 @@ function parseOptInText(text) {
2230
2260
  return segments;
2231
2261
  }
2232
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
+
2233
2378
  // src/elements/model/creditUsage.ts
2234
2379
  function deriveCreditUsage(balances, options) {
2235
2380
  const ordered = options.visibleCredits === void 0 ? balances : options.visibleCredits.flatMap((id) => {
@@ -2324,7 +2469,7 @@ function isEnglish2(locale) {
2324
2469
 
2325
2470
  // src/elements/model/featureUsage.ts
2326
2471
  function pricePeriod(price) {
2327
- if (price === void 0) {
2472
+ if (price == null) {
2328
2473
  return null;
2329
2474
  }
2330
2475
  if (price.interval === "month" && price.intervalCount === 3) {
@@ -2333,7 +2478,7 @@ function pricePeriod(price) {
2333
2478
  return price.interval;
2334
2479
  }
2335
2480
  function isTieredPrice(price) {
2336
- return price !== void 0 && (price.priceTiers.length > 1 || price.tiersMode !== void 0 && price.tiersMode !== null);
2481
+ return price != null && (price.priceTiers.length > 1 || price.tiersMode !== void 0 && price.tiersMode !== null);
2337
2482
  }
2338
2483
  function unitPrice(price) {
2339
2484
  return decimalOr(price.priceDecimal, price.price);
@@ -2438,7 +2583,7 @@ function includedFeatureRow(row, options) {
2438
2583
  amount: formatNumber(row.allocation, locale),
2439
2584
  units: featureName(feature, row.allocation, locale)
2440
2585
  } : null,
2441
- tiers: (row.priceBehavior === "tier" || tiered) && row.price !== void 0 ? {
2586
+ tiers: (row.priceBehavior === "tier" || tiered) && row.price != null ? {
2442
2587
  ranges: tierRanges(row.price),
2443
2588
  currency: row.price.currency,
2444
2589
  mode: row.price.tiersMode ?? null,
@@ -2468,7 +2613,7 @@ function entitlementText(row, options) {
2468
2613
  case "pay_in_advance":
2469
2614
  return typeof row.allocation === "number" ? { kind: "units", ...units(row.allocation) } : null;
2470
2615
  case "pay_as_you_go": {
2471
- if (row.price === void 0) {
2616
+ if (row.price == null) {
2472
2617
  return null;
2473
2618
  }
2474
2619
  const cost = formatCurrency(
@@ -2536,7 +2681,7 @@ function usageSegments(row, locale, tiered, period) {
2536
2681
  pluralName: row.featurePluralName
2537
2682
  };
2538
2683
  const segments = [];
2539
- if (row.priceBehavior === "pay_in_advance" && !tiered && period !== null && row.price !== void 0) {
2684
+ if (row.priceBehavior === "pay_in_advance" && !tiered && period !== null && row.price != null) {
2540
2685
  const size = row.price.packageSize;
2541
2686
  segments.push({
2542
2687
  kind: "unitPricePerPeriod",
@@ -2552,7 +2697,7 @@ function usageSegments(row, locale, tiered, period) {
2552
2697
  units: featureName(feature, row.usage, locale)
2553
2698
  });
2554
2699
  }
2555
- if (typeof row.currentCost === "number" && row.currentCost > 0 && row.price !== void 0) {
2700
+ if (typeof row.currentCost === "number" && row.currentCost > 0 && row.price != null) {
2556
2701
  segments.push({
2557
2702
  kind: "cost",
2558
2703
  cost: formatCurrency(row.currentCost, row.price.currency, locale),
@@ -2676,7 +2821,7 @@ function limitLine(row, limit, unit, options) {
2676
2821
  }
2677
2822
  break;
2678
2823
  case "pay_as_you_go":
2679
- if (typeof row.currentCost === "number" && row.price !== void 0) {
2824
+ if (typeof row.currentCost === "number" && row.price != null) {
2680
2825
  return {
2681
2826
  kind: "cost",
2682
2827
  cost: formatCurrency(row.currentCost, row.price.currency, locale)
@@ -2730,7 +2875,7 @@ function meter(row, options) {
2730
2875
  }
2731
2876
  function priceDetails(row, unit, locale) {
2732
2877
  const price = row.price;
2733
- if (price === void 0) {
2878
+ if (price == null) {
2734
2879
  return null;
2735
2880
  }
2736
2881
  const tier = currentTier(row);
@@ -2993,7 +3138,7 @@ function planCredits(company, balances, locale) {
2993
3138
  kind: "total",
2994
3139
  amount: formatCredits(value, locale),
2995
3140
  creditName: featureName(unit, value, locale),
2996
- period: subscriptionPeriod2
3141
+ period: resetPeriod(grants[0].renewalPeriod) ?? subscriptionPeriod2
2997
3142
  } : {
2998
3143
  kind: "perLicense",
2999
3144
  amount: formatCredits(composition.perLicenseAmount, locale),
@@ -3157,9 +3302,11 @@ function derivePricingTable(view, options) {
3157
3302
  const { catalog } = view;
3158
3303
  const plans = catalog.plans;
3159
3304
  const addOns = catalog.addOns;
3160
- 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];
3161
3308
  const defaultCurrency = catalog.defaultCurrency?.toLowerCase();
3162
- const currency = pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3309
+ const currency = locked ?? pick(currencies, options.currency?.toLowerCase(), [defaultCurrency]) ?? defaultCurrency ?? "usd";
3163
3310
  const priced = (plan) => supportsCurrency(plan, currency);
3164
3311
  const periods = PERIODS.filter(
3165
3312
  (period2) => [...plans, ...addOns].filter(priced).some((plan) => periodsOf(plan).includes(period2))
@@ -3605,15 +3752,6 @@ function customPlanOf2(plan) {
3605
3752
  function asPeriod(value) {
3606
3753
  return value === "month" || value === "quarter" || value === "year" ? value : null;
3607
3754
  }
3608
- var RESET_PERIOD = {
3609
- daily: "day",
3610
- weekly: "week",
3611
- monthly: "month",
3612
- yearly: "year"
3613
- };
3614
- function resetPeriod(cadence) {
3615
- return cadence === void 0 || cadence === null ? null : RESET_PERIOD[cadence] ?? null;
3616
- }
3617
3755
  var METRIC_PERIOD = {
3618
3756
  current_day: "day",
3619
3757
  current_week: "week",
@@ -3797,6 +3935,43 @@ var DEFAULT_STRINGS = {
3797
3935
  creditUsagePerLicense: "{{quantity}} {{licenseName}} \xD7 {{perUnit}}",
3798
3936
  creditUsageCompanyGrant: "{{amount}} company grant",
3799
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",
3800
3975
  planManagerLoading: "Loading your plan",
3801
3976
  planManagerError: "There was a problem retrieving your plan.",
3802
3977
  planManagerUnavailable: "Your plan is not available for this account.",
@@ -4623,6 +4798,197 @@ var checkoutCss = `
4623
4798
  }
4624
4799
  `;
4625
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
+
4626
4992
  // src/elements/styles/credit-usage.ts
4627
4993
  var creditUsageCss = `
4628
4994
  .schematic-credit-usage__credits {
@@ -6706,6 +7072,7 @@ ${tooltipCss}
6706
7072
  ${includedFeaturesCss}
6707
7073
  ${meteredFeaturesCss}
6708
7074
  ${creditUsageCss}
7075
+ ${creditLogCss}
6709
7076
  ${planManagerCss}
6710
7077
  ${pricingTableCss}
6711
7078
  ${unsubscribeCss}
@@ -9292,13 +9659,386 @@ function useCheckoutLauncher() {
9292
9659
  return (0, import_react8.useContext)(LauncherContext) ?? detached;
9293
9660
  }
9294
9661
 
9295
- // src/elements/CreditUsage.tsx
9662
+ // src/elements/CreditLog.tsx
9296
9663
  var import_schematic_react6 = require("@schematichq/schematic-react");
9297
- var import_react11 = require("react");
9298
-
9299
- // src/elements/usage.tsx
9300
9664
  var import_react10 = require("react");
9301
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");
9302
10042
  var COLLAPSED_USER_COUNT = 3;
9303
10043
  var EXPANDED_USER_COUNT = 20;
9304
10044
  function shortPeriod(period, t) {
@@ -9324,16 +10064,16 @@ function PriceTiers({
9324
10064
  }) {
9325
10065
  const perPeriod2 = period === null ? void 0 : shortPeriod(period, t);
9326
10066
  const money = (amount) => formatCurrency(amount, currency, locale);
9327
- 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: [
9328
10068
  money(amount),
9329
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
10069
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
9330
10070
  "/",
9331
10071
  unit
9332
10072
  ] })
9333
10073
  ] });
9334
- 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: [
9335
10075
  money(amount),
9336
- perPeriod2 !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
10076
+ perPeriod2 !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("sub", { children: [
9337
10077
  "/",
9338
10078
  perPeriod2
9339
10079
  ] })
@@ -9345,21 +10085,21 @@ function PriceTiers({
9345
10085
  if (flatPrice !== 0 && perUnitPrice === 0) {
9346
10086
  return flat(flatPrice);
9347
10087
  }
9348
- 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: [
9349
10089
  perUnit(perUnitPrice),
9350
10090
  " + ",
9351
10091
  flat(flatPrice)
9352
10092
  ] });
9353
10093
  };
9354
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { className: "schematic-tiers", children: [
9355
- /* @__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: [
9356
- /* @__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: [
9357
10097
  formatNumber(tier.from, locale),
9358
10098
  tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${formatNumber(tier.to, locale)}` : ""
9359
10099
  ] }),
9360
- /* @__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) })
9361
10101
  ] }, tier.from)) }),
9362
- 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") })
9363
10103
  ] });
9364
10104
  }
9365
10105
  function UserBreakdown({
@@ -9371,17 +10111,17 @@ function UserBreakdown({
9371
10111
  t,
9372
10112
  unit
9373
10113
  }) {
9374
- const [expanded, setExpanded] = (0, import_react10.useState)(false);
9375
- const users = (0, import_react10.useMemo)(
10114
+ const [expanded, setExpanded] = (0, import_react11.useState)(false);
10115
+ const users = (0, import_react11.useMemo)(
9376
10116
  () => [...breakdown?.users ?? []].sort((a, b) => b.amount - a.amount),
9377
10117
  [breakdown?.users]
9378
10118
  );
9379
10119
  const amount = (value) => `${formatAmount?.(value) ?? formatNumber(value, locale)} ${featureName(unit, value, locale)}`;
9380
10120
  if (breakdown === void 0 && error !== void 0) {
9381
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-usage-by-user", role: "alert", children: [
9382
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9383
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-error", children: t("usageByUserError") }),
9384
- /* @__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)(
9385
10125
  "button",
9386
10126
  {
9387
10127
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-status__retry",
@@ -9412,9 +10152,9 @@ function UserBreakdown({
9412
10152
  count: breakdown.count,
9413
10153
  shown: formatNumber(breakdown.count, locale)
9414
10154
  }) : t("usageByUserShowAll");
9415
- const user = (key, label, value, muted = false) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { className: "schematic-usage-by-user__user", children: [
9416
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", className: "schematic-usage-by-user__avatar", children: muted ? "?" : (label.trim()[0] ?? "?").toUpperCase() }),
9417
- /* @__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)(
9418
10158
  "span",
9419
10159
  {
9420
10160
  className: cx(
@@ -9424,12 +10164,12 @@ function UserBreakdown({
9424
10164
  children: label
9425
10165
  }
9426
10166
  ),
9427
- /* @__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) })
9428
10168
  ] }, key);
9429
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-usage-by-user", children: [
9430
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
9431
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted", children: t("usageByUserTotal", { amount: amount(breakdown.total) }) }),
9432
- /* @__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: [
9433
10173
  visible.map((entry) => user(entry.id, entry.label, entry.amount)),
9434
10174
  expanded && unattributed !== null && user(
9435
10175
  "unattributed",
@@ -9438,11 +10178,11 @@ function UserBreakdown({
9438
10178
  true
9439
10179
  )
9440
10180
  ] }),
9441
- 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", {
9442
10182
  count: remaining,
9443
10183
  shown: formatNumber(remaining, locale)
9444
10184
  }) }),
9445
- (hidden > 0 || unattributed !== null) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
10185
+ (hidden > 0 || unattributed !== null) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
9446
10186
  "button",
9447
10187
  {
9448
10188
  "aria-expanded": expanded,
@@ -9450,14 +10190,14 @@ function UserBreakdown({
9450
10190
  type: "button",
9451
10191
  onClick: () => setExpanded((value) => !value),
9452
10192
  children: [
9453
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
10193
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
9454
10194
  "i",
9455
10195
  {
9456
10196
  "aria-hidden": "true",
9457
10197
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9458
10198
  }
9459
10199
  ),
9460
- /* @__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 })
9461
10201
  ]
9462
10202
  }
9463
10203
  )
@@ -9465,7 +10205,7 @@ function UserBreakdown({
9465
10205
  }
9466
10206
 
9467
10207
  // src/elements/CreditUsage.tsx
9468
- var import_jsx_runtime12 = require("react/jsx-runtime");
10208
+ var import_jsx_runtime13 = require("react/jsx-runtime");
9469
10209
  var VISIBLE_GRANT_COUNT = 3;
9470
10210
  var GRANT_KEY = {
9471
10211
  autoTopup: "creditUsageGrantAutoTopup",
@@ -9489,10 +10229,10 @@ function CreditUsage({
9489
10229
  strings,
9490
10230
  visibleCredits
9491
10231
  }) {
9492
- const { data: balances, error, isPending, refetch } = (0, import_schematic_react6.useCreditBalances)();
10232
+ const { data: balances, error, isPending, refetch } = (0, import_schematic_react7.useCreditBalances)();
9493
10233
  const locale = useResolvedLocale(localeProp);
9494
10234
  const t = useTranslator(strings, localeProp);
9495
- const credits = (0, import_react11.useMemo)(
10235
+ const credits = (0, import_react12.useMemo)(
9496
10236
  () => balances === void 0 ? [] : deriveCreditUsage(balances, { locale, visibleCredits }),
9497
10237
  [balances, locale, visibleCredits]
9498
10238
  );
@@ -9503,7 +10243,7 @@ function CreditUsage({
9503
10243
  }
9504
10244
  const Heading = `h${headingLevel}`;
9505
10245
  const CreditHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
9506
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10246
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9507
10247
  StatusFrame,
9508
10248
  {
9509
10249
  className: cx("schematic-credit-usage", className),
@@ -9514,25 +10254,25 @@ function CreditUsage({
9514
10254
  loadingLabel: t("creditUsageLoading"),
9515
10255
  onRetry: refetch,
9516
10256
  retryText: t("retry"),
9517
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreditUsageSkeleton, { showHeader }),
10257
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CreditUsageSkeleton, { showHeader }),
9518
10258
  children: [
9519
- 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") }) }),
9520
- /* @__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)(
9521
10261
  "section",
9522
10262
  {
9523
10263
  "aria-label": credit.name,
9524
10264
  className: "schematic-card schematic-credit-usage__credit",
9525
10265
  "data-testid": "schematic-credit",
9526
10266
  children: [
9527
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__main", children: [
9528
- 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 }) }),
9529
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__body", children: [
9530
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__title", children: [
9531
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
9532
- 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 })
9533
10273
  ] }),
9534
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__balance", children: [
9535
- 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)(
9536
10276
  "span",
9537
10277
  {
9538
10278
  className: "schematic-credit-usage__remaining",
@@ -9540,7 +10280,7 @@ function CreditUsage({
9540
10280
  children: t("creditUsageRemaining", credit.remaining)
9541
10281
  }
9542
10282
  ),
9543
- credit.purchasable && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10283
+ credit.purchasable && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9544
10284
  BuyMore,
9545
10285
  {
9546
10286
  credit,
@@ -9551,10 +10291,10 @@ function CreditUsage({
9551
10291
  }
9552
10292
  )
9553
10293
  ] }),
9554
- 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) })
9555
10295
  ] })
9556
10296
  ] }),
9557
- credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10297
+ credit.ledger.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9558
10298
  Ledger,
9559
10299
  {
9560
10300
  credit,
@@ -9563,7 +10303,7 @@ function CreditUsage({
9563
10303
  t
9564
10304
  }
9565
10305
  ),
9566
- 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 })
9567
10307
  ]
9568
10308
  },
9569
10309
  credit.creditId
@@ -9597,28 +10337,28 @@ function Ledger({
9597
10337
  showExpiration,
9598
10338
  t
9599
10339
  }) {
9600
- const [open, setOpen] = (0, import_react11.useState)(false);
9601
- 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);
9602
10342
  const rows = all ? credit.ledger : credit.ledger.slice(0, VISIBLE_GRANT_COUNT);
9603
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__ledger", children: [
9604
- open && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-credit-usage__grants", children: [
9605
- /* @__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)(
9606
10346
  "li",
9607
10347
  {
9608
10348
  className: "schematic-credit-usage__grant",
9609
10349
  "data-testid": "schematic-credit-grant",
9610
10350
  children: [
9611
- /* @__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], {
9612
10352
  amount: row.amount,
9613
10353
  createdAt: row.createdAt,
9614
10354
  item: row.item
9615
10355
  }) }),
9616
- 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 }) })
9617
10357
  ]
9618
10358
  },
9619
10359
  row.id
9620
10360
  )) }),
9621
- 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)(
9622
10362
  "button",
9623
10363
  {
9624
10364
  "aria-expanded": all,
@@ -9626,21 +10366,21 @@ function Ledger({
9626
10366
  type: "button",
9627
10367
  onClick: () => setAll((value) => !value),
9628
10368
  children: [
9629
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10369
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9630
10370
  "i",
9631
10371
  {
9632
10372
  "aria-hidden": "true",
9633
10373
  className: `schematic-icon schematic-icon--${all ? "chevron-up" : "chevron-down"} schematic-chevron`
9634
10374
  }
9635
10375
  ),
9636
- /* @__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", {
9637
10377
  total: formatNumber(credit.ledger.length, locale)
9638
10378
  }) })
9639
10379
  ]
9640
10380
  }
9641
10381
  )
9642
10382
  ] }),
9643
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
10383
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
9644
10384
  "button",
9645
10385
  {
9646
10386
  "aria-expanded": open,
@@ -9651,14 +10391,14 @@ function Ledger({
9651
10391
  setAll(false);
9652
10392
  },
9653
10393
  children: [
9654
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10394
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9655
10395
  "i",
9656
10396
  {
9657
10397
  "aria-hidden": "true",
9658
10398
  className: `schematic-icon schematic-icon--${open ? "chevron-up" : "chevron-down"} schematic-chevron`
9659
10399
  }
9660
10400
  ),
9661
- /* @__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") })
9662
10402
  ]
9663
10403
  }
9664
10404
  )
@@ -9672,7 +10412,7 @@ function BuyMore({
9672
10412
  url
9673
10413
  }) {
9674
10414
  if (onBuyMore !== void 0) {
9675
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10415
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9676
10416
  "button",
9677
10417
  {
9678
10418
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9683,7 +10423,7 @@ function BuyMore({
9683
10423
  );
9684
10424
  }
9685
10425
  if (url !== void 0) {
9686
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10426
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
9687
10427
  "a",
9688
10428
  {
9689
10429
  className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
@@ -9700,8 +10440,8 @@ function CreditUserBreakdown({
9700
10440
  locale,
9701
10441
  t
9702
10442
  }) {
9703
- const { data, error, refetch } = (0, import_schematic_react6.useCreditUserUsage)(credit.creditId);
9704
- 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)(
9705
10445
  UserBreakdown,
9706
10446
  {
9707
10447
  breakdown: data === void 0 ? void 0 : {
@@ -9724,20 +10464,20 @@ function CreditUserBreakdown({
9724
10464
  );
9725
10465
  }
9726
10466
  function CreditUsageSkeleton({ showHeader }) {
9727
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-skeleton", children: [
9728
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__heading" }),
9729
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-skeleton__row", children: [
9730
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9731
- /* @__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" })
9732
10472
  ] }, index))
9733
10473
  ] });
9734
10474
  }
9735
10475
  CreditUsage.resources = ["creditBalances"];
9736
10476
 
9737
10477
  // src/elements/IncludedFeatures.tsx
9738
- var import_schematic_react7 = require("@schematichq/schematic-react");
9739
- var import_react12 = require("react");
9740
- 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");
9741
10481
  var VISIBLE_FEATURE_COUNT = 4;
9742
10482
  function IncludedFeatures({
9743
10483
  className,
@@ -9755,11 +10495,11 @@ function IncludedFeatures({
9755
10495
  strings,
9756
10496
  visibleFeatures
9757
10497
  }) {
9758
- const { data: features, error, isPending, refetch } = (0, import_schematic_react7.useFeatureUsage)();
10498
+ const { data: features, error, isPending, refetch } = (0, import_schematic_react8.useFeatureUsage)();
9759
10499
  const locale = useResolvedLocale(localeProp);
9760
10500
  const t = useTranslator(strings, localeProp);
9761
- const [expanded, setExpanded] = (0, import_react12.useState)(false);
9762
- const rows = (0, import_react12.useMemo)(
10501
+ const [expanded, setExpanded] = (0, import_react13.useState)(false);
10502
+ const rows = (0, import_react13.useMemo)(
9763
10503
  () => features === void 0 ? [] : deriveIncludedFeatures(features, {
9764
10504
  locale,
9765
10505
  showCredits,
@@ -9779,7 +10519,7 @@ function IncludedFeatures({
9779
10519
  const shown = canExpand && !expanded ? rows.slice(0, VISIBLE_FEATURE_COUNT) : rows;
9780
10520
  const unavailable = features === void 0 && httpStatus(error) === 404;
9781
10521
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("includedFeaturesUnavailable") : t("includedFeaturesError");
9782
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10522
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9783
10523
  StatusFrame,
9784
10524
  {
9785
10525
  className: cx("schematic-card", "schematic-included-features", className),
@@ -9790,26 +10530,26 @@ function IncludedFeatures({
9790
10530
  loadingLabel: t("includedFeaturesLoading"),
9791
10531
  onRetry: refetch,
9792
10532
  retryText: t("retry"),
9793
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(IncludedFeaturesSkeleton, { showHeader }),
10533
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IncludedFeaturesSkeleton, { showHeader }),
9794
10534
  children: [
9795
- 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") }) }),
9796
- /* @__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)(
9797
10537
  "li",
9798
10538
  {
9799
10539
  className: "schematic-included-features__row",
9800
10540
  "data-testid": "schematic-included-feature",
9801
10541
  children: [
9802
- showIcon && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10542
+ showIcon && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9803
10543
  Icon,
9804
10544
  {
9805
10545
  className: "schematic-included-features__icon",
9806
10546
  name: row.icon
9807
10547
  }
9808
10548
  ),
9809
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-included-features__details", children: [
9810
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-included-features__name", children: row.name }),
9811
- showDescription && row.description !== null && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "schematic-muted schematic-small", children: row.description }),
9812
- 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)(
9813
10553
  "span",
9814
10554
  {
9815
10555
  className: "schematic-muted schematic-small",
@@ -9821,9 +10561,9 @@ function IncludedFeatures({
9821
10561
  },
9822
10562
  `${credits.creditName}-${index}`
9823
10563
  )),
9824
- 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 }) })
9825
10565
  ] }),
9826
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10566
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9827
10567
  UsageDetails,
9828
10568
  {
9829
10569
  row,
@@ -9838,7 +10578,7 @@ function IncludedFeatures({
9838
10578
  },
9839
10579
  row.featureId
9840
10580
  )) }),
9841
- canExpand && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
10581
+ canExpand && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
9842
10582
  "button",
9843
10583
  {
9844
10584
  "aria-expanded": expanded,
@@ -9846,14 +10586,14 @@ function IncludedFeatures({
9846
10586
  type: "button",
9847
10587
  onClick: () => setExpanded((value) => !value),
9848
10588
  children: [
9849
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
10589
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
9850
10590
  "i",
9851
10591
  {
9852
10592
  "aria-hidden": "true",
9853
10593
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
9854
10594
  }
9855
10595
  ),
9856
- /* @__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") })
9857
10597
  ]
9858
10598
  }
9859
10599
  )
@@ -9873,17 +10613,17 @@ function UsageDetails({
9873
10613
  if (row.entitlement === null && usage === null) {
9874
10614
  return null;
9875
10615
  }
9876
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-included-features__usage", children: [
9877
- 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: [
9878
10618
  entitlementText2(row.entitlement, t),
9879
- 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", {
9880
10620
  amount: row.hardLimit.amount,
9881
10621
  units: row.hardLimit.units
9882
10622
  }) })
9883
10623
  ] }),
9884
- 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: [
9885
10625
  usage,
9886
- 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)(
9887
10627
  PriceTiers,
9888
10628
  {
9889
10629
  currency: row.tiers.currency,
@@ -9958,21 +10698,42 @@ function segmentText(segment, t) {
9958
10698
  }
9959
10699
  }
9960
10700
  function IncludedFeaturesSkeleton({ showHeader }) {
9961
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton", children: [
9962
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__heading" }),
9963
- [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "schematic-skeleton__row", children: [
9964
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
9965
- /* @__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" })
9966
10706
  ] }, index))
9967
10707
  ] });
9968
10708
  }
9969
10709
  IncludedFeatures.resources = ["featureUsage"];
9970
10710
 
9971
10711
  // src/elements/Invoices.tsx
9972
- var import_schematic_react8 = require("@schematichq/schematic-react");
9973
- var import_react13 = require("react");
9974
- var import_jsx_runtime14 = require("react/jsx-runtime");
9975
- var SKELETON_ROWS = 4;
10712
+ var import_schematic_react9 = require("@schematichq/schematic-react");
10713
+ var import_react14 = require("react");
10714
+
10715
+ // src/utils/invoiceLink.ts
10716
+ function openInvoiceLink(event, storedUrl, fetchUrl) {
10717
+ if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) {
10718
+ return Promise.resolve();
10719
+ }
10720
+ const tab = window.open("", "_blank");
10721
+ if (tab === null) {
10722
+ return Promise.resolve();
10723
+ }
10724
+ event.preventDefault();
10725
+ tab.opener = null;
10726
+ return fetchUrl().then(
10727
+ (url) => url || storedUrl,
10728
+ () => storedUrl
10729
+ ).then((url) => {
10730
+ tab.location.href = url;
10731
+ });
10732
+ }
10733
+
10734
+ // src/elements/Invoices.tsx
10735
+ var import_jsx_runtime15 = require("react/jsx-runtime");
10736
+ var SKELETON_ROWS2 = 4;
9976
10737
  function Invoices({
9977
10738
  className,
9978
10739
  collapsible = true,
@@ -9988,18 +10749,19 @@ function Invoices({
9988
10749
  const {
9989
10750
  data: page,
9990
10751
  error,
10752
+ fetchLink,
9991
10753
  isPending,
9992
10754
  loadMore,
9993
10755
  refetch
9994
- } = (0, import_schematic_react8.useInvoices)(query);
10756
+ } = (0, import_schematic_react9.useInvoices)(query);
9995
10757
  const locale = useResolvedLocale(localeProp);
9996
10758
  const t = useTranslator(strings, localeProp);
9997
- const [expanded, setExpanded] = (0, import_react13.useState)(false);
9998
- const list = (0, import_react13.useMemo)(
10759
+ const [expanded, setExpanded] = (0, import_react14.useState)(false);
10760
+ const list = (0, import_react14.useMemo)(
9999
10761
  () => page === void 0 ? void 0 : deriveInvoiceList(page, { locale }),
10000
10762
  [locale, page]
10001
10763
  );
10002
- const headingId = (0, import_react13.useId)();
10764
+ const headingId = (0, import_react14.useId)();
10003
10765
  const rows = list?.rows ?? [];
10004
10766
  const canCollapse = collapsible && rows.length > limit;
10005
10767
  const showingAll = !canCollapse || expanded;
@@ -10011,7 +10773,7 @@ function Invoices({
10011
10773
  );
10012
10774
  const unavailable = list === void 0 && httpStatus(error) === 404;
10013
10775
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("invoicesUnavailable") : t("invoicesError");
10014
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10776
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10015
10777
  StatusFrame,
10016
10778
  {
10017
10779
  className: cx("schematic-card", "schematic-invoices", className),
@@ -10022,30 +10784,30 @@ function Invoices({
10022
10784
  loadingLabel: t("invoicesLoading"),
10023
10785
  onRetry: refetch,
10024
10786
  retryText: t("retry"),
10025
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10787
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10026
10788
  InvoicesSkeleton,
10027
10789
  {
10028
10790
  columns: columns2,
10029
- rows: Math.max(1, Math.min(limit, SKELETON_ROWS)),
10791
+ rows: Math.max(1, Math.min(limit, SKELETON_ROWS2)),
10030
10792
  showHeader
10031
10793
  }
10032
10794
  ),
10033
- children: list !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
10034
- 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") }) }),
10035
- 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)(
10036
10798
  "ul",
10037
10799
  {
10038
10800
  className: "schematic-invoices__list",
10039
10801
  "aria-label": showHeader ? void 0 : t("invoicesHeader"),
10040
10802
  "aria-labelledby": showHeader ? headingId : void 0,
10041
- children: visible.map((row) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
10803
+ children: visible.map((row) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10042
10804
  "li",
10043
10805
  {
10044
10806
  className: "schematic-invoices__row",
10045
10807
  "data-testid": "schematic-invoice",
10046
10808
  children: [
10047
- showDate && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(InvoiceDate, { row, t }) }),
10048
- 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)(
10049
10811
  "span",
10050
10812
  {
10051
10813
  className: cx(
@@ -10062,8 +10824,8 @@ function Invoices({
10062
10824
  ))
10063
10825
  }
10064
10826
  ),
10065
- (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-invoices__actions", children: [
10066
- 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)(
10067
10829
  "button",
10068
10830
  {
10069
10831
  "aria-expanded": expanded,
@@ -10071,7 +10833,7 @@ function Invoices({
10071
10833
  type: "button",
10072
10834
  onClick: () => setExpanded((value) => !value),
10073
10835
  children: [
10074
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10836
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10075
10837
  "i",
10076
10838
  {
10077
10839
  "aria-hidden": "true",
@@ -10083,11 +10845,11 @@ function Invoices({
10083
10845
  )
10084
10846
  }
10085
10847
  ),
10086
- /* @__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") })
10087
10849
  ]
10088
10850
  }
10089
10851
  ),
10090
- showingAll && list.hasMore && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10852
+ showingAll && list.hasMore && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10091
10853
  "button",
10092
10854
  {
10093
10855
  className: "schematic-link-button schematic-invoices__load-more",
@@ -10110,9 +10872,9 @@ function InvoicesSkeleton({
10110
10872
  rows,
10111
10873
  showHeader
10112
10874
  }) {
10113
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "schematic-skeleton", children: [
10114
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "schematic-skeleton__heading" }),
10115
- 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)(
10116
10878
  "div",
10117
10879
  {
10118
10880
  className: "schematic-skeleton__cell",
@@ -10122,18 +10884,26 @@ function InvoicesSkeleton({
10122
10884
  )) }, row))
10123
10885
  ] });
10124
10886
  }
10125
- function InvoiceDate({ row, t }) {
10126
- if (row.url === null) {
10127
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "schematic-invoices__date-text", children: row.dateText });
10887
+ function InvoiceDate({
10888
+ fetchLink,
10889
+ row,
10890
+ t
10891
+ }) {
10892
+ const { url } = row;
10893
+ if (url === null) {
10894
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-invoices__date-text", children: row.dateText });
10128
10895
  }
10129
10896
  const label = row.dateText === "" ? t("invoicesUndated") : row.dateText;
10130
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
10897
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
10131
10898
  "a",
10132
10899
  {
10133
10900
  className: "schematic-invoices__link",
10134
- href: row.url,
10901
+ href: url,
10135
10902
  rel: "noreferrer",
10136
10903
  target: "_blank",
10904
+ onClick: (event) => {
10905
+ void openInvoiceLink(event, url, () => fetchLink(row.id));
10906
+ },
10137
10907
  children: label
10138
10908
  }
10139
10909
  );
@@ -10141,9 +10911,9 @@ function InvoiceDate({ row, t }) {
10141
10911
  Invoices.resources = ["invoices"];
10142
10912
 
10143
10913
  // src/elements/MeteredFeatures.tsx
10144
- var import_schematic_react9 = require("@schematichq/schematic-react");
10145
- var import_react14 = require("react");
10146
- 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");
10147
10917
  function MeteredFeatures({
10148
10918
  addMoreTarget,
10149
10919
  addMoreUrl,
@@ -10164,10 +10934,10 @@ function MeteredFeatures({
10164
10934
  strings,
10165
10935
  visibleFeatures
10166
10936
  }) {
10167
- const { data: features, error, isPending, refetch } = (0, import_schematic_react9.useFeatureUsage)();
10937
+ const { data: features, error, isPending, refetch } = (0, import_schematic_react10.useFeatureUsage)();
10168
10938
  const locale = useResolvedLocale(localeProp);
10169
10939
  const t = useTranslator(strings, localeProp);
10170
- const rows = (0, import_react14.useMemo)(
10940
+ const rows = (0, import_react15.useMemo)(
10171
10941
  () => features === void 0 ? [] : deriveMeteredFeatures(features, {
10172
10942
  locale,
10173
10943
  showCredits,
@@ -10189,7 +10959,7 @@ function MeteredFeatures({
10189
10959
  }
10190
10960
  const Heading = `h${headingLevel}`;
10191
10961
  const NameHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
10192
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
10962
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
10193
10963
  StatusFrame,
10194
10964
  {
10195
10965
  className: cx("schematic-metered-features", className),
@@ -10200,26 +10970,26 @@ function MeteredFeatures({
10200
10970
  loadingLabel: t("meteredFeaturesLoading"),
10201
10971
  onRetry: refetch,
10202
10972
  retryText: t("retry"),
10203
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MeteredFeaturesSkeleton, { showHeader }),
10973
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MeteredFeaturesSkeleton, { showHeader }),
10204
10974
  children: [
10205
- 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") }) }),
10206
- /* @__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)(
10207
10977
  "li",
10208
10978
  {
10209
10979
  className: "schematic-card schematic-metered-features__feature",
10210
10980
  "data-testid": "schematic-metered-feature",
10211
10981
  children: [
10212
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__main", children: [
10213
- 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 }) }),
10214
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__body", children: [
10215
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__top", children: [
10216
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__title", children: [
10217
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
10218
- 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 })
10219
10989
  ] }),
10220
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__figures", children: [
10221
- showUsage && row.headline !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
10222
- 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)(
10223
10993
  LimitLine,
10224
10994
  {
10225
10995
  row,
@@ -10229,8 +10999,8 @@ function MeteredFeatures({
10229
10999
  )
10230
11000
  ] })
10231
11001
  ] }),
10232
- showMeter && row.meter !== null && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Meter, { meter: row.meter }),
10233
- 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)(
10234
11004
  AddMore,
10235
11005
  {
10236
11006
  label: t("meteredFeaturesAddMore"),
@@ -10241,8 +11011,8 @@ function MeteredFeatures({
10241
11011
  )
10242
11012
  ] })
10243
11013
  ] }),
10244
- showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(UsageByUser, { locale, row, t }),
10245
- 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)(
10246
11016
  PriceDetails,
10247
11017
  {
10248
11018
  details: row.priceDetails,
@@ -10306,9 +11076,9 @@ function LimitLine({
10306
11076
  if (parts.length === 0) {
10307
11077
  return null;
10308
11078
  }
10309
- 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: [
10310
11080
  parts.join(" \u2022 "),
10311
- 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", {
10312
11082
  amount: row.hardLimit.amount,
10313
11083
  units: row.hardLimit.units
10314
11084
  }) })
@@ -10322,8 +11092,8 @@ var METER_TONE_CLASS = {
10322
11092
  overage: "schematic-meter--overage"
10323
11093
  };
10324
11094
  function Meter({ meter: meter2 }) {
10325
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__meter", children: [
10326
- /* @__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)(
10327
11097
  "div",
10328
11098
  {
10329
11099
  "aria-valuemax": meter2.total,
@@ -10332,7 +11102,7 @@ function Meter({ meter: meter2 }) {
10332
11102
  className: cx("schematic-meter", METER_TONE_CLASS[meter2.tone]),
10333
11103
  "data-tone": meter2.tone,
10334
11104
  role: "meter",
10335
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11105
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10336
11106
  "div",
10337
11107
  {
10338
11108
  className: "schematic-meter__fill",
@@ -10341,7 +11111,7 @@ function Meter({ meter: meter2 }) {
10341
11111
  )
10342
11112
  }
10343
11113
  ),
10344
- 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: [
10345
11115
  meter2.valueText,
10346
11116
  "/",
10347
11117
  meter2.totalText
@@ -10355,7 +11125,7 @@ function AddMore({
10355
11125
  url
10356
11126
  }) {
10357
11127
  if (onAddMore !== void 0) {
10358
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11128
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10359
11129
  "button",
10360
11130
  {
10361
11131
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10366,7 +11136,7 @@ function AddMore({
10366
11136
  );
10367
11137
  }
10368
11138
  if (url !== void 0) {
10369
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
11139
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10370
11140
  "a",
10371
11141
  {
10372
11142
  className: "schematic-cta schematic-metered-features__add-more",
@@ -10386,38 +11156,38 @@ function PriceDetails({
10386
11156
  }) {
10387
11157
  const period = details.period === null ? void 0 : shortPeriod(details.period, t);
10388
11158
  if (details.kind === "overage") {
10389
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
10390
- /* @__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: [
10391
11161
  t("meteredFeaturesAdditional"),
10392
11162
  ": ",
10393
11163
  details.unitPrice,
10394
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11164
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10395
11165
  "/",
10396
11166
  details.packageSize !== null && `${details.packageSize} `,
10397
11167
  details.units,
10398
11168
  period !== void 0 && `/${period}`
10399
11169
  ] })
10400
11170
  ] }),
10401
- /* @__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: [
10402
11172
  details.overage.amount,
10403
11173
  " ",
10404
11174
  details.overage.units,
10405
11175
  " \xB7 ",
10406
11176
  details.overage.cost,
10407
- period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11177
+ period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10408
11178
  "/",
10409
11179
  period
10410
11180
  ] })
10411
11181
  ] })
10412
11182
  ] });
10413
11183
  }
10414
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-metered-features__price-details", children: [
10415
- /* @__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: [
10416
11186
  t("meteredFeaturesTier"),
10417
11187
  ": ",
10418
11188
  details.from,
10419
11189
  details.to === null ? "+" : details.to !== details.from ? `\u2013${details.to}` : "",
10420
- /* @__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)(
10421
11191
  PriceTiers,
10422
11192
  {
10423
11193
  currency: details.tiers.currency,
@@ -10430,9 +11200,9 @@ function PriceDetails({
10430
11200
  }
10431
11201
  ) })
10432
11202
  ] }),
10433
- 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: [
10434
11204
  details.cost,
10435
- period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("sub", { children: [
11205
+ period !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
10436
11206
  "/",
10437
11207
  period
10438
11208
  ] })
@@ -10444,8 +11214,8 @@ function UsageByUser({
10444
11214
  row,
10445
11215
  t
10446
11216
  }) {
10447
- const { data, error, refetch } = (0, import_schematic_react9.useFeatureUserUsage)(row.featureId);
10448
- 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)(
10449
11219
  UserBreakdown,
10450
11220
  {
10451
11221
  breakdown: data === void 0 ? void 0 : {
@@ -10467,20 +11237,20 @@ function UsageByUser({
10467
11237
  );
10468
11238
  }
10469
11239
  function MeteredFeaturesSkeleton({ showHeader }) {
10470
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-skeleton", children: [
10471
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__heading" }),
10472
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "schematic-skeleton__row", children: [
10473
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
10474
- /* @__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" })
10475
11245
  ] }, index))
10476
11246
  ] });
10477
11247
  }
10478
11248
  MeteredFeatures.resources = ["featureUsage"];
10479
11249
 
10480
11250
  // src/elements/PlanManager.tsx
10481
- var import_schematic_react10 = require("@schematichq/schematic-react");
10482
- var import_react15 = require("react");
10483
- 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");
10484
11254
  var VISIBLE_CREDIT_COUNT = 3;
10485
11255
  var UNIT_KEY = {
10486
11256
  day: "planManagerDays",
@@ -10517,20 +11287,20 @@ function PlanManager({
10517
11287
  showZeroPriceAsFree = false,
10518
11288
  strings
10519
11289
  }) {
10520
- const company = (0, import_schematic_react10.useCompany)();
10521
- const usage = (0, import_schematic_react10.useFeatureUsage)();
10522
- 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)();
10523
11293
  const locale = useResolvedLocale(localeProp);
10524
11294
  const t = useTranslator(strings, localeProp);
10525
11295
  const creditsFailed = credits.data === void 0 && credits.error !== void 0;
10526
- const [creditsHaveFailed, setCreditsHaveFailed] = (0, import_react15.useState)(false);
11296
+ const [creditsHaveFailed, setCreditsHaveFailed] = (0, import_react16.useState)(false);
10527
11297
  if (creditsFailed && !creditsHaveFailed) {
10528
11298
  setCreditsHaveFailed(true);
10529
11299
  } else if (!creditsFailed && creditsHaveFailed && (credits.data !== void 0 || company.data === void 0 || usage.data === void 0)) {
10530
11300
  setCreditsHaveFailed(false);
10531
11301
  }
10532
11302
  const creditsSettled = !showCredits || credits.data !== void 0 || creditsHaveFailed;
10533
- const view = (0, import_react15.useMemo)(
11303
+ const view = (0, import_react16.useMemo)(
10534
11304
  () => company.data === void 0 || usage.data === void 0 || !creditsSettled ? void 0 : derivePlanManager(
10535
11305
  {
10536
11306
  company: company.data,
@@ -10568,7 +11338,7 @@ function PlanManager({
10568
11338
  }
10569
11339
  };
10570
11340
  const Heading = `h${headingLevel}`;
10571
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11341
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10572
11342
  StatusFrame,
10573
11343
  {
10574
11344
  className: cx("schematic-plan-manager", className),
@@ -10579,30 +11349,30 @@ function PlanManager({
10579
11349
  loadingLabel: t("planManagerLoading"),
10580
11350
  onRetry: retry,
10581
11351
  retryText: t("retry"),
10582
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(PlanManagerSkeleton, {}),
10583
- children: view !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
10584
- showNotice && view.notice !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Notice, { locale, notice: view.notice, t }),
10585
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-card schematic-plan-manager__card", children: [
10586
- showHeader && view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__plan", children: [
10587
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__title", children: [
10588
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
10589
- 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 })
10590
11360
  ] }),
10591
- 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 })
10592
11362
  ] }),
10593
- 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: [
10594
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: addOn.name }),
10595
- 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: [
10596
11366
  addOn.price.amount,
10597
- /* @__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 })
10598
11368
  ] })
10599
11369
  ] }, addOn.id)) }),
10600
- showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11370
+ showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10601
11371
  Section,
10602
11372
  {
10603
11373
  label: t("planManagerUsageBased"),
10604
11374
  showLabel: showLabels,
10605
- children: view.usageBased.map((row) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11375
+ children: view.usageBased.map((row) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10606
11376
  UsageBasedItem,
10607
11377
  {
10608
11378
  locale,
@@ -10614,7 +11384,7 @@ function PlanManager({
10614
11384
  ))
10615
11385
  }
10616
11386
  ),
10617
- 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)(
10618
11388
  StatusFrame,
10619
11389
  {
10620
11390
  className: "schematic-plan-manager__section",
@@ -10628,11 +11398,11 @@ function PlanManager({
10628
11398
  children: null
10629
11399
  }
10630
11400
  ),
10631
- showCredits && view.planCredits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10632
- Truncated,
11401
+ showCredits && view.planCredits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11402
+ Truncated2,
10633
11403
  {
10634
11404
  locale,
10635
- after: view.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11405
+ after: view.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10636
11406
  AutoTopupBox,
10637
11407
  {
10638
11408
  lines: view.autoTopup.lines,
@@ -10646,43 +11416,43 @@ function PlanManager({
10646
11416
  rows: view.planCredits,
10647
11417
  showLabel: showLabels,
10648
11418
  t,
10649
- 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)
10650
11420
  }
10651
11421
  ),
10652
- showCredits && view.topUps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10653
- Truncated,
11422
+ showCredits && view.topUps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11423
+ Truncated2,
10654
11424
  {
10655
11425
  locale,
10656
11426
  label: t("planManagerTopUps"),
10657
11427
  rows: view.topUps,
10658
11428
  showLabel: showLabels,
10659
11429
  t,
10660
- 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)
10661
11431
  }
10662
11432
  ),
10663
- showCredits && view.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10664
- Truncated,
11433
+ showCredits && view.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11434
+ Truncated2,
10665
11435
  {
10666
11436
  locale,
10667
11437
  label: t("planManagerCreditBundles"),
10668
11438
  rows: view.bundles,
10669
11439
  showLabel: showLabels,
10670
11440
  t,
10671
- 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)
10672
11442
  }
10673
11443
  ),
10674
- showCredits && view.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
10675
- Truncated,
11444
+ showCredits && view.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11445
+ Truncated2,
10676
11446
  {
10677
11447
  locale,
10678
11448
  label: t("planManagerPromotionalCredits"),
10679
11449
  rows: view.promotional,
10680
11450
  showLabel: showLabels,
10681
11451
  t,
10682
- 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)
10683
11453
  }
10684
11454
  ),
10685
- view.canChangePlan && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11455
+ view.canChangePlan && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10686
11456
  Cta,
10687
11457
  {
10688
11458
  className: "schematic-cta schematic-plan-manager__change-plan",
@@ -10739,16 +11509,16 @@ function Notice({
10739
11509
  if (title === null && body === null) {
10740
11510
  return null;
10741
11511
  }
10742
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11512
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10743
11513
  "div",
10744
11514
  {
10745
11515
  className: "schematic-plan-manager__notice",
10746
11516
  "data-kind": notice2.kind,
10747
11517
  role: "status",
10748
11518
  children: [
10749
- title !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-plan-manager__notice-title", children: title }),
10750
- body !== null && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
10751
- 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)(
10752
11522
  "a",
10753
11523
  {
10754
11524
  className: "schematic-cta schematic-plan-manager__pay-now",
@@ -10763,14 +11533,14 @@ function Notice({
10763
11533
  );
10764
11534
  }
10765
11535
  function Price2({ price, t }) {
10766
- 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: [
10767
11537
  price.kind === "usageBased" ? t("planManagerUsageBased") : price.kind === "free" ? t("planManagerFree") : price.amount,
10768
- 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 })
10769
11539
  ] });
10770
11540
  }
10771
11541
  function PeriodSuffix({ period, t }) {
10772
11542
  const short = shortPeriod(period, t);
10773
- 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: [
10774
11544
  "/",
10775
11545
  short
10776
11546
  ] });
@@ -10780,12 +11550,12 @@ function Section({
10780
11550
  label,
10781
11551
  showLabel
10782
11552
  }) {
10783
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10784
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10785
- /* @__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 })
10786
11556
  ] });
10787
11557
  }
10788
- function Truncated({
11558
+ function Truncated2({
10789
11559
  after,
10790
11560
  children,
10791
11561
  label,
@@ -10794,12 +11564,12 @@ function Truncated({
10794
11564
  showLabel,
10795
11565
  t
10796
11566
  }) {
10797
- const [expanded, setExpanded] = (0, import_react15.useState)(false);
11567
+ const [expanded, setExpanded] = (0, import_react16.useState)(false);
10798
11568
  const shown = expanded ? rows : rows.slice(0, VISIBLE_CREDIT_COUNT);
10799
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
10800
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
10801
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
10802
- 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)(
10803
11573
  "button",
10804
11574
  {
10805
11575
  "aria-expanded": expanded,
@@ -10807,14 +11577,14 @@ function Truncated({
10807
11577
  type: "button",
10808
11578
  onClick: () => setExpanded((value) => !value),
10809
11579
  children: [
10810
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11580
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10811
11581
  "i",
10812
11582
  {
10813
11583
  "aria-hidden": "true",
10814
11584
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
10815
11585
  }
10816
11586
  ),
10817
- /* @__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", {
10818
11588
  total: formatNumber(rows.length, locale)
10819
11589
  }) })
10820
11590
  ]
@@ -10839,9 +11609,9 @@ function UsageBasedItem({
10839
11609
  if (row.unitPrice !== null) {
10840
11610
  const short = row.unitPrice.period === null ? void 0 : shortPeriod(row.unitPrice.period, t);
10841
11611
  details.push(
10842
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
11612
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { children: [
10843
11613
  row.unitPrice.cost,
10844
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
11614
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { children: [
10845
11615
  "/",
10846
11616
  row.unitPrice.packageSize !== null && `${row.unitPrice.packageSize} `,
10847
11617
  row.unitPrice.units,
@@ -10856,23 +11626,23 @@ function UsageBasedItem({
10856
11626
  );
10857
11627
  }
10858
11628
  const costPeriod = row.cost?.period === null || row.cost === null ? void 0 : shortPeriod(row.cost.period, t);
10859
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11629
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10860
11630
  "li",
10861
11631
  {
10862
11632
  className: "schematic-plan-manager__row",
10863
11633
  "data-testid": "schematic-usage-based",
10864
11634
  children: [
10865
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
10866
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-plan-manager__detail", children: [
10867
- details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-muted schematic-small", children: details }),
10868
- 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: [
10869
11639
  row.cost.amount,
10870
- costPeriod !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("sub", { children: [
11640
+ costPeriod !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("sub", { children: [
10871
11641
  "/",
10872
11642
  costPeriod
10873
11643
  ] })
10874
11644
  ] }),
10875
- 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)(
10876
11646
  PriceTiers,
10877
11647
  {
10878
11648
  currency: row.tiers.currency,
@@ -10884,7 +11654,7 @@ function UsageBasedItem({
10884
11654
  unit: row.tiers.unit
10885
11655
  }
10886
11656
  ) }),
10887
- 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", {
10888
11658
  amount: row.hardLimit.amount,
10889
11659
  units: row.hardLimit.units
10890
11660
  }) })
@@ -10896,14 +11666,14 @@ function UsageBasedItem({
10896
11666
  function PlanCreditItem({ row, t }) {
10897
11667
  const text = row.text;
10898
11668
  const composition = row.composition;
10899
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11669
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10900
11670
  "li",
10901
11671
  {
10902
11672
  className: "schematic-plan-manager__row schematic-plan-manager__row--stacked",
10903
11673
  "data-testid": "schematic-plan-credit",
10904
11674
  children: [
10905
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__row-main", children: [
10906
- /* @__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: [
10907
11677
  t("planManagerCreditsPerLicense", {
10908
11678
  amount: text.amount,
10909
11679
  creditName: text.creditName,
@@ -10922,15 +11692,15 @@ function PlanCreditItem({ row, t }) {
10922
11692
  creditName: text.creditName,
10923
11693
  period: periodWord(text.period, t)
10924
11694
  }) }),
10925
- 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: [
10926
11696
  t("planManagerUsed", { amount: row.used }),
10927
- 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", {
10928
11698
  amount: row.autoTopup.amount,
10929
11699
  threshold: row.autoTopup.threshold
10930
11700
  }) })
10931
11701
  ] })
10932
11702
  ] }),
10933
- 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(
10934
11704
  composition.fixed === null ? "planManagerLicensesTimesCredits" : "planManagerLicensesTimesCreditsPlusCompany",
10935
11705
  {
10936
11706
  creditName: composition.creditName,
@@ -10955,21 +11725,21 @@ function CreditGroupItem({
10955
11725
  const named = !plain && row.bundleName !== null;
10956
11726
  const showCount = !plain && row.count > 1 && (named || countAlways);
10957
11727
  const amount = `${row.quantity} ${row.creditName}`;
10958
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
11728
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
10959
11729
  "li",
10960
11730
  {
10961
11731
  className: "schematic-plan-manager__row",
10962
11732
  "data-testid": "schematic-credit-group",
10963
11733
  children: [
10964
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "schematic-plan-manager__item", children: [
10965
- 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: [
10966
11736
  "(",
10967
11737
  row.count,
10968
11738
  ") "
10969
11739
  ] }),
10970
11740
  named ? `${row.bundleName} (${amount})` : amount
10971
11741
  ] }),
10972
- 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 }) })
10973
11743
  ]
10974
11744
  }
10975
11745
  );
@@ -10981,16 +11751,16 @@ function AutoTopupBox({
10981
11751
  target,
10982
11752
  url
10983
11753
  }) {
10984
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__auto-topup", children: [
10985
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
10986
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
10987
- 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", {
10988
11758
  amount: line.amount,
10989
11759
  threshold: line.threshold,
10990
11760
  unit: line.unit
10991
11761
  }) }, line.creditId))
10992
11762
  ] }),
10993
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
11763
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
10994
11764
  Cta,
10995
11765
  {
10996
11766
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-plan-manager__edit",
@@ -11010,10 +11780,10 @@ function Cta({
11010
11780
  url
11011
11781
  }) {
11012
11782
  if (onClick !== void 0) {
11013
- 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 });
11014
11784
  }
11015
11785
  if (url !== void 0) {
11016
- 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 });
11017
11787
  }
11018
11788
  return null;
11019
11789
  }
@@ -11022,20 +11792,20 @@ function periodWord(period, t) {
11022
11792
  return key === void 0 ? period : t(key);
11023
11793
  }
11024
11794
  function PlanManagerSkeleton() {
11025
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton", children: [
11026
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__heading" }),
11027
- [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "schematic-skeleton__row", children: [
11028
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11029
- /* @__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" })
11030
11800
  ] }, index))
11031
11801
  ] });
11032
11802
  }
11033
11803
  PlanManager.resources = ["company", "featureUsage", "creditBalances"];
11034
11804
 
11035
11805
  // src/elements/PricingTable.tsx
11036
- var import_schematic_react11 = require("@schematichq/schematic-react");
11037
- var import_react16 = require("react");
11038
- 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");
11039
11809
  var VISIBLE_ENTITLEMENT_COUNT = 4;
11040
11810
  var CARD_HEADING = {
11041
11811
  1: "h2",
@@ -11087,17 +11857,17 @@ function PricingTable({
11087
11857
  showZeroPriceAsFree = false,
11088
11858
  strings
11089
11859
  }) {
11090
- const catalog = (0, import_schematic_react11.useCatalog)(catalogId === void 0 ? {} : { catalogId });
11091
- 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)();
11092
11862
  const locale = useResolvedLocale(localeProp);
11093
11863
  const t = useTranslator(strings, localeProp);
11094
- const [chosenPeriod, setChosenPeriod] = (0, import_react16.useState)(defaultPeriod);
11095
- 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);
11096
11866
  const askedPeriod = periodProp ?? chosenPeriod;
11097
11867
  const askedCurrency = currencyProp ?? chosenCurrency;
11098
11868
  const companyMode = catalog.data?.source === "company";
11099
11869
  const companySettled = !companyMode || company.data !== void 0 || company.error !== void 0;
11100
- const view = (0, import_react16.useMemo)(
11870
+ const view = (0, import_react17.useMemo)(
11101
11871
  () => catalog.data === void 0 || !companySettled ? void 0 : derivePricingTable(catalog.data, {
11102
11872
  locale,
11103
11873
  period: askedPeriod,
@@ -11152,7 +11922,7 @@ function PricingTable({
11152
11922
  };
11153
11923
  const plansShown = showPlans && view !== void 0 && (view.plans.length > 0 || view.customPlan !== null);
11154
11924
  const addOnsShown = showAddOns && view !== void 0 && view.addOns.length > 0;
11155
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11925
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11156
11926
  StatusFrame,
11157
11927
  {
11158
11928
  className: cx("schematic-pricing-table", className),
@@ -11163,10 +11933,10 @@ function PricingTable({
11163
11933
  loadingLabel: t("pricingTableLoading"),
11164
11934
  onRetry: catalog.refetch,
11165
11935
  retryText: t("retry"),
11166
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PricingTableSkeleton, {}),
11167
- children: view !== void 0 && shared !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
11168
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11169
- (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)(
11170
11940
  Controls,
11171
11941
  {
11172
11942
  currencies: showCurrencySelector ? view.currencies : [],
@@ -11181,13 +11951,13 @@ function PricingTable({
11181
11951
  t
11182
11952
  }
11183
11953
  ),
11184
- plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
11954
+ plansShown && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11185
11955
  "ul",
11186
11956
  {
11187
11957
  "aria-label": t("pricingTablePlans"),
11188
11958
  className: "schematic-pricing-table__plans",
11189
11959
  children: [
11190
- view.plans.map((plan, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11960
+ view.plans.map((plan, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11191
11961
  Card2,
11192
11962
  {
11193
11963
  card: plan,
@@ -11197,7 +11967,7 @@ function PricingTable({
11197
11967
  },
11198
11968
  plan.id
11199
11969
  )),
11200
- view.customPlan !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11970
+ view.customPlan !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11201
11971
  CustomPlanCard2,
11202
11972
  {
11203
11973
  customPlan: view.customPlan,
@@ -11207,10 +11977,10 @@ function PricingTable({
11207
11977
  ]
11208
11978
  }
11209
11979
  ),
11210
- addOnsShown && !plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AddOnList, { shared })
11980
+ addOnsShown && !plansShown && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AddOnList, { shared })
11211
11981
  ] }),
11212
- addOnsShown && plansShown && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "schematic-pricing-table__section", children: [
11213
- 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)(
11214
11984
  SectionHeading,
11215
11985
  {
11216
11986
  className: "schematic-pricing-table__heading",
@@ -11218,19 +11988,19 @@ function PricingTable({
11218
11988
  children: t("pricingTableAddOns")
11219
11989
  }
11220
11990
  ),
11221
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AddOnList, { shared })
11991
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AddOnList, { shared })
11222
11992
  ] })
11223
11993
  ] })
11224
11994
  }
11225
11995
  );
11226
11996
  }
11227
11997
  function AddOnList({ shared }) {
11228
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
11998
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11229
11999
  "ul",
11230
12000
  {
11231
12001
  "aria-label": shared.t("pricingTableAddOns"),
11232
12002
  className: "schematic-pricing-table__plans",
11233
- 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)(
11234
12004
  Card2,
11235
12005
  {
11236
12006
  card: addOn,
@@ -11249,7 +12019,7 @@ function SectionHeading({
11249
12019
  level
11250
12020
  }) {
11251
12021
  const Heading = `h${level}`;
11252
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Heading, { className, children });
12022
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Heading, { className, children });
11253
12023
  }
11254
12024
  function Controls({
11255
12025
  currencies,
@@ -11268,8 +12038,8 @@ function Controls({
11268
12038
  if (heading === null && !showCurrencies && !showPeriods) {
11269
12039
  return null;
11270
12040
  }
11271
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-pricing-table__header", children: [
11272
- 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)(
11273
12043
  SectionHeading,
11274
12044
  {
11275
12045
  className: "schematic-pricing-table__heading",
@@ -11277,15 +12047,15 @@ function Controls({
11277
12047
  children: heading
11278
12048
  }
11279
12049
  ),
11280
- (showCurrencies || showPeriods) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-pricing-table__controls", children: [
11281
- 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)(
11282
12052
  "select",
11283
12053
  {
11284
12054
  "aria-label": t("pricingTableCurrency"),
11285
12055
  className: "schematic-select",
11286
12056
  value: currency,
11287
12057
  onChange: (event) => onCurrency(event.target.value),
11288
- children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12058
+ children: currencies.map((code) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11289
12059
  "option",
11290
12060
  {
11291
12061
  className: "schematic-select__option",
@@ -11296,14 +12066,14 @@ function Controls({
11296
12066
  ))
11297
12067
  }
11298
12068
  ),
11299
- showPeriods && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12069
+ showPeriods && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11300
12070
  "div",
11301
12071
  {
11302
12072
  "aria-label": t("pricingTablePeriod"),
11303
12073
  className: "schematic-toggle",
11304
12074
  role: "group",
11305
12075
  children: periods.map((option) => {
11306
- const button = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12076
+ const button = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11307
12077
  "button",
11308
12078
  {
11309
12079
  "aria-pressed": option === period,
@@ -11322,9 +12092,9 @@ function Controls({
11322
12092
  if (saved === void 0 || option === "month") {
11323
12093
  return button;
11324
12094
  }
11325
- 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: [
11326
12096
  button,
11327
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12097
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11328
12098
  "span",
11329
12099
  {
11330
12100
  className: "schematic-tooltip__content schematic-toggle__tip-content",
@@ -11349,11 +12119,11 @@ function Card2({
11349
12119
  shared
11350
12120
  }) {
11351
12121
  const { headingLevel, t, view } = shared;
11352
- const [expanded, setExpanded] = (0, import_react16.useState)(false);
11353
- const listId = (0, import_react16.useId)();
12122
+ const [expanded, setExpanded] = (0, import_react17.useState)(false);
12123
+ const listId = (0, import_react17.useId)();
11354
12124
  const Name = CARD_HEADING[headingLevel];
11355
12125
  const entitlements = expanded ? card2.entitlements : card2.entitlements.slice(0, VISIBLE_ENTITLEMENT_COUNT);
11356
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
12126
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
11357
12127
  "li",
11358
12128
  {
11359
12129
  className: cx(
@@ -11363,11 +12133,11 @@ function Card2({
11363
12133
  ),
11364
12134
  "data-plan-id": card2.id,
11365
12135
  children: [
11366
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__header", children: [
11367
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Name, { className: "schematic-plan-card__name", children: card2.name }),
11368
- shared.showDescription && card2.description !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "schematic-plan-card__description", children: card2.description }),
11369
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Price3, { price: card2.price, t }),
11370
- 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)(
11371
12141
  CreditItem,
11372
12142
  {
11373
12143
  credit,
@@ -11376,16 +12146,16 @@ function Card2({
11376
12146
  },
11377
12147
  `${credit.creditId}:${credit.perLicense ?? ""}`
11378
12148
  )) }),
11379
- 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", {
11380
12150
  count: view.trialDaysLeft.count,
11381
12151
  days: view.trialDaysLeft.days
11382
12152
  }) : t("pricingTableActive") })
11383
12153
  ] }),
11384
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__body", children: [
11385
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__features", children: [
11386
- shared.showEntitlements && card2.entitlements.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("ul", { className: "schematic-plan-card__entitlements", id: listId, children: [
11387
- inclusion !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { className: "schematic-plan-card__inclusion", children: t("pricingTableEverythingIn", { plan: inclusion }) }),
11388
- 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)(
11389
12159
  EntitlementItem,
11390
12160
  {
11391
12161
  row,
@@ -11394,7 +12164,7 @@ function Card2({
11394
12164
  row.featureId
11395
12165
  ))
11396
12166
  ] }),
11397
- 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)(
11398
12168
  "button",
11399
12169
  {
11400
12170
  "aria-controls": listId,
@@ -11403,19 +12173,19 @@ function Card2({
11403
12173
  type: "button",
11404
12174
  onClick: () => setExpanded((value) => !value),
11405
12175
  children: [
11406
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12176
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11407
12177
  "i",
11408
12178
  {
11409
12179
  "aria-hidden": "true",
11410
12180
  className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
11411
12181
  }
11412
12182
  ),
11413
- /* @__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") })
11414
12184
  ]
11415
12185
  }
11416
12186
  )
11417
12187
  ] }),
11418
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Action, { card: card2, kind, shared })
12188
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Action, { card: card2, kind, shared })
11419
12189
  ] })
11420
12190
  ]
11421
12191
  }
@@ -11423,9 +12193,9 @@ function Card2({
11423
12193
  }
11424
12194
  function Price3({ price, t }) {
11425
12195
  const per = price.kind === "amount" && price.period !== null ? periodWord2(price.period, t) : void 0;
11426
- 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: [
11427
12197
  priceText2(price, t),
11428
- 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: [
11429
12199
  "/",
11430
12200
  per
11431
12201
  ] })
@@ -11465,11 +12235,11 @@ function CreditItem({
11465
12235
  amount: credit.amount,
11466
12236
  creditName: credit.creditName
11467
12237
  });
11468
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-plan-card__credit", children: [
11469
- showIcon && credit.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "schematic-plan-card__icon", name: credit.icon }),
11470
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__feature", children: [
11471
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-card__feature-text", children: text }),
11472
- 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", {
11473
12243
  amount: credit.plus.amount,
11474
12244
  creditName: credit.plus.creditName
11475
12245
  }) : t("pricingTableCreditsPlusPerPeriod", {
@@ -11485,16 +12255,16 @@ function EntitlementItem({
11485
12255
  shared
11486
12256
  }) {
11487
12257
  const { locale, t } = shared;
11488
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-plan-card__entitlement", children: [
11489
- shared.showFeatureIcons && row.icon !== null && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Icon, { className: "schematic-plan-card__icon", name: row.icon }),
11490
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__feature", children: [
11491
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "schematic-plan-card__feature-text", children: entitlementText3(row, t) }),
11492
- (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: [
11493
12263
  row.detail?.kind === "overage" && t("pricingTableThen", {
11494
12264
  price: unitPrice2(row.detail, t)
11495
12265
  }),
11496
12266
  row.detail?.kind === "tiered" && t("pricingTableTierBased"),
11497
- 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)(
11498
12268
  PriceTiers,
11499
12269
  {
11500
12270
  currency: row.tiers.currency,
@@ -11506,12 +12276,12 @@ function EntitlementItem({
11506
12276
  unit: row.tiers.unit
11507
12277
  }
11508
12278
  ) }),
11509
- 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", {
11510
12280
  amount: row.hardLimit.amount,
11511
12281
  units: row.hardLimit.units
11512
12282
  }) })
11513
12283
  ] }),
11514
- 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 })
11515
12285
  ] })
11516
12286
  ] });
11517
12287
  }
@@ -11579,8 +12349,8 @@ function Action({
11579
12349
  upgrade: true
11580
12350
  };
11581
12351
  if (action2.kind === "current") {
11582
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__current", children: [
11583
- /* @__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)(
11584
12354
  "i",
11585
12355
  {
11586
12356
  "aria-hidden": "true",
@@ -11595,7 +12365,7 @@ function Action({
11595
12365
  if (link === void 0 && shared.onSelectPlan === void 0) {
11596
12366
  return null;
11597
12367
  }
11598
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12368
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11599
12369
  CallToAction,
11600
12370
  {
11601
12371
  className: "schematic-cta",
@@ -11605,7 +12375,7 @@ function Action({
11605
12375
  );
11606
12376
  }
11607
12377
  if (action2.kind === "downgradeBlocked") {
11608
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12378
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11609
12379
  CallToAction,
11610
12380
  {
11611
12381
  className: "schematic-cta schematic-cta--outline",
@@ -11635,8 +12405,8 @@ function Action({
11635
12405
  action2.kind === "remove" && "schematic-cta--ghost",
11636
12406
  action2.kind === "change" && "schematic-cta--outline"
11637
12407
  );
11638
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__action", children: [
11639
- 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)(
11640
12410
  "button",
11641
12411
  {
11642
12412
  className,
@@ -11645,7 +12415,7 @@ function Action({
11645
12415
  onClick: select,
11646
12416
  children: label
11647
12417
  }
11648
- ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
12418
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
11649
12419
  "a",
11650
12420
  {
11651
12421
  className,
@@ -11654,7 +12424,7 @@ function Action({
11654
12424
  children: label
11655
12425
  }
11656
12426
  ),
11657
- 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", {
11658
12428
  features: conjunction(
11659
12429
  action2.violations.map((violation) => violation.featureName),
11660
12430
  locale
@@ -11676,7 +12446,7 @@ function CallToAction({
11676
12446
  link,
11677
12447
  text
11678
12448
  }) {
11679
- 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)(
11680
12450
  "a",
11681
12451
  {
11682
12452
  className,
@@ -11693,12 +12463,12 @@ function CustomPlanCard2({
11693
12463
  }) {
11694
12464
  const { headingLevel, t } = shared;
11695
12465
  const Name = CARD_HEADING[headingLevel];
11696
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("li", { className: "schematic-card schematic-plan-card schematic-plan-card--custom", children: [
11697
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-plan-card__header", children: [
11698
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(Name, { className: "schematic-plan-card__name", children: t("pricingTableCustomPlan") }),
11699
- /* @__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") })
11700
12470
  ] }),
11701
- /* @__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)(
11702
12472
  "a",
11703
12473
  {
11704
12474
  className: "schematic-cta",
@@ -11719,20 +12489,20 @@ function periodWord2(period, t) {
11719
12489
  return key === void 0 ? period : t(key);
11720
12490
  }
11721
12491
  function PricingTableSkeleton() {
11722
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton", children: [
11723
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__heading" }),
11724
- [0, 1, 2].map((index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "schematic-skeleton__row", children: [
11725
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
11726
- /* @__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" })
11727
12497
  ] }, index))
11728
12498
  ] });
11729
12499
  }
11730
12500
  PricingTable.resources = ["catalog", "publicCatalog", "company"];
11731
12501
 
11732
12502
  // src/elements/UnsubscribeButton.tsx
11733
- var import_schematic_react12 = require("@schematichq/schematic-react");
11734
- var import_react17 = require("react");
11735
- 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");
11736
12506
  var TOTAL_KEY = {
11737
12507
  quarter: "unsubscribeQuarterlyTotal",
11738
12508
  year: "unsubscribeYearlyTotal"
@@ -11746,14 +12516,14 @@ function UnsubscribeButton({
11746
12516
  onUnsubscribed,
11747
12517
  strings
11748
12518
  }) {
11749
- const company = (0, import_schematic_react12.useCompany)();
11750
- const usage = (0, import_schematic_react12.useFeatureUsage)();
11751
- 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)();
11752
12522
  const locale = useResolvedLocale(localeProp);
11753
12523
  const t = useTranslator(strings, localeProp);
11754
- const [open, setOpen] = (0, import_react17.useState)(false);
11755
- const [failed, setFailed] = (0, import_react17.useState)(false);
11756
- 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)(
11757
12527
  () => company.data === void 0 || usage.data === void 0 ? void 0 : deriveUnsubscribe(company.data, usage.data, { locale }),
11758
12528
  [company.data, locale, usage.data]
11759
12529
  );
@@ -11762,7 +12532,7 @@ function UnsubscribeButton({
11762
12532
  if (error === void 0) {
11763
12533
  return null;
11764
12534
  }
11765
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12535
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11766
12536
  StatusFrame,
11767
12537
  {
11768
12538
  className: cx("schematic-card", "schematic-unsubscribe", className),
@@ -11802,7 +12572,7 @@ function UnsubscribeButton({
11802
12572
  onUnsubscribed?.();
11803
12573
  };
11804
12574
  const per = shortPeriod(view.period, t);
11805
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
12575
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
11806
12576
  "div",
11807
12577
  {
11808
12578
  className: cx(
@@ -11812,7 +12582,7 @@ function UnsubscribeButton({
11812
12582
  className
11813
12583
  ),
11814
12584
  children: [
11815
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12585
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11816
12586
  "button",
11817
12587
  {
11818
12588
  className: "schematic-cta schematic-unsubscribe__open",
@@ -11824,7 +12594,7 @@ function UnsubscribeButton({
11824
12594
  children: t("unsubscribeButton")
11825
12595
  }
11826
12596
  ),
11827
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12597
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11828
12598
  Dialog,
11829
12599
  {
11830
12600
  className: "schematic-unsubscribe__dialog",
@@ -11832,10 +12602,10 @@ function UnsubscribeButton({
11832
12602
  open,
11833
12603
  title: t("unsubscribeTitle"),
11834
12604
  onClose: close,
11835
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__columns", children: [
11836
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__summary", children: [
11837
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
11838
- /* @__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)(
11839
12609
  ManagePlan,
11840
12610
  {
11841
12611
  onClick: onManagePlan,
@@ -11845,44 +12615,44 @@ function UnsubscribeButton({
11845
12615
  }
11846
12616
  )
11847
12617
  ] }),
11848
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__sidebar", children: [
11849
- view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
11850
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
11851
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
11852
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
11853
- 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: [
11854
12624
  view.plan.price,
11855
- per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
12625
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
11856
12626
  "/",
11857
12627
  per
11858
12628
  ] })
11859
12629
  ] })
11860
12630
  ] })
11861
12631
  ] }),
11862
- view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
11863
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
11864
- view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
11865
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
11866
- /* @__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: [
11867
12637
  addOn.price,
11868
- !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: [
11869
12639
  "/",
11870
12640
  per
11871
12641
  ] })
11872
12642
  ] })
11873
12643
  ] }, addOn.id))
11874
12644
  ] }),
11875
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
11876
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
11877
- /* @__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: [
11878
12648
  view.total,
11879
- per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("sub", { children: [
12649
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("sub", { children: [
11880
12650
  "/",
11881
12651
  per
11882
12652
  ] })
11883
12653
  ] })
11884
12654
  ] }),
11885
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12655
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11886
12656
  "button",
11887
12657
  {
11888
12658
  className: "schematic-cta schematic-unsubscribe__confirm",
@@ -11892,7 +12662,7 @@ function UnsubscribeButton({
11892
12662
  children: t("unsubscribeConfirm")
11893
12663
  }
11894
12664
  ),
11895
- 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") })
11896
12666
  ] })
11897
12667
  ] })
11898
12668
  }
@@ -11911,9 +12681,9 @@ function ManagePlan({
11911
12681
  return null;
11912
12682
  }
11913
12683
  const label = t("unsubscribeManagePlan");
11914
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "schematic-unsubscribe__manage", children: [
11915
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: t("unsubscribeNotReady") }),
11916
- 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)(
11917
12687
  "button",
11918
12688
  {
11919
12689
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11921,7 +12691,7 @@ function ManagePlan({
11921
12691
  onClick,
11922
12692
  children: label
11923
12693
  }
11924
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
12694
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
11925
12695
  "a",
11926
12696
  {
11927
12697
  className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
@@ -11935,9 +12705,9 @@ function ManagePlan({
11935
12705
  UnsubscribeButton.resources = ["company", "featureUsage"];
11936
12706
 
11937
12707
  // src/elements/UpcomingBill.tsx
11938
- var import_schematic_react13 = require("@schematichq/schematic-react");
11939
- var import_react18 = require("react");
11940
- 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");
11941
12711
  function UpcomingBill({
11942
12712
  className,
11943
12713
  headingLevel = 2,
@@ -11948,10 +12718,10 @@ function UpcomingBill({
11948
12718
  showHeader = true,
11949
12719
  strings
11950
12720
  }) {
11951
- const { data: invoice, error, isPending, refetch } = (0, import_schematic_react13.useUpcomingInvoice)();
12721
+ const { data: invoice, error, isPending, refetch } = (0, import_schematic_react14.useUpcomingInvoice)();
11952
12722
  const locale = useResolvedLocale(localeProp);
11953
12723
  const t = useTranslator(strings, localeProp);
11954
- const bill = (0, import_react18.useMemo)(
12724
+ const bill = (0, import_react19.useMemo)(
11955
12725
  () => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
11956
12726
  [invoice, locale]
11957
12727
  );
@@ -11960,7 +12730,7 @@ function UpcomingBill({
11960
12730
  const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
11961
12731
  const unavailable = invoice === void 0 && httpStatus(error) === 404;
11962
12732
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
11963
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
12733
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
11964
12734
  StatusFrame,
11965
12735
  {
11966
12736
  className: cx("schematic-card", "schematic-upcoming-bill", className),
@@ -11971,11 +12741,11 @@ function UpcomingBill({
11971
12741
  loadingLabel: t("upcomingBillLoading"),
11972
12742
  onRetry: refetch,
11973
12743
  retryText: t("retry"),
11974
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(UpcomingBillSkeleton, { showHeader }),
11975
- 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: [
11976
- 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 }) }) }),
11977
- showAmount && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-upcoming-bill__amount", children: [
11978
- /* @__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)(
11979
12749
  "span",
11980
12750
  {
11981
12751
  className: "schematic-upcoming-bill__total",
@@ -11983,46 +12753,46 @@ function UpcomingBill({
11983
12753
  children: bill.amountDueText
11984
12754
  }
11985
12755
  ),
11986
- /* @__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") })
11987
12757
  ] }),
11988
- (balanceRows || discountRow) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-upcoming-bill__rows", children: [
11989
- 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)(
11990
12760
  "div",
11991
12761
  {
11992
12762
  className: "schematic-row schematic-upcoming-bill__balance-applied",
11993
12763
  "data-testid": "schematic-balance-applied",
11994
12764
  children: [
11995
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
11996
- /* @__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 })
11997
12767
  ]
11998
12768
  }
11999
12769
  ),
12000
- balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12770
+ balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12001
12771
  "div",
12002
12772
  {
12003
12773
  className: "schematic-row schematic-upcoming-bill__balance-remaining",
12004
12774
  "data-testid": "schematic-balance-remaining",
12005
12775
  children: [
12006
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
12007
- /* @__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 })
12008
12778
  ]
12009
12779
  }
12010
12780
  ),
12011
- discountRow && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
12781
+ discountRow && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
12012
12782
  "div",
12013
12783
  {
12014
12784
  className: "schematic-row schematic-upcoming-bill__discount-row",
12015
12785
  "data-testid": "schematic-discounts",
12016
12786
  children: [
12017
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
12018
- /* @__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)(
12019
12789
  "li",
12020
12790
  {
12021
12791
  className: "schematic-upcoming-bill__discount",
12022
12792
  "data-testid": "schematic-discount",
12023
12793
  children: [
12024
- discount.code !== null && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
12025
- /* @__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) })
12026
12796
  ]
12027
12797
  },
12028
12798
  `${discount.couponName}-${index}`
@@ -12036,10 +12806,10 @@ function UpcomingBill({
12036
12806
  );
12037
12807
  }
12038
12808
  function UpcomingBillSkeleton({ showHeader }) {
12039
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "schematic-skeleton", children: [
12040
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "schematic-skeleton__heading" }),
12041
- /* @__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" }) }),
12042
- /* @__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" }) })
12043
12813
  ] });
12044
12814
  }
12045
12815
  function discountText(discount, t) {