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