@schematichq/schematic-react 1.18.1 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/schematic-react.cjs.js +568 -5
- package/dist/schematic-react.d.ts +416 -5
- package/dist/schematic-react.esm.js +568 -5
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
1
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.19.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;
|
|
@@ -1329,7 +1329,7 @@ var ContextSignatureManager = class {
|
|
|
1329
1329
|
}
|
|
1330
1330
|
}
|
|
1331
1331
|
};
|
|
1332
|
-
var version = "1.
|
|
1332
|
+
var version = "1.19.0";
|
|
1333
1333
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1334
1334
|
function normalizeCatalogQuery(query) {
|
|
1335
1335
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1365,6 +1365,11 @@ __export(models_exports, {
|
|
|
1365
1365
|
BillingCreditGrantReasonFromJSONTyped: () => BillingCreditGrantReasonFromJSONTyped,
|
|
1366
1366
|
BillingCreditGrantReasonToJSON: () => BillingCreditGrantReasonToJSON,
|
|
1367
1367
|
BillingCreditGrantReasonToJSONTyped: () => BillingCreditGrantReasonToJSONTyped,
|
|
1368
|
+
BillingCreditGrantZeroedOutReason: () => BillingCreditGrantZeroedOutReason,
|
|
1369
|
+
BillingCreditGrantZeroedOutReasonFromJSON: () => BillingCreditGrantZeroedOutReasonFromJSON,
|
|
1370
|
+
BillingCreditGrantZeroedOutReasonFromJSONTyped: () => BillingCreditGrantZeroedOutReasonFromJSONTyped,
|
|
1371
|
+
BillingCreditGrantZeroedOutReasonToJSON: () => BillingCreditGrantZeroedOutReasonToJSON,
|
|
1372
|
+
BillingCreditGrantZeroedOutReasonToJSONTyped: () => BillingCreditGrantZeroedOutReasonToJSONTyped,
|
|
1368
1373
|
BillingPlanCreditGrantResetCadence: () => BillingPlanCreditGrantResetCadence,
|
|
1369
1374
|
BillingPlanCreditGrantResetCadenceFromJSON: () => BillingPlanCreditGrantResetCadenceFromJSON2,
|
|
1370
1375
|
BillingPlanCreditGrantResetCadenceFromJSONTyped: () => BillingPlanCreditGrantResetCadenceFromJSONTyped4,
|
|
@@ -1588,6 +1593,30 @@ __export(models_exports, {
|
|
|
1588
1593
|
CompanyCreditGrantResponseDataFromJSONTyped: () => CompanyCreditGrantResponseDataFromJSONTyped,
|
|
1589
1594
|
CompanyCreditGrantResponseDataToJSON: () => CompanyCreditGrantResponseDataToJSON,
|
|
1590
1595
|
CompanyCreditGrantResponseDataToJSONTyped: () => CompanyCreditGrantResponseDataToJSONTyped,
|
|
1596
|
+
CompanyCreditLedgerBundleResponseDataFromJSON: () => CompanyCreditLedgerBundleResponseDataFromJSON,
|
|
1597
|
+
CompanyCreditLedgerBundleResponseDataFromJSONTyped: () => CompanyCreditLedgerBundleResponseDataFromJSONTyped,
|
|
1598
|
+
CompanyCreditLedgerBundleResponseDataToJSON: () => CompanyCreditLedgerBundleResponseDataToJSON,
|
|
1599
|
+
CompanyCreditLedgerBundleResponseDataToJSONTyped: () => CompanyCreditLedgerBundleResponseDataToJSONTyped,
|
|
1600
|
+
CompanyCreditLedgerCreditResponseDataFromJSON: () => CompanyCreditLedgerCreditResponseDataFromJSON,
|
|
1601
|
+
CompanyCreditLedgerCreditResponseDataFromJSONTyped: () => CompanyCreditLedgerCreditResponseDataFromJSONTyped,
|
|
1602
|
+
CompanyCreditLedgerCreditResponseDataToJSON: () => CompanyCreditLedgerCreditResponseDataToJSON,
|
|
1603
|
+
CompanyCreditLedgerCreditResponseDataToJSONTyped: () => CompanyCreditLedgerCreditResponseDataToJSONTyped,
|
|
1604
|
+
CompanyCreditLedgerEntryResponseDataFromJSON: () => CompanyCreditLedgerEntryResponseDataFromJSON,
|
|
1605
|
+
CompanyCreditLedgerEntryResponseDataFromJSONTyped: () => CompanyCreditLedgerEntryResponseDataFromJSONTyped,
|
|
1606
|
+
CompanyCreditLedgerEntryResponseDataToJSON: () => CompanyCreditLedgerEntryResponseDataToJSON,
|
|
1607
|
+
CompanyCreditLedgerEntryResponseDataToJSONTyped: () => CompanyCreditLedgerEntryResponseDataToJSONTyped,
|
|
1608
|
+
CompanyCreditLedgerFeatureResponseDataFromJSON: () => CompanyCreditLedgerFeatureResponseDataFromJSON,
|
|
1609
|
+
CompanyCreditLedgerFeatureResponseDataFromJSONTyped: () => CompanyCreditLedgerFeatureResponseDataFromJSONTyped,
|
|
1610
|
+
CompanyCreditLedgerFeatureResponseDataToJSON: () => CompanyCreditLedgerFeatureResponseDataToJSON,
|
|
1611
|
+
CompanyCreditLedgerFeatureResponseDataToJSONTyped: () => CompanyCreditLedgerFeatureResponseDataToJSONTyped,
|
|
1612
|
+
CompanyCreditLedgerResponseDataFromJSON: () => CompanyCreditLedgerResponseDataFromJSON,
|
|
1613
|
+
CompanyCreditLedgerResponseDataFromJSONTyped: () => CompanyCreditLedgerResponseDataFromJSONTyped,
|
|
1614
|
+
CompanyCreditLedgerResponseDataToJSON: () => CompanyCreditLedgerResponseDataToJSON,
|
|
1615
|
+
CompanyCreditLedgerResponseDataToJSONTyped: () => CompanyCreditLedgerResponseDataToJSONTyped,
|
|
1616
|
+
CompanyCreditLedgerUserResponseDataFromJSON: () => CompanyCreditLedgerUserResponseDataFromJSON,
|
|
1617
|
+
CompanyCreditLedgerUserResponseDataFromJSONTyped: () => CompanyCreditLedgerUserResponseDataFromJSONTyped,
|
|
1618
|
+
CompanyCreditLedgerUserResponseDataToJSON: () => CompanyCreditLedgerUserResponseDataToJSON,
|
|
1619
|
+
CompanyCreditLedgerUserResponseDataToJSONTyped: () => CompanyCreditLedgerUserResponseDataToJSONTyped,
|
|
1591
1620
|
CompanyCreditUserUsageResponseDataFromJSON: () => CompanyCreditUserUsageResponseDataFromJSON,
|
|
1592
1621
|
CompanyCreditUserUsageResponseDataFromJSONTyped: () => CompanyCreditUserUsageResponseDataFromJSONTyped,
|
|
1593
1622
|
CompanyCreditUserUsageResponseDataToJSON: () => CompanyCreditUserUsageResponseDataToJSON,
|
|
@@ -1657,6 +1686,16 @@ __export(models_exports, {
|
|
|
1657
1686
|
CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
|
|
1658
1687
|
CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
|
|
1659
1688
|
CreateSetupIntentResponseToJSONTyped: () => CreateSetupIntentResponseToJSONTyped,
|
|
1689
|
+
CreditLedgerEntryKind: () => CreditLedgerEntryKind,
|
|
1690
|
+
CreditLedgerEntryKindFromJSON: () => CreditLedgerEntryKindFromJSON,
|
|
1691
|
+
CreditLedgerEntryKindFromJSONTyped: () => CreditLedgerEntryKindFromJSONTyped,
|
|
1692
|
+
CreditLedgerEntryKindToJSON: () => CreditLedgerEntryKindToJSON,
|
|
1693
|
+
CreditLedgerEntryKindToJSONTyped: () => CreditLedgerEntryKindToJSONTyped,
|
|
1694
|
+
CreditUsageReason: () => CreditUsageReason,
|
|
1695
|
+
CreditUsageReasonFromJSON: () => CreditUsageReasonFromJSON,
|
|
1696
|
+
CreditUsageReasonFromJSONTyped: () => CreditUsageReasonFromJSONTyped,
|
|
1697
|
+
CreditUsageReasonToJSON: () => CreditUsageReasonToJSON,
|
|
1698
|
+
CreditUsageReasonToJSONTyped: () => CreditUsageReasonToJSONTyped,
|
|
1660
1699
|
Currency: () => Currency,
|
|
1661
1700
|
CurrencyFromJSON: () => CurrencyFromJSON2,
|
|
1662
1701
|
CurrencyFromJSONTyped: () => CurrencyFromJSONTyped13,
|
|
@@ -1723,6 +1762,14 @@ __export(models_exports, {
|
|
|
1723
1762
|
GetCompanyCreditBalancesResponseFromJSONTyped: () => GetCompanyCreditBalancesResponseFromJSONTyped,
|
|
1724
1763
|
GetCompanyCreditBalancesResponseToJSON: () => GetCompanyCreditBalancesResponseToJSON,
|
|
1725
1764
|
GetCompanyCreditBalancesResponseToJSONTyped: () => GetCompanyCreditBalancesResponseToJSONTyped,
|
|
1765
|
+
GetCompanyCreditLedgerParamsFromJSON: () => GetCompanyCreditLedgerParamsFromJSON,
|
|
1766
|
+
GetCompanyCreditLedgerParamsFromJSONTyped: () => GetCompanyCreditLedgerParamsFromJSONTyped,
|
|
1767
|
+
GetCompanyCreditLedgerParamsToJSON: () => GetCompanyCreditLedgerParamsToJSON,
|
|
1768
|
+
GetCompanyCreditLedgerParamsToJSONTyped: () => GetCompanyCreditLedgerParamsToJSONTyped,
|
|
1769
|
+
GetCompanyCreditLedgerResponseFromJSON: () => GetCompanyCreditLedgerResponseFromJSON,
|
|
1770
|
+
GetCompanyCreditLedgerResponseFromJSONTyped: () => GetCompanyCreditLedgerResponseFromJSONTyped,
|
|
1771
|
+
GetCompanyCreditLedgerResponseToJSON: () => GetCompanyCreditLedgerResponseToJSON,
|
|
1772
|
+
GetCompanyCreditLedgerResponseToJSONTyped: () => GetCompanyCreditLedgerResponseToJSONTyped,
|
|
1726
1773
|
GetCompanyCreditUserUsageParamsFromJSON: () => GetCompanyCreditUserUsageParamsFromJSON,
|
|
1727
1774
|
GetCompanyCreditUserUsageParamsFromJSONTyped: () => GetCompanyCreditUserUsageParamsFromJSONTyped,
|
|
1728
1775
|
GetCompanyCreditUserUsageParamsToJSON: () => GetCompanyCreditUserUsageParamsToJSON,
|
|
@@ -1898,6 +1945,7 @@ __export(models_exports, {
|
|
|
1898
1945
|
instanceOfBillingCreditExpiryType: () => instanceOfBillingCreditExpiryType,
|
|
1899
1946
|
instanceOfBillingCreditExpiryUnit: () => instanceOfBillingCreditExpiryUnit,
|
|
1900
1947
|
instanceOfBillingCreditGrantReason: () => instanceOfBillingCreditGrantReason,
|
|
1948
|
+
instanceOfBillingCreditGrantZeroedOutReason: () => instanceOfBillingCreditGrantZeroedOutReason,
|
|
1901
1949
|
instanceOfBillingPlanCreditGrantResetCadence: () => instanceOfBillingPlanCreditGrantResetCadence,
|
|
1902
1950
|
instanceOfBillingPriceScheme: () => instanceOfBillingPriceScheme,
|
|
1903
1951
|
instanceOfBillingProductPriceInterval: () => instanceOfBillingProductPriceInterval,
|
|
@@ -1950,6 +1998,12 @@ __export(models_exports, {
|
|
|
1950
1998
|
instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
|
|
1951
1999
|
instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
|
|
1952
2000
|
instanceOfCompanyCreditGrantResponseData: () => instanceOfCompanyCreditGrantResponseData,
|
|
2001
|
+
instanceOfCompanyCreditLedgerBundleResponseData: () => instanceOfCompanyCreditLedgerBundleResponseData,
|
|
2002
|
+
instanceOfCompanyCreditLedgerCreditResponseData: () => instanceOfCompanyCreditLedgerCreditResponseData,
|
|
2003
|
+
instanceOfCompanyCreditLedgerEntryResponseData: () => instanceOfCompanyCreditLedgerEntryResponseData,
|
|
2004
|
+
instanceOfCompanyCreditLedgerFeatureResponseData: () => instanceOfCompanyCreditLedgerFeatureResponseData,
|
|
2005
|
+
instanceOfCompanyCreditLedgerResponseData: () => instanceOfCompanyCreditLedgerResponseData,
|
|
2006
|
+
instanceOfCompanyCreditLedgerUserResponseData: () => instanceOfCompanyCreditLedgerUserResponseData,
|
|
1953
2007
|
instanceOfCompanyCreditUserUsageResponseData: () => instanceOfCompanyCreditUserUsageResponseData,
|
|
1954
2008
|
instanceOfCompanyCreditUserUsageRowResponseData: () => instanceOfCompanyCreditUserUsageRowResponseData,
|
|
1955
2009
|
instanceOfCompanyDiscountResponseData: () => instanceOfCompanyDiscountResponseData,
|
|
@@ -1967,6 +2021,8 @@ __export(models_exports, {
|
|
|
1967
2021
|
instanceOfCreateCheckoutRequest: () => instanceOfCreateCheckoutRequest,
|
|
1968
2022
|
instanceOfCreateCheckoutResponse: () => instanceOfCreateCheckoutResponse,
|
|
1969
2023
|
instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
|
|
2024
|
+
instanceOfCreditLedgerEntryKind: () => instanceOfCreditLedgerEntryKind,
|
|
2025
|
+
instanceOfCreditUsageReason: () => instanceOfCreditUsageReason,
|
|
1970
2026
|
instanceOfCurrency: () => instanceOfCurrency,
|
|
1971
2027
|
instanceOfCustomPlanActivationStrategy: () => instanceOfCustomPlanActivationStrategy,
|
|
1972
2028
|
instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
|
|
@@ -1982,6 +2038,8 @@ __export(models_exports, {
|
|
|
1982
2038
|
instanceOfGetCheckoutResponse: () => instanceOfGetCheckoutResponse,
|
|
1983
2039
|
instanceOfGetCheckoutTaxIDResponse: () => instanceOfGetCheckoutTaxIDResponse,
|
|
1984
2040
|
instanceOfGetCompanyCreditBalancesResponse: () => instanceOfGetCompanyCreditBalancesResponse,
|
|
2041
|
+
instanceOfGetCompanyCreditLedgerParams: () => instanceOfGetCompanyCreditLedgerParams,
|
|
2042
|
+
instanceOfGetCompanyCreditLedgerResponse: () => instanceOfGetCompanyCreditLedgerResponse,
|
|
1985
2043
|
instanceOfGetCompanyCreditUserUsageParams: () => instanceOfGetCompanyCreditUserUsageParams,
|
|
1986
2044
|
instanceOfGetCompanyCreditUserUsageResponse: () => instanceOfGetCompanyCreditUserUsageResponse,
|
|
1987
2045
|
instanceOfGetCompanyFeatureUsageResponse: () => instanceOfGetCompanyFeatureUsageResponse,
|
|
@@ -2192,6 +2250,41 @@ function BillingCreditGrantReasonToJSON(value) {
|
|
|
2192
2250
|
function BillingCreditGrantReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
2193
2251
|
return value;
|
|
2194
2252
|
}
|
|
2253
|
+
var BillingCreditGrantZeroedOutReason = {
|
|
2254
|
+
CustomerArchived: "customer_archived",
|
|
2255
|
+
Expired: "expired",
|
|
2256
|
+
IntegrationUninstalled: "integration_uninstalled",
|
|
2257
|
+
LicenseRetired: "license_retired",
|
|
2258
|
+
Manual: "manual",
|
|
2259
|
+
PlanChange: "plan_change",
|
|
2260
|
+
PlanPeriodReset: "plan_period_reset",
|
|
2261
|
+
Reconciled: "reconciled"
|
|
2262
|
+
};
|
|
2263
|
+
function instanceOfBillingCreditGrantZeroedOutReason(value) {
|
|
2264
|
+
for (const key in BillingCreditGrantZeroedOutReason) {
|
|
2265
|
+
if (Object.prototype.hasOwnProperty.call(
|
|
2266
|
+
BillingCreditGrantZeroedOutReason,
|
|
2267
|
+
key
|
|
2268
|
+
)) {
|
|
2269
|
+
if (BillingCreditGrantZeroedOutReason[key] === value) {
|
|
2270
|
+
return true;
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
return false;
|
|
2275
|
+
}
|
|
2276
|
+
function BillingCreditGrantZeroedOutReasonFromJSON(json) {
|
|
2277
|
+
return BillingCreditGrantZeroedOutReasonFromJSONTyped(json, false);
|
|
2278
|
+
}
|
|
2279
|
+
function BillingCreditGrantZeroedOutReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
2280
|
+
return json;
|
|
2281
|
+
}
|
|
2282
|
+
function BillingCreditGrantZeroedOutReasonToJSON(value) {
|
|
2283
|
+
return value;
|
|
2284
|
+
}
|
|
2285
|
+
function BillingCreditGrantZeroedOutReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
2286
|
+
return value;
|
|
2287
|
+
}
|
|
2195
2288
|
var BillingPlanCreditGrantResetCadence = {
|
|
2196
2289
|
Daily: "daily",
|
|
2197
2290
|
Every6Months: "every_6_months",
|
|
@@ -4068,7 +4161,8 @@ var CheckoutStatus = {
|
|
|
4068
4161
|
Abandoned: "abandoned",
|
|
4069
4162
|
Completed: "completed",
|
|
4070
4163
|
Expired: "expired",
|
|
4071
|
-
Open: "open"
|
|
4164
|
+
Open: "open",
|
|
4165
|
+
PendingPayment: "pending_payment"
|
|
4072
4166
|
};
|
|
4073
4167
|
function instanceOfCheckoutStatus(value) {
|
|
4074
4168
|
for (const key in CheckoutStatus) {
|
|
@@ -5339,6 +5433,273 @@ function CompanyCreditBalancesResponseDataToJSONTyped(value, ignoreDiscriminator
|
|
|
5339
5433
|
count: value["count"]
|
|
5340
5434
|
};
|
|
5341
5435
|
}
|
|
5436
|
+
function instanceOfCompanyCreditLedgerBundleResponseData(value) {
|
|
5437
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5438
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5439
|
+
return true;
|
|
5440
|
+
}
|
|
5441
|
+
function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
|
|
5442
|
+
return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
|
|
5443
|
+
}
|
|
5444
|
+
function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5445
|
+
if (json == null) {
|
|
5446
|
+
return json;
|
|
5447
|
+
}
|
|
5448
|
+
return {
|
|
5449
|
+
id: json["id"],
|
|
5450
|
+
name: json["name"]
|
|
5451
|
+
};
|
|
5452
|
+
}
|
|
5453
|
+
function CompanyCreditLedgerBundleResponseDataToJSON(json) {
|
|
5454
|
+
return CompanyCreditLedgerBundleResponseDataToJSONTyped(json, false);
|
|
5455
|
+
}
|
|
5456
|
+
function CompanyCreditLedgerBundleResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5457
|
+
if (value == null) {
|
|
5458
|
+
return value;
|
|
5459
|
+
}
|
|
5460
|
+
return {
|
|
5461
|
+
id: value["id"],
|
|
5462
|
+
name: value["name"]
|
|
5463
|
+
};
|
|
5464
|
+
}
|
|
5465
|
+
function instanceOfCompanyCreditLedgerCreditResponseData(value) {
|
|
5466
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5467
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5468
|
+
return true;
|
|
5469
|
+
}
|
|
5470
|
+
function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
|
|
5471
|
+
return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
|
|
5472
|
+
}
|
|
5473
|
+
function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5474
|
+
if (json == null) {
|
|
5475
|
+
return json;
|
|
5476
|
+
}
|
|
5477
|
+
return {
|
|
5478
|
+
id: json["id"],
|
|
5479
|
+
name: json["name"],
|
|
5480
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
5481
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
|
|
5482
|
+
};
|
|
5483
|
+
}
|
|
5484
|
+
function CompanyCreditLedgerCreditResponseDataToJSON(json) {
|
|
5485
|
+
return CompanyCreditLedgerCreditResponseDataToJSONTyped(json, false);
|
|
5486
|
+
}
|
|
5487
|
+
function CompanyCreditLedgerCreditResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5488
|
+
if (value == null) {
|
|
5489
|
+
return value;
|
|
5490
|
+
}
|
|
5491
|
+
return {
|
|
5492
|
+
id: value["id"],
|
|
5493
|
+
name: value["name"],
|
|
5494
|
+
plural_name: value["pluralName"],
|
|
5495
|
+
singular_name: value["singularName"]
|
|
5496
|
+
};
|
|
5497
|
+
}
|
|
5498
|
+
var CreditUsageReason = {
|
|
5499
|
+
Inference: "inference",
|
|
5500
|
+
LeaseHold: "lease_hold",
|
|
5501
|
+
LeaseRelease: "lease_release",
|
|
5502
|
+
ManualAdjustment: "manual_adjustment",
|
|
5503
|
+
Reconciliation: "reconciliation",
|
|
5504
|
+
ReservationHold: "reservation_hold",
|
|
5505
|
+
ReservationRelease: "reservation_release",
|
|
5506
|
+
Track: "track"
|
|
5507
|
+
};
|
|
5508
|
+
function instanceOfCreditUsageReason(value) {
|
|
5509
|
+
for (const key in CreditUsageReason) {
|
|
5510
|
+
if (Object.prototype.hasOwnProperty.call(CreditUsageReason, key)) {
|
|
5511
|
+
if (CreditUsageReason[key] === value) {
|
|
5512
|
+
return true;
|
|
5513
|
+
}
|
|
5514
|
+
}
|
|
5515
|
+
}
|
|
5516
|
+
return false;
|
|
5517
|
+
}
|
|
5518
|
+
function CreditUsageReasonFromJSON(json) {
|
|
5519
|
+
return CreditUsageReasonFromJSONTyped(json, false);
|
|
5520
|
+
}
|
|
5521
|
+
function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
5522
|
+
return json;
|
|
5523
|
+
}
|
|
5524
|
+
function CreditUsageReasonToJSON(value) {
|
|
5525
|
+
return value;
|
|
5526
|
+
}
|
|
5527
|
+
function CreditUsageReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
5528
|
+
return value;
|
|
5529
|
+
}
|
|
5530
|
+
function instanceOfCompanyCreditLedgerUserResponseData(value) {
|
|
5531
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5532
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5533
|
+
return true;
|
|
5534
|
+
}
|
|
5535
|
+
function CompanyCreditLedgerUserResponseDataFromJSON(json) {
|
|
5536
|
+
return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
|
|
5537
|
+
}
|
|
5538
|
+
function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5539
|
+
if (json == null) {
|
|
5540
|
+
return json;
|
|
5541
|
+
}
|
|
5542
|
+
return {
|
|
5543
|
+
id: json["id"],
|
|
5544
|
+
name: json["name"]
|
|
5545
|
+
};
|
|
5546
|
+
}
|
|
5547
|
+
function CompanyCreditLedgerUserResponseDataToJSON(json) {
|
|
5548
|
+
return CompanyCreditLedgerUserResponseDataToJSONTyped(json, false);
|
|
5549
|
+
}
|
|
5550
|
+
function CompanyCreditLedgerUserResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5551
|
+
if (value == null) {
|
|
5552
|
+
return value;
|
|
5553
|
+
}
|
|
5554
|
+
return {
|
|
5555
|
+
id: value["id"],
|
|
5556
|
+
name: value["name"]
|
|
5557
|
+
};
|
|
5558
|
+
}
|
|
5559
|
+
function instanceOfCompanyCreditLedgerFeatureResponseData(value) {
|
|
5560
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5561
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5562
|
+
return true;
|
|
5563
|
+
}
|
|
5564
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
|
|
5565
|
+
return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
|
|
5566
|
+
}
|
|
5567
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5568
|
+
if (json == null) {
|
|
5569
|
+
return json;
|
|
5570
|
+
}
|
|
5571
|
+
return {
|
|
5572
|
+
id: json["id"],
|
|
5573
|
+
name: json["name"]
|
|
5574
|
+
};
|
|
5575
|
+
}
|
|
5576
|
+
function CompanyCreditLedgerFeatureResponseDataToJSON(json) {
|
|
5577
|
+
return CompanyCreditLedgerFeatureResponseDataToJSONTyped(json, false);
|
|
5578
|
+
}
|
|
5579
|
+
function CompanyCreditLedgerFeatureResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5580
|
+
if (value == null) {
|
|
5581
|
+
return value;
|
|
5582
|
+
}
|
|
5583
|
+
return {
|
|
5584
|
+
id: value["id"],
|
|
5585
|
+
name: value["name"]
|
|
5586
|
+
};
|
|
5587
|
+
}
|
|
5588
|
+
var CreditLedgerEntryKind = {
|
|
5589
|
+
Adjustment: "adjustment",
|
|
5590
|
+
Charge: "charge",
|
|
5591
|
+
Drawdown: "drawdown",
|
|
5592
|
+
Grant: "grant",
|
|
5593
|
+
Settlement: "settlement",
|
|
5594
|
+
Transfer: "transfer",
|
|
5595
|
+
ZeroOut: "zero_out"
|
|
5596
|
+
};
|
|
5597
|
+
function instanceOfCreditLedgerEntryKind(value) {
|
|
5598
|
+
for (const key in CreditLedgerEntryKind) {
|
|
5599
|
+
if (Object.prototype.hasOwnProperty.call(CreditLedgerEntryKind, key)) {
|
|
5600
|
+
if (CreditLedgerEntryKind[key] === value) {
|
|
5601
|
+
return true;
|
|
5602
|
+
}
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
return false;
|
|
5606
|
+
}
|
|
5607
|
+
function CreditLedgerEntryKindFromJSON(json) {
|
|
5608
|
+
return CreditLedgerEntryKindFromJSONTyped(json, false);
|
|
5609
|
+
}
|
|
5610
|
+
function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
|
|
5611
|
+
return json;
|
|
5612
|
+
}
|
|
5613
|
+
function CreditLedgerEntryKindToJSON(value) {
|
|
5614
|
+
return value;
|
|
5615
|
+
}
|
|
5616
|
+
function CreditLedgerEntryKindToJSONTyped(value, ignoreDiscriminator) {
|
|
5617
|
+
return value;
|
|
5618
|
+
}
|
|
5619
|
+
function instanceOfCompanyCreditLedgerEntryResponseData(value) {
|
|
5620
|
+
if (!("amount" in value) || value["amount"] === void 0) return false;
|
|
5621
|
+
if (!("credit" in value) || value["credit"] === void 0) return false;
|
|
5622
|
+
if (!("eventAt" in value) || value["eventAt"] === void 0) return false;
|
|
5623
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5624
|
+
if (!("kind" in value) || value["kind"] === void 0) return false;
|
|
5625
|
+
return true;
|
|
5626
|
+
}
|
|
5627
|
+
function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
|
|
5628
|
+
return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
|
|
5629
|
+
}
|
|
5630
|
+
function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5631
|
+
if (json == null) {
|
|
5632
|
+
return json;
|
|
5633
|
+
}
|
|
5634
|
+
return {
|
|
5635
|
+
amount: json["amount"],
|
|
5636
|
+
bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
|
|
5637
|
+
credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
|
|
5638
|
+
eventAt: new Date(json["event_at"]),
|
|
5639
|
+
feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
|
|
5640
|
+
grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
|
|
5641
|
+
id: json["id"],
|
|
5642
|
+
kind: CreditLedgerEntryKindFromJSON(json["kind"]),
|
|
5643
|
+
usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
|
|
5644
|
+
user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
|
|
5645
|
+
zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
|
|
5646
|
+
};
|
|
5647
|
+
}
|
|
5648
|
+
function CompanyCreditLedgerEntryResponseDataToJSON(json) {
|
|
5649
|
+
return CompanyCreditLedgerEntryResponseDataToJSONTyped(json, false);
|
|
5650
|
+
}
|
|
5651
|
+
function CompanyCreditLedgerEntryResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5652
|
+
if (value == null) {
|
|
5653
|
+
return value;
|
|
5654
|
+
}
|
|
5655
|
+
return {
|
|
5656
|
+
amount: value["amount"],
|
|
5657
|
+
bundle: CompanyCreditLedgerBundleResponseDataToJSON(value["bundle"]),
|
|
5658
|
+
credit: CompanyCreditLedgerCreditResponseDataToJSON(value["credit"]),
|
|
5659
|
+
event_at: value["eventAt"].toISOString(),
|
|
5660
|
+
feature: CompanyCreditLedgerFeatureResponseDataToJSON(value["feature"]),
|
|
5661
|
+
grant_reason: BillingCreditGrantReasonToJSON(value["grantReason"]),
|
|
5662
|
+
id: value["id"],
|
|
5663
|
+
kind: CreditLedgerEntryKindToJSON(value["kind"]),
|
|
5664
|
+
usage_reason: CreditUsageReasonToJSON(value["usageReason"]),
|
|
5665
|
+
user: CompanyCreditLedgerUserResponseDataToJSON(value["user"]),
|
|
5666
|
+
zeroed_out_reason: BillingCreditGrantZeroedOutReasonToJSON(
|
|
5667
|
+
value["zeroedOutReason"]
|
|
5668
|
+
)
|
|
5669
|
+
};
|
|
5670
|
+
}
|
|
5671
|
+
function instanceOfCompanyCreditLedgerResponseData(value) {
|
|
5672
|
+
if (!("entries" in value) || value["entries"] === void 0) return false;
|
|
5673
|
+
return true;
|
|
5674
|
+
}
|
|
5675
|
+
function CompanyCreditLedgerResponseDataFromJSON(json) {
|
|
5676
|
+
return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
|
|
5677
|
+
}
|
|
5678
|
+
function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5679
|
+
if (json == null) {
|
|
5680
|
+
return json;
|
|
5681
|
+
}
|
|
5682
|
+
return {
|
|
5683
|
+
entries: json["entries"].map(
|
|
5684
|
+
CompanyCreditLedgerEntryResponseDataFromJSON
|
|
5685
|
+
),
|
|
5686
|
+
nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
|
|
5687
|
+
};
|
|
5688
|
+
}
|
|
5689
|
+
function CompanyCreditLedgerResponseDataToJSON(json) {
|
|
5690
|
+
return CompanyCreditLedgerResponseDataToJSONTyped(json, false);
|
|
5691
|
+
}
|
|
5692
|
+
function CompanyCreditLedgerResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5693
|
+
if (value == null) {
|
|
5694
|
+
return value;
|
|
5695
|
+
}
|
|
5696
|
+
return {
|
|
5697
|
+
entries: value["entries"].map(
|
|
5698
|
+
CompanyCreditLedgerEntryResponseDataToJSON
|
|
5699
|
+
),
|
|
5700
|
+
next_cursor: value["nextCursor"]
|
|
5701
|
+
};
|
|
5702
|
+
}
|
|
5342
5703
|
function instanceOfCompanyCreditUserUsageRowResponseData(value) {
|
|
5343
5704
|
if (!("share" in value) || value["share"] === void 0) return false;
|
|
5344
5705
|
if (!("used" in value) || value["used"] === void 0) return false;
|
|
@@ -6417,6 +6778,66 @@ function GetCompanyCreditBalancesResponseToJSONTyped(value, ignoreDiscriminator
|
|
|
6417
6778
|
params: value["params"]
|
|
6418
6779
|
};
|
|
6419
6780
|
}
|
|
6781
|
+
function instanceOfGetCompanyCreditLedgerParams(value) {
|
|
6782
|
+
return true;
|
|
6783
|
+
}
|
|
6784
|
+
function GetCompanyCreditLedgerParamsFromJSON(json) {
|
|
6785
|
+
return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
|
|
6786
|
+
}
|
|
6787
|
+
function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
6788
|
+
if (json == null) {
|
|
6789
|
+
return json;
|
|
6790
|
+
}
|
|
6791
|
+
return {
|
|
6792
|
+
creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
|
|
6793
|
+
cursor: json["cursor"] == null ? void 0 : json["cursor"],
|
|
6794
|
+
includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
|
|
6795
|
+
limit: json["limit"] == null ? void 0 : json["limit"]
|
|
6796
|
+
};
|
|
6797
|
+
}
|
|
6798
|
+
function GetCompanyCreditLedgerParamsToJSON(json) {
|
|
6799
|
+
return GetCompanyCreditLedgerParamsToJSONTyped(json, false);
|
|
6800
|
+
}
|
|
6801
|
+
function GetCompanyCreditLedgerParamsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6802
|
+
if (value == null) {
|
|
6803
|
+
return value;
|
|
6804
|
+
}
|
|
6805
|
+
return {
|
|
6806
|
+
credit_ids: value["creditIds"],
|
|
6807
|
+
cursor: value["cursor"],
|
|
6808
|
+
include_grants: value["includeGrants"],
|
|
6809
|
+
limit: value["limit"]
|
|
6810
|
+
};
|
|
6811
|
+
}
|
|
6812
|
+
function instanceOfGetCompanyCreditLedgerResponse(value) {
|
|
6813
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6814
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6815
|
+
return true;
|
|
6816
|
+
}
|
|
6817
|
+
function GetCompanyCreditLedgerResponseFromJSON(json) {
|
|
6818
|
+
return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
|
|
6819
|
+
}
|
|
6820
|
+
function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6821
|
+
if (json == null) {
|
|
6822
|
+
return json;
|
|
6823
|
+
}
|
|
6824
|
+
return {
|
|
6825
|
+
data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
|
|
6826
|
+
params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
|
|
6827
|
+
};
|
|
6828
|
+
}
|
|
6829
|
+
function GetCompanyCreditLedgerResponseToJSON(json) {
|
|
6830
|
+
return GetCompanyCreditLedgerResponseToJSONTyped(json, false);
|
|
6831
|
+
}
|
|
6832
|
+
function GetCompanyCreditLedgerResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6833
|
+
if (value == null) {
|
|
6834
|
+
return value;
|
|
6835
|
+
}
|
|
6836
|
+
return {
|
|
6837
|
+
data: CompanyCreditLedgerResponseDataToJSON(value["data"]),
|
|
6838
|
+
params: GetCompanyCreditLedgerParamsToJSON(value["params"])
|
|
6839
|
+
};
|
|
6840
|
+
}
|
|
6420
6841
|
function instanceOfGetCompanyCreditUserUsageParams(value) {
|
|
6421
6842
|
return true;
|
|
6422
6843
|
}
|
|
@@ -7679,6 +8100,18 @@ function checkoutProblemsOf(error) {
|
|
|
7679
8100
|
}
|
|
7680
8101
|
return body.problems.map((p) => CheckoutProblemResponseDataFromJSON(p));
|
|
7681
8102
|
}
|
|
8103
|
+
var DEFAULT_CREDIT_LEDGER_QUERY = {};
|
|
8104
|
+
function normalizeCreditLedgerQuery(query) {
|
|
8105
|
+
const { credits, includeGrants, ...rest } = query;
|
|
8106
|
+
const normalized = { ...rest };
|
|
8107
|
+
if (credits !== void 0 && credits.length > 0) {
|
|
8108
|
+
normalized.credits = [...new Set(credits)].sort();
|
|
8109
|
+
}
|
|
8110
|
+
if (includeGrants === false) {
|
|
8111
|
+
normalized.includeGrants = false;
|
|
8112
|
+
}
|
|
8113
|
+
return normalized;
|
|
8114
|
+
}
|
|
7682
8115
|
var SINGLETON = {};
|
|
7683
8116
|
var DEFAULT_INVOICE_QUERY = {};
|
|
7684
8117
|
function normalizeInvoiceQuery(query) {
|
|
@@ -7968,6 +8401,7 @@ function dataOf(body, path) {
|
|
|
7968
8401
|
return body.data;
|
|
7969
8402
|
}
|
|
7970
8403
|
var INVOICE_PAGE_SIZE = 12;
|
|
8404
|
+
var CREDIT_LEDGER_PAGE_SIZE = 20;
|
|
7971
8405
|
var INVOICE_MAX_PAGE_SIZE = 250;
|
|
7972
8406
|
var SchematicBillingClient = class {
|
|
7973
8407
|
/**
|
|
@@ -8155,6 +8589,32 @@ var SchematicBillingClient = class {
|
|
|
8155
8589
|
return GetCompanyCreditBalancesResponseFromJSON(body).data.balances;
|
|
8156
8590
|
});
|
|
8157
8591
|
}
|
|
8592
|
+
fetchCreditLedger(params) {
|
|
8593
|
+
const query = new URLSearchParams({
|
|
8594
|
+
limit: String(Math.min(params.limit, INVOICE_MAX_PAGE_SIZE))
|
|
8595
|
+
});
|
|
8596
|
+
if (params.cursor !== void 0) {
|
|
8597
|
+
query.set("cursor", params.cursor);
|
|
8598
|
+
}
|
|
8599
|
+
for (const credit of params.credits ?? []) {
|
|
8600
|
+
query.append("credit_ids", credit);
|
|
8601
|
+
}
|
|
8602
|
+
if (params.includeGrants !== void 0) {
|
|
8603
|
+
query.set("include_grants", String(params.includeGrants));
|
|
8604
|
+
}
|
|
8605
|
+
const path = `/company/credits/ledger?${query}`;
|
|
8606
|
+
return this.session.request(path).then((body) => {
|
|
8607
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
8608
|
+
throw new Error(`Malformed response from ${path}`);
|
|
8609
|
+
}
|
|
8610
|
+
const data = body.data;
|
|
8611
|
+
if (data == null || data.entries == null) {
|
|
8612
|
+
return { entries: [] };
|
|
8613
|
+
}
|
|
8614
|
+
const { entries, nextCursor } = GetCompanyCreditLedgerResponseFromJSON(body).data;
|
|
8615
|
+
return nextCursor == null ? { entries } : { entries, nextCursor };
|
|
8616
|
+
});
|
|
8617
|
+
}
|
|
8158
8618
|
fetchCreditUserUsage(params) {
|
|
8159
8619
|
const query = new URLSearchParams();
|
|
8160
8620
|
if (params.limit !== void 0) {
|
|
@@ -10090,6 +10550,13 @@ function normalizeCatalogQuery2(query) {
|
|
|
10090
10550
|
const { catalogId } = normalizeCatalogQuery(query);
|
|
10091
10551
|
return catalogId === void 0 ? {} : { catalogId };
|
|
10092
10552
|
}
|
|
10553
|
+
function normalizeCreditLedgerQuery2(query) {
|
|
10554
|
+
const { credits, includeGrants } = normalizeCreditLedgerQuery(query);
|
|
10555
|
+
return {
|
|
10556
|
+
...credits === void 0 ? {} : { credits },
|
|
10557
|
+
...includeGrants === void 0 ? {} : { includeGrants }
|
|
10558
|
+
};
|
|
10559
|
+
}
|
|
10093
10560
|
|
|
10094
10561
|
// src/billing/store.ts
|
|
10095
10562
|
var Resource = class {
|
|
@@ -10502,6 +10969,13 @@ var BillingStore = class {
|
|
|
10502
10969
|
() => this._client.fetchCreditBalances(),
|
|
10503
10970
|
{ readiness }
|
|
10504
10971
|
);
|
|
10972
|
+
this.creditLedger = new KeyedResource(
|
|
10973
|
+
(query, current) => this._reloadCreditLedgerWindow(
|
|
10974
|
+
query,
|
|
10975
|
+
Math.max(CREDIT_LEDGER_PAGE_SIZE, current?.entries.length ?? 0)
|
|
10976
|
+
),
|
|
10977
|
+
{ readiness }
|
|
10978
|
+
);
|
|
10505
10979
|
this.company = new KeyedResource(() => this._client.fetchCompany(), {
|
|
10506
10980
|
readiness
|
|
10507
10981
|
});
|
|
@@ -10543,13 +11017,21 @@ var BillingStore = class {
|
|
|
10543
11017
|
if (initialData.creditBalances !== void 0) {
|
|
10544
11018
|
held.creditBalances = initialData.creditBalances;
|
|
10545
11019
|
}
|
|
11020
|
+
if (initialData.creditLedger !== void 0) {
|
|
11021
|
+
held.creditLedger = {
|
|
11022
|
+
params: normalizeCreditLedgerQuery2(
|
|
11023
|
+
initialData.params?.creditLedger ?? DEFAULT_CREDIT_LEDGER_QUERY
|
|
11024
|
+
),
|
|
11025
|
+
data: initialData.creditLedger
|
|
11026
|
+
};
|
|
11027
|
+
}
|
|
10546
11028
|
if (initialData.company !== void 0) {
|
|
10547
11029
|
held.company = initialData.company;
|
|
10548
11030
|
}
|
|
10549
11031
|
if (initialData.taxIds !== void 0) {
|
|
10550
11032
|
held.taxIds = initialData.taxIds;
|
|
10551
11033
|
}
|
|
10552
|
-
if (held.catalog !== void 0 || held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0 || held.company !== void 0 || held.taxIds !== void 0) {
|
|
11034
|
+
if (held.catalog !== void 0 || held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0 || held.creditLedger !== void 0 || held.company !== void 0 || held.taxIds !== void 0) {
|
|
10553
11035
|
this._held = held;
|
|
10554
11036
|
this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
|
|
10555
11037
|
}
|
|
@@ -10562,6 +11044,7 @@ var BillingStore = class {
|
|
|
10562
11044
|
paymentMethods;
|
|
10563
11045
|
featureUsage;
|
|
10564
11046
|
creditBalances;
|
|
11047
|
+
creditLedger;
|
|
10565
11048
|
company;
|
|
10566
11049
|
creditUserUsage;
|
|
10567
11050
|
taxIds;
|
|
@@ -10654,6 +11137,12 @@ var BillingStore = class {
|
|
|
10654
11137
|
if (held.creditBalances !== void 0) {
|
|
10655
11138
|
this.creditBalances.seed(SINGLETON, held.creditBalances);
|
|
10656
11139
|
}
|
|
11140
|
+
if (held.creditLedger !== void 0) {
|
|
11141
|
+
this.creditLedger.seed(
|
|
11142
|
+
held.creditLedger.params,
|
|
11143
|
+
held.creditLedger.data
|
|
11144
|
+
);
|
|
11145
|
+
}
|
|
10657
11146
|
if (held.company !== void 0) {
|
|
10658
11147
|
this.company.seed(SINGLETON, held.company);
|
|
10659
11148
|
}
|
|
@@ -10738,6 +11227,31 @@ var BillingStore = class {
|
|
|
10738
11227
|
};
|
|
10739
11228
|
});
|
|
10740
11229
|
}
|
|
11230
|
+
/**
|
|
11231
|
+
* Appends the next page to the credit ledger for `query`, as
|
|
11232
|
+
* `loadMoreInvoices` does for invoices.
|
|
11233
|
+
*/
|
|
11234
|
+
loadMoreCreditLedger(query = DEFAULT_CREDIT_LEDGER_QUERY) {
|
|
11235
|
+
const params = normalizeCreditLedgerQuery2(query);
|
|
11236
|
+
const resource = this.creditLedger.get(params);
|
|
11237
|
+
if (resource.snapshot.data?.nextCursor === void 0) {
|
|
11238
|
+
return Promise.resolve();
|
|
11239
|
+
}
|
|
11240
|
+
return resource.extend(async (current) => {
|
|
11241
|
+
if (current.nextCursor === void 0) {
|
|
11242
|
+
return current;
|
|
11243
|
+
}
|
|
11244
|
+
const page = await this._client.fetchCreditLedger({
|
|
11245
|
+
...params,
|
|
11246
|
+
cursor: current.nextCursor,
|
|
11247
|
+
limit: CREDIT_LEDGER_PAGE_SIZE
|
|
11248
|
+
});
|
|
11249
|
+
return creditLedgerPage(
|
|
11250
|
+
[...current.entries, ...page.entries],
|
|
11251
|
+
page.entries.length > 0 ? page.nextCursor : void 0
|
|
11252
|
+
);
|
|
11253
|
+
});
|
|
11254
|
+
}
|
|
10741
11255
|
/**
|
|
10742
11256
|
* Makes the payment method `externalId` the company's default, then
|
|
10743
11257
|
* reloads the list so it says so. Rejects with the client's error when
|
|
@@ -10857,6 +11371,24 @@ var BillingStore = class {
|
|
|
10857
11371
|
hasMore: invoices.length > 0 && invoices.length < count
|
|
10858
11372
|
};
|
|
10859
11373
|
}
|
|
11374
|
+
/**
|
|
11375
|
+
* `_reloadWindow` for the credit ledger: re-reads from the newest entry,
|
|
11376
|
+
* following cursors until it has as many rows as were loaded.
|
|
11377
|
+
*/
|
|
11378
|
+
async _reloadCreditLedgerWindow(query, window2) {
|
|
11379
|
+
const entries = [];
|
|
11380
|
+
let cursor;
|
|
11381
|
+
do {
|
|
11382
|
+
const page = await this._client.fetchCreditLedger({
|
|
11383
|
+
...query,
|
|
11384
|
+
...cursor === void 0 ? {} : { cursor },
|
|
11385
|
+
limit: Math.min(INVOICE_MAX_PAGE_SIZE, window2 - entries.length)
|
|
11386
|
+
});
|
|
11387
|
+
entries.push(...page.entries);
|
|
11388
|
+
cursor = page.entries.length > 0 ? page.nextCursor : void 0;
|
|
11389
|
+
} while (cursor !== void 0 && entries.length < window2);
|
|
11390
|
+
return creditLedgerPage(entries, cursor);
|
|
11391
|
+
}
|
|
10860
11392
|
/**
|
|
10861
11393
|
* Returns what the server said and nothing more: whether there is more to
|
|
10862
11394
|
* load depends on the whole window, which only the caller assembling it
|
|
@@ -10874,9 +11406,13 @@ var RESOURCE_NAMES = [
|
|
|
10874
11406
|
"paymentMethods",
|
|
10875
11407
|
"featureUsage",
|
|
10876
11408
|
"creditBalances",
|
|
11409
|
+
"creditLedger",
|
|
10877
11410
|
"company",
|
|
10878
11411
|
"taxIds"
|
|
10879
11412
|
];
|
|
11413
|
+
function creditLedgerPage(entries, nextCursor) {
|
|
11414
|
+
return nextCursor === void 0 ? { entries } : { entries, nextCursor };
|
|
11415
|
+
}
|
|
10880
11416
|
|
|
10881
11417
|
// src/billing/context.tsx
|
|
10882
11418
|
import { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
@@ -10972,6 +11508,7 @@ var missingBillingSource = {
|
|
|
10972
11508
|
},
|
|
10973
11509
|
creditUserUsage: () => missingHandle,
|
|
10974
11510
|
loadMoreInvoices: () => Promise.resolve(),
|
|
11511
|
+
loadMoreCreditLedger: () => Promise.resolve(),
|
|
10975
11512
|
invalidateAll: () => {
|
|
10976
11513
|
},
|
|
10977
11514
|
// The same error a read reports, so a write outside any provider names
|
|
@@ -10988,6 +11525,7 @@ function BillingDataProvider({
|
|
|
10988
11525
|
data,
|
|
10989
11526
|
featureUserUsage,
|
|
10990
11527
|
locale,
|
|
11528
|
+
onLoadMoreCreditLedger,
|
|
10991
11529
|
onLoadMoreInvoices,
|
|
10992
11530
|
onMissingString,
|
|
10993
11531
|
onRefetch,
|
|
@@ -11062,6 +11600,10 @@ function BillingDataProvider({
|
|
|
11062
11600
|
onLoadMoreInvoices?.(query);
|
|
11063
11601
|
return Promise.resolve();
|
|
11064
11602
|
},
|
|
11603
|
+
loadMoreCreditLedger: (query) => {
|
|
11604
|
+
onLoadMoreCreditLedger?.(query);
|
|
11605
|
+
return Promise.resolve();
|
|
11606
|
+
},
|
|
11065
11607
|
invalidateAll: () => {
|
|
11066
11608
|
},
|
|
11067
11609
|
catalogSource: () => catalogSourceOf(data)
|
|
@@ -11071,6 +11613,7 @@ function BillingDataProvider({
|
|
|
11071
11613
|
creditUserUsage,
|
|
11072
11614
|
data,
|
|
11073
11615
|
featureUserUsage,
|
|
11616
|
+
onLoadMoreCreditLedger,
|
|
11074
11617
|
onLoadMoreInvoices,
|
|
11075
11618
|
onRefetch,
|
|
11076
11619
|
status
|
|
@@ -11316,6 +11859,16 @@ function useCheckout(options = {}) {
|
|
|
11316
11859
|
[finalize, reset, setSelections, state]
|
|
11317
11860
|
);
|
|
11318
11861
|
}
|
|
11862
|
+
function useCreditLedger(query = DEFAULT_CREDIT_LEDGER_QUERY) {
|
|
11863
|
+
const source = useBillingDataSource();
|
|
11864
|
+
const params = useStableParams(normalizeCreditLedgerQuery2(query));
|
|
11865
|
+
const handle = useBillingResource("creditLedger", params);
|
|
11866
|
+
const loadMore = useCallback(
|
|
11867
|
+
() => source.loadMoreCreditLedger(params),
|
|
11868
|
+
[params, source]
|
|
11869
|
+
);
|
|
11870
|
+
return useMemo3(() => ({ ...handle, loadMore }), [handle, loadMore]);
|
|
11871
|
+
}
|
|
11319
11872
|
function useInvalidateBillingData() {
|
|
11320
11873
|
return useBillingDataSource().invalidateAll;
|
|
11321
11874
|
}
|
|
@@ -11419,6 +11972,7 @@ function BillingProvider({
|
|
|
11419
11972
|
subscribeCreditUserUsage: (creditId, listener) => store.creditUserUsage.subscribe({ creditId }, listener),
|
|
11420
11973
|
creditUserUsage: (creditId) => handleOf(store.creditUserUsage.get({ creditId })),
|
|
11421
11974
|
loadMoreInvoices: (query) => store.loadMoreInvoices(query),
|
|
11975
|
+
loadMoreCreditLedger: (query) => store.loadMoreCreditLedger(query),
|
|
11422
11976
|
invalidateAll: () => store.invalidateAll(),
|
|
11423
11977
|
actions: {
|
|
11424
11978
|
setDefaultPaymentMethod: (externalId) => store.setDefaultPaymentMethod(externalId),
|
|
@@ -11493,6 +12047,7 @@ function staticSource(data) {
|
|
|
11493
12047
|
return next;
|
|
11494
12048
|
},
|
|
11495
12049
|
loadMoreInvoices: () => Promise.resolve(),
|
|
12050
|
+
loadMoreCreditLedger: () => Promise.resolve(),
|
|
11496
12051
|
invalidateAll: () => {
|
|
11497
12052
|
},
|
|
11498
12053
|
catalogSource: () => catalogSourceOf(data)
|
|
@@ -11500,7 +12055,7 @@ function staticSource(data) {
|
|
|
11500
12055
|
}
|
|
11501
12056
|
|
|
11502
12057
|
// src/version.ts
|
|
11503
|
-
var version2 = "1.
|
|
12058
|
+
var version2 = "1.19.0";
|
|
11504
12059
|
|
|
11505
12060
|
// src/context/schematic.tsx
|
|
11506
12061
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -11755,12 +12310,18 @@ var useSchematicIsPending = (opts) => {
|
|
|
11755
12310
|
return useSyncExternalStore2(subscribe, getSnapshot, () => true);
|
|
11756
12311
|
};
|
|
11757
12312
|
export {
|
|
12313
|
+
BillingCreditGrantReason,
|
|
12314
|
+
BillingCreditGrantZeroedOutReason,
|
|
11758
12315
|
BillingDataProvider,
|
|
11759
12316
|
BillingProvider,
|
|
12317
|
+
CREDIT_LEDGER_PAGE_SIZE,
|
|
11760
12318
|
CheckoutDraft,
|
|
11761
12319
|
CheckoutProblemCode,
|
|
11762
12320
|
CheckoutStatus,
|
|
12321
|
+
CreditLedgerEntryKind,
|
|
12322
|
+
CreditUsageReason,
|
|
11763
12323
|
DEFAULT_CATALOG_QUERY,
|
|
12324
|
+
DEFAULT_CREDIT_LEDGER_QUERY,
|
|
11764
12325
|
DEFAULT_INVOICE_QUERY,
|
|
11765
12326
|
FEATURE_USER_USAGE_LIMIT,
|
|
11766
12327
|
INVOICE_PAGE_SIZE,
|
|
@@ -11775,12 +12336,14 @@ export {
|
|
|
11775
12336
|
UsagePeriod,
|
|
11776
12337
|
checkoutProblemsOf,
|
|
11777
12338
|
normalizeCatalogQuery2 as normalizeCatalogQuery,
|
|
12339
|
+
normalizeCreditLedgerQuery2 as normalizeCreditLedgerQuery,
|
|
11778
12340
|
normalizeInvoiceQuery2 as normalizeInvoiceQuery,
|
|
11779
12341
|
useBillingDataSource,
|
|
11780
12342
|
useCatalog,
|
|
11781
12343
|
useCheckout,
|
|
11782
12344
|
useCompany,
|
|
11783
12345
|
useCreditBalances,
|
|
12346
|
+
useCreditLedger,
|
|
11784
12347
|
useCreditUserUsage,
|
|
11785
12348
|
useFeatureUsage,
|
|
11786
12349
|
useFeatureUserUsage,
|