@schematichq/schematic-react 1.10.0 → 1.11.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,18 +67,78 @@ declare namespace billingApi {
67
67
  ApiErrorToJSON,
68
68
  ApiErrorToJSONTyped,
69
69
  ApiError,
70
+ instanceOfBillingPlanCreditGrantResetCadence,
71
+ BillingPlanCreditGrantResetCadenceFromJSON,
72
+ BillingPlanCreditGrantResetCadenceFromJSONTyped,
73
+ BillingPlanCreditGrantResetCadenceToJSON,
74
+ BillingPlanCreditGrantResetCadenceToJSONTyped,
75
+ BillingPlanCreditGrantResetCadence,
76
+ instanceOfBillingPriceScheme,
77
+ BillingPriceSchemeFromJSON,
78
+ BillingPriceSchemeFromJSONTyped,
79
+ BillingPriceSchemeToJSON,
80
+ BillingPriceSchemeToJSONTyped,
81
+ BillingPriceScheme,
82
+ instanceOfBillingProductPriceInterval,
83
+ BillingProductPriceIntervalFromJSON,
84
+ BillingProductPriceIntervalFromJSONTyped,
85
+ BillingProductPriceIntervalToJSON,
86
+ BillingProductPriceIntervalToJSONTyped,
87
+ BillingProductPriceInterval,
70
88
  instanceOfBillingProviderType,
71
89
  BillingProviderTypeFromJSON,
72
90
  BillingProviderTypeFromJSONTyped,
73
91
  BillingProviderTypeToJSON,
74
92
  BillingProviderTypeToJSONTyped,
75
93
  BillingProviderType,
94
+ instanceOfBillingTiersMode,
95
+ BillingTiersModeFromJSON,
96
+ BillingTiersModeFromJSONTyped,
97
+ BillingTiersModeToJSON,
98
+ BillingTiersModeToJSONTyped,
99
+ BillingTiersMode,
100
+ instanceOfCatalogCreditGrantResponseData,
101
+ CatalogCreditGrantResponseDataFromJSON,
102
+ CatalogCreditGrantResponseDataFromJSONTyped,
103
+ CatalogCreditGrantResponseDataToJSON,
104
+ CatalogCreditGrantResponseDataToJSONTyped,
105
+ CatalogCreditGrantResponseData,
106
+ instanceOfCatalogPriceResponseData,
107
+ CatalogPriceResponseDataFromJSON,
108
+ CatalogPriceResponseDataFromJSONTyped,
109
+ CatalogPriceResponseDataToJSON,
110
+ CatalogPriceResponseDataToJSONTyped,
111
+ CatalogPriceResponseData,
112
+ instanceOfCatalogPriceTierResponseData,
113
+ CatalogPriceTierResponseDataFromJSON,
114
+ CatalogPriceTierResponseDataFromJSONTyped,
115
+ CatalogPriceTierResponseDataToJSON,
116
+ CatalogPriceTierResponseDataToJSONTyped,
117
+ CatalogPriceTierResponseData,
76
118
  instanceOfCompanyDiscountResponseData,
77
119
  CompanyDiscountResponseDataFromJSON,
78
120
  CompanyDiscountResponseDataFromJSONTyped,
79
121
  CompanyDiscountResponseDataToJSON,
80
122
  CompanyDiscountResponseDataToJSONTyped,
81
123
  CompanyDiscountResponseData,
124
+ instanceOfCompanyFeatureUsageListResponseData,
125
+ CompanyFeatureUsageListResponseDataFromJSON,
126
+ CompanyFeatureUsageListResponseDataFromJSONTyped,
127
+ CompanyFeatureUsageListResponseDataToJSON,
128
+ CompanyFeatureUsageListResponseDataToJSONTyped,
129
+ CompanyFeatureUsageListResponseData,
130
+ instanceOfCompanyFeatureUsageResponseData,
131
+ CompanyFeatureUsageResponseDataFromJSON,
132
+ CompanyFeatureUsageResponseDataFromJSONTyped,
133
+ CompanyFeatureUsageResponseDataToJSON,
134
+ CompanyFeatureUsageResponseDataToJSONTyped,
135
+ CompanyFeatureUsageResponseData,
136
+ instanceOfCompanyFeatureUserUsageResponseData,
137
+ CompanyFeatureUserUsageResponseDataFromJSON,
138
+ CompanyFeatureUserUsageResponseDataFromJSONTyped,
139
+ CompanyFeatureUserUsageResponseDataToJSON,
140
+ CompanyFeatureUserUsageResponseDataToJSONTyped,
141
+ CompanyFeatureUserUsageResponseData,
82
142
  instanceOfCompanyInvoiceResponseData,
83
143
  CompanyInvoiceResponseDataFromJSON,
84
144
  CompanyInvoiceResponseDataFromJSONTyped,
@@ -109,6 +169,12 @@ declare namespace billingApi {
109
169
  CompanyUpcomingInvoiceResponseDataToJSON,
110
170
  CompanyUpcomingInvoiceResponseDataToJSONTyped,
111
171
  CompanyUpcomingInvoiceResponseData,
172
+ instanceOfCompanyUserUsageResponseData,
173
+ CompanyUserUsageResponseDataFromJSON,
174
+ CompanyUserUsageResponseDataFromJSONTyped,
175
+ CompanyUserUsageResponseDataToJSON,
176
+ CompanyUserUsageResponseDataToJSONTyped,
177
+ CompanyUserUsageResponseData,
112
178
  instanceOfCreateSetupIntentResponse,
113
179
  CreateSetupIntentResponseFromJSON,
114
180
  CreateSetupIntentResponseFromJSONTyped,
@@ -127,6 +193,48 @@ declare namespace billingApi {
127
193
  DeleteResponseToJSON,
128
194
  DeleteResponseToJSONTyped,
129
195
  DeleteResponse,
196
+ instanceOfEntitlementPriceBehavior,
197
+ EntitlementPriceBehaviorFromJSON,
198
+ EntitlementPriceBehaviorFromJSONTyped,
199
+ EntitlementPriceBehaviorToJSON,
200
+ EntitlementPriceBehaviorToJSONTyped,
201
+ EntitlementPriceBehavior,
202
+ instanceOfEntitlementType,
203
+ EntitlementTypeFromJSON,
204
+ EntitlementTypeFromJSONTyped,
205
+ EntitlementTypeToJSON,
206
+ EntitlementTypeToJSONTyped,
207
+ EntitlementType,
208
+ instanceOfEntitlementValueType,
209
+ EntitlementValueTypeFromJSON,
210
+ EntitlementValueTypeFromJSONTyped,
211
+ EntitlementValueTypeToJSON,
212
+ EntitlementValueTypeToJSONTyped,
213
+ EntitlementValueType_2 as EntitlementValueType,
214
+ instanceOfFeatureType,
215
+ FeatureTypeFromJSON,
216
+ FeatureTypeFromJSONTyped,
217
+ FeatureTypeToJSON,
218
+ FeatureTypeToJSONTyped,
219
+ FeatureType,
220
+ instanceOfGetCompanyFeatureUsageResponse,
221
+ GetCompanyFeatureUsageResponseFromJSON,
222
+ GetCompanyFeatureUsageResponseFromJSONTyped,
223
+ GetCompanyFeatureUsageResponseToJSON,
224
+ GetCompanyFeatureUsageResponseToJSONTyped,
225
+ GetCompanyFeatureUsageResponse,
226
+ instanceOfGetCompanyFeatureUserUsageParams,
227
+ GetCompanyFeatureUserUsageParamsFromJSON,
228
+ GetCompanyFeatureUserUsageParamsFromJSONTyped,
229
+ GetCompanyFeatureUserUsageParamsToJSON,
230
+ GetCompanyFeatureUserUsageParamsToJSONTyped,
231
+ GetCompanyFeatureUserUsageParams,
232
+ instanceOfGetCompanyFeatureUserUsageResponse,
233
+ GetCompanyFeatureUserUsageResponseFromJSON,
234
+ GetCompanyFeatureUserUsageResponseFromJSONTyped,
235
+ GetCompanyFeatureUserUsageResponseToJSON,
236
+ GetCompanyFeatureUserUsageResponseToJSONTyped,
237
+ GetCompanyFeatureUserUsageResponse,
130
238
  instanceOfGetCompanyInvoicesParams,
131
239
  GetCompanyInvoicesParamsFromJSON,
132
240
  GetCompanyInvoicesParamsFromJSONTyped,
@@ -157,12 +265,30 @@ declare namespace billingApi {
157
265
  InvoiceStatusToJSON,
158
266
  InvoiceStatusToJSONTyped,
159
267
  InvoiceStatus,
268
+ instanceOfMetricPeriod,
269
+ MetricPeriodFromJSON,
270
+ MetricPeriodFromJSONTyped,
271
+ MetricPeriodToJSON,
272
+ MetricPeriodToJSONTyped,
273
+ MetricPeriod_2 as MetricPeriod,
274
+ instanceOfMetricPeriodMonthReset,
275
+ MetricPeriodMonthResetFromJSON,
276
+ MetricPeriodMonthResetFromJSONTyped,
277
+ MetricPeriodMonthResetToJSON,
278
+ MetricPeriodMonthResetToJSONTyped,
279
+ MetricPeriodMonthReset_2 as MetricPeriodMonthReset,
160
280
  instanceOfPaymentMethodResponseData,
161
281
  PaymentMethodResponseDataFromJSON,
162
282
  PaymentMethodResponseDataFromJSONTyped,
163
283
  PaymentMethodResponseDataToJSON,
164
284
  PaymentMethodResponseDataToJSONTyped,
165
285
  PaymentMethodResponseData,
286
+ instanceOfPlanCreditGrantScaling,
287
+ PlanCreditGrantScalingFromJSON,
288
+ PlanCreditGrantScalingFromJSONTyped,
289
+ PlanCreditGrantScalingToJSON,
290
+ PlanCreditGrantScalingToJSONTyped,
291
+ PlanCreditGrantScaling,
166
292
  instanceOfSetupIntentResponseData,
167
293
  SetupIntentResponseDataFromJSON,
168
294
  SetupIntentResponseDataFromJSONTyped,
@@ -202,6 +328,10 @@ declare interface BillingClient {
202
328
  updatePaymentMethod(externalId: string): Promise<void>;
203
329
  /** Removes the method, by Schematic's id (`id`). */
204
330
  deletePaymentMethod(id: string): Promise<void>;
331
+ /** Empty when the company is entitled to nothing. */
332
+ fetchFeatureUsage(): Promise<FeatureUsage[]>;
333
+ /** One event-based feature's usage by user over its metric period. */
334
+ fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
205
335
  readonly sessionStatus: SessionStatus;
206
336
  readonly sessionKey: string | undefined;
207
337
  setSession(session: SessionInput): void;
@@ -227,11 +357,13 @@ export declare type BillingData = {
227
357
  sessionKey?: string;
228
358
  };
229
359
 
230
- export declare function BillingDataProvider({ actions, children, data, locale, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
360
+ export declare function BillingDataProvider({ actions, children, data, featureUserUsage, locale, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
231
361
 
232
362
  declare interface BillingDataProviderDataProps {
233
363
  /** A missing key reports as pending. */
234
364
  data: BillingData;
365
+ /** Usage by user, by feature id; a feature left out reports as pending. */
366
+ featureUserUsage?: Record<string, FeatureUserUsage>;
235
367
  /** Simulated loading / failure per resource; wins over `data`. */
236
368
  status?: BillingDataStatus;
237
369
  onRefetch?: (name: BillingResourceName) => void;
@@ -264,6 +396,13 @@ export declare interface BillingDataSource {
264
396
  */
265
397
  subscribe<K extends BillingResourceName>(name: K, params: BillingResourceParams[K], listener: () => void): () => void;
266
398
  handle<K extends BillingResourceName>(name: K, params: BillingResourceParams[K]): ResourceHandle<BillingResources[K]>;
399
+ /**
400
+ * One feature's usage by user. Keyed by feature, so it sits beside the
401
+ * named resources rather than among them: a source that holds one value
402
+ * per name has no slot for it.
403
+ */
404
+ subscribeFeatureUserUsage(featureId: string, listener: () => void): () => void;
405
+ featureUserUsage(featureId: string): ResourceHandle<FeatureUserUsage>;
267
406
  /** Never rejects: a failure lands on the resource's `error`. */
268
407
  loadMoreInvoices: (query: InvoiceQuery) => Promise<void>;
269
408
  invalidateAll: () => void;
@@ -279,6 +418,21 @@ export declare type BillingDataStatus = {
279
418
  };
280
419
  };
281
420
 
421
+ /**
422
+ *
423
+ * @export
424
+ */
425
+ declare const BillingPlanCreditGrantResetCadence: {
426
+ readonly Daily: "daily";
427
+ readonly Every6Months: "every_6_months";
428
+ readonly Monthly: "monthly";
429
+ readonly Quarterly: "quarterly";
430
+ readonly Weekly: "weekly";
431
+ readonly Yearly: "yearly";
432
+ };
433
+
434
+ declare type BillingPlanCreditGrantResetCadence = (typeof BillingPlanCreditGrantResetCadence)[keyof typeof BillingPlanCreditGrantResetCadence];
435
+
282
436
  declare interface BillingPrefetchOptions {
283
437
  /**
284
438
  * The resources the page renders, and no default: each one is a request
@@ -291,6 +445,30 @@ declare interface BillingPrefetchOptions {
291
445
  invoices?: InvoiceQuery;
292
446
  }
293
447
 
448
+ /**
449
+ *
450
+ * @export
451
+ */
452
+ declare const BillingPriceScheme: {
453
+ readonly PerUnit: "per_unit";
454
+ readonly Tiered: "tiered";
455
+ };
456
+
457
+ declare type BillingPriceScheme = (typeof BillingPriceScheme)[keyof typeof BillingPriceScheme];
458
+
459
+ /**
460
+ *
461
+ * @export
462
+ */
463
+ declare const BillingProductPriceInterval: {
464
+ readonly Day: "day";
465
+ readonly Month: "month";
466
+ readonly OneTime: "one-time";
467
+ readonly Year: "year";
468
+ };
469
+
470
+ declare type BillingProductPriceInterval = (typeof BillingProductPriceInterval)[keyof typeof BillingProductPriceInterval];
471
+
294
472
  /**
295
473
  * Provides the billing hooks from a `BillingStore` over a `BillingProviderClient`.
296
474
  * Rendered by `SchematicProvider`; usable on its own with a client.
@@ -305,7 +483,7 @@ export declare function BillingProvider({ billingClient, children, initialData,
305
483
  * much. Named apart from schematic-js's `BillingClient`, which is the whole
306
484
  * interface; this is the part the hooks here call.
307
485
  */
308
- export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod">;
486
+ export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage">;
309
487
 
310
488
  declare interface BillingProviderDataProps {
311
489
  /**
@@ -345,7 +523,7 @@ declare interface BillingProviderDataProps {
345
523
  export declare type BillingProviderProps = BillingProviderDataProps & SchematicI18nConfig;
346
524
 
347
525
  /** The resources this package serves; a key of schematic-js's contract. */
348
- export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods";
526
+ export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage";
349
527
 
350
528
  declare type BillingResourceName_2 = keyof BillingResources_2;
351
529
 
@@ -356,6 +534,7 @@ declare interface BillingResourceParams_2 {
356
534
  invoices: InvoiceQuery;
357
535
  upcomingInvoice: Record<string, never>;
358
536
  paymentMethods: Record<string, never>;
537
+ featureUsage: Record<string, never>;
359
538
  }
360
539
 
361
540
  export declare type BillingResources = Pick<BillingResources_2, BillingResourceName>;
@@ -381,10 +560,223 @@ declare interface BillingResources_2 {
381
560
  * has no method on file — so only `undefined` means not loaded.
382
561
  */
383
562
  paymentMethods: PaymentMethod[];
563
+ /**
564
+ * `GET /company/usage`. Empty is a loaded value — the company is entitled
565
+ * to nothing — so only `undefined` means not loaded.
566
+ */
567
+ featureUsage: FeatureUsage[];
384
568
  }
385
569
 
570
+ /**
571
+ *
572
+ * @export
573
+ */
574
+ declare const BillingTiersMode: {
575
+ readonly Graduated: "graduated";
576
+ readonly Volume: "volume";
577
+ };
578
+
579
+ declare type BillingTiersMode = (typeof BillingTiersMode)[keyof typeof BillingTiersMode];
580
+
386
581
  declare type BooleanListenerFn = (value: boolean) => void;
387
582
 
583
+ /**
584
+ *
585
+ * @export
586
+ * @interface CatalogCreditGrantResponseData
587
+ */
588
+ declare interface CatalogCreditGrantResponseData {
589
+ /**
590
+ * Flat credit amount granted to the company regardless of scaling.
591
+ * @type {number}
592
+ * @memberof CatalogCreditGrantResponseData
593
+ */
594
+ companyCreditAmount: number;
595
+ /**
596
+ * Credits granted; for per_license scaling this is the amount per license unit.
597
+ * @type {number}
598
+ * @memberof CatalogCreditGrantResponseData
599
+ */
600
+ creditAmount: number;
601
+ /**
602
+ *
603
+ * @type {string}
604
+ * @memberof CatalogCreditGrantResponseData
605
+ */
606
+ creditIcon?: string | null;
607
+ /**
608
+ *
609
+ * @type {string}
610
+ * @memberof CatalogCreditGrantResponseData
611
+ */
612
+ creditId: string;
613
+ /**
614
+ *
615
+ * @type {string}
616
+ * @memberof CatalogCreditGrantResponseData
617
+ */
618
+ creditName: string;
619
+ /**
620
+ *
621
+ * @type {string}
622
+ * @memberof CatalogCreditGrantResponseData
623
+ */
624
+ creditPluralName?: string | null;
625
+ /**
626
+ *
627
+ * @type {string}
628
+ * @memberof CatalogCreditGrantResponseData
629
+ */
630
+ creditSingularName?: string | null;
631
+ /**
632
+ *
633
+ * @type {string}
634
+ * @memberof CatalogCreditGrantResponseData
635
+ */
636
+ id: string;
637
+ /**
638
+ *
639
+ * @type {string}
640
+ * @memberof CatalogCreditGrantResponseData
641
+ */
642
+ licenseId?: string | null;
643
+ /**
644
+ *
645
+ * @type {BillingPlanCreditGrantResetCadence}
646
+ * @memberof CatalogCreditGrantResponseData
647
+ */
648
+ resetCadence?: BillingPlanCreditGrantResetCadence | null;
649
+ /**
650
+ *
651
+ * @type {PlanCreditGrantScaling}
652
+ * @memberof CatalogCreditGrantResponseData
653
+ */
654
+ scaling: PlanCreditGrantScaling;
655
+ }
656
+
657
+ /**
658
+ *
659
+ * @export
660
+ * @interface CatalogPriceResponseData
661
+ */
662
+ declare interface CatalogPriceResponseData {
663
+ /**
664
+ *
665
+ * @type {string}
666
+ * @memberof CatalogPriceResponseData
667
+ */
668
+ currency: string;
669
+ /**
670
+ *
671
+ * @type {string}
672
+ * @memberof CatalogPriceResponseData
673
+ */
674
+ id: string;
675
+ /**
676
+ *
677
+ * @type {BillingProductPriceInterval}
678
+ * @memberof CatalogPriceResponseData
679
+ */
680
+ interval: BillingProductPriceInterval;
681
+ /**
682
+ *
683
+ * @type {number}
684
+ * @memberof CatalogPriceResponseData
685
+ */
686
+ intervalCount: number;
687
+ /**
688
+ * Per-unit price of the final tier, precomputed for overage display.
689
+ * @type {string}
690
+ * @memberof CatalogPriceResponseData
691
+ */
692
+ overageUnitPriceDecimal?: string | null;
693
+ /**
694
+ * Units covered per priced package; a price of $10 with package_size 1000 charges $10 per 1000 units.
695
+ * @type {number}
696
+ * @memberof CatalogPriceResponseData
697
+ */
698
+ packageSize: number;
699
+ /**
700
+ *
701
+ * @type {number}
702
+ * @memberof CatalogPriceResponseData
703
+ */
704
+ price: number;
705
+ /**
706
+ *
707
+ * @type {string}
708
+ * @memberof CatalogPriceResponseData
709
+ */
710
+ priceDecimal?: string | null;
711
+ /**
712
+ *
713
+ * @type {Array<CatalogPriceTierResponseData>}
714
+ * @memberof CatalogPriceResponseData
715
+ */
716
+ priceTiers: Array<CatalogPriceTierResponseData>;
717
+ /**
718
+ *
719
+ * @type {BillingPriceScheme}
720
+ * @memberof CatalogPriceResponseData
721
+ */
722
+ scheme: BillingPriceScheme;
723
+ /**
724
+ *
725
+ * @type {BillingTiersMode}
726
+ * @memberof CatalogPriceResponseData
727
+ */
728
+ tiersMode?: BillingTiersMode | null;
729
+ }
730
+
731
+ /**
732
+ * Schematic API
733
+ * Schematic API
734
+ *
735
+ * The version of the OpenAPI document: 0.1
736
+ *
737
+ *
738
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
739
+ * https://openapi-generator.tech
740
+ * Do not edit the class manually.
741
+ */
742
+ /**
743
+ *
744
+ * @export
745
+ * @interface CatalogPriceTierResponseData
746
+ */
747
+ declare interface CatalogPriceTierResponseData {
748
+ /**
749
+ *
750
+ * @type {number}
751
+ * @memberof CatalogPriceTierResponseData
752
+ */
753
+ flatPrice?: number | null;
754
+ /**
755
+ * Lower bound of the tier (inclusive).
756
+ * @type {number}
757
+ * @memberof CatalogPriceTierResponseData
758
+ */
759
+ from: number;
760
+ /**
761
+ *
762
+ * @type {number}
763
+ * @memberof CatalogPriceTierResponseData
764
+ */
765
+ perUnitPrice?: number | null;
766
+ /**
767
+ *
768
+ * @type {string}
769
+ * @memberof CatalogPriceTierResponseData
770
+ */
771
+ perUnitPriceDecimal?: string | null;
772
+ /**
773
+ * Upper bound of the tier (inclusive); null means unbounded.
774
+ * @type {number}
775
+ * @memberof CatalogPriceTierResponseData
776
+ */
777
+ to?: number | null;
778
+ }
779
+
388
780
  /**
389
781
  *
390
782
  * @export
@@ -730,6 +1122,256 @@ declare interface CompanyDiscountResponseData {
730
1122
  percentOff?: number | null;
731
1123
  }
732
1124
 
1125
+ /**
1126
+ *
1127
+ * @export
1128
+ * @interface CompanyFeatureUsageResponseData
1129
+ */
1130
+ declare interface CompanyFeatureUsageResponseData {
1131
+ /**
1132
+ * Whether the company may use the feature right now.
1133
+ * @type {boolean}
1134
+ * @memberof CompanyFeatureUsageResponseData
1135
+ */
1136
+ access: boolean;
1137
+ /**
1138
+ * The entitlement's own limit before any price behavior applies: the numeric value, or the trait's value for a trait-based entitlement. For a credit entitlement, the credits granted in the current billing period (all time without a subscription). Null for unlimited and boolean entitlements.
1139
+ * @type {number}
1140
+ * @memberof CompanyFeatureUsageResponseData
1141
+ */
1142
+ allocation?: number | null;
1143
+ /**
1144
+ * Set when entitlement_type is company_override.
1145
+ * @type {string}
1146
+ * @memberof CompanyFeatureUsageResponseData
1147
+ */
1148
+ companyOverrideId?: string | null;
1149
+ /**
1150
+ * Credits consumed per unit of usage, for entitlements that burn credits.
1151
+ * @type {number}
1152
+ * @memberof CompanyFeatureUsageResponseData
1153
+ */
1154
+ consumptionRate?: number | null;
1155
+ /**
1156
+ *
1157
+ * @type {string}
1158
+ * @memberof CompanyFeatureUsageResponseData
1159
+ */
1160
+ creditIcon?: string | null;
1161
+ /**
1162
+ *
1163
+ * @type {string}
1164
+ * @memberof CompanyFeatureUsageResponseData
1165
+ */
1166
+ creditId?: string | null;
1167
+ /**
1168
+ *
1169
+ * @type {string}
1170
+ * @memberof CompanyFeatureUsageResponseData
1171
+ */
1172
+ creditName?: string | null;
1173
+ /**
1174
+ *
1175
+ * @type {string}
1176
+ * @memberof CompanyFeatureUsageResponseData
1177
+ */
1178
+ creditPluralName?: string | null;
1179
+ /**
1180
+ *
1181
+ * @type {string}
1182
+ * @memberof CompanyFeatureUsageResponseData
1183
+ */
1184
+ creditSingularName?: string | null;
1185
+ /**
1186
+ * What the feature costs at price, in its minor units: the allocation for pay_in_advance, usage for tier and pay_as_you_go, and usage above soft_limit for overage. Null when there is no price, the price behavior bills nothing, or there is nothing yet to bill it on (no allocation for pay_in_advance, unknown usage for tier, no usage for pay_as_you_go and overage); tier at zero usage, and overage within soft_limit, cost 0.
1187
+ * @type {number}
1188
+ * @memberof CompanyFeatureUsageResponseData
1189
+ */
1190
+ currentCost?: number | null;
1191
+ /**
1192
+ *
1193
+ * @type {EntitlementType}
1194
+ * @memberof CompanyFeatureUsageResponseData
1195
+ */
1196
+ entitlementType: EntitlementType;
1197
+ /**
1198
+ * When a company override ends; plan entitlements do not expire.
1199
+ * @type {Date}
1200
+ * @memberof CompanyFeatureUsageResponseData
1201
+ */
1202
+ expiresAt?: Date | null;
1203
+ /**
1204
+ *
1205
+ * @type {string}
1206
+ * @memberof CompanyFeatureUsageResponseData
1207
+ */
1208
+ featureDescription: string;
1209
+ /**
1210
+ *
1211
+ * @type {string}
1212
+ * @memberof CompanyFeatureUsageResponseData
1213
+ */
1214
+ featureIcon: string;
1215
+ /**
1216
+ *
1217
+ * @type {string}
1218
+ * @memberof CompanyFeatureUsageResponseData
1219
+ */
1220
+ featureId: string;
1221
+ /**
1222
+ *
1223
+ * @type {string}
1224
+ * @memberof CompanyFeatureUsageResponseData
1225
+ */
1226
+ featureName: string;
1227
+ /**
1228
+ *
1229
+ * @type {string}
1230
+ * @memberof CompanyFeatureUsageResponseData
1231
+ */
1232
+ featurePluralName?: string | null;
1233
+ /**
1234
+ *
1235
+ * @type {string}
1236
+ * @memberof CompanyFeatureUsageResponseData
1237
+ */
1238
+ featureSingularName?: string | null;
1239
+ /**
1240
+ *
1241
+ * @type {FeatureType}
1242
+ * @memberof CompanyFeatureUsageResponseData
1243
+ */
1244
+ featureType: FeatureType;
1245
+ /**
1246
+ *
1247
+ * @type {string}
1248
+ * @memberof CompanyFeatureUsageResponseData
1249
+ */
1250
+ licenseId?: string | null;
1251
+ /**
1252
+ *
1253
+ * @type {MetricPeriod}
1254
+ * @memberof CompanyFeatureUsageResponseData
1255
+ */
1256
+ metricPeriod?: MetricPeriod_2 | null;
1257
+ /**
1258
+ *
1259
+ * @type {MetricPeriodMonthReset}
1260
+ * @memberof CompanyFeatureUsageResponseData
1261
+ */
1262
+ metricPeriodMonthReset?: MetricPeriodMonthReset_2 | null;
1263
+ /**
1264
+ * The plan's credit grants that scale with the license this feature counts.
1265
+ * @type {Array<CatalogCreditGrantResponseData>}
1266
+ * @memberof CompanyFeatureUsageResponseData
1267
+ */
1268
+ perLicenseCreditGrants: Array<CatalogCreditGrantResponseData>;
1269
+ /**
1270
+ * Set when entitlement_type is plan_entitlement.
1271
+ * @type {string}
1272
+ * @memberof CompanyFeatureUsageResponseData
1273
+ */
1274
+ planEntitlementId?: string | null;
1275
+ /**
1276
+ * The metered price the company is billed at: the slot for its billing period, in the subscription's currency, or in none when the price predates multi-currency (any currency without a subscription). Null when the feature has no such price for that period.
1277
+ * @type {CatalogPriceResponseData}
1278
+ * @memberof CompanyFeatureUsageResponseData
1279
+ */
1280
+ price?: CatalogPriceResponseData;
1281
+ /**
1282
+ *
1283
+ * @type {EntitlementPriceBehavior}
1284
+ * @memberof CompanyFeatureUsageResponseData
1285
+ */
1286
+ priceBehavior?: EntitlementPriceBehavior | null;
1287
+ /**
1288
+ * When the usage metric next resets.
1289
+ * @type {Date}
1290
+ * @memberof CompanyFeatureUsageResponseData
1291
+ */
1292
+ resetsAt?: Date | null;
1293
+ /**
1294
+ *
1295
+ * @type {number}
1296
+ * @memberof CompanyFeatureUsageResponseData
1297
+ */
1298
+ softLimit?: number | null;
1299
+ /**
1300
+ * Usage in the current metric period; null for features that are not metered.
1301
+ * @type {number}
1302
+ * @memberof CompanyFeatureUsageResponseData
1303
+ */
1304
+ usage?: number | null;
1305
+ /**
1306
+ *
1307
+ * @type {boolean}
1308
+ * @memberof CompanyFeatureUsageResponseData
1309
+ */
1310
+ valueBool?: boolean | null;
1311
+ /**
1312
+ *
1313
+ * @type {number}
1314
+ * @memberof CompanyFeatureUsageResponseData
1315
+ */
1316
+ valueNumeric?: number | null;
1317
+ /**
1318
+ *
1319
+ * @type {EntitlementValueType}
1320
+ * @memberof CompanyFeatureUsageResponseData
1321
+ */
1322
+ valueType: EntitlementValueType_2;
1323
+ /**
1324
+ * The default warning-tier value, when configured.
1325
+ * @type {number}
1326
+ * @memberof CompanyFeatureUsageResponseData
1327
+ */
1328
+ warningThreshold?: number | null;
1329
+ }
1330
+
1331
+ /**
1332
+ *
1333
+ * @export
1334
+ * @interface CompanyFeatureUserUsageResponseData
1335
+ */
1336
+ declare interface CompanyFeatureUserUsageResponseData {
1337
+ /**
1338
+ * How many of the company's users the breakdown lists across every page, including those without usage in the period; unattributed usage is not a user and is not counted.
1339
+ * @type {number}
1340
+ * @memberof CompanyFeatureUserUsageResponseData
1341
+ */
1342
+ count: number;
1343
+ /**
1344
+ * End of the feature's current metric period (exclusive).
1345
+ * @type {Date}
1346
+ * @memberof CompanyFeatureUserUsageResponseData
1347
+ */
1348
+ endTime: Date;
1349
+ /**
1350
+ * Start of the feature's current metric period.
1351
+ * @type {Date}
1352
+ * @memberof CompanyFeatureUserUsageResponseData
1353
+ */
1354
+ startTime: Date;
1355
+ /**
1356
+ * Usage across every user in the period, not just this page.
1357
+ * @type {number}
1358
+ * @memberof CompanyFeatureUserUsageResponseData
1359
+ */
1360
+ total: number;
1361
+ /**
1362
+ * Usage from events sent without a user; null when the period has none.
1363
+ * @type {number}
1364
+ * @memberof CompanyFeatureUserUsageResponseData
1365
+ */
1366
+ unattributed?: number | null;
1367
+ /**
1368
+ * This page of users, highest usage first.
1369
+ * @type {Array<CompanyUserUsageResponseData>}
1370
+ * @memberof CompanyFeatureUserUsageResponseData
1371
+ */
1372
+ users: Array<CompanyUserUsageResponseData>;
1373
+ }
1374
+
733
1375
  /**
734
1376
  *
735
1377
  * @export
@@ -933,6 +1575,85 @@ declare interface CompanyUpcomingInvoiceResponseData {
933
1575
  subtotal: number;
934
1576
  }
935
1577
 
1578
+ /**
1579
+ * Schematic API
1580
+ * Schematic API
1581
+ *
1582
+ * The version of the OpenAPI document: 0.1
1583
+ *
1584
+ *
1585
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1586
+ * https://openapi-generator.tech
1587
+ * Do not edit the class manually.
1588
+ */
1589
+ /**
1590
+ *
1591
+ * @export
1592
+ * @interface CompanyUserUsageResponseData
1593
+ */
1594
+ declare interface CompanyUserUsageResponseData {
1595
+ /**
1596
+ * When the user last used the feature in the period.
1597
+ * @type {Date}
1598
+ * @memberof CompanyUserUsageResponseData
1599
+ */
1600
+ lastSeen: Date;
1601
+ /**
1602
+ *
1603
+ * @type {string}
1604
+ * @memberof CompanyUserUsageResponseData
1605
+ */
1606
+ name?: string | null;
1607
+ /**
1608
+ * This user's fraction (0-1) of all usage in the period, unattributed usage included.
1609
+ * @type {number}
1610
+ * @memberof CompanyUserUsageResponseData
1611
+ */
1612
+ share: number;
1613
+ /**
1614
+ *
1615
+ * @type {number}
1616
+ * @memberof CompanyUserUsageResponseData
1617
+ */
1618
+ usage: number;
1619
+ /**
1620
+ *
1621
+ * @type {string}
1622
+ * @memberof CompanyUserUsageResponseData
1623
+ */
1624
+ userId: string;
1625
+ }
1626
+
1627
+ /**
1628
+ * Function supplied by the integrating application that returns an HMAC context
1629
+ * signature (`iat.exp.sig`) for the given context.
1630
+ *
1631
+ * Because a publishable key is public, the signature must be produced by the
1632
+ * customer's backend, which holds the matching secret API key. A typical
1633
+ * implementation forwards the context to that backend and returns the
1634
+ * `X-Schematic-Context-Sig` value it computes:
1635
+ *
1636
+ * ```ts
1637
+ * const schematic = new Schematic(pubKey, {
1638
+ * getContextSignature: async (context) => {
1639
+ * const res = await fetch("/api/schematic/sign", {
1640
+ * method: "POST",
1641
+ * credentials: "include",
1642
+ * headers: { "Content-Type": "application/json" },
1643
+ * body: JSON.stringify(context),
1644
+ * });
1645
+ * const { signature } = await res.json();
1646
+ * return signature; // "iat.exp.sig"
1647
+ * },
1648
+ * });
1649
+ * ```
1650
+ *
1651
+ * The SDK derives the expiry from the returned string (its middle segment) and
1652
+ * caches it per context, so the function is only invoked when no fresh
1653
+ * signature is available.
1654
+ */
1655
+ declare type ContextSignatureProvider = (context: SchematicContext) => string | Promise<string>;
1656
+
936
1657
  /** A company's lease-aware balance for a single credit type */
937
1658
  export declare type CreditBalance = {
938
1659
  /** Spendable balance including any open lease hold (remaining + reserved); the number to display to end users */
@@ -1139,6 +1860,32 @@ export declare type Discount = CompanyDiscountResponseData;
1139
1860
 
1140
1861
  declare type EmptyListenerFn = () => void;
1141
1862
 
1863
+ /**
1864
+ *
1865
+ * @export
1866
+ */
1867
+ declare const EntitlementPriceBehavior: {
1868
+ readonly CreditBurndown: "credit_burndown";
1869
+ readonly Overage: "overage";
1870
+ readonly PayAsYouGo: "pay_as_you_go";
1871
+ readonly PayInAdvance: "pay_in_advance";
1872
+ readonly Tier: "tier";
1873
+ };
1874
+
1875
+ declare type EntitlementPriceBehavior = (typeof EntitlementPriceBehavior)[keyof typeof EntitlementPriceBehavior];
1876
+
1877
+ /**
1878
+ *
1879
+ * @export
1880
+ */
1881
+ declare const EntitlementType: {
1882
+ readonly CompanyOverride: "company_override";
1883
+ readonly PlanEntitlement: "plan_entitlement";
1884
+ readonly Unknown: "unknown";
1885
+ };
1886
+
1887
+ declare type EntitlementType = (typeof EntitlementType)[keyof typeof EntitlementType];
1888
+
1142
1889
  /**
1143
1890
  *
1144
1891
  * @export
@@ -1154,6 +1901,21 @@ declare const EntitlementValueType: {
1154
1901
 
1155
1902
  declare type EntitlementValueType = (typeof EntitlementValueType)[keyof typeof EntitlementValueType];
1156
1903
 
1904
+ /**
1905
+ *
1906
+ * @export
1907
+ */
1908
+ declare const EntitlementValueType_2: {
1909
+ readonly Boolean: "boolean";
1910
+ readonly Credit: "credit";
1911
+ readonly Numeric: "numeric";
1912
+ readonly Trait: "trait";
1913
+ readonly Unknown: "unknown";
1914
+ readonly Unlimited: "unlimited";
1915
+ };
1916
+
1917
+ declare type EntitlementValueType_2 = (typeof EntitlementValueType_2)[keyof typeof EntitlementValueType_2];
1918
+
1157
1919
  declare type Event_2 = {
1158
1920
  api_key: string;
1159
1921
  body: EventBody;
@@ -1278,6 +2040,12 @@ export declare type EventBodyTrack = SchematicContext & {
1278
2040
 
1279
2041
  export declare type EventType = "identify" | "track" | "flag_check";
1280
2042
 
2043
+ /**
2044
+ * Users fetched for one feature's breakdown. The breakdown is read once, not
2045
+ * paged: it lists the heaviest users and says how many more there are.
2046
+ */
2047
+ export declare const FEATURE_USER_USAGE_LIMIT = 20;
2048
+
1281
2049
  /**
1282
2050
  *
1283
2051
  * @export
@@ -1400,6 +2168,48 @@ declare interface FeatureEntitlement {
1400
2168
  warningTiers?: Array<WarningTier>;
1401
2169
  }
1402
2170
 
2171
+ /**
2172
+ *
2173
+ * @export
2174
+ */
2175
+ declare const FeatureType: {
2176
+ readonly Boolean: "boolean";
2177
+ readonly Event: "event";
2178
+ readonly License: "license";
2179
+ readonly Trait: "trait";
2180
+ };
2181
+
2182
+ declare type FeatureType = (typeof FeatureType)[keyof typeof FeatureType];
2183
+
2184
+ /**
2185
+ * One feature the company is entitled to, and its usage. What the server has
2186
+ * already decided, so a consumer never re-derives it:
2187
+ *
2188
+ * * `price` — the one metered price the company is billed at: its billing
2189
+ * period's slot, in the subscription's currency when the feature is priced
2190
+ * in it. Absent when the period has none; another cadence's price is never
2191
+ * substituted.
2192
+ * * `currentCost` — what the feature costs at `price`, in its minor units.
2193
+ * * `perLicenseCreditGrants` — the plan's credit grants that scale with the
2194
+ * license this feature counts.
2195
+ */
2196
+ export declare type FeatureUsage = CompanyFeatureUsageResponseData;
2197
+
2198
+ /**
2199
+ * One event-based feature's usage by user over its current metric period:
2200
+ * a page of `users`, highest usage first; `count` users in all; the period's
2201
+ * `total`; and `unattributed` usage from events sent without a user, which is
2202
+ * not a user and never on the page.
2203
+ */
2204
+ export declare type FeatureUserUsage = CompanyFeatureUserUsageResponseData;
2205
+
2206
+ declare interface FeatureUserUsageRequest {
2207
+ featureId: string;
2208
+ /** Users per page; the server's default when omitted. */
2209
+ limit?: number;
2210
+ offset?: number;
2211
+ }
2212
+
1403
2213
  /**
1404
2214
  * Server prefetch for a provider's `initialData`. A resource that fails is
1405
2215
  * left out rather than thrown, so one of them cannot block a page.
@@ -1468,6 +2278,9 @@ export declare type InvoiceStatus = (typeof InvoiceStatus)[keyof typeof InvoiceS
1468
2278
  /** A record of unique key-value pairs used for identifying a company or user */
1469
2279
  export declare type Keys = Record<string, string>;
1470
2280
 
2281
+ /** A metered price, tiers included. */
2282
+ export declare type MeteredPrice = CatalogPriceResponseData;
2283
+
1471
2284
  /**
1472
2285
  *
1473
2286
  * @export
@@ -1481,6 +2294,19 @@ declare const MetricPeriod: {
1481
2294
 
1482
2295
  declare type MetricPeriod = (typeof MetricPeriod)[keyof typeof MetricPeriod];
1483
2296
 
2297
+ /**
2298
+ *
2299
+ * @export
2300
+ */
2301
+ declare const MetricPeriod_2: {
2302
+ readonly AllTime: "all_time";
2303
+ readonly CurrentDay: "current_day";
2304
+ readonly CurrentMonth: "current_month";
2305
+ readonly CurrentWeek: "current_week";
2306
+ };
2307
+
2308
+ declare type MetricPeriod_2 = (typeof MetricPeriod_2)[keyof typeof MetricPeriod_2];
2309
+
1484
2310
  /**
1485
2311
  *
1486
2312
  * @export
@@ -1492,6 +2318,17 @@ declare const MetricPeriodMonthReset: {
1492
2318
 
1493
2319
  declare type MetricPeriodMonthReset = (typeof MetricPeriodMonthReset)[keyof typeof MetricPeriodMonthReset];
1494
2320
 
2321
+ /**
2322
+ *
2323
+ * @export
2324
+ */
2325
+ declare const MetricPeriodMonthReset_2: {
2326
+ readonly BillingCycle: "billing_cycle";
2327
+ readonly FirstOfMonth: "first_of_month";
2328
+ };
2329
+
2330
+ declare type MetricPeriodMonthReset_2 = (typeof MetricPeriodMonthReset_2)[keyof typeof MetricPeriodMonthReset_2];
2331
+
1495
2332
  /**
1496
2333
  * Keeps only the fields the request reads. The store keys a row set by the
1497
2334
  * query's shape, so a field the API never sees would key a row set of its
@@ -1538,6 +2375,20 @@ export declare interface PaymentMethodsHandle extends ResourceHandle<PaymentMeth
1538
2375
 
1539
2376
  declare type PendingListenerFn = BooleanListenerFn | EmptyListenerFn;
1540
2377
 
2378
+ /** A plan credit grant that scales per license. */
2379
+ export declare type PerLicenseCreditGrant = CatalogCreditGrantResponseData;
2380
+
2381
+ /**
2382
+ *
2383
+ * @export
2384
+ */
2385
+ declare const PlanCreditGrantScaling: {
2386
+ readonly Fixed: "fixed";
2387
+ readonly PerLicense: "per_license";
2388
+ };
2389
+
2390
+ declare type PlanCreditGrantScaling = (typeof PlanCreditGrantScaling)[keyof typeof PlanCreditGrantScaling];
2391
+
1541
2392
  declare type PlanListenerFn = CheckPlanReturnListenerFn | EmptyListenerFn;
1542
2393
 
1543
2394
  declare interface RequestOptions {
@@ -1602,6 +2453,7 @@ declare type RuleType_2 = (typeof RuleType_2)[keyof typeof RuleType_2];
1602
2453
  export declare class Schematic {
1603
2454
  private _additionalHeaders;
1604
2455
  private apiKey;
2456
+ private contextSignatureManager?;
1605
2457
  private _apiUrl;
1606
2458
  private conn;
1607
2459
  private context;
@@ -1680,6 +2532,22 @@ export declare class Schematic {
1680
2532
  * Only logs if debug mode is enabled
1681
2533
  */
1682
2534
  debug(message: string, ...args: unknown[]): void;
2535
+ /**
2536
+ * Resolve the HMAC context-signature value for a context, if a signature
2537
+ * provider is configured. Returns undefined when no provider is set, when
2538
+ * offline, or when the signature could not be obtained.
2539
+ */
2540
+ private contextSignature;
2541
+ /**
2542
+ * Build the `X-Schematic-Context-Sig` header for a context, or an empty
2543
+ * object when no signature is available. Spread into request headers.
2544
+ *
2545
+ * Returns synchronously (not a Promise) when no signature provider is
2546
+ * configured, so callers that dispatch on the same tick (e.g. fire-and-forget
2547
+ * event sends) keep their existing timing; only a configured provider, which
2548
+ * must fetch a signature, yields a Promise.
2549
+ */
2550
+ private contextSignatureHeaders;
1683
2551
  /**
1684
2552
  * Create a persistent message handler for websocket flag updates
1685
2553
  */
@@ -1894,6 +2762,8 @@ declare class SchematicBillingClient implements BillingClient {
1894
2762
  createSetupIntent(): Promise<SetupIntent>;
1895
2763
  updatePaymentMethod(externalId: string): Promise<void>;
1896
2764
  deletePaymentMethod(id: string): Promise<void>;
2765
+ fetchFeatureUsage(): Promise<FeatureUsage[]>;
2766
+ fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
1897
2767
  }
1898
2768
 
1899
2769
  /** Context for checking flags and sending events */
@@ -1974,6 +2844,9 @@ declare namespace SchematicJS {
1974
2844
  BillingResourceParams_2 as BillingResourceParams,
1975
2845
  BillingResources_2 as BillingResources,
1976
2846
  BooleanListenerFn,
2847
+ CatalogCreditGrantResponseData,
2848
+ CatalogPriceResponseData,
2849
+ CatalogPriceTierResponseData,
1977
2850
  CheckFlagResponseData,
1978
2851
  CheckFlagReturn,
1979
2852
  CheckFlagReturnFromJSON,
@@ -1984,9 +2857,13 @@ declare namespace SchematicJS {
1984
2857
  CheckPlanReturnListenerFn,
1985
2858
  CompanyCreditBalance,
1986
2859
  CompanyDiscountResponseData,
2860
+ CompanyFeatureUsageResponseData,
2861
+ CompanyFeatureUserUsageResponseData,
1987
2862
  CompanyInvoiceResponseData,
1988
2863
  CompanyPaymentMethodResponseData,
1989
2864
  CompanyUpcomingInvoiceResponseData,
2865
+ CompanyUserUsageResponseData,
2866
+ ContextSignatureProvider,
1990
2867
  CreditBalance,
1991
2868
  CreditBalanceListenerFn,
1992
2869
  CreditBalances,
@@ -2010,6 +2887,8 @@ declare namespace SchematicJS {
2010
2887
  EventBodyIdentify,
2011
2888
  EventBodyTrack,
2012
2889
  EventType,
2890
+ FeatureUsage,
2891
+ FeatureUserUsage,
2013
2892
  FlagCheckListenerFn,
2014
2893
  FlagValueListenerFn,
2015
2894
  Invoice,
@@ -2021,8 +2900,10 @@ declare namespace SchematicJS {
2021
2900
  InvoicesResult,
2022
2901
  InvoiceStatus,
2023
2902
  Keys,
2903
+ MeteredPrice,
2024
2904
  PaymentMethod,
2025
2905
  PendingListenerFn,
2906
+ PerLicenseCreditGrant,
2026
2907
  PlanListenerFn,
2027
2908
  RequestOptions,
2028
2909
  ResourceState,
@@ -2047,6 +2928,7 @@ declare namespace SchematicJS {
2047
2928
  TrialStatus,
2048
2929
  UpcomingInvoice,
2049
2930
  UsagePeriod,
2931
+ UserUsage,
2050
2932
  WarningTier
2051
2933
  }
2052
2934
  }
@@ -2061,6 +2943,16 @@ export declare type SchematicOptions = {
2061
2943
  debug?: boolean;
2062
2944
  /** Optionally provide a custom event URL */
2063
2945
  eventUrl?: string;
2946
+ /** Optionally provide a function that returns an HMAC context signature
2947
+ * (`iat.exp.sig`) for a given context. Required only when the Schematic
2948
+ * environment has context-signature verification enabled. Because a
2949
+ * publishable key is public, the signature must be produced by your backend
2950
+ * (which holds the matching secret API key); this function typically forwards
2951
+ * the context to that backend and returns the value it computes. The SDK
2952
+ * caches the signature per context, derives its expiry from the returned
2953
+ * string, and attaches it as the `X-Schematic-Context-Sig` header on flag
2954
+ * checks, the WebSocket bootstrap, and events. */
2955
+ getContextSignature?: ContextSignatureProvider;
2064
2956
  /** Enable offline mode to prevent all network requests.
2065
2957
  * When enabled, events are only logged not sent, and flag checks return fallback values.
2066
2958
  * Can also be enabled at runtime via URL query parameter "schematic_offline=true" */
@@ -2342,6 +3234,19 @@ export declare enum UsagePeriod {
2342
3234
 
2343
3235
  export declare function useBillingDataSource(): BillingDataSource;
2344
3236
 
3237
+ /**
3238
+ * Every feature the company is entitled to, with its usage. `data` is empty
3239
+ * when it is entitled to nothing; `undefined` is what means not loaded yet.
3240
+ */
3241
+ export declare function useFeatureUsage(): ResourceHandle<FeatureUsage[]>;
3242
+
3243
+ /**
3244
+ * One event-based feature's usage by user over its metric period: the
3245
+ * heaviest users, how many there are in all, and usage sent without a user.
3246
+ * A feature the company has no event-based entitlement to fails with a 404.
3247
+ */
3248
+ export declare function useFeatureUserUsage(featureId: string): ResourceHandle<FeatureUserUsage>;
3249
+
2345
3250
  /** Reloads every loaded billing resource (after a plan change, for instance). */
2346
3251
  export declare function useInvalidateBillingData(): () => void;
2347
3252
 
@@ -2364,6 +3269,8 @@ export declare function useInvoices(query?: InvoiceQuery): InvoicesHandle;
2364
3269
  */
2365
3270
  export declare function usePaymentMethods(): PaymentMethodsHandle;
2366
3271
 
3272
+ export declare type UserUsage = CompanyUserUsageResponseData;
3273
+
2367
3274
  export declare const useSchematic: () => SchematicContextProps;
2368
3275
 
2369
3276
  export declare const useSchematicContext: (opts?: SchematicHookOpts) => {