@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.
@@ -1,4 +1,4 @@
1
- // node_modules/.pnpm/@schematichq+schematic-js@1.12.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
1
+ // node_modules/.pnpm/@schematichq+schematic-js@1.14.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1326,7 +1326,7 @@ var ContextSignatureManager = class {
1326
1326
  }
1327
1327
  }
1328
1328
  };
1329
- var version = "1.12.0";
1329
+ var version = "1.14.0";
1330
1330
  var SINGLETON = {};
1331
1331
  var models_exports = {};
1332
1332
  __export(models_exports, {
@@ -1376,6 +1376,34 @@ __export(models_exports, {
1376
1376
  CatalogPriceTierResponseDataFromJSONTyped: () => CatalogPriceTierResponseDataFromJSONTyped,
1377
1377
  CatalogPriceTierResponseDataToJSON: () => CatalogPriceTierResponseDataToJSON,
1378
1378
  CatalogPriceTierResponseDataToJSONTyped: () => CatalogPriceTierResponseDataToJSONTyped,
1379
+ CheckoutUnsubscribeResponseFromJSON: () => CheckoutUnsubscribeResponseFromJSON,
1380
+ CheckoutUnsubscribeResponseFromJSONTyped: () => CheckoutUnsubscribeResponseFromJSONTyped,
1381
+ CheckoutUnsubscribeResponseToJSON: () => CheckoutUnsubscribeResponseToJSON,
1382
+ CheckoutUnsubscribeResponseToJSONTyped: () => CheckoutUnsubscribeResponseToJSONTyped,
1383
+ CompanyContextCustomPlanBillingResponseDataFromJSON: () => CompanyContextCustomPlanBillingResponseDataFromJSON,
1384
+ CompanyContextCustomPlanBillingResponseDataFromJSONTyped: () => CompanyContextCustomPlanBillingResponseDataFromJSONTyped,
1385
+ CompanyContextCustomPlanBillingResponseDataToJSON: () => CompanyContextCustomPlanBillingResponseDataToJSON,
1386
+ CompanyContextCustomPlanBillingResponseDataToJSONTyped: () => CompanyContextCustomPlanBillingResponseDataToJSONTyped,
1387
+ CompanyContextPlanResponseDataFromJSON: () => CompanyContextPlanResponseDataFromJSON,
1388
+ CompanyContextPlanResponseDataFromJSONTyped: () => CompanyContextPlanResponseDataFromJSONTyped,
1389
+ CompanyContextPlanResponseDataToJSON: () => CompanyContextPlanResponseDataToJSON,
1390
+ CompanyContextPlanResponseDataToJSONTyped: () => CompanyContextPlanResponseDataToJSONTyped,
1391
+ CompanyContextResponseDataFromJSON: () => CompanyContextResponseDataFromJSON,
1392
+ CompanyContextResponseDataFromJSONTyped: () => CompanyContextResponseDataFromJSONTyped,
1393
+ CompanyContextResponseDataToJSON: () => CompanyContextResponseDataToJSON,
1394
+ CompanyContextResponseDataToJSONTyped: () => CompanyContextResponseDataToJSONTyped,
1395
+ CompanyContextScheduledDowngradeResponseDataFromJSON: () => CompanyContextScheduledDowngradeResponseDataFromJSON,
1396
+ CompanyContextScheduledDowngradeResponseDataFromJSONTyped: () => CompanyContextScheduledDowngradeResponseDataFromJSONTyped,
1397
+ CompanyContextScheduledDowngradeResponseDataToJSON: () => CompanyContextScheduledDowngradeResponseDataToJSON,
1398
+ CompanyContextScheduledDowngradeResponseDataToJSONTyped: () => CompanyContextScheduledDowngradeResponseDataToJSONTyped,
1399
+ CompanyContextSubscriptionResponseDataFromJSON: () => CompanyContextSubscriptionResponseDataFromJSON,
1400
+ CompanyContextSubscriptionResponseDataFromJSONTyped: () => CompanyContextSubscriptionResponseDataFromJSONTyped,
1401
+ CompanyContextSubscriptionResponseDataToJSON: () => CompanyContextSubscriptionResponseDataToJSON,
1402
+ CompanyContextSubscriptionResponseDataToJSONTyped: () => CompanyContextSubscriptionResponseDataToJSONTyped,
1403
+ CompanyCreditAutoTopupResponseDataFromJSON: () => CompanyCreditAutoTopupResponseDataFromJSON,
1404
+ CompanyCreditAutoTopupResponseDataFromJSONTyped: () => CompanyCreditAutoTopupResponseDataFromJSONTyped,
1405
+ CompanyCreditAutoTopupResponseDataToJSON: () => CompanyCreditAutoTopupResponseDataToJSON,
1406
+ CompanyCreditAutoTopupResponseDataToJSONTyped: () => CompanyCreditAutoTopupResponseDataToJSONTyped,
1379
1407
  CompanyCreditBalanceResponseDataFromJSON: () => CompanyCreditBalanceResponseDataFromJSON,
1380
1408
  CompanyCreditBalanceResponseDataFromJSONTyped: () => CompanyCreditBalanceResponseDataFromJSONTyped,
1381
1409
  CompanyCreditBalanceResponseDataToJSON: () => CompanyCreditBalanceResponseDataToJSON,
@@ -1444,6 +1472,16 @@ __export(models_exports, {
1444
1472
  CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
1445
1473
  CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
1446
1474
  CreateSetupIntentResponseToJSONTyped: () => CreateSetupIntentResponseToJSONTyped,
1475
+ Currency: () => Currency,
1476
+ CurrencyFromJSON: () => CurrencyFromJSON2,
1477
+ CurrencyFromJSONTyped: () => CurrencyFromJSONTyped8,
1478
+ CurrencyToJSON: () => CurrencyToJSON2,
1479
+ CurrencyToJSONTyped: () => CurrencyToJSONTyped8,
1480
+ CustomPlanActivationStrategy: () => CustomPlanActivationStrategy,
1481
+ CustomPlanActivationStrategyFromJSON: () => CustomPlanActivationStrategyFromJSON,
1482
+ CustomPlanActivationStrategyFromJSONTyped: () => CustomPlanActivationStrategyFromJSONTyped,
1483
+ CustomPlanActivationStrategyToJSON: () => CustomPlanActivationStrategyToJSON,
1484
+ CustomPlanActivationStrategyToJSONTyped: () => CustomPlanActivationStrategyToJSONTyped,
1447
1485
  DeletePaymentMethodResponseFromJSON: () => DeletePaymentMethodResponseFromJSON,
1448
1486
  DeletePaymentMethodResponseFromJSONTyped: () => DeletePaymentMethodResponseFromJSONTyped,
1449
1487
  DeletePaymentMethodResponseToJSON: () => DeletePaymentMethodResponseToJSON,
@@ -1508,6 +1546,10 @@ __export(models_exports, {
1508
1546
  GetCompanyPaymentMethodsResponseFromJSONTyped: () => GetCompanyPaymentMethodsResponseFromJSONTyped,
1509
1547
  GetCompanyPaymentMethodsResponseToJSON: () => GetCompanyPaymentMethodsResponseToJSON,
1510
1548
  GetCompanyPaymentMethodsResponseToJSONTyped: () => GetCompanyPaymentMethodsResponseToJSONTyped,
1549
+ GetCompanyResponseFromJSON: () => GetCompanyResponseFromJSON,
1550
+ GetCompanyResponseFromJSONTyped: () => GetCompanyResponseFromJSONTyped,
1551
+ GetCompanyResponseToJSON: () => GetCompanyResponseToJSON,
1552
+ GetCompanyResponseToJSONTyped: () => GetCompanyResponseToJSONTyped,
1511
1553
  GetCompanyUpcomingInvoiceResponseFromJSON: () => GetCompanyUpcomingInvoiceResponseFromJSON,
1512
1554
  GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
1513
1555
  GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
@@ -1558,6 +1600,13 @@ __export(models_exports, {
1558
1600
  instanceOfCatalogCreditGrantResponseData: () => instanceOfCatalogCreditGrantResponseData,
1559
1601
  instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
1560
1602
  instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
1603
+ instanceOfCheckoutUnsubscribeResponse: () => instanceOfCheckoutUnsubscribeResponse,
1604
+ instanceOfCompanyContextCustomPlanBillingResponseData: () => instanceOfCompanyContextCustomPlanBillingResponseData,
1605
+ instanceOfCompanyContextPlanResponseData: () => instanceOfCompanyContextPlanResponseData,
1606
+ instanceOfCompanyContextResponseData: () => instanceOfCompanyContextResponseData,
1607
+ instanceOfCompanyContextScheduledDowngradeResponseData: () => instanceOfCompanyContextScheduledDowngradeResponseData,
1608
+ instanceOfCompanyContextSubscriptionResponseData: () => instanceOfCompanyContextSubscriptionResponseData,
1609
+ instanceOfCompanyCreditAutoTopupResponseData: () => instanceOfCompanyCreditAutoTopupResponseData,
1561
1610
  instanceOfCompanyCreditBalanceResponseData: () => instanceOfCompanyCreditBalanceResponseData,
1562
1611
  instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
1563
1612
  instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
@@ -1575,6 +1624,8 @@ __export(models_exports, {
1575
1624
  instanceOfCompanyUpcomingInvoiceResponseData: () => instanceOfCompanyUpcomingInvoiceResponseData,
1576
1625
  instanceOfCompanyUserUsageResponseData: () => instanceOfCompanyUserUsageResponseData,
1577
1626
  instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
1627
+ instanceOfCurrency: () => instanceOfCurrency,
1628
+ instanceOfCustomPlanActivationStrategy: () => instanceOfCustomPlanActivationStrategy,
1578
1629
  instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
1579
1630
  instanceOfDeleteResponse: () => instanceOfDeleteResponse,
1580
1631
  instanceOfEntitlementPriceBehavior: () => instanceOfEntitlementPriceBehavior,
@@ -1590,6 +1641,7 @@ __export(models_exports, {
1590
1641
  instanceOfGetCompanyInvoicesParams: () => instanceOfGetCompanyInvoicesParams,
1591
1642
  instanceOfGetCompanyInvoicesResponse: () => instanceOfGetCompanyInvoicesResponse,
1592
1643
  instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
1644
+ instanceOfGetCompanyResponse: () => instanceOfGetCompanyResponse,
1593
1645
  instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
1594
1646
  instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
1595
1647
  instanceOfMetricPeriod: () => instanceOfMetricPeriod,
@@ -1916,6 +1968,164 @@ function CatalogPriceTierResponseDataToJSONTyped(value, ignoreDiscriminator = fa
1916
1968
  to: value["to"]
1917
1969
  };
1918
1970
  }
1971
+ var Currency = {
1972
+ Aed: "aed",
1973
+ Afn: "afn",
1974
+ All: "all",
1975
+ Amd: "amd",
1976
+ Ang: "ang",
1977
+ Aoa: "aoa",
1978
+ Ars: "ars",
1979
+ Aud: "aud",
1980
+ Awg: "awg",
1981
+ Azn: "azn",
1982
+ Bam: "bam",
1983
+ Bbd: "bbd",
1984
+ Bdt: "bdt",
1985
+ Bif: "bif",
1986
+ Bmd: "bmd",
1987
+ Bnd: "bnd",
1988
+ Bob: "bob",
1989
+ Brl: "brl",
1990
+ Bsd: "bsd",
1991
+ Bwp: "bwp",
1992
+ Byn: "byn",
1993
+ Bzd: "bzd",
1994
+ Cad: "cad",
1995
+ Cdf: "cdf",
1996
+ Chf: "chf",
1997
+ Clp: "clp",
1998
+ Cny: "cny",
1999
+ Cop: "cop",
2000
+ Crc: "crc",
2001
+ Cve: "cve",
2002
+ Czk: "czk",
2003
+ Djf: "djf",
2004
+ Dkk: "dkk",
2005
+ Dop: "dop",
2006
+ Dzd: "dzd",
2007
+ Egp: "egp",
2008
+ Etb: "etb",
2009
+ Eur: "eur",
2010
+ Fjd: "fjd",
2011
+ Fkp: "fkp",
2012
+ Gbp: "gbp",
2013
+ Gel: "gel",
2014
+ Gip: "gip",
2015
+ Gmd: "gmd",
2016
+ Gnf: "gnf",
2017
+ Gtq: "gtq",
2018
+ Gyd: "gyd",
2019
+ Hkd: "hkd",
2020
+ Hnl: "hnl",
2021
+ Htg: "htg",
2022
+ Huf: "huf",
2023
+ Idr: "idr",
2024
+ Ils: "ils",
2025
+ Inr: "inr",
2026
+ Isk: "isk",
2027
+ Jmd: "jmd",
2028
+ Jpy: "jpy",
2029
+ Kes: "kes",
2030
+ Kgs: "kgs",
2031
+ Khr: "khr",
2032
+ Kmf: "kmf",
2033
+ Krw: "krw",
2034
+ Kyd: "kyd",
2035
+ Kzt: "kzt",
2036
+ Lak: "lak",
2037
+ Lbp: "lbp",
2038
+ Lkr: "lkr",
2039
+ Lrd: "lrd",
2040
+ Lsl: "lsl",
2041
+ Mad: "mad",
2042
+ Mdl: "mdl",
2043
+ Mga: "mga",
2044
+ Mkd: "mkd",
2045
+ Mmk: "mmk",
2046
+ Mnt: "mnt",
2047
+ Mop: "mop",
2048
+ Mur: "mur",
2049
+ Mvr: "mvr",
2050
+ Mwk: "mwk",
2051
+ Mxn: "mxn",
2052
+ Myr: "myr",
2053
+ Mzn: "mzn",
2054
+ Nad: "nad",
2055
+ Ngn: "ngn",
2056
+ Nio: "nio",
2057
+ Nok: "nok",
2058
+ Npr: "npr",
2059
+ Nzd: "nzd",
2060
+ Pab: "pab",
2061
+ Pen: "pen",
2062
+ Pgk: "pgk",
2063
+ Php: "php",
2064
+ Pkr: "pkr",
2065
+ Pln: "pln",
2066
+ Pyg: "pyg",
2067
+ Qar: "qar",
2068
+ Ron: "ron",
2069
+ Rsd: "rsd",
2070
+ Rub: "rub",
2071
+ Rwf: "rwf",
2072
+ Sar: "sar",
2073
+ Sbd: "sbd",
2074
+ Scr: "scr",
2075
+ Sek: "sek",
2076
+ Sgd: "sgd",
2077
+ Shp: "shp",
2078
+ Sle: "sle",
2079
+ Sos: "sos",
2080
+ Srd: "srd",
2081
+ Std: "std",
2082
+ Szl: "szl",
2083
+ Thb: "thb",
2084
+ Tjs: "tjs",
2085
+ Top: "top",
2086
+ Try: "try",
2087
+ Ttd: "ttd",
2088
+ Twd: "twd",
2089
+ Tzs: "tzs",
2090
+ Uah: "uah",
2091
+ Ugx: "ugx",
2092
+ Usd: "usd",
2093
+ Uyu: "uyu",
2094
+ Uzs: "uzs",
2095
+ Vnd: "vnd",
2096
+ Vuv: "vuv",
2097
+ Wst: "wst",
2098
+ Xaf: "xaf",
2099
+ Xcd: "xcd",
2100
+ Xcg: "xcg",
2101
+ Xof: "xof",
2102
+ Xpf: "xpf",
2103
+ Yer: "yer",
2104
+ Zar: "zar",
2105
+ Zmw: "zmw"
2106
+ };
2107
+ function instanceOfCurrency(value) {
2108
+ for (const key in Currency) {
2109
+ if (Object.prototype.hasOwnProperty.call(Currency, key)) {
2110
+ if (Currency[key] === value) {
2111
+ return true;
2112
+ }
2113
+ }
2114
+ }
2115
+ return false;
2116
+ }
2117
+ function CurrencyFromJSON2(json) {
2118
+ return CurrencyFromJSONTyped8(json, false);
2119
+ }
2120
+ function CurrencyFromJSONTyped8(json, ignoreDiscriminator) {
2121
+ return json;
2122
+ }
2123
+ function CurrencyToJSON2(value) {
2124
+ return value;
2125
+ }
2126
+ function CurrencyToJSONTyped8(value, ignoreDiscriminator) {
2127
+ return value;
2128
+ }
1919
2129
  function instanceOfCatalogPriceResponseData(value) {
1920
2130
  if (!("currency" in value) || value["currency"] === void 0) return false;
1921
2131
  if (!("id" in value) || value["id"] === void 0) return false;
@@ -1938,7 +2148,7 @@ function CatalogPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
1938
2148
  return json;
1939
2149
  }
1940
2150
  return {
1941
- currency: json["currency"],
2151
+ currency: CurrencyFromJSON2(json["currency"]),
1942
2152
  id: json["id"],
1943
2153
  interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
1944
2154
  intervalCount: json["interval_count"],
@@ -1961,7 +2171,7 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
1961
2171
  return value;
1962
2172
  }
1963
2173
  return {
1964
- currency: value["currency"],
2174
+ currency: CurrencyToJSON2(value["currency"]),
1965
2175
  id: value["id"],
1966
2176
  interval: BillingProductPriceIntervalToJSON2(value["interval"]),
1967
2177
  interval_count: value["intervalCount"],
@@ -1976,6 +2186,335 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
1976
2186
  tiers_mode: BillingTiersModeToJSON2(value["tiersMode"])
1977
2187
  };
1978
2188
  }
2189
+ function instanceOfDeleteResponse(value) {
2190
+ return true;
2191
+ }
2192
+ function DeleteResponseFromJSON(json) {
2193
+ return DeleteResponseFromJSONTyped(json, false);
2194
+ }
2195
+ function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
2196
+ if (json == null) {
2197
+ return json;
2198
+ }
2199
+ return {
2200
+ deleted: json["deleted"] == null ? void 0 : json["deleted"]
2201
+ };
2202
+ }
2203
+ function DeleteResponseToJSON(json) {
2204
+ return DeleteResponseToJSONTyped(json, false);
2205
+ }
2206
+ function DeleteResponseToJSONTyped(value, ignoreDiscriminator = false) {
2207
+ if (value == null) {
2208
+ return value;
2209
+ }
2210
+ return {
2211
+ deleted: value["deleted"]
2212
+ };
2213
+ }
2214
+ function instanceOfCheckoutUnsubscribeResponse(value) {
2215
+ if (!("data" in value) || value["data"] === void 0) return false;
2216
+ if (!("params" in value) || value["params"] === void 0) return false;
2217
+ return true;
2218
+ }
2219
+ function CheckoutUnsubscribeResponseFromJSON(json) {
2220
+ return CheckoutUnsubscribeResponseFromJSONTyped(json, false);
2221
+ }
2222
+ function CheckoutUnsubscribeResponseFromJSONTyped(json, ignoreDiscriminator) {
2223
+ if (json == null) {
2224
+ return json;
2225
+ }
2226
+ return {
2227
+ data: DeleteResponseFromJSON(json["data"]),
2228
+ params: json["params"]
2229
+ };
2230
+ }
2231
+ function CheckoutUnsubscribeResponseToJSON(json) {
2232
+ return CheckoutUnsubscribeResponseToJSONTyped(json, false);
2233
+ }
2234
+ function CheckoutUnsubscribeResponseToJSONTyped(value, ignoreDiscriminator = false) {
2235
+ if (value == null) {
2236
+ return value;
2237
+ }
2238
+ return {
2239
+ data: DeleteResponseToJSON(value["data"]),
2240
+ params: value["params"]
2241
+ };
2242
+ }
2243
+ var CustomPlanActivationStrategy = {
2244
+ Payment: "on_payment",
2245
+ Publish: "on_publish"
2246
+ };
2247
+ function instanceOfCustomPlanActivationStrategy(value) {
2248
+ for (const key in CustomPlanActivationStrategy) {
2249
+ if (Object.prototype.hasOwnProperty.call(CustomPlanActivationStrategy, key)) {
2250
+ if (CustomPlanActivationStrategy[key] === value) {
2251
+ return true;
2252
+ }
2253
+ }
2254
+ }
2255
+ return false;
2256
+ }
2257
+ function CustomPlanActivationStrategyFromJSON(json) {
2258
+ return CustomPlanActivationStrategyFromJSONTyped(json, false);
2259
+ }
2260
+ function CustomPlanActivationStrategyFromJSONTyped(json, ignoreDiscriminator) {
2261
+ return json;
2262
+ }
2263
+ function CustomPlanActivationStrategyToJSON(value) {
2264
+ return value;
2265
+ }
2266
+ function CustomPlanActivationStrategyToJSONTyped(value, ignoreDiscriminator) {
2267
+ return value;
2268
+ }
2269
+ function instanceOfCompanyContextCustomPlanBillingResponseData(value) {
2270
+ if (!("activationStrategy" in value) || value["activationStrategy"] === void 0)
2271
+ return false;
2272
+ if (!("dueAt" in value) || value["dueAt"] === void 0) return false;
2273
+ if (!("planId" in value) || value["planId"] === void 0) return false;
2274
+ return true;
2275
+ }
2276
+ function CompanyContextCustomPlanBillingResponseDataFromJSON(json) {
2277
+ return CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, false);
2278
+ }
2279
+ function CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2280
+ if (json == null) {
2281
+ return json;
2282
+ }
2283
+ return {
2284
+ activationStrategy: CustomPlanActivationStrategyFromJSON(
2285
+ json["activation_strategy"]
2286
+ ),
2287
+ dueAt: new Date(json["due_at"]),
2288
+ invoiceUrl: json["invoice_url"] == null ? void 0 : json["invoice_url"],
2289
+ planId: json["plan_id"],
2290
+ planName: json["plan_name"] == null ? void 0 : json["plan_name"]
2291
+ };
2292
+ }
2293
+ function CompanyContextCustomPlanBillingResponseDataToJSON(json) {
2294
+ return CompanyContextCustomPlanBillingResponseDataToJSONTyped(json, false);
2295
+ }
2296
+ function CompanyContextCustomPlanBillingResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2297
+ if (value == null) {
2298
+ return value;
2299
+ }
2300
+ return {
2301
+ activation_strategy: CustomPlanActivationStrategyToJSON(
2302
+ value["activationStrategy"]
2303
+ ),
2304
+ due_at: value["dueAt"].toISOString(),
2305
+ invoice_url: value["invoiceUrl"],
2306
+ plan_id: value["planId"],
2307
+ plan_name: value["planName"]
2308
+ };
2309
+ }
2310
+ function instanceOfCompanyContextPlanResponseData(value) {
2311
+ if (!("id" in value) || value["id"] === void 0) return false;
2312
+ if (!("includedCreditIds" in value) || value["includedCreditIds"] === void 0)
2313
+ return false;
2314
+ if (!("name" in value) || value["name"] === void 0) return false;
2315
+ return true;
2316
+ }
2317
+ function CompanyContextPlanResponseDataFromJSON(json) {
2318
+ return CompanyContextPlanResponseDataFromJSONTyped(json, false);
2319
+ }
2320
+ function CompanyContextPlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2321
+ if (json == null) {
2322
+ return json;
2323
+ }
2324
+ return {
2325
+ description: json["description"] == null ? void 0 : json["description"],
2326
+ id: json["id"],
2327
+ includedCreditIds: json["included_credit_ids"],
2328
+ name: json["name"],
2329
+ period: json["period"] == null ? void 0 : json["period"],
2330
+ price: json["price"] == null ? void 0 : json["price"]
2331
+ };
2332
+ }
2333
+ function CompanyContextPlanResponseDataToJSON(json) {
2334
+ return CompanyContextPlanResponseDataToJSONTyped(json, false);
2335
+ }
2336
+ function CompanyContextPlanResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2337
+ if (value == null) {
2338
+ return value;
2339
+ }
2340
+ return {
2341
+ description: value["description"],
2342
+ id: value["id"],
2343
+ included_credit_ids: value["includedCreditIds"],
2344
+ name: value["name"],
2345
+ period: value["period"],
2346
+ price: value["price"]
2347
+ };
2348
+ }
2349
+ function instanceOfCompanyContextScheduledDowngradeResponseData(value) {
2350
+ if (!("fromPlanId" in value) || value["fromPlanId"] === void 0)
2351
+ return false;
2352
+ if (!("fromPlanName" in value) || value["fromPlanName"] === void 0)
2353
+ return false;
2354
+ if (!("toPlanId" in value) || value["toPlanId"] === void 0) return false;
2355
+ if (!("toPlanName" in value) || value["toPlanName"] === void 0)
2356
+ return false;
2357
+ return true;
2358
+ }
2359
+ function CompanyContextScheduledDowngradeResponseDataFromJSON(json) {
2360
+ return CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, false);
2361
+ }
2362
+ function CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2363
+ if (json == null) {
2364
+ return json;
2365
+ }
2366
+ return {
2367
+ fromPlanId: json["from_plan_id"],
2368
+ fromPlanName: json["from_plan_name"],
2369
+ toPlanId: json["to_plan_id"],
2370
+ toPlanName: json["to_plan_name"]
2371
+ };
2372
+ }
2373
+ function CompanyContextScheduledDowngradeResponseDataToJSON(json) {
2374
+ return CompanyContextScheduledDowngradeResponseDataToJSONTyped(json, false);
2375
+ }
2376
+ function CompanyContextScheduledDowngradeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2377
+ if (value == null) {
2378
+ return value;
2379
+ }
2380
+ return {
2381
+ from_plan_id: value["fromPlanId"],
2382
+ from_plan_name: value["fromPlanName"],
2383
+ to_plan_id: value["toPlanId"],
2384
+ to_plan_name: value["toPlanName"]
2385
+ };
2386
+ }
2387
+ function instanceOfCompanyContextSubscriptionResponseData(value) {
2388
+ if (!("cancelAtPeriodEnd" in value) || value["cancelAtPeriodEnd"] === void 0)
2389
+ return false;
2390
+ if (!("currency" in value) || value["currency"] === void 0) return false;
2391
+ if (!("status" in value) || value["status"] === void 0) return false;
2392
+ return true;
2393
+ }
2394
+ function CompanyContextSubscriptionResponseDataFromJSON(json) {
2395
+ return CompanyContextSubscriptionResponseDataFromJSONTyped(json, false);
2396
+ }
2397
+ function CompanyContextSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2398
+ if (json == null) {
2399
+ return json;
2400
+ }
2401
+ return {
2402
+ cancelAt: json["cancel_at"] == null ? void 0 : new Date(json["cancel_at"]),
2403
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
2404
+ currency: CurrencyFromJSON2(json["currency"]),
2405
+ nextBillAt: json["next_bill_at"] == null ? void 0 : new Date(json["next_bill_at"]),
2406
+ period: json["period"] == null ? void 0 : json["period"],
2407
+ periodEnd: json["period_end"] == null ? void 0 : new Date(json["period_end"]),
2408
+ status: json["status"],
2409
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
2410
+ };
2411
+ }
2412
+ function CompanyContextSubscriptionResponseDataToJSON(json) {
2413
+ return CompanyContextSubscriptionResponseDataToJSONTyped(json, false);
2414
+ }
2415
+ function CompanyContextSubscriptionResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2416
+ if (value == null) {
2417
+ return value;
2418
+ }
2419
+ return {
2420
+ cancel_at: value["cancelAt"] == null ? void 0 : value["cancelAt"].toISOString(),
2421
+ cancel_at_period_end: value["cancelAtPeriodEnd"],
2422
+ currency: CurrencyToJSON2(value["currency"]),
2423
+ next_bill_at: value["nextBillAt"] == null ? void 0 : value["nextBillAt"].toISOString(),
2424
+ period: value["period"],
2425
+ period_end: value["periodEnd"] == null ? void 0 : value["periodEnd"].toISOString(),
2426
+ status: value["status"],
2427
+ trial_end: value["trialEnd"] == null ? void 0 : value["trialEnd"].toISOString()
2428
+ };
2429
+ }
2430
+ function instanceOfCompanyContextResponseData(value) {
2431
+ if (!("addOns" in value) || value["addOns"] === void 0) return false;
2432
+ if (!("id" in value) || value["id"] === void 0) return false;
2433
+ if (!("name" in value) || value["name"] === void 0) return false;
2434
+ return true;
2435
+ }
2436
+ function CompanyContextResponseDataFromJSON(json) {
2437
+ return CompanyContextResponseDataFromJSONTyped(json, false);
2438
+ }
2439
+ function CompanyContextResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2440
+ if (json == null) {
2441
+ return json;
2442
+ }
2443
+ return {
2444
+ addOns: json["add_ons"].map(
2445
+ CompanyContextPlanResponseDataFromJSON
2446
+ ),
2447
+ customPlanBilling: json["custom_plan_billing"] == null ? void 0 : CompanyContextCustomPlanBillingResponseDataFromJSON(
2448
+ json["custom_plan_billing"]
2449
+ ),
2450
+ id: json["id"],
2451
+ name: json["name"],
2452
+ plan: json["plan"] == null ? void 0 : CompanyContextPlanResponseDataFromJSON(json["plan"]),
2453
+ scheduledDowngrade: json["scheduled_downgrade"] == null ? void 0 : CompanyContextScheduledDowngradeResponseDataFromJSON(
2454
+ json["scheduled_downgrade"]
2455
+ ),
2456
+ subscription: json["subscription"] == null ? void 0 : CompanyContextSubscriptionResponseDataFromJSON(json["subscription"])
2457
+ };
2458
+ }
2459
+ function CompanyContextResponseDataToJSON(json) {
2460
+ return CompanyContextResponseDataToJSONTyped(json, false);
2461
+ }
2462
+ function CompanyContextResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2463
+ if (value == null) {
2464
+ return value;
2465
+ }
2466
+ return {
2467
+ add_ons: value["addOns"].map(
2468
+ CompanyContextPlanResponseDataToJSON
2469
+ ),
2470
+ custom_plan_billing: CompanyContextCustomPlanBillingResponseDataToJSON(
2471
+ value["customPlanBilling"]
2472
+ ),
2473
+ id: value["id"],
2474
+ name: value["name"],
2475
+ plan: CompanyContextPlanResponseDataToJSON(value["plan"]),
2476
+ scheduled_downgrade: CompanyContextScheduledDowngradeResponseDataToJSON(
2477
+ value["scheduledDowngrade"]
2478
+ ),
2479
+ subscription: CompanyContextSubscriptionResponseDataToJSON(
2480
+ value["subscription"]
2481
+ )
2482
+ };
2483
+ }
2484
+ function instanceOfCompanyCreditAutoTopupResponseData(value) {
2485
+ if (!("enabled" in value) || value["enabled"] === void 0) return false;
2486
+ if (!("selfService" in value) || value["selfService"] === void 0)
2487
+ return false;
2488
+ return true;
2489
+ }
2490
+ function CompanyCreditAutoTopupResponseDataFromJSON(json) {
2491
+ return CompanyCreditAutoTopupResponseDataFromJSONTyped(json, false);
2492
+ }
2493
+ function CompanyCreditAutoTopupResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2494
+ if (json == null) {
2495
+ return json;
2496
+ }
2497
+ return {
2498
+ amount: json["amount"] == null ? void 0 : json["amount"],
2499
+ enabled: json["enabled"],
2500
+ selfService: json["self_service"],
2501
+ thresholdCredits: json["threshold_credits"] == null ? void 0 : json["threshold_credits"]
2502
+ };
2503
+ }
2504
+ function CompanyCreditAutoTopupResponseDataToJSON(json) {
2505
+ return CompanyCreditAutoTopupResponseDataToJSONTyped(json, false);
2506
+ }
2507
+ function CompanyCreditAutoTopupResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2508
+ if (value == null) {
2509
+ return value;
2510
+ }
2511
+ return {
2512
+ amount: value["amount"],
2513
+ enabled: value["enabled"],
2514
+ self_service: value["selfService"],
2515
+ threshold_credits: value["thresholdCredits"]
2516
+ };
2517
+ }
1979
2518
  function instanceOfCompanyCreditGrantResponseData(value) {
1980
2519
  if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
1981
2520
  if (!("grantReason" in value) || value["grantReason"] === void 0)
@@ -2113,6 +2652,7 @@ function CompanyCreditBalanceResponseDataFromJSONTyped(json, ignoreDiscriminator
2113
2652
  return json;
2114
2653
  }
2115
2654
  return {
2655
+ autoTopup: json["auto_topup"] == null ? void 0 : CompanyCreditAutoTopupResponseDataFromJSON(json["auto_topup"]),
2116
2656
  composition: json["composition"] == null ? void 0 : CompanyCreditCompositionResponseDataFromJSON(json["composition"]),
2117
2657
  creditDescription: json["credit_description"],
2118
2658
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
@@ -2139,6 +2679,7 @@ function CompanyCreditBalanceResponseDataToJSONTyped(value, ignoreDiscriminator
2139
2679
  return value;
2140
2680
  }
2141
2681
  return {
2682
+ auto_topup: CompanyCreditAutoTopupResponseDataToJSON(value["autoTopup"]),
2142
2683
  composition: CompanyCreditCompositionResponseDataToJSON(
2143
2684
  value["composition"]
2144
2685
  ),
@@ -2284,7 +2825,7 @@ function CompanyDiscountResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2284
2825
  return {
2285
2826
  amountOff: json["amount_off"] == null ? void 0 : json["amount_off"],
2286
2827
  couponName: json["coupon_name"],
2287
- currency: json["currency"] == null ? void 0 : json["currency"],
2828
+ currency: json["currency"] == null ? void 0 : CurrencyFromJSON2(json["currency"]),
2288
2829
  customerFacingCode: json["customer_facing_code"] == null ? void 0 : json["customer_facing_code"],
2289
2830
  duration: json["duration"],
2290
2831
  durationInMonths: json["duration_in_months"] == null ? void 0 : json["duration_in_months"],
@@ -2301,7 +2842,7 @@ function CompanyDiscountResponseDataToJSONTyped(value, ignoreDiscriminator = fal
2301
2842
  return {
2302
2843
  amount_off: value["amountOff"],
2303
2844
  coupon_name: value["couponName"],
2304
- currency: value["currency"],
2845
+ currency: CurrencyToJSON2(value["currency"]),
2305
2846
  customer_facing_code: value["customerFacingCode"],
2306
2847
  duration: value["duration"],
2307
2848
  duration_in_months: value["durationInMonths"],
@@ -2742,7 +3283,7 @@ function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2742
3283
  return {
2743
3284
  amountDue: json["amount_due"],
2744
3285
  createdAt: new Date(json["created_at"]),
2745
- currency: json["currency"],
3286
+ currency: CurrencyFromJSON2(json["currency"]),
2746
3287
  dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
2747
3288
  id: json["id"],
2748
3289
  status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
@@ -2759,7 +3300,7 @@ function CompanyInvoiceResponseDataToJSONTyped(value, ignoreDiscriminator = fals
2759
3300
  return {
2760
3301
  amount_due: value["amountDue"],
2761
3302
  created_at: value["createdAt"].toISOString(),
2762
- currency: value["currency"],
3303
+ currency: CurrencyToJSON2(value["currency"]),
2763
3304
  due_date: value["dueDate"] == null ? void 0 : value["dueDate"].toISOString(),
2764
3305
  id: value["id"],
2765
3306
  status: InvoiceStatusToJSON(value["status"]),
@@ -2910,7 +3451,7 @@ function CompanyUpcomingInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminat
2910
3451
  }
2911
3452
  return {
2912
3453
  amountDue: json["amount_due"],
2913
- currency: json["currency"],
3454
+ currency: CurrencyFromJSON2(json["currency"]),
2914
3455
  customerBalanceApplied: json["customer_balance_applied"],
2915
3456
  customerBalanceRemaining: json["customer_balance_remaining"],
2916
3457
  discounts: json["discounts"].map(
@@ -2929,7 +3470,7 @@ function CompanyUpcomingInvoiceResponseDataToJSONTyped(value, ignoreDiscriminato
2929
3470
  }
2930
3471
  return {
2931
3472
  amount_due: value["amountDue"],
2932
- currency: value["currency"],
3473
+ currency: CurrencyToJSON2(value["currency"]),
2933
3474
  customer_balance_applied: value["customerBalanceApplied"],
2934
3475
  customer_balance_remaining: value["customerBalanceRemaining"],
2935
3476
  discounts: value["discounts"].map(
@@ -3001,31 +3542,6 @@ function CreateSetupIntentResponseToJSONTyped(value, ignoreDiscriminator = false
3001
3542
  params: value["params"]
3002
3543
  };
3003
3544
  }
3004
- function instanceOfDeleteResponse(value) {
3005
- return true;
3006
- }
3007
- function DeleteResponseFromJSON(json) {
3008
- return DeleteResponseFromJSONTyped(json, false);
3009
- }
3010
- function DeleteResponseFromJSONTyped(json, ignoreDiscriminator) {
3011
- if (json == null) {
3012
- return json;
3013
- }
3014
- return {
3015
- deleted: json["deleted"] == null ? void 0 : json["deleted"]
3016
- };
3017
- }
3018
- function DeleteResponseToJSON(json) {
3019
- return DeleteResponseToJSONTyped(json, false);
3020
- }
3021
- function DeleteResponseToJSONTyped(value, ignoreDiscriminator = false) {
3022
- if (value == null) {
3023
- return value;
3024
- }
3025
- return {
3026
- deleted: value["deleted"]
3027
- };
3028
- }
3029
3545
  function instanceOfDeletePaymentMethodResponse(value) {
3030
3546
  if (!("data" in value) || value["data"] === void 0) return false;
3031
3547
  if (!("params" in value) || value["params"] === void 0) return false;
@@ -3312,6 +3828,35 @@ function GetCompanyPaymentMethodsResponseToJSONTyped(value, ignoreDiscriminator
3312
3828
  params: value["params"]
3313
3829
  };
3314
3830
  }
3831
+ function instanceOfGetCompanyResponse(value) {
3832
+ if (!("data" in value) || value["data"] === void 0) return false;
3833
+ if (!("params" in value) || value["params"] === void 0) return false;
3834
+ return true;
3835
+ }
3836
+ function GetCompanyResponseFromJSON(json) {
3837
+ return GetCompanyResponseFromJSONTyped(json, false);
3838
+ }
3839
+ function GetCompanyResponseFromJSONTyped(json, ignoreDiscriminator) {
3840
+ if (json == null) {
3841
+ return json;
3842
+ }
3843
+ return {
3844
+ data: CompanyContextResponseDataFromJSON(json["data"]),
3845
+ params: json["params"]
3846
+ };
3847
+ }
3848
+ function GetCompanyResponseToJSON(json) {
3849
+ return GetCompanyResponseToJSONTyped(json, false);
3850
+ }
3851
+ function GetCompanyResponseToJSONTyped(value, ignoreDiscriminator = false) {
3852
+ if (value == null) {
3853
+ return value;
3854
+ }
3855
+ return {
3856
+ data: CompanyContextResponseDataToJSON(value["data"]),
3857
+ params: value["params"]
3858
+ };
3859
+ }
3315
3860
  function instanceOfGetCompanyUpcomingInvoiceResponse(value) {
3316
3861
  if (!("data" in value) || value["data"] === void 0) return false;
3317
3862
  if (!("params" in value) || value["params"] === void 0) return false;
@@ -3826,6 +4371,9 @@ var SchematicBillingClient = class {
3826
4371
  method: "DELETE"
3827
4372
  }).then(() => void 0);
3828
4373
  }
4374
+ cancelSubscription() {
4375
+ return this.session.request("/checkout/unsubscribe", { method: "DELETE" }).then(() => void 0);
4376
+ }
3829
4377
  fetchFeatureUsage() {
3830
4378
  const path = "/company/usage";
3831
4379
  return this.session.request(path).then((body) => {
@@ -3839,6 +4387,15 @@ var SchematicBillingClient = class {
3839
4387
  return GetCompanyFeatureUsageResponseFromJSON(body).data.features;
3840
4388
  });
3841
4389
  }
4390
+ fetchCompany() {
4391
+ const path = "/company";
4392
+ return this.session.request(path).then((body) => {
4393
+ if (body === null || typeof body !== "object" || !("data" in body) || body.data == null) {
4394
+ throw new Error(`Malformed response from ${path}`);
4395
+ }
4396
+ return GetCompanyResponseFromJSON(body).data;
4397
+ });
4398
+ }
3842
4399
  fetchCreditBalances() {
3843
4400
  const path = "/company/credits";
3844
4401
  return this.session.request(path).then((body) => {
@@ -6163,6 +6720,9 @@ var BillingStore = class {
6163
6720
  () => this._client.fetchCreditBalances(),
6164
6721
  { readiness }
6165
6722
  );
6723
+ this.company = new KeyedResource(() => this._client.fetchCompany(), {
6724
+ readiness
6725
+ });
6166
6726
  this.creditUserUsage = new KeyedResource(
6167
6727
  ({ creditId }) => this._client.fetchCreditUserUsage({
6168
6728
  creditId,
@@ -6193,7 +6753,10 @@ var BillingStore = class {
6193
6753
  if (initialData.creditBalances !== void 0) {
6194
6754
  held.creditBalances = initialData.creditBalances;
6195
6755
  }
6196
- if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0) {
6756
+ if (initialData.company !== void 0) {
6757
+ held.company = initialData.company;
6758
+ }
6759
+ 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) {
6197
6760
  this._held = held;
6198
6761
  this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
6199
6762
  }
@@ -6204,6 +6767,7 @@ var BillingStore = class {
6204
6767
  paymentMethods;
6205
6768
  featureUsage;
6206
6769
  creditBalances;
6770
+ company;
6207
6771
  creditUserUsage;
6208
6772
  featureUserUsage;
6209
6773
  _pageSize;
@@ -6290,6 +6854,9 @@ var BillingStore = class {
6290
6854
  if (held.creditBalances !== void 0) {
6291
6855
  this.creditBalances.seed(SINGLETON, held.creditBalances);
6292
6856
  }
6857
+ if (held.company !== void 0) {
6858
+ this.company.seed(SINGLETON, held.company);
6859
+ }
6293
6860
  this._seedKey = held.key;
6294
6861
  this._seeded = true;
6295
6862
  }
@@ -6374,6 +6941,19 @@ var BillingStore = class {
6374
6941
  await this._client.deletePaymentMethod(id);
6375
6942
  await this._reloadPaymentMethods();
6376
6943
  }
6944
+ /**
6945
+ * Cancels the subscription at period end, then reloads what that changes:
6946
+ * the company, its next bill and its credits' renewals. Rejects as
6947
+ * `setDefaultPaymentMethod` does.
6948
+ */
6949
+ async unsubscribe() {
6950
+ await this._client.cancelSubscription();
6951
+ await Promise.all([
6952
+ this._reload(this.company),
6953
+ this._reload(this.creditBalances),
6954
+ this._reload(this.upcomingInvoice)
6955
+ ]);
6956
+ }
6377
6957
  /**
6378
6958
  * Mints a setup intent for adding a payment method. Nothing in the store
6379
6959
  * changes until the provider confirms it and the host reloads the list,
@@ -6385,16 +6965,19 @@ var BillingStore = class {
6385
6965
  dispose() {
6386
6966
  this._unsubscribe?.();
6387
6967
  }
6968
+ _reloadPaymentMethods() {
6969
+ return this._reload(this.paymentMethods);
6970
+ }
6388
6971
  /**
6389
- * After a write. A list nobody has read is left alone: it loads fresh
6972
+ * After a write. A resource nobody has read is left alone: it loads fresh
6390
6973
  * when someone does. One that is loaded, or subscribed and waiting on a
6391
6974
  * failed load, is fetched again; `refetch` never rejects.
6392
6975
  */
6393
- async _reloadPaymentMethods() {
6394
- if (!this.paymentMethods.has(SINGLETON)) {
6976
+ async _reload(keyed) {
6977
+ if (!keyed.has(SINGLETON)) {
6395
6978
  return;
6396
6979
  }
6397
- const resource = this.paymentMethods.get(SINGLETON);
6980
+ const resource = keyed.get(SINGLETON);
6398
6981
  if (resource.snapshot.data !== void 0 || resource.subscriberCount > 0) {
6399
6982
  await resource.refetch();
6400
6983
  }
@@ -6441,7 +7024,8 @@ var RESOURCE_NAMES = [
6441
7024
  "upcomingInvoice",
6442
7025
  "paymentMethods",
6443
7026
  "featureUsage",
6444
- "creditBalances"
7027
+ "creditBalances",
7028
+ "company"
6445
7029
  ];
6446
7030
 
6447
7031
  // src/billing/context.tsx
@@ -6495,7 +7079,8 @@ var BILLING_ACTION_UNAVAILABLE_MESSAGE = (name) => `Schematic billing action ${n
6495
7079
  var ACTION_NAMES = [
6496
7080
  "setDefaultPaymentMethod",
6497
7081
  "removePaymentMethod",
6498
- "createSetupIntent"
7082
+ "createSetupIntent",
7083
+ "unsubscribe"
6499
7084
  ];
6500
7085
  function rejectingActions(reason, given = {}) {
6501
7086
  const actions = {};
@@ -6740,6 +7325,9 @@ function useFeatureUserUsage(featureId) {
6740
7325
  );
6741
7326
  return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
6742
7327
  }
7328
+ function useCompany() {
7329
+ return useBillingResource("company", SINGLETON);
7330
+ }
6743
7331
  function useCreditBalances() {
6744
7332
  return useBillingResource("creditBalances", SINGLETON);
6745
7333
  }
@@ -6758,6 +7346,29 @@ function useCreditUserUsage(creditId) {
6758
7346
  function useInvalidateBillingData() {
6759
7347
  return useBillingDataSource().invalidateAll;
6760
7348
  }
7349
+ function useUnsubscribe() {
7350
+ const source = useBillingDataSource();
7351
+ const [mutation, setMutation] = useState(IDLE);
7352
+ const unsubscribe = useCallback(async () => {
7353
+ setMutation((m) => ({ inflight: m.inflight + 1, error: void 0 }));
7354
+ try {
7355
+ await actionsOf(source).unsubscribe();
7356
+ } catch (cause) {
7357
+ const error = cause instanceof Error ? cause : new Error(String(cause));
7358
+ setMutation((m) => ({ inflight: m.inflight - 1, error }));
7359
+ throw error;
7360
+ }
7361
+ setMutation((m) => ({ inflight: m.inflight - 1, error: void 0 }));
7362
+ }, [source]);
7363
+ return useMemo3(
7364
+ () => ({
7365
+ unsubscribe,
7366
+ isMutating: mutation.inflight > 0,
7367
+ mutationError: mutation.error
7368
+ }),
7369
+ [mutation, unsubscribe]
7370
+ );
7371
+ }
6761
7372
 
6762
7373
  // src/billing/provider.tsx
6763
7374
  import { useEffect, useMemo as useMemo4, useRef as useRef2 } from "react";
@@ -6839,7 +7450,8 @@ function BillingProvider({
6839
7450
  actions: {
6840
7451
  setDefaultPaymentMethod: (externalId) => store.setDefaultPaymentMethod(externalId),
6841
7452
  removePaymentMethod: (id) => store.removePaymentMethod(id),
6842
- createSetupIntent: () => store.createSetupIntent()
7453
+ createSetupIntent: () => store.createSetupIntent(),
7454
+ unsubscribe: () => store.unsubscribe()
6843
7455
  }
6844
7456
  };
6845
7457
  }, [store]);
@@ -6906,7 +7518,7 @@ function staticSource(data) {
6906
7518
  }
6907
7519
 
6908
7520
  // src/version.ts
6909
- var version2 = "1.12.0";
7521
+ var version2 = "1.14.0";
6910
7522
 
6911
7523
  // src/context/schematic.tsx
6912
7524
  import { jsx as jsx4 } from "react/jsx-runtime";
@@ -7169,6 +7781,7 @@ export {
7169
7781
  UsagePeriod,
7170
7782
  normalizeInvoiceQuery2 as normalizeInvoiceQuery,
7171
7783
  useBillingDataSource,
7784
+ useCompany,
7172
7785
  useCreditBalances,
7173
7786
  useCreditUserUsage,
7174
7787
  useFeatureUsage,
@@ -7190,6 +7803,7 @@ export {
7190
7803
  useSchematicStrings,
7191
7804
  useSchematicTranslate,
7192
7805
  useSetupIntent,
7806
+ useUnsubscribe,
7193
7807
  useUpcomingInvoice
7194
7808
  };
7195
7809
  /*! Bundled license information: