@schematichq/schematic-components 2.31.0 → 2.31.1

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.
@@ -45,13 +45,15 @@ var init_tokens = __esm({
45
45
  "hsla(0, 0%, 0%, 0.175)",
46
46
  "hsla(0, 0%, 100%, 0.2)"
47
47
  ),
48
- "--schematic-card-padding": "2.8125rem",
48
+ // 45px from a 750px viewport up; narrower screens give the content the
49
+ // room instead (about 22px on a 375px phone).
50
+ "--schematic-card-padding": "min(2.8125rem, 6vw)",
49
51
  "--schematic-danger": ld("#d75a5c", "#ff6b6e"),
50
52
  "--schematic-font-body": '"Public Sans", system-ui, sans-serif',
51
53
  "--schematic-font-heading": '"Manrope", system-ui, sans-serif',
52
54
  // Link buttons' face: Edit, Set default, Try again, and the rest.
53
55
  "--schematic-font-link": '"Inter", system-ui, sans-serif',
54
- "--schematic-line-height": "1.5",
56
+ "--schematic-line-height": "1.375",
55
57
  "--schematic-line-height-heading": "1.2",
56
58
  "--schematic-meter-track": ld("#f2f4f7", "#26282d"),
57
59
  "--schematic-muted": ld("#8a8a8a", "#a1a1a1"),
@@ -85,8 +87,8 @@ __export(PaymentMethodForm_exports, {
85
87
  resolveAppearance: () => resolveAppearance
86
88
  });
87
89
  import { useSetupIntent } from "@schematichq/schematic-react";
88
- import { useEffect as useEffect2, useId as useId3, useRef as useRef2, useState as useState2 } from "react";
89
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
90
+ import { useEffect as useEffect2, useId as useId3, useRef as useRef2, useState as useState3 } from "react";
91
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
90
92
  function orUndefined(value) {
91
93
  return value === void 0 || value === "" ? void 0 : value;
92
94
  }
@@ -108,13 +110,27 @@ function resolveAppearance(host) {
108
110
  fontFamily: style.fontFamily
109
111
  };
110
112
  probe.remove();
111
- const variables = {};
113
+ const variables = {
114
+ gridColumnSpacing: "1.5rem",
115
+ gridRowSpacing: "1.5rem",
116
+ spacingUnit: "0.25rem"
117
+ };
112
118
  for (const [name, value] of Object.entries(candidates)) {
113
119
  if (resolved(value)) {
114
120
  variables[name] = value;
115
121
  }
116
122
  }
117
- return { theme: "stripe", variables };
123
+ return {
124
+ theme: "stripe",
125
+ variables,
126
+ rules: {
127
+ ".Label": {
128
+ fontSize: "1rem",
129
+ fontWeight: "400",
130
+ marginBottom: "0.75rem"
131
+ }
132
+ }
133
+ };
118
134
  }
119
135
  function PaymentMethodForm({
120
136
  checkoutPrefill,
@@ -125,7 +141,7 @@ function PaymentMethodForm({
125
141
  t
126
142
  }) {
127
143
  const { create } = useSetupIntent();
128
- const [state, setState] = useState2({ status: "loading" });
144
+ const [state, setState] = useState3({ status: "loading" });
129
145
  const hostRef = useRef2(null);
130
146
  useEffect2(() => {
131
147
  let cancelled = false;
@@ -173,7 +189,7 @@ function PaymentMethodForm({
173
189
  };
174
190
  }, [create, locale]);
175
191
  if (state.status === "loading") {
176
- return /* @__PURE__ */ jsxs3(
192
+ return /* @__PURE__ */ jsxs5(
177
193
  "div",
178
194
  {
179
195
  "aria-busy": "true",
@@ -181,15 +197,15 @@ function PaymentMethodForm({
181
197
  "data-state": "pending",
182
198
  ref: hostRef,
183
199
  children: [
184
- /* @__PURE__ */ jsx4("span", { className: "schematic-hidden", children: t("paymentMethodsFormLoading") }),
185
- /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
200
+ /* @__PURE__ */ jsx6("span", { className: "schematic-hidden", children: t("paymentMethodsFormLoading") }),
201
+ /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
186
202
  ]
187
203
  }
188
204
  );
189
205
  }
190
206
  if (state.status === "failed") {
191
- return /* @__PURE__ */ jsxs3("div", { className: "schematic-payment-methods__form", "data-state": "error", children: [
192
- /* @__PURE__ */ jsx4(
207
+ return /* @__PURE__ */ jsxs5("div", { className: "schematic-payment-methods__form", "data-state": "error", children: [
208
+ /* @__PURE__ */ jsx6(
193
209
  "p",
194
210
  {
195
211
  className: "schematic-error schematic-small schematic-payment-methods__form-error",
@@ -197,11 +213,11 @@ function PaymentMethodForm({
197
213
  children: t(state.errorKey)
198
214
  }
199
215
  ),
200
- onSelectExisting !== void 0 && /* @__PURE__ */ jsx4(SelectExisting, { t, onSelectExisting })
216
+ onSelectExisting !== void 0 && /* @__PURE__ */ jsx6(SelectExisting, { t, onSelectExisting })
201
217
  ] });
202
218
  }
203
219
  const { Elements } = state.ui;
204
- return /* @__PURE__ */ jsx4(
220
+ return /* @__PURE__ */ jsx6(
205
221
  Elements,
206
222
  {
207
223
  stripe: state.stripe,
@@ -209,7 +225,7 @@ function PaymentMethodForm({
209
225
  appearance: state.appearance,
210
226
  clientSecret: state.clientSecret
211
227
  },
212
- children: /* @__PURE__ */ jsx4(
228
+ children: /* @__PURE__ */ jsx6(
213
229
  Fields,
214
230
  {
215
231
  checkoutPrefill,
@@ -241,13 +257,13 @@ function Fields({
241
257
  const emailId = useId3();
242
258
  const stripe = useStripe();
243
259
  const elements = useElements();
244
- const [saving, setSaving] = useState2(false);
245
- const [message, setMessage] = useState2(null);
246
- const [complete, setComplete] = useState2(false);
247
- const [ready, setReady] = useState2(false);
248
- const [loadFailed, setLoadFailed] = useState2(false);
249
- const [addressComplete, setAddressComplete] = useState2(!collectAddress);
250
- const [typedEmail, setTypedEmail] = useState2(null);
260
+ const [saving, setSaving] = useState3(false);
261
+ const [message, setMessage] = useState3(null);
262
+ const [complete, setComplete] = useState3(false);
263
+ const [ready, setReady] = useState3(false);
264
+ const [loadFailed, setLoadFailed] = useState3(false);
265
+ const [addressComplete, setAddressComplete] = useState3(!collectAddress);
266
+ const [typedEmail, setTypedEmail] = useState3(null);
251
267
  const email = typedEmail ?? orUndefined(prefill?.email) ?? "";
252
268
  const emailValid = !collectEmail || VALID_EMAIL.test(email);
253
269
  useEffect2(() => {
@@ -302,14 +318,14 @@ function Fields({
302
318
  setSaving(false);
303
319
  }
304
320
  };
305
- return /* @__PURE__ */ jsxs3(
321
+ return /* @__PURE__ */ jsxs5(
306
322
  "form",
307
323
  {
308
324
  className: "schematic-payment-methods__form",
309
325
  "data-state": "ready",
310
326
  onSubmit: (event) => void submit(event),
311
327
  children: [
312
- /* @__PURE__ */ jsx4("div", { className: "schematic-payment-methods__fields", children: /* @__PURE__ */ jsx4(
328
+ /* @__PURE__ */ jsx6("div", { className: "schematic-payment-methods__fields", children: /* @__PURE__ */ jsx6(
313
329
  PaymentElement,
314
330
  {
315
331
  onChange: (event) => setComplete(event.complete),
@@ -320,8 +336,8 @@ function Fields({
320
336
  }
321
337
  }
322
338
  ) }),
323
- collectEmail && /* @__PURE__ */ jsxs3("div", { className: "schematic-payment-methods__field", children: [
324
- /* @__PURE__ */ jsx4(
339
+ collectEmail && /* @__PURE__ */ jsxs5("div", { className: "schematic-payment-methods__field", children: [
340
+ /* @__PURE__ */ jsx6(
325
341
  "label",
326
342
  {
327
343
  className: "schematic-payment-methods__field-label",
@@ -329,7 +345,7 @@ function Fields({
329
345
  children: t("paymentMethodsEmail")
330
346
  }
331
347
  ),
332
- /* @__PURE__ */ jsx4(
348
+ /* @__PURE__ */ jsx6(
333
349
  "input",
334
350
  {
335
351
  autoComplete: "email",
@@ -343,7 +359,7 @@ function Fields({
343
359
  }
344
360
  )
345
361
  ] }),
346
- showAddress && /* @__PURE__ */ jsx4("div", { className: "schematic-payment-methods__address", children: /* @__PURE__ */ jsx4(
362
+ showAddress && /* @__PURE__ */ jsx6("div", { className: "schematic-payment-methods__address", children: /* @__PURE__ */ jsx6(
347
363
  AddressElement,
348
364
  {
349
365
  options: {
@@ -357,7 +373,7 @@ function Fields({
357
373
  },
358
374
  prefillName ?? ""
359
375
  ) }),
360
- loadFailed && /* @__PURE__ */ jsx4(
376
+ loadFailed && /* @__PURE__ */ jsx6(
361
377
  "p",
362
378
  {
363
379
  className: "schematic-error schematic-small schematic-payment-methods__form-error",
@@ -365,7 +381,7 @@ function Fields({
365
381
  children: t("paymentMethodsFormError")
366
382
  }
367
383
  ),
368
- message !== null && /* @__PURE__ */ jsx4(
384
+ message !== null && /* @__PURE__ */ jsx6(
369
385
  "p",
370
386
  {
371
387
  className: "schematic-error schematic-small schematic-payment-methods__form-error",
@@ -373,7 +389,7 @@ function Fields({
373
389
  children: message
374
390
  }
375
391
  ),
376
- /* @__PURE__ */ jsx4(
392
+ /* @__PURE__ */ jsx6(
377
393
  "button",
378
394
  {
379
395
  className: "schematic-cta schematic-payment-methods__save",
@@ -382,7 +398,7 @@ function Fields({
382
398
  children: saving ? t("paymentMethodsSaving") : t("paymentMethodsSave")
383
399
  }
384
400
  ),
385
- onSelectExisting !== void 0 && /* @__PURE__ */ jsx4(
401
+ onSelectExisting !== void 0 && /* @__PURE__ */ jsx6(
386
402
  SelectExisting,
387
403
  {
388
404
  disabled: saving,
@@ -399,7 +415,7 @@ function SelectExisting({
399
415
  onSelectExisting,
400
416
  t
401
417
  }) {
402
- return /* @__PURE__ */ jsx4(
418
+ return /* @__PURE__ */ jsx6(
403
419
  "button",
404
420
  {
405
421
  className: "schematic-link-button schematic-payment-methods__select-existing",
@@ -421,7 +437,7 @@ var init_PaymentMethodForm = __esm({
421
437
  [
422
438
  "background-color: var(--schematic-background)",
423
439
  "border-color: var(--schematic-accent)",
424
- "border-radius: var(--schematic-radius)",
440
+ "border-radius: calc(var(--schematic-radius) * 0.8)",
425
441
  "color: var(--schematic-text)",
426
442
  "font-family: var(--schematic-font-body)",
427
443
  "outline-color: var(--schematic-danger)",
@@ -438,7 +454,10 @@ var init_PaymentMethodForm = __esm({
438
454
  // src/elements/index.ts
439
455
  import {
440
456
  BillingDataProvider,
457
+ FEATURE_USER_USAGE_LIMIT,
441
458
  SchematicI18nProvider,
459
+ useFeatureUsage as useFeatureUsage2,
460
+ useFeatureUserUsage,
442
461
  useInvalidateBillingData,
443
462
  useInvoices as useInvoices2,
444
463
  usePaymentMethods as usePaymentMethods2,
@@ -1209,6 +1228,270 @@ function derivePaymentMethods(methods, options) {
1209
1228
  };
1210
1229
  }
1211
1230
 
1231
+ // src/elements/model/featureUsage.ts
1232
+ function pricePeriod(price) {
1233
+ if (price === void 0) {
1234
+ return null;
1235
+ }
1236
+ if (price.interval === "month" && price.intervalCount === 3) {
1237
+ return "quarter";
1238
+ }
1239
+ return price.interval;
1240
+ }
1241
+ function isTieredPrice(price) {
1242
+ return price !== void 0 && (price.priceTiers.length > 1 || price.tiersMode !== void 0 && price.tiersMode !== null);
1243
+ }
1244
+ function unitPrice(price) {
1245
+ return decimalOr(price.priceDecimal, price.price);
1246
+ }
1247
+ function usageLimit(row, options = {}) {
1248
+ let limit = null;
1249
+ const behavior = row.priceBehavior ?? null;
1250
+ if ((behavior === null || behavior === "pay_in_advance") && typeof row.allocation === "number") {
1251
+ limit = row.allocation;
1252
+ } else if (behavior === "overage" && typeof row.softLimit === "number") {
1253
+ limit = row.softLimit;
1254
+ }
1255
+ if (options.showWarningThresholdAsLimit === true && typeof row.warningThreshold === "number") {
1256
+ limit = row.warningThreshold;
1257
+ }
1258
+ return limit;
1259
+ }
1260
+ function currentTier(row) {
1261
+ const tiers = row.price?.priceTiers ?? [];
1262
+ if (row.priceBehavior === "overage" && typeof row.softLimit === "number") {
1263
+ const overage = tiers.length === 2 ? tiers[1] : void 0;
1264
+ return overage === void 0 ? null : { ...tierRange(overage), from: row.softLimit + 1 };
1265
+ }
1266
+ if (row.priceBehavior === "tier" && typeof row.usage === "number") {
1267
+ const usage = row.usage;
1268
+ const tier = tiers.find(
1269
+ (t) => usage >= t.from && (t.to === void 0 || t.to === null || usage <= t.to)
1270
+ );
1271
+ return tier === void 0 ? null : tierRange(tier);
1272
+ }
1273
+ return null;
1274
+ }
1275
+ function tierRanges(price) {
1276
+ return (price?.priceTiers ?? []).map((tier, index) => {
1277
+ const range = tierRange(tier);
1278
+ return index === 0 ? { ...range, from: Math.max(1, range.from) } : range;
1279
+ });
1280
+ }
1281
+ function tierRange(tier) {
1282
+ return {
1283
+ from: tier.from,
1284
+ to: tier.to ?? null,
1285
+ flatPrice: tier.flatPrice ?? null,
1286
+ perUnitPrice: tier.perUnitPriceDecimal !== void 0 && tier.perUnitPriceDecimal !== null ? decimalOr(tier.perUnitPriceDecimal, tier.perUnitPrice ?? 0) : tier.perUnitPrice ?? null
1287
+ };
1288
+ }
1289
+ function decimalOr(decimal, fallback) {
1290
+ if (decimal === void 0 || decimal === null) {
1291
+ return fallback;
1292
+ }
1293
+ const parsed = Number(decimal);
1294
+ return Number.isFinite(parsed) ? parsed : fallback;
1295
+ }
1296
+
1297
+ // src/elements/model/includedFeatures.ts
1298
+ function deriveIncludedFeatures(features, options) {
1299
+ const ordered = options.visibleFeatures === void 0 ? features : options.visibleFeatures.flatMap((id) => {
1300
+ const row = features.find((f) => f.featureId === id);
1301
+ return row === void 0 ? [] : [row];
1302
+ });
1303
+ return ordered.map((row) => includedFeatureRow(row, options));
1304
+ }
1305
+ function includedFeatureRow(row, options) {
1306
+ const { locale } = options;
1307
+ const feature = {
1308
+ name: row.featureName,
1309
+ singularName: row.featureSingularName,
1310
+ pluralName: row.featurePluralName
1311
+ };
1312
+ const expiresAt = usableDate(row.expiresAt);
1313
+ const tiered = row.priceBehavior === "pay_in_advance" && isTieredPrice(row.price);
1314
+ const period = pricePeriod(row.price);
1315
+ return {
1316
+ featureId: row.featureId,
1317
+ name: row.featureName,
1318
+ description: nonEmpty(row.featureDescription),
1319
+ icon: nonEmpty(row.featureIcon),
1320
+ perLicenseCredits: row.perLicenseCreditGrants.filter((grant) => grant.scaling === "per_license").map((grant) => ({
1321
+ amount: grant.creditAmount,
1322
+ creditName: featureName(
1323
+ {
1324
+ name: grant.creditName,
1325
+ singularName: grant.creditSingularName,
1326
+ pluralName: grant.creditPluralName
1327
+ },
1328
+ grant.creditAmount,
1329
+ locale
1330
+ ),
1331
+ licenseName: featureName(feature, 1, locale)
1332
+ })),
1333
+ expiresAt: expiresAt === void 0 ? null : {
1334
+ date: expiresAt,
1335
+ text: formatDate(expiresAt, locale, { month: "short" })
1336
+ },
1337
+ entitlement: entitlementText(row, options),
1338
+ usage: usageSegments(row, locale, tiered, period),
1339
+ usageSummary: usageSummary(row, options),
1340
+ hardLimit: row.priceBehavior !== void 0 && row.priceBehavior !== null && row.priceBehavior !== "credit_burndown" && row.valueType === "numeric" && typeof row.allocation === "number" ? {
1341
+ amount: row.allocation,
1342
+ units: featureName(feature, row.allocation, locale)
1343
+ } : null,
1344
+ tiers: (row.priceBehavior === "tier" || tiered) && row.price !== void 0 ? {
1345
+ ranges: tierRanges(row.price),
1346
+ currency: row.price.currency,
1347
+ mode: row.price.tiersMode ?? null,
1348
+ period
1349
+ } : null,
1350
+ source: row
1351
+ };
1352
+ }
1353
+ function isMetered(row) {
1354
+ return row.featureType === "event" || row.featureType === "trait";
1355
+ }
1356
+ function entitlementText(row, options) {
1357
+ if (!isMetered(row)) {
1358
+ return null;
1359
+ }
1360
+ const { locale } = options;
1361
+ const feature = {
1362
+ name: row.featureName,
1363
+ singularName: row.featureSingularName,
1364
+ pluralName: row.featurePluralName
1365
+ };
1366
+ const units = (count) => ({
1367
+ amount: formatNumber(count, locale),
1368
+ units: featureName(feature, count, locale)
1369
+ });
1370
+ switch (row.priceBehavior) {
1371
+ case "pay_in_advance":
1372
+ return typeof row.allocation === "number" ? { kind: "units", ...units(row.allocation) } : null;
1373
+ case "pay_as_you_go": {
1374
+ if (row.price === void 0) {
1375
+ return null;
1376
+ }
1377
+ const cost = formatCurrency(
1378
+ unitPrice(row.price),
1379
+ row.price.currency,
1380
+ locale
1381
+ );
1382
+ const size = row.price.packageSize;
1383
+ return size > 1 ? {
1384
+ kind: "perPackage",
1385
+ cost,
1386
+ size,
1387
+ units: featureName(feature, size, locale)
1388
+ } : { kind: "perUnit", cost, unit: featureName(feature, 1, locale) };
1389
+ }
1390
+ case "overage":
1391
+ return typeof row.softLimit === "number" ? { kind: "units", ...units(row.softLimit) } : null;
1392
+ case "tier": {
1393
+ const tier = currentTier(row);
1394
+ if (tier === null) {
1395
+ return null;
1396
+ }
1397
+ return tier.to === null ? { kind: "tierUnlimited", feature: featureName(feature, 0, locale) } : {
1398
+ kind: "tierUpTo",
1399
+ amount: formatNumber(tier.to, locale),
1400
+ feature: featureName(feature, tier.to, locale)
1401
+ };
1402
+ }
1403
+ case "credit_burndown":
1404
+ if (options.showCredits === false || typeof row.consumptionRate !== "number" || row.creditName === void 0 || row.creditName === null) {
1405
+ return null;
1406
+ }
1407
+ return {
1408
+ kind: "perUse",
1409
+ amount: formatConsumptionRate(row.consumptionRate, locale),
1410
+ units: featureName(
1411
+ {
1412
+ name: row.creditName,
1413
+ singularName: row.creditSingularName,
1414
+ pluralName: row.creditPluralName
1415
+ },
1416
+ row.consumptionRate,
1417
+ locale
1418
+ )
1419
+ };
1420
+ default:
1421
+ break;
1422
+ }
1423
+ if (typeof row.allocation === "number") {
1424
+ const limit = usageLimit(row, options) ?? row.allocation;
1425
+ return { kind: "units", ...units(limit) };
1426
+ }
1427
+ if (row.valueType === "unlimited") {
1428
+ return { kind: "unlimited", item: featureName(feature, 0, locale) };
1429
+ }
1430
+ return null;
1431
+ }
1432
+ function usageSegments(row, locale, tiered, period) {
1433
+ if (!isMetered(row)) {
1434
+ return [];
1435
+ }
1436
+ const feature = {
1437
+ name: row.featureName,
1438
+ singularName: row.featureSingularName,
1439
+ pluralName: row.featurePluralName
1440
+ };
1441
+ const segments = [];
1442
+ if (row.priceBehavior === "pay_in_advance" && !tiered && period !== null && row.price !== void 0) {
1443
+ const size = row.price.packageSize;
1444
+ segments.push({
1445
+ kind: "unitPricePerPeriod",
1446
+ cost: formatCurrency(unitPrice(row.price), row.price.currency, locale),
1447
+ size,
1448
+ units: featureName(feature, size, locale),
1449
+ period
1450
+ });
1451
+ } else if ((row.priceBehavior === "pay_as_you_go" || row.priceBehavior === "overage" || row.priceBehavior === "tier" || row.priceBehavior === "credit_burndown" || tiered) && typeof row.usage === "number") {
1452
+ segments.push({
1453
+ kind: "used",
1454
+ amount: String(row.usage),
1455
+ units: featureName(feature, row.usage, locale)
1456
+ });
1457
+ }
1458
+ if (typeof row.currentCost === "number" && row.currentCost > 0 && row.price !== void 0) {
1459
+ segments.push({
1460
+ kind: "cost",
1461
+ cost: formatCurrency(row.currentCost, row.price.currency, locale),
1462
+ period: row.featureType === "trait" ? period : null
1463
+ });
1464
+ }
1465
+ const resetsAt = usableDate(row.resetsAt);
1466
+ if (resetsAt !== void 0) {
1467
+ segments.push({
1468
+ kind: "resets",
1469
+ date: formatDate(resetsAt, locale, { month: "short", year: void 0 })
1470
+ });
1471
+ }
1472
+ return segments;
1473
+ }
1474
+ function usageSummary(row, options) {
1475
+ if (!isMetered(row) || typeof row.usage !== "number") {
1476
+ return null;
1477
+ }
1478
+ const amount = formatNumber(row.usage, options.locale);
1479
+ if (typeof row.allocation === "number") {
1480
+ return {
1481
+ kind: "limited",
1482
+ amount,
1483
+ allocation: formatNumber(
1484
+ usageLimit(row, options) ?? row.allocation,
1485
+ options.locale
1486
+ )
1487
+ };
1488
+ }
1489
+ return { kind: "unlimited", amount };
1490
+ }
1491
+ function nonEmpty(value) {
1492
+ return value === void 0 || value === null || value === "" ? null : value;
1493
+ }
1494
+
1212
1495
  // src/elements/strings.ts
1213
1496
  var DEFAULT_STRINGS_LOCALE = "en";
1214
1497
  var DEFAULT_STRINGS = {
@@ -1275,7 +1558,37 @@ var DEFAULT_STRINGS = {
1275
1558
  paymentMethodsSaving: "Loading",
1276
1559
  paymentMethodsSaveError: "A problem occurred while saving your payment method.",
1277
1560
  paymentMethodsSetDefaultError: "Error updating payment method. Please try again.",
1278
- paymentMethodsRemoveError: "Error deleting payment method. Please try again."
1561
+ paymentMethodsRemoveError: "Error deleting payment method. Please try again.",
1562
+ includedFeaturesLoading: "Loading features",
1563
+ includedFeaturesHeader: "Included features",
1564
+ includedFeaturesError: "There was a problem retrieving your features.",
1565
+ includedFeaturesUnavailable: "Features are not available for this account.",
1566
+ includedFeaturesSeeAll: "See all",
1567
+ includedFeaturesHideAll: "Hide all",
1568
+ includedFeaturesExpires: "Expires {{date}}",
1569
+ includedFeaturesPerLicense: "Includes {{amount}} {{creditName}} per {{licenseName}}",
1570
+ // Shared by the usage elements.
1571
+ usageUnits: "{{amount}} {{units}}",
1572
+ usagePerUnit: "{{cost}} per {{unit}}",
1573
+ usagePerPackage: "{{cost}} per {{size}} {{units}}",
1574
+ usageTierUpTo: "Up to {{amount}} {{feature}} in this tier",
1575
+ usageTierUnlimited: "Unlimited {{feature}} in this tier",
1576
+ usagePerUse: "{{amount}} {{units}} per use",
1577
+ usageUnlimited: "Unlimited {{item}}",
1578
+ usageUnitPricePerPeriod: "{{cost}}/{{unit}}/{{period}}",
1579
+ usagePackagePricePerPeriod: "{{cost}}/{{size}} {{units}}/{{period}}",
1580
+ usageUsed: "{{amount}} {{units}} used",
1581
+ usageResets: "Resets {{date}}",
1582
+ usageLimited: "{{amount}} of {{allocation}} used",
1583
+ usageUnlimitedUsed: "{{amount}} used",
1584
+ usageHardLimitLabel: "Limit",
1585
+ usageHardLimit: "Up to a limit of {{amount}} {{units}}",
1586
+ usageTieredPricingLabel: "Tiered pricing",
1587
+ usageTiersVolume: "Price by unit based on final tier reached.",
1588
+ usageTiersGraduated: "Tiers apply progressively as quantity increases.",
1589
+ periodMonthShort: "mo",
1590
+ periodQuarterShort: "qtr",
1591
+ periodYearShort: "yr"
1279
1592
  };
1280
1593
  var MISSING_STRING = "\0schematic:missing";
1281
1594
  function interpolate(template, vars) {
@@ -1314,15 +1627,29 @@ var dialogCss = `
1314
1627
  border: 0;
1315
1628
  border-radius: 0.5rem;
1316
1629
  box-shadow: var(--schematic-shadow);
1630
+ box-sizing: border-box;
1317
1631
  color: var(--schematic-text);
1318
- line-height: 1.375;
1319
1632
  margin: auto;
1320
1633
  max-height: calc(100vh - 2 * var(--schematic-space));
1321
- max-width: 48rem;
1634
+ max-width: none;
1322
1635
  /* No padding of its own: a click on the backdrop lands on the dialog
1323
1636
  itself, and one inside lands on the header or body. */
1324
1637
  padding: 0;
1325
- width: calc(100% - 2 * var(--schematic-space));
1638
+ /* Never wider than the screen, whatever it holds. */
1639
+ width: min(48rem, calc(100vw - 2 * var(--schematic-space)));
1640
+ }
1641
+
1642
+ /* Centred by vw on a phone: a host page wider than the screen widens the
1643
+ layout viewport, and auto margins would centre the dialog half off the
1644
+ screen. Desktop keeps auto margins, as vw counts the scrollbar there. */
1645
+ @media (max-width: 52rem) {
1646
+ .schematic-dialog {
1647
+ inset-inline: 0 auto;
1648
+ margin-inline: calc(
1649
+ (100vw - min(48rem, calc(100vw - 2 * var(--schematic-space)))) / 2
1650
+ )
1651
+ 0;
1652
+ }
1326
1653
  }
1327
1654
 
1328
1655
  .schematic-dialog::backdrop {
@@ -1354,7 +1681,7 @@ var dialogCss = `
1354
1681
  font-family: var(--schematic-font-body);
1355
1682
  font-size: 1.125rem;
1356
1683
  font-weight: 400;
1357
- line-height: var(--schematic-line-height-heading);
1684
+ line-height: var(--schematic-line-height);
1358
1685
  margin: 0;
1359
1686
  }
1360
1687
 
@@ -1383,6 +1710,8 @@ var dialogCss = `
1383
1710
  display: flex;
1384
1711
  flex-direction: column;
1385
1712
  gap: var(--schematic-space);
1713
+ min-width: 0;
1714
+ overflow-wrap: anywhere;
1386
1715
  padding: calc(var(--schematic-space) * 1.5);
1387
1716
  }
1388
1717
  `;
@@ -1797,6 +2126,109 @@ var iconsCss = String.raw`
1797
2126
  }
1798
2127
  `;
1799
2128
 
2129
+ // src/elements/styles/included-features.ts
2130
+ var includedFeaturesCss = `
2131
+ .schematic-included-features {
2132
+ container-type: inline-size;
2133
+ }
2134
+
2135
+ .schematic-included-features__list {
2136
+ display: flex;
2137
+ flex-direction: column;
2138
+ gap: calc(var(--schematic-space) * 1.5);
2139
+ list-style: none;
2140
+ margin: 0;
2141
+ padding: 0;
2142
+ }
2143
+
2144
+ /* Icon, name and details; the usage drops beneath on a narrow card. */
2145
+ .schematic-included-features__row {
2146
+ column-gap: 0.5rem;
2147
+ display: grid;
2148
+ grid-template-columns: min-content 1fr;
2149
+ }
2150
+
2151
+ /* Two classes: the icon font's own rule comes later in the sheet and sets
2152
+ display, which would leave the glyph in the circle's corner. */
2153
+ .schematic-included-features .schematic-included-features__icon {
2154
+ align-items: center;
2155
+ background: var(--schematic-surface);
2156
+ border-radius: 9999px;
2157
+ color: var(--schematic-accent);
2158
+ display: inline-flex;
2159
+ font-size: 1.5rem;
2160
+ height: 2.75rem;
2161
+ justify-content: center;
2162
+ margin-inline-end: 0.5rem;
2163
+ width: 2.75rem;
2164
+ }
2165
+
2166
+ .schematic-included-features__details {
2167
+ align-self: baseline;
2168
+ display: flex;
2169
+ flex-direction: column;
2170
+ gap: 0.25rem;
2171
+ grid-column: 2;
2172
+ }
2173
+
2174
+ /* An item name, as add-ons and plan lines elsewhere. */
2175
+ .schematic-included-features__name {
2176
+ font-family: var(--schematic-font-heading);
2177
+ font-size: 1.125rem;
2178
+ font-weight: 800;
2179
+ line-height: var(--schematic-line-height-heading);
2180
+ }
2181
+
2182
+ .schematic-included-features__usage {
2183
+ display: flex;
2184
+ flex-direction: column;
2185
+ gap: 0.25rem;
2186
+ grid-column: 1 / span 2;
2187
+ margin-inline-start: 3.75rem;
2188
+ margin-top: 0.75rem;
2189
+ }
2190
+
2191
+ .schematic-included-features__entitlement,
2192
+ .schematic-included-features__used {
2193
+ font-variant-numeric: tabular-nums;
2194
+ }
2195
+
2196
+ @container (min-width: 23.4375rem) {
2197
+ /* The usage takes the room it needs and wraps only when the name leaves
2198
+ it none. */
2199
+ .schematic-included-features__row {
2200
+ grid-template-columns: min-content 1fr auto;
2201
+ }
2202
+
2203
+ .schematic-included-features__usage {
2204
+ align-self: baseline;
2205
+ grid-column: 3;
2206
+ margin-inline-start: 0;
2207
+ margin-top: 0;
2208
+ text-align: end;
2209
+ }
2210
+ }
2211
+
2212
+ .schematic-included-features__toggle {
2213
+ align-items: center;
2214
+ display: inline-flex;
2215
+ gap: 0.25rem;
2216
+ margin-top: var(--schematic-space);
2217
+ }
2218
+
2219
+ .schematic-included-features__toggle .schematic-chevron {
2220
+ margin-inline-start: -0.333rem;
2221
+ }
2222
+
2223
+ .schematic-included-features .schematic-skeleton__cell[data-column="name"] {
2224
+ width: 10rem;
2225
+ }
2226
+
2227
+ .schematic-included-features .schematic-skeleton__cell[data-column="usage"] {
2228
+ width: 6rem;
2229
+ }
2230
+ `;
2231
+
1800
2232
  // src/elements/styles/invoices.ts
1801
2233
  var invoicesCss = `
1802
2234
  .schematic-invoices {
@@ -1826,6 +2258,7 @@ var invoicesCss = `
1826
2258
 
1827
2259
  .schematic-invoices__link {
1828
2260
  color: var(--schematic-accent);
2261
+ font-family: var(--schematic-font-link);
1829
2262
  text-decoration: none;
1830
2263
  }
1831
2264
 
@@ -1841,10 +2274,6 @@ var invoicesCss = `
1841
2274
  text-align: end;
1842
2275
  }
1843
2276
 
1844
- .schematic-invoices__credit {
1845
- color: var(--schematic-muted);
1846
- }
1847
-
1848
2277
  .schematic-invoices__actions {
1849
2278
  align-items: center;
1850
2279
  display: flex;
@@ -1855,23 +2284,12 @@ var invoicesCss = `
1855
2284
  .schematic-invoices__see-more {
1856
2285
  align-items: center;
1857
2286
  display: inline-flex;
1858
- gap: 0.375rem;
2287
+ gap: calc(var(--schematic-space) / 2);
1859
2288
  }
1860
2289
 
1861
- /* A chevron drawn from two borders. The vertical nudge lives in the
1862
- transform with the rotation so one transition carries both. */
2290
+ /* Cancels the glyph's side bearing, so the chevron sits flush. */
1863
2291
  .schematic-invoices__chevron {
1864
- border-block-end: 2px solid var(--schematic-muted);
1865
- border-inline-end: 2px solid var(--schematic-muted);
1866
- display: inline-block;
1867
- height: 0.5em;
1868
- transform: translateY(-0.125em) rotate(45deg);
1869
- transition: transform 0.15s;
1870
- width: 0.5em;
1871
- }
1872
-
1873
- .schematic-invoices__see-more[aria-expanded="true"] .schematic-invoices__chevron {
1874
- transform: translateY(0.125em) rotate(-135deg);
2292
+ margin-inline-start: -0.333rem;
1875
2293
  }
1876
2294
 
1877
2295
  .schematic-invoices__empty {
@@ -1900,10 +2318,6 @@ var paymentMethodsCss = `
1900
2318
  margin-bottom: 0;
1901
2319
  }
1902
2320
 
1903
- .schematic-payment-methods .schematic-header__title {
1904
- margin-bottom: 0;
1905
- }
1906
-
1907
2321
  .schematic-payment-methods__expiry-warning {
1908
2322
  color: var(--schematic-danger);
1909
2323
  white-space: nowrap;
@@ -1920,12 +2334,21 @@ var paymentMethodsCss = `
1920
2334
  padding: calc(var(--schematic-space) / 2.25) var(--schematic-space);
1921
2335
  }
1922
2336
 
2337
+ /* One line: a label too long for the space truncates rather than wrapping
2338
+ "Card ending in" away from its digits or widening the dialog. */
1923
2339
  .schematic-payment-methods__method {
1924
2340
  align-items: center;
1925
2341
  display: inline-flex;
1926
2342
  flex-grow: 1;
1927
- flex-wrap: wrap;
1928
2343
  gap: 0.25em;
2344
+ min-width: 0;
2345
+ }
2346
+
2347
+ .schematic-payment-methods__label {
2348
+ min-width: 0;
2349
+ overflow: hidden;
2350
+ text-overflow: ellipsis;
2351
+ white-space: nowrap;
1929
2352
  }
1930
2353
 
1931
2354
  /* The brand's mark before the label, in the label's colour. */
@@ -1937,6 +2360,7 @@ var paymentMethodsCss = `
1937
2360
  }
1938
2361
 
1939
2362
  .schematic-payment-methods__last4 {
2363
+ flex-shrink: 0;
1940
2364
  font-variant-numeric: tabular-nums;
1941
2365
  }
1942
2366
 
@@ -1950,14 +2374,16 @@ var paymentMethodsCss = `
1950
2374
  white-space: nowrap;
1951
2375
  }
1952
2376
 
1953
- /* The toggle that reveals the other methods, with its chevron: down while
1954
- folded, up while unfolded, each its own glyph. The chevron sits beside
1955
- the link in the text colour rather than as part of it. A flex container hands its underline to every item, and an item
1956
- cannot take it off, so the hover underline goes on the label alone. */
2377
+ /* The toggle that reveals the other methods. Its chevron is a glyph per
2378
+ state, down while folded and up while unfolded, and the hover underline
2379
+ goes on the label alone, as on every toggle. */
1957
2380
  .schematic-payment-methods__choose {
1958
2381
  align-items: center;
1959
2382
  align-self: flex-start;
1960
2383
  display: inline-flex;
2384
+ /* A button centres its text; a label that wraps on a phone keeps to the
2385
+ start. */
2386
+ text-align: start;
1961
2387
  gap: calc(var(--schematic-space) / 2);
1962
2388
  }
1963
2389
 
@@ -1969,10 +2395,6 @@ var paymentMethodsCss = `
1969
2395
  text-decoration: underline;
1970
2396
  }
1971
2397
 
1972
- .schematic-payment-methods__chevron {
1973
- color: var(--schematic-text);
1974
- font-size: 1.5em;
1975
- }
1976
2398
 
1977
2399
  /* A faintly tinted panel, roomier than the shared dialog body, with its
1978
2400
  parts spaced further apart. */
@@ -2016,6 +2438,12 @@ var paymentMethodsCss = `
2016
2438
  padding: calc(var(--schematic-space) / 2) 0;
2017
2439
  }
2018
2440
 
2441
+ /* The name takes the line's room first; the actions wrap under it before
2442
+ the name is cut short. */
2443
+ .schematic-payment-methods__row .schematic-payment-methods__method {
2444
+ flex: 1 1 10rem;
2445
+ }
2446
+
2019
2447
  .schematic-payment-methods__expires {
2020
2448
  flex-grow: 1;
2021
2449
  font-variant-numeric: tabular-nums;
@@ -2089,23 +2517,31 @@ var paymentMethodsCss = `
2089
2517
  white-space: nowrap;
2090
2518
  }
2091
2519
 
2520
+ /* Spaced as the embed's form: 24px between parts, and a wider break before
2521
+ Save under the address. */
2092
2522
  .schematic-payment-methods__form {
2093
2523
  display: flex;
2094
2524
  flex-direction: column;
2095
- gap: var(--schematic-space);
2525
+ gap: calc(var(--schematic-space) * 1.5);
2096
2526
  }
2097
2527
 
2098
- /* The fields the checkout settings add beside Stripe's own. */
2528
+ .schematic-payment-methods__address {
2529
+ margin-bottom: calc(var(--schematic-space) * 2);
2530
+ }
2531
+
2532
+ /* The fields the checkout settings add beside Stripe's own, labelled as
2533
+ Stripe's are. */
2099
2534
  .schematic-payment-methods__field {
2100
2535
  display: flex;
2101
2536
  flex-direction: column;
2102
- gap: calc(var(--schematic-space) / 2);
2537
+ gap: calc(var(--schematic-space) * 0.75);
2103
2538
  }
2104
2539
 
2105
2540
  .schematic-payment-methods__input {
2106
2541
  background: var(--schematic-background);
2107
2542
  border: 1px solid var(--schematic-border);
2108
- border-radius: var(--schematic-radius);
2543
+ /* The embed's 8px at the default radius; Stripe's fields take the same. */
2544
+ border-radius: calc(var(--schematic-radius) * 0.8);
2109
2545
  box-sizing: border-box;
2110
2546
  color: var(--schematic-text);
2111
2547
  font: inherit;
@@ -2136,6 +2572,83 @@ var paymentMethodsCss = `
2136
2572
  // src/elements/styles/index.tsx
2137
2573
  init_tokens();
2138
2574
 
2575
+ // src/elements/styles/tooltip.ts
2576
+ var tooltipCss = `
2577
+ .schematic-tooltip {
2578
+ display: inline-block;
2579
+ margin-inline-start: 0.25rem;
2580
+ position: relative;
2581
+ vertical-align: middle;
2582
+ }
2583
+
2584
+ .schematic-tooltip__trigger {
2585
+ background: none;
2586
+ border: 0;
2587
+ color: var(--schematic-muted);
2588
+ cursor: help;
2589
+ /* A button keeps the browser's control font; the glyph is the embed's
2590
+ 24px. */
2591
+ font-size: 1.5rem;
2592
+ line-height: 0;
2593
+ padding: 0;
2594
+ }
2595
+
2596
+ .schematic-tooltip__trigger:focus-visible {
2597
+ outline: 2px solid var(--schematic-accent);
2598
+ outline-offset: 2px;
2599
+ }
2600
+
2601
+ .schematic-tooltip__content {
2602
+ background: var(--schematic-background);
2603
+ border: 1px solid var(--schematic-border);
2604
+ border-radius: calc(var(--schematic-radius) / 2);
2605
+ bottom: calc(100% + 0.5rem);
2606
+ box-shadow: var(--schematic-shadow);
2607
+ color: var(--schematic-text);
2608
+ font-size: 0.875rem;
2609
+ inset-inline-end: 0;
2610
+ padding: 0.5rem 0.75rem;
2611
+ pointer-events: none;
2612
+ position: absolute;
2613
+ text-align: start;
2614
+ visibility: hidden;
2615
+ white-space: nowrap;
2616
+ z-index: 1;
2617
+ }
2618
+
2619
+ .schematic-tooltip:hover .schematic-tooltip__content,
2620
+ .schematic-tooltip:focus-within .schematic-tooltip__content {
2621
+ visibility: visible;
2622
+ }
2623
+
2624
+ .schematic-tiers {
2625
+ display: flex;
2626
+ flex-direction: column;
2627
+ gap: 0.5rem;
2628
+ }
2629
+
2630
+ .schematic-tiers__list {
2631
+ margin: 0;
2632
+ }
2633
+
2634
+ .schematic-tiers__tier {
2635
+ display: flex;
2636
+ gap: var(--schematic-space);
2637
+ justify-content: space-between;
2638
+ padding: 0.25rem 0;
2639
+ }
2640
+
2641
+ .schematic-tiers__price {
2642
+ margin: 0;
2643
+ }
2644
+
2645
+ .schematic-tiers__mode {
2646
+ border-top: 1px solid var(--schematic-border);
2647
+ padding-top: 0.5rem;
2648
+ white-space: normal;
2649
+ }
2650
+ `;
2651
+
2139
2652
  // src/elements/styles/upcoming-bill.ts
2140
2653
  var upcomingBillCss = `
2141
2654
  .schematic-upcoming-bill {
@@ -2148,10 +2661,6 @@ var upcomingBillCss = `
2148
2661
  margin-bottom: 0;
2149
2662
  }
2150
2663
 
2151
- .schematic-upcoming-bill .schematic-header__title {
2152
- margin-bottom: 0;
2153
- }
2154
-
2155
2664
  .schematic-upcoming-bill__amount {
2156
2665
  align-items: flex-start;
2157
2666
  display: flex;
@@ -2161,14 +2670,14 @@ var upcomingBillCss = `
2161
2670
 
2162
2671
  .schematic-upcoming-bill__total {
2163
2672
  font-family: var(--schematic-font-heading);
2164
- font-size: 1.8125rem;
2673
+ font-size: 2.3125rem;
2165
2674
  font-variant-numeric: tabular-nums;
2166
2675
  font-weight: 800;
2167
2676
  line-height: 1;
2168
2677
  }
2169
2678
 
2170
2679
  .schematic-upcoming-bill__estimate {
2171
- font-weight: 600;
2680
+ color: var(--schematic-muted);
2172
2681
  max-width: 10rem;
2173
2682
  text-align: end;
2174
2683
  }
@@ -2234,6 +2743,21 @@ var rulesCss = `
2234
2743
  margin: 0;
2235
2744
  }
2236
2745
 
2746
+ /* Unit suffixes ("/mo", "/seat") sit on the baseline, as in the embed. */
2747
+ :where([class^="schematic-"]) sub,
2748
+ :where([class^="schematic-"]) sup {
2749
+ line-height: 1;
2750
+ position: static;
2751
+ }
2752
+
2753
+ :where([class^="schematic-"]) sub {
2754
+ vertical-align: baseline;
2755
+ }
2756
+
2757
+ :where([class^="schematic-"]) sup {
2758
+ vertical-align: top;
2759
+ }
2760
+
2237
2761
  .schematic-card {
2238
2762
  background: var(--schematic-background);
2239
2763
  border-radius: var(--schematic-radius);
@@ -2329,6 +2853,7 @@ var rulesCss = `
2329
2853
 
2330
2854
  .schematic-error {
2331
2855
  color: var(--schematic-danger);
2856
+ font-weight: 500;
2332
2857
  }
2333
2858
 
2334
2859
  .schematic-status-note {
@@ -2391,10 +2916,26 @@ var rulesCss = `
2391
2916
  border-color: var(--schematic-primary);
2392
2917
  }
2393
2918
 
2919
+ /* The embed's small button: 15px type, 40px tall. */
2394
2920
  .schematic-cta--small {
2921
+ border-radius: 0.375rem;
2395
2922
  font-size: 0.9375rem;
2396
2923
  min-height: 2.5rem;
2397
- padding: 0.375rem 1rem;
2924
+ padding: 0.4375rem 1.25rem;
2925
+ }
2926
+
2927
+ /* The embed's ghost button, for secondary actions such as Try again. */
2928
+ .schematic-cta--ghost {
2929
+ background: transparent;
2930
+ border-color: color-mix(in srgb, var(--schematic-text) 20%, transparent);
2931
+ color: var(--schematic-text);
2932
+ }
2933
+
2934
+ .schematic-cta--ghost:hover:not(:disabled) {
2935
+ background: transparent;
2936
+ border-color: color-mix(in srgb, var(--schematic-text) 12.5%, transparent);
2937
+ box-shadow: 0 1px 2px
2938
+ color-mix(in srgb, var(--schematic-text) 7.5%, transparent);
2398
2939
  }
2399
2940
 
2400
2941
  .schematic-link-button {
@@ -2411,6 +2952,27 @@ var rulesCss = `
2411
2952
  text-decoration: underline;
2412
2953
  }
2413
2954
 
2955
+ /* Every toggle's chevron: the 24px glyph, muted. */
2956
+ .schematic-chevron {
2957
+ color: var(--schematic-muted);
2958
+ font-size: 1.5rem;
2959
+ }
2960
+
2961
+ /* A toggle underlines its label alone: a flex container hands its underline
2962
+ to every item, the chevron included, and an item cannot take it off. */
2963
+ .schematic-link-button:has(.schematic-link-button__label):hover {
2964
+ text-decoration: none;
2965
+ }
2966
+
2967
+ /* The reset colours every schematic- element; the label keeps the link's. */
2968
+ .schematic-link-button__label {
2969
+ color: inherit;
2970
+ }
2971
+
2972
+ .schematic-link-button:hover .schematic-link-button__label {
2973
+ text-decoration: underline;
2974
+ }
2975
+
2414
2976
  .schematic-meter {
2415
2977
  background: var(--schematic-meter-track);
2416
2978
  border-radius: 9999px;
@@ -2500,7 +3062,7 @@ var rulesCss = `
2500
3062
  font-size: 1.125rem;
2501
3063
  font-weight: 800;
2502
3064
  line-height: var(--schematic-line-height-heading);
2503
- margin: 0 0 calc(var(--schematic-space) / 2);
3065
+ margin: 0;
2504
3066
  }
2505
3067
 
2506
3068
  /* A label on the left, its value on the right. */
@@ -2708,13 +3270,15 @@ ${dialogCss}
2708
3270
  ${invoicesCss}
2709
3271
  ${upcomingBillCss}
2710
3272
  ${paymentMethodsCss}
3273
+ ${tooltipCss}
3274
+ ${includedFeaturesCss}
2711
3275
  `;
2712
3276
  var schematicStylesCss = withTokenDefaults(rulesCss) + iconsCss;
2713
3277
  var SchematicStyles = () => /* @__PURE__ */ jsx("style", { "data-schematic-styles": "", children: schematicStylesCss });
2714
3278
 
2715
- // src/elements/Invoices.tsx
2716
- import { useInvoices } from "@schematichq/schematic-react";
2717
- import { useId as useId2, useMemo, useState } from "react";
3279
+ // src/elements/IncludedFeatures.tsx
3280
+ import { useFeatureUsage } from "@schematichq/schematic-react";
3281
+ import { useMemo, useState } from "react";
2718
3282
 
2719
3283
  // src/elements/common.tsx
2720
3284
  import {
@@ -2812,7 +3376,7 @@ var StatusFrame = ({
2812
3376
  onRetry !== void 0 && /* @__PURE__ */ jsx2(
2813
3377
  "button",
2814
3378
  {
2815
- className: "schematic-link-button schematic-status__retry",
3379
+ className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-status__retry",
2816
3380
  type: "button",
2817
3381
  onClick: onRetry,
2818
3382
  children: retryText
@@ -2831,6 +3395,28 @@ var StatusFrame = ({
2831
3395
  error !== void 0 && /* @__PURE__ */ jsx2("p", { className: "schematic-status-note schematic-error", role: "alert", children: errorMessage ?? error.message })
2832
3396
  ] });
2833
3397
  };
3398
+ var Tooltip = ({ children, className, label }) => {
3399
+ const id = useId();
3400
+ return /* @__PURE__ */ jsxs("span", { className: cx("schematic-tooltip", className), children: [
3401
+ /* @__PURE__ */ jsx2(
3402
+ "button",
3403
+ {
3404
+ "aria-describedby": id,
3405
+ "aria-label": label,
3406
+ className: "schematic-tooltip__trigger",
3407
+ type: "button",
3408
+ children: /* @__PURE__ */ jsx2(
3409
+ "i",
3410
+ {
3411
+ "aria-hidden": "true",
3412
+ className: "schematic-icon schematic-icon--info-rounded"
3413
+ }
3414
+ )
3415
+ }
3416
+ ),
3417
+ /* @__PURE__ */ jsx2("span", { className: "schematic-tooltip__content", id, role: "tooltip", children })
3418
+ ] });
3419
+ };
2834
3420
  var Dialog = ({ children, className, closeLabel, onClose, open, title, titleId }) => {
2835
3421
  const ref = useRef(null);
2836
3422
  const generatedId = useId();
@@ -2882,8 +3468,306 @@ var Dialog = ({ children, className, closeLabel, onClose, open, title, titleId }
2882
3468
  );
2883
3469
  };
2884
3470
 
2885
- // src/elements/Invoices.tsx
3471
+ // src/elements/usage.tsx
2886
3472
  import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
3473
+ function shortPeriod(period, t) {
3474
+ switch (period) {
3475
+ case "month":
3476
+ return t("periodMonthShort");
3477
+ case "quarter":
3478
+ return t("periodQuarterShort");
3479
+ case "year":
3480
+ return t("periodYearShort");
3481
+ default:
3482
+ return void 0;
3483
+ }
3484
+ }
3485
+ function PriceTiers({
3486
+ currency,
3487
+ locale,
3488
+ mode,
3489
+ period,
3490
+ ranges,
3491
+ t,
3492
+ unit
3493
+ }) {
3494
+ const perPeriod = period === null ? void 0 : shortPeriod(period, t);
3495
+ const money = (amount) => formatCurrency(amount, currency, locale);
3496
+ const perUnit = (amount) => /* @__PURE__ */ jsxs2(Fragment, { children: [
3497
+ money(amount),
3498
+ /* @__PURE__ */ jsxs2("sub", { children: [
3499
+ "/",
3500
+ unit
3501
+ ] })
3502
+ ] });
3503
+ const flat = (amount) => /* @__PURE__ */ jsxs2(Fragment, { children: [
3504
+ money(amount),
3505
+ perPeriod !== void 0 && /* @__PURE__ */ jsxs2("sub", { children: [
3506
+ "/",
3507
+ perPeriod
3508
+ ] })
3509
+ ] });
3510
+ const tierPrice = (flatPrice, perUnitPrice) => {
3511
+ if (flatPrice === 0 && perUnitPrice !== 0) {
3512
+ return perUnit(perUnitPrice);
3513
+ }
3514
+ if (flatPrice !== 0 && perUnitPrice === 0) {
3515
+ return flat(flatPrice);
3516
+ }
3517
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
3518
+ perUnit(perUnitPrice),
3519
+ " + ",
3520
+ flat(flatPrice)
3521
+ ] });
3522
+ };
3523
+ return /* @__PURE__ */ jsxs2("span", { className: "schematic-tiers", children: [
3524
+ /* @__PURE__ */ jsx3("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ jsxs2("div", { className: "schematic-tiers__tier", children: [
3525
+ /* @__PURE__ */ jsxs2("dt", { className: "schematic-tiers__range", children: [
3526
+ tier.from,
3527
+ tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${tier.to}` : ""
3528
+ ] }),
3529
+ /* @__PURE__ */ jsx3("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
3530
+ ] }, tier.from)) }),
3531
+ mode !== null && /* @__PURE__ */ jsx3("span", { className: "schematic-tiers__mode", children: mode === "volume" ? t("usageTiersVolume") : t("usageTiersGraduated") })
3532
+ ] });
3533
+ }
3534
+
3535
+ // src/elements/IncludedFeatures.tsx
3536
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
3537
+ var VISIBLE_FEATURE_COUNT = 4;
3538
+ function IncludedFeatures({
3539
+ className,
3540
+ headingLevel = 2,
3541
+ locale: localeProp,
3542
+ showCredits = true,
3543
+ showDescription = true,
3544
+ showEntitlement = true,
3545
+ showExpiration = true,
3546
+ showHardLimit = false,
3547
+ showHeader = true,
3548
+ showIcon = true,
3549
+ showUsage = true,
3550
+ showWarningThresholdAsLimit = false,
3551
+ strings,
3552
+ visibleFeatures
3553
+ }) {
3554
+ const { data: features, error, isPending, refetch } = useFeatureUsage();
3555
+ const locale = useResolvedLocale(localeProp);
3556
+ const t = useTranslator(strings, localeProp);
3557
+ const [expanded, setExpanded] = useState(false);
3558
+ const rows = useMemo(
3559
+ () => features === void 0 ? [] : deriveIncludedFeatures(features, {
3560
+ locale,
3561
+ showCredits,
3562
+ showWarningThresholdAsLimit,
3563
+ visibleFeatures
3564
+ }),
3565
+ [
3566
+ features,
3567
+ locale,
3568
+ showCredits,
3569
+ showWarningThresholdAsLimit,
3570
+ visibleFeatures
3571
+ ]
3572
+ );
3573
+ const Heading = `h${headingLevel}`;
3574
+ const canExpand = rows.length > VISIBLE_FEATURE_COUNT;
3575
+ const shown = canExpand && !expanded ? rows.slice(0, VISIBLE_FEATURE_COUNT) : rows;
3576
+ const unavailable = features === void 0 && httpStatus(error) === 404;
3577
+ const errorMessage = error === void 0 ? void 0 : unavailable ? t("includedFeaturesUnavailable") : t("includedFeaturesError");
3578
+ return /* @__PURE__ */ jsxs3(
3579
+ StatusFrame,
3580
+ {
3581
+ className: cx("schematic-card", "schematic-included-features", className),
3582
+ error,
3583
+ errorMessage,
3584
+ hasData: features !== void 0,
3585
+ isPending,
3586
+ loadingLabel: t("includedFeaturesLoading"),
3587
+ onRetry: refetch,
3588
+ retryText: t("retry"),
3589
+ skeleton: /* @__PURE__ */ jsx4(IncludedFeaturesSkeleton, { showHeader }),
3590
+ children: [
3591
+ showHeader && /* @__PURE__ */ jsx4("div", { className: "schematic-header", children: /* @__PURE__ */ jsx4(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
3592
+ /* @__PURE__ */ jsx4("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ jsxs3(
3593
+ "li",
3594
+ {
3595
+ className: "schematic-included-features__row",
3596
+ "data-testid": "schematic-included-feature",
3597
+ children: [
3598
+ showIcon && row.icon !== null && /* @__PURE__ */ jsx4(
3599
+ "i",
3600
+ {
3601
+ "aria-hidden": "true",
3602
+ className: `schematic-icon schematic-icon--${row.icon} schematic-included-features__icon`
3603
+ }
3604
+ ),
3605
+ /* @__PURE__ */ jsxs3("div", { className: "schematic-included-features__details", children: [
3606
+ /* @__PURE__ */ jsx4("span", { className: "schematic-included-features__name", children: row.name }),
3607
+ showDescription && row.description !== null && /* @__PURE__ */ jsx4("span", { className: "schematic-muted schematic-small", children: row.description }),
3608
+ row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ jsx4(
3609
+ "span",
3610
+ {
3611
+ className: "schematic-muted schematic-small",
3612
+ children: t("includedFeaturesPerLicense", {
3613
+ amount: credits.amount,
3614
+ creditName: credits.creditName,
3615
+ licenseName: credits.licenseName
3616
+ })
3617
+ },
3618
+ `${credits.creditName}-${index}`
3619
+ )),
3620
+ showExpiration && row.expiresAt !== null && /* @__PURE__ */ jsx4("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
3621
+ ] }),
3622
+ /* @__PURE__ */ jsx4(
3623
+ UsageDetails,
3624
+ {
3625
+ row,
3626
+ showEntitlement,
3627
+ showHardLimit,
3628
+ showUsage,
3629
+ t,
3630
+ locale
3631
+ }
3632
+ )
3633
+ ]
3634
+ },
3635
+ row.featureId
3636
+ )) }),
3637
+ canExpand && /* @__PURE__ */ jsxs3(
3638
+ "button",
3639
+ {
3640
+ "aria-expanded": expanded,
3641
+ className: "schematic-link-button schematic-included-features__toggle",
3642
+ type: "button",
3643
+ onClick: () => setExpanded((value) => !value),
3644
+ children: [
3645
+ /* @__PURE__ */ jsx4(
3646
+ "i",
3647
+ {
3648
+ "aria-hidden": "true",
3649
+ className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
3650
+ }
3651
+ ),
3652
+ /* @__PURE__ */ jsx4("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
3653
+ ]
3654
+ }
3655
+ )
3656
+ ]
3657
+ }
3658
+ );
3659
+ }
3660
+ function UsageDetails({
3661
+ locale,
3662
+ row,
3663
+ showEntitlement,
3664
+ showHardLimit,
3665
+ showUsage,
3666
+ t
3667
+ }) {
3668
+ const usage = usageText(row.usage, row.usageSummary, t);
3669
+ if (row.entitlement === null && usage === null) {
3670
+ return null;
3671
+ }
3672
+ return /* @__PURE__ */ jsxs3("div", { className: "schematic-included-features__usage", children: [
3673
+ showEntitlement && row.entitlement !== null && /* @__PURE__ */ jsxs3("span", { className: "schematic-included-features__entitlement", children: [
3674
+ entitlementText2(row.entitlement, t),
3675
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx4(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
3676
+ amount: row.hardLimit.amount,
3677
+ units: row.hardLimit.units
3678
+ }) })
3679
+ ] }),
3680
+ showUsage && usage !== null && /* @__PURE__ */ jsxs3("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
3681
+ usage,
3682
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx4(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx4(
3683
+ PriceTiers,
3684
+ {
3685
+ currency: row.tiers.currency,
3686
+ locale,
3687
+ mode: row.tiers.mode,
3688
+ period: row.tiers.period,
3689
+ ranges: row.tiers.ranges,
3690
+ t,
3691
+ unit: row.source.featureSingularName ?? row.name
3692
+ }
3693
+ ) })
3694
+ ] })
3695
+ ] });
3696
+ }
3697
+ function entitlementText2(text, t) {
3698
+ switch (text.kind) {
3699
+ case "units":
3700
+ return t("usageUnits", { amount: text.amount, units: text.units });
3701
+ case "perUnit":
3702
+ return t("usagePerUnit", { cost: text.cost, unit: text.unit });
3703
+ case "perPackage":
3704
+ return t("usagePerPackage", {
3705
+ cost: text.cost,
3706
+ size: text.size,
3707
+ units: text.units
3708
+ });
3709
+ case "tierUpTo":
3710
+ return t("usageTierUpTo", { amount: text.amount, feature: text.feature });
3711
+ case "tierUnlimited":
3712
+ return t("usageTierUnlimited", { feature: text.feature });
3713
+ case "perUse":
3714
+ return t("usagePerUse", { amount: text.amount, units: text.units });
3715
+ case "unlimited":
3716
+ return t("usageUnlimited", { item: text.item });
3717
+ }
3718
+ }
3719
+ function usageText(segments, summary, t) {
3720
+ if (segments.length > 0) {
3721
+ return segments.map((segment) => segmentText(segment, t)).join(" \u2022 ");
3722
+ }
3723
+ if (summary === null) {
3724
+ return null;
3725
+ }
3726
+ return summary.kind === "limited" ? t("usageLimited", {
3727
+ amount: summary.amount,
3728
+ allocation: summary.allocation
3729
+ }) : t("usageUnlimitedUsed", { amount: summary.amount });
3730
+ }
3731
+ function segmentText(segment, t) {
3732
+ switch (segment.kind) {
3733
+ case "unitPricePerPeriod": {
3734
+ const period = shortPeriod(segment.period, t) ?? segment.period;
3735
+ return segment.size > 1 ? t("usagePackagePricePerPeriod", {
3736
+ cost: segment.cost,
3737
+ size: segment.size,
3738
+ units: segment.units,
3739
+ period
3740
+ }) : t("usageUnitPricePerPeriod", {
3741
+ cost: segment.cost,
3742
+ unit: segment.units,
3743
+ period
3744
+ });
3745
+ }
3746
+ case "used":
3747
+ return t("usageUsed", { amount: segment.amount, units: segment.units });
3748
+ case "cost": {
3749
+ const period = segment.period === null ? void 0 : shortPeriod(segment.period, t);
3750
+ return period === void 0 ? segment.cost : `${segment.cost}/${period}`;
3751
+ }
3752
+ case "resets":
3753
+ return t("usageResets", { date: segment.date });
3754
+ }
3755
+ }
3756
+ function IncludedFeaturesSkeleton({ showHeader }) {
3757
+ return /* @__PURE__ */ jsxs3("div", { className: "schematic-skeleton", children: [
3758
+ showHeader && /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__heading" }),
3759
+ [0, 1, 2].map((index) => /* @__PURE__ */ jsxs3("div", { className: "schematic-skeleton__row", children: [
3760
+ /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
3761
+ /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
3762
+ ] }, index))
3763
+ ] });
3764
+ }
3765
+ IncludedFeatures.resources = ["featureUsage"];
3766
+
3767
+ // src/elements/Invoices.tsx
3768
+ import { useInvoices } from "@schematichq/schematic-react";
3769
+ import { useId as useId2, useMemo as useMemo2, useState as useState2 } from "react";
3770
+ import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
2887
3771
  var SKELETON_ROWS = 4;
2888
3772
  function Invoices({
2889
3773
  className,
@@ -2906,8 +3790,8 @@ function Invoices({
2906
3790
  } = useInvoices(query);
2907
3791
  const locale = useResolvedLocale(localeProp);
2908
3792
  const t = useTranslator(strings, localeProp);
2909
- const [expanded, setExpanded] = useState(false);
2910
- const list = useMemo(
3793
+ const [expanded, setExpanded] = useState2(false);
3794
+ const list = useMemo2(
2911
3795
  () => page === void 0 ? void 0 : deriveInvoiceList(page, { locale }),
2912
3796
  [locale, page]
2913
3797
  );
@@ -2923,7 +3807,7 @@ function Invoices({
2923
3807
  );
2924
3808
  const unavailable = list === void 0 && httpStatus(error) === 404;
2925
3809
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("invoicesUnavailable") : t("invoicesError");
2926
- return /* @__PURE__ */ jsx3(
3810
+ return /* @__PURE__ */ jsx5(
2927
3811
  StatusFrame,
2928
3812
  {
2929
3813
  className: cx("schematic-card", "schematic-invoices", className),
@@ -2934,7 +3818,7 @@ function Invoices({
2934
3818
  loadingLabel: t("invoicesLoading"),
2935
3819
  onRetry: refetch,
2936
3820
  retryText: t("retry"),
2937
- skeleton: /* @__PURE__ */ jsx3(
3821
+ skeleton: /* @__PURE__ */ jsx5(
2938
3822
  InvoicesSkeleton,
2939
3823
  {
2940
3824
  columns,
@@ -2942,22 +3826,22 @@ function Invoices({
2942
3826
  showHeader
2943
3827
  }
2944
3828
  ),
2945
- children: list !== void 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
2946
- showHeader && /* @__PURE__ */ jsx3("div", { className: "schematic-header", children: /* @__PURE__ */ jsx3(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
2947
- rows.length === 0 ? /* @__PURE__ */ jsx3("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ jsx3(
3829
+ children: list !== void 0 && /* @__PURE__ */ jsxs4(Fragment2, { children: [
3830
+ showHeader && /* @__PURE__ */ jsx5("div", { className: "schematic-header", children: /* @__PURE__ */ jsx5(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
3831
+ rows.length === 0 ? /* @__PURE__ */ jsx5("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ jsx5(
2948
3832
  "ul",
2949
3833
  {
2950
3834
  className: "schematic-invoices__list",
2951
3835
  "aria-label": showHeader ? void 0 : t("invoicesHeader"),
2952
3836
  "aria-labelledby": showHeader ? headingId : void 0,
2953
- children: visible.map((row) => /* @__PURE__ */ jsxs2(
3837
+ children: visible.map((row) => /* @__PURE__ */ jsxs4(
2954
3838
  "li",
2955
3839
  {
2956
3840
  className: "schematic-invoices__row",
2957
3841
  "data-testid": "schematic-invoice",
2958
3842
  children: [
2959
- showDate && /* @__PURE__ */ jsx3("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ jsx3(InvoiceDate, { row, t }) }),
2960
- showAmount && /* @__PURE__ */ jsx3(
3843
+ showDate && /* @__PURE__ */ jsx5("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ jsx5(InvoiceDate, { row, t }) }),
3844
+ showAmount && /* @__PURE__ */ jsx5(
2961
3845
  "span",
2962
3846
  {
2963
3847
  className: cx(
@@ -2974,8 +3858,8 @@ function Invoices({
2974
3858
  ))
2975
3859
  }
2976
3860
  ),
2977
- (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ jsxs2("div", { className: "schematic-invoices__actions", children: [
2978
- canCollapse && /* @__PURE__ */ jsxs2(
3861
+ (canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ jsxs4("div", { className: "schematic-invoices__actions", children: [
3862
+ canCollapse && /* @__PURE__ */ jsxs4(
2979
3863
  "button",
2980
3864
  {
2981
3865
  "aria-expanded": expanded,
@@ -2983,18 +3867,23 @@ function Invoices({
2983
3867
  type: "button",
2984
3868
  onClick: () => setExpanded((value) => !value),
2985
3869
  children: [
2986
- /* @__PURE__ */ jsx3(
2987
- "span",
3870
+ /* @__PURE__ */ jsx5(
3871
+ "i",
2988
3872
  {
2989
3873
  "aria-hidden": "true",
2990
- className: "schematic-invoices__chevron"
3874
+ className: cx(
3875
+ "schematic-icon",
3876
+ expanded ? "schematic-icon--chevron-up" : "schematic-icon--chevron-down",
3877
+ "schematic-chevron",
3878
+ "schematic-invoices__chevron"
3879
+ )
2991
3880
  }
2992
3881
  ),
2993
- expanded ? t("invoicesSeeLess") : t("invoicesSeeMore")
3882
+ /* @__PURE__ */ jsx5("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
2994
3883
  ]
2995
3884
  }
2996
3885
  ),
2997
- showingAll && list.hasMore && /* @__PURE__ */ jsx3(
3886
+ showingAll && list.hasMore && /* @__PURE__ */ jsx5(
2998
3887
  "button",
2999
3888
  {
3000
3889
  className: "schematic-link-button schematic-invoices__load-more",
@@ -3017,9 +3906,9 @@ function InvoicesSkeleton({
3017
3906
  rows,
3018
3907
  showHeader
3019
3908
  }) {
3020
- return /* @__PURE__ */ jsxs2("div", { className: "schematic-skeleton", children: [
3021
- showHeader && /* @__PURE__ */ jsx3("div", { className: "schematic-skeleton__heading" }),
3022
- Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx3("div", { className: "schematic-skeleton__row", children: columns.map((column) => /* @__PURE__ */ jsx3(
3909
+ return /* @__PURE__ */ jsxs4("div", { className: "schematic-skeleton", children: [
3910
+ showHeader && /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__heading" }),
3911
+ Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__row", children: columns.map((column) => /* @__PURE__ */ jsx5(
3023
3912
  "div",
3024
3913
  {
3025
3914
  className: "schematic-skeleton__cell",
@@ -3031,10 +3920,10 @@ function InvoicesSkeleton({
3031
3920
  }
3032
3921
  function InvoiceDate({ row, t }) {
3033
3922
  if (row.url === null) {
3034
- return /* @__PURE__ */ jsx3("span", { className: "schematic-invoices__date-text", children: row.dateText });
3923
+ return /* @__PURE__ */ jsx5("span", { className: "schematic-invoices__date-text", children: row.dateText });
3035
3924
  }
3036
3925
  const label = row.dateText === "" ? t("invoicesUndated") : row.dateText;
3037
- return /* @__PURE__ */ jsx3(
3926
+ return /* @__PURE__ */ jsx5(
3038
3927
  "a",
3039
3928
  {
3040
3929
  className: "schematic-invoices__link",
@@ -3049,8 +3938,8 @@ Invoices.resources = ["invoices"];
3049
3938
 
3050
3939
  // src/elements/PaymentMethods.tsx
3051
3940
  import { usePaymentMethods } from "@schematichq/schematic-react";
3052
- import { Suspense, lazy, useCallback as useCallback2, useMemo as useMemo2, useState as useState3 } from "react";
3053
- import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
3941
+ import { Suspense, lazy, useCallback as useCallback2, useMemo as useMemo3, useState as useState4 } from "react";
3942
+ import { Fragment as Fragment3, jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
3054
3943
  var PaymentMethodForm2 = lazy(() => Promise.resolve().then(() => (init_PaymentMethodForm(), PaymentMethodForm_exports)));
3055
3944
  function PaymentMethods({
3056
3945
  allowEdit = true,
@@ -3075,10 +3964,10 @@ function PaymentMethods({
3075
3964
  } = usePaymentMethods();
3076
3965
  const locale = useResolvedLocale(localeProp);
3077
3966
  const t = useTranslator(strings, localeProp);
3078
- const [dialog, setDialog] = useState3(null);
3079
- const [choosing, setChoosing] = useState3(false);
3080
- const [lastWrite, setLastWrite] = useState3(null);
3081
- const derived = useMemo2(
3967
+ const [dialog, setDialog] = useState4(null);
3968
+ const [choosing, setChoosing] = useState4(false);
3969
+ const [lastWrite, setLastWrite] = useState4(null);
3970
+ const derived = useMemo3(
3082
3971
  () => methods === void 0 ? void 0 : derivePaymentMethods(methods, { locale }),
3083
3972
  [locale, methods]
3084
3973
  );
@@ -3109,7 +3998,7 @@ function PaymentMethods({
3109
3998
  const Heading = `h${headingLevel}`;
3110
3999
  const unavailable = derived === void 0 && httpStatus(error) === 404;
3111
4000
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("paymentMethodsUnavailable") : t("paymentMethodsError");
3112
- return /* @__PURE__ */ jsx5(
4001
+ return /* @__PURE__ */ jsx7(
3113
4002
  StatusFrame,
3114
4003
  {
3115
4004
  className: cx("schematic-card", "schematic-payment-methods", className),
@@ -3120,9 +4009,9 @@ function PaymentMethods({
3120
4009
  loadingLabel: t("paymentMethodsLoading"),
3121
4010
  onRetry: refetch,
3122
4011
  retryText: t("retry"),
3123
- skeleton: /* @__PURE__ */ jsx5(PaymentMethodsSkeleton, { showHeader }),
3124
- children: derived !== void 0 && /* @__PURE__ */ jsxs4(Fragment2, { children: [
3125
- showHeader && /* @__PURE__ */ jsx5(
4012
+ skeleton: /* @__PURE__ */ jsx7(PaymentMethodsSkeleton, { showHeader }),
4013
+ children: derived !== void 0 && /* @__PURE__ */ jsxs6(Fragment3, { children: [
4014
+ showHeader && /* @__PURE__ */ jsx7(
3126
4015
  PaymentMethodsHeader,
3127
4016
  {
3128
4017
  derived,
@@ -3131,7 +4020,7 @@ function PaymentMethods({
3131
4020
  t
3132
4021
  }
3133
4022
  ),
3134
- /* @__PURE__ */ jsx5(MethodPill, { row: derived.current, t, children: allowEdit && /* @__PURE__ */ jsx5(
4023
+ /* @__PURE__ */ jsx7(MethodPill, { row: derived.current, t, children: allowEdit && /* @__PURE__ */ jsx7(
3135
4024
  "button",
3136
4025
  {
3137
4026
  className: "schematic-link-button schematic-payment-methods__edit",
@@ -3140,7 +4029,7 @@ function PaymentMethods({
3140
4029
  children: derived.current === null ? t("paymentMethodsAdd") : t("paymentMethodsEdit")
3141
4030
  }
3142
4031
  ) }),
3143
- dialog !== null && /* @__PURE__ */ jsx5(
4032
+ dialog !== null && /* @__PURE__ */ jsx7(
3144
4033
  PaymentMethodsDialog,
3145
4034
  {
3146
4035
  checkoutPrefill,
@@ -3192,7 +4081,7 @@ function PaymentMethodsDialog({
3192
4081
  const { current, others, rows } = derived;
3193
4082
  const hasMethods = rows.length > 0;
3194
4083
  const showForm = view === "add" || !hasMethods;
3195
- return /* @__PURE__ */ jsxs4(
4084
+ return /* @__PURE__ */ jsxs6(
3196
4085
  Dialog,
3197
4086
  {
3198
4087
  className: "schematic-payment-methods__dialog",
@@ -3201,11 +4090,11 @@ function PaymentMethodsDialog({
3201
4090
  title: t("paymentMethodsDialogTitle"),
3202
4091
  onClose,
3203
4092
  children: [
3204
- showForm ? /* @__PURE__ */ jsx5(
4093
+ showForm ? /* @__PURE__ */ jsx7(
3205
4094
  Suspense,
3206
4095
  {
3207
- fallback: /* @__PURE__ */ jsx5(FormSkeleton, { label: t("paymentMethodsFormLoading") }),
3208
- children: /* @__PURE__ */ jsx5(
4096
+ fallback: /* @__PURE__ */ jsx7(FormSkeleton, { label: t("paymentMethodsFormLoading") }),
4097
+ children: /* @__PURE__ */ jsx7(
3209
4098
  PaymentMethodForm2,
3210
4099
  {
3211
4100
  checkoutPrefill,
@@ -3217,8 +4106,8 @@ function PaymentMethodsDialog({
3217
4106
  }
3218
4107
  )
3219
4108
  }
3220
- ) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
3221
- /* @__PURE__ */ jsx5(
4109
+ ) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
4110
+ /* @__PURE__ */ jsx7(
3222
4111
  PaymentMethodsHeader,
3223
4112
  {
3224
4113
  derived,
@@ -3227,7 +4116,7 @@ function PaymentMethodsDialog({
3227
4116
  t
3228
4117
  }
3229
4118
  ),
3230
- /* @__PURE__ */ jsx5(MethodPill, { row: current, t, children: current?.canRemove === true && /* @__PURE__ */ jsx5(
4119
+ /* @__PURE__ */ jsx7(MethodPill, { row: current, t, children: current?.canRemove === true && /* @__PURE__ */ jsx7(
3231
4120
  "button",
3232
4121
  {
3233
4122
  className: "schematic-link-button schematic-payment-methods__remove-current",
@@ -3237,7 +4126,7 @@ function PaymentMethodsDialog({
3237
4126
  children: t("paymentMethodsRemove")
3238
4127
  }
3239
4128
  ) }),
3240
- /* @__PURE__ */ jsxs4(
4129
+ /* @__PURE__ */ jsxs6(
3241
4130
  "button",
3242
4131
  {
3243
4132
  "aria-expanded": choosing,
@@ -3245,14 +4134,15 @@ function PaymentMethodsDialog({
3245
4134
  type: "button",
3246
4135
  onClick: onChoose,
3247
4136
  children: [
3248
- /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__choose-label", children: t("paymentMethodsChooseDifferent") }),
3249
- /* @__PURE__ */ jsx5(
4137
+ /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__choose-label", children: t("paymentMethodsChooseDifferent") }),
4138
+ /* @__PURE__ */ jsx7(
3250
4139
  "i",
3251
4140
  {
3252
4141
  "aria-hidden": "true",
3253
4142
  className: cx(
3254
4143
  "schematic-icon",
3255
4144
  choosing ? "schematic-icon--chevron-up" : "schematic-icon--chevron-down",
4145
+ "schematic-chevron",
3256
4146
  "schematic-payment-methods__chevron"
3257
4147
  )
3258
4148
  }
@@ -3260,13 +4150,13 @@ function PaymentMethodsDialog({
3260
4150
  ]
3261
4151
  }
3262
4152
  ),
3263
- choosing && /* @__PURE__ */ jsxs4(Fragment2, { children: [
3264
- others.length > 0 && /* @__PURE__ */ jsx5(
4153
+ choosing && /* @__PURE__ */ jsxs6(Fragment3, { children: [
4154
+ others.length > 0 && /* @__PURE__ */ jsx7(
3265
4155
  "ul",
3266
4156
  {
3267
4157
  "aria-label": t("paymentMethodsChooseDifferent"),
3268
4158
  className: "schematic-payment-methods__list",
3269
- children: others.map((row) => /* @__PURE__ */ jsxs4(
4159
+ children: others.map((row) => /* @__PURE__ */ jsxs6(
3270
4160
  "li",
3271
4161
  {
3272
4162
  className: "schematic-payment-methods__row",
@@ -3274,11 +4164,11 @@ function PaymentMethodsDialog({
3274
4164
  "data-kind": row.kind,
3275
4165
  "data-testid": "schematic-payment-method",
3276
4166
  children: [
3277
- /* @__PURE__ */ jsx5(Method, { row, t }),
3278
- row.expiresShort !== null && /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__expires", children: t("paymentMethodsExpires", {
4167
+ /* @__PURE__ */ jsx7(Method, { row, t }),
4168
+ row.expiresShort !== null && /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__expires", children: t("paymentMethodsExpires", {
3279
4169
  date: row.expiresShort
3280
4170
  }) }),
3281
- /* @__PURE__ */ jsx5(
4171
+ /* @__PURE__ */ jsx7(
3282
4172
  "button",
3283
4173
  {
3284
4174
  className: "schematic-link-button schematic-payment-methods__set-default",
@@ -3288,7 +4178,7 @@ function PaymentMethodsDialog({
3288
4178
  children: t("paymentMethodsSetDefault")
3289
4179
  }
3290
4180
  ),
3291
- row.canRemove && /* @__PURE__ */ jsx5(
4181
+ row.canRemove && /* @__PURE__ */ jsx7(
3292
4182
  "button",
3293
4183
  {
3294
4184
  "aria-label": t("paymentMethodsRemove"),
@@ -3296,7 +4186,7 @@ function PaymentMethodsDialog({
3296
4186
  disabled: isMutating,
3297
4187
  type: "button",
3298
4188
  onClick: () => onRemove(row),
3299
- children: /* @__PURE__ */ jsx5(
4189
+ children: /* @__PURE__ */ jsx7(
3300
4190
  "i",
3301
4191
  {
3302
4192
  "aria-hidden": "true",
@@ -3311,7 +4201,7 @@ function PaymentMethodsDialog({
3311
4201
  ))
3312
4202
  }
3313
4203
  ),
3314
- /* @__PURE__ */ jsx5(
4204
+ /* @__PURE__ */ jsx7(
3315
4205
  "button",
3316
4206
  {
3317
4207
  className: "schematic-cta schematic-payment-methods__add-new",
@@ -3323,17 +4213,17 @@ function PaymentMethodsDialog({
3323
4213
  )
3324
4214
  ] })
3325
4215
  ] }),
3326
- mutationError !== void 0 && /* @__PURE__ */ jsxs4(
4216
+ mutationError !== void 0 && /* @__PURE__ */ jsxs6(
3327
4217
  "p",
3328
4218
  {
3329
4219
  className: "schematic-status-note schematic-error schematic-payment-methods__error",
3330
4220
  role: "alert",
3331
4221
  children: [
3332
- /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__error-message", children: mutationError }),
3333
- onRetry !== void 0 && /* @__PURE__ */ jsx5(
4222
+ /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__error-message", children: mutationError }),
4223
+ onRetry !== void 0 && /* @__PURE__ */ jsx7(
3334
4224
  "button",
3335
4225
  {
3336
- className: "schematic-link-button schematic-payment-methods__error-retry",
4226
+ className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-payment-methods__error-retry",
3337
4227
  disabled: isMutating,
3338
4228
  type: "button",
3339
4229
  onClick: onRetry,
@@ -3353,9 +4243,9 @@ function PaymentMethodsHeader({
3353
4243
  showExpiration,
3354
4244
  t
3355
4245
  }) {
3356
- return /* @__PURE__ */ jsxs4("div", { className: "schematic-header", children: [
3357
- /* @__PURE__ */ jsx5(Heading, { className: "schematic-header__title", children: t("paymentMethodsHeader") }),
3358
- showExpiration && derived.expiryWarning !== "none" && /* @__PURE__ */ jsx5(
4246
+ return /* @__PURE__ */ jsxs6("div", { className: "schematic-header", children: [
4247
+ /* @__PURE__ */ jsx7(Heading, { className: "schematic-header__title", children: t("paymentMethodsHeader") }),
4248
+ showExpiration && derived.expiryWarning !== "none" && /* @__PURE__ */ jsx7(
3359
4249
  "span",
3360
4250
  {
3361
4251
  className: "schematic-small schematic-payment-methods__expiry-warning",
@@ -3370,37 +4260,37 @@ function MethodPill({
3370
4260
  row,
3371
4261
  t
3372
4262
  }) {
3373
- return /* @__PURE__ */ jsxs4(
4263
+ return /* @__PURE__ */ jsxs6(
3374
4264
  "div",
3375
4265
  {
3376
4266
  className: "schematic-payment-methods__current",
3377
4267
  "data-testid": "schematic-payment-method-current",
3378
4268
  children: [
3379
- row === null ? /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__empty", children: t("paymentMethodsEmpty") }) : /* @__PURE__ */ jsx5(Method, { row, t }),
4269
+ row === null ? /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__empty", children: t("paymentMethodsEmpty") }) : /* @__PURE__ */ jsx7(Method, { row, t }),
3380
4270
  children
3381
4271
  ]
3382
4272
  }
3383
4273
  );
3384
4274
  }
3385
4275
  function Method({ row, t }) {
3386
- return /* @__PURE__ */ jsxs4(
4276
+ return /* @__PURE__ */ jsxs6(
3387
4277
  "span",
3388
4278
  {
3389
4279
  className: "schematic-payment-methods__method",
3390
4280
  "data-brand": row.brand,
3391
4281
  "data-kind": row.kind,
3392
4282
  children: [
3393
- /* @__PURE__ */ jsx5(
4283
+ /* @__PURE__ */ jsx7(
3394
4284
  "i",
3395
4285
  {
3396
4286
  "aria-hidden": "true",
3397
4287
  className: `schematic-icon schematic-icon--${row.icon} schematic-payment-methods__icon`
3398
4288
  }
3399
4289
  ),
3400
- /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__label", children: labelText(row.label, t) }),
3401
- row.last4 !== null && /* @__PURE__ */ jsxs4(Fragment2, { children: [
4290
+ /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__label", children: labelText(row.label, t) }),
4291
+ row.last4 !== null && /* @__PURE__ */ jsxs6(Fragment3, { children: [
3402
4292
  " ",
3403
- /* @__PURE__ */ jsx5("span", { className: "schematic-payment-methods__last4", children: row.last4 })
4293
+ /* @__PURE__ */ jsx7("span", { className: "schematic-payment-methods__last4", children: row.last4 })
3404
4294
  ] })
3405
4295
  ]
3406
4296
  }
@@ -3414,24 +4304,24 @@ function expiryWarningText(derived, t) {
3414
4304
  return derived.expiryWarning === "expired" ? t("paymentMethodsExpired") : t("paymentMethodsExpiresInMonths", { months });
3415
4305
  }
3416
4306
  function PaymentMethodsSkeleton({ showHeader }) {
3417
- return /* @__PURE__ */ jsxs4("div", { className: "schematic-skeleton", children: [
3418
- showHeader && /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__heading" }),
3419
- /* @__PURE__ */ jsxs4("div", { className: "schematic-skeleton__row", children: [
3420
- /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__cell", "data-column": "method" }),
3421
- /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__cell", "data-column": "action" })
4307
+ return /* @__PURE__ */ jsxs6("div", { className: "schematic-skeleton", children: [
4308
+ showHeader && /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__heading" }),
4309
+ /* @__PURE__ */ jsxs6("div", { className: "schematic-skeleton__row", children: [
4310
+ /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__cell", "data-column": "method" }),
4311
+ /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__cell", "data-column": "action" })
3422
4312
  ] })
3423
4313
  ] });
3424
4314
  }
3425
4315
  function FormSkeleton({ label }) {
3426
- return /* @__PURE__ */ jsxs4(
4316
+ return /* @__PURE__ */ jsxs6(
3427
4317
  "div",
3428
4318
  {
3429
4319
  "aria-busy": "true",
3430
4320
  className: "schematic-payment-methods__form",
3431
4321
  "data-state": "pending",
3432
4322
  children: [
3433
- /* @__PURE__ */ jsx5("span", { className: "schematic-hidden", children: label }),
3434
- /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
4323
+ /* @__PURE__ */ jsx7("span", { className: "schematic-hidden", children: label }),
4324
+ /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
3435
4325
  ]
3436
4326
  }
3437
4327
  );
@@ -3440,8 +4330,8 @@ PaymentMethods.resources = ["paymentMethods"];
3440
4330
 
3441
4331
  // src/elements/UpcomingBill.tsx
3442
4332
  import { useUpcomingInvoice } from "@schematichq/schematic-react";
3443
- import { useMemo as useMemo3 } from "react";
3444
- import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
4333
+ import { useMemo as useMemo4 } from "react";
4334
+ import { Fragment as Fragment4, jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
3445
4335
  function UpcomingBill({
3446
4336
  className,
3447
4337
  headingLevel = 2,
@@ -3455,7 +4345,7 @@ function UpcomingBill({
3455
4345
  const { data: invoice, error, isPending, refetch } = useUpcomingInvoice();
3456
4346
  const locale = useResolvedLocale(localeProp);
3457
4347
  const t = useTranslator(strings, localeProp);
3458
- const bill = useMemo3(
4348
+ const bill = useMemo4(
3459
4349
  () => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
3460
4350
  [invoice, locale]
3461
4351
  );
@@ -3464,7 +4354,7 @@ function UpcomingBill({
3464
4354
  const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
3465
4355
  const unavailable = invoice === void 0 && httpStatus(error) === 404;
3466
4356
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
3467
- return /* @__PURE__ */ jsx6(
4357
+ return /* @__PURE__ */ jsx8(
3468
4358
  StatusFrame,
3469
4359
  {
3470
4360
  className: cx("schematic-card", "schematic-upcoming-bill", className),
@@ -3475,11 +4365,11 @@ function UpcomingBill({
3475
4365
  loadingLabel: t("upcomingBillLoading"),
3476
4366
  onRetry: refetch,
3477
4367
  retryText: t("retry"),
3478
- skeleton: /* @__PURE__ */ jsx6(UpcomingBillSkeleton, { showHeader }),
3479
- children: bill === null ? invoice !== void 0 && /* @__PURE__ */ jsx6("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ jsxs5(Fragment3, { children: [
3480
- showHeader && bill.dueAt !== null && /* @__PURE__ */ jsx6("div", { className: "schematic-header", children: /* @__PURE__ */ jsx6(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
3481
- showAmount && /* @__PURE__ */ jsxs5("div", { className: "schematic-upcoming-bill__amount", children: [
3482
- /* @__PURE__ */ jsx6(
4368
+ skeleton: /* @__PURE__ */ jsx8(UpcomingBillSkeleton, { showHeader }),
4369
+ children: bill === null ? invoice !== void 0 && /* @__PURE__ */ jsx8("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ jsxs7(Fragment4, { children: [
4370
+ showHeader && bill.dueAt !== null && /* @__PURE__ */ jsx8("div", { className: "schematic-header", children: /* @__PURE__ */ jsx8(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
4371
+ showAmount && /* @__PURE__ */ jsxs7("div", { className: "schematic-upcoming-bill__amount", children: [
4372
+ /* @__PURE__ */ jsx8(
3483
4373
  "span",
3484
4374
  {
3485
4375
  className: "schematic-upcoming-bill__total",
@@ -3487,46 +4377,46 @@ function UpcomingBill({
3487
4377
  children: bill.amountDueText
3488
4378
  }
3489
4379
  ),
3490
- /* @__PURE__ */ jsx6("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
4380
+ /* @__PURE__ */ jsx8("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
3491
4381
  ] }),
3492
- (balanceRows || discountRow) && /* @__PURE__ */ jsxs5("div", { className: "schematic-upcoming-bill__rows", children: [
3493
- balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ jsxs5(
4382
+ (balanceRows || discountRow) && /* @__PURE__ */ jsxs7("div", { className: "schematic-upcoming-bill__rows", children: [
4383
+ balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ jsxs7(
3494
4384
  "div",
3495
4385
  {
3496
4386
  className: "schematic-row schematic-upcoming-bill__balance-applied",
3497
4387
  "data-testid": "schematic-balance-applied",
3498
4388
  children: [
3499
- /* @__PURE__ */ jsx6("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
3500
- /* @__PURE__ */ jsx6("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
4389
+ /* @__PURE__ */ jsx8("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
4390
+ /* @__PURE__ */ jsx8("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
3501
4391
  ]
3502
4392
  }
3503
4393
  ),
3504
- balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ jsxs5(
4394
+ balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ jsxs7(
3505
4395
  "div",
3506
4396
  {
3507
4397
  className: "schematic-row schematic-upcoming-bill__balance-remaining",
3508
4398
  "data-testid": "schematic-balance-remaining",
3509
4399
  children: [
3510
- /* @__PURE__ */ jsx6("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
3511
- /* @__PURE__ */ jsx6("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
4400
+ /* @__PURE__ */ jsx8("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
4401
+ /* @__PURE__ */ jsx8("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
3512
4402
  ]
3513
4403
  }
3514
4404
  ),
3515
- discountRow && /* @__PURE__ */ jsxs5(
4405
+ discountRow && /* @__PURE__ */ jsxs7(
3516
4406
  "div",
3517
4407
  {
3518
4408
  className: "schematic-row schematic-upcoming-bill__discount-row",
3519
4409
  "data-testid": "schematic-discounts",
3520
4410
  children: [
3521
- /* @__PURE__ */ jsx6("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
3522
- /* @__PURE__ */ jsx6("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ jsxs5(
4411
+ /* @__PURE__ */ jsx8("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
4412
+ /* @__PURE__ */ jsx8("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ jsxs7(
3523
4413
  "li",
3524
4414
  {
3525
4415
  className: "schematic-upcoming-bill__discount",
3526
4416
  "data-testid": "schematic-discount",
3527
4417
  children: [
3528
- discount.code !== null && /* @__PURE__ */ jsx6("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
3529
- /* @__PURE__ */ jsx6("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
4418
+ discount.code !== null && /* @__PURE__ */ jsx8("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
4419
+ /* @__PURE__ */ jsx8("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
3530
4420
  ]
3531
4421
  },
3532
4422
  `${discount.couponName}-${index}`
@@ -3540,10 +4430,10 @@ function UpcomingBill({
3540
4430
  );
3541
4431
  }
3542
4432
  function UpcomingBillSkeleton({ showHeader }) {
3543
- return /* @__PURE__ */ jsxs5("div", { className: "schematic-skeleton", children: [
3544
- showHeader && /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__heading" }),
3545
- /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
3546
- /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
4433
+ return /* @__PURE__ */ jsxs7("div", { className: "schematic-skeleton", children: [
4434
+ showHeader && /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__heading" }),
4435
+ /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
4436
+ /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
3547
4437
  ] });
3548
4438
  }
3549
4439
  function discountText(discount, t) {
@@ -3559,13 +4449,18 @@ UpcomingBill.resources = ["upcomingInvoice"];
3559
4449
  export {
3560
4450
  BillingDataProvider,
3561
4451
  DEFAULT_STRINGS,
4452
+ FEATURE_USER_USAGE_LIMIT,
4453
+ IncludedFeatures,
3562
4454
  Invoices,
3563
4455
  PaymentMethods,
3564
4456
  SCHEMATIC_TOKENS,
3565
4457
  SchematicI18nProvider,
3566
4458
  SchematicStyles,
4459
+ Tooltip,
3567
4460
  UpcomingBill,
3568
4461
  billingResources,
4462
+ currentTier,
4463
+ deriveIncludedFeatures,
3569
4464
  deriveInvoiceList,
3570
4465
  derivePaymentMethods,
3571
4466
  deriveUpcomingInvoice,
@@ -3580,11 +4475,18 @@ export {
3580
4475
  httpStatus,
3581
4476
  iconsCss,
3582
4477
  interpolate,
4478
+ isTieredPrice,
3583
4479
  lookup,
3584
4480
  plural,
4481
+ pricePeriod,
3585
4482
  resolveLocale,
3586
4483
  schematicStylesCss,
3587
4484
  schematicTokensCss,
4485
+ tierRanges,
4486
+ unitPrice,
4487
+ usageLimit,
4488
+ useFeatureUsage2 as useFeatureUsage,
4489
+ useFeatureUserUsage,
3588
4490
  useInvalidateBillingData,
3589
4491
  useInvoices2 as useInvoices,
3590
4492
  usePaymentMethods2 as usePaymentMethods,