@schematichq/schematic-react 1.11.0 → 1.12.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.
@@ -67,6 +67,12 @@ declare namespace billingApi {
67
67
  ApiErrorToJSON,
68
68
  ApiErrorToJSONTyped,
69
69
  ApiError,
70
+ instanceOfBillingCreditGrantReason,
71
+ BillingCreditGrantReasonFromJSON,
72
+ BillingCreditGrantReasonFromJSONTyped,
73
+ BillingCreditGrantReasonToJSON,
74
+ BillingCreditGrantReasonToJSONTyped,
75
+ BillingCreditGrantReason,
70
76
  instanceOfBillingPlanCreditGrantResetCadence,
71
77
  BillingPlanCreditGrantResetCadenceFromJSON,
72
78
  BillingPlanCreditGrantResetCadenceFromJSONTyped,
@@ -115,6 +121,42 @@ declare namespace billingApi {
115
121
  CatalogPriceTierResponseDataToJSON,
116
122
  CatalogPriceTierResponseDataToJSONTyped,
117
123
  CatalogPriceTierResponseData,
124
+ instanceOfCompanyCreditBalanceResponseData,
125
+ CompanyCreditBalanceResponseDataFromJSON,
126
+ CompanyCreditBalanceResponseDataFromJSONTyped,
127
+ CompanyCreditBalanceResponseDataToJSON,
128
+ CompanyCreditBalanceResponseDataToJSONTyped,
129
+ CompanyCreditBalanceResponseData,
130
+ instanceOfCompanyCreditBalancesResponseData,
131
+ CompanyCreditBalancesResponseDataFromJSON,
132
+ CompanyCreditBalancesResponseDataFromJSONTyped,
133
+ CompanyCreditBalancesResponseDataToJSON,
134
+ CompanyCreditBalancesResponseDataToJSONTyped,
135
+ CompanyCreditBalancesResponseData,
136
+ instanceOfCompanyCreditCompositionResponseData,
137
+ CompanyCreditCompositionResponseDataFromJSON,
138
+ CompanyCreditCompositionResponseDataFromJSONTyped,
139
+ CompanyCreditCompositionResponseDataToJSON,
140
+ CompanyCreditCompositionResponseDataToJSONTyped,
141
+ CompanyCreditCompositionResponseData,
142
+ instanceOfCompanyCreditGrantResponseData,
143
+ CompanyCreditGrantResponseDataFromJSON,
144
+ CompanyCreditGrantResponseDataFromJSONTyped,
145
+ CompanyCreditGrantResponseDataToJSON,
146
+ CompanyCreditGrantResponseDataToJSONTyped,
147
+ CompanyCreditGrantResponseData,
148
+ instanceOfCompanyCreditUserUsageResponseData,
149
+ CompanyCreditUserUsageResponseDataFromJSON,
150
+ CompanyCreditUserUsageResponseDataFromJSONTyped,
151
+ CompanyCreditUserUsageResponseDataToJSON,
152
+ CompanyCreditUserUsageResponseDataToJSONTyped,
153
+ CompanyCreditUserUsageResponseData,
154
+ instanceOfCompanyCreditUserUsageRowResponseData,
155
+ CompanyCreditUserUsageRowResponseDataFromJSON,
156
+ CompanyCreditUserUsageRowResponseDataFromJSONTyped,
157
+ CompanyCreditUserUsageRowResponseDataToJSON,
158
+ CompanyCreditUserUsageRowResponseDataToJSONTyped,
159
+ CompanyCreditUserUsageRowResponseData,
118
160
  instanceOfCompanyDiscountResponseData,
119
161
  CompanyDiscountResponseDataFromJSON,
120
162
  CompanyDiscountResponseDataFromJSONTyped,
@@ -217,6 +259,24 @@ declare namespace billingApi {
217
259
  FeatureTypeToJSON,
218
260
  FeatureTypeToJSONTyped,
219
261
  FeatureType,
262
+ instanceOfGetCompanyCreditBalancesResponse,
263
+ GetCompanyCreditBalancesResponseFromJSON,
264
+ GetCompanyCreditBalancesResponseFromJSONTyped,
265
+ GetCompanyCreditBalancesResponseToJSON,
266
+ GetCompanyCreditBalancesResponseToJSONTyped,
267
+ GetCompanyCreditBalancesResponse,
268
+ instanceOfGetCompanyCreditUserUsageParams,
269
+ GetCompanyCreditUserUsageParamsFromJSON,
270
+ GetCompanyCreditUserUsageParamsFromJSONTyped,
271
+ GetCompanyCreditUserUsageParamsToJSON,
272
+ GetCompanyCreditUserUsageParamsToJSONTyped,
273
+ GetCompanyCreditUserUsageParams,
274
+ instanceOfGetCompanyCreditUserUsageResponse,
275
+ GetCompanyCreditUserUsageResponseFromJSON,
276
+ GetCompanyCreditUserUsageResponseFromJSONTyped,
277
+ GetCompanyCreditUserUsageResponseToJSON,
278
+ GetCompanyCreditUserUsageResponseToJSONTyped,
279
+ GetCompanyCreditUserUsageResponse,
220
280
  instanceOfGetCompanyFeatureUsageResponse,
221
281
  GetCompanyFeatureUsageResponseFromJSON,
222
282
  GetCompanyFeatureUsageResponseFromJSONTyped,
@@ -332,6 +392,10 @@ declare interface BillingClient {
332
392
  fetchFeatureUsage(): Promise<FeatureUsage[]>;
333
393
  /** One event-based feature's usage by user over its metric period. */
334
394
  fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
395
+ /** Empty when the company holds no credits and its plan draws on none. */
396
+ fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
397
+ /** One credit's consumption by user over the span of its live grants. */
398
+ fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
335
399
  readonly sessionStatus: SessionStatus;
336
400
  readonly sessionKey: string | undefined;
337
401
  setSession(session: SessionInput): void;
@@ -340,6 +404,24 @@ declare interface BillingClient {
340
404
 
341
405
  declare type BillingClientOptions = SessionOptions;
342
406
 
407
+ /**
408
+ *
409
+ * @export
410
+ */
411
+ declare const BillingCreditGrantReason: {
412
+ readonly Adjustment: "adjustment";
413
+ readonly BillingCreditAutoTopup: "billing_credit_auto_topup";
414
+ readonly Free: "free";
415
+ readonly Plan: "plan";
416
+ readonly PostpaidForgiven: "postpaid_forgiven";
417
+ readonly PostpaidOverdraft: "postpaid_overdraft";
418
+ readonly PostpaidSettlement: "postpaid_settlement";
419
+ readonly Purchased: "purchased";
420
+ readonly Rollover: "rollover";
421
+ };
422
+
423
+ declare type BillingCreditGrantReason = (typeof BillingCreditGrantReason)[keyof typeof BillingCreditGrantReason];
424
+
343
425
  /**
344
426
  * A prefetch or fixture. An omitted key reports as pending; a keyed resource
345
427
  * seeds under `params`, or its defaults when absent, so a prefetch for a
@@ -357,13 +439,15 @@ export declare type BillingData = {
357
439
  sessionKey?: string;
358
440
  };
359
441
 
360
- export declare function BillingDataProvider({ actions, children, data, featureUserUsage, locale, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
442
+ export declare function BillingDataProvider({ actions, children, creditUserUsage, data, featureUserUsage, locale, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
361
443
 
362
444
  declare interface BillingDataProviderDataProps {
363
445
  /** A missing key reports as pending. */
364
446
  data: BillingData;
365
447
  /** Usage by user, by feature id; a feature left out reports as pending. */
366
448
  featureUserUsage?: Record<string, FeatureUserUsage>;
449
+ /** Consumption by user, by credit id; a credit left out reports as pending. */
450
+ creditUserUsage?: Record<string, CreditUserUsage>;
367
451
  /** Simulated loading / failure per resource; wins over `data`. */
368
452
  status?: BillingDataStatus;
369
453
  onRefetch?: (name: BillingResourceName) => void;
@@ -403,6 +487,9 @@ export declare interface BillingDataSource {
403
487
  */
404
488
  subscribeFeatureUserUsage(featureId: string, listener: () => void): () => void;
405
489
  featureUserUsage(featureId: string): ResourceHandle<FeatureUserUsage>;
490
+ /** One credit's consumption by user, keyed like `featureUserUsage`. */
491
+ subscribeCreditUserUsage(creditId: string, listener: () => void): () => void;
492
+ creditUserUsage(creditId: string): ResourceHandle<CreditUserUsage>;
406
493
  /** Never rejects: a failure lands on the resource's `error`. */
407
494
  loadMoreInvoices: (query: InvoiceQuery) => Promise<void>;
408
495
  invalidateAll: () => void;
@@ -483,7 +570,7 @@ export declare function BillingProvider({ billingClient, children, initialData,
483
570
  * much. Named apart from schematic-js's `BillingClient`, which is the whole
484
571
  * interface; this is the part the hooks here call.
485
572
  */
486
- export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage">;
573
+ export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage" | "fetchCreditBalances" | "fetchCreditUserUsage">;
487
574
 
488
575
  declare interface BillingProviderDataProps {
489
576
  /**
@@ -523,7 +610,7 @@ declare interface BillingProviderDataProps {
523
610
  export declare type BillingProviderProps = BillingProviderDataProps & SchematicI18nConfig;
524
611
 
525
612
  /** The resources this package serves; a key of schematic-js's contract. */
526
- export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage";
613
+ export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage" | "creditBalances";
527
614
 
528
615
  declare type BillingResourceName_2 = keyof BillingResources_2;
529
616
 
@@ -535,6 +622,7 @@ declare interface BillingResourceParams_2 {
535
622
  upcomingInvoice: Record<string, never>;
536
623
  paymentMethods: Record<string, never>;
537
624
  featureUsage: Record<string, never>;
625
+ creditBalances: Record<string, never>;
538
626
  }
539
627
 
540
628
  export declare type BillingResources = Pick<BillingResources_2, BillingResourceName>;
@@ -565,6 +653,12 @@ declare interface BillingResources_2 {
565
653
  * to nothing — so only `undefined` means not loaded.
566
654
  */
567
655
  featureUsage: FeatureUsage[];
656
+ /**
657
+ * `GET /company/credits`. Empty is a loaded value — the company holds no
658
+ * credits and its plan draws on none — so only `undefined` means not
659
+ * loaded.
660
+ */
661
+ creditBalances: CreditBalanceEntry[];
568
662
  }
569
663
 
570
664
  /**
@@ -1061,6 +1155,356 @@ export declare interface CompanyCreditBalance {
1061
1155
  settled: number;
1062
1156
  }
1063
1157
 
1158
+ /**
1159
+ *
1160
+ * @export
1161
+ * @interface CompanyCreditBalanceResponseData
1162
+ */
1163
+ declare interface CompanyCreditBalanceResponseData {
1164
+ /**
1165
+ * How the plan's grants of this credit add up per period; null unless the plan grants it per license and the license count is known.
1166
+ * @type {CompanyCreditCompositionResponseData}
1167
+ * @memberof CompanyCreditBalanceResponseData
1168
+ */
1169
+ composition?: CompanyCreditCompositionResponseData;
1170
+ /**
1171
+ *
1172
+ * @type {string}
1173
+ * @memberof CompanyCreditBalanceResponseData
1174
+ */
1175
+ creditDescription: string;
1176
+ /**
1177
+ *
1178
+ * @type {string}
1179
+ * @memberof CompanyCreditBalanceResponseData
1180
+ */
1181
+ creditIcon?: string | null;
1182
+ /**
1183
+ *
1184
+ * @type {string}
1185
+ * @memberof CompanyCreditBalanceResponseData
1186
+ */
1187
+ creditId: string;
1188
+ /**
1189
+ *
1190
+ * @type {string}
1191
+ * @memberof CompanyCreditBalanceResponseData
1192
+ */
1193
+ creditName: string;
1194
+ /**
1195
+ *
1196
+ * @type {string}
1197
+ * @memberof CompanyCreditBalanceResponseData
1198
+ */
1199
+ creditPluralName?: string | null;
1200
+ /**
1201
+ *
1202
+ * @type {string}
1203
+ * @memberof CompanyCreditBalanceResponseData
1204
+ */
1205
+ creditSingularName?: string | null;
1206
+ /**
1207
+ * The earliest expiry among grants that will not be replaced.
1208
+ * @type {Date}
1209
+ * @memberof CompanyCreditBalanceResponseData
1210
+ */
1211
+ expiresAt?: Date | null;
1212
+ /**
1213
+ * The live grants behind the balance, newest first. Empty for a credit the plan draws on that the company holds none of.
1214
+ * @type {Array<CompanyCreditGrantResponseData>}
1215
+ * @memberof CompanyCreditBalanceResponseData
1216
+ */
1217
+ grants: Array<CompanyCreditGrantResponseData>;
1218
+ /**
1219
+ * Whether a bundle of this credit is on offer to the company's plan.
1220
+ * @type {boolean}
1221
+ * @memberof CompanyCreditBalanceResponseData
1222
+ */
1223
+ purchasable: boolean;
1224
+ /**
1225
+ *
1226
+ * @type {number}
1227
+ * @memberof CompanyCreditBalanceResponseData
1228
+ */
1229
+ remaining: number;
1230
+ /**
1231
+ * The earliest refresh among grants that renew.
1232
+ * @type {Date}
1233
+ * @memberof CompanyCreditBalanceResponseData
1234
+ */
1235
+ resetsAt?: Date | null;
1236
+ /**
1237
+ *
1238
+ * @type {number}
1239
+ * @memberof CompanyCreditBalanceResponseData
1240
+ */
1241
+ total: number;
1242
+ /**
1243
+ *
1244
+ * @type {number}
1245
+ * @memberof CompanyCreditBalanceResponseData
1246
+ */
1247
+ used: number;
1248
+ }
1249
+
1250
+ /**
1251
+ * Schematic API
1252
+ * Schematic API
1253
+ *
1254
+ * The version of the OpenAPI document: 0.1
1255
+ *
1256
+ *
1257
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1258
+ * https://openapi-generator.tech
1259
+ * Do not edit the class manually.
1260
+ */
1261
+ /**
1262
+ *
1263
+ * @export
1264
+ * @interface CompanyCreditCompositionResponseData
1265
+ */
1266
+ declare interface CompanyCreditCompositionResponseData {
1267
+ /**
1268
+ * Credits granted to the company once per period, on top of the per-license amount.
1269
+ * @type {number}
1270
+ * @memberof CompanyCreditCompositionResponseData
1271
+ */
1272
+ fixedQuantity: number;
1273
+ /**
1274
+ *
1275
+ * @type {string}
1276
+ * @memberof CompanyCreditCompositionResponseData
1277
+ */
1278
+ licenseId?: string | null;
1279
+ /**
1280
+ *
1281
+ * @type {string}
1282
+ * @memberof CompanyCreditCompositionResponseData
1283
+ */
1284
+ licenseName: string;
1285
+ /**
1286
+ *
1287
+ * @type {string}
1288
+ * @memberof CompanyCreditCompositionResponseData
1289
+ */
1290
+ licensePluralName?: string | null;
1291
+ /**
1292
+ *
1293
+ * @type {number}
1294
+ * @memberof CompanyCreditCompositionResponseData
1295
+ */
1296
+ licenseQuantity: number;
1297
+ /**
1298
+ *
1299
+ * @type {string}
1300
+ * @memberof CompanyCreditCompositionResponseData
1301
+ */
1302
+ licenseSingularName?: string | null;
1303
+ /**
1304
+ *
1305
+ * @type {number}
1306
+ * @memberof CompanyCreditCompositionResponseData
1307
+ */
1308
+ perLicenseAmount: number;
1309
+ /**
1310
+ * day, week, month or year.
1311
+ * @type {string}
1312
+ * @memberof CompanyCreditCompositionResponseData
1313
+ */
1314
+ period: string;
1315
+ /**
1316
+ * When the company's next bill renews the plan: the subscription's period end, else the stored next bill's due date. Null when the subscription cancels at period end, its trial cancels, or neither is known.
1317
+ * @type {Date}
1318
+ * @memberof CompanyCreditCompositionResponseData
1319
+ */
1320
+ renewsAt?: Date | null;
1321
+ /**
1322
+ *
1323
+ * @type {number}
1324
+ * @memberof CompanyCreditCompositionResponseData
1325
+ */
1326
+ total: number;
1327
+ }
1328
+
1329
+ /**
1330
+ *
1331
+ * @export
1332
+ * @interface CompanyCreditGrantResponseData
1333
+ */
1334
+ declare interface CompanyCreditGrantResponseData {
1335
+ /**
1336
+ *
1337
+ * @type {string}
1338
+ * @memberof CompanyCreditGrantResponseData
1339
+ */
1340
+ bundleId?: string | null;
1341
+ /**
1342
+ *
1343
+ * @type {string}
1344
+ * @memberof CompanyCreditGrantResponseData
1345
+ */
1346
+ bundleName?: string | null;
1347
+ /**
1348
+ *
1349
+ * @type {Date}
1350
+ * @memberof CompanyCreditGrantResponseData
1351
+ */
1352
+ createdAt: Date;
1353
+ /**
1354
+ * When these credits go away unreplaced; null if the grant renews or never expires.
1355
+ * @type {Date}
1356
+ * @memberof CompanyCreditGrantResponseData
1357
+ */
1358
+ expiresAt?: Date | null;
1359
+ /**
1360
+ *
1361
+ * @type {BillingCreditGrantReason}
1362
+ * @memberof CompanyCreditGrantResponseData
1363
+ */
1364
+ grantReason: BillingCreditGrantReason;
1365
+ /**
1366
+ *
1367
+ * @type {string}
1368
+ * @memberof CompanyCreditGrantResponseData
1369
+ */
1370
+ id: string;
1371
+ /**
1372
+ *
1373
+ * @type {string}
1374
+ * @memberof CompanyCreditGrantResponseData
1375
+ */
1376
+ planId?: string | null;
1377
+ /**
1378
+ *
1379
+ * @type {string}
1380
+ * @memberof CompanyCreditGrantResponseData
1381
+ */
1382
+ planName?: string | null;
1383
+ /**
1384
+ *
1385
+ * @type {number}
1386
+ * @memberof CompanyCreditGrantResponseData
1387
+ */
1388
+ quantity: number;
1389
+ /**
1390
+ *
1391
+ * @type {number}
1392
+ * @memberof CompanyCreditGrantResponseData
1393
+ */
1394
+ quantityRemaining: number;
1395
+ /**
1396
+ *
1397
+ * @type {number}
1398
+ * @memberof CompanyCreditGrantResponseData
1399
+ */
1400
+ quantityUsed: number;
1401
+ /**
1402
+ * The cadence a renewing grant refreshes on, when it is known.
1403
+ * @type {BillingPlanCreditGrantResetCadence}
1404
+ * @memberof CompanyCreditGrantResponseData
1405
+ */
1406
+ renewalPeriod?: BillingPlanCreditGrantResetCadence | null;
1407
+ /**
1408
+ * When this grant refreshes; null if it does not renew.
1409
+ * @type {Date}
1410
+ * @memberof CompanyCreditGrantResponseData
1411
+ */
1412
+ resetsAt?: Date | null;
1413
+ /**
1414
+ *
1415
+ * @type {Date}
1416
+ * @memberof CompanyCreditGrantResponseData
1417
+ */
1418
+ validFrom?: Date | null;
1419
+ }
1420
+
1421
+ /**
1422
+ *
1423
+ * @export
1424
+ * @interface CompanyCreditUserUsageResponseData
1425
+ */
1426
+ declare interface CompanyCreditUserUsageResponseData {
1427
+ /**
1428
+ * How many of the company's users the breakdown lists across every page, including those who consumed none of the credit in the span; 0 for a credit with no live grant. Unattributed consumption is not a user and is not counted.
1429
+ * @type {number}
1430
+ * @memberof CompanyCreditUserUsageResponseData
1431
+ */
1432
+ count: number;
1433
+ /**
1434
+ * End of the span; the time of the request for a credit the company holds no live grant of.
1435
+ * @type {Date}
1436
+ * @memberof CompanyCreditUserUsageResponseData
1437
+ */
1438
+ endTime?: Date | null;
1439
+ /**
1440
+ * Start of the span; equal to end_time for a credit the company holds no live grant of.
1441
+ * @type {Date}
1442
+ * @memberof CompanyCreditUserUsageResponseData
1443
+ */
1444
+ startTime?: Date | null;
1445
+ /**
1446
+ * Consumption across every user in the span, not just this page.
1447
+ * @type {number}
1448
+ * @memberof CompanyCreditUserUsageResponseData
1449
+ */
1450
+ total: number;
1451
+ /**
1452
+ * Consumption from events sent without a user; null when there is none.
1453
+ * @type {number}
1454
+ * @memberof CompanyCreditUserUsageResponseData
1455
+ */
1456
+ unattributed?: number | null;
1457
+ /**
1458
+ * This page of users, heaviest first.
1459
+ * @type {Array<CompanyCreditUserUsageRowResponseData>}
1460
+ * @memberof CompanyCreditUserUsageResponseData
1461
+ */
1462
+ users: Array<CompanyCreditUserUsageRowResponseData>;
1463
+ }
1464
+
1465
+ /**
1466
+ * Schematic API
1467
+ * Schematic API
1468
+ *
1469
+ * The version of the OpenAPI document: 0.1
1470
+ *
1471
+ *
1472
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1473
+ * https://openapi-generator.tech
1474
+ * Do not edit the class manually.
1475
+ */
1476
+ /**
1477
+ *
1478
+ * @export
1479
+ * @interface CompanyCreditUserUsageRowResponseData
1480
+ */
1481
+ declare interface CompanyCreditUserUsageRowResponseData {
1482
+ /**
1483
+ *
1484
+ * @type {string}
1485
+ * @memberof CompanyCreditUserUsageRowResponseData
1486
+ */
1487
+ name?: string | null;
1488
+ /**
1489
+ * This user's fraction (0-1) of all consumption in the span, unattributed included.
1490
+ * @type {number}
1491
+ * @memberof CompanyCreditUserUsageRowResponseData
1492
+ */
1493
+ share: number;
1494
+ /**
1495
+ *
1496
+ * @type {number}
1497
+ * @memberof CompanyCreditUserUsageRowResponseData
1498
+ */
1499
+ used: number;
1500
+ /**
1501
+ *
1502
+ * @type {string}
1503
+ * @memberof CompanyCreditUserUsageRowResponseData
1504
+ */
1505
+ userId: string;
1506
+ }
1507
+
1064
1508
  /**
1065
1509
  * Schematic API
1066
1510
  * Schematic API
@@ -1664,6 +2108,20 @@ export declare type CreditBalance = {
1664
2108
  reserved: number;
1665
2109
  };
1666
2110
 
2111
+ /**
2112
+ * One credit's balance. What the server has already decided, so a consumer
2113
+ * never re-derives it:
2114
+ *
2115
+ * * `grants` are the live ones only, newest first; expired and zeroed-out
2116
+ * grants are gone, so `total` is `used` plus `remaining`.
2117
+ * * A credit the plan draws on that the company holds none of is a zero
2118
+ * balance with no grants.
2119
+ * * Each grant carries `resetsAt` or `expiresAt`, never both.
2120
+ * * `purchasable` — a bundle of it is on offer to the company's plan.
2121
+ * * `composition` — how a per-license plan grant adds up per period.
2122
+ */
2123
+ export declare type CreditBalanceEntry = CompanyCreditBalanceResponseData;
2124
+
1667
2125
  declare type CreditBalanceListenerFn = CreditBalancesListenerFn | EmptyListenerFn;
1668
2126
 
1669
2127
  /** A company's lease-aware credit balances keyed by credit ID */
@@ -1673,6 +2131,10 @@ declare const CreditBalancesFromJSON: (json: any) => CreditBalances;
1673
2131
 
1674
2132
  declare type CreditBalancesListenerFn = (value: CreditBalances) => void;
1675
2133
 
2134
+ export declare type CreditComposition = CompanyCreditCompositionResponseData;
2135
+
2136
+ export declare type CreditGrant = CompanyCreditGrantResponseData;
2137
+
1676
2138
  /** Every spend policy binding the current context, company-scope first */
1677
2139
  export declare type CreditSpendPolicies = CreditSpendPolicy[];
1678
2140
 
@@ -1820,6 +2282,23 @@ declare interface CreditSpendWindow_2 {
1820
2282
  unit: string;
1821
2283
  }
1822
2284
 
2285
+ /**
2286
+ * One credit's consumption by user over the span of its live grants: a page
2287
+ * of `users`, heaviest first; `count` users in all; the span's `total`; and
2288
+ * `unattributed` consumption from events sent without a user. Empty for a
2289
+ * credit the company holds no live grant of.
2290
+ */
2291
+ export declare type CreditUserUsage = CompanyCreditUserUsageResponseData;
2292
+
2293
+ declare interface CreditUserUsageRequest {
2294
+ creditId: string;
2295
+ /** Users per page; the server's default when omitted. */
2296
+ limit?: number;
2297
+ offset?: number;
2298
+ }
2299
+
2300
+ export declare type CreditUserUsageRow = CompanyCreditUserUsageRowResponseData;
2301
+
1823
2302
  /**
1824
2303
  *
1825
2304
  * @export
@@ -2142,6 +2621,14 @@ declare interface FeatureEntitlement {
2142
2621
  * @memberof FeatureEntitlement
2143
2622
  */
2144
2623
  monthReset?: MetricPeriodMonthReset | null;
2624
+ /**
2625
+ * If the company has a credit-based entitlement for this feature, the credit cost per unit of each quantity an event carries, keyed by quantity key (per token for inference features). Absent when the entitlement prices requests only
2626
+ * @type {{ [key: string]: number; }}
2627
+ * @memberof FeatureEntitlement
2628
+ */
2629
+ quantityRates?: {
2630
+ [key: string]: number;
2631
+ };
2145
2632
  /**
2146
2633
  * For usage-based pricing, the soft limit for overage charges or the next tier boundary
2147
2634
  * @type {number}
@@ -2763,6 +3250,8 @@ declare class SchematicBillingClient implements BillingClient {
2763
3250
  updatePaymentMethod(externalId: string): Promise<void>;
2764
3251
  deletePaymentMethod(id: string): Promise<void>;
2765
3252
  fetchFeatureUsage(): Promise<FeatureUsage[]>;
3253
+ fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
3254
+ fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
2766
3255
  fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
2767
3256
  }
2768
3257
 
@@ -2856,6 +3345,11 @@ declare namespace SchematicJS {
2856
3345
  CheckPlanReturnFromJSON,
2857
3346
  CheckPlanReturnListenerFn,
2858
3347
  CompanyCreditBalance,
3348
+ CompanyCreditBalanceResponseData,
3349
+ CompanyCreditCompositionResponseData,
3350
+ CompanyCreditGrantResponseData,
3351
+ CompanyCreditUserUsageResponseData,
3352
+ CompanyCreditUserUsageRowResponseData,
2859
3353
  CompanyDiscountResponseData,
2860
3354
  CompanyFeatureUsageResponseData,
2861
3355
  CompanyFeatureUserUsageResponseData,
@@ -2865,10 +3359,13 @@ declare namespace SchematicJS {
2865
3359
  CompanyUserUsageResponseData,
2866
3360
  ContextSignatureProvider,
2867
3361
  CreditBalance,
3362
+ CreditBalanceEntry,
2868
3363
  CreditBalanceListenerFn,
2869
3364
  CreditBalances,
2870
3365
  CreditBalancesFromJSON,
2871
3366
  CreditBalancesListenerFn,
3367
+ CreditComposition,
3368
+ CreditGrant,
2872
3369
  CreditSpendPolicies,
2873
3370
  creditSpendPoliciesEqual,
2874
3371
  CreditSpendPoliciesFromJSON,
@@ -2878,6 +3375,8 @@ declare namespace SchematicJS {
2878
3375
  CreditSpendPolicyListenerFn,
2879
3376
  CreditSpendPolicyScope,
2880
3377
  CreditSpendWindow,
3378
+ CreditUserUsage,
3379
+ CreditUserUsageRow,
2881
3380
  DEFAULT_INVOICE_QUERY,
2882
3381
  Discount,
2883
3382
  EmptyListenerFn,
@@ -3234,6 +3733,19 @@ export declare enum UsagePeriod {
3234
3733
 
3235
3734
  export declare function useBillingDataSource(): BillingDataSource;
3236
3735
 
3736
+ /**
3737
+ * The company's credit balances, one per credit. `data` is empty when it
3738
+ * holds no credits and its plan draws on none; `undefined` means not loaded.
3739
+ */
3740
+ export declare function useCreditBalances(): ResourceHandle<CreditBalanceEntry[]>;
3741
+
3742
+ /**
3743
+ * One credit's consumption by user over the span of its live grants: the
3744
+ * heaviest users, how many there are in all, and consumption from events
3745
+ * sent without a user. Empty for a credit the company holds no live grant of.
3746
+ */
3747
+ export declare function useCreditUserUsage(creditId: string): ResourceHandle<CreditUserUsage>;
3748
+
3237
3749
  /**
3238
3750
  * Every feature the company is entitled to, with its usage. `data` is empty
3239
3751
  * when it is entitled to nothing; `undefined` is what means not loaded yet.