@schematichq/schematic-components 2.33.0 → 2.34.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.
@@ -479,18 +479,20 @@ var init_PaymentMethodForm = __esm({
479
479
  // src/elements/index.ts
480
480
  var index_exports = {};
481
481
  __export(index_exports, {
482
- BillingDataProvider: () => import_schematic_react9.BillingDataProvider,
482
+ BillingDataProvider: () => import_schematic_react11.BillingDataProvider,
483
483
  CreditUsage: () => CreditUsage,
484
484
  DEFAULT_STRINGS: () => DEFAULT_STRINGS,
485
- FEATURE_USER_USAGE_LIMIT: () => import_schematic_react9.FEATURE_USER_USAGE_LIMIT,
485
+ FEATURE_USER_USAGE_LIMIT: () => import_schematic_react11.FEATURE_USER_USAGE_LIMIT,
486
486
  IncludedFeatures: () => IncludedFeatures,
487
487
  Invoices: () => Invoices,
488
488
  MeteredFeatures: () => MeteredFeatures,
489
489
  PaymentMethods: () => PaymentMethods,
490
+ PlanManager: () => PlanManager,
490
491
  SCHEMATIC_TOKENS: () => SCHEMATIC_TOKENS,
491
- SchematicI18nProvider: () => import_schematic_react9.SchematicI18nProvider,
492
+ SchematicI18nProvider: () => import_schematic_react11.SchematicI18nProvider,
492
493
  SchematicStyles: () => SchematicStyles,
493
494
  Tooltip: () => Tooltip,
495
+ UnsubscribeButton: () => UnsubscribeButton,
494
496
  UpcomingBill: () => UpcomingBill,
495
497
  billingResources: () => billingResources,
496
498
  currentTier: () => currentTier,
@@ -499,6 +501,8 @@ __export(index_exports, {
499
501
  deriveInvoiceList: () => deriveInvoiceList,
500
502
  deriveMeteredFeatures: () => deriveMeteredFeatures,
501
503
  derivePaymentMethods: () => derivePaymentMethods,
504
+ derivePlanManager: () => derivePlanManager,
505
+ deriveUnsubscribe: () => deriveUnsubscribe,
502
506
  deriveUpcomingInvoice: () => deriveUpcomingInvoice,
503
507
  featureName: () => featureName,
504
508
  formatConsumptionRate: () => formatConsumptionRate,
@@ -521,25 +525,27 @@ __export(index_exports, {
521
525
  tierRanges: () => tierRanges,
522
526
  unitPrice: () => unitPrice,
523
527
  usageLimit: () => usageLimit,
524
- useCreditBalances: () => import_schematic_react9.useCreditBalances,
525
- useCreditUserUsage: () => import_schematic_react9.useCreditUserUsage,
526
- useFeatureUsage: () => import_schematic_react9.useFeatureUsage,
527
- useFeatureUserUsage: () => import_schematic_react9.useFeatureUserUsage,
528
- useInvalidateBillingData: () => import_schematic_react9.useInvalidateBillingData,
529
- useInvoices: () => import_schematic_react9.useInvoices,
530
- usePaymentMethods: () => import_schematic_react9.usePaymentMethods,
528
+ useCompany: () => import_schematic_react11.useCompany,
529
+ useCreditBalances: () => import_schematic_react11.useCreditBalances,
530
+ useCreditUserUsage: () => import_schematic_react11.useCreditUserUsage,
531
+ useFeatureUsage: () => import_schematic_react11.useFeatureUsage,
532
+ useFeatureUserUsage: () => import_schematic_react11.useFeatureUserUsage,
533
+ useInvalidateBillingData: () => import_schematic_react11.useInvalidateBillingData,
534
+ useInvoices: () => import_schematic_react11.useInvoices,
535
+ usePaymentMethods: () => import_schematic_react11.usePaymentMethods,
531
536
  useResolvedLocale: () => useResolvedLocale,
532
- useSchematicI18n: () => import_schematic_react9.useSchematicI18n,
533
- useSchematicLocale: () => import_schematic_react9.useSchematicLocale,
534
- useSchematicStrings: () => import_schematic_react9.useSchematicStrings,
535
- useSchematicTranslate: () => import_schematic_react9.useSchematicTranslate,
536
- useSetupIntent: () => import_schematic_react9.useSetupIntent,
537
+ useSchematicI18n: () => import_schematic_react11.useSchematicI18n,
538
+ useSchematicLocale: () => import_schematic_react11.useSchematicLocale,
539
+ useSchematicStrings: () => import_schematic_react11.useSchematicStrings,
540
+ useSchematicTranslate: () => import_schematic_react11.useSchematicTranslate,
541
+ useSetupIntent: () => import_schematic_react11.useSetupIntent,
537
542
  useTranslator: () => useTranslator,
538
- useUpcomingInvoice: () => import_schematic_react9.useUpcomingInvoice,
543
+ useUnsubscribe: () => import_schematic_react11.useUnsubscribe,
544
+ useUpcomingInvoice: () => import_schematic_react11.useUpcomingInvoice,
539
545
  viewerLocale: () => viewerLocale
540
546
  });
541
547
  module.exports = __toCommonJS(index_exports);
542
- var import_schematic_react9 = require("@schematichq/schematic-react");
548
+ var import_schematic_react11 = require("@schematichq/schematic-react");
543
549
 
544
550
  // src/elements/model/errors.ts
545
551
  function httpStatus(error) {
@@ -1848,6 +1854,416 @@ function isEnglish2(locale) {
1848
1854
  }
1849
1855
  }
1850
1856
 
1857
+ // src/elements/model/planManager.ts
1858
+ var DAY_MS = 24 * 60 * 60 * 1e3;
1859
+ var HOUR_MS = 60 * 60 * 1e3;
1860
+ var MINUTE_MS = 60 * 1e3;
1861
+ function derivePlanManager(data, options) {
1862
+ const { company, creditBalances, featureUsage } = data;
1863
+ const { locale } = options;
1864
+ const subscription = company.subscription ?? null;
1865
+ const currency = subscription?.currency ?? "usd";
1866
+ const planPeriod = subscription?.period ?? company.plan?.period ?? null;
1867
+ const usageBasedSources = featureUsage.filter(
1868
+ (row) => typeof row.priceBehavior === "string"
1869
+ );
1870
+ return {
1871
+ notice: notice(company, options),
1872
+ plan: company.plan === void 0 || company.plan === null ? null : {
1873
+ name: company.plan.name,
1874
+ description: orNull3(company.plan.description),
1875
+ price: planPrice(
1876
+ company.plan.price,
1877
+ planPeriod,
1878
+ currency,
1879
+ usageBasedSources.length > 0,
1880
+ options
1881
+ )
1882
+ },
1883
+ addOns: company.addOns.map((addOn) => {
1884
+ const period = addOn.period === "one-time" ? "one-time" : planPeriod ?? addOn.period ?? null;
1885
+ return {
1886
+ id: addOn.id,
1887
+ name: addOn.name,
1888
+ price: typeof addOn.price === "number" && period !== null ? {
1889
+ amount: formatCurrency(addOn.price, currency, locale),
1890
+ period
1891
+ } : null
1892
+ };
1893
+ }),
1894
+ usageBased: usageBasedSources.flatMap((row) => {
1895
+ const derived = usageBasedRow(row, planPeriod ?? "month", options);
1896
+ return derived === null ? [] : [derived];
1897
+ }),
1898
+ planCredits: planCredits(company, creditBalances, locale),
1899
+ autoTopup: autoTopupBox(company, creditBalances, locale),
1900
+ ...creditGroups(creditBalances, locale),
1901
+ canChangePlan: company.customPlanBilling?.activationStrategy !== "on_payment"
1902
+ };
1903
+ }
1904
+ function notice(company, options) {
1905
+ const { locale } = options;
1906
+ const subscription = company.subscription ?? null;
1907
+ const cancelAt = usableDate(subscription?.cancelAt);
1908
+ const willCancel = cancelAt !== void 0 && subscription?.cancelAtPeriodEnd === true;
1909
+ if (subscription?.status === "trialing" && !willCancel) {
1910
+ const trialEnd = usableDate(subscription.trialEnd);
1911
+ return {
1912
+ kind: "trial",
1913
+ endsIn: trialEnd === void 0 ? null : countdown(
1914
+ trialEnd.getTime() - (options.now ?? /* @__PURE__ */ new Date()).getTime()
1915
+ )
1916
+ };
1917
+ }
1918
+ if (willCancel) {
1919
+ return {
1920
+ kind: "canceled",
1921
+ planName: orNull3(company.plan?.name),
1922
+ date: formatDate(cancelAt, locale)
1923
+ };
1924
+ }
1925
+ const billing = company.customPlanBilling;
1926
+ if (billing !== void 0 && billing !== null) {
1927
+ return {
1928
+ kind: "customPlanBilling",
1929
+ awaitingActivation: billing.activationStrategy === "on_payment",
1930
+ planName: orNull3(billing.planName),
1931
+ date: formatDate(billing.dueAt, locale),
1932
+ invoiceUrl: orNull3(billing.invoiceUrl)
1933
+ };
1934
+ }
1935
+ const downgrade = company.scheduledDowngrade;
1936
+ if (downgrade !== void 0 && downgrade !== null && downgrade.toPlanName !== "") {
1937
+ const periodEnd = usableDate(subscription?.periodEnd);
1938
+ return {
1939
+ kind: "scheduledDowngrade",
1940
+ fromPlanName: downgrade.fromPlanName,
1941
+ toPlanName: downgrade.toPlanName,
1942
+ date: periodEnd === void 0 ? null : formatDate(periodEnd, locale)
1943
+ };
1944
+ }
1945
+ return null;
1946
+ }
1947
+ function countdown(ms) {
1948
+ if (ms >= DAY_MS) {
1949
+ return { amount: Math.floor(ms / DAY_MS), unit: "day" };
1950
+ }
1951
+ if (ms >= HOUR_MS) {
1952
+ return { amount: Math.floor(ms / HOUR_MS), unit: "hour" };
1953
+ }
1954
+ if (ms >= MINUTE_MS) {
1955
+ return { amount: Math.floor(ms / MINUTE_MS), unit: "minute" };
1956
+ }
1957
+ return ms > 0 ? "soon" : "ended";
1958
+ }
1959
+ function planPrice(price, period, currency, hasUsageBased, options) {
1960
+ if (typeof price !== "number") {
1961
+ return null;
1962
+ }
1963
+ const isFree = price === 0;
1964
+ if (isFree && hasUsageBased) {
1965
+ return { kind: "usageBased" };
1966
+ }
1967
+ if (isFree && options.showZeroPriceAsFree === true) {
1968
+ return { kind: "free" };
1969
+ }
1970
+ return {
1971
+ kind: "amount",
1972
+ amount: formatCurrency(price, currency, options.locale),
1973
+ period: isFree ? null : period
1974
+ };
1975
+ }
1976
+ function usageBasedRow(row, period, options) {
1977
+ const { locale } = options;
1978
+ const behavior = row.priceBehavior ?? null;
1979
+ const showCredits = options.showCredits ?? true;
1980
+ if (behavior === "credit_burndown" && !showCredits || row.featureName === "") {
1981
+ return null;
1982
+ }
1983
+ const unit = {
1984
+ name: row.featureName,
1985
+ singularName: row.featureSingularName ?? void 0,
1986
+ pluralName: row.featurePluralName ?? void 0
1987
+ };
1988
+ const isTrait = row.featureType === "trait";
1989
+ const price = row.price ?? void 0;
1990
+ const priceCurrency = price?.currency ?? "usd";
1991
+ const limit = behavior === "credit_burndown" ? null : usageLimit(row, options);
1992
+ let unitPriceText = null;
1993
+ if ((behavior === "pay_as_you_go" || behavior === "overage") && price !== void 0) {
1994
+ const packageSize = price.packageSize ?? 1;
1995
+ const ranges = behavior === "overage" ? tierRanges(price) : [];
1996
+ const lastTier = ranges[ranges.length - 1];
1997
+ const amount = lastTier === void 0 ? unitPrice(price) : lastTier.perUnitPrice ?? price.price;
1998
+ unitPriceText = {
1999
+ cost: formatCurrency(amount, priceCurrency, locale),
2000
+ packageSize: packageSize > 1 ? formatNumber(packageSize, locale) : null,
2001
+ units: featureName(unit, packageSize, locale),
2002
+ period: isTrait ? period : null
2003
+ };
2004
+ }
2005
+ let perUse = null;
2006
+ if (behavior === "credit_burndown" && typeof row.consumptionRate === "number" && row.consumptionRate !== 0 && typeof row.creditName === "string") {
2007
+ perUse = {
2008
+ amount: formatConsumptionRate(row.consumptionRate, locale),
2009
+ units: featureName(
2010
+ {
2011
+ name: row.creditName,
2012
+ singularName: row.creditSingularName,
2013
+ pluralName: row.creditPluralName
2014
+ },
2015
+ row.consumptionRate,
2016
+ locale
2017
+ )
2018
+ };
2019
+ }
2020
+ return {
2021
+ featureId: row.featureId,
2022
+ name: row.featureName,
2023
+ // The bare name, inflected, as the embed counts a limit.
2024
+ quantity: limit === null ? null : {
2025
+ amount: formatNumber(limit, locale),
2026
+ units: featureName({ name: row.featureName }, limit, locale)
2027
+ },
2028
+ additional: behavior === "overage",
2029
+ tierBased: behavior === "tier",
2030
+ unitPrice: unitPriceText,
2031
+ perUse,
2032
+ cost: behavior === "pay_in_advance" ? {
2033
+ amount: formatCurrency(row.currentCost ?? 0, priceCurrency, locale),
2034
+ period: isTrait ? period : null
2035
+ } : null,
2036
+ tiers: behavior === "tier" && isTieredPrice(price) ? {
2037
+ currency: priceCurrency,
2038
+ mode: price?.tiersMode ?? null,
2039
+ period,
2040
+ ranges: tierRanges(price),
2041
+ unit: row.featureSingularName ?? row.featureName
2042
+ } : null,
2043
+ hardLimit: behavior !== null && behavior !== "credit_burndown" && row.valueType === "numeric" && typeof row.allocation === "number" ? {
2044
+ amount: formatNumber(row.allocation, locale),
2045
+ units: featureName(unit, row.allocation, locale)
2046
+ } : null,
2047
+ source: row
2048
+ };
2049
+ }
2050
+ function planCredits(company, balances, locale) {
2051
+ const order = company.plan?.includedCreditIds ?? [];
2052
+ const rank = (creditId) => {
2053
+ const index = order.indexOf(creditId);
2054
+ return index === -1 ? order.length : index;
2055
+ };
2056
+ const subscriptionPeriod = company.subscription?.period ?? null;
2057
+ return balances.flatMap((balance) => {
2058
+ const grants = balance.grants.filter(
2059
+ (grant) => grant.grantReason === "plan"
2060
+ );
2061
+ if (grants.length === 0) {
2062
+ return [];
2063
+ }
2064
+ const unit = creditUnit(balance);
2065
+ const value = sum(grants, (grant) => grant.quantity);
2066
+ const used = sum(grants, (grant) => grant.quantityUsed);
2067
+ const composition = balance.composition ?? null;
2068
+ const autoTopup = balance.autoTopup ?? null;
2069
+ const row = {
2070
+ creditId: balance.creditId,
2071
+ text: composition === null ? {
2072
+ kind: "total",
2073
+ amount: formatCredits(value, locale),
2074
+ creditName: featureName(unit, value, locale),
2075
+ period: subscriptionPeriod
2076
+ } : {
2077
+ kind: "perLicense",
2078
+ amount: formatCredits(composition.perLicenseAmount, locale),
2079
+ creditName: featureName(
2080
+ unit,
2081
+ composition.perLicenseAmount,
2082
+ locale
2083
+ ),
2084
+ licenseName: featureName(licenseUnit(composition), 1, locale),
2085
+ plus: composition.fixedQuantity > 0 ? {
2086
+ amount: formatCredits(
2087
+ composition.fixedQuantity,
2088
+ locale
2089
+ ),
2090
+ creditName: featureName(
2091
+ unit,
2092
+ composition.fixedQuantity,
2093
+ locale
2094
+ ),
2095
+ period: composition.period
2096
+ } : null
2097
+ },
2098
+ used: spent(used, locale),
2099
+ autoTopup: autoTopup !== null && autoTopup.enabled && typeof autoTopup.thresholdCredits === "number" && typeof autoTopup.amount === "number" ? {
2100
+ amount: formatCredits(autoTopup.amount, locale),
2101
+ threshold: formatCredits(autoTopup.thresholdCredits, locale)
2102
+ } : null,
2103
+ composition: composition === null ? null : {
2104
+ quantity: formatNumber(composition.licenseQuantity, locale),
2105
+ licenseName: featureName(
2106
+ licenseUnit(composition),
2107
+ composition.licenseQuantity,
2108
+ locale
2109
+ ),
2110
+ perUnit: formatCredits(composition.perLicenseAmount, locale),
2111
+ fixed: composition.fixedQuantity > 0 ? formatCredits(composition.fixedQuantity, locale) : null,
2112
+ total: formatCredits(composition.total, locale),
2113
+ creditName: featureName(unit, composition.total, locale),
2114
+ period: composition.period
2115
+ }
2116
+ };
2117
+ return [row];
2118
+ }).map((row, index) => ({ row, index })).sort(
2119
+ (a, b) => rank(a.row.creditId) - rank(b.row.creditId) || a.index - b.index
2120
+ ).map(({ row }) => row);
2121
+ }
2122
+ function autoTopupBox(company, balances, locale) {
2123
+ const order = company.plan?.includedCreditIds ?? [];
2124
+ const selfService = order.flatMap((creditId) => {
2125
+ const balance = balances.find((b) => b.creditId === creditId);
2126
+ const autoTopup = balance?.autoTopup ?? null;
2127
+ return balance === void 0 || autoTopup === null || !autoTopup.selfService ? [] : [{ balance, autoTopup }];
2128
+ });
2129
+ if (selfService.length === 0) {
2130
+ return null;
2131
+ }
2132
+ return {
2133
+ lines: selfService.flatMap(({ balance, autoTopup }) => {
2134
+ const unit = creditUnit(balance);
2135
+ if (!autoTopup.enabled) {
2136
+ return [
2137
+ {
2138
+ kind: "disabled",
2139
+ creditId: balance.creditId,
2140
+ unit: featureName(unit, 1, locale)
2141
+ }
2142
+ ];
2143
+ }
2144
+ if (typeof autoTopup.thresholdCredits !== "number" || typeof autoTopup.amount !== "number") {
2145
+ return [];
2146
+ }
2147
+ return [
2148
+ {
2149
+ kind: "adds",
2150
+ creditId: balance.creditId,
2151
+ amount: formatCredits(autoTopup.amount, locale),
2152
+ unit: featureName(unit, autoTopup.amount, locale),
2153
+ threshold: formatCredits(autoTopup.thresholdCredits, locale)
2154
+ }
2155
+ ];
2156
+ })
2157
+ };
2158
+ }
2159
+ function creditGroups(balances, locale) {
2160
+ const groups = /* @__PURE__ */ new Map();
2161
+ for (const balance of balances) {
2162
+ for (const grant of balance.grants) {
2163
+ if (grant.grantReason === "plan") {
2164
+ continue;
2165
+ }
2166
+ const key = `${grant.grantReason}:${grant.bundleId ?? grant.id}`;
2167
+ const group = groups.get(key);
2168
+ if (group === void 0) {
2169
+ groups.set(key, { balance, grants: [grant] });
2170
+ } else {
2171
+ group.grants.push(grant);
2172
+ }
2173
+ }
2174
+ }
2175
+ const rows = Array.from(groups.entries()).map(([key, { balance, grants }]) => {
2176
+ const sorted = [...grants].sort(byRecency);
2177
+ const latest = sorted[0];
2178
+ return {
2179
+ reason: latest.grantReason,
2180
+ createdAt: latest.createdAt,
2181
+ row: {
2182
+ key,
2183
+ count: sorted.length,
2184
+ bundleName: orNull3(latest.bundleName),
2185
+ quantity: formatCredits(latest.quantity, locale),
2186
+ creditName: featureName(creditUnit(balance), latest.quantity, locale),
2187
+ used: spent(
2188
+ sum(sorted, (grant) => grant.quantityUsed),
2189
+ locale
2190
+ )
2191
+ }
2192
+ };
2193
+ }).sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
2194
+ const pick = (reason) => rows.filter((entry) => entry.reason === reason).map((entry) => entry.row);
2195
+ return {
2196
+ bundles: pick("purchased"),
2197
+ promotional: pick("free"),
2198
+ topUps: pick("billing_credit_auto_topup")
2199
+ };
2200
+ }
2201
+ function byRecency(a, b) {
2202
+ return b.createdAt.getTime() - a.createdAt.getTime();
2203
+ }
2204
+ function creditUnit(balance) {
2205
+ return {
2206
+ name: balance.creditName,
2207
+ singularName: balance.creditSingularName ?? void 0,
2208
+ pluralName: balance.creditPluralName ?? void 0
2209
+ };
2210
+ }
2211
+ function licenseUnit(composition) {
2212
+ return {
2213
+ name: composition.licenseName,
2214
+ singularName: composition.licenseSingularName,
2215
+ pluralName: composition.licensePluralName
2216
+ };
2217
+ }
2218
+ function spent(used, locale) {
2219
+ return used > 0 ? formatCredits(used, locale) : null;
2220
+ }
2221
+ function sum(items, value) {
2222
+ return items.reduce((total, item) => total + value(item), 0);
2223
+ }
2224
+ function orNull3(value) {
2225
+ return value === void 0 || value === null || value === "" ? null : value;
2226
+ }
2227
+
2228
+ // src/elements/model/unsubscribe.ts
2229
+ function deriveUnsubscribe(company, featureUsage, options) {
2230
+ const { locale } = options;
2231
+ const subscription = company.subscription ?? null;
2232
+ const currency = subscription?.currency ?? "usd";
2233
+ const cancelAt = usableDate(subscription?.cancelAt);
2234
+ const endsOn = cancelAt ?? usableDate(subscription?.nextBillAt) ?? options.now ?? /* @__PURE__ */ new Date();
2235
+ const money = (amount) => formatCurrency(amount, currency, locale);
2236
+ const addOns = company.addOns.flatMap(
2237
+ (addOn) => typeof addOn.price === "number" ? [
2238
+ {
2239
+ id: addOn.id,
2240
+ name: addOn.name,
2241
+ price: money(addOn.price),
2242
+ oneTime: addOn.period === "one-time"
2243
+ }
2244
+ ] : []
2245
+ );
2246
+ const planPrice2 = company.plan?.price;
2247
+ const total = (typeof planPrice2 === "number" ? planPrice2 : 0) + company.addOns.reduce(
2248
+ (sum2, addOn) => addOn.period !== "one-time" && typeof addOn.price === "number" ? sum2 + addOn.price : sum2,
2249
+ 0
2250
+ ) + featureUsage.reduce(
2251
+ (sum2, row) => row.priceBehavior === "pay_in_advance" ? sum2 + (row.currentCost ?? 0) : sum2,
2252
+ 0
2253
+ );
2254
+ return {
2255
+ canUnsubscribe: subscription !== null && cancelAt === void 0,
2256
+ accessEndsOn: formatDate(endsOn, locale),
2257
+ period: subscription?.period ?? company.plan?.period ?? "month",
2258
+ plan: company.plan === void 0 || company.plan === null ? null : {
2259
+ name: company.plan.name,
2260
+ price: typeof planPrice2 === "number" ? money(planPrice2) : null
2261
+ },
2262
+ addOns,
2263
+ total: money(total)
2264
+ };
2265
+ }
2266
+
1851
2267
  // src/elements/strings.ts
1852
2268
  var DEFAULT_STRINGS_LOCALE = "en";
1853
2269
  var DEFAULT_STRINGS = {
@@ -1956,6 +2372,73 @@ var DEFAULT_STRINGS = {
1956
2372
  creditUsagePerLicense: "{{quantity}} {{licenseName}} \xD7 {{perUnit}}",
1957
2373
  creditUsageCompanyGrant: "{{amount}} company grant",
1958
2374
  creditUsageRenewsOn: "Renews on the {{day}}.",
2375
+ planManagerLoading: "Loading your plan",
2376
+ planManagerError: "There was a problem retrieving your plan.",
2377
+ planManagerUnavailable: "Your plan is not available for this account.",
2378
+ planManagerTrialEndsIn: "Trial ends in {{amount}} {{units}}",
2379
+ planManagerTrialEndsSoon: "Trial ends in less than a minute",
2380
+ planManagerTrialEnded: "Your trial has ended",
2381
+ // The trial countdown's units, looked up by the bare key with `{ count }`.
2382
+ planManagerDays: "days",
2383
+ planManagerDays_one: "day",
2384
+ planManagerDays_other: "days",
2385
+ planManagerHours: "hours",
2386
+ planManagerHours_one: "hour",
2387
+ planManagerHours_other: "hours",
2388
+ planManagerMinutes: "minutes",
2389
+ planManagerMinutes_one: "minute",
2390
+ planManagerMinutes_other: "minutes",
2391
+ planManagerCanceled: "Subscription canceled",
2392
+ planManagerAccessEnds: "Access to {{plan}} will end on {{date}}.",
2393
+ planManagerPlanFallback: "plan",
2394
+ planManagerCustomAwaiting: "Pay to activate {{plan}}",
2395
+ planManagerCustomAwaitingDescription: "Pay the invoice to activate your custom plan. Due by {{date}}.",
2396
+ planManagerCustomDue: "Pay by {{date}} to keep {{plan}}",
2397
+ planManagerCustomDueDescription: "Access to {{plan}} will end on {{date}} unless the invoice is paid.",
2398
+ planManagerYourPlan: "your plan",
2399
+ planManagerPayNow: "Pay now",
2400
+ planManagerDowngradeScheduled: "Downgrade to {{plan}} scheduled",
2401
+ planManagerUsageBased: "Usage-based",
2402
+ planManagerFree: "Free",
2403
+ planManagerAddOns: "Add-ons",
2404
+ planManagerAdditional: "Additional",
2405
+ planManagerTierBased: "Tier-based",
2406
+ planManagerCreditsInPlan: "Credits in plan",
2407
+ planManagerCreditsError: "There was a problem retrieving your credits.",
2408
+ planManagerCreditsLoading: "Loading your credits",
2409
+ planManagerTopUps: "Top-ups",
2410
+ planManagerCreditBundles: "Credit bundles",
2411
+ planManagerPromotionalCredits: "Promotional credits",
2412
+ planManagerChangePlan: "Change plan",
2413
+ planManagerCredits: "{{amount}} {{creditName}}",
2414
+ planManagerCreditsPerPeriod: "{{amount}} {{creditName}} per {{period}}",
2415
+ planManagerCreditsPerLicense: "{{amount}} {{creditName}} per {{licenseName}}",
2416
+ planManagerCreditsPlusPerPeriod: "+ {{amount}} {{creditName}} per {{period}}",
2417
+ planManagerLicensesTimesCredits: "{{quantity}} {{licenseName}} \xD7 {{perUnit}} = {{total}} {{creditName}}/{{period}}",
2418
+ planManagerLicensesTimesCreditsPlusCompany: "{{quantity}} {{licenseName}} \xD7 {{perUnit}} + {{fixed}} = {{total}} {{creditName}}/{{period}}",
2419
+ planManagerUsed: "{{amount}} used",
2420
+ planManagerAutoTopup: "Auto top-up",
2421
+ planManagerAutoTopupDisabled: "Auto top-up disabled for {{unit}}",
2422
+ planManagerAutoTopupAdds: "Adds {{amount}} {{unit}} when {{threshold}} remaining in balance",
2423
+ planManagerAutoTopupTip: "When credit balance reaches {{threshold}} remaining, an auto top-up of {{amount}} credits will be processed.",
2424
+ planManagerEdit: "Edit",
2425
+ planManagerSeeAll: "See all ({{total}})",
2426
+ planManagerHideAll: "Hide all",
2427
+ unsubscribeButton: "Unsubscribe",
2428
+ unsubscribeTitle: "Cancel subscription",
2429
+ unsubscribeAccessUntil: "You will retain access to your plan until the end of the billing period, on {{date}}",
2430
+ unsubscribeNotReady: "Not ready to cancel?",
2431
+ unsubscribeManagePlan: "Manage plan",
2432
+ unsubscribePlan: "Plan",
2433
+ unsubscribeAddOns: "Add-ons",
2434
+ unsubscribeMonthlyTotal: "Monthly total:",
2435
+ unsubscribeQuarterlyTotal: "Quarterly total:",
2436
+ unsubscribeYearlyTotal: "Yearly total:",
2437
+ unsubscribeConfirm: "Cancel subscription",
2438
+ unsubscribeFailed: "Unsubscribe failed",
2439
+ unsubscribeClose: "Close",
2440
+ unsubscribeError: "There was a problem retrieving your subscription.",
2441
+ unsubscribeUnavailable: "Your subscription is not available for this account.",
1959
2442
  usageByUserHeader: "Usage by user",
1960
2443
  usageByUserTotal: "{{amount}} used by your team this period",
1961
2444
  usageByUserError: "There was a problem retrieving usage by user.",
@@ -1991,7 +2474,12 @@ var DEFAULT_STRINGS = {
1991
2474
  usageTiersGraduated: "Tiers apply progressively as quantity increases.",
1992
2475
  periodMonthShort: "mo",
1993
2476
  periodQuarterShort: "qtr",
1994
- periodYearShort: "yr"
2477
+ periodYearShort: "yr",
2478
+ periodDay: "day",
2479
+ periodWeek: "week",
2480
+ periodMonth: "month",
2481
+ periodQuarter: "quarter",
2482
+ periodYear: "year"
1995
2483
  };
1996
2484
  var MISSING_STRING = "\0schematic:missing";
1997
2485
  function interpolate(template, vars) {
@@ -3358,146 +3846,408 @@ var paymentMethodsCss = `
3358
3846
  }
3359
3847
  `;
3360
3848
 
3361
- // src/elements/styles/index.tsx
3362
- init_tokens();
3363
-
3364
- // src/elements/styles/tooltip.ts
3365
- var tooltipCss = `
3366
- .schematic-tooltip {
3367
- display: inline-block;
3368
- margin-inline-start: 0.25rem;
3369
- position: relative;
3370
- vertical-align: middle;
3371
- }
3372
-
3373
- .schematic-tooltip__trigger {
3374
- background: none;
3375
- border: 0;
3376
- color: var(--schematic-muted);
3377
- cursor: help;
3378
- /* A button keeps the browser's control font; the glyph is the embed's
3379
- 24px. */
3380
- font-size: 1.5rem;
3381
- line-height: 0;
3382
- padding: 0;
3849
+ // src/elements/styles/plan-manager.ts
3850
+ var planManagerCss = `
3851
+ .schematic-plan-manager {
3852
+ display: flex;
3853
+ flex-direction: column;
3854
+ gap: var(--schematic-space);
3383
3855
  }
3384
3856
 
3385
- .schematic-tooltip__trigger:focus-visible {
3386
- outline: 2px solid var(--schematic-accent);
3387
- outline-offset: 2px;
3857
+ /* While loading or failed there is no plan card, so the root draws one. */
3858
+ .schematic-plan-manager[data-state="pending"],
3859
+ .schematic-plan-manager[data-state="error"] {
3860
+ background: var(--schematic-background);
3861
+ border-radius: var(--schematic-radius);
3862
+ box-shadow: var(--schematic-shadow);
3863
+ padding: calc(var(--schematic-card-padding) * 0.75)
3864
+ var(--schematic-card-padding);
3388
3865
  }
3389
3866
 
3390
- .schematic-tooltip__content {
3867
+ /* As in the embed, a notice is a band across the top of the card: the
3868
+ root draws the card and the plan's own card goes flat. */
3869
+ .schematic-plan-manager:has(.schematic-plan-manager__notice) {
3391
3870
  background: var(--schematic-background);
3392
- border: 1px solid var(--schematic-border);
3393
- border-radius: calc(var(--schematic-radius) / 2);
3394
- bottom: calc(100% + 0.5rem);
3871
+ border-radius: var(--schematic-radius);
3395
3872
  box-shadow: var(--schematic-shadow);
3396
- color: var(--schematic-text);
3397
- font-size: 0.875rem;
3398
- inset-inline-end: 0;
3399
- padding: 0.5rem 0.75rem;
3400
- pointer-events: none;
3401
- position: absolute;
3402
- text-align: start;
3403
- visibility: hidden;
3404
- white-space: nowrap;
3405
- z-index: 1;
3873
+ gap: 0;
3874
+ overflow: hidden;
3406
3875
  }
3407
3876
 
3408
- .schematic-tooltip:hover .schematic-tooltip__content,
3409
- .schematic-tooltip:focus-within .schematic-tooltip__content {
3410
- visibility: visible;
3877
+ .schematic-plan-manager:has(.schematic-plan-manager__notice)
3878
+ .schematic-plan-manager__card {
3879
+ border-radius: 0;
3880
+ box-shadow: none;
3411
3881
  }
3412
3882
 
3413
- .schematic-tiers {
3883
+ .schematic-plan-manager__notice {
3884
+ align-items: center;
3885
+ background: var(--schematic-inset);
3414
3886
  display: flex;
3415
3887
  flex-direction: column;
3416
3888
  gap: 0.5rem;
3889
+ padding: calc(var(--schematic-space) * 1.5);
3890
+ text-align: center;
3417
3891
  }
3418
3892
 
3419
- .schematic-tiers__list {
3420
- margin: 0;
3421
- }
3422
-
3423
- .schematic-tiers__tier {
3424
- display: flex;
3425
- gap: var(--schematic-space);
3426
- justify-content: space-between;
3427
- padding: 0.25rem 0;
3428
- }
3429
-
3430
- .schematic-tiers__price {
3893
+ .schematic-plan-manager__notice-title {
3894
+ font-family: var(--schematic-font-heading);
3895
+ font-size: 1.25rem;
3896
+ font-weight: 600;
3897
+ line-height: var(--schematic-line-height-heading);
3431
3898
  margin: 0;
3432
3899
  }
3433
3900
 
3434
- .schematic-tiers__mode {
3435
- border-top: 1px solid var(--schematic-border);
3436
- padding-top: 0.5rem;
3437
- white-space: normal;
3901
+ .schematic-plan-manager__notice-body {
3902
+ font-size: 0.8125rem;
3438
3903
  }
3439
- `;
3440
3904
 
3441
- // src/elements/styles/upcoming-bill.ts
3442
- var upcomingBillCss = `
3443
- .schematic-upcoming-bill {
3905
+ .schematic-plan-manager__card {
3444
3906
  display: flex;
3445
3907
  flex-direction: column;
3446
- gap: var(--schematic-space);
3908
+ gap: calc(var(--schematic-space) * 2);
3447
3909
  }
3448
3910
 
3449
- .schematic-upcoming-bill .schematic-header {
3450
- margin-bottom: 0;
3911
+ .schematic-plan-manager__plan {
3912
+ align-items: center;
3913
+ display: flex;
3914
+ gap: var(--schematic-space);
3915
+ justify-content: space-between;
3451
3916
  }
3452
3917
 
3453
- .schematic-upcoming-bill__amount {
3454
- align-items: flex-start;
3918
+ .schematic-plan-manager__title {
3455
3919
  display: flex;
3920
+ flex-direction: column;
3456
3921
  gap: var(--schematic-space);
3457
- justify-content: space-between;
3458
3922
  }
3459
3923
 
3460
- .schematic-upcoming-bill__total {
3924
+ .schematic-plan-manager__name {
3461
3925
  font-family: var(--schematic-font-heading);
3462
3926
  font-size: 2.3125rem;
3463
- font-variant-numeric: tabular-nums;
3464
3927
  font-weight: 800;
3465
3928
  line-height: 1;
3929
+ margin: 0;
3466
3930
  }
3467
3931
 
3468
- .schematic-upcoming-bill__estimate {
3469
- color: var(--schematic-muted);
3470
- max-width: 10rem;
3471
- text-align: end;
3932
+ .schematic-plan-manager__price {
3933
+ font-family: var(--schematic-font-heading);
3934
+ font-size: 1.25rem;
3935
+ font-weight: 600;
3936
+ white-space: nowrap;
3472
3937
  }
3473
3938
 
3474
- .schematic-upcoming-bill__rows {
3939
+ .schematic-plan-manager__section {
3475
3940
  display: flex;
3476
3941
  flex-direction: column;
3477
- gap: var(--schematic-space);
3942
+ gap: 0.5rem;
3478
3943
  }
3479
3944
 
3480
- .schematic-upcoming-bill .schematic-row__value {
3481
- font-variant-numeric: tabular-nums;
3945
+ .schematic-plan-manager__label {
3946
+ line-height: 1;
3482
3947
  }
3483
3948
 
3484
- .schematic-upcoming-bill__discounts {
3485
- align-items: flex-end;
3949
+ .schematic-plan-manager__rows {
3486
3950
  display: flex;
3487
3951
  flex-direction: column;
3488
- gap: calc(var(--schematic-space) / 2);
3952
+ gap: var(--schematic-space);
3489
3953
  list-style: none;
3490
3954
  margin: 0;
3491
3955
  padding: 0;
3492
3956
  }
3493
3957
 
3494
- .schematic-upcoming-bill__discount {
3958
+ /* Centred as in the embed; a plan credit's name and figure share a
3959
+ baseline above the line that explains them. */
3960
+ .schematic-plan-manager__row,
3961
+ .schematic-plan-manager__row-main {
3495
3962
  align-items: center;
3496
- display: inline-flex;
3497
- gap: calc(var(--schematic-space) / 2);
3498
- }
3499
-
3500
- .schematic-upcoming-bill__empty {
3963
+ display: flex;
3964
+ flex-wrap: wrap;
3965
+ gap: var(--schematic-space);
3966
+ justify-content: space-between;
3967
+ }
3968
+
3969
+ .schematic-plan-manager__row-main {
3970
+ align-items: baseline;
3971
+ gap: 0.5rem;
3972
+ }
3973
+
3974
+ .schematic-plan-manager__row--stacked {
3975
+ align-items: stretch;
3976
+ flex-direction: column;
3977
+ gap: 0.25rem;
3978
+ }
3979
+
3980
+ .schematic-plan-manager__item {
3981
+ font-family: var(--schematic-font-heading);
3982
+ font-size: 1.125rem;
3983
+ font-weight: 800;
3984
+ }
3985
+
3986
+ .schematic-plan-manager__detail,
3987
+ .schematic-plan-manager__used {
3988
+ align-items: center;
3989
+ display: inline-flex;
3990
+ gap: 0.25rem;
3991
+ }
3992
+
3993
+ .schematic-plan-manager__see-all {
3994
+ align-items: center;
3995
+ align-self: flex-start;
3996
+ display: inline-flex;
3997
+ gap: 0.25rem;
3998
+ margin-top: 0.5rem;
3999
+ }
4000
+
4001
+ .schematic-plan-manager__see-all .schematic-chevron {
4002
+ margin-inline-start: -0.333rem;
4003
+ }
4004
+
4005
+ .schematic-plan-manager__auto-topup {
4006
+ align-items: center;
4007
+ background: var(--schematic-inset);
4008
+ border-radius: calc(var(--schematic-radius) * 0.8);
4009
+ display: flex;
4010
+ gap: 0.5rem;
4011
+ justify-content: space-between;
4012
+ padding: calc(var(--schematic-space) * 1.5);
4013
+ }
4014
+
4015
+ .schematic-plan-manager__auto-topup-lines {
4016
+ display: flex;
4017
+ flex-direction: column;
4018
+ gap: 0.5rem;
4019
+ line-height: 1.25;
4020
+ }
4021
+
4022
+ .schematic-plan-manager__change-plan {
4023
+ width: 100%;
4024
+ }
4025
+
4026
+ .schematic-plan-manager .schematic-skeleton__cell[data-column="name"] {
4027
+ width: 10rem;
4028
+ }
4029
+
4030
+ .schematic-plan-manager .schematic-skeleton__cell[data-column="price"] {
4031
+ width: 6rem;
4032
+ }
4033
+ `;
4034
+
4035
+ // src/elements/styles/index.tsx
4036
+ init_tokens();
4037
+
4038
+ // src/elements/styles/tooltip.ts
4039
+ var tooltipCss = `
4040
+ .schematic-tooltip {
4041
+ display: inline-block;
4042
+ margin-inline-start: 0.25rem;
4043
+ position: relative;
4044
+ vertical-align: middle;
4045
+ }
4046
+
4047
+ .schematic-tooltip__trigger {
4048
+ background: none;
4049
+ border: 0;
4050
+ color: var(--schematic-muted);
4051
+ cursor: help;
4052
+ /* A button keeps the browser's control font; the glyph is the embed's
4053
+ 24px. */
4054
+ font-size: 1.5rem;
4055
+ line-height: 0;
4056
+ padding: 0;
4057
+ }
4058
+
4059
+ .schematic-tooltip__trigger:focus-visible {
4060
+ outline: 2px solid var(--schematic-accent);
4061
+ outline-offset: 2px;
4062
+ }
4063
+
4064
+ .schematic-tooltip__content {
4065
+ background: var(--schematic-background);
4066
+ border: 1px solid var(--schematic-border);
4067
+ border-radius: calc(var(--schematic-radius) / 2);
4068
+ bottom: calc(100% + 0.5rem);
4069
+ box-shadow: var(--schematic-shadow);
4070
+ color: var(--schematic-text);
4071
+ font-size: 0.875rem;
4072
+ inset-inline-end: 0;
4073
+ padding: 0.5rem 0.75rem;
4074
+ pointer-events: none;
4075
+ position: absolute;
4076
+ text-align: start;
4077
+ visibility: hidden;
4078
+ white-space: nowrap;
4079
+ z-index: 1;
4080
+ }
4081
+
4082
+ .schematic-tooltip:hover .schematic-tooltip__content,
4083
+ .schematic-tooltip:focus-within .schematic-tooltip__content {
4084
+ visibility: visible;
4085
+ }
4086
+
4087
+ .schematic-tiers {
4088
+ display: flex;
4089
+ flex-direction: column;
4090
+ gap: 0.5rem;
4091
+ }
4092
+
4093
+ .schematic-tiers__list {
4094
+ margin: 0;
4095
+ }
4096
+
4097
+ .schematic-tiers__tier {
4098
+ display: flex;
4099
+ gap: var(--schematic-space);
4100
+ justify-content: space-between;
4101
+ padding: 0.25rem 0;
4102
+ }
4103
+
4104
+ .schematic-tiers__price {
4105
+ margin: 0;
4106
+ }
4107
+
4108
+ .schematic-tiers__mode {
4109
+ border-top: 1px solid var(--schematic-border);
4110
+ padding-top: 0.5rem;
4111
+ white-space: normal;
4112
+ }
4113
+ `;
4114
+
4115
+ // src/elements/styles/unsubscribe.ts
4116
+ var unsubscribeCss = `
4117
+ .schematic-unsubscribe {
4118
+ display: flex;
4119
+ justify-content: center;
4120
+ }
4121
+
4122
+ .schematic-unsubscribe__open {
4123
+ width: 100%;
4124
+ }
4125
+
4126
+ .schematic-unsubscribe__columns {
4127
+ display: flex;
4128
+ flex-wrap: wrap;
4129
+ gap: calc(var(--schematic-space) * 2);
4130
+ }
4131
+
4132
+ .schematic-unsubscribe__summary {
4133
+ display: flex;
4134
+ flex: 1 1 18rem;
4135
+ flex-direction: column;
4136
+ gap: calc(var(--schematic-space) * 2);
4137
+ }
4138
+
4139
+ .schematic-unsubscribe__manage {
4140
+ display: flex;
4141
+ flex-direction: column;
4142
+ gap: 0.5rem;
4143
+ }
4144
+
4145
+ .schematic-unsubscribe__manage-plan {
4146
+ align-self: flex-start;
4147
+ color: var(--schematic-accent);
4148
+ }
4149
+
4150
+ .schematic-unsubscribe__sidebar {
4151
+ background: var(--schematic-inset);
4152
+ border-radius: calc(var(--schematic-radius) * 0.8);
4153
+ display: flex;
4154
+ flex: 1 1 16rem;
4155
+ flex-direction: column;
4156
+ gap: calc(var(--schematic-space) * 1.5);
4157
+ padding: calc(var(--schematic-space) * 1.5);
4158
+ }
4159
+
4160
+ .schematic-unsubscribe__group {
4161
+ display: flex;
4162
+ flex-direction: column;
4163
+ gap: 0.125rem;
4164
+ }
4165
+
4166
+ .schematic-unsubscribe__line {
4167
+ align-items: baseline;
4168
+ display: flex;
4169
+ gap: var(--schematic-space);
4170
+ justify-content: space-between;
4171
+ white-space: nowrap;
4172
+ }
4173
+
4174
+ .schematic-unsubscribe__name {
4175
+ font-family: var(--schematic-font-heading);
4176
+ font-size: 1.125rem;
4177
+ font-weight: 800;
4178
+ white-space: normal;
4179
+ }
4180
+
4181
+ .schematic-unsubscribe__total {
4182
+ border-top: 1px solid var(--schematic-card-divider);
4183
+ padding-top: calc(var(--schematic-space) * 1.5);
4184
+ }
4185
+
4186
+ .schematic-unsubscribe__confirm {
4187
+ width: 100%;
4188
+ }
4189
+ `;
4190
+
4191
+ // src/elements/styles/upcoming-bill.ts
4192
+ var upcomingBillCss = `
4193
+ .schematic-upcoming-bill {
4194
+ display: flex;
4195
+ flex-direction: column;
4196
+ gap: var(--schematic-space);
4197
+ }
4198
+
4199
+ .schematic-upcoming-bill .schematic-header {
4200
+ margin-bottom: 0;
4201
+ }
4202
+
4203
+ .schematic-upcoming-bill__amount {
4204
+ align-items: flex-start;
4205
+ display: flex;
4206
+ gap: var(--schematic-space);
4207
+ justify-content: space-between;
4208
+ }
4209
+
4210
+ .schematic-upcoming-bill__total {
4211
+ font-family: var(--schematic-font-heading);
4212
+ font-size: 2.3125rem;
4213
+ font-variant-numeric: tabular-nums;
4214
+ font-weight: 800;
4215
+ line-height: 1;
4216
+ }
4217
+
4218
+ .schematic-upcoming-bill__estimate {
4219
+ color: var(--schematic-muted);
4220
+ max-width: 10rem;
4221
+ text-align: end;
4222
+ }
4223
+
4224
+ .schematic-upcoming-bill__rows {
4225
+ display: flex;
4226
+ flex-direction: column;
4227
+ gap: var(--schematic-space);
4228
+ }
4229
+
4230
+ .schematic-upcoming-bill .schematic-row__value {
4231
+ font-variant-numeric: tabular-nums;
4232
+ }
4233
+
4234
+ .schematic-upcoming-bill__discounts {
4235
+ align-items: flex-end;
4236
+ display: flex;
4237
+ flex-direction: column;
4238
+ gap: calc(var(--schematic-space) / 2);
4239
+ list-style: none;
4240
+ margin: 0;
4241
+ padding: 0;
4242
+ }
4243
+
4244
+ .schematic-upcoming-bill__discount {
4245
+ align-items: center;
4246
+ display: inline-flex;
4247
+ gap: calc(var(--schematic-space) / 2);
4248
+ }
4249
+
4250
+ .schematic-upcoming-bill__empty {
3501
4251
  padding: calc(var(--schematic-space) / 2) 0;
3502
4252
  }
3503
4253
 
@@ -4063,6 +4813,8 @@ ${tooltipCss}
4063
4813
  ${includedFeaturesCss}
4064
4814
  ${meteredFeaturesCss}
4065
4815
  ${creditUsageCss}
4816
+ ${planManagerCss}
4817
+ ${unsubscribeCss}
4066
4818
  `;
4067
4819
  var schematicStylesCss = withTokenDefaults(rulesCss) + iconsCss;
4068
4820
  var SchematicStyles = () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("style", { "data-schematic-styles": "", children: schematicStylesCss });
@@ -5855,11 +6607,760 @@ function FormSkeleton({ label }) {
5855
6607
  }
5856
6608
  PaymentMethods.resources = ["paymentMethods"];
5857
6609
 
5858
- // src/elements/UpcomingBill.tsx
6610
+ // src/elements/PlanManager.tsx
5859
6611
  var import_schematic_react8 = require("@schematichq/schematic-react");
5860
6612
  var import_react9 = require("react");
5861
6613
  var import_jsx_runtime10 = require("react/jsx-runtime");
5862
- function UpcomingBill({
6614
+ var VISIBLE_CREDIT_COUNT = 3;
6615
+ var UNIT_KEY = {
6616
+ day: "planManagerDays",
6617
+ hour: "planManagerHours",
6618
+ minute: "planManagerMinutes"
6619
+ };
6620
+ var PERIOD_KEY = {
6621
+ day: "periodDay",
6622
+ month: "periodMonth",
6623
+ quarter: "periodQuarter",
6624
+ week: "periodWeek",
6625
+ year: "periodYear"
6626
+ };
6627
+ function PlanManager({
6628
+ changePlanTarget,
6629
+ changePlanUrl,
6630
+ className,
6631
+ editAutoTopupTarget,
6632
+ editAutoTopupUrl,
6633
+ headingLevel = 2,
6634
+ locale: localeProp,
6635
+ onChangePlan,
6636
+ onEditAutoTopup,
6637
+ showAddOns = true,
6638
+ showCredits = true,
6639
+ showDescription = true,
6640
+ showHardLimit = false,
6641
+ showHeader = true,
6642
+ showLabels = true,
6643
+ showNotice = true,
6644
+ showPrice = true,
6645
+ showUsageBased = true,
6646
+ showWarningThresholdAsLimit = false,
6647
+ showZeroPriceAsFree = false,
6648
+ strings
6649
+ }) {
6650
+ const company = (0, import_schematic_react8.useCompany)();
6651
+ const usage = (0, import_schematic_react8.useFeatureUsage)();
6652
+ const credits = (0, import_schematic_react8.useCreditBalances)();
6653
+ const locale = useResolvedLocale(localeProp);
6654
+ const t = useTranslator(strings, localeProp);
6655
+ const creditsFailed = credits.data === void 0 && credits.error !== void 0;
6656
+ const [creditsHaveFailed, setCreditsHaveFailed] = (0, import_react9.useState)(false);
6657
+ if (creditsFailed && !creditsHaveFailed) {
6658
+ setCreditsHaveFailed(true);
6659
+ } else if (!creditsFailed && creditsHaveFailed && (credits.data !== void 0 || company.data === void 0 || usage.data === void 0)) {
6660
+ setCreditsHaveFailed(false);
6661
+ }
6662
+ const creditsSettled = !showCredits || credits.data !== void 0 || creditsHaveFailed;
6663
+ const view = (0, import_react9.useMemo)(
6664
+ () => company.data === void 0 || usage.data === void 0 || !creditsSettled ? void 0 : derivePlanManager(
6665
+ {
6666
+ company: company.data,
6667
+ creditBalances: credits.data ?? [],
6668
+ featureUsage: usage.data
6669
+ },
6670
+ {
6671
+ locale,
6672
+ showCredits,
6673
+ showWarningThresholdAsLimit,
6674
+ showZeroPriceAsFree
6675
+ }
6676
+ ),
6677
+ [
6678
+ company.data,
6679
+ credits.data,
6680
+ creditsSettled,
6681
+ locale,
6682
+ showCredits,
6683
+ showWarningThresholdAsLimit,
6684
+ showZeroPriceAsFree,
6685
+ usage.data
6686
+ ]
6687
+ );
6688
+ const creditsRefetchError = showCredits && credits.data !== void 0 ? credits.error : void 0;
6689
+ const cardError = company.error ?? usage.error;
6690
+ const error = cardError ?? creditsRefetchError;
6691
+ const unavailable = view === void 0 && httpStatus(error) === 404;
6692
+ const errorMessage = error === void 0 ? void 0 : unavailable ? t("planManagerUnavailable") : cardError === void 0 ? t("planManagerCreditsError") : t("planManagerError");
6693
+ const retry = () => {
6694
+ for (const handle of showCredits ? [company, usage, credits] : [company, usage]) {
6695
+ if (handle.error !== void 0) {
6696
+ handle.refetch();
6697
+ }
6698
+ }
6699
+ };
6700
+ const Heading = `h${headingLevel}`;
6701
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6702
+ StatusFrame,
6703
+ {
6704
+ className: cx("schematic-plan-manager", className),
6705
+ error,
6706
+ errorMessage,
6707
+ hasData: view !== void 0,
6708
+ isPending: company.isPending || usage.isPending || credits.isPending,
6709
+ loadingLabel: t("planManagerLoading"),
6710
+ onRetry: retry,
6711
+ retryText: t("retry"),
6712
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlanManagerSkeleton, {}),
6713
+ children: view !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
6714
+ showNotice && view.notice !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Notice, { locale, notice: view.notice, t }),
6715
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-card schematic-plan-manager__card", children: [
6716
+ showHeader && view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__plan", children: [
6717
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__title", children: [
6718
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { className: "schematic-plan-manager__name", children: view.plan.name }),
6719
+ showDescription && view.plan.description !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "schematic-plan-manager__description", children: view.plan.description })
6720
+ ] }),
6721
+ showPrice && view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Price, { price: view.plan.price, t })
6722
+ ] }),
6723
+ showAddOns && view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Section, { label: t("planManagerAddOns"), showLabel: showLabels, children: view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { className: "schematic-plan-manager__row", children: [
6724
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-plan-manager__item", children: addOn.name }),
6725
+ addOn.price !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "schematic-plan-manager__price-value", children: [
6726
+ addOn.price.amount,
6727
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PeriodSuffix, { period: addOn.price.period, t })
6728
+ ] })
6729
+ ] }, addOn.id)) }),
6730
+ showUsageBased && view.usageBased.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6731
+ Section,
6732
+ {
6733
+ label: t("planManagerUsageBased"),
6734
+ showLabel: showLabels,
6735
+ children: view.usageBased.map((row) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6736
+ UsageBasedItem,
6737
+ {
6738
+ locale,
6739
+ row,
6740
+ showHardLimit,
6741
+ t
6742
+ },
6743
+ row.featureId
6744
+ ))
6745
+ }
6746
+ ),
6747
+ showCredits && credits.data === void 0 && creditsHaveFailed && (credits.error !== void 0 || credits.isPending) && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6748
+ StatusFrame,
6749
+ {
6750
+ className: "schematic-plan-manager__section",
6751
+ error: credits.error,
6752
+ errorMessage: t("planManagerCreditsError"),
6753
+ hasData: false,
6754
+ isPending: credits.isPending,
6755
+ loadingLabel: t("planManagerCreditsLoading"),
6756
+ onRetry: credits.refetch,
6757
+ retryText: t("retry"),
6758
+ children: null
6759
+ }
6760
+ ),
6761
+ showCredits && view.planCredits.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6762
+ Truncated,
6763
+ {
6764
+ locale,
6765
+ after: view.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6766
+ AutoTopupBox,
6767
+ {
6768
+ lines: view.autoTopup.lines,
6769
+ onEdit: onEditAutoTopup,
6770
+ t,
6771
+ target: editAutoTopupTarget,
6772
+ url: editAutoTopupUrl
6773
+ }
6774
+ ),
6775
+ label: t("planManagerCreditsInPlan"),
6776
+ rows: view.planCredits,
6777
+ showLabel: showLabels,
6778
+ t,
6779
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PlanCreditItem, { row, t }, row.creditId)
6780
+ }
6781
+ ),
6782
+ showCredits && view.topUps.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6783
+ Truncated,
6784
+ {
6785
+ locale,
6786
+ label: t("planManagerTopUps"),
6787
+ rows: view.topUps,
6788
+ showLabel: showLabels,
6789
+ t,
6790
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CreditGroupItem, { countAlways: true, row, t }, row.key)
6791
+ }
6792
+ ),
6793
+ showCredits && view.bundles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6794
+ Truncated,
6795
+ {
6796
+ locale,
6797
+ label: t("planManagerCreditBundles"),
6798
+ rows: view.bundles,
6799
+ showLabel: showLabels,
6800
+ t,
6801
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CreditGroupItem, { row, t }, row.key)
6802
+ }
6803
+ ),
6804
+ showCredits && view.promotional.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6805
+ Truncated,
6806
+ {
6807
+ locale,
6808
+ label: t("planManagerPromotionalCredits"),
6809
+ rows: view.promotional,
6810
+ showLabel: showLabels,
6811
+ t,
6812
+ children: (row) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CreditGroupItem, { plain: true, row, t }, row.key)
6813
+ }
6814
+ ),
6815
+ view.canChangePlan && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6816
+ Cta,
6817
+ {
6818
+ className: "schematic-cta schematic-plan-manager__change-plan",
6819
+ label: t("planManagerChangePlan"),
6820
+ onClick: onChangePlan,
6821
+ target: changePlanTarget,
6822
+ url: changePlanUrl
6823
+ }
6824
+ )
6825
+ ] })
6826
+ ] })
6827
+ }
6828
+ );
6829
+ }
6830
+ function Notice({
6831
+ locale,
6832
+ notice: notice2,
6833
+ t
6834
+ }) {
6835
+ let title = null;
6836
+ let body = null;
6837
+ let payUrl = null;
6838
+ switch (notice2.kind) {
6839
+ case "trial":
6840
+ title = notice2.endsIn === null ? null : notice2.endsIn === "soon" ? t("planManagerTrialEndsSoon") : notice2.endsIn === "ended" ? t("planManagerTrialEnded") : t("planManagerTrialEndsIn", {
6841
+ amount: formatNumber(notice2.endsIn.amount, locale),
6842
+ units: t(UNIT_KEY[notice2.endsIn.unit], {
6843
+ count: notice2.endsIn.amount
6844
+ })
6845
+ });
6846
+ break;
6847
+ case "canceled":
6848
+ title = t("planManagerCanceled");
6849
+ body = notice2.date === null ? null : t("planManagerAccessEnds", {
6850
+ date: notice2.date,
6851
+ plan: notice2.planName ?? t("planManagerPlanFallback")
6852
+ });
6853
+ break;
6854
+ case "customPlanBilling": {
6855
+ const plan = notice2.planName ?? t("planManagerYourPlan");
6856
+ title = notice2.awaitingActivation ? t("planManagerCustomAwaiting", { plan }) : t("planManagerCustomDue", { date: notice2.date, plan });
6857
+ body = notice2.awaitingActivation ? t("planManagerCustomAwaitingDescription", { date: notice2.date }) : t("planManagerCustomDueDescription", { date: notice2.date, plan });
6858
+ payUrl = notice2.invoiceUrl;
6859
+ break;
6860
+ }
6861
+ case "scheduledDowngrade":
6862
+ title = t("planManagerDowngradeScheduled", { plan: notice2.toPlanName });
6863
+ body = notice2.date === null ? null : t("planManagerAccessEnds", {
6864
+ date: notice2.date,
6865
+ plan: notice2.fromPlanName
6866
+ });
6867
+ break;
6868
+ }
6869
+ if (title === null && body === null) {
6870
+ return null;
6871
+ }
6872
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6873
+ "div",
6874
+ {
6875
+ className: "schematic-plan-manager__notice",
6876
+ "data-kind": notice2.kind,
6877
+ role: "status",
6878
+ children: [
6879
+ title !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "schematic-plan-manager__notice-title", children: title }),
6880
+ body !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "schematic-small schematic-plan-manager__notice-body", children: body }),
6881
+ payUrl !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6882
+ "a",
6883
+ {
6884
+ className: "schematic-cta schematic-plan-manager__pay-now",
6885
+ href: payUrl,
6886
+ rel: "noreferrer",
6887
+ target: "_blank",
6888
+ children: t("planManagerPayNow")
6889
+ }
6890
+ )
6891
+ ]
6892
+ }
6893
+ );
6894
+ }
6895
+ function Price({ price, t }) {
6896
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__price", children: [
6897
+ price.kind === "usageBased" ? t("planManagerUsageBased") : price.kind === "free" ? t("planManagerFree") : price.amount,
6898
+ price.kind === "amount" && price.period !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(PeriodSuffix, { period: price.period, t })
6899
+ ] });
6900
+ }
6901
+ function PeriodSuffix({ period, t }) {
6902
+ const short = shortPeriod(period, t);
6903
+ return short === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("sub", { children: [
6904
+ "/",
6905
+ short
6906
+ ] });
6907
+ }
6908
+ function Section({
6909
+ children,
6910
+ label,
6911
+ showLabel
6912
+ }) {
6913
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
6914
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
6915
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "schematic-plan-manager__rows", children })
6916
+ ] });
6917
+ }
6918
+ function Truncated({
6919
+ after,
6920
+ children,
6921
+ label,
6922
+ locale,
6923
+ rows,
6924
+ showLabel,
6925
+ t
6926
+ }) {
6927
+ const [expanded, setExpanded] = (0, import_react9.useState)(false);
6928
+ const shown = expanded ? rows : rows.slice(0, VISIBLE_CREDIT_COUNT);
6929
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { "aria-label": label, className: "schematic-plan-manager__section", children: [
6930
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-muted schematic-plan-manager__label", children: label }),
6931
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "schematic-plan-manager__rows", children: shown.map(children) }),
6932
+ rows.length > VISIBLE_CREDIT_COUNT && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6933
+ "button",
6934
+ {
6935
+ "aria-expanded": expanded,
6936
+ className: "schematic-link-button schematic-plan-manager__see-all",
6937
+ type: "button",
6938
+ onClick: () => setExpanded((value) => !value),
6939
+ children: [
6940
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6941
+ "i",
6942
+ {
6943
+ "aria-hidden": "true",
6944
+ className: `schematic-icon schematic-icon--${expanded ? "chevron-up" : "chevron-down"} schematic-chevron`
6945
+ }
6946
+ ),
6947
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-link-button__label", children: expanded ? t("planManagerHideAll") : t("planManagerSeeAll", {
6948
+ total: formatNumber(rows.length, locale)
6949
+ }) })
6950
+ ]
6951
+ }
6952
+ ),
6953
+ after
6954
+ ] });
6955
+ }
6956
+ function UsageBasedItem({
6957
+ locale,
6958
+ row,
6959
+ showHardLimit,
6960
+ t
6961
+ }) {
6962
+ const details = [];
6963
+ if (row.additional) {
6964
+ details.push(`${t("planManagerAdditional")}: `);
6965
+ }
6966
+ if (row.tierBased) {
6967
+ details.push(t("planManagerTierBased"));
6968
+ }
6969
+ if (row.unitPrice !== null) {
6970
+ const short = row.unitPrice.period === null ? void 0 : shortPeriod(row.unitPrice.period, t);
6971
+ details.push(
6972
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
6973
+ row.unitPrice.cost,
6974
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("sub", { children: [
6975
+ "/",
6976
+ row.unitPrice.packageSize !== null && `${row.unitPrice.packageSize} `,
6977
+ row.unitPrice.units,
6978
+ short !== void 0 && `/${short}`
6979
+ ] })
6980
+ ] }, "price")
6981
+ );
6982
+ }
6983
+ if (row.perUse !== null) {
6984
+ details.push(
6985
+ t("usagePerUse", { amount: row.perUse.amount, units: row.perUse.units })
6986
+ );
6987
+ }
6988
+ const costPeriod = row.cost?.period === null || row.cost === null ? void 0 : shortPeriod(row.cost.period, t);
6989
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6990
+ "li",
6991
+ {
6992
+ className: "schematic-plan-manager__row",
6993
+ "data-testid": "schematic-usage-based",
6994
+ children: [
6995
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-plan-manager__item", children: row.quantity === null ? row.name : `${row.quantity.amount} ${row.quantity.units}` }),
6996
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "schematic-plan-manager__detail", children: [
6997
+ details.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-muted schematic-small", children: details }),
6998
+ row.cost !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
6999
+ row.cost.amount,
7000
+ costPeriod !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("sub", { children: [
7001
+ "/",
7002
+ costPeriod
7003
+ ] })
7004
+ ] }),
7005
+ row.tiers !== null && row.tiers.ranges.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tooltip, { label: t("usageTieredPricingLabel"), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
7006
+ PriceTiers,
7007
+ {
7008
+ currency: row.tiers.currency,
7009
+ locale,
7010
+ mode: row.tiers.mode,
7011
+ period: row.tiers.period,
7012
+ ranges: row.tiers.ranges,
7013
+ t,
7014
+ unit: row.tiers.unit
7015
+ }
7016
+ ) }),
7017
+ showHardLimit && row.hardLimit !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tooltip, { label: t("usageHardLimitLabel"), children: t("usageHardLimit", {
7018
+ amount: row.hardLimit.amount,
7019
+ units: row.hardLimit.units
7020
+ }) })
7021
+ ] })
7022
+ ]
7023
+ }
7024
+ );
7025
+ }
7026
+ function PlanCreditItem({ row, t }) {
7027
+ const text = row.text;
7028
+ const composition = row.composition;
7029
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7030
+ "li",
7031
+ {
7032
+ className: "schematic-plan-manager__row schematic-plan-manager__row--stacked",
7033
+ "data-testid": "schematic-plan-credit",
7034
+ children: [
7035
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__row-main", children: [
7036
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-plan-manager__item", children: text.kind === "perLicense" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
7037
+ t("planManagerCreditsPerLicense", {
7038
+ amount: text.amount,
7039
+ creditName: text.creditName,
7040
+ licenseName: text.licenseName
7041
+ }),
7042
+ text.plus !== null && ` ${t("planManagerCreditsPlusPerPeriod", {
7043
+ amount: text.plus.amount,
7044
+ creditName: text.plus.creditName,
7045
+ period: periodWord(text.plus.period, t)
7046
+ })}`
7047
+ ] }) : text.period === null ? t("planManagerCredits", {
7048
+ amount: text.amount,
7049
+ creditName: text.creditName
7050
+ }) : t("planManagerCreditsPerPeriod", {
7051
+ amount: text.amount,
7052
+ creditName: text.creditName,
7053
+ period: periodWord(text.period, t)
7054
+ }) }),
7055
+ row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: [
7056
+ t("planManagerUsed", { amount: row.used }),
7057
+ row.autoTopup !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Tooltip, { label: t("planManagerAutoTopup"), children: t("planManagerAutoTopupTip", {
7058
+ amount: row.autoTopup.amount,
7059
+ threshold: row.autoTopup.threshold
7060
+ }) })
7061
+ ] })
7062
+ ] }),
7063
+ composition !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-muted schematic-small", children: t(
7064
+ composition.fixed === null ? "planManagerLicensesTimesCredits" : "planManagerLicensesTimesCreditsPlusCompany",
7065
+ {
7066
+ creditName: composition.creditName,
7067
+ fixed: composition.fixed ?? void 0,
7068
+ licenseName: composition.licenseName,
7069
+ period: shortPeriod(composition.period, t) ?? periodWord(composition.period, t),
7070
+ perUnit: composition.perUnit,
7071
+ quantity: composition.quantity,
7072
+ total: composition.total
7073
+ }
7074
+ ) })
7075
+ ]
7076
+ }
7077
+ );
7078
+ }
7079
+ function CreditGroupItem({
7080
+ countAlways = false,
7081
+ plain = false,
7082
+ row,
7083
+ t
7084
+ }) {
7085
+ const named = !plain && row.bundleName !== null;
7086
+ const showCount = !plain && row.count > 1 && (named || countAlways);
7087
+ const amount = `${row.quantity} ${row.creditName}`;
7088
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7089
+ "li",
7090
+ {
7091
+ className: "schematic-plan-manager__row",
7092
+ "data-testid": "schematic-credit-group",
7093
+ children: [
7094
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "schematic-plan-manager__item", children: [
7095
+ showCount && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "schematic-muted", children: [
7096
+ "(",
7097
+ row.count,
7098
+ ") "
7099
+ ] }),
7100
+ named ? `${row.bundleName} (${amount})` : amount
7101
+ ] }),
7102
+ row.used !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-muted schematic-small schematic-plan-manager__used", children: t("planManagerUsed", { amount: row.used }) })
7103
+ ]
7104
+ }
7105
+ );
7106
+ }
7107
+ function AutoTopupBox({
7108
+ lines,
7109
+ onEdit,
7110
+ t,
7111
+ target,
7112
+ url
7113
+ }) {
7114
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__auto-topup", children: [
7115
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-plan-manager__auto-topup-lines", children: [
7116
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-plan-manager__item", children: t("planManagerAutoTopup") }),
7117
+ lines.map((line) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: line.kind === "disabled" ? t("planManagerAutoTopupDisabled", { unit: line.unit }) : t("planManagerAutoTopupAdds", {
7118
+ amount: line.amount,
7119
+ threshold: line.threshold,
7120
+ unit: line.unit
7121
+ }) }, line.creditId))
7122
+ ] }),
7123
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
7124
+ Cta,
7125
+ {
7126
+ className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-plan-manager__edit",
7127
+ label: t("planManagerEdit"),
7128
+ onClick: onEdit,
7129
+ target,
7130
+ url
7131
+ }
7132
+ )
7133
+ ] });
7134
+ }
7135
+ function Cta({
7136
+ className,
7137
+ label,
7138
+ onClick,
7139
+ target,
7140
+ url
7141
+ }) {
7142
+ if (onClick !== void 0) {
7143
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { className, type: "button", onClick, children: label });
7144
+ }
7145
+ if (url !== void 0) {
7146
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { className, href: url, target, children: label });
7147
+ }
7148
+ return null;
7149
+ }
7150
+ function periodWord(period, t) {
7151
+ const key = PERIOD_KEY[period];
7152
+ return key === void 0 ? period : t(key);
7153
+ }
7154
+ function PlanManagerSkeleton() {
7155
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-skeleton", children: [
7156
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__heading" }),
7157
+ [0, 1].map((index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-skeleton__row", children: [
7158
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "name" }),
7159
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "price" })
7160
+ ] }, index))
7161
+ ] });
7162
+ }
7163
+ PlanManager.resources = ["company", "featureUsage", "creditBalances"];
7164
+
7165
+ // src/elements/UnsubscribeButton.tsx
7166
+ var import_schematic_react9 = require("@schematichq/schematic-react");
7167
+ var import_react10 = require("react");
7168
+ var import_jsx_runtime11 = require("react/jsx-runtime");
7169
+ var TOTAL_KEY = {
7170
+ quarter: "unsubscribeQuarterlyTotal",
7171
+ year: "unsubscribeYearlyTotal"
7172
+ };
7173
+ function UnsubscribeButton({
7174
+ className,
7175
+ locale: localeProp,
7176
+ managePlanTarget,
7177
+ managePlanUrl,
7178
+ onManagePlan,
7179
+ onUnsubscribed,
7180
+ strings
7181
+ }) {
7182
+ const company = (0, import_schematic_react9.useCompany)();
7183
+ const usage = (0, import_schematic_react9.useFeatureUsage)();
7184
+ const { isMutating, unsubscribe } = (0, import_schematic_react9.useUnsubscribe)();
7185
+ const locale = useResolvedLocale(localeProp);
7186
+ const t = useTranslator(strings, localeProp);
7187
+ const [open, setOpen] = (0, import_react10.useState)(false);
7188
+ const [failed, setFailed] = (0, import_react10.useState)(false);
7189
+ const view = (0, import_react10.useMemo)(
7190
+ () => company.data === void 0 || usage.data === void 0 ? void 0 : deriveUnsubscribe(company.data, usage.data, { locale }),
7191
+ [company.data, locale, usage.data]
7192
+ );
7193
+ if (view === void 0) {
7194
+ const error = company.error ?? usage.error;
7195
+ if (error === void 0) {
7196
+ return null;
7197
+ }
7198
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7199
+ StatusFrame,
7200
+ {
7201
+ className: cx("schematic-card", "schematic-unsubscribe", className),
7202
+ error,
7203
+ errorMessage: httpStatus(error) === 404 ? t("unsubscribeUnavailable") : t("unsubscribeError"),
7204
+ hasData: false,
7205
+ isPending: false,
7206
+ loadingLabel: "",
7207
+ onRetry: () => {
7208
+ for (const handle of [company, usage]) {
7209
+ if (handle.error !== void 0) {
7210
+ handle.refetch();
7211
+ }
7212
+ }
7213
+ },
7214
+ retryText: t("retry"),
7215
+ children: null
7216
+ }
7217
+ );
7218
+ }
7219
+ if (!view.canUnsubscribe && !open) {
7220
+ return null;
7221
+ }
7222
+ const close = () => {
7223
+ setOpen(false);
7224
+ setFailed(false);
7225
+ };
7226
+ const confirm = async () => {
7227
+ setFailed(false);
7228
+ try {
7229
+ await unsubscribe();
7230
+ } catch {
7231
+ setFailed(true);
7232
+ return;
7233
+ }
7234
+ setOpen(false);
7235
+ onUnsubscribed?.();
7236
+ };
7237
+ const per = shortPeriod(view.period, t);
7238
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cx("schematic-card", "schematic-unsubscribe", className), children: [
7239
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7240
+ "button",
7241
+ {
7242
+ className: "schematic-cta schematic-unsubscribe__open",
7243
+ type: "button",
7244
+ onClick: () => {
7245
+ setFailed(false);
7246
+ setOpen(true);
7247
+ },
7248
+ children: t("unsubscribeButton")
7249
+ }
7250
+ ),
7251
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7252
+ Dialog,
7253
+ {
7254
+ className: "schematic-unsubscribe__dialog",
7255
+ closeLabel: t("unsubscribeClose"),
7256
+ open,
7257
+ title: t("unsubscribeTitle"),
7258
+ onClose: close,
7259
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__columns", children: [
7260
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__summary", children: [
7261
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: t("unsubscribeAccessUntil", { date: view.accessEndsOn }) }),
7262
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7263
+ ManagePlan,
7264
+ {
7265
+ onClick: onManagePlan,
7266
+ t,
7267
+ target: managePlanTarget,
7268
+ url: managePlanUrl
7269
+ }
7270
+ )
7271
+ ] }),
7272
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__sidebar", children: [
7273
+ view.plan !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
7274
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribePlan") }),
7275
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
7276
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-unsubscribe__name", children: view.plan.name }),
7277
+ view.plan.price !== null && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
7278
+ view.plan.price,
7279
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
7280
+ "/",
7281
+ per
7282
+ ] })
7283
+ ] })
7284
+ ] })
7285
+ ] }),
7286
+ view.addOns.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__group", children: [
7287
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted schematic-small", children: t("unsubscribeAddOns") }),
7288
+ view.addOns.map((addOn) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__line", children: [
7289
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-unsubscribe__name", children: addOn.name }),
7290
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
7291
+ addOn.price,
7292
+ !addOn.oneTime && per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
7293
+ "/",
7294
+ per
7295
+ ] })
7296
+ ] })
7297
+ ] }, addOn.id))
7298
+ ] }),
7299
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__line schematic-unsubscribe__total", children: [
7300
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "schematic-muted", children: t(TOTAL_KEY[view.period] ?? "unsubscribeMonthlyTotal") }),
7301
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
7302
+ view.total,
7303
+ per !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("sub", { children: [
7304
+ "/",
7305
+ per
7306
+ ] })
7307
+ ] })
7308
+ ] }),
7309
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7310
+ "button",
7311
+ {
7312
+ className: "schematic-cta schematic-unsubscribe__confirm",
7313
+ disabled: isMutating,
7314
+ type: "button",
7315
+ onClick: () => void confirm(),
7316
+ children: t("unsubscribeConfirm")
7317
+ }
7318
+ ),
7319
+ failed && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "schematic-error", role: "alert", children: t("unsubscribeFailed") })
7320
+ ] })
7321
+ ] })
7322
+ }
7323
+ )
7324
+ ] });
7325
+ }
7326
+ function ManagePlan({
7327
+ onClick,
7328
+ t,
7329
+ target,
7330
+ url
7331
+ }) {
7332
+ if (onClick === void 0 && url === void 0) {
7333
+ return null;
7334
+ }
7335
+ const label = t("unsubscribeManagePlan");
7336
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "schematic-unsubscribe__manage", children: [
7337
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: t("unsubscribeNotReady") }),
7338
+ onClick !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7339
+ "button",
7340
+ {
7341
+ className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
7342
+ type: "button",
7343
+ onClick,
7344
+ children: label
7345
+ }
7346
+ ) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
7347
+ "a",
7348
+ {
7349
+ className: "schematic-cta schematic-cta--small schematic-cta--ghost schematic-unsubscribe__manage-plan",
7350
+ href: url,
7351
+ target,
7352
+ children: label
7353
+ }
7354
+ )
7355
+ ] });
7356
+ }
7357
+ UnsubscribeButton.resources = ["company", "featureUsage"];
7358
+
7359
+ // src/elements/UpcomingBill.tsx
7360
+ var import_schematic_react10 = require("@schematichq/schematic-react");
7361
+ var import_react11 = require("react");
7362
+ var import_jsx_runtime12 = require("react/jsx-runtime");
7363
+ function UpcomingBill({
5863
7364
  className,
5864
7365
  headingLevel = 2,
5865
7366
  locale: localeProp,
@@ -5869,10 +7370,10 @@ function UpcomingBill({
5869
7370
  showHeader = true,
5870
7371
  strings
5871
7372
  }) {
5872
- const { data: invoice, error, isPending, refetch } = (0, import_schematic_react8.useUpcomingInvoice)();
7373
+ const { data: invoice, error, isPending, refetch } = (0, import_schematic_react10.useUpcomingInvoice)();
5873
7374
  const locale = useResolvedLocale(localeProp);
5874
7375
  const t = useTranslator(strings, localeProp);
5875
- const bill = (0, import_react9.useMemo)(
7376
+ const bill = (0, import_react11.useMemo)(
5876
7377
  () => invoice === void 0 || invoice === null ? null : deriveUpcomingInvoice(invoice, { locale }),
5877
7378
  [invoice, locale]
5878
7379
  );
@@ -5881,7 +7382,7 @@ function UpcomingBill({
5881
7382
  const discountRow = showDiscounts && bill !== null && bill.discounts.length > 0;
5882
7383
  const unavailable = invoice === void 0 && httpStatus(error) === 404;
5883
7384
  const errorMessage = error === void 0 ? void 0 : unavailable ? t("upcomingBillUnavailable") : t("upcomingBillError");
5884
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
7385
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5885
7386
  StatusFrame,
5886
7387
  {
5887
7388
  className: cx("schematic-card", "schematic-upcoming-bill", className),
@@ -5892,11 +7393,11 @@ function UpcomingBill({
5892
7393
  loadingLabel: t("upcomingBillLoading"),
5893
7394
  onRetry: refetch,
5894
7395
  retryText: t("retry"),
5895
- skeleton: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(UpcomingBillSkeleton, { showHeader }),
5896
- children: bill === null ? invoice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [
5897
- showHeader && bill.dueAt !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
5898
- showAmount && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-upcoming-bill__amount", children: [
5899
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
7396
+ skeleton: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(UpcomingBillSkeleton, { showHeader }),
7397
+ children: bill === null ? invoice !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "schematic-muted schematic-upcoming-bill__empty", children: t("upcomingBillEmpty") }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
7398
+ showHeader && bill.dueAt !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-header", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Heading, { className: "schematic-header__title", children: t("upcomingBillHeader", { date: bill.dueAt.text }) }) }),
7399
+ showAmount && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-upcoming-bill__amount", children: [
7400
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5900
7401
  "span",
5901
7402
  {
5902
7403
  className: "schematic-upcoming-bill__total",
@@ -5904,46 +7405,46 @@ function UpcomingBill({
5904
7405
  children: bill.amountDueText
5905
7406
  }
5906
7407
  ),
5907
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
7408
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-small schematic-upcoming-bill__estimate", children: t("upcomingBillEstimate") })
5908
7409
  ] }),
5909
- (balanceRows || discountRow) && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-upcoming-bill__rows", children: [
5910
- balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7410
+ (balanceRows || discountRow) && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-upcoming-bill__rows", children: [
7411
+ balanceRows && bill.balanceApplied !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5911
7412
  "div",
5912
7413
  {
5913
7414
  className: "schematic-row schematic-upcoming-bill__balance-applied",
5914
7415
  "data-testid": "schematic-balance-applied",
5915
7416
  children: [
5916
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
5917
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
7417
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceApplied") }),
7418
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-row__value", children: bill.balanceApplied.amountText })
5918
7419
  ]
5919
7420
  }
5920
7421
  ),
5921
- balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7422
+ balanceRows && bill.balanceRemaining !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5922
7423
  "div",
5923
7424
  {
5924
7425
  className: "schematic-row schematic-upcoming-bill__balance-remaining",
5925
7426
  "data-testid": "schematic-balance-remaining",
5926
7427
  children: [
5927
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
5928
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
7428
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillBalanceRemaining") }),
7429
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-row__value", children: bill.balanceRemaining.amountText })
5929
7430
  ]
5930
7431
  }
5931
7432
  ),
5932
- discountRow && /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7433
+ discountRow && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5933
7434
  "div",
5934
7435
  {
5935
7436
  className: "schematic-row schematic-upcoming-bill__discount-row",
5936
7437
  "data-testid": "schematic-discounts",
5937
7438
  children: [
5938
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
5939
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
7439
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-row__label", children: t("upcomingBillDiscount") }),
7440
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "schematic-row__value schematic-upcoming-bill__discounts", children: bill.discounts.map((discount, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5940
7441
  "li",
5941
7442
  {
5942
7443
  className: "schematic-upcoming-bill__discount",
5943
7444
  "data-testid": "schematic-discount",
5944
7445
  children: [
5945
- discount.code !== null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
5946
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
7446
+ discount.code !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-chip schematic-upcoming-bill__code", children: discount.code }),
7447
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "schematic-upcoming-bill__discount-value", children: discountText(discount, t) })
5947
7448
  ]
5948
7449
  },
5949
7450
  `${discount.couponName}-${index}`
@@ -5957,10 +7458,10 @@ function UpcomingBill({
5957
7458
  );
5958
7459
  }
5959
7460
  function UpcomingBillSkeleton({ showHeader }) {
5960
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "schematic-skeleton", children: [
5961
- showHeader && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__heading" }),
5962
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
5963
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
7461
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "schematic-skeleton", children: [
7462
+ showHeader && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__heading" }),
7463
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "amount" }) }),
7464
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__row", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "schematic-skeleton__cell", "data-column": "row" }) })
5964
7465
  ] });
5965
7466
  }
5966
7467
  function discountText(discount, t) {