@schematichq/schematic-react 1.12.0 → 1.13.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,
@@ -71,7 +72,7 @@ __export(index_exports, {
71
72
  });
72
73
  module.exports = __toCommonJS(index_exports);
73
74
 
74
- // node_modules/.pnpm/@schematichq+schematic-js@1.12.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
75
+ // node_modules/.pnpm/@schematichq+schematic-js@1.13.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
75
76
  var __create2 = Object.create;
76
77
  var __defProp2 = Object.defineProperty;
77
78
  var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
@@ -1399,7 +1400,7 @@ var ContextSignatureManager = class {
1399
1400
  }
1400
1401
  }
1401
1402
  };
1402
- var version = "1.12.0";
1403
+ var version = "1.13.0";
1403
1404
  var SINGLETON = {};
1404
1405
  var models_exports = {};
1405
1406
  __export2(models_exports, {
@@ -1449,6 +1450,30 @@ __export2(models_exports, {
1449
1450
  CatalogPriceTierResponseDataFromJSONTyped: () => CatalogPriceTierResponseDataFromJSONTyped,
1450
1451
  CatalogPriceTierResponseDataToJSON: () => CatalogPriceTierResponseDataToJSON,
1451
1452
  CatalogPriceTierResponseDataToJSONTyped: () => CatalogPriceTierResponseDataToJSONTyped,
1453
+ CompanyContextCustomPlanBillingResponseDataFromJSON: () => CompanyContextCustomPlanBillingResponseDataFromJSON,
1454
+ CompanyContextCustomPlanBillingResponseDataFromJSONTyped: () => CompanyContextCustomPlanBillingResponseDataFromJSONTyped,
1455
+ CompanyContextCustomPlanBillingResponseDataToJSON: () => CompanyContextCustomPlanBillingResponseDataToJSON,
1456
+ CompanyContextCustomPlanBillingResponseDataToJSONTyped: () => CompanyContextCustomPlanBillingResponseDataToJSONTyped,
1457
+ CompanyContextPlanResponseDataFromJSON: () => CompanyContextPlanResponseDataFromJSON,
1458
+ CompanyContextPlanResponseDataFromJSONTyped: () => CompanyContextPlanResponseDataFromJSONTyped,
1459
+ CompanyContextPlanResponseDataToJSON: () => CompanyContextPlanResponseDataToJSON,
1460
+ CompanyContextPlanResponseDataToJSONTyped: () => CompanyContextPlanResponseDataToJSONTyped,
1461
+ CompanyContextResponseDataFromJSON: () => CompanyContextResponseDataFromJSON,
1462
+ CompanyContextResponseDataFromJSONTyped: () => CompanyContextResponseDataFromJSONTyped,
1463
+ CompanyContextResponseDataToJSON: () => CompanyContextResponseDataToJSON,
1464
+ CompanyContextResponseDataToJSONTyped: () => CompanyContextResponseDataToJSONTyped,
1465
+ CompanyContextScheduledDowngradeResponseDataFromJSON: () => CompanyContextScheduledDowngradeResponseDataFromJSON,
1466
+ CompanyContextScheduledDowngradeResponseDataFromJSONTyped: () => CompanyContextScheduledDowngradeResponseDataFromJSONTyped,
1467
+ CompanyContextScheduledDowngradeResponseDataToJSON: () => CompanyContextScheduledDowngradeResponseDataToJSON,
1468
+ CompanyContextScheduledDowngradeResponseDataToJSONTyped: () => CompanyContextScheduledDowngradeResponseDataToJSONTyped,
1469
+ CompanyContextSubscriptionResponseDataFromJSON: () => CompanyContextSubscriptionResponseDataFromJSON,
1470
+ CompanyContextSubscriptionResponseDataFromJSONTyped: () => CompanyContextSubscriptionResponseDataFromJSONTyped,
1471
+ CompanyContextSubscriptionResponseDataToJSON: () => CompanyContextSubscriptionResponseDataToJSON,
1472
+ CompanyContextSubscriptionResponseDataToJSONTyped: () => CompanyContextSubscriptionResponseDataToJSONTyped,
1473
+ CompanyCreditAutoTopupResponseDataFromJSON: () => CompanyCreditAutoTopupResponseDataFromJSON,
1474
+ CompanyCreditAutoTopupResponseDataFromJSONTyped: () => CompanyCreditAutoTopupResponseDataFromJSONTyped,
1475
+ CompanyCreditAutoTopupResponseDataToJSON: () => CompanyCreditAutoTopupResponseDataToJSON,
1476
+ CompanyCreditAutoTopupResponseDataToJSONTyped: () => CompanyCreditAutoTopupResponseDataToJSONTyped,
1452
1477
  CompanyCreditBalanceResponseDataFromJSON: () => CompanyCreditBalanceResponseDataFromJSON,
1453
1478
  CompanyCreditBalanceResponseDataFromJSONTyped: () => CompanyCreditBalanceResponseDataFromJSONTyped,
1454
1479
  CompanyCreditBalanceResponseDataToJSON: () => CompanyCreditBalanceResponseDataToJSON,
@@ -1517,6 +1542,16 @@ __export2(models_exports, {
1517
1542
  CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
1518
1543
  CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
1519
1544
  CreateSetupIntentResponseToJSONTyped: () => CreateSetupIntentResponseToJSONTyped,
1545
+ Currency: () => Currency,
1546
+ CurrencyFromJSON: () => CurrencyFromJSON2,
1547
+ CurrencyFromJSONTyped: () => CurrencyFromJSONTyped8,
1548
+ CurrencyToJSON: () => CurrencyToJSON2,
1549
+ CurrencyToJSONTyped: () => CurrencyToJSONTyped8,
1550
+ CustomPlanActivationStrategy: () => CustomPlanActivationStrategy,
1551
+ CustomPlanActivationStrategyFromJSON: () => CustomPlanActivationStrategyFromJSON,
1552
+ CustomPlanActivationStrategyFromJSONTyped: () => CustomPlanActivationStrategyFromJSONTyped,
1553
+ CustomPlanActivationStrategyToJSON: () => CustomPlanActivationStrategyToJSON,
1554
+ CustomPlanActivationStrategyToJSONTyped: () => CustomPlanActivationStrategyToJSONTyped,
1520
1555
  DeletePaymentMethodResponseFromJSON: () => DeletePaymentMethodResponseFromJSON,
1521
1556
  DeletePaymentMethodResponseFromJSONTyped: () => DeletePaymentMethodResponseFromJSONTyped,
1522
1557
  DeletePaymentMethodResponseToJSON: () => DeletePaymentMethodResponseToJSON,
@@ -1581,6 +1616,10 @@ __export2(models_exports, {
1581
1616
  GetCompanyPaymentMethodsResponseFromJSONTyped: () => GetCompanyPaymentMethodsResponseFromJSONTyped,
1582
1617
  GetCompanyPaymentMethodsResponseToJSON: () => GetCompanyPaymentMethodsResponseToJSON,
1583
1618
  GetCompanyPaymentMethodsResponseToJSONTyped: () => GetCompanyPaymentMethodsResponseToJSONTyped,
1619
+ GetCompanyResponseFromJSON: () => GetCompanyResponseFromJSON,
1620
+ GetCompanyResponseFromJSONTyped: () => GetCompanyResponseFromJSONTyped,
1621
+ GetCompanyResponseToJSON: () => GetCompanyResponseToJSON,
1622
+ GetCompanyResponseToJSONTyped: () => GetCompanyResponseToJSONTyped,
1584
1623
  GetCompanyUpcomingInvoiceResponseFromJSON: () => GetCompanyUpcomingInvoiceResponseFromJSON,
1585
1624
  GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
1586
1625
  GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
@@ -1631,6 +1670,12 @@ __export2(models_exports, {
1631
1670
  instanceOfCatalogCreditGrantResponseData: () => instanceOfCatalogCreditGrantResponseData,
1632
1671
  instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
1633
1672
  instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
1673
+ instanceOfCompanyContextCustomPlanBillingResponseData: () => instanceOfCompanyContextCustomPlanBillingResponseData,
1674
+ instanceOfCompanyContextPlanResponseData: () => instanceOfCompanyContextPlanResponseData,
1675
+ instanceOfCompanyContextResponseData: () => instanceOfCompanyContextResponseData,
1676
+ instanceOfCompanyContextScheduledDowngradeResponseData: () => instanceOfCompanyContextScheduledDowngradeResponseData,
1677
+ instanceOfCompanyContextSubscriptionResponseData: () => instanceOfCompanyContextSubscriptionResponseData,
1678
+ instanceOfCompanyCreditAutoTopupResponseData: () => instanceOfCompanyCreditAutoTopupResponseData,
1634
1679
  instanceOfCompanyCreditBalanceResponseData: () => instanceOfCompanyCreditBalanceResponseData,
1635
1680
  instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
1636
1681
  instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
@@ -1648,6 +1693,8 @@ __export2(models_exports, {
1648
1693
  instanceOfCompanyUpcomingInvoiceResponseData: () => instanceOfCompanyUpcomingInvoiceResponseData,
1649
1694
  instanceOfCompanyUserUsageResponseData: () => instanceOfCompanyUserUsageResponseData,
1650
1695
  instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
1696
+ instanceOfCurrency: () => instanceOfCurrency,
1697
+ instanceOfCustomPlanActivationStrategy: () => instanceOfCustomPlanActivationStrategy,
1651
1698
  instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
1652
1699
  instanceOfDeleteResponse: () => instanceOfDeleteResponse,
1653
1700
  instanceOfEntitlementPriceBehavior: () => instanceOfEntitlementPriceBehavior,
@@ -1663,6 +1710,7 @@ __export2(models_exports, {
1663
1710
  instanceOfGetCompanyInvoicesParams: () => instanceOfGetCompanyInvoicesParams,
1664
1711
  instanceOfGetCompanyInvoicesResponse: () => instanceOfGetCompanyInvoicesResponse,
1665
1712
  instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
1713
+ instanceOfGetCompanyResponse: () => instanceOfGetCompanyResponse,
1666
1714
  instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
1667
1715
  instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
1668
1716
  instanceOfMetricPeriod: () => instanceOfMetricPeriod,
@@ -1989,6 +2037,164 @@ function CatalogPriceTierResponseDataToJSONTyped(value, ignoreDiscriminator = fa
1989
2037
  to: value["to"]
1990
2038
  };
1991
2039
  }
2040
+ var Currency = {
2041
+ Aed: "aed",
2042
+ Afn: "afn",
2043
+ All: "all",
2044
+ Amd: "amd",
2045
+ Ang: "ang",
2046
+ Aoa: "aoa",
2047
+ Ars: "ars",
2048
+ Aud: "aud",
2049
+ Awg: "awg",
2050
+ Azn: "azn",
2051
+ Bam: "bam",
2052
+ Bbd: "bbd",
2053
+ Bdt: "bdt",
2054
+ Bif: "bif",
2055
+ Bmd: "bmd",
2056
+ Bnd: "bnd",
2057
+ Bob: "bob",
2058
+ Brl: "brl",
2059
+ Bsd: "bsd",
2060
+ Bwp: "bwp",
2061
+ Byn: "byn",
2062
+ Bzd: "bzd",
2063
+ Cad: "cad",
2064
+ Cdf: "cdf",
2065
+ Chf: "chf",
2066
+ Clp: "clp",
2067
+ Cny: "cny",
2068
+ Cop: "cop",
2069
+ Crc: "crc",
2070
+ Cve: "cve",
2071
+ Czk: "czk",
2072
+ Djf: "djf",
2073
+ Dkk: "dkk",
2074
+ Dop: "dop",
2075
+ Dzd: "dzd",
2076
+ Egp: "egp",
2077
+ Etb: "etb",
2078
+ Eur: "eur",
2079
+ Fjd: "fjd",
2080
+ Fkp: "fkp",
2081
+ Gbp: "gbp",
2082
+ Gel: "gel",
2083
+ Gip: "gip",
2084
+ Gmd: "gmd",
2085
+ Gnf: "gnf",
2086
+ Gtq: "gtq",
2087
+ Gyd: "gyd",
2088
+ Hkd: "hkd",
2089
+ Hnl: "hnl",
2090
+ Htg: "htg",
2091
+ Huf: "huf",
2092
+ Idr: "idr",
2093
+ Ils: "ils",
2094
+ Inr: "inr",
2095
+ Isk: "isk",
2096
+ Jmd: "jmd",
2097
+ Jpy: "jpy",
2098
+ Kes: "kes",
2099
+ Kgs: "kgs",
2100
+ Khr: "khr",
2101
+ Kmf: "kmf",
2102
+ Krw: "krw",
2103
+ Kyd: "kyd",
2104
+ Kzt: "kzt",
2105
+ Lak: "lak",
2106
+ Lbp: "lbp",
2107
+ Lkr: "lkr",
2108
+ Lrd: "lrd",
2109
+ Lsl: "lsl",
2110
+ Mad: "mad",
2111
+ Mdl: "mdl",
2112
+ Mga: "mga",
2113
+ Mkd: "mkd",
2114
+ Mmk: "mmk",
2115
+ Mnt: "mnt",
2116
+ Mop: "mop",
2117
+ Mur: "mur",
2118
+ Mvr: "mvr",
2119
+ Mwk: "mwk",
2120
+ Mxn: "mxn",
2121
+ Myr: "myr",
2122
+ Mzn: "mzn",
2123
+ Nad: "nad",
2124
+ Ngn: "ngn",
2125
+ Nio: "nio",
2126
+ Nok: "nok",
2127
+ Npr: "npr",
2128
+ Nzd: "nzd",
2129
+ Pab: "pab",
2130
+ Pen: "pen",
2131
+ Pgk: "pgk",
2132
+ Php: "php",
2133
+ Pkr: "pkr",
2134
+ Pln: "pln",
2135
+ Pyg: "pyg",
2136
+ Qar: "qar",
2137
+ Ron: "ron",
2138
+ Rsd: "rsd",
2139
+ Rub: "rub",
2140
+ Rwf: "rwf",
2141
+ Sar: "sar",
2142
+ Sbd: "sbd",
2143
+ Scr: "scr",
2144
+ Sek: "sek",
2145
+ Sgd: "sgd",
2146
+ Shp: "shp",
2147
+ Sle: "sle",
2148
+ Sos: "sos",
2149
+ Srd: "srd",
2150
+ Std: "std",
2151
+ Szl: "szl",
2152
+ Thb: "thb",
2153
+ Tjs: "tjs",
2154
+ Top: "top",
2155
+ Try: "try",
2156
+ Ttd: "ttd",
2157
+ Twd: "twd",
2158
+ Tzs: "tzs",
2159
+ Uah: "uah",
2160
+ Ugx: "ugx",
2161
+ Usd: "usd",
2162
+ Uyu: "uyu",
2163
+ Uzs: "uzs",
2164
+ Vnd: "vnd",
2165
+ Vuv: "vuv",
2166
+ Wst: "wst",
2167
+ Xaf: "xaf",
2168
+ Xcd: "xcd",
2169
+ Xcg: "xcg",
2170
+ Xof: "xof",
2171
+ Xpf: "xpf",
2172
+ Yer: "yer",
2173
+ Zar: "zar",
2174
+ Zmw: "zmw"
2175
+ };
2176
+ function instanceOfCurrency(value) {
2177
+ for (const key in Currency) {
2178
+ if (Object.prototype.hasOwnProperty.call(Currency, key)) {
2179
+ if (Currency[key] === value) {
2180
+ return true;
2181
+ }
2182
+ }
2183
+ }
2184
+ return false;
2185
+ }
2186
+ function CurrencyFromJSON2(json) {
2187
+ return CurrencyFromJSONTyped8(json, false);
2188
+ }
2189
+ function CurrencyFromJSONTyped8(json, ignoreDiscriminator) {
2190
+ return json;
2191
+ }
2192
+ function CurrencyToJSON2(value) {
2193
+ return value;
2194
+ }
2195
+ function CurrencyToJSONTyped8(value, ignoreDiscriminator) {
2196
+ return value;
2197
+ }
1992
2198
  function instanceOfCatalogPriceResponseData(value) {
1993
2199
  if (!("currency" in value) || value["currency"] === void 0) return false;
1994
2200
  if (!("id" in value) || value["id"] === void 0) return false;
@@ -2011,7 +2217,7 @@ function CatalogPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2011
2217
  return json;
2012
2218
  }
2013
2219
  return {
2014
- currency: json["currency"],
2220
+ currency: CurrencyFromJSON2(json["currency"]),
2015
2221
  id: json["id"],
2016
2222
  interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
2017
2223
  intervalCount: json["interval_count"],
@@ -2034,7 +2240,7 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
2034
2240
  return value;
2035
2241
  }
2036
2242
  return {
2037
- currency: value["currency"],
2243
+ currency: CurrencyToJSON2(value["currency"]),
2038
2244
  id: value["id"],
2039
2245
  interval: BillingProductPriceIntervalToJSON2(value["interval"]),
2040
2246
  interval_count: value["intervalCount"],
@@ -2049,6 +2255,281 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
2049
2255
  tiers_mode: BillingTiersModeToJSON2(value["tiersMode"])
2050
2256
  };
2051
2257
  }
2258
+ var CustomPlanActivationStrategy = {
2259
+ Payment: "on_payment",
2260
+ Publish: "on_publish"
2261
+ };
2262
+ function instanceOfCustomPlanActivationStrategy(value) {
2263
+ for (const key in CustomPlanActivationStrategy) {
2264
+ if (Object.prototype.hasOwnProperty.call(CustomPlanActivationStrategy, key)) {
2265
+ if (CustomPlanActivationStrategy[key] === value) {
2266
+ return true;
2267
+ }
2268
+ }
2269
+ }
2270
+ return false;
2271
+ }
2272
+ function CustomPlanActivationStrategyFromJSON(json) {
2273
+ return CustomPlanActivationStrategyFromJSONTyped(json, false);
2274
+ }
2275
+ function CustomPlanActivationStrategyFromJSONTyped(json, ignoreDiscriminator) {
2276
+ return json;
2277
+ }
2278
+ function CustomPlanActivationStrategyToJSON(value) {
2279
+ return value;
2280
+ }
2281
+ function CustomPlanActivationStrategyToJSONTyped(value, ignoreDiscriminator) {
2282
+ return value;
2283
+ }
2284
+ function instanceOfCompanyContextCustomPlanBillingResponseData(value) {
2285
+ if (!("activationStrategy" in value) || value["activationStrategy"] === void 0)
2286
+ return false;
2287
+ if (!("dueAt" in value) || value["dueAt"] === void 0) return false;
2288
+ if (!("planId" in value) || value["planId"] === void 0) return false;
2289
+ return true;
2290
+ }
2291
+ function CompanyContextCustomPlanBillingResponseDataFromJSON(json) {
2292
+ return CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, false);
2293
+ }
2294
+ function CompanyContextCustomPlanBillingResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2295
+ if (json == null) {
2296
+ return json;
2297
+ }
2298
+ return {
2299
+ activationStrategy: CustomPlanActivationStrategyFromJSON(
2300
+ json["activation_strategy"]
2301
+ ),
2302
+ dueAt: new Date(json["due_at"]),
2303
+ invoiceUrl: json["invoice_url"] == null ? void 0 : json["invoice_url"],
2304
+ planId: json["plan_id"],
2305
+ planName: json["plan_name"] == null ? void 0 : json["plan_name"]
2306
+ };
2307
+ }
2308
+ function CompanyContextCustomPlanBillingResponseDataToJSON(json) {
2309
+ return CompanyContextCustomPlanBillingResponseDataToJSONTyped(json, false);
2310
+ }
2311
+ function CompanyContextCustomPlanBillingResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2312
+ if (value == null) {
2313
+ return value;
2314
+ }
2315
+ return {
2316
+ activation_strategy: CustomPlanActivationStrategyToJSON(
2317
+ value["activationStrategy"]
2318
+ ),
2319
+ due_at: value["dueAt"].toISOString(),
2320
+ invoice_url: value["invoiceUrl"],
2321
+ plan_id: value["planId"],
2322
+ plan_name: value["planName"]
2323
+ };
2324
+ }
2325
+ function instanceOfCompanyContextPlanResponseData(value) {
2326
+ if (!("id" in value) || value["id"] === void 0) return false;
2327
+ if (!("includedCreditIds" in value) || value["includedCreditIds"] === void 0)
2328
+ return false;
2329
+ if (!("name" in value) || value["name"] === void 0) return false;
2330
+ return true;
2331
+ }
2332
+ function CompanyContextPlanResponseDataFromJSON(json) {
2333
+ return CompanyContextPlanResponseDataFromJSONTyped(json, false);
2334
+ }
2335
+ function CompanyContextPlanResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2336
+ if (json == null) {
2337
+ return json;
2338
+ }
2339
+ return {
2340
+ description: json["description"] == null ? void 0 : json["description"],
2341
+ id: json["id"],
2342
+ includedCreditIds: json["included_credit_ids"],
2343
+ name: json["name"],
2344
+ period: json["period"] == null ? void 0 : json["period"],
2345
+ price: json["price"] == null ? void 0 : json["price"]
2346
+ };
2347
+ }
2348
+ function CompanyContextPlanResponseDataToJSON(json) {
2349
+ return CompanyContextPlanResponseDataToJSONTyped(json, false);
2350
+ }
2351
+ function CompanyContextPlanResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2352
+ if (value == null) {
2353
+ return value;
2354
+ }
2355
+ return {
2356
+ description: value["description"],
2357
+ id: value["id"],
2358
+ included_credit_ids: value["includedCreditIds"],
2359
+ name: value["name"],
2360
+ period: value["period"],
2361
+ price: value["price"]
2362
+ };
2363
+ }
2364
+ function instanceOfCompanyContextScheduledDowngradeResponseData(value) {
2365
+ if (!("fromPlanId" in value) || value["fromPlanId"] === void 0)
2366
+ return false;
2367
+ if (!("fromPlanName" in value) || value["fromPlanName"] === void 0)
2368
+ return false;
2369
+ if (!("toPlanId" in value) || value["toPlanId"] === void 0) return false;
2370
+ if (!("toPlanName" in value) || value["toPlanName"] === void 0)
2371
+ return false;
2372
+ return true;
2373
+ }
2374
+ function CompanyContextScheduledDowngradeResponseDataFromJSON(json) {
2375
+ return CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, false);
2376
+ }
2377
+ function CompanyContextScheduledDowngradeResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2378
+ if (json == null) {
2379
+ return json;
2380
+ }
2381
+ return {
2382
+ fromPlanId: json["from_plan_id"],
2383
+ fromPlanName: json["from_plan_name"],
2384
+ toPlanId: json["to_plan_id"],
2385
+ toPlanName: json["to_plan_name"]
2386
+ };
2387
+ }
2388
+ function CompanyContextScheduledDowngradeResponseDataToJSON(json) {
2389
+ return CompanyContextScheduledDowngradeResponseDataToJSONTyped(json, false);
2390
+ }
2391
+ function CompanyContextScheduledDowngradeResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2392
+ if (value == null) {
2393
+ return value;
2394
+ }
2395
+ return {
2396
+ from_plan_id: value["fromPlanId"],
2397
+ from_plan_name: value["fromPlanName"],
2398
+ to_plan_id: value["toPlanId"],
2399
+ to_plan_name: value["toPlanName"]
2400
+ };
2401
+ }
2402
+ function instanceOfCompanyContextSubscriptionResponseData(value) {
2403
+ if (!("cancelAtPeriodEnd" in value) || value["cancelAtPeriodEnd"] === void 0)
2404
+ return false;
2405
+ if (!("currency" in value) || value["currency"] === void 0) return false;
2406
+ if (!("status" in value) || value["status"] === void 0) return false;
2407
+ return true;
2408
+ }
2409
+ function CompanyContextSubscriptionResponseDataFromJSON(json) {
2410
+ return CompanyContextSubscriptionResponseDataFromJSONTyped(json, false);
2411
+ }
2412
+ function CompanyContextSubscriptionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2413
+ if (json == null) {
2414
+ return json;
2415
+ }
2416
+ return {
2417
+ cancelAt: json["cancel_at"] == null ? void 0 : new Date(json["cancel_at"]),
2418
+ cancelAtPeriodEnd: json["cancel_at_period_end"],
2419
+ currency: CurrencyFromJSON2(json["currency"]),
2420
+ nextBillAt: json["next_bill_at"] == null ? void 0 : new Date(json["next_bill_at"]),
2421
+ period: json["period"] == null ? void 0 : json["period"],
2422
+ periodEnd: json["period_end"] == null ? void 0 : new Date(json["period_end"]),
2423
+ status: json["status"],
2424
+ trialEnd: json["trial_end"] == null ? void 0 : new Date(json["trial_end"])
2425
+ };
2426
+ }
2427
+ function CompanyContextSubscriptionResponseDataToJSON(json) {
2428
+ return CompanyContextSubscriptionResponseDataToJSONTyped(json, false);
2429
+ }
2430
+ function CompanyContextSubscriptionResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2431
+ if (value == null) {
2432
+ return value;
2433
+ }
2434
+ return {
2435
+ cancel_at: value["cancelAt"] == null ? void 0 : value["cancelAt"].toISOString(),
2436
+ cancel_at_period_end: value["cancelAtPeriodEnd"],
2437
+ currency: CurrencyToJSON2(value["currency"]),
2438
+ next_bill_at: value["nextBillAt"] == null ? void 0 : value["nextBillAt"].toISOString(),
2439
+ period: value["period"],
2440
+ period_end: value["periodEnd"] == null ? void 0 : value["periodEnd"].toISOString(),
2441
+ status: value["status"],
2442
+ trial_end: value["trialEnd"] == null ? void 0 : value["trialEnd"].toISOString()
2443
+ };
2444
+ }
2445
+ function instanceOfCompanyContextResponseData(value) {
2446
+ if (!("addOns" in value) || value["addOns"] === void 0) return false;
2447
+ if (!("id" in value) || value["id"] === void 0) return false;
2448
+ if (!("name" in value) || value["name"] === void 0) return false;
2449
+ return true;
2450
+ }
2451
+ function CompanyContextResponseDataFromJSON(json) {
2452
+ return CompanyContextResponseDataFromJSONTyped(json, false);
2453
+ }
2454
+ function CompanyContextResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2455
+ if (json == null) {
2456
+ return json;
2457
+ }
2458
+ return {
2459
+ addOns: json["add_ons"].map(
2460
+ CompanyContextPlanResponseDataFromJSON
2461
+ ),
2462
+ customPlanBilling: json["custom_plan_billing"] == null ? void 0 : CompanyContextCustomPlanBillingResponseDataFromJSON(
2463
+ json["custom_plan_billing"]
2464
+ ),
2465
+ id: json["id"],
2466
+ name: json["name"],
2467
+ plan: json["plan"] == null ? void 0 : CompanyContextPlanResponseDataFromJSON(json["plan"]),
2468
+ scheduledDowngrade: json["scheduled_downgrade"] == null ? void 0 : CompanyContextScheduledDowngradeResponseDataFromJSON(
2469
+ json["scheduled_downgrade"]
2470
+ ),
2471
+ subscription: json["subscription"] == null ? void 0 : CompanyContextSubscriptionResponseDataFromJSON(json["subscription"])
2472
+ };
2473
+ }
2474
+ function CompanyContextResponseDataToJSON(json) {
2475
+ return CompanyContextResponseDataToJSONTyped(json, false);
2476
+ }
2477
+ function CompanyContextResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2478
+ if (value == null) {
2479
+ return value;
2480
+ }
2481
+ return {
2482
+ add_ons: value["addOns"].map(
2483
+ CompanyContextPlanResponseDataToJSON
2484
+ ),
2485
+ custom_plan_billing: CompanyContextCustomPlanBillingResponseDataToJSON(
2486
+ value["customPlanBilling"]
2487
+ ),
2488
+ id: value["id"],
2489
+ name: value["name"],
2490
+ plan: CompanyContextPlanResponseDataToJSON(value["plan"]),
2491
+ scheduled_downgrade: CompanyContextScheduledDowngradeResponseDataToJSON(
2492
+ value["scheduledDowngrade"]
2493
+ ),
2494
+ subscription: CompanyContextSubscriptionResponseDataToJSON(
2495
+ value["subscription"]
2496
+ )
2497
+ };
2498
+ }
2499
+ function instanceOfCompanyCreditAutoTopupResponseData(value) {
2500
+ if (!("enabled" in value) || value["enabled"] === void 0) return false;
2501
+ if (!("selfService" in value) || value["selfService"] === void 0)
2502
+ return false;
2503
+ return true;
2504
+ }
2505
+ function CompanyCreditAutoTopupResponseDataFromJSON(json) {
2506
+ return CompanyCreditAutoTopupResponseDataFromJSONTyped(json, false);
2507
+ }
2508
+ function CompanyCreditAutoTopupResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2509
+ if (json == null) {
2510
+ return json;
2511
+ }
2512
+ return {
2513
+ amount: json["amount"] == null ? void 0 : json["amount"],
2514
+ enabled: json["enabled"],
2515
+ selfService: json["self_service"],
2516
+ thresholdCredits: json["threshold_credits"] == null ? void 0 : json["threshold_credits"]
2517
+ };
2518
+ }
2519
+ function CompanyCreditAutoTopupResponseDataToJSON(json) {
2520
+ return CompanyCreditAutoTopupResponseDataToJSONTyped(json, false);
2521
+ }
2522
+ function CompanyCreditAutoTopupResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
2523
+ if (value == null) {
2524
+ return value;
2525
+ }
2526
+ return {
2527
+ amount: value["amount"],
2528
+ enabled: value["enabled"],
2529
+ self_service: value["selfService"],
2530
+ threshold_credits: value["thresholdCredits"]
2531
+ };
2532
+ }
2052
2533
  function instanceOfCompanyCreditGrantResponseData(value) {
2053
2534
  if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
2054
2535
  if (!("grantReason" in value) || value["grantReason"] === void 0)
@@ -2186,6 +2667,7 @@ function CompanyCreditBalanceResponseDataFromJSONTyped(json, ignoreDiscriminator
2186
2667
  return json;
2187
2668
  }
2188
2669
  return {
2670
+ autoTopup: json["auto_topup"] == null ? void 0 : CompanyCreditAutoTopupResponseDataFromJSON(json["auto_topup"]),
2189
2671
  composition: json["composition"] == null ? void 0 : CompanyCreditCompositionResponseDataFromJSON(json["composition"]),
2190
2672
  creditDescription: json["credit_description"],
2191
2673
  creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
@@ -2212,6 +2694,7 @@ function CompanyCreditBalanceResponseDataToJSONTyped(value, ignoreDiscriminator
2212
2694
  return value;
2213
2695
  }
2214
2696
  return {
2697
+ auto_topup: CompanyCreditAutoTopupResponseDataToJSON(value["autoTopup"]),
2215
2698
  composition: CompanyCreditCompositionResponseDataToJSON(
2216
2699
  value["composition"]
2217
2700
  ),
@@ -2357,7 +2840,7 @@ function CompanyDiscountResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2357
2840
  return {
2358
2841
  amountOff: json["amount_off"] == null ? void 0 : json["amount_off"],
2359
2842
  couponName: json["coupon_name"],
2360
- currency: json["currency"] == null ? void 0 : json["currency"],
2843
+ currency: json["currency"] == null ? void 0 : CurrencyFromJSON2(json["currency"]),
2361
2844
  customerFacingCode: json["customer_facing_code"] == null ? void 0 : json["customer_facing_code"],
2362
2845
  duration: json["duration"],
2363
2846
  durationInMonths: json["duration_in_months"] == null ? void 0 : json["duration_in_months"],
@@ -2374,7 +2857,7 @@ function CompanyDiscountResponseDataToJSONTyped(value, ignoreDiscriminator = fal
2374
2857
  return {
2375
2858
  amount_off: value["amountOff"],
2376
2859
  coupon_name: value["couponName"],
2377
- currency: value["currency"],
2860
+ currency: CurrencyToJSON2(value["currency"]),
2378
2861
  customer_facing_code: value["customerFacingCode"],
2379
2862
  duration: value["duration"],
2380
2863
  duration_in_months: value["durationInMonths"],
@@ -2815,7 +3298,7 @@ function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
2815
3298
  return {
2816
3299
  amountDue: json["amount_due"],
2817
3300
  createdAt: new Date(json["created_at"]),
2818
- currency: json["currency"],
3301
+ currency: CurrencyFromJSON2(json["currency"]),
2819
3302
  dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
2820
3303
  id: json["id"],
2821
3304
  status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
@@ -2832,7 +3315,7 @@ function CompanyInvoiceResponseDataToJSONTyped(value, ignoreDiscriminator = fals
2832
3315
  return {
2833
3316
  amount_due: value["amountDue"],
2834
3317
  created_at: value["createdAt"].toISOString(),
2835
- currency: value["currency"],
3318
+ currency: CurrencyToJSON2(value["currency"]),
2836
3319
  due_date: value["dueDate"] == null ? void 0 : value["dueDate"].toISOString(),
2837
3320
  id: value["id"],
2838
3321
  status: InvoiceStatusToJSON(value["status"]),
@@ -2983,7 +3466,7 @@ function CompanyUpcomingInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminat
2983
3466
  }
2984
3467
  return {
2985
3468
  amountDue: json["amount_due"],
2986
- currency: json["currency"],
3469
+ currency: CurrencyFromJSON2(json["currency"]),
2987
3470
  customerBalanceApplied: json["customer_balance_applied"],
2988
3471
  customerBalanceRemaining: json["customer_balance_remaining"],
2989
3472
  discounts: json["discounts"].map(
@@ -3002,7 +3485,7 @@ function CompanyUpcomingInvoiceResponseDataToJSONTyped(value, ignoreDiscriminato
3002
3485
  }
3003
3486
  return {
3004
3487
  amount_due: value["amountDue"],
3005
- currency: value["currency"],
3488
+ currency: CurrencyToJSON2(value["currency"]),
3006
3489
  customer_balance_applied: value["customerBalanceApplied"],
3007
3490
  customer_balance_remaining: value["customerBalanceRemaining"],
3008
3491
  discounts: value["discounts"].map(
@@ -3385,6 +3868,35 @@ function GetCompanyPaymentMethodsResponseToJSONTyped(value, ignoreDiscriminator
3385
3868
  params: value["params"]
3386
3869
  };
3387
3870
  }
3871
+ function instanceOfGetCompanyResponse(value) {
3872
+ if (!("data" in value) || value["data"] === void 0) return false;
3873
+ if (!("params" in value) || value["params"] === void 0) return false;
3874
+ return true;
3875
+ }
3876
+ function GetCompanyResponseFromJSON(json) {
3877
+ return GetCompanyResponseFromJSONTyped(json, false);
3878
+ }
3879
+ function GetCompanyResponseFromJSONTyped(json, ignoreDiscriminator) {
3880
+ if (json == null) {
3881
+ return json;
3882
+ }
3883
+ return {
3884
+ data: CompanyContextResponseDataFromJSON(json["data"]),
3885
+ params: json["params"]
3886
+ };
3887
+ }
3888
+ function GetCompanyResponseToJSON(json) {
3889
+ return GetCompanyResponseToJSONTyped(json, false);
3890
+ }
3891
+ function GetCompanyResponseToJSONTyped(value, ignoreDiscriminator = false) {
3892
+ if (value == null) {
3893
+ return value;
3894
+ }
3895
+ return {
3896
+ data: CompanyContextResponseDataToJSON(value["data"]),
3897
+ params: value["params"]
3898
+ };
3899
+ }
3388
3900
  function instanceOfGetCompanyUpcomingInvoiceResponse(value) {
3389
3901
  if (!("data" in value) || value["data"] === void 0) return false;
3390
3902
  if (!("params" in value) || value["params"] === void 0) return false;
@@ -3912,6 +4424,15 @@ var SchematicBillingClient = class {
3912
4424
  return GetCompanyFeatureUsageResponseFromJSON(body).data.features;
3913
4425
  });
3914
4426
  }
4427
+ fetchCompany() {
4428
+ const path = "/company";
4429
+ return this.session.request(path).then((body) => {
4430
+ if (body === null || typeof body !== "object" || !("data" in body) || body.data == null) {
4431
+ throw new Error(`Malformed response from ${path}`);
4432
+ }
4433
+ return GetCompanyResponseFromJSON(body).data;
4434
+ });
4435
+ }
3915
4436
  fetchCreditBalances() {
3916
4437
  const path = "/company/credits";
3917
4438
  return this.session.request(path).then((body) => {
@@ -6236,6 +6757,9 @@ var BillingStore = class {
6236
6757
  () => this._client.fetchCreditBalances(),
6237
6758
  { readiness }
6238
6759
  );
6760
+ this.company = new KeyedResource(() => this._client.fetchCompany(), {
6761
+ readiness
6762
+ });
6239
6763
  this.creditUserUsage = new KeyedResource(
6240
6764
  ({ creditId }) => this._client.fetchCreditUserUsage({
6241
6765
  creditId,
@@ -6266,7 +6790,10 @@ var BillingStore = class {
6266
6790
  if (initialData.creditBalances !== void 0) {
6267
6791
  held.creditBalances = initialData.creditBalances;
6268
6792
  }
6269
- if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0) {
6793
+ if (initialData.company !== void 0) {
6794
+ held.company = initialData.company;
6795
+ }
6796
+ 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
6797
  this._held = held;
6271
6798
  this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
6272
6799
  }
@@ -6277,6 +6804,7 @@ var BillingStore = class {
6277
6804
  paymentMethods;
6278
6805
  featureUsage;
6279
6806
  creditBalances;
6807
+ company;
6280
6808
  creditUserUsage;
6281
6809
  featureUserUsage;
6282
6810
  _pageSize;
@@ -6363,6 +6891,9 @@ var BillingStore = class {
6363
6891
  if (held.creditBalances !== void 0) {
6364
6892
  this.creditBalances.seed(SINGLETON, held.creditBalances);
6365
6893
  }
6894
+ if (held.company !== void 0) {
6895
+ this.company.seed(SINGLETON, held.company);
6896
+ }
6366
6897
  this._seedKey = held.key;
6367
6898
  this._seeded = true;
6368
6899
  }
@@ -6514,7 +7045,8 @@ var RESOURCE_NAMES = [
6514
7045
  "upcomingInvoice",
6515
7046
  "paymentMethods",
6516
7047
  "featureUsage",
6517
- "creditBalances"
7048
+ "creditBalances",
7049
+ "company"
6518
7050
  ];
6519
7051
 
6520
7052
  // src/billing/context.tsx
@@ -6807,6 +7339,9 @@ function useFeatureUserUsage(featureId) {
6807
7339
  );
6808
7340
  return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
6809
7341
  }
7342
+ function useCompany() {
7343
+ return useBillingResource("company", SINGLETON);
7344
+ }
6810
7345
  function useCreditBalances() {
6811
7346
  return useBillingResource("creditBalances", SINGLETON);
6812
7347
  }
@@ -6973,7 +7508,7 @@ function staticSource(data) {
6973
7508
  }
6974
7509
 
6975
7510
  // src/version.ts
6976
- var version2 = "1.12.0";
7511
+ var version2 = "1.13.0";
6977
7512
 
6978
7513
  // src/context/schematic.tsx
6979
7514
  var import_jsx_runtime4 = require("react/jsx-runtime");