@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.
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  UsagePeriod: () => UsagePeriod,
47
47
  normalizeInvoiceQuery: () => normalizeInvoiceQuery2,
48
48
  useBillingDataSource: () => useBillingDataSource,
49
+ useCompany: () => useCompany,
49
50
  useCreditBalances: () => useCreditBalances,
50
51
  useCreditUserUsage: () => useCreditUserUsage,
51
52
  useFeatureUsage: () => useFeatureUsage,
@@ -67,11 +68,12 @@ __export(index_exports, {
67
68
  useSchematicStrings: () => useSchematicStrings,
68
69
  useSchematicTranslate: () => useSchematicTranslate,
69
70
  useSetupIntent: () => useSetupIntent,
71
+ useUnsubscribe: () => useUnsubscribe,
70
72
  useUpcomingInvoice: () => useUpcomingInvoice
71
73
  });
72
74
  module.exports = __toCommonJS(index_exports);
73
75
 
74
- // node_modules/.pnpm/@schematichq+schematic-js@1.12.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
76
+ // node_modules/.pnpm/@schematichq+schematic-js@1.14.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
75
77
  var __create2 = Object.create;
76
78
  var __defProp2 = Object.defineProperty;
77
79
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -1399,7 +1401,7 @@ var ContextSignatureManager = class {
1399
1401
  }
1400
1402
  }
1401
1403
  };
1402
- var version = "1.12.0";
1404
+ var version = "1.14.0";
1403
1405
  var SINGLETON = {};
1404
1406
  var models_exports = {};
1405
1407
  __export2(models_exports, {
@@ -1449,6 +1451,34 @@ __export2(models_exports, {
1449
1451
  CatalogPriceTierResponseDataFromJSONTyped: () => CatalogPriceTierResponseDataFromJSONTyped,
1450
1452
  CatalogPriceTierResponseDataToJSON: () => CatalogPriceTierResponseDataToJSON,
1451
1453
  CatalogPriceTierResponseDataToJSONTyped: () => CatalogPriceTierResponseDataToJSONTyped,
1454
+ CheckoutUnsubscribeResponseFromJSON: () => CheckoutUnsubscribeResponseFromJSON,
1455
+ CheckoutUnsubscribeResponseFromJSONTyped: () => CheckoutUnsubscribeResponseFromJSONTyped,
1456
+ CheckoutUnsubscribeResponseToJSON: () => CheckoutUnsubscribeResponseToJSON,
1457
+ CheckoutUnsubscribeResponseToJSONTyped: () => CheckoutUnsubscribeResponseToJSONTyped,
1458
+ CompanyContextCustomPlanBillingResponseDataFromJSON: () => CompanyContextCustomPlanBillingResponseDataFromJSON,
1459
+ CompanyContextCustomPlanBillingResponseDataFromJSONTyped: () => CompanyContextCustomPlanBillingResponseDataFromJSONTyped,
1460
+ CompanyContextCustomPlanBillingResponseDataToJSON: () => CompanyContextCustomPlanBillingResponseDataToJSON,
1461
+ CompanyContextCustomPlanBillingResponseDataToJSONTyped: () => CompanyContextCustomPlanBillingResponseDataToJSONTyped,
1462
+ CompanyContextPlanResponseDataFromJSON: () => CompanyContextPlanResponseDataFromJSON,
1463
+ CompanyContextPlanResponseDataFromJSONTyped: () => CompanyContextPlanResponseDataFromJSONTyped,
1464
+ CompanyContextPlanResponseDataToJSON: () => CompanyContextPlanResponseDataToJSON,
1465
+ CompanyContextPlanResponseDataToJSONTyped: () => CompanyContextPlanResponseDataToJSONTyped,
1466
+ CompanyContextResponseDataFromJSON: () => CompanyContextResponseDataFromJSON,
1467
+ CompanyContextResponseDataFromJSONTyped: () => CompanyContextResponseDataFromJSONTyped,
1468
+ CompanyContextResponseDataToJSON: () => CompanyContextResponseDataToJSON,
1469
+ CompanyContextResponseDataToJSONTyped: () => CompanyContextResponseDataToJSONTyped,
1470
+ CompanyContextScheduledDowngradeResponseDataFromJSON: () => CompanyContextScheduledDowngradeResponseDataFromJSON,
1471
+ CompanyContextScheduledDowngradeResponseDataFromJSONTyped: () => CompanyContextScheduledDowngradeResponseDataFromJSONTyped,
1472
+ CompanyContextScheduledDowngradeResponseDataToJSON: () => CompanyContextScheduledDowngradeResponseDataToJSON,
1473
+ CompanyContextScheduledDowngradeResponseDataToJSONTyped: () => CompanyContextScheduledDowngradeResponseDataToJSONTyped,
1474
+ CompanyContextSubscriptionResponseDataFromJSON: () => CompanyContextSubscriptionResponseDataFromJSON,
1475
+ CompanyContextSubscriptionResponseDataFromJSONTyped: () => CompanyContextSubscriptionResponseDataFromJSONTyped,
1476
+ CompanyContextSubscriptionResponseDataToJSON: () => CompanyContextSubscriptionResponseDataToJSON,
1477
+ CompanyContextSubscriptionResponseDataToJSONTyped: () => CompanyContextSubscriptionResponseDataToJSONTyped,
1478
+ CompanyCreditAutoTopupResponseDataFromJSON: () => CompanyCreditAutoTopupResponseDataFromJSON,
1479
+ CompanyCreditAutoTopupResponseDataFromJSONTyped: () => CompanyCreditAutoTopupResponseDataFromJSONTyped,
1480
+ CompanyCreditAutoTopupResponseDataToJSON: () => CompanyCreditAutoTopupResponseDataToJSON,
1481
+ CompanyCreditAutoTopupResponseDataToJSONTyped: () => CompanyCreditAutoTopupResponseDataToJSONTyped,
1452
1482
  CompanyCreditBalanceResponseDataFromJSON: () => CompanyCreditBalanceResponseDataFromJSON,
1453
1483
  CompanyCreditBalanceResponseDataFromJSONTyped: () => CompanyCreditBalanceResponseDataFromJSONTyped,
1454
1484
  CompanyCreditBalanceResponseDataToJSON: () => CompanyCreditBalanceResponseDataToJSON,
@@ -1517,6 +1547,16 @@ __export2(models_exports, {
1517
1547
  CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
1518
1548
  CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
1519
1549
  CreateSetupIntentResponseToJSONTyped: () => CreateSetupIntentResponseToJSONTyped,
1550
+ Currency: () => Currency,
1551
+ CurrencyFromJSON: () => CurrencyFromJSON2,
1552
+ CurrencyFromJSONTyped: () => CurrencyFromJSONTyped8,
1553
+ CurrencyToJSON: () => CurrencyToJSON2,
1554
+ CurrencyToJSONTyped: () => CurrencyToJSONTyped8,
1555
+ CustomPlanActivationStrategy: () => CustomPlanActivationStrategy,
1556
+ CustomPlanActivationStrategyFromJSON: () => CustomPlanActivationStrategyFromJSON,
1557
+ CustomPlanActivationStrategyFromJSONTyped: () => CustomPlanActivationStrategyFromJSONTyped,
1558
+ CustomPlanActivationStrategyToJSON: () => CustomPlanActivationStrategyToJSON,
1559
+ CustomPlanActivationStrategyToJSONTyped: () => CustomPlanActivationStrategyToJSONTyped,
1520
1560
  DeletePaymentMethodResponseFromJSON: () => DeletePaymentMethodResponseFromJSON,
1521
1561
  DeletePaymentMethodResponseFromJSONTyped: () => DeletePaymentMethodResponseFromJSONTyped,
1522
1562
  DeletePaymentMethodResponseToJSON: () => DeletePaymentMethodResponseToJSON,
@@ -1581,6 +1621,10 @@ __export2(models_exports, {
1581
1621
  GetCompanyPaymentMethodsResponseFromJSONTyped: () => GetCompanyPaymentMethodsResponseFromJSONTyped,
1582
1622
  GetCompanyPaymentMethodsResponseToJSON: () => GetCompanyPaymentMethodsResponseToJSON,
1583
1623
  GetCompanyPaymentMethodsResponseToJSONTyped: () => GetCompanyPaymentMethodsResponseToJSONTyped,
1624
+ GetCompanyResponseFromJSON: () => GetCompanyResponseFromJSON,
1625
+ GetCompanyResponseFromJSONTyped: () => GetCompanyResponseFromJSONTyped,
1626
+ GetCompanyResponseToJSON: () => GetCompanyResponseToJSON,
1627
+ GetCompanyResponseToJSONTyped: () => GetCompanyResponseToJSONTyped,
1584
1628
  GetCompanyUpcomingInvoiceResponseFromJSON: () => GetCompanyUpcomingInvoiceResponseFromJSON,
1585
1629
  GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
1586
1630
  GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
@@ -1631,6 +1675,13 @@ __export2(models_exports, {
1631
1675
  instanceOfCatalogCreditGrantResponseData: () => instanceOfCatalogCreditGrantResponseData,
1632
1676
  instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
1633
1677
  instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
1678
+ instanceOfCheckoutUnsubscribeResponse: () => instanceOfCheckoutUnsubscribeResponse,
1679
+ instanceOfCompanyContextCustomPlanBillingResponseData: () => instanceOfCompanyContextCustomPlanBillingResponseData,
1680
+ instanceOfCompanyContextPlanResponseData: () => instanceOfCompanyContextPlanResponseData,
1681
+ instanceOfCompanyContextResponseData: () => instanceOfCompanyContextResponseData,
1682
+ instanceOfCompanyContextScheduledDowngradeResponseData: () => instanceOfCompanyContextScheduledDowngradeResponseData,
1683
+ instanceOfCompanyContextSubscriptionResponseData: () => instanceOfCompanyContextSubscriptionResponseData,
1684
+ instanceOfCompanyCreditAutoTopupResponseData: () => instanceOfCompanyCreditAutoTopupResponseData,
1634
1685
  instanceOfCompanyCreditBalanceResponseData: () => instanceOfCompanyCreditBalanceResponseData,
1635
1686
  instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
1636
1687
  instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
@@ -1648,6 +1699,8 @@ __export2(models_exports, {
1648
1699
  instanceOfCompanyUpcomingInvoiceResponseData: () => instanceOfCompanyUpcomingInvoiceResponseData,
1649
1700
  instanceOfCompanyUserUsageResponseData: () => instanceOfCompanyUserUsageResponseData,
1650
1701
  instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
1702
+ instanceOfCurrency: () => instanceOfCurrency,
1703
+ instanceOfCustomPlanActivationStrategy: () => instanceOfCustomPlanActivationStrategy,
1651
1704
  instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
1652
1705
  instanceOfDeleteResponse: () => instanceOfDeleteResponse,
1653
1706
  instanceOfEntitlementPriceBehavior: () => instanceOfEntitlementPriceBehavior,
@@ -1663,6 +1716,7 @@ __export2(models_exports, {
1663
1716
  instanceOfGetCompanyInvoicesParams: () => instanceOfGetCompanyInvoicesParams,
1664
1717
  instanceOfGetCompanyInvoicesResponse: () => instanceOfGetCompanyInvoicesResponse,
1665
1718
  instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
1719
+ instanceOfGetCompanyResponse: () => instanceOfGetCompanyResponse,
1666
1720
  instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
1667
1721
  instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
1668
1722
  instanceOfMetricPeriod: () => instanceOfMetricPeriod,
@@ -1989,6 +2043,164 @@ function CatalogPriceTierResponseDataToJSONTyped(value, ignoreDiscriminator = fa
1989
2043
  to: value["to"]
1990
2044
  };
1991
2045
  }
2046
+ var Currency = {
2047
+ Aed: "aed",
2048
+ Afn: "afn",
2049
+ All: "all",
2050
+ Amd: "amd",
2051
+ Ang: "ang",
2052
+ Aoa: "aoa",
2053
+ Ars: "ars",
2054
+ Aud: "aud",
2055
+ Awg: "awg",
2056
+ Azn: "azn",
2057
+ Bam: "bam",
2058
+ Bbd: "bbd",
2059
+ Bdt: "bdt",
2060
+ Bif: "bif",
2061
+ Bmd: "bmd",
2062
+ Bnd: "bnd",
2063
+ Bob: "bob",
2064
+ Brl: "brl",
2065
+ Bsd: "bsd",
2066
+ Bwp: "bwp",
2067
+ Byn: "byn",
2068
+ Bzd: "bzd",
2069
+ Cad: "cad",
2070
+ Cdf: "cdf",
2071
+ Chf: "chf",
2072
+ Clp: "clp",
2073
+ Cny: "cny",
2074
+ Cop: "cop",
2075
+ Crc: "crc",
2076
+ Cve: "cve",
2077
+ Czk: "czk",
2078
+ Djf: "djf",
2079
+ Dkk: "dkk",
2080
+ Dop: "dop",
2081
+ Dzd: "dzd",
2082
+ Egp: "egp",
2083
+ Etb: "etb",
2084
+ Eur: "eur",
2085
+ Fjd: "fjd",
2086
+ Fkp: "fkp",
2087
+ Gbp: "gbp",
2088
+ Gel: "gel",
2089
+ Gip: "gip",
2090
+ Gmd: "gmd",
2091
+ Gnf: "gnf",
2092
+ Gtq: "gtq",
2093
+ Gyd: "gyd",
2094
+ Hkd: "hkd",
2095
+ Hnl: "hnl",
2096
+ Htg: "htg",
2097
+ Huf: "huf",
2098
+ Idr: "idr",
2099
+ Ils: "ils",
2100
+ Inr: "inr",
2101
+ Isk: "isk",
2102
+ Jmd: "jmd",
2103
+ Jpy: "jpy",
2104
+ Kes: "kes",
2105
+ Kgs: "kgs",
2106
+ Khr: "khr",
2107
+ Kmf: "kmf",
2108
+ Krw: "krw",
2109
+ Kyd: "kyd",
2110
+ Kzt: "kzt",
2111
+ Lak: "lak",
2112
+ Lbp: "lbp",
2113
+ Lkr: "lkr",
2114
+ Lrd: "lrd",
2115
+ Lsl: "lsl",
2116
+ Mad: "mad",
2117
+ Mdl: "mdl",
2118
+ Mga: "mga",
2119
+ Mkd: "mkd",
2120
+ Mmk: "mmk",
2121
+ Mnt: "mnt",
2122
+ Mop: "mop",
2123
+ Mur: "mur",
2124
+ Mvr: "mvr",
2125
+ Mwk: "mwk",
2126
+ Mxn: "mxn",
2127
+ Myr: "myr",
2128
+ Mzn: "mzn",
2129
+ Nad: "nad",
2130
+ Ngn: "ngn",
2131
+ Nio: "nio",
2132
+ Nok: "nok",
2133
+ Npr: "npr",
2134
+ Nzd: "nzd",
2135
+ Pab: "pab",
2136
+ Pen: "pen",
2137
+ Pgk: "pgk",
2138
+ Php: "php",
2139
+ Pkr: "pkr",
2140
+ Pln: "pln",
2141
+ Pyg: "pyg",
2142
+ Qar: "qar",
2143
+ Ron: "ron",
2144
+ Rsd: "rsd",
2145
+ Rub: "rub",
2146
+ Rwf: "rwf",
2147
+ Sar: "sar",
2148
+ Sbd: "sbd",
2149
+ Scr: "scr",
2150
+ Sek: "sek",
2151
+ Sgd: "sgd",
2152
+ Shp: "shp",
2153
+ Sle: "sle",
2154
+ Sos: "sos",
2155
+ Srd: "srd",
2156
+ Std: "std",
2157
+ Szl: "szl",
2158
+ Thb: "thb",
2159
+ Tjs: "tjs",
2160
+ Top: "top",
2161
+ Try: "try",
2162
+ Ttd: "ttd",
2163
+ Twd: "twd",
2164
+ Tzs: "tzs",
2165
+ Uah: "uah",
2166
+ Ugx: "ugx",
2167
+ Usd: "usd",
2168
+ Uyu: "uyu",
2169
+ Uzs: "uzs",
2170
+ Vnd: "vnd",
2171
+ Vuv: "vuv",
2172
+ Wst: "wst",
2173
+ Xaf: "xaf",
2174
+ Xcd: "xcd",
2175
+ Xcg: "xcg",
2176
+ Xof: "xof",
2177
+ Xpf: "xpf",
2178
+ Yer: "yer",
2179
+ Zar: "zar",
2180
+ Zmw: "zmw"
2181
+ };
2182
+ function instanceOfCurrency(value) {
2183
+ for (const key in Currency) {
2184
+ if (Object.prototype.hasOwnProperty.call(Currency, key)) {
2185
+ if (Currency[key] === value) {
2186
+ return true;
2187
+ }
2188
+ }
2189
+ }
2190
+ return false;
2191
+ }
2192
+ function CurrencyFromJSON2(json) {
2193
+ return CurrencyFromJSONTyped8(json, false);
2194
+ }
2195
+ function CurrencyFromJSONTyped8(json, ignoreDiscriminator) {
2196
+ return json;
2197
+ }
2198
+ function CurrencyToJSON2(value) {
2199
+ return value;
2200
+ }
2201
+ function CurrencyToJSONTyped8(value, ignoreDiscriminator) {
2202
+ return value;
2203
+ }
1992
2204
  function instanceOfCatalogPriceResponseData(value) {
1993
2205
  if (!("currency" in value) || value["currency"] === void 0) return false;
1994
2206
  if (!("id" in value) || value["id"] === void 0) return false;
@@ -2011,7 +2223,7 @@ function CatalogPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2011
2223
  return json;
2012
2224
  }
2013
2225
  return {
2014
- currency: json["currency"],
2226
+ currency: CurrencyFromJSON2(json["currency"]),
2015
2227
  id: json["id"],
2016
2228
  interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
2017
2229
  intervalCount: json["interval_count"],
@@ -2034,7 +2246,7 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
2034
2246
  return value;
2035
2247
  }
2036
2248
  return {
2037
- currency: value["currency"],
2249
+ currency: CurrencyToJSON2(value["currency"]),
2038
2250
  id: value["id"],
2039
2251
  interval: BillingProductPriceIntervalToJSON2(value["interval"]),
2040
2252
  interval_count: value["intervalCount"],
@@ -2049,6 +2261,335 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
2049
2261
  tiers_mode: BillingTiersModeToJSON2(value["tiersMode"])
2050
2262
  };
2051
2263
  }
2264
+ function instanceOfDeleteResponse(value) {
2265
+ return true;
2266
+ }
2267
+ function DeleteResponseFromJSON(json) {
2268
+ return DeleteResponseFromJSONTyped(json, false);
2269
+ }
2270
+ function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
2271
+ if (json == null) {
2272
+ return json;
2273
+ }
2274
+ return {
2275
+ deleted: json["deleted"] == null ? void 0 : json["deleted"]
2276
+ };
2277
+ }
2278
+ function DeleteResponseToJSON(json) {
2279
+ return DeleteResponseToJSONTyped(json, false);
2280
+ }
2281
+ function DeleteResponseToJSONTyped(value, ignoreDiscriminator = false) {
2282
+ if (value == null) {
2283
+ return value;
2284
+ }
2285
+ return {
2286
+ deleted: value["deleted"]
2287
+ };
2288
+ }
2289
+ function instanceOfCheckoutUnsubscribeResponse(value) {
2290
+ if (!("data" in value) || value["data"] === void 0) return false;
2291
+ if (!("params" in value) || value["params"] === void 0) return false;
2292
+ return true;
2293
+ }
2294
+ function CheckoutUnsubscribeResponseFromJSON(json) {
2295
+ return CheckoutUnsubscribeResponseFromJSONTyped(json, false);
2296
+ }
2297
+ function CheckoutUnsubscribeResponseFromJSONTyped(json, ignoreDiscriminator) {
2298
+ if (json == null) {
2299
+ return json;
2300
+ }
2301
+ return {
2302
+ data: DeleteResponseFromJSON(json["data"]),
2303
+ params: json["params"]
2304
+ };
2305
+ }
2306
+ function CheckoutUnsubscribeResponseToJSON(json) {
2307
+ return CheckoutUnsubscribeResponseToJSONTyped(json, false);
2308
+ }
2309
+ function CheckoutUnsubscribeResponseToJSONTyped(value, ignoreDiscriminator = false) {
2310
+ if (value == null) {
2311
+ return value;
2312
+ }
2313
+ return {
2314
+ data: DeleteResponseToJSON(value["data"]),
2315
+ params: value["params"]
2316
+ };
2317
+ }
2318
+ var CustomPlanActivationStrategy = {
2319
+ Payment: "on_payment",
2320
+ Publish: "on_publish"
2321
+ };
2322
+ function instanceOfCustomPlanActivationStrategy(value) {
2323
+ for (const key in CustomPlanActivationStrategy) {
2324
+ if (Object.prototype.hasOwnProperty.call(CustomPlanActivationStrategy, key)) {
2325
+ if (CustomPlanActivationStrategy[key] === value) {
2326
+ return true;
2327
+ }
2328
+ }
2329
+ }
2330
+ return false;
2331
+ }
2332
+ function CustomPlanActivationStrategyFromJSON(json) {
2333
+ return CustomPlanActivationStrategyFromJSONTyped(json, false);
2334
+ }
2335
+ function CustomPlanActivationStrategyFromJSONTyped(json, ignoreDiscriminator) {
2336
+ return json;
2337
+ }
2338
+ function CustomPlanActivationStrategyToJSON(value) {
2339
+ return value;
2340
+ }
2341
+ function CustomPlanActivationStrategyToJSONTyped(value, ignoreDiscriminator) {
2342
+ return value;
2343
+ }
2344
+ function instanceOfCompanyContextCustomPlanBillingResponseData(value) {
2345
+ if (!("activationStrategy" in value) || value["activationStrategy"] === void 0)
2346
+ return false;
2347
+ if (!("dueAt" in value) || value["dueAt"] === void 0) return false;
2348
+ if (!("planId" in value) || value["planId"] === void 0) return false;
2349
+ return true;
2350
+ }
2351
+ function CompanyContextCustomPlanBillingResponseDataFromJSON(json) {
2352
+ return CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, false);
2353
+ }
2354
+ function CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2355
+ if (json == null) {
2356
+ return json;
2357
+ }
2358
+ return {
2359
+ activationStrategy: CustomPlanActivationStrategyFromJSON(
2360
+ json["activation_strategy"]
2361
+ ),
2362
+ dueAt: new Date(json["due_at"]),
2363
+ invoiceUrl: json["invoice_url"] == null ? void 0 : json["invoice_url"],
2364
+ planId: json["plan_id"],
2365
+ planName: json["plan_name"] == null ? void 0 : json["plan_name"]
2366
+ };
2367
+ }
2368
+ function CompanyContextCustomPlanBillingResponseDataToJSON(json) {
2369
+ return CompanyContextCustomPlanBillingResponseDataToJSONTyped(json, false);
2370
+ }
2371
+ function CompanyContextCustomPlanBillingResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2372
+ if (value == null) {
2373
+ return value;
2374
+ }
2375
+ return {
2376
+ activation_strategy: CustomPlanActivationStrategyToJSON(
2377
+ value["activationStrategy"]
2378
+ ),
2379
+ due_at: value["dueAt"].toISOString(),
2380
+ invoice_url: value["invoiceUrl"],
2381
+ plan_id: value["planId"],
2382
+ plan_name: value["planName"]
2383
+ };
2384
+ }
2385
+ function instanceOfCompanyContextPlanResponseData(value) {
2386
+ if (!("id" in value) || value["id"] === void 0) return false;
2387
+ if (!("includedCreditIds" in value) || value["includedCreditIds"] === void 0)
2388
+ return false;
2389
+ if (!("name" in value) || value["name"] === void 0) return false;
2390
+ return true;
2391
+ }
2392
+ function CompanyContextPlanResponseDataFromJSON(json) {
2393
+ return CompanyContextPlanResponseDataFromJSONTyped(json, false);
2394
+ }
2395
+ function CompanyContextPlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2396
+ if (json == null) {
2397
+ return json;
2398
+ }
2399
+ return {
2400
+ description: json["description"] == null ? void 0 : json["description"],
2401
+ id: json["id"],
2402
+ includedCreditIds: json["included_credit_ids"],
2403
+ name: json["name"],
2404
+ period: json["period"] == null ? void 0 : json["period"],
2405
+ price: json["price"] == null ? void 0 : json["price"]
2406
+ };
2407
+ }
2408
+ function CompanyContextPlanResponseDataToJSON(json) {
2409
+ return CompanyContextPlanResponseDataToJSONTyped(json, false);
2410
+ }
2411
+ function CompanyContextPlanResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2412
+ if (value == null) {
2413
+ return value;
2414
+ }
2415
+ return {
2416
+ description: value["description"],
2417
+ id: value["id"],
2418
+ included_credit_ids: value["includedCreditIds"],
2419
+ name: value["name"],
2420
+ period: value["period"],
2421
+ price: value["price"]
2422
+ };
2423
+ }
2424
+ function instanceOfCompanyContextScheduledDowngradeResponseData(value) {
2425
+ if (!("fromPlanId" in value) || value["fromPlanId"] === void 0)
2426
+ return false;
2427
+ if (!("fromPlanName" in value) || value["fromPlanName"] === void 0)
2428
+ return false;
2429
+ if (!("toPlanId" in value) || value["toPlanId"] === void 0) return false;
2430
+ if (!("toPlanName" in value) || value["toPlanName"] === void 0)
2431
+ return false;
2432
+ return true;
2433
+ }
2434
+ function CompanyContextScheduledDowngradeResponseDataFromJSON(json) {
2435
+ return CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, false);
2436
+ }
2437
+ function CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2438
+ if (json == null) {
2439
+ return json;
2440
+ }
2441
+ return {
2442
+ fromPlanId: json["from_plan_id"],
2443
+ fromPlanName: json["from_plan_name"],
2444
+ toPlanId: json["to_plan_id"],
2445
+ toPlanName: json["to_plan_name"]
2446
+ };
2447
+ }
2448
+ function CompanyContextScheduledDowngradeResponseDataToJSON(json) {
2449
+ return CompanyContextScheduledDowngradeResponseDataToJSONTyped(json, false);
2450
+ }
2451
+ function CompanyContextScheduledDowngradeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2452
+ if (value == null) {
2453
+ return value;
2454
+ }
2455
+ return {
2456
+ from_plan_id: value["fromPlanId"],
2457
+ from_plan_name: value["fromPlanName"],
2458
+ to_plan_id: value["toPlanId"],
2459
+ to_plan_name: value["toPlanName"]
2460
+ };
2461
+ }
2462
+ function instanceOfCompanyContextSubscriptionResponseData(value) {
2463
+ if (!("cancelAtPeriodEnd" in value) || value["cancelAtPeriodEnd"] === void 0)
2464
+ return false;
2465
+ if (!("currency" in value) || value["currency"] === void 0) return false;
2466
+ if (!("status" in value) || value["status"] === void 0) return false;
2467
+ return true;
2468
+ }
2469
+ function CompanyContextSubscriptionResponseDataFromJSON(json) {
2470
+ return CompanyContextSubscriptionResponseDataFromJSONTyped(json, false);
2471
+ }
2472
+ function CompanyContextSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2473
+ if (json == null) {
2474
+ return json;
2475
+ }
2476
+ return {
2477
+ cancelAt: json["cancel_at"] == null ? void 0 : new Date(json["cancel_at"]),
2478
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
2479
+ currency: CurrencyFromJSON2(json["currency"]),
2480
+ nextBillAt: json["next_bill_at"] == null ? void 0 : new Date(json["next_bill_at"]),
2481
+ period: json["period"] == null ? void 0 : json["period"],
2482
+ periodEnd: json["period_end"] == null ? void 0 : new Date(json["period_end"]),
2483
+ status: json["status"],
2484
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
2485
+ };
2486
+ }
2487
+ function CompanyContextSubscriptionResponseDataToJSON(json) {
2488
+ return CompanyContextSubscriptionResponseDataToJSONTyped(json, false);
2489
+ }
2490
+ function CompanyContextSubscriptionResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2491
+ if (value == null) {
2492
+ return value;
2493
+ }
2494
+ return {
2495
+ cancel_at: value["cancelAt"] == null ? void 0 : value["cancelAt"].toISOString(),
2496
+ cancel_at_period_end: value["cancelAtPeriodEnd"],
2497
+ currency: CurrencyToJSON2(value["currency"]),
2498
+ next_bill_at: value["nextBillAt"] == null ? void 0 : value["nextBillAt"].toISOString(),
2499
+ period: value["period"],
2500
+ period_end: value["periodEnd"] == null ? void 0 : value["periodEnd"].toISOString(),
2501
+ status: value["status"],
2502
+ trial_end: value["trialEnd"] == null ? void 0 : value["trialEnd"].toISOString()
2503
+ };
2504
+ }
2505
+ function instanceOfCompanyContextResponseData(value) {
2506
+ if (!("addOns" in value) || value["addOns"] === void 0) return false;
2507
+ if (!("id" in value) || value["id"] === void 0) return false;
2508
+ if (!("name" in value) || value["name"] === void 0) return false;
2509
+ return true;
2510
+ }
2511
+ function CompanyContextResponseDataFromJSON(json) {
2512
+ return CompanyContextResponseDataFromJSONTyped(json, false);
2513
+ }
2514
+ function CompanyContextResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2515
+ if (json == null) {
2516
+ return json;
2517
+ }
2518
+ return {
2519
+ addOns: json["add_ons"].map(
2520
+ CompanyContextPlanResponseDataFromJSON
2521
+ ),
2522
+ customPlanBilling: json["custom_plan_billing"] == null ? void 0 : CompanyContextCustomPlanBillingResponseDataFromJSON(
2523
+ json["custom_plan_billing"]
2524
+ ),
2525
+ id: json["id"],
2526
+ name: json["name"],
2527
+ plan: json["plan"] == null ? void 0 : CompanyContextPlanResponseDataFromJSON(json["plan"]),
2528
+ scheduledDowngrade: json["scheduled_downgrade"] == null ? void 0 : CompanyContextScheduledDowngradeResponseDataFromJSON(
2529
+ json["scheduled_downgrade"]
2530
+ ),
2531
+ subscription: json["subscription"] == null ? void 0 : CompanyContextSubscriptionResponseDataFromJSON(json["subscription"])
2532
+ };
2533
+ }
2534
+ function CompanyContextResponseDataToJSON(json) {
2535
+ return CompanyContextResponseDataToJSONTyped(json, false);
2536
+ }
2537
+ function CompanyContextResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2538
+ if (value == null) {
2539
+ return value;
2540
+ }
2541
+ return {
2542
+ add_ons: value["addOns"].map(
2543
+ CompanyContextPlanResponseDataToJSON
2544
+ ),
2545
+ custom_plan_billing: CompanyContextCustomPlanBillingResponseDataToJSON(
2546
+ value["customPlanBilling"]
2547
+ ),
2548
+ id: value["id"],
2549
+ name: value["name"],
2550
+ plan: CompanyContextPlanResponseDataToJSON(value["plan"]),
2551
+ scheduled_downgrade: CompanyContextScheduledDowngradeResponseDataToJSON(
2552
+ value["scheduledDowngrade"]
2553
+ ),
2554
+ subscription: CompanyContextSubscriptionResponseDataToJSON(
2555
+ value["subscription"]
2556
+ )
2557
+ };
2558
+ }
2559
+ function instanceOfCompanyCreditAutoTopupResponseData(value) {
2560
+ if (!("enabled" in value) || value["enabled"] === void 0) return false;
2561
+ if (!("selfService" in value) || value["selfService"] === void 0)
2562
+ return false;
2563
+ return true;
2564
+ }
2565
+ function CompanyCreditAutoTopupResponseDataFromJSON(json) {
2566
+ return CompanyCreditAutoTopupResponseDataFromJSONTyped(json, false);
2567
+ }
2568
+ function CompanyCreditAutoTopupResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2569
+ if (json == null) {
2570
+ return json;
2571
+ }
2572
+ return {
2573
+ amount: json["amount"] == null ? void 0 : json["amount"],
2574
+ enabled: json["enabled"],
2575
+ selfService: json["self_service"],
2576
+ thresholdCredits: json["threshold_credits"] == null ? void 0 : json["threshold_credits"]
2577
+ };
2578
+ }
2579
+ function CompanyCreditAutoTopupResponseDataToJSON(json) {
2580
+ return CompanyCreditAutoTopupResponseDataToJSONTyped(json, false);
2581
+ }
2582
+ function CompanyCreditAutoTopupResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2583
+ if (value == null) {
2584
+ return value;
2585
+ }
2586
+ return {
2587
+ amount: value["amount"],
2588
+ enabled: value["enabled"],
2589
+ self_service: value["selfService"],
2590
+ threshold_credits: value["thresholdCredits"]
2591
+ };
2592
+ }
2052
2593
  function instanceOfCompanyCreditGrantResponseData(value) {
2053
2594
  if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
2054
2595
  if (!("grantReason" in value) || value["grantReason"] === void 0)
@@ -2186,6 +2727,7 @@ function CompanyCreditBalanceResponseDataFromJSONTyped(json, ignoreDiscriminator
2186
2727
  return json;
2187
2728
  }
2188
2729
  return {
2730
+ autoTopup: json["auto_topup"] == null ? void 0 : CompanyCreditAutoTopupResponseDataFromJSON(json["auto_topup"]),
2189
2731
  composition: json["composition"] == null ? void 0 : CompanyCreditCompositionResponseDataFromJSON(json["composition"]),
2190
2732
  creditDescription: json["credit_description"],
2191
2733
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
@@ -2212,6 +2754,7 @@ function CompanyCreditBalanceResponseDataToJSONTyped(value, ignoreDiscriminator
2212
2754
  return value;
2213
2755
  }
2214
2756
  return {
2757
+ auto_topup: CompanyCreditAutoTopupResponseDataToJSON(value["autoTopup"]),
2215
2758
  composition: CompanyCreditCompositionResponseDataToJSON(
2216
2759
  value["composition"]
2217
2760
  ),
@@ -2357,7 +2900,7 @@ function CompanyDiscountResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2357
2900
  return {
2358
2901
  amountOff: json["amount_off"] == null ? void 0 : json["amount_off"],
2359
2902
  couponName: json["coupon_name"],
2360
- currency: json["currency"] == null ? void 0 : json["currency"],
2903
+ currency: json["currency"] == null ? void 0 : CurrencyFromJSON2(json["currency"]),
2361
2904
  customerFacingCode: json["customer_facing_code"] == null ? void 0 : json["customer_facing_code"],
2362
2905
  duration: json["duration"],
2363
2906
  durationInMonths: json["duration_in_months"] == null ? void 0 : json["duration_in_months"],
@@ -2374,7 +2917,7 @@ function CompanyDiscountResponseDataToJSONTyped(value, ignoreDiscriminator = fal
2374
2917
  return {
2375
2918
  amount_off: value["amountOff"],
2376
2919
  coupon_name: value["couponName"],
2377
- currency: value["currency"],
2920
+ currency: CurrencyToJSON2(value["currency"]),
2378
2921
  customer_facing_code: value["customerFacingCode"],
2379
2922
  duration: value["duration"],
2380
2923
  duration_in_months: value["durationInMonths"],
@@ -2815,7 +3358,7 @@ function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2815
3358
  return {
2816
3359
  amountDue: json["amount_due"],
2817
3360
  createdAt: new Date(json["created_at"]),
2818
- currency: json["currency"],
3361
+ currency: CurrencyFromJSON2(json["currency"]),
2819
3362
  dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
2820
3363
  id: json["id"],
2821
3364
  status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
@@ -2832,7 +3375,7 @@ function CompanyInvoiceResponseDataToJSONTyped(value, ignoreDiscriminator = fals
2832
3375
  return {
2833
3376
  amount_due: value["amountDue"],
2834
3377
  created_at: value["createdAt"].toISOString(),
2835
- currency: value["currency"],
3378
+ currency: CurrencyToJSON2(value["currency"]),
2836
3379
  due_date: value["dueDate"] == null ? void 0 : value["dueDate"].toISOString(),
2837
3380
  id: value["id"],
2838
3381
  status: InvoiceStatusToJSON(value["status"]),
@@ -2983,7 +3526,7 @@ function CompanyUpcomingInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminat
2983
3526
  }
2984
3527
  return {
2985
3528
  amountDue: json["amount_due"],
2986
- currency: json["currency"],
3529
+ currency: CurrencyFromJSON2(json["currency"]),
2987
3530
  customerBalanceApplied: json["customer_balance_applied"],
2988
3531
  customerBalanceRemaining: json["customer_balance_remaining"],
2989
3532
  discounts: json["discounts"].map(
@@ -3002,7 +3545,7 @@ function CompanyUpcomingInvoiceResponseDataToJSONTyped(value, ignoreDiscriminato
3002
3545
  }
3003
3546
  return {
3004
3547
  amount_due: value["amountDue"],
3005
- currency: value["currency"],
3548
+ currency: CurrencyToJSON2(value["currency"]),
3006
3549
  customer_balance_applied: value["customerBalanceApplied"],
3007
3550
  customer_balance_remaining: value["customerBalanceRemaining"],
3008
3551
  discounts: value["discounts"].map(
@@ -3074,31 +3617,6 @@ function CreateSetupIntentResponseToJSONTyped(value, ignoreDiscriminator = false
3074
3617
  params: value["params"]
3075
3618
  };
3076
3619
  }
3077
- function instanceOfDeleteResponse(value) {
3078
- return true;
3079
- }
3080
- function DeleteResponseFromJSON(json) {
3081
- return DeleteResponseFromJSONTyped(json, false);
3082
- }
3083
- function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
3084
- if (json == null) {
3085
- return json;
3086
- }
3087
- return {
3088
- deleted: json["deleted"] == null ? void 0 : json["deleted"]
3089
- };
3090
- }
3091
- function DeleteResponseToJSON(json) {
3092
- return DeleteResponseToJSONTyped(json, false);
3093
- }
3094
- function DeleteResponseToJSONTyped(value, ignoreDiscriminator = false) {
3095
- if (value == null) {
3096
- return value;
3097
- }
3098
- return {
3099
- deleted: value["deleted"]
3100
- };
3101
- }
3102
3620
  function instanceOfDeletePaymentMethodResponse(value) {
3103
3621
  if (!("data" in value) || value["data"] === void 0) return false;
3104
3622
  if (!("params" in value) || value["params"] === void 0) return false;
@@ -3385,6 +3903,35 @@ function GetCompanyPaymentMethodsResponseToJSONTyped(value, ignoreDiscriminator
3385
3903
  params: value["params"]
3386
3904
  };
3387
3905
  }
3906
+ function instanceOfGetCompanyResponse(value) {
3907
+ if (!("data" in value) || value["data"] === void 0) return false;
3908
+ if (!("params" in value) || value["params"] === void 0) return false;
3909
+ return true;
3910
+ }
3911
+ function GetCompanyResponseFromJSON(json) {
3912
+ return GetCompanyResponseFromJSONTyped(json, false);
3913
+ }
3914
+ function GetCompanyResponseFromJSONTyped(json, ignoreDiscriminator) {
3915
+ if (json == null) {
3916
+ return json;
3917
+ }
3918
+ return {
3919
+ data: CompanyContextResponseDataFromJSON(json["data"]),
3920
+ params: json["params"]
3921
+ };
3922
+ }
3923
+ function GetCompanyResponseToJSON(json) {
3924
+ return GetCompanyResponseToJSONTyped(json, false);
3925
+ }
3926
+ function GetCompanyResponseToJSONTyped(value, ignoreDiscriminator = false) {
3927
+ if (value == null) {
3928
+ return value;
3929
+ }
3930
+ return {
3931
+ data: CompanyContextResponseDataToJSON(value["data"]),
3932
+ params: value["params"]
3933
+ };
3934
+ }
3388
3935
  function instanceOfGetCompanyUpcomingInvoiceResponse(value) {
3389
3936
  if (!("data" in value) || value["data"] === void 0) return false;
3390
3937
  if (!("params" in value) || value["params"] === void 0) return false;
@@ -3899,6 +4446,9 @@ var SchematicBillingClient = class {
3899
4446
  method: "DELETE"
3900
4447
  }).then(() => void 0);
3901
4448
  }
4449
+ cancelSubscription() {
4450
+ return this.session.request("/checkout/unsubscribe", { method: "DELETE" }).then(() => void 0);
4451
+ }
3902
4452
  fetchFeatureUsage() {
3903
4453
  const path = "/company/usage";
3904
4454
  return this.session.request(path).then((body) => {
@@ -3912,6 +4462,15 @@ var SchematicBillingClient = class {
3912
4462
  return GetCompanyFeatureUsageResponseFromJSON(body).data.features;
3913
4463
  });
3914
4464
  }
4465
+ fetchCompany() {
4466
+ const path = "/company";
4467
+ return this.session.request(path).then((body) => {
4468
+ if (body === null || typeof body !== "object" || !("data" in body) || body.data == null) {
4469
+ throw new Error(`Malformed response from ${path}`);
4470
+ }
4471
+ return GetCompanyResponseFromJSON(body).data;
4472
+ });
4473
+ }
3915
4474
  fetchCreditBalances() {
3916
4475
  const path = "/company/credits";
3917
4476
  return this.session.request(path).then((body) => {
@@ -6236,6 +6795,9 @@ var BillingStore = class {
6236
6795
  () => this._client.fetchCreditBalances(),
6237
6796
  { readiness }
6238
6797
  );
6798
+ this.company = new KeyedResource(() => this._client.fetchCompany(), {
6799
+ readiness
6800
+ });
6239
6801
  this.creditUserUsage = new KeyedResource(
6240
6802
  ({ creditId }) => this._client.fetchCreditUserUsage({
6241
6803
  creditId,
@@ -6266,7 +6828,10 @@ var BillingStore = class {
6266
6828
  if (initialData.creditBalances !== void 0) {
6267
6829
  held.creditBalances = initialData.creditBalances;
6268
6830
  }
6269
- if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0) {
6831
+ if (initialData.company !== void 0) {
6832
+ held.company = initialData.company;
6833
+ }
6834
+ if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0 || held.company !== void 0) {
6270
6835
  this._held = held;
6271
6836
  this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
6272
6837
  }
@@ -6277,6 +6842,7 @@ var BillingStore = class {
6277
6842
  paymentMethods;
6278
6843
  featureUsage;
6279
6844
  creditBalances;
6845
+ company;
6280
6846
  creditUserUsage;
6281
6847
  featureUserUsage;
6282
6848
  _pageSize;
@@ -6363,6 +6929,9 @@ var BillingStore = class {
6363
6929
  if (held.creditBalances !== void 0) {
6364
6930
  this.creditBalances.seed(SINGLETON, held.creditBalances);
6365
6931
  }
6932
+ if (held.company !== void 0) {
6933
+ this.company.seed(SINGLETON, held.company);
6934
+ }
6366
6935
  this._seedKey = held.key;
6367
6936
  this._seeded = true;
6368
6937
  }
@@ -6447,6 +7016,19 @@ var BillingStore = class {
6447
7016
  await this._client.deletePaymentMethod(id);
6448
7017
  await this._reloadPaymentMethods();
6449
7018
  }
7019
+ /**
7020
+ * Cancels the subscription at period end, then reloads what that changes:
7021
+ * the company, its next bill and its credits' renewals. Rejects as
7022
+ * `setDefaultPaymentMethod` does.
7023
+ */
7024
+ async unsubscribe() {
7025
+ await this._client.cancelSubscription();
7026
+ await Promise.all([
7027
+ this._reload(this.company),
7028
+ this._reload(this.creditBalances),
7029
+ this._reload(this.upcomingInvoice)
7030
+ ]);
7031
+ }
6450
7032
  /**
6451
7033
  * Mints a setup intent for adding a payment method. Nothing in the store
6452
7034
  * changes until the provider confirms it and the host reloads the list,
@@ -6458,16 +7040,19 @@ var BillingStore = class {
6458
7040
  dispose() {
6459
7041
  this._unsubscribe?.();
6460
7042
  }
7043
+ _reloadPaymentMethods() {
7044
+ return this._reload(this.paymentMethods);
7045
+ }
6461
7046
  /**
6462
- * After a write. A list nobody has read is left alone: it loads fresh
7047
+ * After a write. A resource nobody has read is left alone: it loads fresh
6463
7048
  * when someone does. One that is loaded, or subscribed and waiting on a
6464
7049
  * failed load, is fetched again; `refetch` never rejects.
6465
7050
  */
6466
- async _reloadPaymentMethods() {
6467
- if (!this.paymentMethods.has(SINGLETON)) {
7051
+ async _reload(keyed) {
7052
+ if (!keyed.has(SINGLETON)) {
6468
7053
  return;
6469
7054
  }
6470
- const resource = this.paymentMethods.get(SINGLETON);
7055
+ const resource = keyed.get(SINGLETON);
6471
7056
  if (resource.snapshot.data !== void 0 || resource.subscriberCount > 0) {
6472
7057
  await resource.refetch();
6473
7058
  }
@@ -6514,7 +7099,8 @@ var RESOURCE_NAMES = [
6514
7099
  "upcomingInvoice",
6515
7100
  "paymentMethods",
6516
7101
  "featureUsage",
6517
- "creditBalances"
7102
+ "creditBalances",
7103
+ "company"
6518
7104
  ];
6519
7105
 
6520
7106
  // src/billing/context.tsx
@@ -6568,7 +7154,8 @@ var BILLING_ACTION_UNAVAILABLE_MESSAGE = (name) => `Schematic billing action ${n
6568
7154
  var ACTION_NAMES = [
6569
7155
  "setDefaultPaymentMethod",
6570
7156
  "removePaymentMethod",
6571
- "createSetupIntent"
7157
+ "createSetupIntent",
7158
+ "unsubscribe"
6572
7159
  ];
6573
7160
  function rejectingActions(reason, given = {}) {
6574
7161
  const actions = {};
@@ -6807,6 +7394,9 @@ function useFeatureUserUsage(featureId) {
6807
7394
  );
6808
7395
  return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
6809
7396
  }
7397
+ function useCompany() {
7398
+ return useBillingResource("company", SINGLETON);
7399
+ }
6810
7400
  function useCreditBalances() {
6811
7401
  return useBillingResource("creditBalances", SINGLETON);
6812
7402
  }
@@ -6825,6 +7415,29 @@ function useCreditUserUsage(creditId) {
6825
7415
  function useInvalidateBillingData() {
6826
7416
  return useBillingDataSource().invalidateAll;
6827
7417
  }
7418
+ function useUnsubscribe() {
7419
+ const source = useBillingDataSource();
7420
+ const [mutation, setMutation] = (0, import_react3.useState)(IDLE);
7421
+ const unsubscribe = (0, import_react3.useCallback)(async () => {
7422
+ setMutation((m) => ({ inflight: m.inflight + 1, error: void 0 }));
7423
+ try {
7424
+ await actionsOf(source).unsubscribe();
7425
+ } catch (cause) {
7426
+ const error = cause instanceof Error ? cause : new Error(String(cause));
7427
+ setMutation((m) => ({ inflight: m.inflight - 1, error }));
7428
+ throw error;
7429
+ }
7430
+ setMutation((m) => ({ inflight: m.inflight - 1, error: void 0 }));
7431
+ }, [source]);
7432
+ return (0, import_react3.useMemo)(
7433
+ () => ({
7434
+ unsubscribe,
7435
+ isMutating: mutation.inflight > 0,
7436
+ mutationError: mutation.error
7437
+ }),
7438
+ [mutation, unsubscribe]
7439
+ );
7440
+ }
6828
7441
 
6829
7442
  // src/billing/provider.tsx
6830
7443
  var import_react4 = require("react");
@@ -6906,7 +7519,8 @@ function BillingProvider({
6906
7519
  actions: {
6907
7520
  setDefaultPaymentMethod: (externalId) => store.setDefaultPaymentMethod(externalId),
6908
7521
  removePaymentMethod: (id) => store.removePaymentMethod(id),
6909
- createSetupIntent: () => store.createSetupIntent()
7522
+ createSetupIntent: () => store.createSetupIntent(),
7523
+ unsubscribe: () => store.unsubscribe()
6910
7524
  }
6911
7525
  };
6912
7526
  }, [store]);
@@ -6973,7 +7587,7 @@ function staticSource(data) {
6973
7587
  }
6974
7588
 
6975
7589
  // src/version.ts
6976
- var version2 = "1.12.0";
7590
+ var version2 = "1.14.0";
6977
7591
 
6978
7592
  // src/context/schematic.tsx
6979
7593
  var import_jsx_runtime4 = require("react/jsx-runtime");