@schematichq/schematic-components 2.32.0 → 2.33.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.
- package/dist/schematic-components-elements.cjs.js +838 -258
- package/dist/schematic-components-elements.d.ts +174 -10
- package/dist/schematic-components-elements.esm.js +805 -220
- package/dist/schematic-components.browser.cjs.js +247 -32
- package/dist/schematic-components.browser.esm.js +247 -32
- package/dist/schematic-components.cjs.js +247 -32
- package/dist/schematic-components.d.ts +127 -0
- package/dist/schematic-components.esm.js +247 -32
- package/package.json +6 -6
|
@@ -53,6 +53,9 @@ var init_tokens = __esm({
|
|
|
53
53
|
"--schematic-font-heading": '"Manrope", system-ui, sans-serif',
|
|
54
54
|
// Link buttons' face: Edit, Set default, Try again, and the rest.
|
|
55
55
|
"--schematic-font-link": '"Inter", system-ui, sans-serif',
|
|
56
|
+
// A lighter tint than the surface, for panels set into a card: a credit's
|
|
57
|
+
// grants, a plan's auto top-up.
|
|
58
|
+
"--schematic-inset": ld("hsla(0, 0%, 0%, 0.04)", "hsla(0, 0%, 100%, 0.06)"),
|
|
56
59
|
"--schematic-line-height": "1.375",
|
|
57
60
|
"--schematic-line-height-heading": "1.2",
|
|
58
61
|
"--schematic-meter-track": ld("#f2f4f7", "#26282d"),
|
|
@@ -87,8 +90,8 @@ __export(PaymentMethodForm_exports, {
|
|
|
87
90
|
resolveAppearance: () => resolveAppearance
|
|
88
91
|
});
|
|
89
92
|
import { useSetupIntent } from "@schematichq/schematic-react";
|
|
90
|
-
import { useEffect as useEffect2, useId as useId3, useRef as useRef2, useState as
|
|
91
|
-
import { jsx as
|
|
93
|
+
import { useEffect as useEffect2, useId as useId3, useRef as useRef2, useState as useState5 } from "react";
|
|
94
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
92
95
|
function orUndefined(value) {
|
|
93
96
|
return value === void 0 || value === "" ? void 0 : value;
|
|
94
97
|
}
|
|
@@ -141,7 +144,7 @@ function PaymentMethodForm({
|
|
|
141
144
|
t
|
|
142
145
|
}) {
|
|
143
146
|
const { create } = useSetupIntent();
|
|
144
|
-
const [state, setState] =
|
|
147
|
+
const [state, setState] = useState5({ status: "loading" });
|
|
145
148
|
const hostRef = useRef2(null);
|
|
146
149
|
useEffect2(() => {
|
|
147
150
|
let cancelled = false;
|
|
@@ -189,7 +192,7 @@ function PaymentMethodForm({
|
|
|
189
192
|
};
|
|
190
193
|
}, [create, locale]);
|
|
191
194
|
if (state.status === "loading") {
|
|
192
|
-
return /* @__PURE__ */
|
|
195
|
+
return /* @__PURE__ */ jsxs7(
|
|
193
196
|
"div",
|
|
194
197
|
{
|
|
195
198
|
"aria-busy": "true",
|
|
@@ -197,15 +200,15 @@ function PaymentMethodForm({
|
|
|
197
200
|
"data-state": "pending",
|
|
198
201
|
ref: hostRef,
|
|
199
202
|
children: [
|
|
200
|
-
/* @__PURE__ */
|
|
201
|
-
/* @__PURE__ */
|
|
203
|
+
/* @__PURE__ */ jsx8("span", { className: "schematic-hidden", children: t("paymentMethodsFormLoading") }),
|
|
204
|
+
/* @__PURE__ */ jsx8("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx8("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
|
|
202
205
|
]
|
|
203
206
|
}
|
|
204
207
|
);
|
|
205
208
|
}
|
|
206
209
|
if (state.status === "failed") {
|
|
207
|
-
return /* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
210
|
+
return /* @__PURE__ */ jsxs7("div", { className: "schematic-payment-methods__form", "data-state": "error", children: [
|
|
211
|
+
/* @__PURE__ */ jsx8(
|
|
209
212
|
"p",
|
|
210
213
|
{
|
|
211
214
|
className: "schematic-error schematic-small schematic-payment-methods__form-error",
|
|
@@ -213,11 +216,11 @@ function PaymentMethodForm({
|
|
|
213
216
|
children: t(state.errorKey)
|
|
214
217
|
}
|
|
215
218
|
),
|
|
216
|
-
onSelectExisting !== void 0 && /* @__PURE__ */
|
|
219
|
+
onSelectExisting !== void 0 && /* @__PURE__ */ jsx8(SelectExisting, { t, onSelectExisting })
|
|
217
220
|
] });
|
|
218
221
|
}
|
|
219
222
|
const { Elements } = state.ui;
|
|
220
|
-
return /* @__PURE__ */
|
|
223
|
+
return /* @__PURE__ */ jsx8(
|
|
221
224
|
Elements,
|
|
222
225
|
{
|
|
223
226
|
stripe: state.stripe,
|
|
@@ -225,7 +228,7 @@ function PaymentMethodForm({
|
|
|
225
228
|
appearance: state.appearance,
|
|
226
229
|
clientSecret: state.clientSecret
|
|
227
230
|
},
|
|
228
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ jsx8(
|
|
229
232
|
Fields,
|
|
230
233
|
{
|
|
231
234
|
checkoutPrefill,
|
|
@@ -257,13 +260,13 @@ function Fields({
|
|
|
257
260
|
const emailId = useId3();
|
|
258
261
|
const stripe = useStripe();
|
|
259
262
|
const elements = useElements();
|
|
260
|
-
const [saving, setSaving] =
|
|
261
|
-
const [message, setMessage] =
|
|
262
|
-
const [complete, setComplete] =
|
|
263
|
-
const [ready, setReady] =
|
|
264
|
-
const [loadFailed, setLoadFailed] =
|
|
265
|
-
const [addressComplete, setAddressComplete] =
|
|
266
|
-
const [typedEmail, setTypedEmail] =
|
|
263
|
+
const [saving, setSaving] = useState5(false);
|
|
264
|
+
const [message, setMessage] = useState5(null);
|
|
265
|
+
const [complete, setComplete] = useState5(false);
|
|
266
|
+
const [ready, setReady] = useState5(false);
|
|
267
|
+
const [loadFailed, setLoadFailed] = useState5(false);
|
|
268
|
+
const [addressComplete, setAddressComplete] = useState5(!collectAddress);
|
|
269
|
+
const [typedEmail, setTypedEmail] = useState5(null);
|
|
267
270
|
const email = typedEmail ?? orUndefined(prefill?.email) ?? "";
|
|
268
271
|
const emailValid = !collectEmail || VALID_EMAIL.test(email);
|
|
269
272
|
useEffect2(() => {
|
|
@@ -318,14 +321,14 @@ function Fields({
|
|
|
318
321
|
setSaving(false);
|
|
319
322
|
}
|
|
320
323
|
};
|
|
321
|
-
return /* @__PURE__ */
|
|
324
|
+
return /* @__PURE__ */ jsxs7(
|
|
322
325
|
"form",
|
|
323
326
|
{
|
|
324
327
|
className: "schematic-payment-methods__form",
|
|
325
328
|
"data-state": "ready",
|
|
326
329
|
onSubmit: (event) => void submit(event),
|
|
327
330
|
children: [
|
|
328
|
-
/* @__PURE__ */
|
|
331
|
+
/* @__PURE__ */ jsx8("div", { className: "schematic-payment-methods__fields", children: /* @__PURE__ */ jsx8(
|
|
329
332
|
PaymentElement,
|
|
330
333
|
{
|
|
331
334
|
onChange: (event) => setComplete(event.complete),
|
|
@@ -336,8 +339,8 @@ function Fields({
|
|
|
336
339
|
}
|
|
337
340
|
}
|
|
338
341
|
) }),
|
|
339
|
-
collectEmail && /* @__PURE__ */
|
|
340
|
-
/* @__PURE__ */
|
|
342
|
+
collectEmail && /* @__PURE__ */ jsxs7("div", { className: "schematic-payment-methods__field", children: [
|
|
343
|
+
/* @__PURE__ */ jsx8(
|
|
341
344
|
"label",
|
|
342
345
|
{
|
|
343
346
|
className: "schematic-payment-methods__field-label",
|
|
@@ -345,7 +348,7 @@ function Fields({
|
|
|
345
348
|
children: t("paymentMethodsEmail")
|
|
346
349
|
}
|
|
347
350
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ jsx8(
|
|
349
352
|
"input",
|
|
350
353
|
{
|
|
351
354
|
autoComplete: "email",
|
|
@@ -359,7 +362,7 @@ function Fields({
|
|
|
359
362
|
}
|
|
360
363
|
)
|
|
361
364
|
] }),
|
|
362
|
-
showAddress && /* @__PURE__ */
|
|
365
|
+
showAddress && /* @__PURE__ */ jsx8("div", { className: "schematic-payment-methods__address", children: /* @__PURE__ */ jsx8(
|
|
363
366
|
AddressElement,
|
|
364
367
|
{
|
|
365
368
|
options: {
|
|
@@ -373,7 +376,7 @@ function Fields({
|
|
|
373
376
|
},
|
|
374
377
|
prefillName ?? ""
|
|
375
378
|
) }),
|
|
376
|
-
loadFailed && /* @__PURE__ */
|
|
379
|
+
loadFailed && /* @__PURE__ */ jsx8(
|
|
377
380
|
"p",
|
|
378
381
|
{
|
|
379
382
|
className: "schematic-error schematic-small schematic-payment-methods__form-error",
|
|
@@ -381,7 +384,7 @@ function Fields({
|
|
|
381
384
|
children: t("paymentMethodsFormError")
|
|
382
385
|
}
|
|
383
386
|
),
|
|
384
|
-
message !== null && /* @__PURE__ */
|
|
387
|
+
message !== null && /* @__PURE__ */ jsx8(
|
|
385
388
|
"p",
|
|
386
389
|
{
|
|
387
390
|
className: "schematic-error schematic-small schematic-payment-methods__form-error",
|
|
@@ -389,7 +392,7 @@ function Fields({
|
|
|
389
392
|
children: message
|
|
390
393
|
}
|
|
391
394
|
),
|
|
392
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ jsx8(
|
|
393
396
|
"button",
|
|
394
397
|
{
|
|
395
398
|
className: "schematic-cta schematic-payment-methods__save",
|
|
@@ -398,7 +401,7 @@ function Fields({
|
|
|
398
401
|
children: saving ? t("paymentMethodsSaving") : t("paymentMethodsSave")
|
|
399
402
|
}
|
|
400
403
|
),
|
|
401
|
-
onSelectExisting !== void 0 && /* @__PURE__ */
|
|
404
|
+
onSelectExisting !== void 0 && /* @__PURE__ */ jsx8(
|
|
402
405
|
SelectExisting,
|
|
403
406
|
{
|
|
404
407
|
disabled: saving,
|
|
@@ -415,7 +418,7 @@ function SelectExisting({
|
|
|
415
418
|
onSelectExisting,
|
|
416
419
|
t
|
|
417
420
|
}) {
|
|
418
|
-
return /* @__PURE__ */
|
|
421
|
+
return /* @__PURE__ */ jsx8(
|
|
419
422
|
"button",
|
|
420
423
|
{
|
|
421
424
|
className: "schematic-link-button schematic-payment-methods__select-existing",
|
|
@@ -456,6 +459,8 @@ import {
|
|
|
456
459
|
BillingDataProvider,
|
|
457
460
|
FEATURE_USER_USAGE_LIMIT,
|
|
458
461
|
SchematicI18nProvider,
|
|
462
|
+
useCreditBalances as useCreditBalances2,
|
|
463
|
+
useCreditUserUsage as useCreditUserUsage2,
|
|
459
464
|
useFeatureUsage as useFeatureUsage3,
|
|
460
465
|
useFeatureUserUsage as useFeatureUserUsage2,
|
|
461
466
|
useInvalidateBillingData,
|
|
@@ -922,6 +927,9 @@ function formatCurrency(amountMinor, currency, locale, options = {}) {
|
|
|
922
927
|
function formatNumber(value, locale, options) {
|
|
923
928
|
return new Intl.NumberFormat(usableLocale(locale), options).format(value);
|
|
924
929
|
}
|
|
930
|
+
function formatCredits(value, locale) {
|
|
931
|
+
return formatNumber(value, locale, { maximumFractionDigits: 10 });
|
|
932
|
+
}
|
|
925
933
|
function formatConsumptionRate(rate, locale) {
|
|
926
934
|
return formatNumber(rate, locale, {
|
|
927
935
|
maximumFractionDigits: MAXIMUM_FRACTION_DIGITS
|
|
@@ -1318,7 +1326,10 @@ function includedFeatureRow(row, options) {
|
|
|
1318
1326
|
description: nonEmpty(row.featureDescription),
|
|
1319
1327
|
icon: nonEmpty(row.featureIcon),
|
|
1320
1328
|
perLicenseCredits: row.perLicenseCreditGrants.filter((grant) => grant.scaling === "per_license").map((grant) => ({
|
|
1321
|
-
|
|
1329
|
+
// Credits come in fractions as small as 1e-10.
|
|
1330
|
+
amount: formatNumber(grant.creditAmount, locale, {
|
|
1331
|
+
maximumFractionDigits: 10
|
|
1332
|
+
}),
|
|
1322
1333
|
creditName: featureName(
|
|
1323
1334
|
{
|
|
1324
1335
|
name: grant.creditName,
|
|
@@ -1338,7 +1349,7 @@ function includedFeatureRow(row, options) {
|
|
|
1338
1349
|
usage: usageSegments(row, locale, tiered, period),
|
|
1339
1350
|
usageSummary: usageSummary(row, options),
|
|
1340
1351
|
hardLimit: row.priceBehavior !== void 0 && row.priceBehavior !== null && row.priceBehavior !== "credit_burndown" && row.valueType === "numeric" && typeof row.allocation === "number" ? {
|
|
1341
|
-
amount: row.allocation,
|
|
1352
|
+
amount: formatNumber(row.allocation, locale),
|
|
1342
1353
|
units: featureName(feature, row.allocation, locale)
|
|
1343
1354
|
} : null,
|
|
1344
1355
|
tiers: (row.priceBehavior === "tier" || tiered) && row.price !== void 0 ? {
|
|
@@ -1383,7 +1394,7 @@ function entitlementText(row, options) {
|
|
|
1383
1394
|
return size > 1 ? {
|
|
1384
1395
|
kind: "perPackage",
|
|
1385
1396
|
cost,
|
|
1386
|
-
size,
|
|
1397
|
+
size: formatNumber(size, locale),
|
|
1387
1398
|
units: featureName(feature, size, locale)
|
|
1388
1399
|
} : { kind: "perUnit", cost, unit: featureName(feature, 1, locale) };
|
|
1389
1400
|
}
|
|
@@ -1444,14 +1455,14 @@ function usageSegments(row, locale, tiered, period) {
|
|
|
1444
1455
|
segments.push({
|
|
1445
1456
|
kind: "unitPricePerPeriod",
|
|
1446
1457
|
cost: formatCurrency(unitPrice(row.price), row.price.currency, locale),
|
|
1447
|
-
size,
|
|
1458
|
+
size: size > 1 ? formatNumber(size, locale) : null,
|
|
1448
1459
|
units: featureName(feature, size, locale),
|
|
1449
1460
|
period
|
|
1450
1461
|
});
|
|
1451
1462
|
} else if ((row.priceBehavior === "pay_as_you_go" || row.priceBehavior === "overage" || row.priceBehavior === "tier" || row.priceBehavior === "credit_burndown" || tiered) && typeof row.usage === "number") {
|
|
1452
1463
|
segments.push({
|
|
1453
1464
|
kind: "used",
|
|
1454
|
-
amount:
|
|
1465
|
+
amount: formatNumber(row.usage, locale),
|
|
1455
1466
|
units: featureName(feature, row.usage, locale)
|
|
1456
1467
|
});
|
|
1457
1468
|
}
|
|
@@ -1526,7 +1537,7 @@ function meteredFeatureRow(row, options) {
|
|
|
1526
1537
|
limit: limitLine(row, limit, unit, options),
|
|
1527
1538
|
resetsAt: resetsAt === void 0 ? null : formatDate(resetsAt, locale, { month: "short", year: void 0 }),
|
|
1528
1539
|
hardLimit: row.priceBehavior !== void 0 && row.priceBehavior !== null && row.priceBehavior !== "credit_burndown" && row.valueType === "numeric" && typeof row.allocation === "number" ? {
|
|
1529
|
-
amount: row.allocation,
|
|
1540
|
+
amount: formatNumber(row.allocation, locale),
|
|
1530
1541
|
units: featureName(unit, row.allocation, locale)
|
|
1531
1542
|
} : null,
|
|
1532
1543
|
meter: meter(row, options),
|
|
@@ -1648,7 +1659,7 @@ function priceDetails(row, unit, locale) {
|
|
|
1648
1659
|
return {
|
|
1649
1660
|
kind: "overage",
|
|
1650
1661
|
unitPrice: money(tier.perUnitPrice),
|
|
1651
|
-
packageSize: size,
|
|
1662
|
+
packageSize: size > 1 ? formatNumber(size, locale) : null,
|
|
1652
1663
|
units: featureName(unit, size, locale),
|
|
1653
1664
|
period,
|
|
1654
1665
|
overage: {
|
|
@@ -1664,8 +1675,8 @@ function priceDetails(row, unit, locale) {
|
|
|
1664
1675
|
}
|
|
1665
1676
|
return {
|
|
1666
1677
|
kind: "tier",
|
|
1667
|
-
from: tier.from === 0 ? 1 : tier.from,
|
|
1668
|
-
to: tier.to,
|
|
1678
|
+
from: formatNumber(tier.from === 0 ? 1 : tier.from, locale),
|
|
1679
|
+
to: tier.to === null ? null : formatNumber(tier.to, locale),
|
|
1669
1680
|
cost: typeof row.currentCost === "number" ? money(row.currentCost) : null,
|
|
1670
1681
|
period,
|
|
1671
1682
|
tiers: {
|
|
@@ -1678,6 +1689,98 @@ function priceDetails(row, unit, locale) {
|
|
|
1678
1689
|
return null;
|
|
1679
1690
|
}
|
|
1680
1691
|
|
|
1692
|
+
// src/elements/model/creditUsage.ts
|
|
1693
|
+
function deriveCreditUsage(balances, options) {
|
|
1694
|
+
const ordered = options.visibleCredits === void 0 ? balances : options.visibleCredits.flatMap((id) => {
|
|
1695
|
+
const balance = balances.find((b) => b.creditId === id);
|
|
1696
|
+
return balance === void 0 ? [] : [balance];
|
|
1697
|
+
});
|
|
1698
|
+
return ordered.map((balance) => creditUsageRow(balance, options.locale));
|
|
1699
|
+
}
|
|
1700
|
+
function creditUsageRow(balance, locale) {
|
|
1701
|
+
const unit = {
|
|
1702
|
+
name: balance.creditName,
|
|
1703
|
+
singularName: balance.creditSingularName ?? void 0,
|
|
1704
|
+
pluralName: balance.creditPluralName ?? void 0
|
|
1705
|
+
};
|
|
1706
|
+
const composition = balance.composition;
|
|
1707
|
+
return {
|
|
1708
|
+
creditId: balance.creditId,
|
|
1709
|
+
name: balance.creditName,
|
|
1710
|
+
description: balance.creditDescription === "" ? null : balance.creditDescription,
|
|
1711
|
+
icon: balance.creditIcon === void 0 || balance.creditIcon === null || balance.creditIcon === "" ? null : balance.creditIcon,
|
|
1712
|
+
remaining: {
|
|
1713
|
+
amount: formatCredits(balance.remaining, locale),
|
|
1714
|
+
units: featureName(unit, balance.remaining, locale)
|
|
1715
|
+
},
|
|
1716
|
+
purchasable: balance.purchasable,
|
|
1717
|
+
ledger: balance.grants.map((grant) => ledgerRow(grant, unit, locale)),
|
|
1718
|
+
composition: composition === void 0 || composition === null ? null : {
|
|
1719
|
+
total: formatCredits(composition.total, locale),
|
|
1720
|
+
creditName: featureName(unit, composition.total, locale),
|
|
1721
|
+
period: composition.period,
|
|
1722
|
+
perLicense: {
|
|
1723
|
+
quantity: formatNumber(composition.licenseQuantity, locale),
|
|
1724
|
+
licenseName: featureName(
|
|
1725
|
+
{
|
|
1726
|
+
name: composition.licenseName,
|
|
1727
|
+
singularName: composition.licenseSingularName,
|
|
1728
|
+
pluralName: composition.licensePluralName
|
|
1729
|
+
},
|
|
1730
|
+
composition.licenseQuantity,
|
|
1731
|
+
locale
|
|
1732
|
+
),
|
|
1733
|
+
perUnit: formatCredits(composition.perLicenseAmount, locale)
|
|
1734
|
+
},
|
|
1735
|
+
companyGrant: composition.fixedQuantity > 0 ? formatCredits(composition.fixedQuantity, locale) : null,
|
|
1736
|
+
renewsOn: renewsOn(composition.renewsAt, locale)
|
|
1737
|
+
},
|
|
1738
|
+
unit,
|
|
1739
|
+
source: balance
|
|
1740
|
+
};
|
|
1741
|
+
}
|
|
1742
|
+
function ledgerRow(grant, unit, locale) {
|
|
1743
|
+
const kind = grant.grantReason === "plan" ? "plan" : grant.grantReason === "purchased" ? "bundle" : grant.grantReason === "billing_credit_auto_topup" ? "autoTopup" : "promotional";
|
|
1744
|
+
const short = (date) => formatDate(date, locale, { month: "short" });
|
|
1745
|
+
const resetsAt = usableDate(grant.resetsAt);
|
|
1746
|
+
const expiresAt = usableDate(grant.expiresAt);
|
|
1747
|
+
return {
|
|
1748
|
+
id: grant.id,
|
|
1749
|
+
kind,
|
|
1750
|
+
amount: formatCredits(grant.quantity, locale),
|
|
1751
|
+
item: featureName(unit, kind === "bundle" ? 1 : grant.quantity, locale),
|
|
1752
|
+
createdAt: short(grant.createdAt),
|
|
1753
|
+
date: resetsAt !== void 0 ? { kind: "resets", text: short(resetsAt) } : expiresAt !== void 0 ? { kind: "expires", text: short(expiresAt) } : null,
|
|
1754
|
+
source: grant
|
|
1755
|
+
};
|
|
1756
|
+
}
|
|
1757
|
+
function renewsOn(date, locale) {
|
|
1758
|
+
const due = usableDate(date);
|
|
1759
|
+
if (due === void 0) {
|
|
1760
|
+
return null;
|
|
1761
|
+
}
|
|
1762
|
+
const day = due.getDate();
|
|
1763
|
+
if (!isEnglish2(locale)) {
|
|
1764
|
+
return formatNumber(day, locale);
|
|
1765
|
+
}
|
|
1766
|
+
const suffix = {
|
|
1767
|
+
few: "rd",
|
|
1768
|
+
many: "th",
|
|
1769
|
+
one: "st",
|
|
1770
|
+
other: "th",
|
|
1771
|
+
two: "nd",
|
|
1772
|
+
zero: "th"
|
|
1773
|
+
};
|
|
1774
|
+
return `${day}${suffix[new Intl.PluralRules("en", { type: "ordinal" }).select(day)]}`;
|
|
1775
|
+
}
|
|
1776
|
+
function isEnglish2(locale) {
|
|
1777
|
+
try {
|
|
1778
|
+
return new Intl.Locale(locale).language === "en";
|
|
1779
|
+
} catch {
|
|
1780
|
+
return false;
|
|
1781
|
+
}
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1681
1784
|
// src/elements/strings.ts
|
|
1682
1785
|
var DEFAULT_STRINGS_LOCALE = "en";
|
|
1683
1786
|
var DEFAULT_STRINGS = {
|
|
@@ -1765,6 +1868,27 @@ var DEFAULT_STRINGS = {
|
|
|
1765
1868
|
meteredFeaturesAddMore: "Add More",
|
|
1766
1869
|
meteredFeaturesAdditional: "Additional",
|
|
1767
1870
|
meteredFeaturesTier: "Tier",
|
|
1871
|
+
creditUsageLoading: "Loading credits",
|
|
1872
|
+
creditUsageHeader: "Credits",
|
|
1873
|
+
creditUsageError: "There was a problem retrieving your credits.",
|
|
1874
|
+
creditUsageUnavailable: "Credits are not available for this account.",
|
|
1875
|
+
creditUsageRemaining: "{{amount}} {{units}} remaining",
|
|
1876
|
+
creditUsageBuyMore: "Buy More",
|
|
1877
|
+
creditUsageSeeDetails: "See balance details",
|
|
1878
|
+
creditUsageHideDetails: "Hide balance details",
|
|
1879
|
+
creditUsageSeeAll: "See all ({{total}})",
|
|
1880
|
+
creditUsageHideAll: "Hide all",
|
|
1881
|
+
creditUsageGrantPlan: "{{amount}} {{item}} included in plan",
|
|
1882
|
+
creditUsageGrantBundle: "{{amount}} {{item}} bundle purchased {{createdAt}}",
|
|
1883
|
+
creditUsageGrantAutoTopup: "{{amount}} {{item}} auto-topup purchased {{createdAt}}",
|
|
1884
|
+
creditUsageGrantPromotional: "{{amount}} promotional {{item}} granted {{createdAt}}",
|
|
1885
|
+
creditUsageResets: "Resets {{date}}",
|
|
1886
|
+
creditUsageExpires: "Expires {{date}}",
|
|
1887
|
+
creditUsageComposition: "Your plan includes {{total}} {{creditName}}/{{period}} \u2014 {{perLicense}}.",
|
|
1888
|
+
creditUsageCompositionWithGrant: "Your plan includes {{total}} {{creditName}}/{{period}} \u2014 {{perLicense}} + {{companyGrant}}.",
|
|
1889
|
+
creditUsagePerLicense: "{{quantity}} {{licenseName}} \xD7 {{perUnit}}",
|
|
1890
|
+
creditUsageCompanyGrant: "{{amount}} company grant",
|
|
1891
|
+
creditUsageRenewsOn: "Renews on the {{day}}.",
|
|
1768
1892
|
usageByUserHeader: "Usage by user",
|
|
1769
1893
|
usageByUserTotal: "{{amount}} used by your team this period",
|
|
1770
1894
|
usageByUserError: "There was a problem retrieving usage by user.",
|
|
@@ -1831,6 +1955,160 @@ function defaultString(key, vars) {
|
|
|
1831
1955
|
return lookup(DEFAULT_STRINGS, key, vars) ?? DEFAULT_STRINGS[key] ?? key;
|
|
1832
1956
|
}
|
|
1833
1957
|
|
|
1958
|
+
// src/elements/styles/credit-usage.ts
|
|
1959
|
+
var creditUsageCss = `
|
|
1960
|
+
.schematic-credit-usage__credits {
|
|
1961
|
+
display: flex;
|
|
1962
|
+
flex-direction: column;
|
|
1963
|
+
gap: var(--schematic-space);
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
/* Each credit draws its own card, so the root draws one only while pending
|
|
1967
|
+
or failed. */
|
|
1968
|
+
.schematic-credit-usage[data-state="pending"],
|
|
1969
|
+
.schematic-credit-usage[data-state="error"] {
|
|
1970
|
+
background: var(--schematic-background);
|
|
1971
|
+
border-radius: var(--schematic-radius);
|
|
1972
|
+
box-shadow: var(--schematic-shadow);
|
|
1973
|
+
padding: calc(var(--schematic-card-padding) * 0.75)
|
|
1974
|
+
var(--schematic-card-padding);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
.schematic-credit-usage__credit {
|
|
1978
|
+
display: flex;
|
|
1979
|
+
flex-direction: column;
|
|
1980
|
+
gap: var(--schematic-space);
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
.schematic-credit-usage__main {
|
|
1984
|
+
display: flex;
|
|
1985
|
+
gap: calc(var(--schematic-space) * 1.5);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
/* Held even without a glyph, as the embed does, so names line up. */
|
|
1989
|
+
.schematic-credit-usage__icon {
|
|
1990
|
+
align-items: center;
|
|
1991
|
+
background: var(--schematic-surface);
|
|
1992
|
+
border-radius: 9999px;
|
|
1993
|
+
display: inline-flex;
|
|
1994
|
+
flex-shrink: 0;
|
|
1995
|
+
font-size: 1.5rem;
|
|
1996
|
+
height: 2.75rem;
|
|
1997
|
+
justify-content: center;
|
|
1998
|
+
width: 2.75rem;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
.schematic-credit-usage__icon .schematic-icon {
|
|
2002
|
+
color: var(--schematic-accent);
|
|
2003
|
+
}
|
|
2004
|
+
|
|
2005
|
+
/* The embed's spacing: the balance well clear of the name, the composition
|
|
2006
|
+
tucked close under the balance. */
|
|
2007
|
+
.schematic-credit-usage__body {
|
|
2008
|
+
display: flex;
|
|
2009
|
+
flex-direction: column;
|
|
2010
|
+
flex-grow: 1;
|
|
2011
|
+
gap: calc(var(--schematic-space) * 2);
|
|
2012
|
+
min-width: 0;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
.schematic-credit-usage__composition {
|
|
2016
|
+
margin-top: calc(var(--schematic-space) * -1.5);
|
|
2017
|
+
}
|
|
2018
|
+
|
|
2019
|
+
.schematic-credit-usage__title {
|
|
2020
|
+
display: flex;
|
|
2021
|
+
flex-direction: column;
|
|
2022
|
+
gap: 0.5rem;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
.schematic-credit-usage__name {
|
|
2026
|
+
font-family: var(--schematic-font-heading);
|
|
2027
|
+
font-size: 1.8125rem;
|
|
2028
|
+
font-weight: 800;
|
|
2029
|
+
line-height: var(--schematic-line-height-heading);
|
|
2030
|
+
margin: 0;
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
.schematic-credit-usage__balance {
|
|
2034
|
+
align-items: center;
|
|
2035
|
+
display: flex;
|
|
2036
|
+
gap: var(--schematic-space);
|
|
2037
|
+
justify-content: space-between;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
.schematic-credit-usage__remaining {
|
|
2041
|
+
font-size: 1.0625rem;
|
|
2042
|
+
font-variant-numeric: tabular-nums;
|
|
2043
|
+
font-weight: 500;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
.schematic-credit-usage__buy-more {
|
|
2047
|
+
white-space: nowrap;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
2050
|
+
.schematic-credit-usage__details,
|
|
2051
|
+
.schematic-credit-usage__see-all {
|
|
2052
|
+
align-items: center;
|
|
2053
|
+
display: inline-flex;
|
|
2054
|
+
gap: 0.25rem;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
.schematic-credit-usage__details .schematic-chevron,
|
|
2058
|
+
.schematic-credit-usage__see-all .schematic-chevron {
|
|
2059
|
+
margin-inline-start: -0.333rem;
|
|
2060
|
+
}
|
|
2061
|
+
|
|
2062
|
+
/* Opens above its toggle, as in the embed. */
|
|
2063
|
+
.schematic-credit-usage__grants {
|
|
2064
|
+
background: var(--schematic-inset);
|
|
2065
|
+
border-radius: calc(var(--schematic-radius) * 0.8);
|
|
2066
|
+
display: flex;
|
|
2067
|
+
flex-direction: column;
|
|
2068
|
+
gap: 0.5rem;
|
|
2069
|
+
margin-bottom: 0.5rem;
|
|
2070
|
+
padding: calc(var(--schematic-space) * 1.5);
|
|
2071
|
+
}
|
|
2072
|
+
|
|
2073
|
+
.schematic-credit-usage__grant-list {
|
|
2074
|
+
display: flex;
|
|
2075
|
+
flex-direction: column;
|
|
2076
|
+
gap: 0.75rem;
|
|
2077
|
+
list-style: none;
|
|
2078
|
+
margin: 0;
|
|
2079
|
+
padding: 0;
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
/* Where the grant and its date do not fit on one line, the date wraps
|
|
2083
|
+
rather than overflowing the panel. */
|
|
2084
|
+
.schematic-credit-usage__grant {
|
|
2085
|
+
display: flex;
|
|
2086
|
+
flex-wrap: wrap;
|
|
2087
|
+
gap: 0.25rem var(--schematic-space);
|
|
2088
|
+
justify-content: space-between;
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
.schematic-credit-usage__grant-text {
|
|
2092
|
+
flex: 1 1 12rem;
|
|
2093
|
+
min-width: 0;
|
|
2094
|
+
overflow-wrap: anywhere;
|
|
2095
|
+
}
|
|
2096
|
+
|
|
2097
|
+
.schematic-credit-usage__grant-date {
|
|
2098
|
+
margin-inline-start: auto;
|
|
2099
|
+
text-align: end;
|
|
2100
|
+
white-space: nowrap;
|
|
2101
|
+
}
|
|
2102
|
+
|
|
2103
|
+
.schematic-credit-usage .schematic-skeleton__cell[data-column="name"] {
|
|
2104
|
+
width: 10rem;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
.schematic-credit-usage .schematic-skeleton__cell[data-column="remaining"] {
|
|
2108
|
+
width: 6rem;
|
|
2109
|
+
}
|
|
2110
|
+
`;
|
|
2111
|
+
|
|
1834
2112
|
// src/elements/styles/dialog.ts
|
|
1835
2113
|
var dialogCss = `
|
|
1836
2114
|
/* Up to 768px wide, with a tighter radius than a card. */
|
|
@@ -3717,12 +3995,16 @@ ${paymentMethodsCss}
|
|
|
3717
3995
|
${tooltipCss}
|
|
3718
3996
|
${includedFeaturesCss}
|
|
3719
3997
|
${meteredFeaturesCss}
|
|
3998
|
+
${creditUsageCss}
|
|
3720
3999
|
`;
|
|
3721
4000
|
var schematicStylesCss = withTokenDefaults(rulesCss) + iconsCss;
|
|
3722
4001
|
var SchematicStyles = () => /* @__PURE__ */ jsx("style", { "data-schematic-styles": "", children: schematicStylesCss });
|
|
3723
4002
|
|
|
3724
|
-
// src/elements/
|
|
3725
|
-
import {
|
|
4003
|
+
// src/elements/CreditUsage.tsx
|
|
4004
|
+
import {
|
|
4005
|
+
useCreditBalances,
|
|
4006
|
+
useCreditUserUsage
|
|
4007
|
+
} from "@schematichq/schematic-react";
|
|
3726
4008
|
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
3727
4009
|
|
|
3728
4010
|
// src/elements/common.tsx
|
|
@@ -3767,6 +4049,9 @@ function useTranslator(overrides, locale) {
|
|
|
3767
4049
|
const { onMissingString, strings, translate } = useSchematicI18n();
|
|
3768
4050
|
return useCallback(
|
|
3769
4051
|
(key, vars) => {
|
|
4052
|
+
if (isDevelopment) {
|
|
4053
|
+
warnRawNumbers(key, vars);
|
|
4054
|
+
}
|
|
3770
4055
|
const override = lookup(overrides, key, vars, resolved2) ?? lookup(strings, key, vars, resolved2);
|
|
3771
4056
|
if (override !== void 0) {
|
|
3772
4057
|
return override;
|
|
@@ -3788,6 +4073,18 @@ function useTranslator(overrides, locale) {
|
|
|
3788
4073
|
[onMissingString, overrides, resolved2, strings, translate]
|
|
3789
4074
|
);
|
|
3790
4075
|
}
|
|
4076
|
+
var rawNumberWarnings = /* @__PURE__ */ new Set();
|
|
4077
|
+
function warnRawNumbers(key, vars) {
|
|
4078
|
+
for (const [name, value] of Object.entries(vars ?? {})) {
|
|
4079
|
+
const id = `${key}.${name}`;
|
|
4080
|
+
if (name !== "count" && typeof value === "number" && !rawNumberWarnings.has(id)) {
|
|
4081
|
+
rawNumberWarnings.add(id);
|
|
4082
|
+
console.warn(
|
|
4083
|
+
`Schematic: "${key}" got a raw number for "${name}"; format it before it reaches the translator.`
|
|
4084
|
+
);
|
|
4085
|
+
}
|
|
4086
|
+
}
|
|
4087
|
+
}
|
|
3791
4088
|
var isDevelopment = (() => {
|
|
3792
4089
|
try {
|
|
3793
4090
|
return process.env.NODE_ENV !== "production";
|
|
@@ -3971,8 +4268,8 @@ function PriceTiers({
|
|
|
3971
4268
|
return /* @__PURE__ */ jsxs2("span", { className: "schematic-tiers", children: [
|
|
3972
4269
|
/* @__PURE__ */ jsx3("dl", { className: "schematic-tiers__list", children: ranges.map((tier) => /* @__PURE__ */ jsxs2("div", { className: "schematic-tiers__tier", children: [
|
|
3973
4270
|
/* @__PURE__ */ jsxs2("dt", { className: "schematic-tiers__range", children: [
|
|
3974
|
-
tier.from,
|
|
3975
|
-
tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${tier.to}` : ""
|
|
4271
|
+
formatNumber(tier.from, locale),
|
|
4272
|
+
tier.to === null ? "+" : tier.to !== tier.from ? `\u2013${formatNumber(tier.to, locale)}` : ""
|
|
3976
4273
|
] }),
|
|
3977
4274
|
/* @__PURE__ */ jsx3("dd", { className: "schematic-tiers__price", children: tierPrice(tier.flatPrice ?? 0, tier.perUnitPrice ?? 0) })
|
|
3978
4275
|
] }, tier.from)) }),
|
|
@@ -3982,6 +4279,7 @@ function PriceTiers({
|
|
|
3982
4279
|
function UserBreakdown({
|
|
3983
4280
|
breakdown,
|
|
3984
4281
|
error,
|
|
4282
|
+
formatAmount,
|
|
3985
4283
|
locale,
|
|
3986
4284
|
onRetry,
|
|
3987
4285
|
t,
|
|
@@ -3992,7 +4290,7 @@ function UserBreakdown({
|
|
|
3992
4290
|
() => [...breakdown?.users ?? []].sort((a, b) => b.amount - a.amount),
|
|
3993
4291
|
[breakdown?.users]
|
|
3994
4292
|
);
|
|
3995
|
-
const amount = (value) => `${formatNumber(value, locale)} ${featureName(unit, value, locale)}`;
|
|
4293
|
+
const amount = (value) => `${formatAmount?.(value) ?? formatNumber(value, locale)} ${featureName(unit, value, locale)}`;
|
|
3996
4294
|
if (breakdown === void 0 && error !== void 0) {
|
|
3997
4295
|
return /* @__PURE__ */ jsxs2("div", { className: "schematic-usage-by-user", role: "alert", children: [
|
|
3998
4296
|
/* @__PURE__ */ jsx3("span", { className: "schematic-usage-by-user__title", children: t("usageByUserHeader") }),
|
|
@@ -4080,8 +4378,286 @@ function UserBreakdown({
|
|
|
4080
4378
|
] });
|
|
4081
4379
|
}
|
|
4082
4380
|
|
|
4083
|
-
// src/elements/
|
|
4381
|
+
// src/elements/CreditUsage.tsx
|
|
4084
4382
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4383
|
+
var VISIBLE_GRANT_COUNT = 3;
|
|
4384
|
+
var GRANT_KEY = {
|
|
4385
|
+
autoTopup: "creditUsageGrantAutoTopup",
|
|
4386
|
+
bundle: "creditUsageGrantBundle",
|
|
4387
|
+
plan: "creditUsageGrantPlan",
|
|
4388
|
+
promotional: "creditUsageGrantPromotional"
|
|
4389
|
+
};
|
|
4390
|
+
function CreditUsage({
|
|
4391
|
+
buyMoreTarget,
|
|
4392
|
+
buyMoreUrl,
|
|
4393
|
+
className,
|
|
4394
|
+
headingLevel = 2,
|
|
4395
|
+
locale: localeProp,
|
|
4396
|
+
onBuyMore,
|
|
4397
|
+
showDescription = true,
|
|
4398
|
+
showExpiration = true,
|
|
4399
|
+
showHeader = false,
|
|
4400
|
+
showIcon = true,
|
|
4401
|
+
showUsage = true,
|
|
4402
|
+
showUsageByUser = true,
|
|
4403
|
+
strings,
|
|
4404
|
+
visibleCredits
|
|
4405
|
+
}) {
|
|
4406
|
+
const { data: balances, error, isPending, refetch } = useCreditBalances();
|
|
4407
|
+
const locale = useResolvedLocale(localeProp);
|
|
4408
|
+
const t = useTranslator(strings, localeProp);
|
|
4409
|
+
const credits = useMemo2(
|
|
4410
|
+
() => balances === void 0 ? [] : deriveCreditUsage(balances, { locale, visibleCredits }),
|
|
4411
|
+
[balances, locale, visibleCredits]
|
|
4412
|
+
);
|
|
4413
|
+
const unavailable = balances === void 0 && httpStatus(error) === 404;
|
|
4414
|
+
const errorMessage = error === void 0 ? void 0 : unavailable ? t("creditUsageUnavailable") : t("creditUsageError");
|
|
4415
|
+
if (balances !== void 0 && error === void 0 && credits.length === 0) {
|
|
4416
|
+
return null;
|
|
4417
|
+
}
|
|
4418
|
+
const Heading = `h${headingLevel}`;
|
|
4419
|
+
const CreditHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
|
|
4420
|
+
return /* @__PURE__ */ jsxs3(
|
|
4421
|
+
StatusFrame,
|
|
4422
|
+
{
|
|
4423
|
+
className: cx("schematic-credit-usage", className),
|
|
4424
|
+
error,
|
|
4425
|
+
errorMessage,
|
|
4426
|
+
hasData: balances !== void 0,
|
|
4427
|
+
isPending,
|
|
4428
|
+
loadingLabel: t("creditUsageLoading"),
|
|
4429
|
+
onRetry: refetch,
|
|
4430
|
+
retryText: t("retry"),
|
|
4431
|
+
skeleton: /* @__PURE__ */ jsx4(CreditUsageSkeleton, { showHeader }),
|
|
4432
|
+
children: [
|
|
4433
|
+
showHeader && /* @__PURE__ */ jsx4("div", { className: "schematic-header", children: /* @__PURE__ */ jsx4(Heading, { className: "schematic-header__title", children: t("creditUsageHeader") }) }),
|
|
4434
|
+
/* @__PURE__ */ jsx4("div", { className: "schematic-credit-usage__credits", children: credits.map((credit) => /* @__PURE__ */ jsxs3(
|
|
4435
|
+
"section",
|
|
4436
|
+
{
|
|
4437
|
+
"aria-label": credit.name,
|
|
4438
|
+
className: "schematic-card schematic-credit-usage__credit",
|
|
4439
|
+
"data-testid": "schematic-credit",
|
|
4440
|
+
children: [
|
|
4441
|
+
/* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__main", children: [
|
|
4442
|
+
showIcon && /* @__PURE__ */ jsx4("span", { className: "schematic-credit-usage__icon", children: credit.icon !== null && /* @__PURE__ */ jsx4(
|
|
4443
|
+
"i",
|
|
4444
|
+
{
|
|
4445
|
+
"aria-hidden": "true",
|
|
4446
|
+
className: `schematic-icon schematic-icon--${credit.icon}`
|
|
4447
|
+
}
|
|
4448
|
+
) }),
|
|
4449
|
+
/* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__body", children: [
|
|
4450
|
+
/* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__title", children: [
|
|
4451
|
+
/* @__PURE__ */ jsx4(CreditHeading, { className: "schematic-credit-usage__name", children: credit.name }),
|
|
4452
|
+
showDescription && credit.description !== null && /* @__PURE__ */ jsx4("p", { className: "schematic-muted", children: credit.description })
|
|
4453
|
+
] }),
|
|
4454
|
+
/* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__balance", children: [
|
|
4455
|
+
showUsage && /* @__PURE__ */ jsx4(
|
|
4456
|
+
"span",
|
|
4457
|
+
{
|
|
4458
|
+
className: "schematic-credit-usage__remaining",
|
|
4459
|
+
"data-testid": "schematic-credit-remaining",
|
|
4460
|
+
children: t("creditUsageRemaining", credit.remaining)
|
|
4461
|
+
}
|
|
4462
|
+
),
|
|
4463
|
+
credit.purchasable && /* @__PURE__ */ jsx4(
|
|
4464
|
+
BuyMore,
|
|
4465
|
+
{
|
|
4466
|
+
credit,
|
|
4467
|
+
label: t("creditUsageBuyMore"),
|
|
4468
|
+
onBuyMore,
|
|
4469
|
+
target: buyMoreTarget,
|
|
4470
|
+
url: buyMoreUrl
|
|
4471
|
+
}
|
|
4472
|
+
)
|
|
4473
|
+
] }),
|
|
4474
|
+
credit.composition !== null && /* @__PURE__ */ jsx4("p", { className: "schematic-muted schematic-small schematic-credit-usage__composition", children: compositionText(credit, t) })
|
|
4475
|
+
] })
|
|
4476
|
+
] }),
|
|
4477
|
+
credit.ledger.length > 0 && /* @__PURE__ */ jsx4(
|
|
4478
|
+
Ledger,
|
|
4479
|
+
{
|
|
4480
|
+
credit,
|
|
4481
|
+
locale,
|
|
4482
|
+
showExpiration,
|
|
4483
|
+
t
|
|
4484
|
+
}
|
|
4485
|
+
),
|
|
4486
|
+
showUsageByUser && credit.ledger.length > 0 && /* @__PURE__ */ jsx4(CreditUserBreakdown, { credit, locale, t })
|
|
4487
|
+
]
|
|
4488
|
+
},
|
|
4489
|
+
credit.creditId
|
|
4490
|
+
)) })
|
|
4491
|
+
]
|
|
4492
|
+
}
|
|
4493
|
+
);
|
|
4494
|
+
}
|
|
4495
|
+
function compositionText(credit, t) {
|
|
4496
|
+
const composition = credit.composition;
|
|
4497
|
+
if (composition === null) {
|
|
4498
|
+
return "";
|
|
4499
|
+
}
|
|
4500
|
+
const vars = {
|
|
4501
|
+
creditName: composition.creditName,
|
|
4502
|
+
perLicense: t("creditUsagePerLicense", composition.perLicense),
|
|
4503
|
+
period: shortPeriod(composition.period, t) ?? composition.period,
|
|
4504
|
+
total: composition.total
|
|
4505
|
+
};
|
|
4506
|
+
const sentence = composition.companyGrant === null ? t("creditUsageComposition", vars) : t("creditUsageCompositionWithGrant", {
|
|
4507
|
+
...vars,
|
|
4508
|
+
companyGrant: t("creditUsageCompanyGrant", {
|
|
4509
|
+
amount: composition.companyGrant
|
|
4510
|
+
})
|
|
4511
|
+
});
|
|
4512
|
+
return composition.renewsOn === null ? sentence : `${sentence} ${t("creditUsageRenewsOn", { day: composition.renewsOn })}`;
|
|
4513
|
+
}
|
|
4514
|
+
function Ledger({
|
|
4515
|
+
credit,
|
|
4516
|
+
locale,
|
|
4517
|
+
showExpiration,
|
|
4518
|
+
t
|
|
4519
|
+
}) {
|
|
4520
|
+
const [open, setOpen] = useState2(false);
|
|
4521
|
+
const [all, setAll] = useState2(false);
|
|
4522
|
+
const rows = all ? credit.ledger : credit.ledger.slice(0, VISIBLE_GRANT_COUNT);
|
|
4523
|
+
return /* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__ledger", children: [
|
|
4524
|
+
open && /* @__PURE__ */ jsxs3("div", { className: "schematic-credit-usage__grants", children: [
|
|
4525
|
+
/* @__PURE__ */ jsx4("ul", { className: "schematic-credit-usage__grant-list", children: rows.map((row) => /* @__PURE__ */ jsxs3(
|
|
4526
|
+
"li",
|
|
4527
|
+
{
|
|
4528
|
+
className: "schematic-credit-usage__grant",
|
|
4529
|
+
"data-testid": "schematic-credit-grant",
|
|
4530
|
+
children: [
|
|
4531
|
+
/* @__PURE__ */ jsx4("span", { className: "schematic-credit-usage__grant-text", children: t(GRANT_KEY[row.kind], {
|
|
4532
|
+
amount: row.amount,
|
|
4533
|
+
createdAt: row.createdAt,
|
|
4534
|
+
item: row.item
|
|
4535
|
+
}) }),
|
|
4536
|
+
showExpiration && row.date !== null && /* @__PURE__ */ jsx4("span", { className: "schematic-credit-usage__grant-date", children: row.date.kind === "resets" ? t("creditUsageResets", { date: row.date.text }) : t("creditUsageExpires", { date: row.date.text }) })
|
|
4537
|
+
]
|
|
4538
|
+
},
|
|
4539
|
+
row.id
|
|
4540
|
+
)) }),
|
|
4541
|
+
credit.ledger.length > VISIBLE_GRANT_COUNT && /* @__PURE__ */ jsxs3(
|
|
4542
|
+
"button",
|
|
4543
|
+
{
|
|
4544
|
+
"aria-expanded": all,
|
|
4545
|
+
className: "schematic-link-button schematic-credit-usage__see-all",
|
|
4546
|
+
type: "button",
|
|
4547
|
+
onClick: () => setAll((value) => !value),
|
|
4548
|
+
children: [
|
|
4549
|
+
/* @__PURE__ */ jsx4(
|
|
4550
|
+
"i",
|
|
4551
|
+
{
|
|
4552
|
+
"aria-hidden": "true",
|
|
4553
|
+
className: `schematic-icon schematic-icon--${all ? "chevron-up" : "chevron-down"} schematic-chevron`
|
|
4554
|
+
}
|
|
4555
|
+
),
|
|
4556
|
+
/* @__PURE__ */ jsx4("span", { className: "schematic-link-button__label", children: all ? t("creditUsageHideAll") : t("creditUsageSeeAll", {
|
|
4557
|
+
total: formatNumber(credit.ledger.length, locale)
|
|
4558
|
+
}) })
|
|
4559
|
+
]
|
|
4560
|
+
}
|
|
4561
|
+
)
|
|
4562
|
+
] }),
|
|
4563
|
+
/* @__PURE__ */ jsxs3(
|
|
4564
|
+
"button",
|
|
4565
|
+
{
|
|
4566
|
+
"aria-expanded": open,
|
|
4567
|
+
className: "schematic-link-button schematic-credit-usage__details",
|
|
4568
|
+
type: "button",
|
|
4569
|
+
onClick: () => {
|
|
4570
|
+
setOpen((value) => !value);
|
|
4571
|
+
setAll(false);
|
|
4572
|
+
},
|
|
4573
|
+
children: [
|
|
4574
|
+
/* @__PURE__ */ jsx4(
|
|
4575
|
+
"i",
|
|
4576
|
+
{
|
|
4577
|
+
"aria-hidden": "true",
|
|
4578
|
+
className: `schematic-icon schematic-icon--${open ? "chevron-up" : "chevron-down"} schematic-chevron`
|
|
4579
|
+
}
|
|
4580
|
+
),
|
|
4581
|
+
/* @__PURE__ */ jsx4("span", { className: "schematic-link-button__label", children: open ? t("creditUsageHideDetails") : t("creditUsageSeeDetails") })
|
|
4582
|
+
]
|
|
4583
|
+
}
|
|
4584
|
+
)
|
|
4585
|
+
] });
|
|
4586
|
+
}
|
|
4587
|
+
function BuyMore({
|
|
4588
|
+
credit,
|
|
4589
|
+
label,
|
|
4590
|
+
onBuyMore,
|
|
4591
|
+
target,
|
|
4592
|
+
url
|
|
4593
|
+
}) {
|
|
4594
|
+
if (onBuyMore !== void 0) {
|
|
4595
|
+
return /* @__PURE__ */ jsx4(
|
|
4596
|
+
"button",
|
|
4597
|
+
{
|
|
4598
|
+
className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
|
|
4599
|
+
type: "button",
|
|
4600
|
+
onClick: () => onBuyMore(credit.source),
|
|
4601
|
+
children: label
|
|
4602
|
+
}
|
|
4603
|
+
);
|
|
4604
|
+
}
|
|
4605
|
+
if (url !== void 0) {
|
|
4606
|
+
return /* @__PURE__ */ jsx4(
|
|
4607
|
+
"a",
|
|
4608
|
+
{
|
|
4609
|
+
className: "schematic-cta schematic-cta--small schematic-credit-usage__buy-more",
|
|
4610
|
+
href: url,
|
|
4611
|
+
target,
|
|
4612
|
+
children: label
|
|
4613
|
+
}
|
|
4614
|
+
);
|
|
4615
|
+
}
|
|
4616
|
+
return null;
|
|
4617
|
+
}
|
|
4618
|
+
function CreditUserBreakdown({
|
|
4619
|
+
credit,
|
|
4620
|
+
locale,
|
|
4621
|
+
t
|
|
4622
|
+
}) {
|
|
4623
|
+
const { data, error, refetch } = useCreditUserUsage(credit.creditId);
|
|
4624
|
+
return /* @__PURE__ */ jsx4(
|
|
4625
|
+
UserBreakdown,
|
|
4626
|
+
{
|
|
4627
|
+
breakdown: data === void 0 ? void 0 : {
|
|
4628
|
+
count: data.count,
|
|
4629
|
+
total: data.total,
|
|
4630
|
+
unattributed: data.unattributed ?? null,
|
|
4631
|
+
users: data.users.map((user) => ({
|
|
4632
|
+
amount: user.used,
|
|
4633
|
+
id: user.userId,
|
|
4634
|
+
label: user.name ?? user.userId
|
|
4635
|
+
}))
|
|
4636
|
+
},
|
|
4637
|
+
error,
|
|
4638
|
+
formatAmount: (value) => formatCredits(value, locale),
|
|
4639
|
+
locale,
|
|
4640
|
+
onRetry: refetch,
|
|
4641
|
+
t,
|
|
4642
|
+
unit: credit.unit
|
|
4643
|
+
}
|
|
4644
|
+
);
|
|
4645
|
+
}
|
|
4646
|
+
function CreditUsageSkeleton({ showHeader }) {
|
|
4647
|
+
return /* @__PURE__ */ jsxs3("div", { className: "schematic-skeleton", children: [
|
|
4648
|
+
showHeader && /* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__heading" }),
|
|
4649
|
+
[0, 1].map((index) => /* @__PURE__ */ jsxs3("div", { className: "schematic-skeleton__row", children: [
|
|
4650
|
+
/* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
|
|
4651
|
+
/* @__PURE__ */ jsx4("div", { className: "schematic-skeleton__cell", "data-column": "remaining" })
|
|
4652
|
+
] }, index))
|
|
4653
|
+
] });
|
|
4654
|
+
}
|
|
4655
|
+
CreditUsage.resources = ["creditBalances"];
|
|
4656
|
+
|
|
4657
|
+
// src/elements/IncludedFeatures.tsx
|
|
4658
|
+
import { useFeatureUsage } from "@schematichq/schematic-react";
|
|
4659
|
+
import { useMemo as useMemo3, useState as useState3 } from "react";
|
|
4660
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
4085
4661
|
var VISIBLE_FEATURE_COUNT = 4;
|
|
4086
4662
|
function IncludedFeatures({
|
|
4087
4663
|
className,
|
|
@@ -4102,8 +4678,8 @@ function IncludedFeatures({
|
|
|
4102
4678
|
const { data: features, error, isPending, refetch } = useFeatureUsage();
|
|
4103
4679
|
const locale = useResolvedLocale(localeProp);
|
|
4104
4680
|
const t = useTranslator(strings, localeProp);
|
|
4105
|
-
const [expanded, setExpanded] =
|
|
4106
|
-
const rows =
|
|
4681
|
+
const [expanded, setExpanded] = useState3(false);
|
|
4682
|
+
const rows = useMemo3(
|
|
4107
4683
|
() => features === void 0 ? [] : deriveIncludedFeatures(features, {
|
|
4108
4684
|
locale,
|
|
4109
4685
|
showCredits,
|
|
@@ -4123,7 +4699,7 @@ function IncludedFeatures({
|
|
|
4123
4699
|
const shown = canExpand && !expanded ? rows.slice(0, VISIBLE_FEATURE_COUNT) : rows;
|
|
4124
4700
|
const unavailable = features === void 0 && httpStatus(error) === 404;
|
|
4125
4701
|
const errorMessage = error === void 0 ? void 0 : unavailable ? t("includedFeaturesUnavailable") : t("includedFeaturesError");
|
|
4126
|
-
return /* @__PURE__ */
|
|
4702
|
+
return /* @__PURE__ */ jsxs4(
|
|
4127
4703
|
StatusFrame,
|
|
4128
4704
|
{
|
|
4129
4705
|
className: cx("schematic-card", "schematic-included-features", className),
|
|
@@ -4134,26 +4710,26 @@ function IncludedFeatures({
|
|
|
4134
4710
|
loadingLabel: t("includedFeaturesLoading"),
|
|
4135
4711
|
onRetry: refetch,
|
|
4136
4712
|
retryText: t("retry"),
|
|
4137
|
-
skeleton: /* @__PURE__ */
|
|
4713
|
+
skeleton: /* @__PURE__ */ jsx5(IncludedFeaturesSkeleton, { showHeader }),
|
|
4138
4714
|
children: [
|
|
4139
|
-
showHeader && /* @__PURE__ */
|
|
4140
|
-
/* @__PURE__ */
|
|
4715
|
+
showHeader && /* @__PURE__ */ jsx5("div", { className: "schematic-header", children: /* @__PURE__ */ jsx5(Heading, { className: "schematic-header__title", children: t("includedFeaturesHeader") }) }),
|
|
4716
|
+
/* @__PURE__ */ jsx5("ul", { className: "schematic-included-features__list", children: shown.map((row) => /* @__PURE__ */ jsxs4(
|
|
4141
4717
|
"li",
|
|
4142
4718
|
{
|
|
4143
4719
|
className: "schematic-included-features__row",
|
|
4144
4720
|
"data-testid": "schematic-included-feature",
|
|
4145
4721
|
children: [
|
|
4146
|
-
showIcon && row.icon !== null && /* @__PURE__ */
|
|
4722
|
+
showIcon && row.icon !== null && /* @__PURE__ */ jsx5(
|
|
4147
4723
|
"i",
|
|
4148
4724
|
{
|
|
4149
4725
|
"aria-hidden": "true",
|
|
4150
4726
|
className: `schematic-icon schematic-icon--${row.icon} schematic-included-features__icon`
|
|
4151
4727
|
}
|
|
4152
4728
|
),
|
|
4153
|
-
/* @__PURE__ */
|
|
4154
|
-
/* @__PURE__ */
|
|
4155
|
-
showDescription && row.description !== null && /* @__PURE__ */
|
|
4156
|
-
row.perLicenseCredits.map((credits, index) => /* @__PURE__ */
|
|
4729
|
+
/* @__PURE__ */ jsxs4("div", { className: "schematic-included-features__details", children: [
|
|
4730
|
+
/* @__PURE__ */ jsx5("span", { className: "schematic-included-features__name", children: row.name }),
|
|
4731
|
+
showDescription && row.description !== null && /* @__PURE__ */ jsx5("span", { className: "schematic-muted schematic-small", children: row.description }),
|
|
4732
|
+
row.perLicenseCredits.map((credits, index) => /* @__PURE__ */ jsx5(
|
|
4157
4733
|
"span",
|
|
4158
4734
|
{
|
|
4159
4735
|
className: "schematic-muted schematic-small",
|
|
@@ -4165,9 +4741,9 @@ function IncludedFeatures({
|
|
|
4165
4741
|
},
|
|
4166
4742
|
`${credits.creditName}-${index}`
|
|
4167
4743
|
)),
|
|
4168
|
-
showExpiration && row.expiresAt !== null && /* @__PURE__ */
|
|
4744
|
+
showExpiration && row.expiresAt !== null && /* @__PURE__ */ jsx5("em", { className: "schematic-muted schematic-small", children: t("includedFeaturesExpires", { date: row.expiresAt.text }) })
|
|
4169
4745
|
] }),
|
|
4170
|
-
/* @__PURE__ */
|
|
4746
|
+
/* @__PURE__ */ jsx5(
|
|
4171
4747
|
UsageDetails,
|
|
4172
4748
|
{
|
|
4173
4749
|
row,
|
|
@@ -4182,7 +4758,7 @@ function IncludedFeatures({
|
|
|
4182
4758
|
},
|
|
4183
4759
|
row.featureId
|
|
4184
4760
|
)) }),
|
|
4185
|
-
canExpand && /* @__PURE__ */
|
|
4761
|
+
canExpand && /* @__PURE__ */ jsxs4(
|
|
4186
4762
|
"button",
|
|
4187
4763
|
{
|
|
4188
4764
|
"aria-expanded": expanded,
|
|
@@ -4190,14 +4766,14 @@ function IncludedFeatures({
|
|
|
4190
4766
|
type: "button",
|
|
4191
4767
|
onClick: () => setExpanded((value) => !value),
|
|
4192
4768
|
children: [
|
|
4193
|
-
/* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ jsx5(
|
|
4194
4770
|
"i",
|
|
4195
4771
|
{
|
|
4196
4772
|
"aria-hidden": "true",
|
|
4197
4773
|
className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
|
|
4198
4774
|
}
|
|
4199
4775
|
),
|
|
4200
|
-
/* @__PURE__ */
|
|
4776
|
+
/* @__PURE__ */ jsx5("span", { className: "schematic-link-button__label", children: expanded ? t("includedFeaturesHideAll") : t("includedFeaturesSeeAll") })
|
|
4201
4777
|
]
|
|
4202
4778
|
}
|
|
4203
4779
|
)
|
|
@@ -4217,17 +4793,17 @@ function UsageDetails({
|
|
|
4217
4793
|
if (row.entitlement === null && usage === null) {
|
|
4218
4794
|
return null;
|
|
4219
4795
|
}
|
|
4220
|
-
return /* @__PURE__ */
|
|
4221
|
-
showEntitlement && row.entitlement !== null && /* @__PURE__ */
|
|
4796
|
+
return /* @__PURE__ */ jsxs4("div", { className: "schematic-included-features__usage", children: [
|
|
4797
|
+
showEntitlement && row.entitlement !== null && /* @__PURE__ */ jsxs4("span", { className: "schematic-included-features__entitlement", children: [
|
|
4222
4798
|
entitlementText2(row.entitlement, t),
|
|
4223
|
-
showHardLimit && row.hardLimit !== null && /* @__PURE__ */
|
|
4799
|
+
showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx5(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
|
|
4224
4800
|
amount: row.hardLimit.amount,
|
|
4225
4801
|
units: row.hardLimit.units
|
|
4226
4802
|
}) })
|
|
4227
4803
|
] }),
|
|
4228
|
-
showUsage && usage !== null && /* @__PURE__ */
|
|
4804
|
+
showUsage && usage !== null && /* @__PURE__ */ jsxs4("span", { className: "schematic-muted schematic-small schematic-included-features__used", children: [
|
|
4229
4805
|
usage,
|
|
4230
|
-
row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */
|
|
4806
|
+
row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ jsx5(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx5(
|
|
4231
4807
|
PriceTiers,
|
|
4232
4808
|
{
|
|
4233
4809
|
currency: row.tiers.currency,
|
|
@@ -4280,7 +4856,7 @@ function segmentText(segment, t) {
|
|
|
4280
4856
|
switch (segment.kind) {
|
|
4281
4857
|
case "unitPricePerPeriod": {
|
|
4282
4858
|
const period = shortPeriod(segment.period, t) ?? segment.period;
|
|
4283
|
-
return segment.size
|
|
4859
|
+
return segment.size !== null ? t("usagePackagePricePerPeriod", {
|
|
4284
4860
|
cost: segment.cost,
|
|
4285
4861
|
size: segment.size,
|
|
4286
4862
|
units: segment.units,
|
|
@@ -4302,11 +4878,11 @@ function segmentText(segment, t) {
|
|
|
4302
4878
|
}
|
|
4303
4879
|
}
|
|
4304
4880
|
function IncludedFeaturesSkeleton({ showHeader }) {
|
|
4305
|
-
return /* @__PURE__ */
|
|
4306
|
-
showHeader && /* @__PURE__ */
|
|
4307
|
-
[0, 1, 2].map((index) => /* @__PURE__ */
|
|
4308
|
-
/* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
4881
|
+
return /* @__PURE__ */ jsxs4("div", { className: "schematic-skeleton", children: [
|
|
4882
|
+
showHeader && /* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__heading" }),
|
|
4883
|
+
[0, 1, 2].map((index) => /* @__PURE__ */ jsxs4("div", { className: "schematic-skeleton__row", children: [
|
|
4884
|
+
/* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
|
|
4885
|
+
/* @__PURE__ */ jsx5("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
|
|
4310
4886
|
] }, index))
|
|
4311
4887
|
] });
|
|
4312
4888
|
}
|
|
@@ -4314,8 +4890,8 @@ IncludedFeatures.resources = ["featureUsage"];
|
|
|
4314
4890
|
|
|
4315
4891
|
// src/elements/Invoices.tsx
|
|
4316
4892
|
import { useInvoices } from "@schematichq/schematic-react";
|
|
4317
|
-
import { useId as useId2, useMemo as
|
|
4318
|
-
import { Fragment as Fragment2, jsx as
|
|
4893
|
+
import { useId as useId2, useMemo as useMemo4, useState as useState4 } from "react";
|
|
4894
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
4319
4895
|
var SKELETON_ROWS = 4;
|
|
4320
4896
|
function Invoices({
|
|
4321
4897
|
className,
|
|
@@ -4338,8 +4914,8 @@ function Invoices({
|
|
|
4338
4914
|
} = useInvoices(query);
|
|
4339
4915
|
const locale = useResolvedLocale(localeProp);
|
|
4340
4916
|
const t = useTranslator(strings, localeProp);
|
|
4341
|
-
const [expanded, setExpanded] =
|
|
4342
|
-
const list =
|
|
4917
|
+
const [expanded, setExpanded] = useState4(false);
|
|
4918
|
+
const list = useMemo4(
|
|
4343
4919
|
() => page === void 0 ? void 0 : deriveInvoiceList(page, { locale }),
|
|
4344
4920
|
[locale, page]
|
|
4345
4921
|
);
|
|
@@ -4355,7 +4931,7 @@ function Invoices({
|
|
|
4355
4931
|
);
|
|
4356
4932
|
const unavailable = list === void 0 && httpStatus(error) === 404;
|
|
4357
4933
|
const errorMessage = error === void 0 ? void 0 : unavailable ? t("invoicesUnavailable") : t("invoicesError");
|
|
4358
|
-
return /* @__PURE__ */
|
|
4934
|
+
return /* @__PURE__ */ jsx6(
|
|
4359
4935
|
StatusFrame,
|
|
4360
4936
|
{
|
|
4361
4937
|
className: cx("schematic-card", "schematic-invoices", className),
|
|
@@ -4366,7 +4942,7 @@ function Invoices({
|
|
|
4366
4942
|
loadingLabel: t("invoicesLoading"),
|
|
4367
4943
|
onRetry: refetch,
|
|
4368
4944
|
retryText: t("retry"),
|
|
4369
|
-
skeleton: /* @__PURE__ */
|
|
4945
|
+
skeleton: /* @__PURE__ */ jsx6(
|
|
4370
4946
|
InvoicesSkeleton,
|
|
4371
4947
|
{
|
|
4372
4948
|
columns,
|
|
@@ -4374,22 +4950,22 @@ function Invoices({
|
|
|
4374
4950
|
showHeader
|
|
4375
4951
|
}
|
|
4376
4952
|
),
|
|
4377
|
-
children: list !== void 0 && /* @__PURE__ */
|
|
4378
|
-
showHeader && /* @__PURE__ */
|
|
4379
|
-
rows.length === 0 ? /* @__PURE__ */
|
|
4953
|
+
children: list !== void 0 && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
4954
|
+
showHeader && /* @__PURE__ */ jsx6("div", { className: "schematic-header", children: /* @__PURE__ */ jsx6(Heading, { className: "schematic-header__title", id: headingId, children: t("invoicesHeader") }) }),
|
|
4955
|
+
rows.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "schematic-muted schematic-invoices__empty", children: t("invoicesEmpty") }) : /* @__PURE__ */ jsx6(
|
|
4380
4956
|
"ul",
|
|
4381
4957
|
{
|
|
4382
4958
|
className: "schematic-invoices__list",
|
|
4383
4959
|
"aria-label": showHeader ? void 0 : t("invoicesHeader"),
|
|
4384
4960
|
"aria-labelledby": showHeader ? headingId : void 0,
|
|
4385
|
-
children: visible.map((row) => /* @__PURE__ */
|
|
4961
|
+
children: visible.map((row) => /* @__PURE__ */ jsxs5(
|
|
4386
4962
|
"li",
|
|
4387
4963
|
{
|
|
4388
4964
|
className: "schematic-invoices__row",
|
|
4389
4965
|
"data-testid": "schematic-invoice",
|
|
4390
4966
|
children: [
|
|
4391
|
-
showDate && /* @__PURE__ */
|
|
4392
|
-
showAmount && /* @__PURE__ */
|
|
4967
|
+
showDate && /* @__PURE__ */ jsx6("span", { className: "schematic-invoices__date", children: /* @__PURE__ */ jsx6(InvoiceDate, { row, t }) }),
|
|
4968
|
+
showAmount && /* @__PURE__ */ jsx6(
|
|
4393
4969
|
"span",
|
|
4394
4970
|
{
|
|
4395
4971
|
className: cx(
|
|
@@ -4406,8 +4982,8 @@ function Invoices({
|
|
|
4406
4982
|
))
|
|
4407
4983
|
}
|
|
4408
4984
|
),
|
|
4409
|
-
(canCollapse || showingAll && list.hasMore) && /* @__PURE__ */
|
|
4410
|
-
canCollapse && /* @__PURE__ */
|
|
4985
|
+
(canCollapse || showingAll && list.hasMore) && /* @__PURE__ */ jsxs5("div", { className: "schematic-invoices__actions", children: [
|
|
4986
|
+
canCollapse && /* @__PURE__ */ jsxs5(
|
|
4411
4987
|
"button",
|
|
4412
4988
|
{
|
|
4413
4989
|
"aria-expanded": expanded,
|
|
@@ -4415,7 +4991,7 @@ function Invoices({
|
|
|
4415
4991
|
type: "button",
|
|
4416
4992
|
onClick: () => setExpanded((value) => !value),
|
|
4417
4993
|
children: [
|
|
4418
|
-
/* @__PURE__ */
|
|
4994
|
+
/* @__PURE__ */ jsx6(
|
|
4419
4995
|
"i",
|
|
4420
4996
|
{
|
|
4421
4997
|
"aria-hidden": "true",
|
|
@@ -4427,11 +5003,11 @@ function Invoices({
|
|
|
4427
5003
|
)
|
|
4428
5004
|
}
|
|
4429
5005
|
),
|
|
4430
|
-
/* @__PURE__ */
|
|
5006
|
+
/* @__PURE__ */ jsx6("span", { className: "schematic-link-button__label", children: expanded ? t("invoicesSeeLess") : t("invoicesSeeMore") })
|
|
4431
5007
|
]
|
|
4432
5008
|
}
|
|
4433
5009
|
),
|
|
4434
|
-
showingAll && list.hasMore && /* @__PURE__ */
|
|
5010
|
+
showingAll && list.hasMore && /* @__PURE__ */ jsx6(
|
|
4435
5011
|
"button",
|
|
4436
5012
|
{
|
|
4437
5013
|
className: "schematic-link-button schematic-invoices__load-more",
|
|
@@ -4454,9 +5030,9 @@ function InvoicesSkeleton({
|
|
|
4454
5030
|
rows,
|
|
4455
5031
|
showHeader
|
|
4456
5032
|
}) {
|
|
4457
|
-
return /* @__PURE__ */
|
|
4458
|
-
showHeader && /* @__PURE__ */
|
|
4459
|
-
Array.from({ length: rows }, (_, row) => /* @__PURE__ */
|
|
5033
|
+
return /* @__PURE__ */ jsxs5("div", { className: "schematic-skeleton", children: [
|
|
5034
|
+
showHeader && /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__heading" }),
|
|
5035
|
+
Array.from({ length: rows }, (_, row) => /* @__PURE__ */ jsx6("div", { className: "schematic-skeleton__row", children: columns.map((column) => /* @__PURE__ */ jsx6(
|
|
4460
5036
|
"div",
|
|
4461
5037
|
{
|
|
4462
5038
|
className: "schematic-skeleton__cell",
|
|
@@ -4468,10 +5044,10 @@ function InvoicesSkeleton({
|
|
|
4468
5044
|
}
|
|
4469
5045
|
function InvoiceDate({ row, t }) {
|
|
4470
5046
|
if (row.url === null) {
|
|
4471
|
-
return /* @__PURE__ */
|
|
5047
|
+
return /* @__PURE__ */ jsx6("span", { className: "schematic-invoices__date-text", children: row.dateText });
|
|
4472
5048
|
}
|
|
4473
5049
|
const label = row.dateText === "" ? t("invoicesUndated") : row.dateText;
|
|
4474
|
-
return /* @__PURE__ */
|
|
5050
|
+
return /* @__PURE__ */ jsx6(
|
|
4475
5051
|
"a",
|
|
4476
5052
|
{
|
|
4477
5053
|
className: "schematic-invoices__link",
|
|
@@ -4489,8 +5065,8 @@ import {
|
|
|
4489
5065
|
useFeatureUsage as useFeatureUsage2,
|
|
4490
5066
|
useFeatureUserUsage
|
|
4491
5067
|
} from "@schematichq/schematic-react";
|
|
4492
|
-
import { useMemo as
|
|
4493
|
-
import { jsx as
|
|
5068
|
+
import { useMemo as useMemo5 } from "react";
|
|
5069
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
4494
5070
|
function MeteredFeatures({
|
|
4495
5071
|
addMoreTarget,
|
|
4496
5072
|
addMoreUrl,
|
|
@@ -4514,7 +5090,7 @@ function MeteredFeatures({
|
|
|
4514
5090
|
const { data: features, error, isPending, refetch } = useFeatureUsage2();
|
|
4515
5091
|
const locale = useResolvedLocale(localeProp);
|
|
4516
5092
|
const t = useTranslator(strings, localeProp);
|
|
4517
|
-
const rows =
|
|
5093
|
+
const rows = useMemo5(
|
|
4518
5094
|
() => features === void 0 ? [] : deriveMeteredFeatures(features, {
|
|
4519
5095
|
locale,
|
|
4520
5096
|
showCredits,
|
|
@@ -4536,7 +5112,7 @@ function MeteredFeatures({
|
|
|
4536
5112
|
}
|
|
4537
5113
|
const Heading = `h${headingLevel}`;
|
|
4538
5114
|
const NameHeading = showHeader ? `h${Math.min(6, headingLevel + 1)}` : Heading;
|
|
4539
|
-
return /* @__PURE__ */
|
|
5115
|
+
return /* @__PURE__ */ jsxs6(
|
|
4540
5116
|
StatusFrame,
|
|
4541
5117
|
{
|
|
4542
5118
|
className: cx("schematic-metered-features", className),
|
|
@@ -4547,32 +5123,32 @@ function MeteredFeatures({
|
|
|
4547
5123
|
loadingLabel: t("meteredFeaturesLoading"),
|
|
4548
5124
|
onRetry: refetch,
|
|
4549
5125
|
retryText: t("retry"),
|
|
4550
|
-
skeleton: /* @__PURE__ */
|
|
5126
|
+
skeleton: /* @__PURE__ */ jsx7(MeteredFeaturesSkeleton, { showHeader }),
|
|
4551
5127
|
children: [
|
|
4552
|
-
showHeader && /* @__PURE__ */
|
|
4553
|
-
/* @__PURE__ */
|
|
5128
|
+
showHeader && /* @__PURE__ */ jsx7("div", { className: "schematic-header", children: /* @__PURE__ */ jsx7(Heading, { className: "schematic-header__title", children: t("meteredFeaturesHeader") }) }),
|
|
5129
|
+
/* @__PURE__ */ jsx7("ul", { className: "schematic-metered-features__list", children: rows.map((row) => /* @__PURE__ */ jsxs6(
|
|
4554
5130
|
"li",
|
|
4555
5131
|
{
|
|
4556
5132
|
className: "schematic-card schematic-metered-features__feature",
|
|
4557
5133
|
"data-testid": "schematic-metered-feature",
|
|
4558
5134
|
children: [
|
|
4559
|
-
/* @__PURE__ */
|
|
4560
|
-
showIcon && /* @__PURE__ */
|
|
5135
|
+
/* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__main", children: [
|
|
5136
|
+
showIcon && /* @__PURE__ */ jsx7("span", { className: "schematic-metered-features__icon", children: row.icon !== null && /* @__PURE__ */ jsx7(
|
|
4561
5137
|
"i",
|
|
4562
5138
|
{
|
|
4563
5139
|
"aria-hidden": "true",
|
|
4564
5140
|
className: `schematic-icon schematic-icon--${row.icon}`
|
|
4565
5141
|
}
|
|
4566
5142
|
) }),
|
|
4567
|
-
/* @__PURE__ */
|
|
4568
|
-
/* @__PURE__ */
|
|
4569
|
-
/* @__PURE__ */
|
|
4570
|
-
/* @__PURE__ */
|
|
4571
|
-
showDescription && row.description !== null && /* @__PURE__ */
|
|
5143
|
+
/* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__body", children: [
|
|
5144
|
+
/* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__top", children: [
|
|
5145
|
+
/* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__title", children: [
|
|
5146
|
+
/* @__PURE__ */ jsx7(NameHeading, { className: "schematic-metered-features__name", children: row.name }),
|
|
5147
|
+
showDescription && row.description !== null && /* @__PURE__ */ jsx7("p", { className: "schematic-muted", children: row.description })
|
|
4572
5148
|
] }),
|
|
4573
|
-
/* @__PURE__ */
|
|
4574
|
-
showUsage && row.headline !== null && /* @__PURE__ */
|
|
4575
|
-
showAllocation && /* @__PURE__ */
|
|
5149
|
+
/* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__figures", children: [
|
|
5150
|
+
showUsage && row.headline !== null && /* @__PURE__ */ jsx7("span", { className: "schematic-metered-features__headline", children: headlineText(row.headline, t) }),
|
|
5151
|
+
showAllocation && /* @__PURE__ */ jsx7(
|
|
4576
5152
|
LimitLine,
|
|
4577
5153
|
{
|
|
4578
5154
|
row,
|
|
@@ -4582,8 +5158,8 @@ function MeteredFeatures({
|
|
|
4582
5158
|
)
|
|
4583
5159
|
] })
|
|
4584
5160
|
] }),
|
|
4585
|
-
showMeter && row.meter !== null && /* @__PURE__ */
|
|
4586
|
-
row.canAddMore && /* @__PURE__ */
|
|
5161
|
+
showMeter && row.meter !== null && /* @__PURE__ */ jsx7(Meter, { meter: row.meter }),
|
|
5162
|
+
row.canAddMore && /* @__PURE__ */ jsx7(
|
|
4587
5163
|
AddMore,
|
|
4588
5164
|
{
|
|
4589
5165
|
label: t("meteredFeaturesAddMore"),
|
|
@@ -4594,8 +5170,8 @@ function MeteredFeatures({
|
|
|
4594
5170
|
)
|
|
4595
5171
|
] })
|
|
4596
5172
|
] }),
|
|
4597
|
-
showUsageByUser && row.hasUsageByUser && /* @__PURE__ */
|
|
4598
|
-
row.priceDetails !== null && /* @__PURE__ */
|
|
5173
|
+
showUsageByUser && row.hasUsageByUser && /* @__PURE__ */ jsx7(UsageByUser, { locale, row, t }),
|
|
5174
|
+
row.priceDetails !== null && /* @__PURE__ */ jsx7(
|
|
4599
5175
|
PriceDetails,
|
|
4600
5176
|
{
|
|
4601
5177
|
details: row.priceDetails,
|
|
@@ -4659,9 +5235,9 @@ function LimitLine({
|
|
|
4659
5235
|
if (parts.length === 0) {
|
|
4660
5236
|
return null;
|
|
4661
5237
|
}
|
|
4662
|
-
return /* @__PURE__ */
|
|
5238
|
+
return /* @__PURE__ */ jsxs6("span", { className: "schematic-muted schematic-metered-features__limit", children: [
|
|
4663
5239
|
parts.join(" \u2022 "),
|
|
4664
|
-
showHardLimit && row.hardLimit !== null && /* @__PURE__ */
|
|
5240
|
+
showHardLimit && row.hardLimit !== null && /* @__PURE__ */ jsx7(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
|
|
4665
5241
|
amount: row.hardLimit.amount,
|
|
4666
5242
|
units: row.hardLimit.units
|
|
4667
5243
|
}) })
|
|
@@ -4675,8 +5251,8 @@ var METER_TONE_CLASS = {
|
|
|
4675
5251
|
overage: "schematic-meter--overage"
|
|
4676
5252
|
};
|
|
4677
5253
|
function Meter({ meter: meter2 }) {
|
|
4678
|
-
return /* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
5254
|
+
return /* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__meter", children: [
|
|
5255
|
+
/* @__PURE__ */ jsx7(
|
|
4680
5256
|
"div",
|
|
4681
5257
|
{
|
|
4682
5258
|
"aria-valuemax": meter2.total,
|
|
@@ -4685,7 +5261,7 @@ function Meter({ meter: meter2 }) {
|
|
|
4685
5261
|
className: cx("schematic-meter", METER_TONE_CLASS[meter2.tone]),
|
|
4686
5262
|
"data-tone": meter2.tone,
|
|
4687
5263
|
role: "meter",
|
|
4688
|
-
children: /* @__PURE__ */
|
|
5264
|
+
children: /* @__PURE__ */ jsx7(
|
|
4689
5265
|
"div",
|
|
4690
5266
|
{
|
|
4691
5267
|
className: "schematic-meter__fill",
|
|
@@ -4694,7 +5270,7 @@ function Meter({ meter: meter2 }) {
|
|
|
4694
5270
|
)
|
|
4695
5271
|
}
|
|
4696
5272
|
),
|
|
4697
|
-
meter2.total > 0 && /* @__PURE__ */
|
|
5273
|
+
meter2.total > 0 && /* @__PURE__ */ jsxs6("span", { className: "schematic-metered-features__meter-label", children: [
|
|
4698
5274
|
meter2.valueText,
|
|
4699
5275
|
"/",
|
|
4700
5276
|
meter2.totalText
|
|
@@ -4708,7 +5284,7 @@ function AddMore({
|
|
|
4708
5284
|
url
|
|
4709
5285
|
}) {
|
|
4710
5286
|
if (onAddMore !== void 0) {
|
|
4711
|
-
return /* @__PURE__ */
|
|
5287
|
+
return /* @__PURE__ */ jsx7(
|
|
4712
5288
|
"button",
|
|
4713
5289
|
{
|
|
4714
5290
|
className: "schematic-cta schematic-metered-features__add-more",
|
|
@@ -4719,7 +5295,7 @@ function AddMore({
|
|
|
4719
5295
|
);
|
|
4720
5296
|
}
|
|
4721
5297
|
if (url !== void 0) {
|
|
4722
|
-
return /* @__PURE__ */
|
|
5298
|
+
return /* @__PURE__ */ jsx7(
|
|
4723
5299
|
"a",
|
|
4724
5300
|
{
|
|
4725
5301
|
className: "schematic-cta schematic-metered-features__add-more",
|
|
@@ -4739,38 +5315,38 @@ function PriceDetails({
|
|
|
4739
5315
|
}) {
|
|
4740
5316
|
const period = details.period === null ? void 0 : shortPeriod(details.period, t);
|
|
4741
5317
|
if (details.kind === "overage") {
|
|
4742
|
-
return /* @__PURE__ */
|
|
4743
|
-
/* @__PURE__ */
|
|
5318
|
+
return /* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__price-details", children: [
|
|
5319
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
4744
5320
|
t("meteredFeaturesAdditional"),
|
|
4745
5321
|
": ",
|
|
4746
5322
|
details.unitPrice,
|
|
4747
|
-
/* @__PURE__ */
|
|
5323
|
+
/* @__PURE__ */ jsxs6("sub", { children: [
|
|
4748
5324
|
"/",
|
|
4749
|
-
details.packageSize
|
|
5325
|
+
details.packageSize !== null && `${details.packageSize} `,
|
|
4750
5326
|
details.units,
|
|
4751
5327
|
period !== void 0 && `/${period}`
|
|
4752
5328
|
] })
|
|
4753
5329
|
] }),
|
|
4754
|
-
/* @__PURE__ */
|
|
5330
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
4755
5331
|
details.overage.amount,
|
|
4756
5332
|
" ",
|
|
4757
5333
|
details.overage.units,
|
|
4758
5334
|
" \xB7 ",
|
|
4759
5335
|
details.overage.cost,
|
|
4760
|
-
period !== void 0 && /* @__PURE__ */
|
|
5336
|
+
period !== void 0 && /* @__PURE__ */ jsxs6("sub", { children: [
|
|
4761
5337
|
"/",
|
|
4762
5338
|
period
|
|
4763
5339
|
] })
|
|
4764
5340
|
] })
|
|
4765
5341
|
] });
|
|
4766
5342
|
}
|
|
4767
|
-
return /* @__PURE__ */
|
|
4768
|
-
/* @__PURE__ */
|
|
5343
|
+
return /* @__PURE__ */ jsxs6("div", { className: "schematic-metered-features__price-details", children: [
|
|
5344
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
4769
5345
|
t("meteredFeaturesTier"),
|
|
4770
5346
|
": ",
|
|
4771
5347
|
details.from,
|
|
4772
5348
|
details.to === null ? "+" : details.to !== details.from ? `\u2013${details.to}` : "",
|
|
4773
|
-
/* @__PURE__ */
|
|
5349
|
+
/* @__PURE__ */ jsx7(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ jsx7(
|
|
4774
5350
|
PriceTiers,
|
|
4775
5351
|
{
|
|
4776
5352
|
currency: details.tiers.currency,
|
|
@@ -4783,9 +5359,9 @@ function PriceDetails({
|
|
|
4783
5359
|
}
|
|
4784
5360
|
) })
|
|
4785
5361
|
] }),
|
|
4786
|
-
details.cost !== null && /* @__PURE__ */
|
|
5362
|
+
details.cost !== null && /* @__PURE__ */ jsxs6("span", { children: [
|
|
4787
5363
|
details.cost,
|
|
4788
|
-
period !== void 0 && /* @__PURE__ */
|
|
5364
|
+
period !== void 0 && /* @__PURE__ */ jsxs6("sub", { children: [
|
|
4789
5365
|
"/",
|
|
4790
5366
|
period
|
|
4791
5367
|
] })
|
|
@@ -4798,7 +5374,7 @@ function UsageByUser({
|
|
|
4798
5374
|
t
|
|
4799
5375
|
}) {
|
|
4800
5376
|
const { data, error, refetch } = useFeatureUserUsage(row.featureId);
|
|
4801
|
-
return /* @__PURE__ */
|
|
5377
|
+
return /* @__PURE__ */ jsx7(
|
|
4802
5378
|
UserBreakdown,
|
|
4803
5379
|
{
|
|
4804
5380
|
breakdown: data === void 0 ? void 0 : {
|
|
@@ -4820,11 +5396,11 @@ function UsageByUser({
|
|
|
4820
5396
|
);
|
|
4821
5397
|
}
|
|
4822
5398
|
function MeteredFeaturesSkeleton({ showHeader }) {
|
|
4823
|
-
return /* @__PURE__ */
|
|
4824
|
-
showHeader && /* @__PURE__ */
|
|
4825
|
-
[0, 1].map((index) => /* @__PURE__ */
|
|
4826
|
-
/* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
5399
|
+
return /* @__PURE__ */ jsxs6("div", { className: "schematic-skeleton", children: [
|
|
5400
|
+
showHeader && /* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__heading" }),
|
|
5401
|
+
[0, 1].map((index) => /* @__PURE__ */ jsxs6("div", { className: "schematic-skeleton__row", children: [
|
|
5402
|
+
/* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
|
|
5403
|
+
/* @__PURE__ */ jsx7("div", { className: "schematic-skeleton__cell", "data-column": "usage" })
|
|
4828
5404
|
] }, index))
|
|
4829
5405
|
] });
|
|
4830
5406
|
}
|
|
@@ -4832,8 +5408,8 @@ MeteredFeatures.resources = ["featureUsage"];
|
|
|
4832
5408
|
|
|
4833
5409
|
// src/elements/PaymentMethods.tsx
|
|
4834
5410
|
import { usePaymentMethods } from "@schematichq/schematic-react";
|
|
4835
|
-
import { Suspense, lazy, useCallback as useCallback2, useMemo as
|
|
4836
|
-
import { Fragment as Fragment3, jsx as
|
|
5411
|
+
import { Suspense, lazy, useCallback as useCallback2, useMemo as useMemo6, useState as useState6 } from "react";
|
|
5412
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4837
5413
|
var PaymentMethodForm2 = lazy(() => Promise.resolve().then(() => (init_PaymentMethodForm(), PaymentMethodForm_exports)));
|
|
4838
5414
|
function PaymentMethods({
|
|
4839
5415
|
allowEdit = true,
|
|
@@ -4858,10 +5434,10 @@ function PaymentMethods({
|
|
|
4858
5434
|
} = usePaymentMethods();
|
|
4859
5435
|
const locale = useResolvedLocale(localeProp);
|
|
4860
5436
|
const t = useTranslator(strings, localeProp);
|
|
4861
|
-
const [dialog, setDialog] =
|
|
4862
|
-
const [choosing, setChoosing] =
|
|
4863
|
-
const [lastWrite, setLastWrite] =
|
|
4864
|
-
const derived =
|
|
5437
|
+
const [dialog, setDialog] = useState6(null);
|
|
5438
|
+
const [choosing, setChoosing] = useState6(false);
|
|
5439
|
+
const [lastWrite, setLastWrite] = useState6(null);
|
|
5440
|
+
const derived = useMemo6(
|
|
4865
5441
|
() => methods === void 0 ? void 0 : derivePaymentMethods(methods, { locale }),
|
|
4866
5442
|
[locale, methods]
|
|
4867
5443
|
);
|
|
@@ -4892,7 +5468,7 @@ function PaymentMethods({
|
|
|
4892
5468
|
const Heading = `h${headingLevel}`;
|
|
4893
5469
|
const unavailable = derived === void 0 && httpStatus(error) === 404;
|
|
4894
5470
|
const errorMessage = error === void 0 ? void 0 : unavailable ? t("paymentMethodsUnavailable") : t("paymentMethodsError");
|
|
4895
|
-
return /* @__PURE__ */
|
|
5471
|
+
return /* @__PURE__ */ jsx9(
|
|
4896
5472
|
StatusFrame,
|
|
4897
5473
|
{
|
|
4898
5474
|
className: cx("schematic-card", "schematic-payment-methods", className),
|
|
@@ -4903,18 +5479,19 @@ function PaymentMethods({
|
|
|
4903
5479
|
loadingLabel: t("paymentMethodsLoading"),
|
|
4904
5480
|
onRetry: refetch,
|
|
4905
5481
|
retryText: t("retry"),
|
|
4906
|
-
skeleton: /* @__PURE__ */
|
|
4907
|
-
children: derived !== void 0 && /* @__PURE__ */
|
|
4908
|
-
showHeader && /* @__PURE__ */
|
|
5482
|
+
skeleton: /* @__PURE__ */ jsx9(PaymentMethodsSkeleton, { showHeader }),
|
|
5483
|
+
children: derived !== void 0 && /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5484
|
+
showHeader && /* @__PURE__ */ jsx9(
|
|
4909
5485
|
PaymentMethodsHeader,
|
|
4910
5486
|
{
|
|
4911
5487
|
derived,
|
|
4912
5488
|
heading: Heading,
|
|
5489
|
+
locale,
|
|
4913
5490
|
showExpiration,
|
|
4914
5491
|
t
|
|
4915
5492
|
}
|
|
4916
5493
|
),
|
|
4917
|
-
/* @__PURE__ */
|
|
5494
|
+
/* @__PURE__ */ jsx9(MethodPill, { row: derived.current, t, children: allowEdit && /* @__PURE__ */ jsx9(
|
|
4918
5495
|
"button",
|
|
4919
5496
|
{
|
|
4920
5497
|
className: "schematic-link-button schematic-payment-methods__edit",
|
|
@@ -4923,7 +5500,7 @@ function PaymentMethods({
|
|
|
4923
5500
|
children: derived.current === null ? t("paymentMethodsAdd") : t("paymentMethodsEdit")
|
|
4924
5501
|
}
|
|
4925
5502
|
) }),
|
|
4926
|
-
dialog !== null && /* @__PURE__ */
|
|
5503
|
+
dialog !== null && /* @__PURE__ */ jsx9(
|
|
4927
5504
|
PaymentMethodsDialog,
|
|
4928
5505
|
{
|
|
4929
5506
|
checkoutPrefill,
|
|
@@ -4975,7 +5552,7 @@ function PaymentMethodsDialog({
|
|
|
4975
5552
|
const { current, others, rows } = derived;
|
|
4976
5553
|
const hasMethods = rows.length > 0;
|
|
4977
5554
|
const showForm = view === "add" || !hasMethods;
|
|
4978
|
-
return /* @__PURE__ */
|
|
5555
|
+
return /* @__PURE__ */ jsxs8(
|
|
4979
5556
|
Dialog,
|
|
4980
5557
|
{
|
|
4981
5558
|
className: "schematic-payment-methods__dialog",
|
|
@@ -4984,11 +5561,11 @@ function PaymentMethodsDialog({
|
|
|
4984
5561
|
title: t("paymentMethodsDialogTitle"),
|
|
4985
5562
|
onClose,
|
|
4986
5563
|
children: [
|
|
4987
|
-
showForm ? /* @__PURE__ */
|
|
5564
|
+
showForm ? /* @__PURE__ */ jsx9(
|
|
4988
5565
|
Suspense,
|
|
4989
5566
|
{
|
|
4990
|
-
fallback: /* @__PURE__ */
|
|
4991
|
-
children: /* @__PURE__ */
|
|
5567
|
+
fallback: /* @__PURE__ */ jsx9(FormSkeleton, { label: t("paymentMethodsFormLoading") }),
|
|
5568
|
+
children: /* @__PURE__ */ jsx9(
|
|
4992
5569
|
PaymentMethodForm2,
|
|
4993
5570
|
{
|
|
4994
5571
|
checkoutPrefill,
|
|
@@ -5000,17 +5577,18 @@ function PaymentMethodsDialog({
|
|
|
5000
5577
|
}
|
|
5001
5578
|
)
|
|
5002
5579
|
}
|
|
5003
|
-
) : /* @__PURE__ */
|
|
5004
|
-
/* @__PURE__ */
|
|
5580
|
+
) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5581
|
+
/* @__PURE__ */ jsx9(
|
|
5005
5582
|
PaymentMethodsHeader,
|
|
5006
5583
|
{
|
|
5007
5584
|
derived,
|
|
5008
5585
|
heading: "h3",
|
|
5586
|
+
locale,
|
|
5009
5587
|
showExpiration: true,
|
|
5010
5588
|
t
|
|
5011
5589
|
}
|
|
5012
5590
|
),
|
|
5013
|
-
/* @__PURE__ */
|
|
5591
|
+
/* @__PURE__ */ jsx9(MethodPill, { row: current, t, children: current?.canRemove === true && /* @__PURE__ */ jsx9(
|
|
5014
5592
|
"button",
|
|
5015
5593
|
{
|
|
5016
5594
|
className: "schematic-link-button schematic-payment-methods__remove-current",
|
|
@@ -5020,7 +5598,7 @@ function PaymentMethodsDialog({
|
|
|
5020
5598
|
children: t("paymentMethodsRemove")
|
|
5021
5599
|
}
|
|
5022
5600
|
) }),
|
|
5023
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsxs8(
|
|
5024
5602
|
"button",
|
|
5025
5603
|
{
|
|
5026
5604
|
"aria-expanded": choosing,
|
|
@@ -5028,8 +5606,8 @@ function PaymentMethodsDialog({
|
|
|
5028
5606
|
type: "button",
|
|
5029
5607
|
onClick: onChoose,
|
|
5030
5608
|
children: [
|
|
5031
|
-
/* @__PURE__ */
|
|
5032
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__choose-label", children: t("paymentMethodsChooseDifferent") }),
|
|
5610
|
+
/* @__PURE__ */ jsx9(
|
|
5033
5611
|
"i",
|
|
5034
5612
|
{
|
|
5035
5613
|
"aria-hidden": "true",
|
|
@@ -5044,13 +5622,13 @@ function PaymentMethodsDialog({
|
|
|
5044
5622
|
]
|
|
5045
5623
|
}
|
|
5046
5624
|
),
|
|
5047
|
-
choosing && /* @__PURE__ */
|
|
5048
|
-
others.length > 0 && /* @__PURE__ */
|
|
5625
|
+
choosing && /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5626
|
+
others.length > 0 && /* @__PURE__ */ jsx9(
|
|
5049
5627
|
"ul",
|
|
5050
5628
|
{
|
|
5051
5629
|
"aria-label": t("paymentMethodsChooseDifferent"),
|
|
5052
5630
|
className: "schematic-payment-methods__list",
|
|
5053
|
-
children: others.map((row) => /* @__PURE__ */
|
|
5631
|
+
children: others.map((row) => /* @__PURE__ */ jsxs8(
|
|
5054
5632
|
"li",
|
|
5055
5633
|
{
|
|
5056
5634
|
className: "schematic-payment-methods__row",
|
|
@@ -5058,11 +5636,11 @@ function PaymentMethodsDialog({
|
|
|
5058
5636
|
"data-kind": row.kind,
|
|
5059
5637
|
"data-testid": "schematic-payment-method",
|
|
5060
5638
|
children: [
|
|
5061
|
-
/* @__PURE__ */
|
|
5062
|
-
row.expiresShort !== null && /* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ jsx9(Method, { row, t }),
|
|
5640
|
+
row.expiresShort !== null && /* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__expires", children: t("paymentMethodsExpires", {
|
|
5063
5641
|
date: row.expiresShort
|
|
5064
5642
|
}) }),
|
|
5065
|
-
/* @__PURE__ */
|
|
5643
|
+
/* @__PURE__ */ jsx9(
|
|
5066
5644
|
"button",
|
|
5067
5645
|
{
|
|
5068
5646
|
className: "schematic-link-button schematic-payment-methods__set-default",
|
|
@@ -5072,7 +5650,7 @@ function PaymentMethodsDialog({
|
|
|
5072
5650
|
children: t("paymentMethodsSetDefault")
|
|
5073
5651
|
}
|
|
5074
5652
|
),
|
|
5075
|
-
row.canRemove && /* @__PURE__ */
|
|
5653
|
+
row.canRemove && /* @__PURE__ */ jsx9(
|
|
5076
5654
|
"button",
|
|
5077
5655
|
{
|
|
5078
5656
|
"aria-label": t("paymentMethodsRemove"),
|
|
@@ -5080,7 +5658,7 @@ function PaymentMethodsDialog({
|
|
|
5080
5658
|
disabled: isMutating,
|
|
5081
5659
|
type: "button",
|
|
5082
5660
|
onClick: () => onRemove(row),
|
|
5083
|
-
children: /* @__PURE__ */
|
|
5661
|
+
children: /* @__PURE__ */ jsx9(
|
|
5084
5662
|
"i",
|
|
5085
5663
|
{
|
|
5086
5664
|
"aria-hidden": "true",
|
|
@@ -5095,7 +5673,7 @@ function PaymentMethodsDialog({
|
|
|
5095
5673
|
))
|
|
5096
5674
|
}
|
|
5097
5675
|
),
|
|
5098
|
-
/* @__PURE__ */
|
|
5676
|
+
/* @__PURE__ */ jsx9(
|
|
5099
5677
|
"button",
|
|
5100
5678
|
{
|
|
5101
5679
|
className: "schematic-cta schematic-payment-methods__add-new",
|
|
@@ -5107,14 +5685,14 @@ function PaymentMethodsDialog({
|
|
|
5107
5685
|
)
|
|
5108
5686
|
] })
|
|
5109
5687
|
] }),
|
|
5110
|
-
mutationError !== void 0 && /* @__PURE__ */
|
|
5688
|
+
mutationError !== void 0 && /* @__PURE__ */ jsxs8(
|
|
5111
5689
|
"p",
|
|
5112
5690
|
{
|
|
5113
5691
|
className: "schematic-status-note schematic-error schematic-payment-methods__error",
|
|
5114
5692
|
role: "alert",
|
|
5115
5693
|
children: [
|
|
5116
|
-
/* @__PURE__ */
|
|
5117
|
-
onRetry !== void 0 && /* @__PURE__ */
|
|
5694
|
+
/* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__error-message", children: mutationError }),
|
|
5695
|
+
onRetry !== void 0 && /* @__PURE__ */ jsx9(
|
|
5118
5696
|
"button",
|
|
5119
5697
|
{
|
|
5120
5698
|
className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-payment-methods__error-retry",
|
|
@@ -5134,17 +5712,18 @@ function PaymentMethodsDialog({
|
|
|
5134
5712
|
function PaymentMethodsHeader({
|
|
5135
5713
|
derived,
|
|
5136
5714
|
heading: Heading,
|
|
5715
|
+
locale,
|
|
5137
5716
|
showExpiration,
|
|
5138
5717
|
t
|
|
5139
5718
|
}) {
|
|
5140
|
-
return /* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5142
|
-
showExpiration && derived.expiryWarning !== "none" && /* @__PURE__ */
|
|
5719
|
+
return /* @__PURE__ */ jsxs8("div", { className: "schematic-header", children: [
|
|
5720
|
+
/* @__PURE__ */ jsx9(Heading, { className: "schematic-header__title", children: t("paymentMethodsHeader") }),
|
|
5721
|
+
showExpiration && derived.expiryWarning !== "none" && /* @__PURE__ */ jsx9(
|
|
5143
5722
|
"span",
|
|
5144
5723
|
{
|
|
5145
5724
|
className: "schematic-small schematic-payment-methods__expiry-warning",
|
|
5146
5725
|
"data-expiry": derived.expiryWarning,
|
|
5147
|
-
children: expiryWarningText(derived, t)
|
|
5726
|
+
children: expiryWarningText(derived, locale, t)
|
|
5148
5727
|
}
|
|
5149
5728
|
)
|
|
5150
5729
|
] });
|
|
@@ -5154,37 +5733,37 @@ function MethodPill({
|
|
|
5154
5733
|
row,
|
|
5155
5734
|
t
|
|
5156
5735
|
}) {
|
|
5157
|
-
return /* @__PURE__ */
|
|
5736
|
+
return /* @__PURE__ */ jsxs8(
|
|
5158
5737
|
"div",
|
|
5159
5738
|
{
|
|
5160
5739
|
className: "schematic-payment-methods__current",
|
|
5161
5740
|
"data-testid": "schematic-payment-method-current",
|
|
5162
5741
|
children: [
|
|
5163
|
-
row === null ? /* @__PURE__ */
|
|
5742
|
+
row === null ? /* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__empty", children: t("paymentMethodsEmpty") }) : /* @__PURE__ */ jsx9(Method, { row, t }),
|
|
5164
5743
|
children
|
|
5165
5744
|
]
|
|
5166
5745
|
}
|
|
5167
5746
|
);
|
|
5168
5747
|
}
|
|
5169
5748
|
function Method({ row, t }) {
|
|
5170
|
-
return /* @__PURE__ */
|
|
5749
|
+
return /* @__PURE__ */ jsxs8(
|
|
5171
5750
|
"span",
|
|
5172
5751
|
{
|
|
5173
5752
|
className: "schematic-payment-methods__method",
|
|
5174
5753
|
"data-brand": row.brand,
|
|
5175
5754
|
"data-kind": row.kind,
|
|
5176
5755
|
children: [
|
|
5177
|
-
/* @__PURE__ */
|
|
5756
|
+
/* @__PURE__ */ jsx9(
|
|
5178
5757
|
"i",
|
|
5179
5758
|
{
|
|
5180
5759
|
"aria-hidden": "true",
|
|
5181
5760
|
className: `schematic-icon schematic-icon--${row.icon} schematic-payment-methods__icon`
|
|
5182
5761
|
}
|
|
5183
5762
|
),
|
|
5184
|
-
/* @__PURE__ */
|
|
5185
|
-
row.last4 !== null && /* @__PURE__ */
|
|
5763
|
+
/* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__label", children: labelText(row.label, t) }),
|
|
5764
|
+
row.last4 !== null && /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
5186
5765
|
" ",
|
|
5187
|
-
/* @__PURE__ */
|
|
5766
|
+
/* @__PURE__ */ jsx9("span", { className: "schematic-payment-methods__last4", children: row.last4 })
|
|
5188
5767
|
] })
|
|
5189
5768
|
]
|
|
5190
5769
|
}
|
|
@@ -5193,29 +5772,31 @@ function Method({ row, t }) {
|
|
|
5193
5772
|
function labelText(label, t) {
|
|
5194
5773
|
return label.key === void 0 ? label.text : t(label.key);
|
|
5195
5774
|
}
|
|
5196
|
-
function expiryWarningText(derived, t) {
|
|
5775
|
+
function expiryWarningText(derived, locale, t) {
|
|
5197
5776
|
const months = derived.monthsToExpiration ?? 0;
|
|
5198
|
-
return derived.expiryWarning === "expired" ? t("paymentMethodsExpired") : t("paymentMethodsExpiresInMonths", {
|
|
5777
|
+
return derived.expiryWarning === "expired" ? t("paymentMethodsExpired") : t("paymentMethodsExpiresInMonths", {
|
|
5778
|
+
months: formatNumber(months, locale)
|
|
5779
|
+
});
|
|
5199
5780
|
}
|
|
5200
5781
|
function PaymentMethodsSkeleton({ showHeader }) {
|
|
5201
|
-
return /* @__PURE__ */
|
|
5202
|
-
showHeader && /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
/* @__PURE__ */
|
|
5782
|
+
return /* @__PURE__ */ jsxs8("div", { className: "schematic-skeleton", children: [
|
|
5783
|
+
showHeader && /* @__PURE__ */ jsx9("div", { className: "schematic-skeleton__heading" }),
|
|
5784
|
+
/* @__PURE__ */ jsxs8("div", { className: "schematic-skeleton__row", children: [
|
|
5785
|
+
/* @__PURE__ */ jsx9("div", { className: "schematic-skeleton__cell", "data-column": "method" }),
|
|
5786
|
+
/* @__PURE__ */ jsx9("div", { className: "schematic-skeleton__cell", "data-column": "action" })
|
|
5206
5787
|
] })
|
|
5207
5788
|
] });
|
|
5208
5789
|
}
|
|
5209
5790
|
function FormSkeleton({ label }) {
|
|
5210
|
-
return /* @__PURE__ */
|
|
5791
|
+
return /* @__PURE__ */ jsxs8(
|
|
5211
5792
|
"div",
|
|
5212
5793
|
{
|
|
5213
5794
|
"aria-busy": "true",
|
|
5214
5795
|
className: "schematic-payment-methods__form",
|
|
5215
5796
|
"data-state": "pending",
|
|
5216
5797
|
children: [
|
|
5217
|
-
/* @__PURE__ */
|
|
5218
|
-
/* @__PURE__ */
|
|
5798
|
+
/* @__PURE__ */ jsx9("span", { className: "schematic-hidden", children: label }),
|
|
5799
|
+
/* @__PURE__ */ jsx9("div", { className: "schematic-skeleton", children: /* @__PURE__ */ jsx9("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx9("div", { className: "schematic-skeleton__cell", "data-column": "field" }) }) })
|
|
5219
5800
|
]
|
|
5220
5801
|
}
|
|
5221
5802
|
);
|
|
@@ -5224,8 +5805,8 @@ PaymentMethods.resources = ["paymentMethods"];
|
|
|
5224
5805
|
|
|
5225
5806
|
// src/elements/UpcomingBill.tsx
|
|
5226
5807
|
import { useUpcomingInvoice } from "@schematichq/schematic-react";
|
|
5227
|
-
import { useMemo as
|
|
5228
|
-
import { Fragment as Fragment4, jsx as
|
|
5808
|
+
import { useMemo as useMemo7 } from "react";
|
|
5809
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
5229
5810
|
function UpcomingBill({
|
|
5230
5811
|
className,
|
|
5231
5812
|
headingLevel = 2,
|
|
@@ -5239,7 +5820,7 @@ function UpcomingBill({
|
|
|
5239
5820
|
const { data: invoice, error, isPending, refetch } = useUpcomingInvoice();
|
|
5240
5821
|
const locale = useResolvedLocale(localeProp);
|
|
5241
5822
|
const t = useTranslator(strings, localeProp);
|
|
5242
|
-
const bill =
|
|
5823
|
+
const bill = useMemo7(
|
|
5243
5824
|
() => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
|
|
5244
5825
|
[invoice, locale]
|
|
5245
5826
|
);
|
|
@@ -5248,7 +5829,7 @@ function UpcomingBill({
|
|
|
5248
5829
|
const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
|
|
5249
5830
|
const unavailable = invoice === void 0 && httpStatus(error) === 404;
|
|
5250
5831
|
const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
|
|
5251
|
-
return /* @__PURE__ */
|
|
5832
|
+
return /* @__PURE__ */ jsx10(
|
|
5252
5833
|
StatusFrame,
|
|
5253
5834
|
{
|
|
5254
5835
|
className: cx("schematic-card", "schematic-upcoming-bill", className),
|
|
@@ -5259,11 +5840,11 @@ function UpcomingBill({
|
|
|
5259
5840
|
loadingLabel: t("upcomingBillLoading"),
|
|
5260
5841
|
onRetry: refetch,
|
|
5261
5842
|
retryText: t("retry"),
|
|
5262
|
-
skeleton: /* @__PURE__ */
|
|
5263
|
-
children: bill === null ? invoice !== void 0 && /* @__PURE__ */
|
|
5264
|
-
showHeader && bill.dueAt !== null && /* @__PURE__ */
|
|
5265
|
-
showAmount && /* @__PURE__ */
|
|
5266
|
-
/* @__PURE__ */
|
|
5843
|
+
skeleton: /* @__PURE__ */ jsx10(UpcomingBillSkeleton, { showHeader }),
|
|
5844
|
+
children: bill === null ? invoice !== void 0 && /* @__PURE__ */ jsx10("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
5845
|
+
showHeader && bill.dueAt !== null && /* @__PURE__ */ jsx10("div", { className: "schematic-header", children: /* @__PURE__ */ jsx10(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
|
|
5846
|
+
showAmount && /* @__PURE__ */ jsxs9("div", { className: "schematic-upcoming-bill__amount", children: [
|
|
5847
|
+
/* @__PURE__ */ jsx10(
|
|
5267
5848
|
"span",
|
|
5268
5849
|
{
|
|
5269
5850
|
className: "schematic-upcoming-bill__total",
|
|
@@ -5271,46 +5852,46 @@ function UpcomingBill({
|
|
|
5271
5852
|
children: bill.amountDueText
|
|
5272
5853
|
}
|
|
5273
5854
|
),
|
|
5274
|
-
/* @__PURE__ */
|
|
5855
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
|
|
5275
5856
|
] }),
|
|
5276
|
-
(balanceRows || discountRow) && /* @__PURE__ */
|
|
5277
|
-
balanceRows && bill.balanceApplied !== null && /* @__PURE__ */
|
|
5857
|
+
(balanceRows || discountRow) && /* @__PURE__ */ jsxs9("div", { className: "schematic-upcoming-bill__rows", children: [
|
|
5858
|
+
balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ jsxs9(
|
|
5278
5859
|
"div",
|
|
5279
5860
|
{
|
|
5280
5861
|
className: "schematic-row schematic-upcoming-bill__balance-applied",
|
|
5281
5862
|
"data-testid": "schematic-balance-applied",
|
|
5282
5863
|
children: [
|
|
5283
|
-
/* @__PURE__ */
|
|
5284
|
-
/* @__PURE__ */
|
|
5864
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
|
|
5865
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
|
|
5285
5866
|
]
|
|
5286
5867
|
}
|
|
5287
5868
|
),
|
|
5288
|
-
balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */
|
|
5869
|
+
balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ jsxs9(
|
|
5289
5870
|
"div",
|
|
5290
5871
|
{
|
|
5291
5872
|
className: "schematic-row schematic-upcoming-bill__balance-remaining",
|
|
5292
5873
|
"data-testid": "schematic-balance-remaining",
|
|
5293
5874
|
children: [
|
|
5294
|
-
/* @__PURE__ */
|
|
5295
|
-
/* @__PURE__ */
|
|
5875
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
|
|
5876
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
|
|
5296
5877
|
]
|
|
5297
5878
|
}
|
|
5298
5879
|
),
|
|
5299
|
-
discountRow && /* @__PURE__ */
|
|
5880
|
+
discountRow && /* @__PURE__ */ jsxs9(
|
|
5300
5881
|
"div",
|
|
5301
5882
|
{
|
|
5302
5883
|
className: "schematic-row schematic-upcoming-bill__discount-row",
|
|
5303
5884
|
"data-testid": "schematic-discounts",
|
|
5304
5885
|
children: [
|
|
5305
|
-
/* @__PURE__ */
|
|
5306
|
-
/* @__PURE__ */
|
|
5886
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
|
|
5887
|
+
/* @__PURE__ */ jsx10("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ jsxs9(
|
|
5307
5888
|
"li",
|
|
5308
5889
|
{
|
|
5309
5890
|
className: "schematic-upcoming-bill__discount",
|
|
5310
5891
|
"data-testid": "schematic-discount",
|
|
5311
5892
|
children: [
|
|
5312
|
-
discount.code !== null && /* @__PURE__ */
|
|
5313
|
-
/* @__PURE__ */
|
|
5893
|
+
discount.code !== null && /* @__PURE__ */ jsx10("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
|
|
5894
|
+
/* @__PURE__ */ jsx10("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
|
|
5314
5895
|
]
|
|
5315
5896
|
},
|
|
5316
5897
|
`${discount.couponName}-${index}`
|
|
@@ -5324,10 +5905,10 @@ function UpcomingBill({
|
|
|
5324
5905
|
);
|
|
5325
5906
|
}
|
|
5326
5907
|
function UpcomingBillSkeleton({ showHeader }) {
|
|
5327
|
-
return /* @__PURE__ */
|
|
5328
|
-
showHeader && /* @__PURE__ */
|
|
5329
|
-
/* @__PURE__ */
|
|
5330
|
-
/* @__PURE__ */
|
|
5908
|
+
return /* @__PURE__ */ jsxs9("div", { className: "schematic-skeleton", children: [
|
|
5909
|
+
showHeader && /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__heading" }),
|
|
5910
|
+
/* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
|
|
5911
|
+
/* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ jsx10("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
|
|
5331
5912
|
] });
|
|
5332
5913
|
}
|
|
5333
5914
|
function discountText(discount, t) {
|
|
@@ -5342,6 +5923,7 @@ function discountText(discount, t) {
|
|
|
5342
5923
|
UpcomingBill.resources = ["upcomingInvoice"];
|
|
5343
5924
|
export {
|
|
5344
5925
|
BillingDataProvider,
|
|
5926
|
+
CreditUsage,
|
|
5345
5927
|
DEFAULT_STRINGS,
|
|
5346
5928
|
FEATURE_USER_USAGE_LIMIT,
|
|
5347
5929
|
IncludedFeatures,
|
|
@@ -5355,6 +5937,7 @@ export {
|
|
|
5355
5937
|
UpcomingBill,
|
|
5356
5938
|
billingResources,
|
|
5357
5939
|
currentTier,
|
|
5940
|
+
deriveCreditUsage,
|
|
5358
5941
|
deriveIncludedFeatures,
|
|
5359
5942
|
deriveInvoiceList,
|
|
5360
5943
|
deriveMeteredFeatures,
|
|
@@ -5381,6 +5964,8 @@ export {
|
|
|
5381
5964
|
tierRanges,
|
|
5382
5965
|
unitPrice,
|
|
5383
5966
|
usageLimit,
|
|
5967
|
+
useCreditBalances2 as useCreditBalances,
|
|
5968
|
+
useCreditUserUsage2 as useCreditUserUsage,
|
|
5384
5969
|
useFeatureUsage3 as useFeatureUsage,
|
|
5385
5970
|
useFeatureUserUsage2 as useFeatureUserUsage,
|
|
5386
5971
|
useInvalidateBillingData,
|