@schematichq/schematic-components 2.32.0 → 2.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-components-elements.cjs.js +838 -258
- package/dist/schematic-components-elements.d.ts +174 -10
- package/dist/schematic-components-elements.esm.js +805 -220
- package/dist/schematic-components.browser.cjs.js +247 -32
- package/dist/schematic-components.browser.esm.js +247 -32
- package/dist/schematic-components.cjs.js +247 -32
- package/dist/schematic-components.d.ts +127 -0
- package/dist/schematic-components.esm.js +247 -32
- package/package.json +6 -6
|
@@ -4,6 +4,11 @@ import { BillingDataProvider } from '@schematichq/schematic-react';
|
|
|
4
4
|
import { BillingDataProviderProps } from '@schematichq/schematic-react';
|
|
5
5
|
import { BillingDataStatus } from '@schematichq/schematic-react';
|
|
6
6
|
import { BillingResourceName } from '@schematichq/schematic-react';
|
|
7
|
+
import { CreditBalanceEntry } from '@schematichq/schematic-react';
|
|
8
|
+
import { CreditComposition } from '@schematichq/schematic-react';
|
|
9
|
+
import { CreditGrant } from '@schematichq/schematic-react';
|
|
10
|
+
import { CreditUserUsage } from '@schematichq/schematic-react';
|
|
11
|
+
import { CreditUserUsageRow } from '@schematichq/schematic-react';
|
|
7
12
|
import { Discount } from '@schematichq/schematic-react';
|
|
8
13
|
import { FEATURE_USER_USAGE_LIMIT } from '@schematichq/schematic-react';
|
|
9
14
|
import { FeatureUsage } from '@schematichq/schematic-react';
|
|
@@ -27,6 +32,8 @@ import { SetupIntent } from '@schematichq/schematic-react';
|
|
|
27
32
|
import { SetupIntentHandle } from '@schematichq/schematic-react';
|
|
28
33
|
import type { Translate } from '@schematichq/schematic-react';
|
|
29
34
|
import { UpcomingInvoice } from '@schematichq/schematic-react';
|
|
35
|
+
import { useCreditBalances } from '@schematichq/schematic-react';
|
|
36
|
+
import { useCreditUserUsage } from '@schematichq/schematic-react';
|
|
30
37
|
import { useFeatureUsage } from '@schematichq/schematic-react';
|
|
31
38
|
import { useFeatureUserUsage } from '@schematichq/schematic-react';
|
|
32
39
|
import { useInvalidateBillingData } from '@schematichq/schematic-react';
|
|
@@ -66,6 +73,129 @@ export declare interface BillLine {
|
|
|
66
73
|
amountText: string;
|
|
67
74
|
}
|
|
68
75
|
|
|
76
|
+
export { CreditBalanceEntry }
|
|
77
|
+
|
|
78
|
+
export { CreditComposition }
|
|
79
|
+
|
|
80
|
+
export declare interface CreditCompositionLine {
|
|
81
|
+
/** Credits per period in all. */
|
|
82
|
+
total: string;
|
|
83
|
+
creditName: string;
|
|
84
|
+
/** A period key: "day", "week", "month" or "year". */
|
|
85
|
+
period: string;
|
|
86
|
+
/** "12 Seats × 10". */
|
|
87
|
+
perLicense: {
|
|
88
|
+
quantity: string;
|
|
89
|
+
licenseName: string;
|
|
90
|
+
perUnit: string;
|
|
91
|
+
};
|
|
92
|
+
/** The flat company grant on top; `null` when there is none. */
|
|
93
|
+
companyGrant: string | null;
|
|
94
|
+
/** "1st", "22nd": the day of the month the next bill is due. */
|
|
95
|
+
renewsOn: string | null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { CreditGrant }
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* `deriveCreditUsage`: the company's credit balances as the cards show them,
|
|
102
|
+
* with numbers, names and dates formatted here. The wording is the
|
|
103
|
+
* element's, keyed by `kind`.
|
|
104
|
+
*/
|
|
105
|
+
/** Why credits were granted, as the ledger words it. */
|
|
106
|
+
export declare type CreditGrantKind = "plan" | "bundle" | "autoTopup" | "promotional";
|
|
107
|
+
|
|
108
|
+
export declare interface CreditLedgerRow {
|
|
109
|
+
id: string;
|
|
110
|
+
kind: CreditGrantKind;
|
|
111
|
+
/** Credits granted. */
|
|
112
|
+
amount: string;
|
|
113
|
+
/** The credit's name for `amount`; a bundle is named in the singular. */
|
|
114
|
+
item: string;
|
|
115
|
+
/** "Sep 1, 2026". */
|
|
116
|
+
createdAt: string;
|
|
117
|
+
/** When the grant refreshes, or when it runs out; `null` for neither. */
|
|
118
|
+
date: {
|
|
119
|
+
kind: "resets" | "expires";
|
|
120
|
+
text: string;
|
|
121
|
+
} | null;
|
|
122
|
+
source: CreditGrant;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The company's credit balances, a card each: what is left, the grants
|
|
127
|
+
* behind it, how the plan's grants add up, and who on the team spent it.
|
|
128
|
+
*
|
|
129
|
+
* A company with no credits, and a plan that draws on none, renders
|
|
130
|
+
* nothing. A 404 means the account is not enabled for company reads, and
|
|
131
|
+
* the element says so.
|
|
132
|
+
*/
|
|
133
|
+
export declare function CreditUsage({ buyMoreTarget, buyMoreUrl, className, headingLevel, locale: localeProp, onBuyMore, showDescription, showExpiration, showHeader, showIcon, showUsage, showUsageByUser, strings, visibleCredits, }: CreditUsageProps): JSX.Element | null;
|
|
134
|
+
|
|
135
|
+
export declare namespace CreditUsage {
|
|
136
|
+
var resources: readonly ["creditBalances"];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export declare interface CreditUsageProps extends ElementProps {
|
|
140
|
+
/** The "Credits" heading above the cards. Default false, as in the embed. */
|
|
141
|
+
showHeader?: boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Heading level; each credit's name sits one below while the heading
|
|
144
|
+
* shows, and takes it when the heading is hidden. Names stay h6 under an
|
|
145
|
+
* h6 heading, as HTML has no h7. Default 2.
|
|
146
|
+
*/
|
|
147
|
+
headingLevel?: HeadingLevel;
|
|
148
|
+
/** Each credit's icon; the circle is held even without one. Default true. */
|
|
149
|
+
showIcon?: boolean;
|
|
150
|
+
/** Each credit's description. Default true. */
|
|
151
|
+
showDescription?: boolean;
|
|
152
|
+
/** When each grant expires or resets, in its balance details. Default true. */
|
|
153
|
+
showExpiration?: boolean;
|
|
154
|
+
/** What is left of each credit. Default true. */
|
|
155
|
+
showUsage?: boolean;
|
|
156
|
+
/** The breakdown of consumption by user. Default true. */
|
|
157
|
+
showUsageByUser?: boolean;
|
|
158
|
+
/** Credit ids to show, in this order; every credit when absent. */
|
|
159
|
+
visibleCredits?: string[];
|
|
160
|
+
/**
|
|
161
|
+
* "Buy More" on a credit a bundle sells calls this. Without it or
|
|
162
|
+
* `buyMoreUrl` there is no button.
|
|
163
|
+
*/
|
|
164
|
+
onBuyMore?: (credit: CreditBalanceEntry) => void;
|
|
165
|
+
/** "Buy More" links here when there is no `onBuyMore`. */
|
|
166
|
+
buyMoreUrl?: string;
|
|
167
|
+
/** `target` for `buyMoreUrl`. */
|
|
168
|
+
buyMoreTarget?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export declare interface CreditUsageRow {
|
|
172
|
+
creditId: string;
|
|
173
|
+
name: string;
|
|
174
|
+
description: string | null;
|
|
175
|
+
/** A schematic-icons glyph name; `null` when the credit has none. */
|
|
176
|
+
icon: string | null;
|
|
177
|
+
/** What is left, to ten fraction digits, and the credit's name for it. */
|
|
178
|
+
remaining: {
|
|
179
|
+
amount: string;
|
|
180
|
+
units: string;
|
|
181
|
+
};
|
|
182
|
+
purchasable: boolean;
|
|
183
|
+
/** Newest first. Empty for a plan credit the company holds none of. */
|
|
184
|
+
ledger: CreditLedgerRow[];
|
|
185
|
+
composition: CreditCompositionLine | null;
|
|
186
|
+
/** The credit's names, for a host labelling amounts itself. */
|
|
187
|
+
unit: {
|
|
188
|
+
name: string;
|
|
189
|
+
singularName?: string;
|
|
190
|
+
pluralName?: string;
|
|
191
|
+
};
|
|
192
|
+
source: CreditBalanceEntry;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export { CreditUserUsage }
|
|
196
|
+
|
|
197
|
+
export { CreditUserUsageRow }
|
|
198
|
+
|
|
69
199
|
/**
|
|
70
200
|
* The tier a row's usage sits in. For overage, the tier past the soft limit
|
|
71
201
|
* of a two-tier price, which is how an overage price is built; for tiered
|
|
@@ -89,6 +219,14 @@ export declare function currentTier(row: FeatureUsage): TierRange | null;
|
|
|
89
219
|
*/
|
|
90
220
|
export declare const DEFAULT_STRINGS: ElementStrings & StringCatalog;
|
|
91
221
|
|
|
222
|
+
export declare function deriveCreditUsage(balances: CreditBalanceEntry[], options: DeriveCreditUsageOptions): CreditUsageRow[];
|
|
223
|
+
|
|
224
|
+
export declare interface DeriveCreditUsageOptions {
|
|
225
|
+
locale: string;
|
|
226
|
+
/** Credit ids to show, in this order; every credit when absent. */
|
|
227
|
+
visibleCredits?: string[];
|
|
228
|
+
}
|
|
229
|
+
|
|
92
230
|
export declare interface DerivedPaymentMethods {
|
|
93
231
|
/** Every method, in the order the server gave. */
|
|
94
232
|
rows: PaymentMethodRow[];
|
|
@@ -279,6 +417,27 @@ export declare type ElementStrings = {
|
|
|
279
417
|
meteredFeaturesAddMore: string;
|
|
280
418
|
meteredFeaturesAdditional: string;
|
|
281
419
|
meteredFeaturesTier: string;
|
|
420
|
+
creditUsageLoading: string;
|
|
421
|
+
creditUsageHeader: string;
|
|
422
|
+
creditUsageError: string;
|
|
423
|
+
creditUsageUnavailable: string;
|
|
424
|
+
creditUsageRemaining: string;
|
|
425
|
+
creditUsageBuyMore: string;
|
|
426
|
+
creditUsageSeeDetails: string;
|
|
427
|
+
creditUsageHideDetails: string;
|
|
428
|
+
creditUsageSeeAll: string;
|
|
429
|
+
creditUsageHideAll: string;
|
|
430
|
+
creditUsageGrantPlan: string;
|
|
431
|
+
creditUsageGrantBundle: string;
|
|
432
|
+
creditUsageGrantAutoTopup: string;
|
|
433
|
+
creditUsageGrantPromotional: string;
|
|
434
|
+
creditUsageResets: string;
|
|
435
|
+
creditUsageExpires: string;
|
|
436
|
+
creditUsageComposition: string;
|
|
437
|
+
creditUsageCompositionWithGrant: string;
|
|
438
|
+
creditUsagePerLicense: string;
|
|
439
|
+
creditUsageCompanyGrant: string;
|
|
440
|
+
creditUsageRenewsOn: string;
|
|
282
441
|
usageByUserHeader: string;
|
|
283
442
|
usageByUserTotal: string;
|
|
284
443
|
usageByUserError: string;
|
|
@@ -333,7 +492,7 @@ export declare type EntitlementText =
|
|
|
333
492
|
| {
|
|
334
493
|
kind: "perPackage";
|
|
335
494
|
cost: string;
|
|
336
|
-
size:
|
|
495
|
+
size: string;
|
|
337
496
|
units: string;
|
|
338
497
|
}
|
|
339
498
|
/** "Up to 1,000 API calls in this tier". */
|
|
@@ -470,7 +629,7 @@ export declare interface IncludedFeatureRow {
|
|
|
470
629
|
* the element shows it only when the host asks.
|
|
471
630
|
*/
|
|
472
631
|
hardLimit: {
|
|
473
|
-
amount:
|
|
632
|
+
amount: string;
|
|
474
633
|
units: string;
|
|
475
634
|
} | null;
|
|
476
635
|
/** The price's tiers, for a tier-priced row or tiered pay-in-advance. */
|
|
@@ -625,7 +784,7 @@ export declare interface MeteredFeatureRow {
|
|
|
625
784
|
/** "Resets Oct 1". */
|
|
626
785
|
resetsAt: string | null;
|
|
627
786
|
hardLimit: {
|
|
628
|
-
amount:
|
|
787
|
+
amount: string;
|
|
629
788
|
units: string;
|
|
630
789
|
} | null;
|
|
631
790
|
meter: MeteredMeter | null;
|
|
@@ -769,7 +928,8 @@ export declare type MeteredPriceDetails = {
|
|
|
769
928
|
kind: "overage";
|
|
770
929
|
/** The per-unit price past the soft limit. */
|
|
771
930
|
unitPrice: string;
|
|
772
|
-
|
|
931
|
+
/** "100" for a package price; `null` for a price per unit. */
|
|
932
|
+
packageSize: string | null;
|
|
773
933
|
units: string;
|
|
774
934
|
/** A period key, for a trait billed per period. */
|
|
775
935
|
period: string | null;
|
|
@@ -781,9 +941,9 @@ export declare type MeteredPriceDetails = {
|
|
|
781
941
|
};
|
|
782
942
|
} | {
|
|
783
943
|
kind: "tier";
|
|
784
|
-
from:
|
|
944
|
+
from: string;
|
|
785
945
|
/** `null` for the last, unbounded tier. */
|
|
786
|
-
to:
|
|
946
|
+
to: string | null;
|
|
787
947
|
/** What the usage costs across the tiers; `null` when nothing does. */
|
|
788
948
|
cost: string | null;
|
|
789
949
|
period: string | null;
|
|
@@ -933,8 +1093,7 @@ export declare interface PaymentMethodsProps extends ElementProps {
|
|
|
933
1093
|
export { PerLicenseCreditGrant }
|
|
934
1094
|
|
|
935
1095
|
export declare interface PerLicenseCredits {
|
|
936
|
-
|
|
937
|
-
amount: number;
|
|
1096
|
+
amount: string;
|
|
938
1097
|
creditName: string;
|
|
939
1098
|
licenseName: string;
|
|
940
1099
|
}
|
|
@@ -1165,12 +1324,13 @@ export declare type UsageSegment =
|
|
|
1165
1324
|
{
|
|
1166
1325
|
kind: "unitPricePerPeriod";
|
|
1167
1326
|
cost: string;
|
|
1168
|
-
|
|
1327
|
+
/** "100" for a package price; `null` for a price per unit. */
|
|
1328
|
+
size: string | null;
|
|
1169
1329
|
units: string;
|
|
1170
1330
|
/** A period key: "month", "quarter" or "year". */
|
|
1171
1331
|
period: string;
|
|
1172
1332
|
}
|
|
1173
|
-
/** "
|
|
1333
|
+
/** "1,300 API calls used". */
|
|
1174
1334
|
| {
|
|
1175
1335
|
kind: "used";
|
|
1176
1336
|
amount: string;
|
|
@@ -1198,6 +1358,10 @@ export declare type UsageSummary = {
|
|
|
1198
1358
|
amount: string;
|
|
1199
1359
|
};
|
|
1200
1360
|
|
|
1361
|
+
export { useCreditBalances }
|
|
1362
|
+
|
|
1363
|
+
export { useCreditUserUsage }
|
|
1364
|
+
|
|
1201
1365
|
export { useFeatureUsage }
|
|
1202
1366
|
|
|
1203
1367
|
export { useFeatureUserUsage }
|