@schematichq/schematic-react 1.12.0 → 1.14.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.
@@ -57,6 +57,8 @@ export declare interface BillingActions {
57
57
  removePaymentMethod(id: string): Promise<void>;
58
58
  /** Mints a new setup intent every call; nothing is cached. */
59
59
  createSetupIntent(): Promise<SetupIntent>;
60
+ /** Cancels the subscription at period end and reloads what that changes. */
61
+ unsubscribe(): Promise<void>;
60
62
  }
61
63
 
62
64
  declare namespace billingApi {
@@ -121,6 +123,48 @@ declare namespace billingApi {
121
123
  CatalogPriceTierResponseDataToJSON,
122
124
  CatalogPriceTierResponseDataToJSONTyped,
123
125
  CatalogPriceTierResponseData,
126
+ instanceOfCheckoutUnsubscribeResponse,
127
+ CheckoutUnsubscribeResponseFromJSON,
128
+ CheckoutUnsubscribeResponseFromJSONTyped,
129
+ CheckoutUnsubscribeResponseToJSON,
130
+ CheckoutUnsubscribeResponseToJSONTyped,
131
+ CheckoutUnsubscribeResponse,
132
+ instanceOfCompanyContextCustomPlanBillingResponseData,
133
+ CompanyContextCustomPlanBillingResponseDataFromJSON,
134
+ CompanyContextCustomPlanBillingResponseDataFromJSONTyped,
135
+ CompanyContextCustomPlanBillingResponseDataToJSON,
136
+ CompanyContextCustomPlanBillingResponseDataToJSONTyped,
137
+ CompanyContextCustomPlanBillingResponseData,
138
+ instanceOfCompanyContextPlanResponseData,
139
+ CompanyContextPlanResponseDataFromJSON,
140
+ CompanyContextPlanResponseDataFromJSONTyped,
141
+ CompanyContextPlanResponseDataToJSON,
142
+ CompanyContextPlanResponseDataToJSONTyped,
143
+ CompanyContextPlanResponseData,
144
+ instanceOfCompanyContextResponseData,
145
+ CompanyContextResponseDataFromJSON,
146
+ CompanyContextResponseDataFromJSONTyped,
147
+ CompanyContextResponseDataToJSON,
148
+ CompanyContextResponseDataToJSONTyped,
149
+ CompanyContextResponseData,
150
+ instanceOfCompanyContextScheduledDowngradeResponseData,
151
+ CompanyContextScheduledDowngradeResponseDataFromJSON,
152
+ CompanyContextScheduledDowngradeResponseDataFromJSONTyped,
153
+ CompanyContextScheduledDowngradeResponseDataToJSON,
154
+ CompanyContextScheduledDowngradeResponseDataToJSONTyped,
155
+ CompanyContextScheduledDowngradeResponseData,
156
+ instanceOfCompanyContextSubscriptionResponseData,
157
+ CompanyContextSubscriptionResponseDataFromJSON,
158
+ CompanyContextSubscriptionResponseDataFromJSONTyped,
159
+ CompanyContextSubscriptionResponseDataToJSON,
160
+ CompanyContextSubscriptionResponseDataToJSONTyped,
161
+ CompanyContextSubscriptionResponseData,
162
+ instanceOfCompanyCreditAutoTopupResponseData,
163
+ CompanyCreditAutoTopupResponseDataFromJSON,
164
+ CompanyCreditAutoTopupResponseDataFromJSONTyped,
165
+ CompanyCreditAutoTopupResponseDataToJSON,
166
+ CompanyCreditAutoTopupResponseDataToJSONTyped,
167
+ CompanyCreditAutoTopupResponseData,
124
168
  instanceOfCompanyCreditBalanceResponseData,
125
169
  CompanyCreditBalanceResponseDataFromJSON,
126
170
  CompanyCreditBalanceResponseDataFromJSONTyped,
@@ -223,6 +267,18 @@ declare namespace billingApi {
223
267
  CreateSetupIntentResponseToJSON,
224
268
  CreateSetupIntentResponseToJSONTyped,
225
269
  CreateSetupIntentResponse,
270
+ instanceOfCurrency,
271
+ CurrencyFromJSON,
272
+ CurrencyFromJSONTyped,
273
+ CurrencyToJSON,
274
+ CurrencyToJSONTyped,
275
+ Currency,
276
+ instanceOfCustomPlanActivationStrategy,
277
+ CustomPlanActivationStrategyFromJSON,
278
+ CustomPlanActivationStrategyFromJSONTyped,
279
+ CustomPlanActivationStrategyToJSON,
280
+ CustomPlanActivationStrategyToJSONTyped,
281
+ CustomPlanActivationStrategy,
226
282
  instanceOfDeletePaymentMethodResponse,
227
283
  DeletePaymentMethodResponseFromJSON,
228
284
  DeletePaymentMethodResponseFromJSONTyped,
@@ -313,6 +369,12 @@ declare namespace billingApi {
313
369
  GetCompanyPaymentMethodsResponseToJSON,
314
370
  GetCompanyPaymentMethodsResponseToJSONTyped,
315
371
  GetCompanyPaymentMethodsResponse,
372
+ instanceOfGetCompanyResponse,
373
+ GetCompanyResponseFromJSON,
374
+ GetCompanyResponseFromJSONTyped,
375
+ GetCompanyResponseToJSON,
376
+ GetCompanyResponseToJSONTyped,
377
+ GetCompanyResponse,
316
378
  instanceOfGetCompanyUpcomingInvoiceResponse,
317
379
  GetCompanyUpcomingInvoiceResponseFromJSON,
318
380
  GetCompanyUpcomingInvoiceResponseFromJSONTyped,
@@ -388,6 +450,12 @@ declare interface BillingClient {
388
450
  updatePaymentMethod(externalId: string): Promise<void>;
389
451
  /** Removes the method, by Schematic's id (`id`). */
390
452
  deletePaymentMethod(id: string): Promise<void>;
453
+ /**
454
+ * Cancels the company's subscription at the end of its billing period.
455
+ * Rejects when it has no single active subscription, or that one is
456
+ * already set to cancel.
457
+ */
458
+ cancelSubscription(): Promise<void>;
391
459
  /** Empty when the company is entitled to nothing. */
392
460
  fetchFeatureUsage(): Promise<FeatureUsage[]>;
393
461
  /** One event-based feature's usage by user over its metric period. */
@@ -396,6 +464,8 @@ declare interface BillingClient {
396
464
  fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
397
465
  /** One credit's consumption by user over the span of its live grants. */
398
466
  fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
467
+ /** The company's plan, add-ons, and subscription state. */
468
+ fetchCompany(): Promise<Company>;
399
469
  readonly sessionStatus: SessionStatus;
400
470
  readonly sessionKey: string | undefined;
401
471
  setSession(session: SessionInput): void;
@@ -570,7 +640,7 @@ export declare function BillingProvider({ billingClient, children, initialData,
570
640
  * much. Named apart from schematic-js's `BillingClient`, which is the whole
571
641
  * interface; this is the part the hooks here call.
572
642
  */
573
- export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage" | "fetchCreditBalances" | "fetchCreditUserUsage">;
643
+ export declare type BillingProviderClient = Pick<BillingClient, "sessionStatus" | "sessionKey" | "setSession" | "onSessionChange" | "fetchInvoices" | "fetchUpcomingInvoice" | "fetchPaymentMethods" | "createSetupIntent" | "updatePaymentMethod" | "deletePaymentMethod" | "fetchFeatureUsage" | "fetchFeatureUserUsage" | "fetchCreditBalances" | "fetchCreditUserUsage" | "fetchCompany" | "cancelSubscription">;
574
644
 
575
645
  declare interface BillingProviderDataProps {
576
646
  /**
@@ -610,7 +680,7 @@ declare interface BillingProviderDataProps {
610
680
  export declare type BillingProviderProps = BillingProviderDataProps & SchematicI18nConfig;
611
681
 
612
682
  /** The resources this package serves; a key of schematic-js's contract. */
613
- export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage" | "creditBalances";
683
+ export declare type BillingResourceName = "invoices" | "upcomingInvoice" | "paymentMethods" | "featureUsage" | "creditBalances" | "company";
614
684
 
615
685
  declare type BillingResourceName_2 = keyof BillingResources_2;
616
686
 
@@ -623,6 +693,7 @@ declare interface BillingResourceParams_2 {
623
693
  paymentMethods: Record<string, never>;
624
694
  featureUsage: Record<string, never>;
625
695
  creditBalances: Record<string, never>;
696
+ company: Record<string, never>;
626
697
  }
627
698
 
628
699
  export declare type BillingResources = Pick<BillingResources_2, BillingResourceName>;
@@ -659,6 +730,8 @@ declare interface BillingResources_2 {
659
730
  * loaded.
660
731
  */
661
732
  creditBalances: CreditBalanceEntry[];
733
+ /** `GET /company`. */
734
+ company: Company;
662
735
  }
663
736
 
664
737
  /**
@@ -756,10 +829,10 @@ declare interface CatalogCreditGrantResponseData {
756
829
  declare interface CatalogPriceResponseData {
757
830
  /**
758
831
  *
759
- * @type {string}
832
+ * @type {Currency}
760
833
  * @memberof CatalogPriceResponseData
761
834
  */
762
- currency: string;
835
+ currency: Currency;
763
836
  /**
764
837
  *
765
838
  * @type {string}
@@ -1118,6 +1191,302 @@ declare const CheckPlanReturnFromJSON: (json: any) => CheckPlanReturn;
1118
1191
 
1119
1192
  declare type CheckPlanReturnListenerFn = (value: CheckPlanReturn) => void;
1120
1193
 
1194
+ /**
1195
+ * The company. The server has already made the embed's derivations from its
1196
+ * hydrated `company`:
1197
+ *
1198
+ * * `subscription` is absent when the company has none, or several.
1199
+ * * `subscription.period` comes from its first recurring product, else its
1200
+ * interval; `subscription.nextBillAt` is the embed's next bill date.
1201
+ * * `customPlanBilling` is the newest pending one, with its `dueAt`.
1202
+ */
1203
+ export declare type Company = CompanyContextResponseData;
1204
+
1205
+ /**
1206
+ *
1207
+ * @export
1208
+ * @interface CompanyContextCustomPlanBillingResponseData
1209
+ */
1210
+ declare interface CompanyContextCustomPlanBillingResponseData {
1211
+ /**
1212
+ * on_payment: the plan activates once the invoice is paid. on_publish: the plan is active and ends unless the invoice is paid.
1213
+ * @type {CustomPlanActivationStrategy}
1214
+ * @memberof CompanyContextCustomPlanBillingResponseData
1215
+ */
1216
+ activationStrategy: CustomPlanActivationStrategy;
1217
+ /**
1218
+ * When payment is due: days_until_due after the billing was published, else created.
1219
+ * @type {Date}
1220
+ * @memberof CompanyContextCustomPlanBillingResponseData
1221
+ */
1222
+ dueAt: Date;
1223
+ /**
1224
+ * Where the company pays the invoice.
1225
+ * @type {string}
1226
+ * @memberof CompanyContextCustomPlanBillingResponseData
1227
+ */
1228
+ invoiceUrl?: string | null;
1229
+ /**
1230
+ *
1231
+ * @type {string}
1232
+ * @memberof CompanyContextCustomPlanBillingResponseData
1233
+ */
1234
+ planId: string;
1235
+ /**
1236
+ *
1237
+ * @type {string}
1238
+ * @memberof CompanyContextCustomPlanBillingResponseData
1239
+ */
1240
+ planName?: string | null;
1241
+ }
1242
+
1243
+ /**
1244
+ * Schematic API
1245
+ * Schematic API
1246
+ *
1247
+ * The version of the OpenAPI document: 0.1
1248
+ *
1249
+ *
1250
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1251
+ * https://openapi-generator.tech
1252
+ * Do not edit the class manually.
1253
+ */
1254
+ /**
1255
+ *
1256
+ * @export
1257
+ * @interface CompanyContextPlanResponseData
1258
+ */
1259
+ declare interface CompanyContextPlanResponseData {
1260
+ /**
1261
+ *
1262
+ * @type {string}
1263
+ * @memberof CompanyContextPlanResponseData
1264
+ */
1265
+ description?: string | null;
1266
+ /**
1267
+ *
1268
+ * @type {string}
1269
+ * @memberof CompanyContextPlanResponseData
1270
+ */
1271
+ id: string;
1272
+ /**
1273
+ * The credits the plan grants, in the plan's order.
1274
+ * @type {Array<string>}
1275
+ * @memberof CompanyContextPlanResponseData
1276
+ */
1277
+ includedCreditIds: Array<string>;
1278
+ /**
1279
+ *
1280
+ * @type {string}
1281
+ * @memberof CompanyContextPlanResponseData
1282
+ */
1283
+ name: string;
1284
+ /**
1285
+ * The period the plan is billed in: day, week, month, quarter, year, or one-time. Null when it is not billed.
1286
+ * @type {string}
1287
+ * @memberof CompanyContextPlanResponseData
1288
+ */
1289
+ period?: string | null;
1290
+ /**
1291
+ * What the company is billed per period, in minor units of the subscription's currency. Null when it is not billed.
1292
+ * @type {number}
1293
+ * @memberof CompanyContextPlanResponseData
1294
+ */
1295
+ price?: number | null;
1296
+ }
1297
+
1298
+ /**
1299
+ *
1300
+ * @export
1301
+ * @interface CompanyContextResponseData
1302
+ */
1303
+ declare interface CompanyContextResponseData {
1304
+ /**
1305
+ * The add-ons the company holds.
1306
+ * @type {Array<CompanyContextPlanResponseData>}
1307
+ * @memberof CompanyContextResponseData
1308
+ */
1309
+ addOns: Array<CompanyContextPlanResponseData>;
1310
+ /**
1311
+ * The newest custom plan billing awaiting payment or activation; null when none is pending.
1312
+ * @type {CompanyContextCustomPlanBillingResponseData}
1313
+ * @memberof CompanyContextResponseData
1314
+ */
1315
+ customPlanBilling?: CompanyContextCustomPlanBillingResponseData;
1316
+ /**
1317
+ *
1318
+ * @type {string}
1319
+ * @memberof CompanyContextResponseData
1320
+ */
1321
+ id: string;
1322
+ /**
1323
+ *
1324
+ * @type {string}
1325
+ * @memberof CompanyContextResponseData
1326
+ */
1327
+ name: string;
1328
+ /**
1329
+ * The company's base plan; null when it has none.
1330
+ * @type {CompanyContextPlanResponseData}
1331
+ * @memberof CompanyContextResponseData
1332
+ */
1333
+ plan?: CompanyContextPlanResponseData;
1334
+ /**
1335
+ * A plan change scheduled for the end of the billing period; null when none is.
1336
+ * @type {CompanyContextScheduledDowngradeResponseData}
1337
+ * @memberof CompanyContextResponseData
1338
+ */
1339
+ scheduledDowngrade?: CompanyContextScheduledDowngradeResponseData;
1340
+ /**
1341
+ * The company's subscription; null when it has none, or several.
1342
+ * @type {CompanyContextSubscriptionResponseData}
1343
+ * @memberof CompanyContextResponseData
1344
+ */
1345
+ subscription?: CompanyContextSubscriptionResponseData;
1346
+ }
1347
+
1348
+ /**
1349
+ * Schematic API
1350
+ * Schematic API
1351
+ *
1352
+ * The version of the OpenAPI document: 0.1
1353
+ *
1354
+ *
1355
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1356
+ * https://openapi-generator.tech
1357
+ * Do not edit the class manually.
1358
+ */
1359
+ /**
1360
+ *
1361
+ * @export
1362
+ * @interface CompanyContextScheduledDowngradeResponseData
1363
+ */
1364
+ declare interface CompanyContextScheduledDowngradeResponseData {
1365
+ /**
1366
+ *
1367
+ * @type {string}
1368
+ * @memberof CompanyContextScheduledDowngradeResponseData
1369
+ */
1370
+ fromPlanId: string;
1371
+ /**
1372
+ *
1373
+ * @type {string}
1374
+ * @memberof CompanyContextScheduledDowngradeResponseData
1375
+ */
1376
+ fromPlanName: string;
1377
+ /**
1378
+ *
1379
+ * @type {string}
1380
+ * @memberof CompanyContextScheduledDowngradeResponseData
1381
+ */
1382
+ toPlanId: string;
1383
+ /**
1384
+ *
1385
+ * @type {string}
1386
+ * @memberof CompanyContextScheduledDowngradeResponseData
1387
+ */
1388
+ toPlanName: string;
1389
+ }
1390
+
1391
+ /**
1392
+ *
1393
+ * @export
1394
+ * @interface CompanyContextSubscriptionResponseData
1395
+ */
1396
+ declare interface CompanyContextSubscriptionResponseData {
1397
+ /**
1398
+ * When the subscription is set to end.
1399
+ * @type {Date}
1400
+ * @memberof CompanyContextSubscriptionResponseData
1401
+ */
1402
+ cancelAt?: Date | null;
1403
+ /**
1404
+ *
1405
+ * @type {boolean}
1406
+ * @memberof CompanyContextSubscriptionResponseData
1407
+ */
1408
+ cancelAtPeriodEnd: boolean;
1409
+ /**
1410
+ *
1411
+ * @type {Currency}
1412
+ * @memberof CompanyContextSubscriptionResponseData
1413
+ */
1414
+ currency: Currency;
1415
+ /**
1416
+ * When the current period ends, and the company is next billed unless its trial is set to cancel: the period end, else the stored next bill's due date. Null when the subscription cancels at period end or neither is known.
1417
+ * @type {Date}
1418
+ * @memberof CompanyContextSubscriptionResponseData
1419
+ */
1420
+ nextBillAt?: Date | null;
1421
+ /**
1422
+ * The period the subscription bills in: day, week, month, quarter, or year.
1423
+ * @type {string}
1424
+ * @memberof CompanyContextSubscriptionResponseData
1425
+ */
1426
+ period?: string | null;
1427
+ /**
1428
+ *
1429
+ * @type {Date}
1430
+ * @memberof CompanyContextSubscriptionResponseData
1431
+ */
1432
+ periodEnd?: Date | null;
1433
+ /**
1434
+ * Provider vocabulary: trialing, active, past_due, and so on.
1435
+ * @type {string}
1436
+ * @memberof CompanyContextSubscriptionResponseData
1437
+ */
1438
+ status: string;
1439
+ /**
1440
+ *
1441
+ * @type {Date}
1442
+ * @memberof CompanyContextSubscriptionResponseData
1443
+ */
1444
+ trialEnd?: Date | null;
1445
+ }
1446
+
1447
+ /**
1448
+ * Schematic API
1449
+ * Schematic API
1450
+ *
1451
+ * The version of the OpenAPI document: 0.1
1452
+ *
1453
+ *
1454
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1455
+ * https://openapi-generator.tech
1456
+ * Do not edit the class manually.
1457
+ */
1458
+ /**
1459
+ *
1460
+ * @export
1461
+ * @interface CompanyCreditAutoTopupResponseData
1462
+ */
1463
+ declare interface CompanyCreditAutoTopupResponseData {
1464
+ /**
1465
+ * Credits each top-up adds.
1466
+ * @type {number}
1467
+ * @memberof CompanyCreditAutoTopupResponseData
1468
+ */
1469
+ amount?: number | null;
1470
+ /**
1471
+ * Whether top-ups run: the company's choice when self_service, else the plan's; false when the plan turns top-ups off.
1472
+ * @type {boolean}
1473
+ * @memberof CompanyCreditAutoTopupResponseData
1474
+ */
1475
+ enabled: boolean;
1476
+ /**
1477
+ * Whether the company may change these settings itself.
1478
+ * @type {boolean}
1479
+ * @memberof CompanyCreditAutoTopupResponseData
1480
+ */
1481
+ selfService: boolean;
1482
+ /**
1483
+ * The remaining balance that triggers a top-up.
1484
+ * @type {number}
1485
+ * @memberof CompanyCreditAutoTopupResponseData
1486
+ */
1487
+ thresholdCredits?: number | null;
1488
+ }
1489
+
1121
1490
  /**
1122
1491
  * Schematic API
1123
1492
  * Schematic API
@@ -1161,6 +1530,12 @@ export declare interface CompanyCreditBalance {
1161
1530
  * @interface CompanyCreditBalanceResponseData
1162
1531
  */
1163
1532
  declare interface CompanyCreditBalanceResponseData {
1533
+ /**
1534
+ * How the credit tops itself up; null unless the company's base plan grants it.
1535
+ * @type {CompanyCreditAutoTopupResponseData}
1536
+ * @memberof CompanyCreditBalanceResponseData
1537
+ */
1538
+ autoTopup?: CompanyCreditAutoTopupResponseData;
1164
1539
  /**
1165
1540
  * 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
1541
  * @type {CompanyCreditCompositionResponseData}
@@ -1505,17 +1880,6 @@ declare interface CompanyCreditUserUsageRowResponseData {
1505
1880
  userId: string;
1506
1881
  }
1507
1882
 
1508
- /**
1509
- * Schematic API
1510
- * Schematic API
1511
- *
1512
- * The version of the OpenAPI document: 0.1
1513
- *
1514
- *
1515
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
1516
- * https://openapi-generator.tech
1517
- * Do not edit the class manually.
1518
- */
1519
1883
  /**
1520
1884
  *
1521
1885
  * @export
@@ -1536,10 +1900,10 @@ declare interface CompanyDiscountResponseData {
1536
1900
  couponName: string;
1537
1901
  /**
1538
1902
  *
1539
- * @type {string}
1903
+ * @type {Currency}
1540
1904
  * @memberof CompanyDiscountResponseData
1541
1905
  */
1542
- currency?: string | null;
1906
+ currency?: Currency | null;
1543
1907
  /**
1544
1908
  *
1545
1909
  * @type {string}
@@ -1836,10 +2200,10 @@ declare interface CompanyInvoiceResponseData {
1836
2200
  createdAt: Date;
1837
2201
  /**
1838
2202
  *
1839
- * @type {string}
2203
+ * @type {Currency}
1840
2204
  * @memberof CompanyInvoiceResponseData
1841
2205
  */
1842
- currency: string;
2206
+ currency: Currency;
1843
2207
  /**
1844
2208
  *
1845
2209
  * @type {Date}
@@ -1969,6 +2333,11 @@ declare interface CompanyPaymentMethodResponseData {
1969
2333
  type: string;
1970
2334
  }
1971
2335
 
2336
+ /** A plan or add-on the company holds, at the price it is billed. */
2337
+ export declare type CompanyPlan = CompanyContextPlanResponseData;
2338
+
2339
+ export declare type CompanySubscription = CompanyContextSubscriptionResponseData;
2340
+
1972
2341
  /**
1973
2342
  *
1974
2343
  * @export
@@ -1983,10 +2352,10 @@ declare interface CompanyUpcomingInvoiceResponseData {
1983
2352
  amountDue: number;
1984
2353
  /**
1985
2354
  *
1986
- * @type {string}
2355
+ * @type {Currency}
1987
2356
  * @memberof CompanyUpcomingInvoiceResponseData
1988
2357
  */
1989
- currency: string;
2358
+ currency: Currency;
1990
2359
  /**
1991
2360
  * How much of the company's existing balance this invoice consumes.
1992
2361
  * @type {number}
@@ -2098,6 +2467,8 @@ declare interface CompanyUserUsageResponseData {
2098
2467
  */
2099
2468
  declare type ContextSignatureProvider = (context: SchematicContext) => string | Promise<string>;
2100
2469
 
2470
+ export declare type CreditAutoTopup = CompanyCreditAutoTopupResponseData;
2471
+
2101
2472
  /** A company's lease-aware balance for a single credit type */
2102
2473
  export declare type CreditBalance = {
2103
2474
  /** Spendable balance including any open lease hold (remaining + reserved); the number to display to end users */
@@ -2119,6 +2490,8 @@ export declare type CreditBalance = {
2119
2490
  * * Each grant carries `resetsAt` or `expiresAt`, never both.
2120
2491
  * * `purchasable` — a bundle of it is on offer to the company's plan.
2121
2492
  * * `composition` — how a per-license plan grant adds up per period.
2493
+ * * `autoTopup` — auto top-up for a credit the base plan grants, with the
2494
+ * company's own settings applied.
2122
2495
  */
2123
2496
  export declare type CreditBalanceEntry = CompanyCreditBalanceResponseData;
2124
2497
 
@@ -2299,6 +2672,162 @@ declare interface CreditUserUsageRequest {
2299
2672
 
2300
2673
  export declare type CreditUserUsageRow = CompanyCreditUserUsageRowResponseData;
2301
2674
 
2675
+ /**
2676
+ *
2677
+ * @export
2678
+ */
2679
+ declare const Currency: {
2680
+ readonly Aed: "aed";
2681
+ readonly Afn: "afn";
2682
+ readonly All: "all";
2683
+ readonly Amd: "amd";
2684
+ readonly Ang: "ang";
2685
+ readonly Aoa: "aoa";
2686
+ readonly Ars: "ars";
2687
+ readonly Aud: "aud";
2688
+ readonly Awg: "awg";
2689
+ readonly Azn: "azn";
2690
+ readonly Bam: "bam";
2691
+ readonly Bbd: "bbd";
2692
+ readonly Bdt: "bdt";
2693
+ readonly Bif: "bif";
2694
+ readonly Bmd: "bmd";
2695
+ readonly Bnd: "bnd";
2696
+ readonly Bob: "bob";
2697
+ readonly Brl: "brl";
2698
+ readonly Bsd: "bsd";
2699
+ readonly Bwp: "bwp";
2700
+ readonly Byn: "byn";
2701
+ readonly Bzd: "bzd";
2702
+ readonly Cad: "cad";
2703
+ readonly Cdf: "cdf";
2704
+ readonly Chf: "chf";
2705
+ readonly Clp: "clp";
2706
+ readonly Cny: "cny";
2707
+ readonly Cop: "cop";
2708
+ readonly Crc: "crc";
2709
+ readonly Cve: "cve";
2710
+ readonly Czk: "czk";
2711
+ readonly Djf: "djf";
2712
+ readonly Dkk: "dkk";
2713
+ readonly Dop: "dop";
2714
+ readonly Dzd: "dzd";
2715
+ readonly Egp: "egp";
2716
+ readonly Etb: "etb";
2717
+ readonly Eur: "eur";
2718
+ readonly Fjd: "fjd";
2719
+ readonly Fkp: "fkp";
2720
+ readonly Gbp: "gbp";
2721
+ readonly Gel: "gel";
2722
+ readonly Gip: "gip";
2723
+ readonly Gmd: "gmd";
2724
+ readonly Gnf: "gnf";
2725
+ readonly Gtq: "gtq";
2726
+ readonly Gyd: "gyd";
2727
+ readonly Hkd: "hkd";
2728
+ readonly Hnl: "hnl";
2729
+ readonly Htg: "htg";
2730
+ readonly Huf: "huf";
2731
+ readonly Idr: "idr";
2732
+ readonly Ils: "ils";
2733
+ readonly Inr: "inr";
2734
+ readonly Isk: "isk";
2735
+ readonly Jmd: "jmd";
2736
+ readonly Jpy: "jpy";
2737
+ readonly Kes: "kes";
2738
+ readonly Kgs: "kgs";
2739
+ readonly Khr: "khr";
2740
+ readonly Kmf: "kmf";
2741
+ readonly Krw: "krw";
2742
+ readonly Kyd: "kyd";
2743
+ readonly Kzt: "kzt";
2744
+ readonly Lak: "lak";
2745
+ readonly Lbp: "lbp";
2746
+ readonly Lkr: "lkr";
2747
+ readonly Lrd: "lrd";
2748
+ readonly Lsl: "lsl";
2749
+ readonly Mad: "mad";
2750
+ readonly Mdl: "mdl";
2751
+ readonly Mga: "mga";
2752
+ readonly Mkd: "mkd";
2753
+ readonly Mmk: "mmk";
2754
+ readonly Mnt: "mnt";
2755
+ readonly Mop: "mop";
2756
+ readonly Mur: "mur";
2757
+ readonly Mvr: "mvr";
2758
+ readonly Mwk: "mwk";
2759
+ readonly Mxn: "mxn";
2760
+ readonly Myr: "myr";
2761
+ readonly Mzn: "mzn";
2762
+ readonly Nad: "nad";
2763
+ readonly Ngn: "ngn";
2764
+ readonly Nio: "nio";
2765
+ readonly Nok: "nok";
2766
+ readonly Npr: "npr";
2767
+ readonly Nzd: "nzd";
2768
+ readonly Pab: "pab";
2769
+ readonly Pen: "pen";
2770
+ readonly Pgk: "pgk";
2771
+ readonly Php: "php";
2772
+ readonly Pkr: "pkr";
2773
+ readonly Pln: "pln";
2774
+ readonly Pyg: "pyg";
2775
+ readonly Qar: "qar";
2776
+ readonly Ron: "ron";
2777
+ readonly Rsd: "rsd";
2778
+ readonly Rub: "rub";
2779
+ readonly Rwf: "rwf";
2780
+ readonly Sar: "sar";
2781
+ readonly Sbd: "sbd";
2782
+ readonly Scr: "scr";
2783
+ readonly Sek: "sek";
2784
+ readonly Sgd: "sgd";
2785
+ readonly Shp: "shp";
2786
+ readonly Sle: "sle";
2787
+ readonly Sos: "sos";
2788
+ readonly Srd: "srd";
2789
+ readonly Std: "std";
2790
+ readonly Szl: "szl";
2791
+ readonly Thb: "thb";
2792
+ readonly Tjs: "tjs";
2793
+ readonly Top: "top";
2794
+ readonly Try: "try";
2795
+ readonly Ttd: "ttd";
2796
+ readonly Twd: "twd";
2797
+ readonly Tzs: "tzs";
2798
+ readonly Uah: "uah";
2799
+ readonly Ugx: "ugx";
2800
+ readonly Usd: "usd";
2801
+ readonly Uyu: "uyu";
2802
+ readonly Uzs: "uzs";
2803
+ readonly Vnd: "vnd";
2804
+ readonly Vuv: "vuv";
2805
+ readonly Wst: "wst";
2806
+ readonly Xaf: "xaf";
2807
+ readonly Xcd: "xcd";
2808
+ readonly Xcg: "xcg";
2809
+ readonly Xof: "xof";
2810
+ readonly Xpf: "xpf";
2811
+ readonly Yer: "yer";
2812
+ readonly Zar: "zar";
2813
+ readonly Zmw: "zmw";
2814
+ };
2815
+
2816
+ declare type Currency = (typeof Currency)[keyof typeof Currency];
2817
+
2818
+ /**
2819
+ *
2820
+ * @export
2821
+ */
2822
+ declare const CustomPlanActivationStrategy: {
2823
+ readonly Payment: "on_payment";
2824
+ readonly Publish: "on_publish";
2825
+ };
2826
+
2827
+ declare type CustomPlanActivationStrategy = (typeof CustomPlanActivationStrategy)[keyof typeof CustomPlanActivationStrategy];
2828
+
2829
+ export declare type CustomPlanBilling = CompanyContextCustomPlanBillingResponseData;
2830
+
2302
2831
  /**
2303
2832
  *
2304
2833
  * @export
@@ -2937,6 +3466,8 @@ declare const RuleType_2: {
2937
3466
 
2938
3467
  declare type RuleType_2 = (typeof RuleType_2)[keyof typeof RuleType_2];
2939
3468
 
3469
+ export declare type ScheduledDowngrade = CompanyContextScheduledDowngradeResponseData;
3470
+
2940
3471
  export declare class Schematic {
2941
3472
  private _additionalHeaders;
2942
3473
  private apiKey;
@@ -3249,7 +3780,9 @@ declare class SchematicBillingClient implements BillingClient {
3249
3780
  createSetupIntent(): Promise<SetupIntent>;
3250
3781
  updatePaymentMethod(externalId: string): Promise<void>;
3251
3782
  deletePaymentMethod(id: string): Promise<void>;
3783
+ cancelSubscription(): Promise<void>;
3252
3784
  fetchFeatureUsage(): Promise<FeatureUsage[]>;
3785
+ fetchCompany(): Promise<Company>;
3253
3786
  fetchCreditBalances(): Promise<CreditBalanceEntry[]>;
3254
3787
  fetchCreditUserUsage(params: CreditUserUsageRequest): Promise<CreditUserUsage>;
3255
3788
  fetchFeatureUserUsage(params: FeatureUserUsageRequest): Promise<FeatureUserUsage>;
@@ -3344,6 +3877,13 @@ declare namespace SchematicJS {
3344
3877
  CheckPlanReturn,
3345
3878
  CheckPlanReturnFromJSON,
3346
3879
  CheckPlanReturnListenerFn,
3880
+ Company,
3881
+ CompanyContextCustomPlanBillingResponseData,
3882
+ CompanyContextPlanResponseData,
3883
+ CompanyContextResponseData,
3884
+ CompanyContextScheduledDowngradeResponseData,
3885
+ CompanyContextSubscriptionResponseData,
3886
+ CompanyCreditAutoTopupResponseData,
3347
3887
  CompanyCreditBalance,
3348
3888
  CompanyCreditBalanceResponseData,
3349
3889
  CompanyCreditCompositionResponseData,
@@ -3355,9 +3895,12 @@ declare namespace SchematicJS {
3355
3895
  CompanyFeatureUserUsageResponseData,
3356
3896
  CompanyInvoiceResponseData,
3357
3897
  CompanyPaymentMethodResponseData,
3898
+ CompanyPlan,
3899
+ CompanySubscription,
3358
3900
  CompanyUpcomingInvoiceResponseData,
3359
3901
  CompanyUserUsageResponseData,
3360
3902
  ContextSignatureProvider,
3903
+ CreditAutoTopup,
3361
3904
  CreditBalance,
3362
3905
  CreditBalanceEntry,
3363
3906
  CreditBalanceListenerFn,
@@ -3377,6 +3920,7 @@ declare namespace SchematicJS {
3377
3920
  CreditSpendWindow,
3378
3921
  CreditUserUsage,
3379
3922
  CreditUserUsageRow,
3923
+ CustomPlanBilling,
3380
3924
  DEFAULT_INVOICE_QUERY,
3381
3925
  Discount,
3382
3926
  EmptyListenerFn,
@@ -3407,6 +3951,7 @@ declare namespace SchematicJS {
3407
3951
  RequestOptions,
3408
3952
  ResourceState,
3409
3953
  RuleType,
3954
+ ScheduledDowngrade,
3410
3955
  Schematic,
3411
3956
  SchematicApiError,
3412
3957
  SchematicBillingClient,
@@ -3722,6 +4267,19 @@ export declare const TrialStatus: {
3722
4267
 
3723
4268
  export declare type TrialStatus = (typeof TrialStatus)[keyof typeof TrialStatus];
3724
4269
 
4270
+ export declare interface UnsubscribeHandle {
4271
+ /**
4272
+ * Cancels the subscription at period end; the company, its next bill and
4273
+ * its credits reload once it lands. Rejects with the failure and records
4274
+ * it on `mutationError`.
4275
+ */
4276
+ unsubscribe: () => Promise<void>;
4277
+ /** The cancellation is in flight. */
4278
+ isMutating: boolean;
4279
+ /** The last attempt's failure; cleared when the next one starts. */
4280
+ mutationError: Error | undefined;
4281
+ }
4282
+
3725
4283
  export declare type UpcomingInvoice = CompanyUpcomingInvoiceResponseData;
3726
4284
 
3727
4285
  export declare enum UsagePeriod {
@@ -3733,6 +4291,13 @@ export declare enum UsagePeriod {
3733
4291
 
3734
4292
  export declare function useBillingDataSource(): BillingDataSource;
3735
4293
 
4294
+ /**
4295
+ * The company's plan and add-ons at their billed prices, its subscription,
4296
+ * any scheduled downgrade and any pending custom plan billing. `undefined`
4297
+ * means not loaded.
4298
+ */
4299
+ export declare function useCompany(): ResourceHandle<Company>;
4300
+
3736
4301
  /**
3737
4302
  * The company's credit balances, one per credit. `data` is empty when it
3738
4303
  * holds no credits and its plan draws on none; `undefined` means not loaded.
@@ -3848,6 +4413,12 @@ export declare function useSchematicTranslate(): Translate | undefined;
3848
4413
  */
3849
4414
  export declare function useSetupIntent(): SetupIntentHandle;
3850
4415
 
4416
+ /**
4417
+ * Cancels the company's subscription. Subscribes to no resource: read the
4418
+ * subscription's state from `useCompany`, which reloads once this lands.
4419
+ */
4420
+ export declare function useUnsubscribe(): UnsubscribeHandle;
4421
+
3851
4422
  /**
3852
4423
  * The company's next bill. `data` is `null` when there is nothing to bill —
3853
4424
  * no subscription, which the endpoint reports as a 204 — so an element can