@schematichq/schematic-react 1.18.1 → 1.19.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.
@@ -110,6 +110,12 @@ declare namespace billingApi {
110
110
  BillingCreditGrantReasonToJSON,
111
111
  BillingCreditGrantReasonToJSONTyped,
112
112
  BillingCreditGrantReason,
113
+ instanceOfBillingCreditGrantZeroedOutReason,
114
+ BillingCreditGrantZeroedOutReasonFromJSON,
115
+ BillingCreditGrantZeroedOutReasonFromJSONTyped,
116
+ BillingCreditGrantZeroedOutReasonToJSON,
117
+ BillingCreditGrantZeroedOutReasonToJSONTyped,
118
+ BillingCreditGrantZeroedOutReason,
113
119
  instanceOfBillingPlanCreditGrantResetCadence,
114
120
  BillingPlanCreditGrantResetCadenceFromJSON,
115
121
  BillingPlanCreditGrantResetCadenceFromJSONTyped,
@@ -422,6 +428,42 @@ declare namespace billingApi {
422
428
  CompanyCreditGrantResponseDataToJSON,
423
429
  CompanyCreditGrantResponseDataToJSONTyped,
424
430
  CompanyCreditGrantResponseData,
431
+ instanceOfCompanyCreditLedgerBundleResponseData,
432
+ CompanyCreditLedgerBundleResponseDataFromJSON,
433
+ CompanyCreditLedgerBundleResponseDataFromJSONTyped,
434
+ CompanyCreditLedgerBundleResponseDataToJSON,
435
+ CompanyCreditLedgerBundleResponseDataToJSONTyped,
436
+ CompanyCreditLedgerBundleResponseData,
437
+ instanceOfCompanyCreditLedgerCreditResponseData,
438
+ CompanyCreditLedgerCreditResponseDataFromJSON,
439
+ CompanyCreditLedgerCreditResponseDataFromJSONTyped,
440
+ CompanyCreditLedgerCreditResponseDataToJSON,
441
+ CompanyCreditLedgerCreditResponseDataToJSONTyped,
442
+ CompanyCreditLedgerCreditResponseData,
443
+ instanceOfCompanyCreditLedgerEntryResponseData,
444
+ CompanyCreditLedgerEntryResponseDataFromJSON,
445
+ CompanyCreditLedgerEntryResponseDataFromJSONTyped,
446
+ CompanyCreditLedgerEntryResponseDataToJSON,
447
+ CompanyCreditLedgerEntryResponseDataToJSONTyped,
448
+ CompanyCreditLedgerEntryResponseData,
449
+ instanceOfCompanyCreditLedgerFeatureResponseData,
450
+ CompanyCreditLedgerFeatureResponseDataFromJSON,
451
+ CompanyCreditLedgerFeatureResponseDataFromJSONTyped,
452
+ CompanyCreditLedgerFeatureResponseDataToJSON,
453
+ CompanyCreditLedgerFeatureResponseDataToJSONTyped,
454
+ CompanyCreditLedgerFeatureResponseData,
455
+ instanceOfCompanyCreditLedgerResponseData,
456
+ CompanyCreditLedgerResponseDataFromJSON,
457
+ CompanyCreditLedgerResponseDataFromJSONTyped,
458
+ CompanyCreditLedgerResponseDataToJSON,
459
+ CompanyCreditLedgerResponseDataToJSONTyped,
460
+ CompanyCreditLedgerResponseData,
461
+ instanceOfCompanyCreditLedgerUserResponseData,
462
+ CompanyCreditLedgerUserResponseDataFromJSON,
463
+ CompanyCreditLedgerUserResponseDataFromJSONTyped,
464
+ CompanyCreditLedgerUserResponseDataToJSON,
465
+ CompanyCreditLedgerUserResponseDataToJSONTyped,
466
+ CompanyCreditLedgerUserResponseData,
425
467
  instanceOfCompanyCreditUserUsageResponseData,
426
468
  CompanyCreditUserUsageResponseDataFromJSON,
427
469
  CompanyCreditUserUsageResponseDataFromJSONTyped,
@@ -524,6 +566,18 @@ declare namespace billingApi {
524
566
  CreateSetupIntentResponseToJSON,
525
567
  CreateSetupIntentResponseToJSONTyped,
526
568
  CreateSetupIntentResponse,
569
+ instanceOfCreditLedgerEntryKind,
570
+ CreditLedgerEntryKindFromJSON,
571
+ CreditLedgerEntryKindFromJSONTyped,
572
+ CreditLedgerEntryKindToJSON,
573
+ CreditLedgerEntryKindToJSONTyped,
574
+ CreditLedgerEntryKind,
575
+ instanceOfCreditUsageReason,
576
+ CreditUsageReasonFromJSON,
577
+ CreditUsageReasonFromJSONTyped,
578
+ CreditUsageReasonToJSON,
579
+ CreditUsageReasonToJSONTyped,
580
+ CreditUsageReason,
527
581
  instanceOfCurrency,
528
582
  CurrencyFromJSON,
529
583
  CurrencyFromJSONTyped,
@@ -614,6 +668,18 @@ declare namespace billingApi {
614
668
  GetCompanyCreditBalancesResponseToJSON,
615
669
  GetCompanyCreditBalancesResponseToJSONTyped,
616
670
  GetCompanyCreditBalancesResponse,
671
+ instanceOfGetCompanyCreditLedgerParams,
672
+ GetCompanyCreditLedgerParamsFromJSON,
673
+ GetCompanyCreditLedgerParamsFromJSONTyped,
674
+ GetCompanyCreditLedgerParamsToJSON,
675
+ GetCompanyCreditLedgerParamsToJSONTyped,
676
+ GetCompanyCreditLedgerParams,
677
+ instanceOfGetCompanyCreditLedgerResponse,
678
+ GetCompanyCreditLedgerResponseFromJSON,
679
+ GetCompanyCreditLedgerResponseFromJSONTyped,
680
+ GetCompanyCreditLedgerResponseToJSON,
681
+ GetCompanyCreditLedgerResponseToJSONTyped,
682
+ GetCompanyCreditLedgerResponse,
617
683
  instanceOfGetCompanyCreditUserUsageParams,
618
684
  GetCompanyCreditUserUsageParamsFromJSON,
619
685
  GetCompanyCreditUserUsageParamsFromJSONTyped,
@@ -921,6 +987,8 @@ declare interface BillingClient {
921
987
  fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
922
988
  /** Empty when the company holds no credits and its plan draws on none. */
923
989
  fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
990
+ /** A page of the company's credit activity, newest first. */
991
+ fetchCreditLedger(params: CreditLedgerRequest): Promise<CreditLedgerPage>;
924
992
  /** One credit's consumption by user over the span of its live grants. */
925
993
  fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
926
994
  /** The company's plan, add-ons, and subscription state. */
@@ -984,7 +1052,7 @@ declare type BillingCreditExpiryUnit = (typeof BillingCreditExpiryUnit)[keyof ty
984
1052
  *
985
1053
  * @export
986
1054
  */
987
- declare const BillingCreditGrantReason: {
1055
+ export declare const BillingCreditGrantReason: {
988
1056
  readonly Adjustment: "adjustment";
989
1057
  readonly BillingCreditAutoTopup: "billing_credit_auto_topup";
990
1058
  readonly Free: "free";
@@ -996,7 +1064,24 @@ declare const BillingCreditGrantReason: {
996
1064
  readonly Rollover: "rollover";
997
1065
  };
998
1066
 
999
- declare type BillingCreditGrantReason = (typeof BillingCreditGrantReason)[keyof typeof BillingCreditGrantReason];
1067
+ export declare type BillingCreditGrantReason = (typeof BillingCreditGrantReason)[keyof typeof BillingCreditGrantReason];
1068
+
1069
+ /**
1070
+ *
1071
+ * @export
1072
+ */
1073
+ export declare const BillingCreditGrantZeroedOutReason: {
1074
+ readonly CustomerArchived: "customer_archived";
1075
+ readonly Expired: "expired";
1076
+ readonly IntegrationUninstalled: "integration_uninstalled";
1077
+ readonly LicenseRetired: "license_retired";
1078
+ readonly Manual: "manual";
1079
+ readonly PlanChange: "plan_change";
1080
+ readonly PlanPeriodReset: "plan_period_reset";
1081
+ readonly Reconciled: "reconciled";
1082
+ };
1083
+
1084
+ export declare type BillingCreditGrantZeroedOutReason = (typeof BillingCreditGrantZeroedOutReason)[keyof typeof BillingCreditGrantZeroedOutReason];
1000
1085
 
1001
1086
  /**
1002
1087
  * A prefetch or fixture. An omitted key reports as pending; a keyed resource
@@ -1015,7 +1100,7 @@ export declare type BillingData = {
1015
1100
  sessionKey?: string;
1016
1101
  };
1017
1102
 
1018
- export declare function BillingDataProvider({ actions, children, creditUserUsage, data, featureUserUsage, locale, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
1103
+ export declare function BillingDataProvider({ actions, children, creditUserUsage, data, featureUserUsage, locale, onLoadMoreCreditLedger, onLoadMoreInvoices, onMissingString, onRefetch, status, strings, translate, }: BillingDataProviderProps): React_2.JSX.Element;
1019
1104
 
1020
1105
  declare interface BillingDataProviderDataProps {
1021
1106
  /** A missing key reports as pending. */
@@ -1028,6 +1113,7 @@ declare interface BillingDataProviderDataProps {
1028
1113
  status?: BillingDataStatus;
1029
1114
  onRefetch?: (name: BillingResourceName) => void;
1030
1115
  onLoadMoreInvoices?: (query: InvoiceQuery) => void;
1116
+ onLoadMoreCreditLedger?: (query: CreditLedgerQuery) => void;
1031
1117
  /**
1032
1118
  * What the write hooks call. Each rejects on its own; an action left out
1033
1119
  * rejects with `BILLING_ACTION_UNAVAILABLE_MESSAGE`. Nothing here touches
@@ -1068,6 +1154,8 @@ export declare interface BillingDataSource {
1068
1154
  creditUserUsage(creditId: string): ResourceHandle<CreditUserUsage>;
1069
1155
  /** Never rejects: a failure lands on the resource's `error`. */
1070
1156
  loadMoreInvoices: (query: InvoiceQuery) => Promise<void>;
1157
+ /** Never rejects, as `loadMoreInvoices`. */
1158
+ loadMoreCreditLedger: (query: CreditLedgerQuery) => Promise<void>;
1071
1159
  invalidateAll: () => void;
1072
1160
  /** Absent on a source that only reads. */
1073
1161
  actions?: BillingActions;
@@ -1117,6 +1205,8 @@ declare interface BillingPrefetchOptions {
1117
1205
  names: BillingResourceName_2[];
1118
1206
  /** The invoice query to prefetch for; the element must ask the same one. */
1119
1207
  invoices?: InvoiceQuery;
1208
+ /** The credit ledger query to prefetch for; the element must ask the same one. */
1209
+ creditLedger?: CreditLedgerQuery;
1120
1210
  /**
1121
1211
  * The catalog to prefetch, as `catalog` or `publicCatalog`; the element
1122
1212
  * must ask the same one.
@@ -1162,7 +1252,7 @@ export declare function BillingProvider({ billingClient, children, initialData,
1162
1252
  * much. Named apart from schematic-js's `BillingClient`, which is the whole
1163
1253
  * interface; this is the part the hooks here call.
1164
1254
  */
1165
- export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchCatalog" | "createCheckout" | "getCheckout" | "updateCheckout" | "finalizeCheckout" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage" | "fetchCreditBalances" | "fetchCreditUserUsage" | "fetchCompany" | "cancelSubscription" | "fetchTaxIds" | "updateTaxId"> & Partial<Pick<BillingClient, "fetchPublicCatalog" | "hasPublishableKey" | "fetchInvoiceLink">>;
1255
+ export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchCatalog" | "createCheckout" | "getCheckout" | "updateCheckout" | "finalizeCheckout" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage" | "fetchCreditBalances" | "fetchCreditLedger" | "fetchCreditUserUsage" | "fetchCompany" | "cancelSubscription" | "fetchTaxIds" | "updateTaxId"> & Partial<Pick<BillingClient, "fetchPublicCatalog" | "hasPublishableKey" | "fetchInvoiceLink">>;
1166
1256
 
1167
1257
  declare interface BillingProviderDataProps {
1168
1258
  /**
@@ -1215,7 +1305,7 @@ declare const BillingProviderType: {
1215
1305
  declare type BillingProviderType = (typeof BillingProviderType)[keyof typeof BillingProviderType];
1216
1306
 
1217
1307
  /** The resources this package serves; a key of schematic-js's contract. */
1218
- export declare type BillingResourceName = "catalog" | "publicCatalog" | "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage" | "creditBalances" | "company" | "taxIds";
1308
+ export declare type BillingResourceName = "catalog" | "publicCatalog" | "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage" | "creditBalances" | "creditLedger" | "company" | "taxIds";
1219
1309
 
1220
1310
  declare type BillingResourceName_2 = keyof BillingResources_2;
1221
1311
 
@@ -1230,6 +1320,7 @@ declare interface BillingResourceParams_2 {
1230
1320
  paymentMethods: Record<string, never>;
1231
1321
  featureUsage: Record<string, never>;
1232
1322
  creditBalances: Record<string, never>;
1323
+ creditLedger: CreditLedgerQuery;
1233
1324
  company: Record<string, never>;
1234
1325
  taxIds: Record<string, never>;
1235
1326
  }
@@ -1279,6 +1370,8 @@ declare interface BillingResources_2 {
1279
1370
  * loaded.
1280
1371
  */
1281
1372
  creditBalances: CreditBalanceEntry[];
1373
+ /** `GET /company/credits/ledger?limit&offset&credit_ids&include_grants`. */
1374
+ creditLedger: CreditLedgerPage;
1282
1375
  /** `GET /company`. */
1283
1376
  company: Company;
1284
1377
  /**
@@ -3834,6 +3927,7 @@ export declare const CheckoutStatus: {
3834
3927
  readonly Completed: "completed";
3835
3928
  readonly Expired: "expired";
3836
3929
  readonly Open: "open";
3930
+ readonly PendingPayment: "pending_payment";
3837
3931
  };
3838
3932
 
3839
3933
  export declare type CheckoutStatus = (typeof CheckoutStatus)[keyof typeof CheckoutStatus];
@@ -4586,6 +4680,216 @@ declare interface CompanyCreditGrantResponseData {
4586
4680
  validFrom?: Date | null;
4587
4681
  }
4588
4682
 
4683
+ /**
4684
+ * Components API
4685
+ * The browser-facing billing API behind the drop-in components and the schematic-react hooks. A temporary access token scopes every call to one company.
4686
+ *
4687
+ * The version of the OpenAPI document: 0.1
4688
+ *
4689
+ *
4690
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4691
+ * https://openapi-generator.tech
4692
+ * Do not edit the class manually.
4693
+ */
4694
+ /**
4695
+ *
4696
+ * @export
4697
+ * @interface CompanyCreditLedgerBundleResponseData
4698
+ */
4699
+ declare interface CompanyCreditLedgerBundleResponseData {
4700
+ /**
4701
+ *
4702
+ * @type {string}
4703
+ * @memberof CompanyCreditLedgerBundleResponseData
4704
+ */
4705
+ id: string;
4706
+ /**
4707
+ *
4708
+ * @type {string}
4709
+ * @memberof CompanyCreditLedgerBundleResponseData
4710
+ */
4711
+ name: string;
4712
+ }
4713
+
4714
+ /**
4715
+ * Components API
4716
+ * The browser-facing billing API behind the drop-in components and the schematic-react hooks. A temporary access token scopes every call to one company.
4717
+ *
4718
+ * The version of the OpenAPI document: 0.1
4719
+ *
4720
+ *
4721
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4722
+ * https://openapi-generator.tech
4723
+ * Do not edit the class manually.
4724
+ */
4725
+ /**
4726
+ *
4727
+ * @export
4728
+ * @interface CompanyCreditLedgerCreditResponseData
4729
+ */
4730
+ declare interface CompanyCreditLedgerCreditResponseData {
4731
+ /**
4732
+ *
4733
+ * @type {string}
4734
+ * @memberof CompanyCreditLedgerCreditResponseData
4735
+ */
4736
+ id: string;
4737
+ /**
4738
+ *
4739
+ * @type {string}
4740
+ * @memberof CompanyCreditLedgerCreditResponseData
4741
+ */
4742
+ name: string;
4743
+ /**
4744
+ * How an amount of the credit reads in the plural; null when unset, or once the credit is deleted.
4745
+ * @type {string}
4746
+ * @memberof CompanyCreditLedgerCreditResponseData
4747
+ */
4748
+ pluralName?: string | null;
4749
+ /**
4750
+ * How one of the credit reads; null when unset, or once the credit is deleted.
4751
+ * @type {string}
4752
+ * @memberof CompanyCreditLedgerCreditResponseData
4753
+ */
4754
+ singularName?: string | null;
4755
+ }
4756
+
4757
+ /**
4758
+ *
4759
+ * @export
4760
+ * @interface CompanyCreditLedgerEntryResponseData
4761
+ */
4762
+ declare interface CompanyCreditLedgerEntryResponseData {
4763
+ /**
4764
+ * Signed change to the balance: negative for draws and expiries, positive for grants and refunded draws.
4765
+ * @type {number}
4766
+ * @memberof CompanyCreditLedgerEntryResponseData
4767
+ */
4768
+ amount: number;
4769
+ /**
4770
+ * The bundle a purchased or auto top-up grant came from; null otherwise, or once the bundle is deleted.
4771
+ * @type {CompanyCreditLedgerBundleResponseData}
4772
+ * @memberof CompanyCreditLedgerEntryResponseData
4773
+ */
4774
+ bundle?: CompanyCreditLedgerBundleResponseData | null;
4775
+ /**
4776
+ *
4777
+ * @type {CompanyCreditLedgerCreditResponseData}
4778
+ * @memberof CompanyCreditLedgerEntryResponseData
4779
+ */
4780
+ credit: CompanyCreditLedgerCreditResponseData;
4781
+ /**
4782
+ *
4783
+ * @type {Date}
4784
+ * @memberof CompanyCreditLedgerEntryResponseData
4785
+ */
4786
+ eventAt: Date;
4787
+ /**
4788
+ * The feature a draw was for; null on grants and expiries, and once the feature is deleted.
4789
+ * @type {CompanyCreditLedgerFeatureResponseData}
4790
+ * @memberof CompanyCreditLedgerEntryResponseData
4791
+ */
4792
+ feature?: CompanyCreditLedgerFeatureResponseData | null;
4793
+ /**
4794
+ * Why the grant was made, on grants and on the expiries of grants; null on draws.
4795
+ * @type {BillingCreditGrantReason}
4796
+ * @memberof CompanyCreditLedgerEntryResponseData
4797
+ */
4798
+ grantReason?: BillingCreditGrantReason | null;
4799
+ /**
4800
+ * Stable across pages. A draw written against several grants is one entry.
4801
+ * @type {string}
4802
+ * @memberof CompanyCreditLedgerEntryResponseData
4803
+ */
4804
+ id: string;
4805
+ /**
4806
+ * drawdown, grant or zero_out.
4807
+ * @type {CreditLedgerEntryKind}
4808
+ * @memberof CompanyCreditLedgerEntryResponseData
4809
+ */
4810
+ kind: CreditLedgerEntryKind;
4811
+ /**
4812
+ * On draws: track, inference or manual_adjustment; null on draws recorded before reasons were.
4813
+ * @type {CreditUsageReason}
4814
+ * @memberof CompanyCreditLedgerEntryResponseData
4815
+ */
4816
+ usageReason?: CreditUsageReason | null;
4817
+ /**
4818
+ * The user a draw is attributed to; null when the usage was sent without a user.
4819
+ * @type {CompanyCreditLedgerUserResponseData}
4820
+ * @memberof CompanyCreditLedgerEntryResponseData
4821
+ */
4822
+ user?: CompanyCreditLedgerUserResponseData | null;
4823
+ /**
4824
+ * On expiries: why the remaining credits were removed.
4825
+ * @type {BillingCreditGrantZeroedOutReason}
4826
+ * @memberof CompanyCreditLedgerEntryResponseData
4827
+ */
4828
+ zeroedOutReason?: BillingCreditGrantZeroedOutReason | null;
4829
+ }
4830
+
4831
+ /**
4832
+ * Components API
4833
+ * The browser-facing billing API behind the drop-in components and the schematic-react hooks. A temporary access token scopes every call to one company.
4834
+ *
4835
+ * The version of the OpenAPI document: 0.1
4836
+ *
4837
+ *
4838
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4839
+ * https://openapi-generator.tech
4840
+ * Do not edit the class manually.
4841
+ */
4842
+ /**
4843
+ *
4844
+ * @export
4845
+ * @interface CompanyCreditLedgerFeatureResponseData
4846
+ */
4847
+ declare interface CompanyCreditLedgerFeatureResponseData {
4848
+ /**
4849
+ *
4850
+ * @type {string}
4851
+ * @memberof CompanyCreditLedgerFeatureResponseData
4852
+ */
4853
+ id: string;
4854
+ /**
4855
+ *
4856
+ * @type {string}
4857
+ * @memberof CompanyCreditLedgerFeatureResponseData
4858
+ */
4859
+ name: string;
4860
+ }
4861
+
4862
+ /**
4863
+ * Components API
4864
+ * The browser-facing billing API behind the drop-in components and the schematic-react hooks. A temporary access token scopes every call to one company.
4865
+ *
4866
+ * The version of the OpenAPI document: 0.1
4867
+ *
4868
+ *
4869
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
4870
+ * https://openapi-generator.tech
4871
+ * Do not edit the class manually.
4872
+ */
4873
+ /**
4874
+ *
4875
+ * @export
4876
+ * @interface CompanyCreditLedgerUserResponseData
4877
+ */
4878
+ declare interface CompanyCreditLedgerUserResponseData {
4879
+ /**
4880
+ *
4881
+ * @type {string}
4882
+ * @memberof CompanyCreditLedgerUserResponseData
4883
+ */
4884
+ id: string;
4885
+ /**
4886
+ *
4887
+ * @type {string}
4888
+ * @memberof CompanyCreditLedgerUserResponseData
4889
+ */
4890
+ name: string;
4891
+ }
4892
+
4589
4893
  /**
4590
4894
  *
4591
4895
  * @export
@@ -5320,6 +5624,8 @@ declare interface CompanyUserUsageResponseData {
5320
5624
  */
5321
5625
  declare type ContextSignatureProvider = (context: SchematicContext) => string | Promise<string>;
5322
5626
 
5627
+ export declare const CREDIT_LEDGER_PAGE_SIZE = 20;
5628
+
5323
5629
  export declare type CreditAutoTopup = CompanyCreditAutoTopupResponseData;
5324
5630
 
5325
5631
  /** A company's lease-aware balance for a single credit type */
@@ -5361,6 +5667,59 @@ export declare type CreditComposition = CompanyCreditCompositionResponseData;
5361
5667
 
5362
5668
  export declare type CreditGrant = CompanyCreditGrantResponseData;
5363
5669
 
5670
+ /**
5671
+ * One change to a balance, as the server has already folded it:
5672
+ *
5673
+ * * A draw written against several grants is one entry, and each user's
5674
+ * share of a draw is its own.
5675
+ * * `amount` is signed — negative for draws and expiries, positive for
5676
+ * grants and refunded draws.
5677
+ * * `kind` is `drawdown`, `grant` or `zero_out`; the reason beside it says
5678
+ * whether a grant is a top-up or a zero-out an expiry.
5679
+ */
5680
+ export declare type CreditLedgerEntry = CompanyCreditLedgerEntryResponseData;
5681
+
5682
+ /**
5683
+ *
5684
+ * @export
5685
+ */
5686
+ export declare const CreditLedgerEntryKind: {
5687
+ readonly Adjustment: "adjustment";
5688
+ readonly Charge: "charge";
5689
+ readonly Drawdown: "drawdown";
5690
+ readonly Grant: "grant";
5691
+ readonly Settlement: "settlement";
5692
+ readonly Transfer: "transfer";
5693
+ readonly ZeroOut: "zero_out";
5694
+ };
5695
+
5696
+ export declare type CreditLedgerEntryKind = (typeof CreditLedgerEntryKind)[keyof typeof CreditLedgerEntryKind];
5697
+
5698
+ export declare interface CreditLedgerHandle extends ResourceHandle<CreditLedgerPage> {
5699
+ /** Requests the next page, as `InvoicesHandle.loadMore` does. */
5700
+ loadMore: () => Promise<void>;
5701
+ }
5702
+
5703
+ export declare interface CreditLedgerPage {
5704
+ entries: CreditLedgerEntry[];
5705
+ /** Reads the page after this one; absent on the last page. */
5706
+ nextCursor?: string;
5707
+ }
5708
+
5709
+ /** Each distinct query is its own row set with its own paging. */
5710
+ export declare interface CreditLedgerQuery {
5711
+ /** Only these credits, by id. All credits when omitted or empty. */
5712
+ credits?: string[];
5713
+ /** Grants and expiries alongside draws. Default true. */
5714
+ includeGrants?: boolean;
5715
+ }
5716
+
5717
+ declare interface CreditLedgerRequest extends CreditLedgerQuery {
5718
+ /** The previous page's `nextCursor`; the newest page when omitted. */
5719
+ cursor?: string;
5720
+ limit: number;
5721
+ }
5722
+
5364
5723
  /** Every spend policy binding the current context, company-scope first */
5365
5724
  export declare type CreditSpendPolicies = CreditSpendPolicy[];
5366
5725
 
@@ -5514,6 +5873,23 @@ declare interface CreditSpendWindow_2 {
5514
5873
  unit: string;
5515
5874
  }
5516
5875
 
5876
+ /**
5877
+ *
5878
+ * @export
5879
+ */
5880
+ export declare const CreditUsageReason: {
5881
+ readonly Inference: "inference";
5882
+ readonly LeaseHold: "lease_hold";
5883
+ readonly LeaseRelease: "lease_release";
5884
+ readonly ManualAdjustment: "manual_adjustment";
5885
+ readonly Reconciliation: "reconciliation";
5886
+ readonly ReservationHold: "reservation_hold";
5887
+ readonly ReservationRelease: "reservation_release";
5888
+ readonly Track: "track";
5889
+ };
5890
+
5891
+ export declare type CreditUsageReason = (typeof CreditUsageReason)[keyof typeof CreditUsageReason];
5892
+
5517
5893
  /**
5518
5894
  * One credit's consumption by user over the span of its live grants: a page
5519
5895
  * of `users`, heaviest first; `count` users in all; the span's `total`; and
@@ -5723,6 +6099,8 @@ declare function DatastreamCompanyPlanFromJSON(json: any): DatastreamCompanyPlan
5723
6099
 
5724
6100
  export declare const DEFAULT_CATALOG_QUERY: CatalogQuery;
5725
6101
 
6102
+ export declare const DEFAULT_CREDIT_LEDGER_QUERY: CreditLedgerQuery;
6103
+
5726
6104
  export declare const DEFAULT_INVOICE_QUERY: InvoiceQuery;
5727
6105
 
5728
6106
  export declare type Discount = CompanyDiscountResponseData;
@@ -6219,6 +6597,15 @@ export declare function normalizeCatalogQuery(query: CatalogQuery): CatalogQuery
6219
6597
  /** As for invoices: `{ catalogId: undefined }` is the same resource as `{}`. */
6220
6598
  declare function normalizeCatalogQuery_2(query: CatalogQuery): CatalogQuery;
6221
6599
 
6600
+ /** As `normalizeInvoiceQuery`: only the credits and `includeGrants` key a ledger. */
6601
+ export declare function normalizeCreditLedgerQuery(query: CreditLedgerQuery): CreditLedgerQuery;
6602
+
6603
+ /**
6604
+ * Keyed by shape, like the invoice query: `{ includeGrants: true }` and `{}`
6605
+ * are one row set, and so are the same credits in another order.
6606
+ */
6607
+ declare function normalizeCreditLedgerQuery_2(query: CreditLedgerQuery): CreditLedgerQuery;
6608
+
6222
6609
  /**
6223
6610
  * Keeps only the fields the request reads. The store keys a row set by the
6224
6611
  * query's shape, so a field the API never sees would key a row set of its
@@ -6806,6 +7193,7 @@ declare class SchematicBillingClient implements BillingClient {
6806
7193
  fetchFeatureUsage(): Promise<FeatureUsage[]>;
6807
7194
  fetchCompany(): Promise<Company>;
6808
7195
  fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
7196
+ fetchCreditLedger(params: CreditLedgerRequest): Promise<CreditLedgerPage>;
6809
7197
  fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
6810
7198
  fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
6811
7199
  }
@@ -6877,6 +7265,7 @@ declare namespace SchematicJS {
6877
7265
  EventBodyFlagCheckToJSON,
6878
7266
  fetchBillingData,
6879
7267
  normalizeCatalogQuery_2 as normalizeCatalogQuery,
7268
+ normalizeCreditLedgerQuery_2 as normalizeCreditLedgerQuery,
6880
7269
  normalizeInvoiceQuery_2 as normalizeInvoiceQuery,
6881
7270
  sessionKey,
6882
7271
  AccessToken,
@@ -6885,6 +7274,8 @@ declare namespace SchematicJS {
6885
7274
  billingApi,
6886
7275
  BillingClient,
6887
7276
  BillingClientOptions,
7277
+ BillingCreditGrantReason,
7278
+ BillingCreditGrantZeroedOutReason,
6888
7279
  BillingData,
6889
7280
  BillingPrefetchOptions,
6890
7281
  BillingResourceName_2 as BillingResourceName,
@@ -6949,6 +7340,11 @@ declare namespace SchematicJS {
6949
7340
  CompanyCreditBalanceResponseData,
6950
7341
  CompanyCreditCompositionResponseData,
6951
7342
  CompanyCreditGrantResponseData,
7343
+ CompanyCreditLedgerBundleResponseData,
7344
+ CompanyCreditLedgerCreditResponseData,
7345
+ CompanyCreditLedgerEntryResponseData,
7346
+ CompanyCreditLedgerFeatureResponseData,
7347
+ CompanyCreditLedgerUserResponseData,
6952
7348
  CompanyCreditUserUsageResponseData,
6953
7349
  CompanyCreditUserUsageRowResponseData,
6954
7350
  CompanyDiscountResponseData,
@@ -6962,6 +7358,7 @@ declare namespace SchematicJS {
6962
7358
  CompanyUpcomingInvoiceResponseData,
6963
7359
  CompanyUserUsageResponseData,
6964
7360
  ContextSignatureProvider,
7361
+ CREDIT_LEDGER_PAGE_SIZE,
6965
7362
  CreditAutoTopup,
6966
7363
  CreditBalance,
6967
7364
  CreditBalanceEntry,
@@ -6971,6 +7368,11 @@ declare namespace SchematicJS {
6971
7368
  CreditBalancesListenerFn,
6972
7369
  CreditComposition,
6973
7370
  CreditGrant,
7371
+ CreditLedgerEntry,
7372
+ CreditLedgerEntryKind,
7373
+ CreditLedgerPage,
7374
+ CreditLedgerQuery,
7375
+ CreditLedgerRequest,
6974
7376
  CreditSpendPolicies,
6975
7377
  creditSpendPoliciesEqual,
6976
7378
  CreditSpendPoliciesFromJSON,
@@ -6980,10 +7382,12 @@ declare namespace SchematicJS {
6980
7382
  CreditSpendPolicyListenerFn,
6981
7383
  CreditSpendPolicyScope,
6982
7384
  CreditSpendWindow,
7385
+ CreditUsageReason,
6983
7386
  CreditUserUsage,
6984
7387
  CreditUserUsageRow,
6985
7388
  CustomPlanBilling,
6986
7389
  DEFAULT_CATALOG_QUERY,
7390
+ DEFAULT_CREDIT_LEDGER_QUERY,
6987
7391
  DEFAULT_INVOICE_QUERY,
6988
7392
  Discount,
6989
7393
  EmptyListenerFn,
@@ -7646,6 +8050,13 @@ export declare function useCompany(): ResourceHandle<Company>;
7646
8050
  */
7647
8051
  export declare function useCreditBalances(): ResourceHandle<CreditBalanceEntry[]>;
7648
8052
 
8053
+ /**
8054
+ * The company's credit activity for `query`, newest first: draws by feature
8055
+ * and user, grants, and expiries. Each distinct query is its own list with
8056
+ * its own paging; an inline object literal is fine, the hook keys by value.
8057
+ */
8058
+ export declare function useCreditLedger(query?: CreditLedgerQuery): CreditLedgerHandle;
8059
+
7649
8060
  /**
7650
8061
  * One credit's consumption by user over the span of its live grants: the
7651
8062
  * heaviest users, how many there are in all, and consumption from events