@schematichq/schematic-react 1.18.0 → 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 +423 -6
- package/dist/schematic-react.esm.js +568 -5
- package/package.json +3 -3
|
@@ -30,12 +30,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
BillingCreditGrantReason: () => BillingCreditGrantReason,
|
|
34
|
+
BillingCreditGrantZeroedOutReason: () => BillingCreditGrantZeroedOutReason,
|
|
33
35
|
BillingDataProvider: () => BillingDataProvider,
|
|
34
36
|
BillingProvider: () => BillingProvider,
|
|
37
|
+
CREDIT_LEDGER_PAGE_SIZE: () => CREDIT_LEDGER_PAGE_SIZE,
|
|
35
38
|
CheckoutDraft: () => CheckoutDraft,
|
|
36
39
|
CheckoutProblemCode: () => CheckoutProblemCode,
|
|
37
40
|
CheckoutStatus: () => CheckoutStatus,
|
|
41
|
+
CreditLedgerEntryKind: () => CreditLedgerEntryKind,
|
|
42
|
+
CreditUsageReason: () => CreditUsageReason,
|
|
38
43
|
DEFAULT_CATALOG_QUERY: () => DEFAULT_CATALOG_QUERY,
|
|
44
|
+
DEFAULT_CREDIT_LEDGER_QUERY: () => DEFAULT_CREDIT_LEDGER_QUERY,
|
|
39
45
|
DEFAULT_INVOICE_QUERY: () => DEFAULT_INVOICE_QUERY,
|
|
40
46
|
FEATURE_USER_USAGE_LIMIT: () => FEATURE_USER_USAGE_LIMIT,
|
|
41
47
|
INVOICE_PAGE_SIZE: () => INVOICE_PAGE_SIZE,
|
|
@@ -50,12 +56,14 @@ __export(index_exports, {
|
|
|
50
56
|
UsagePeriod: () => UsagePeriod,
|
|
51
57
|
checkoutProblemsOf: () => checkoutProblemsOf,
|
|
52
58
|
normalizeCatalogQuery: () => normalizeCatalogQuery2,
|
|
59
|
+
normalizeCreditLedgerQuery: () => normalizeCreditLedgerQuery2,
|
|
53
60
|
normalizeInvoiceQuery: () => normalizeInvoiceQuery2,
|
|
54
61
|
useBillingDataSource: () => useBillingDataSource,
|
|
55
62
|
useCatalog: () => useCatalog,
|
|
56
63
|
useCheckout: () => useCheckout,
|
|
57
64
|
useCompany: () => useCompany,
|
|
58
65
|
useCreditBalances: () => useCreditBalances,
|
|
66
|
+
useCreditLedger: () => useCreditLedger,
|
|
59
67
|
useCreditUserUsage: () => useCreditUserUsage,
|
|
60
68
|
useFeatureUsage: () => useFeatureUsage,
|
|
61
69
|
useFeatureUserUsage: () => useFeatureUserUsage,
|
|
@@ -82,7 +90,7 @@ __export(index_exports, {
|
|
|
82
90
|
});
|
|
83
91
|
module.exports = __toCommonJS(index_exports);
|
|
84
92
|
|
|
85
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
93
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.19.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
|
|
86
94
|
var __create2 = Object.create;
|
|
87
95
|
var __defProp2 = Object.defineProperty;
|
|
88
96
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -1413,7 +1421,7 @@ var ContextSignatureManager = class {
|
|
|
1413
1421
|
}
|
|
1414
1422
|
}
|
|
1415
1423
|
};
|
|
1416
|
-
var version = "1.
|
|
1424
|
+
var version = "1.19.0";
|
|
1417
1425
|
var DEFAULT_CATALOG_QUERY = {};
|
|
1418
1426
|
function normalizeCatalogQuery(query) {
|
|
1419
1427
|
return query.catalogId === void 0 ? {} : { catalogId: query.catalogId };
|
|
@@ -1449,6 +1457,11 @@ __export2(models_exports, {
|
|
|
1449
1457
|
BillingCreditGrantReasonFromJSONTyped: () => BillingCreditGrantReasonFromJSONTyped,
|
|
1450
1458
|
BillingCreditGrantReasonToJSON: () => BillingCreditGrantReasonToJSON,
|
|
1451
1459
|
BillingCreditGrantReasonToJSONTyped: () => BillingCreditGrantReasonToJSONTyped,
|
|
1460
|
+
BillingCreditGrantZeroedOutReason: () => BillingCreditGrantZeroedOutReason,
|
|
1461
|
+
BillingCreditGrantZeroedOutReasonFromJSON: () => BillingCreditGrantZeroedOutReasonFromJSON,
|
|
1462
|
+
BillingCreditGrantZeroedOutReasonFromJSONTyped: () => BillingCreditGrantZeroedOutReasonFromJSONTyped,
|
|
1463
|
+
BillingCreditGrantZeroedOutReasonToJSON: () => BillingCreditGrantZeroedOutReasonToJSON,
|
|
1464
|
+
BillingCreditGrantZeroedOutReasonToJSONTyped: () => BillingCreditGrantZeroedOutReasonToJSONTyped,
|
|
1452
1465
|
BillingPlanCreditGrantResetCadence: () => BillingPlanCreditGrantResetCadence,
|
|
1453
1466
|
BillingPlanCreditGrantResetCadenceFromJSON: () => BillingPlanCreditGrantResetCadenceFromJSON2,
|
|
1454
1467
|
BillingPlanCreditGrantResetCadenceFromJSONTyped: () => BillingPlanCreditGrantResetCadenceFromJSONTyped4,
|
|
@@ -1672,6 +1685,30 @@ __export2(models_exports, {
|
|
|
1672
1685
|
CompanyCreditGrantResponseDataFromJSONTyped: () => CompanyCreditGrantResponseDataFromJSONTyped,
|
|
1673
1686
|
CompanyCreditGrantResponseDataToJSON: () => CompanyCreditGrantResponseDataToJSON,
|
|
1674
1687
|
CompanyCreditGrantResponseDataToJSONTyped: () => CompanyCreditGrantResponseDataToJSONTyped,
|
|
1688
|
+
CompanyCreditLedgerBundleResponseDataFromJSON: () => CompanyCreditLedgerBundleResponseDataFromJSON,
|
|
1689
|
+
CompanyCreditLedgerBundleResponseDataFromJSONTyped: () => CompanyCreditLedgerBundleResponseDataFromJSONTyped,
|
|
1690
|
+
CompanyCreditLedgerBundleResponseDataToJSON: () => CompanyCreditLedgerBundleResponseDataToJSON,
|
|
1691
|
+
CompanyCreditLedgerBundleResponseDataToJSONTyped: () => CompanyCreditLedgerBundleResponseDataToJSONTyped,
|
|
1692
|
+
CompanyCreditLedgerCreditResponseDataFromJSON: () => CompanyCreditLedgerCreditResponseDataFromJSON,
|
|
1693
|
+
CompanyCreditLedgerCreditResponseDataFromJSONTyped: () => CompanyCreditLedgerCreditResponseDataFromJSONTyped,
|
|
1694
|
+
CompanyCreditLedgerCreditResponseDataToJSON: () => CompanyCreditLedgerCreditResponseDataToJSON,
|
|
1695
|
+
CompanyCreditLedgerCreditResponseDataToJSONTyped: () => CompanyCreditLedgerCreditResponseDataToJSONTyped,
|
|
1696
|
+
CompanyCreditLedgerEntryResponseDataFromJSON: () => CompanyCreditLedgerEntryResponseDataFromJSON,
|
|
1697
|
+
CompanyCreditLedgerEntryResponseDataFromJSONTyped: () => CompanyCreditLedgerEntryResponseDataFromJSONTyped,
|
|
1698
|
+
CompanyCreditLedgerEntryResponseDataToJSON: () => CompanyCreditLedgerEntryResponseDataToJSON,
|
|
1699
|
+
CompanyCreditLedgerEntryResponseDataToJSONTyped: () => CompanyCreditLedgerEntryResponseDataToJSONTyped,
|
|
1700
|
+
CompanyCreditLedgerFeatureResponseDataFromJSON: () => CompanyCreditLedgerFeatureResponseDataFromJSON,
|
|
1701
|
+
CompanyCreditLedgerFeatureResponseDataFromJSONTyped: () => CompanyCreditLedgerFeatureResponseDataFromJSONTyped,
|
|
1702
|
+
CompanyCreditLedgerFeatureResponseDataToJSON: () => CompanyCreditLedgerFeatureResponseDataToJSON,
|
|
1703
|
+
CompanyCreditLedgerFeatureResponseDataToJSONTyped: () => CompanyCreditLedgerFeatureResponseDataToJSONTyped,
|
|
1704
|
+
CompanyCreditLedgerResponseDataFromJSON: () => CompanyCreditLedgerResponseDataFromJSON,
|
|
1705
|
+
CompanyCreditLedgerResponseDataFromJSONTyped: () => CompanyCreditLedgerResponseDataFromJSONTyped,
|
|
1706
|
+
CompanyCreditLedgerResponseDataToJSON: () => CompanyCreditLedgerResponseDataToJSON,
|
|
1707
|
+
CompanyCreditLedgerResponseDataToJSONTyped: () => CompanyCreditLedgerResponseDataToJSONTyped,
|
|
1708
|
+
CompanyCreditLedgerUserResponseDataFromJSON: () => CompanyCreditLedgerUserResponseDataFromJSON,
|
|
1709
|
+
CompanyCreditLedgerUserResponseDataFromJSONTyped: () => CompanyCreditLedgerUserResponseDataFromJSONTyped,
|
|
1710
|
+
CompanyCreditLedgerUserResponseDataToJSON: () => CompanyCreditLedgerUserResponseDataToJSON,
|
|
1711
|
+
CompanyCreditLedgerUserResponseDataToJSONTyped: () => CompanyCreditLedgerUserResponseDataToJSONTyped,
|
|
1675
1712
|
CompanyCreditUserUsageResponseDataFromJSON: () => CompanyCreditUserUsageResponseDataFromJSON,
|
|
1676
1713
|
CompanyCreditUserUsageResponseDataFromJSONTyped: () => CompanyCreditUserUsageResponseDataFromJSONTyped,
|
|
1677
1714
|
CompanyCreditUserUsageResponseDataToJSON: () => CompanyCreditUserUsageResponseDataToJSON,
|
|
@@ -1741,6 +1778,16 @@ __export2(models_exports, {
|
|
|
1741
1778
|
CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
|
|
1742
1779
|
CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
|
|
1743
1780
|
CreateSetupIntentResponseToJSONTyped: () => CreateSetupIntentResponseToJSONTyped,
|
|
1781
|
+
CreditLedgerEntryKind: () => CreditLedgerEntryKind,
|
|
1782
|
+
CreditLedgerEntryKindFromJSON: () => CreditLedgerEntryKindFromJSON,
|
|
1783
|
+
CreditLedgerEntryKindFromJSONTyped: () => CreditLedgerEntryKindFromJSONTyped,
|
|
1784
|
+
CreditLedgerEntryKindToJSON: () => CreditLedgerEntryKindToJSON,
|
|
1785
|
+
CreditLedgerEntryKindToJSONTyped: () => CreditLedgerEntryKindToJSONTyped,
|
|
1786
|
+
CreditUsageReason: () => CreditUsageReason,
|
|
1787
|
+
CreditUsageReasonFromJSON: () => CreditUsageReasonFromJSON,
|
|
1788
|
+
CreditUsageReasonFromJSONTyped: () => CreditUsageReasonFromJSONTyped,
|
|
1789
|
+
CreditUsageReasonToJSON: () => CreditUsageReasonToJSON,
|
|
1790
|
+
CreditUsageReasonToJSONTyped: () => CreditUsageReasonToJSONTyped,
|
|
1744
1791
|
Currency: () => Currency,
|
|
1745
1792
|
CurrencyFromJSON: () => CurrencyFromJSON2,
|
|
1746
1793
|
CurrencyFromJSONTyped: () => CurrencyFromJSONTyped13,
|
|
@@ -1807,6 +1854,14 @@ __export2(models_exports, {
|
|
|
1807
1854
|
GetCompanyCreditBalancesResponseFromJSONTyped: () => GetCompanyCreditBalancesResponseFromJSONTyped,
|
|
1808
1855
|
GetCompanyCreditBalancesResponseToJSON: () => GetCompanyCreditBalancesResponseToJSON,
|
|
1809
1856
|
GetCompanyCreditBalancesResponseToJSONTyped: () => GetCompanyCreditBalancesResponseToJSONTyped,
|
|
1857
|
+
GetCompanyCreditLedgerParamsFromJSON: () => GetCompanyCreditLedgerParamsFromJSON,
|
|
1858
|
+
GetCompanyCreditLedgerParamsFromJSONTyped: () => GetCompanyCreditLedgerParamsFromJSONTyped,
|
|
1859
|
+
GetCompanyCreditLedgerParamsToJSON: () => GetCompanyCreditLedgerParamsToJSON,
|
|
1860
|
+
GetCompanyCreditLedgerParamsToJSONTyped: () => GetCompanyCreditLedgerParamsToJSONTyped,
|
|
1861
|
+
GetCompanyCreditLedgerResponseFromJSON: () => GetCompanyCreditLedgerResponseFromJSON,
|
|
1862
|
+
GetCompanyCreditLedgerResponseFromJSONTyped: () => GetCompanyCreditLedgerResponseFromJSONTyped,
|
|
1863
|
+
GetCompanyCreditLedgerResponseToJSON: () => GetCompanyCreditLedgerResponseToJSON,
|
|
1864
|
+
GetCompanyCreditLedgerResponseToJSONTyped: () => GetCompanyCreditLedgerResponseToJSONTyped,
|
|
1810
1865
|
GetCompanyCreditUserUsageParamsFromJSON: () => GetCompanyCreditUserUsageParamsFromJSON,
|
|
1811
1866
|
GetCompanyCreditUserUsageParamsFromJSONTyped: () => GetCompanyCreditUserUsageParamsFromJSONTyped,
|
|
1812
1867
|
GetCompanyCreditUserUsageParamsToJSON: () => GetCompanyCreditUserUsageParamsToJSON,
|
|
@@ -1982,6 +2037,7 @@ __export2(models_exports, {
|
|
|
1982
2037
|
instanceOfBillingCreditExpiryType: () => instanceOfBillingCreditExpiryType,
|
|
1983
2038
|
instanceOfBillingCreditExpiryUnit: () => instanceOfBillingCreditExpiryUnit,
|
|
1984
2039
|
instanceOfBillingCreditGrantReason: () => instanceOfBillingCreditGrantReason,
|
|
2040
|
+
instanceOfBillingCreditGrantZeroedOutReason: () => instanceOfBillingCreditGrantZeroedOutReason,
|
|
1985
2041
|
instanceOfBillingPlanCreditGrantResetCadence: () => instanceOfBillingPlanCreditGrantResetCadence,
|
|
1986
2042
|
instanceOfBillingPriceScheme: () => instanceOfBillingPriceScheme,
|
|
1987
2043
|
instanceOfBillingProductPriceInterval: () => instanceOfBillingProductPriceInterval,
|
|
@@ -2034,6 +2090,12 @@ __export2(models_exports, {
|
|
|
2034
2090
|
instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
|
|
2035
2091
|
instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
|
|
2036
2092
|
instanceOfCompanyCreditGrantResponseData: () => instanceOfCompanyCreditGrantResponseData,
|
|
2093
|
+
instanceOfCompanyCreditLedgerBundleResponseData: () => instanceOfCompanyCreditLedgerBundleResponseData,
|
|
2094
|
+
instanceOfCompanyCreditLedgerCreditResponseData: () => instanceOfCompanyCreditLedgerCreditResponseData,
|
|
2095
|
+
instanceOfCompanyCreditLedgerEntryResponseData: () => instanceOfCompanyCreditLedgerEntryResponseData,
|
|
2096
|
+
instanceOfCompanyCreditLedgerFeatureResponseData: () => instanceOfCompanyCreditLedgerFeatureResponseData,
|
|
2097
|
+
instanceOfCompanyCreditLedgerResponseData: () => instanceOfCompanyCreditLedgerResponseData,
|
|
2098
|
+
instanceOfCompanyCreditLedgerUserResponseData: () => instanceOfCompanyCreditLedgerUserResponseData,
|
|
2037
2099
|
instanceOfCompanyCreditUserUsageResponseData: () => instanceOfCompanyCreditUserUsageResponseData,
|
|
2038
2100
|
instanceOfCompanyCreditUserUsageRowResponseData: () => instanceOfCompanyCreditUserUsageRowResponseData,
|
|
2039
2101
|
instanceOfCompanyDiscountResponseData: () => instanceOfCompanyDiscountResponseData,
|
|
@@ -2051,6 +2113,8 @@ __export2(models_exports, {
|
|
|
2051
2113
|
instanceOfCreateCheckoutRequest: () => instanceOfCreateCheckoutRequest,
|
|
2052
2114
|
instanceOfCreateCheckoutResponse: () => instanceOfCreateCheckoutResponse,
|
|
2053
2115
|
instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
|
|
2116
|
+
instanceOfCreditLedgerEntryKind: () => instanceOfCreditLedgerEntryKind,
|
|
2117
|
+
instanceOfCreditUsageReason: () => instanceOfCreditUsageReason,
|
|
2054
2118
|
instanceOfCurrency: () => instanceOfCurrency,
|
|
2055
2119
|
instanceOfCustomPlanActivationStrategy: () => instanceOfCustomPlanActivationStrategy,
|
|
2056
2120
|
instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
|
|
@@ -2066,6 +2130,8 @@ __export2(models_exports, {
|
|
|
2066
2130
|
instanceOfGetCheckoutResponse: () => instanceOfGetCheckoutResponse,
|
|
2067
2131
|
instanceOfGetCheckoutTaxIDResponse: () => instanceOfGetCheckoutTaxIDResponse,
|
|
2068
2132
|
instanceOfGetCompanyCreditBalancesResponse: () => instanceOfGetCompanyCreditBalancesResponse,
|
|
2133
|
+
instanceOfGetCompanyCreditLedgerParams: () => instanceOfGetCompanyCreditLedgerParams,
|
|
2134
|
+
instanceOfGetCompanyCreditLedgerResponse: () => instanceOfGetCompanyCreditLedgerResponse,
|
|
2069
2135
|
instanceOfGetCompanyCreditUserUsageParams: () => instanceOfGetCompanyCreditUserUsageParams,
|
|
2070
2136
|
instanceOfGetCompanyCreditUserUsageResponse: () => instanceOfGetCompanyCreditUserUsageResponse,
|
|
2071
2137
|
instanceOfGetCompanyFeatureUsageResponse: () => instanceOfGetCompanyFeatureUsageResponse,
|
|
@@ -2276,6 +2342,41 @@ function BillingCreditGrantReasonToJSON(value) {
|
|
|
2276
2342
|
function BillingCreditGrantReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
2277
2343
|
return value;
|
|
2278
2344
|
}
|
|
2345
|
+
var BillingCreditGrantZeroedOutReason = {
|
|
2346
|
+
CustomerArchived: "customer_archived",
|
|
2347
|
+
Expired: "expired",
|
|
2348
|
+
IntegrationUninstalled: "integration_uninstalled",
|
|
2349
|
+
LicenseRetired: "license_retired",
|
|
2350
|
+
Manual: "manual",
|
|
2351
|
+
PlanChange: "plan_change",
|
|
2352
|
+
PlanPeriodReset: "plan_period_reset",
|
|
2353
|
+
Reconciled: "reconciled"
|
|
2354
|
+
};
|
|
2355
|
+
function instanceOfBillingCreditGrantZeroedOutReason(value) {
|
|
2356
|
+
for (const key in BillingCreditGrantZeroedOutReason) {
|
|
2357
|
+
if (Object.prototype.hasOwnProperty.call(
|
|
2358
|
+
BillingCreditGrantZeroedOutReason,
|
|
2359
|
+
key
|
|
2360
|
+
)) {
|
|
2361
|
+
if (BillingCreditGrantZeroedOutReason[key] === value) {
|
|
2362
|
+
return true;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
return false;
|
|
2367
|
+
}
|
|
2368
|
+
function BillingCreditGrantZeroedOutReasonFromJSON(json) {
|
|
2369
|
+
return BillingCreditGrantZeroedOutReasonFromJSONTyped(json, false);
|
|
2370
|
+
}
|
|
2371
|
+
function BillingCreditGrantZeroedOutReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
2372
|
+
return json;
|
|
2373
|
+
}
|
|
2374
|
+
function BillingCreditGrantZeroedOutReasonToJSON(value) {
|
|
2375
|
+
return value;
|
|
2376
|
+
}
|
|
2377
|
+
function BillingCreditGrantZeroedOutReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
2378
|
+
return value;
|
|
2379
|
+
}
|
|
2279
2380
|
var BillingPlanCreditGrantResetCadence = {
|
|
2280
2381
|
Daily: "daily",
|
|
2281
2382
|
Every6Months: "every_6_months",
|
|
@@ -4152,7 +4253,8 @@ var CheckoutStatus = {
|
|
|
4152
4253
|
Abandoned: "abandoned",
|
|
4153
4254
|
Completed: "completed",
|
|
4154
4255
|
Expired: "expired",
|
|
4155
|
-
Open: "open"
|
|
4256
|
+
Open: "open",
|
|
4257
|
+
PendingPayment: "pending_payment"
|
|
4156
4258
|
};
|
|
4157
4259
|
function instanceOfCheckoutStatus(value) {
|
|
4158
4260
|
for (const key in CheckoutStatus) {
|
|
@@ -5423,6 +5525,273 @@ function CompanyCreditBalancesResponseDataToJSONTyped(value, ignoreDiscriminator
|
|
|
5423
5525
|
count: value["count"]
|
|
5424
5526
|
};
|
|
5425
5527
|
}
|
|
5528
|
+
function instanceOfCompanyCreditLedgerBundleResponseData(value) {
|
|
5529
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5530
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5531
|
+
return true;
|
|
5532
|
+
}
|
|
5533
|
+
function CompanyCreditLedgerBundleResponseDataFromJSON(json) {
|
|
5534
|
+
return CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, false);
|
|
5535
|
+
}
|
|
5536
|
+
function CompanyCreditLedgerBundleResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5537
|
+
if (json == null) {
|
|
5538
|
+
return json;
|
|
5539
|
+
}
|
|
5540
|
+
return {
|
|
5541
|
+
id: json["id"],
|
|
5542
|
+
name: json["name"]
|
|
5543
|
+
};
|
|
5544
|
+
}
|
|
5545
|
+
function CompanyCreditLedgerBundleResponseDataToJSON(json) {
|
|
5546
|
+
return CompanyCreditLedgerBundleResponseDataToJSONTyped(json, false);
|
|
5547
|
+
}
|
|
5548
|
+
function CompanyCreditLedgerBundleResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5549
|
+
if (value == null) {
|
|
5550
|
+
return value;
|
|
5551
|
+
}
|
|
5552
|
+
return {
|
|
5553
|
+
id: value["id"],
|
|
5554
|
+
name: value["name"]
|
|
5555
|
+
};
|
|
5556
|
+
}
|
|
5557
|
+
function instanceOfCompanyCreditLedgerCreditResponseData(value) {
|
|
5558
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5559
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5560
|
+
return true;
|
|
5561
|
+
}
|
|
5562
|
+
function CompanyCreditLedgerCreditResponseDataFromJSON(json) {
|
|
5563
|
+
return CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, false);
|
|
5564
|
+
}
|
|
5565
|
+
function CompanyCreditLedgerCreditResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5566
|
+
if (json == null) {
|
|
5567
|
+
return json;
|
|
5568
|
+
}
|
|
5569
|
+
return {
|
|
5570
|
+
id: json["id"],
|
|
5571
|
+
name: json["name"],
|
|
5572
|
+
pluralName: json["plural_name"] == null ? void 0 : json["plural_name"],
|
|
5573
|
+
singularName: json["singular_name"] == null ? void 0 : json["singular_name"]
|
|
5574
|
+
};
|
|
5575
|
+
}
|
|
5576
|
+
function CompanyCreditLedgerCreditResponseDataToJSON(json) {
|
|
5577
|
+
return CompanyCreditLedgerCreditResponseDataToJSONTyped(json, false);
|
|
5578
|
+
}
|
|
5579
|
+
function CompanyCreditLedgerCreditResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5580
|
+
if (value == null) {
|
|
5581
|
+
return value;
|
|
5582
|
+
}
|
|
5583
|
+
return {
|
|
5584
|
+
id: value["id"],
|
|
5585
|
+
name: value["name"],
|
|
5586
|
+
plural_name: value["pluralName"],
|
|
5587
|
+
singular_name: value["singularName"]
|
|
5588
|
+
};
|
|
5589
|
+
}
|
|
5590
|
+
var CreditUsageReason = {
|
|
5591
|
+
Inference: "inference",
|
|
5592
|
+
LeaseHold: "lease_hold",
|
|
5593
|
+
LeaseRelease: "lease_release",
|
|
5594
|
+
ManualAdjustment: "manual_adjustment",
|
|
5595
|
+
Reconciliation: "reconciliation",
|
|
5596
|
+
ReservationHold: "reservation_hold",
|
|
5597
|
+
ReservationRelease: "reservation_release",
|
|
5598
|
+
Track: "track"
|
|
5599
|
+
};
|
|
5600
|
+
function instanceOfCreditUsageReason(value) {
|
|
5601
|
+
for (const key in CreditUsageReason) {
|
|
5602
|
+
if (Object.prototype.hasOwnProperty.call(CreditUsageReason, key)) {
|
|
5603
|
+
if (CreditUsageReason[key] === value) {
|
|
5604
|
+
return true;
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5607
|
+
}
|
|
5608
|
+
return false;
|
|
5609
|
+
}
|
|
5610
|
+
function CreditUsageReasonFromJSON(json) {
|
|
5611
|
+
return CreditUsageReasonFromJSONTyped(json, false);
|
|
5612
|
+
}
|
|
5613
|
+
function CreditUsageReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
5614
|
+
return json;
|
|
5615
|
+
}
|
|
5616
|
+
function CreditUsageReasonToJSON(value) {
|
|
5617
|
+
return value;
|
|
5618
|
+
}
|
|
5619
|
+
function CreditUsageReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
5620
|
+
return value;
|
|
5621
|
+
}
|
|
5622
|
+
function instanceOfCompanyCreditLedgerUserResponseData(value) {
|
|
5623
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5624
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5625
|
+
return true;
|
|
5626
|
+
}
|
|
5627
|
+
function CompanyCreditLedgerUserResponseDataFromJSON(json) {
|
|
5628
|
+
return CompanyCreditLedgerUserResponseDataFromJSONTyped(json, false);
|
|
5629
|
+
}
|
|
5630
|
+
function CompanyCreditLedgerUserResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5631
|
+
if (json == null) {
|
|
5632
|
+
return json;
|
|
5633
|
+
}
|
|
5634
|
+
return {
|
|
5635
|
+
id: json["id"],
|
|
5636
|
+
name: json["name"]
|
|
5637
|
+
};
|
|
5638
|
+
}
|
|
5639
|
+
function CompanyCreditLedgerUserResponseDataToJSON(json) {
|
|
5640
|
+
return CompanyCreditLedgerUserResponseDataToJSONTyped(json, false);
|
|
5641
|
+
}
|
|
5642
|
+
function CompanyCreditLedgerUserResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5643
|
+
if (value == null) {
|
|
5644
|
+
return value;
|
|
5645
|
+
}
|
|
5646
|
+
return {
|
|
5647
|
+
id: value["id"],
|
|
5648
|
+
name: value["name"]
|
|
5649
|
+
};
|
|
5650
|
+
}
|
|
5651
|
+
function instanceOfCompanyCreditLedgerFeatureResponseData(value) {
|
|
5652
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5653
|
+
if (!("name" in value) || value["name"] === void 0) return false;
|
|
5654
|
+
return true;
|
|
5655
|
+
}
|
|
5656
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSON(json) {
|
|
5657
|
+
return CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, false);
|
|
5658
|
+
}
|
|
5659
|
+
function CompanyCreditLedgerFeatureResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5660
|
+
if (json == null) {
|
|
5661
|
+
return json;
|
|
5662
|
+
}
|
|
5663
|
+
return {
|
|
5664
|
+
id: json["id"],
|
|
5665
|
+
name: json["name"]
|
|
5666
|
+
};
|
|
5667
|
+
}
|
|
5668
|
+
function CompanyCreditLedgerFeatureResponseDataToJSON(json) {
|
|
5669
|
+
return CompanyCreditLedgerFeatureResponseDataToJSONTyped(json, false);
|
|
5670
|
+
}
|
|
5671
|
+
function CompanyCreditLedgerFeatureResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5672
|
+
if (value == null) {
|
|
5673
|
+
return value;
|
|
5674
|
+
}
|
|
5675
|
+
return {
|
|
5676
|
+
id: value["id"],
|
|
5677
|
+
name: value["name"]
|
|
5678
|
+
};
|
|
5679
|
+
}
|
|
5680
|
+
var CreditLedgerEntryKind = {
|
|
5681
|
+
Adjustment: "adjustment",
|
|
5682
|
+
Charge: "charge",
|
|
5683
|
+
Drawdown: "drawdown",
|
|
5684
|
+
Grant: "grant",
|
|
5685
|
+
Settlement: "settlement",
|
|
5686
|
+
Transfer: "transfer",
|
|
5687
|
+
ZeroOut: "zero_out"
|
|
5688
|
+
};
|
|
5689
|
+
function instanceOfCreditLedgerEntryKind(value) {
|
|
5690
|
+
for (const key in CreditLedgerEntryKind) {
|
|
5691
|
+
if (Object.prototype.hasOwnProperty.call(CreditLedgerEntryKind, key)) {
|
|
5692
|
+
if (CreditLedgerEntryKind[key] === value) {
|
|
5693
|
+
return true;
|
|
5694
|
+
}
|
|
5695
|
+
}
|
|
5696
|
+
}
|
|
5697
|
+
return false;
|
|
5698
|
+
}
|
|
5699
|
+
function CreditLedgerEntryKindFromJSON(json) {
|
|
5700
|
+
return CreditLedgerEntryKindFromJSONTyped(json, false);
|
|
5701
|
+
}
|
|
5702
|
+
function CreditLedgerEntryKindFromJSONTyped(json, ignoreDiscriminator) {
|
|
5703
|
+
return json;
|
|
5704
|
+
}
|
|
5705
|
+
function CreditLedgerEntryKindToJSON(value) {
|
|
5706
|
+
return value;
|
|
5707
|
+
}
|
|
5708
|
+
function CreditLedgerEntryKindToJSONTyped(value, ignoreDiscriminator) {
|
|
5709
|
+
return value;
|
|
5710
|
+
}
|
|
5711
|
+
function instanceOfCompanyCreditLedgerEntryResponseData(value) {
|
|
5712
|
+
if (!("amount" in value) || value["amount"] === void 0) return false;
|
|
5713
|
+
if (!("credit" in value) || value["credit"] === void 0) return false;
|
|
5714
|
+
if (!("eventAt" in value) || value["eventAt"] === void 0) return false;
|
|
5715
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
5716
|
+
if (!("kind" in value) || value["kind"] === void 0) return false;
|
|
5717
|
+
return true;
|
|
5718
|
+
}
|
|
5719
|
+
function CompanyCreditLedgerEntryResponseDataFromJSON(json) {
|
|
5720
|
+
return CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, false);
|
|
5721
|
+
}
|
|
5722
|
+
function CompanyCreditLedgerEntryResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5723
|
+
if (json == null) {
|
|
5724
|
+
return json;
|
|
5725
|
+
}
|
|
5726
|
+
return {
|
|
5727
|
+
amount: json["amount"],
|
|
5728
|
+
bundle: json["bundle"] == null ? void 0 : CompanyCreditLedgerBundleResponseDataFromJSON(json["bundle"]),
|
|
5729
|
+
credit: CompanyCreditLedgerCreditResponseDataFromJSON(json["credit"]),
|
|
5730
|
+
eventAt: new Date(json["event_at"]),
|
|
5731
|
+
feature: json["feature"] == null ? void 0 : CompanyCreditLedgerFeatureResponseDataFromJSON(json["feature"]),
|
|
5732
|
+
grantReason: json["grant_reason"] == null ? void 0 : BillingCreditGrantReasonFromJSON(json["grant_reason"]),
|
|
5733
|
+
id: json["id"],
|
|
5734
|
+
kind: CreditLedgerEntryKindFromJSON(json["kind"]),
|
|
5735
|
+
usageReason: json["usage_reason"] == null ? void 0 : CreditUsageReasonFromJSON(json["usage_reason"]),
|
|
5736
|
+
user: json["user"] == null ? void 0 : CompanyCreditLedgerUserResponseDataFromJSON(json["user"]),
|
|
5737
|
+
zeroedOutReason: json["zeroed_out_reason"] == null ? void 0 : BillingCreditGrantZeroedOutReasonFromJSON(json["zeroed_out_reason"])
|
|
5738
|
+
};
|
|
5739
|
+
}
|
|
5740
|
+
function CompanyCreditLedgerEntryResponseDataToJSON(json) {
|
|
5741
|
+
return CompanyCreditLedgerEntryResponseDataToJSONTyped(json, false);
|
|
5742
|
+
}
|
|
5743
|
+
function CompanyCreditLedgerEntryResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5744
|
+
if (value == null) {
|
|
5745
|
+
return value;
|
|
5746
|
+
}
|
|
5747
|
+
return {
|
|
5748
|
+
amount: value["amount"],
|
|
5749
|
+
bundle: CompanyCreditLedgerBundleResponseDataToJSON(value["bundle"]),
|
|
5750
|
+
credit: CompanyCreditLedgerCreditResponseDataToJSON(value["credit"]),
|
|
5751
|
+
event_at: value["eventAt"].toISOString(),
|
|
5752
|
+
feature: CompanyCreditLedgerFeatureResponseDataToJSON(value["feature"]),
|
|
5753
|
+
grant_reason: BillingCreditGrantReasonToJSON(value["grantReason"]),
|
|
5754
|
+
id: value["id"],
|
|
5755
|
+
kind: CreditLedgerEntryKindToJSON(value["kind"]),
|
|
5756
|
+
usage_reason: CreditUsageReasonToJSON(value["usageReason"]),
|
|
5757
|
+
user: CompanyCreditLedgerUserResponseDataToJSON(value["user"]),
|
|
5758
|
+
zeroed_out_reason: BillingCreditGrantZeroedOutReasonToJSON(
|
|
5759
|
+
value["zeroedOutReason"]
|
|
5760
|
+
)
|
|
5761
|
+
};
|
|
5762
|
+
}
|
|
5763
|
+
function instanceOfCompanyCreditLedgerResponseData(value) {
|
|
5764
|
+
if (!("entries" in value) || value["entries"] === void 0) return false;
|
|
5765
|
+
return true;
|
|
5766
|
+
}
|
|
5767
|
+
function CompanyCreditLedgerResponseDataFromJSON(json) {
|
|
5768
|
+
return CompanyCreditLedgerResponseDataFromJSONTyped(json, false);
|
|
5769
|
+
}
|
|
5770
|
+
function CompanyCreditLedgerResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
5771
|
+
if (json == null) {
|
|
5772
|
+
return json;
|
|
5773
|
+
}
|
|
5774
|
+
return {
|
|
5775
|
+
entries: json["entries"].map(
|
|
5776
|
+
CompanyCreditLedgerEntryResponseDataFromJSON
|
|
5777
|
+
),
|
|
5778
|
+
nextCursor: json["next_cursor"] == null ? void 0 : json["next_cursor"]
|
|
5779
|
+
};
|
|
5780
|
+
}
|
|
5781
|
+
function CompanyCreditLedgerResponseDataToJSON(json) {
|
|
5782
|
+
return CompanyCreditLedgerResponseDataToJSONTyped(json, false);
|
|
5783
|
+
}
|
|
5784
|
+
function CompanyCreditLedgerResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
5785
|
+
if (value == null) {
|
|
5786
|
+
return value;
|
|
5787
|
+
}
|
|
5788
|
+
return {
|
|
5789
|
+
entries: value["entries"].map(
|
|
5790
|
+
CompanyCreditLedgerEntryResponseDataToJSON
|
|
5791
|
+
),
|
|
5792
|
+
next_cursor: value["nextCursor"]
|
|
5793
|
+
};
|
|
5794
|
+
}
|
|
5426
5795
|
function instanceOfCompanyCreditUserUsageRowResponseData(value) {
|
|
5427
5796
|
if (!("share" in value) || value["share"] === void 0) return false;
|
|
5428
5797
|
if (!("used" in value) || value["used"] === void 0) return false;
|
|
@@ -6501,6 +6870,66 @@ function GetCompanyCreditBalancesResponseToJSONTyped(value, ignoreDiscriminator
|
|
|
6501
6870
|
params: value["params"]
|
|
6502
6871
|
};
|
|
6503
6872
|
}
|
|
6873
|
+
function instanceOfGetCompanyCreditLedgerParams(value) {
|
|
6874
|
+
return true;
|
|
6875
|
+
}
|
|
6876
|
+
function GetCompanyCreditLedgerParamsFromJSON(json) {
|
|
6877
|
+
return GetCompanyCreditLedgerParamsFromJSONTyped(json, false);
|
|
6878
|
+
}
|
|
6879
|
+
function GetCompanyCreditLedgerParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
6880
|
+
if (json == null) {
|
|
6881
|
+
return json;
|
|
6882
|
+
}
|
|
6883
|
+
return {
|
|
6884
|
+
creditIds: json["credit_ids"] == null ? void 0 : json["credit_ids"],
|
|
6885
|
+
cursor: json["cursor"] == null ? void 0 : json["cursor"],
|
|
6886
|
+
includeGrants: json["include_grants"] == null ? void 0 : json["include_grants"],
|
|
6887
|
+
limit: json["limit"] == null ? void 0 : json["limit"]
|
|
6888
|
+
};
|
|
6889
|
+
}
|
|
6890
|
+
function GetCompanyCreditLedgerParamsToJSON(json) {
|
|
6891
|
+
return GetCompanyCreditLedgerParamsToJSONTyped(json, false);
|
|
6892
|
+
}
|
|
6893
|
+
function GetCompanyCreditLedgerParamsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6894
|
+
if (value == null) {
|
|
6895
|
+
return value;
|
|
6896
|
+
}
|
|
6897
|
+
return {
|
|
6898
|
+
credit_ids: value["creditIds"],
|
|
6899
|
+
cursor: value["cursor"],
|
|
6900
|
+
include_grants: value["includeGrants"],
|
|
6901
|
+
limit: value["limit"]
|
|
6902
|
+
};
|
|
6903
|
+
}
|
|
6904
|
+
function instanceOfGetCompanyCreditLedgerResponse(value) {
|
|
6905
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
6906
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
6907
|
+
return true;
|
|
6908
|
+
}
|
|
6909
|
+
function GetCompanyCreditLedgerResponseFromJSON(json) {
|
|
6910
|
+
return GetCompanyCreditLedgerResponseFromJSONTyped(json, false);
|
|
6911
|
+
}
|
|
6912
|
+
function GetCompanyCreditLedgerResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
6913
|
+
if (json == null) {
|
|
6914
|
+
return json;
|
|
6915
|
+
}
|
|
6916
|
+
return {
|
|
6917
|
+
data: CompanyCreditLedgerResponseDataFromJSON(json["data"]),
|
|
6918
|
+
params: GetCompanyCreditLedgerParamsFromJSON(json["params"])
|
|
6919
|
+
};
|
|
6920
|
+
}
|
|
6921
|
+
function GetCompanyCreditLedgerResponseToJSON(json) {
|
|
6922
|
+
return GetCompanyCreditLedgerResponseToJSONTyped(json, false);
|
|
6923
|
+
}
|
|
6924
|
+
function GetCompanyCreditLedgerResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
6925
|
+
if (value == null) {
|
|
6926
|
+
return value;
|
|
6927
|
+
}
|
|
6928
|
+
return {
|
|
6929
|
+
data: CompanyCreditLedgerResponseDataToJSON(value["data"]),
|
|
6930
|
+
params: GetCompanyCreditLedgerParamsToJSON(value["params"])
|
|
6931
|
+
};
|
|
6932
|
+
}
|
|
6504
6933
|
function instanceOfGetCompanyCreditUserUsageParams(value) {
|
|
6505
6934
|
return true;
|
|
6506
6935
|
}
|
|
@@ -7763,6 +8192,18 @@ function checkoutProblemsOf(error) {
|
|
|
7763
8192
|
}
|
|
7764
8193
|
return body.problems.map((p) => CheckoutProblemResponseDataFromJSON(p));
|
|
7765
8194
|
}
|
|
8195
|
+
var DEFAULT_CREDIT_LEDGER_QUERY = {};
|
|
8196
|
+
function normalizeCreditLedgerQuery(query) {
|
|
8197
|
+
const { credits, includeGrants, ...rest } = query;
|
|
8198
|
+
const normalized = { ...rest };
|
|
8199
|
+
if (credits !== void 0 && credits.length > 0) {
|
|
8200
|
+
normalized.credits = [...new Set(credits)].sort();
|
|
8201
|
+
}
|
|
8202
|
+
if (includeGrants === false) {
|
|
8203
|
+
normalized.includeGrants = false;
|
|
8204
|
+
}
|
|
8205
|
+
return normalized;
|
|
8206
|
+
}
|
|
7766
8207
|
var SINGLETON = {};
|
|
7767
8208
|
var DEFAULT_INVOICE_QUERY = {};
|
|
7768
8209
|
function normalizeInvoiceQuery(query) {
|
|
@@ -8052,6 +8493,7 @@ function dataOf(body, path) {
|
|
|
8052
8493
|
return body.data;
|
|
8053
8494
|
}
|
|
8054
8495
|
var INVOICE_PAGE_SIZE = 12;
|
|
8496
|
+
var CREDIT_LEDGER_PAGE_SIZE = 20;
|
|
8055
8497
|
var INVOICE_MAX_PAGE_SIZE = 250;
|
|
8056
8498
|
var SchematicBillingClient = class {
|
|
8057
8499
|
/**
|
|
@@ -8239,6 +8681,32 @@ var SchematicBillingClient = class {
|
|
|
8239
8681
|
return GetCompanyCreditBalancesResponseFromJSON(body).data.balances;
|
|
8240
8682
|
});
|
|
8241
8683
|
}
|
|
8684
|
+
fetchCreditLedger(params) {
|
|
8685
|
+
const query = new URLSearchParams({
|
|
8686
|
+
limit: String(Math.min(params.limit, INVOICE_MAX_PAGE_SIZE))
|
|
8687
|
+
});
|
|
8688
|
+
if (params.cursor !== void 0) {
|
|
8689
|
+
query.set("cursor", params.cursor);
|
|
8690
|
+
}
|
|
8691
|
+
for (const credit of params.credits ?? []) {
|
|
8692
|
+
query.append("credit_ids", credit);
|
|
8693
|
+
}
|
|
8694
|
+
if (params.includeGrants !== void 0) {
|
|
8695
|
+
query.set("include_grants", String(params.includeGrants));
|
|
8696
|
+
}
|
|
8697
|
+
const path = `/company/credits/ledger?${query}`;
|
|
8698
|
+
return this.session.request(path).then((body) => {
|
|
8699
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
8700
|
+
throw new Error(`Malformed response from ${path}`);
|
|
8701
|
+
}
|
|
8702
|
+
const data = body.data;
|
|
8703
|
+
if (data == null || data.entries == null) {
|
|
8704
|
+
return { entries: [] };
|
|
8705
|
+
}
|
|
8706
|
+
const { entries, nextCursor } = GetCompanyCreditLedgerResponseFromJSON(body).data;
|
|
8707
|
+
return nextCursor == null ? { entries } : { entries, nextCursor };
|
|
8708
|
+
});
|
|
8709
|
+
}
|
|
8242
8710
|
fetchCreditUserUsage(params) {
|
|
8243
8711
|
const query = new URLSearchParams();
|
|
8244
8712
|
if (params.limit !== void 0) {
|
|
@@ -10174,6 +10642,13 @@ function normalizeCatalogQuery2(query) {
|
|
|
10174
10642
|
const { catalogId } = normalizeCatalogQuery(query);
|
|
10175
10643
|
return catalogId === void 0 ? {} : { catalogId };
|
|
10176
10644
|
}
|
|
10645
|
+
function normalizeCreditLedgerQuery2(query) {
|
|
10646
|
+
const { credits, includeGrants } = normalizeCreditLedgerQuery(query);
|
|
10647
|
+
return {
|
|
10648
|
+
...credits === void 0 ? {} : { credits },
|
|
10649
|
+
...includeGrants === void 0 ? {} : { includeGrants }
|
|
10650
|
+
};
|
|
10651
|
+
}
|
|
10177
10652
|
|
|
10178
10653
|
// src/billing/store.ts
|
|
10179
10654
|
var Resource = class {
|
|
@@ -10586,6 +11061,13 @@ var BillingStore = class {
|
|
|
10586
11061
|
() => this._client.fetchCreditBalances(),
|
|
10587
11062
|
{ readiness }
|
|
10588
11063
|
);
|
|
11064
|
+
this.creditLedger = new KeyedResource(
|
|
11065
|
+
(query, current) => this._reloadCreditLedgerWindow(
|
|
11066
|
+
query,
|
|
11067
|
+
Math.max(CREDIT_LEDGER_PAGE_SIZE, current?.entries.length ?? 0)
|
|
11068
|
+
),
|
|
11069
|
+
{ readiness }
|
|
11070
|
+
);
|
|
10589
11071
|
this.company = new KeyedResource(() => this._client.fetchCompany(), {
|
|
10590
11072
|
readiness
|
|
10591
11073
|
});
|
|
@@ -10627,13 +11109,21 @@ var BillingStore = class {
|
|
|
10627
11109
|
if (initialData.creditBalances !== void 0) {
|
|
10628
11110
|
held.creditBalances = initialData.creditBalances;
|
|
10629
11111
|
}
|
|
11112
|
+
if (initialData.creditLedger !== void 0) {
|
|
11113
|
+
held.creditLedger = {
|
|
11114
|
+
params: normalizeCreditLedgerQuery2(
|
|
11115
|
+
initialData.params?.creditLedger ?? DEFAULT_CREDIT_LEDGER_QUERY
|
|
11116
|
+
),
|
|
11117
|
+
data: initialData.creditLedger
|
|
11118
|
+
};
|
|
11119
|
+
}
|
|
10630
11120
|
if (initialData.company !== void 0) {
|
|
10631
11121
|
held.company = initialData.company;
|
|
10632
11122
|
}
|
|
10633
11123
|
if (initialData.taxIds !== void 0) {
|
|
10634
11124
|
held.taxIds = initialData.taxIds;
|
|
10635
11125
|
}
|
|
10636
|
-
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) {
|
|
11126
|
+
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) {
|
|
10637
11127
|
this._held = held;
|
|
10638
11128
|
this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
|
|
10639
11129
|
}
|
|
@@ -10646,6 +11136,7 @@ var BillingStore = class {
|
|
|
10646
11136
|
paymentMethods;
|
|
10647
11137
|
featureUsage;
|
|
10648
11138
|
creditBalances;
|
|
11139
|
+
creditLedger;
|
|
10649
11140
|
company;
|
|
10650
11141
|
creditUserUsage;
|
|
10651
11142
|
taxIds;
|
|
@@ -10738,6 +11229,12 @@ var BillingStore = class {
|
|
|
10738
11229
|
if (held.creditBalances !== void 0) {
|
|
10739
11230
|
this.creditBalances.seed(SINGLETON, held.creditBalances);
|
|
10740
11231
|
}
|
|
11232
|
+
if (held.creditLedger !== void 0) {
|
|
11233
|
+
this.creditLedger.seed(
|
|
11234
|
+
held.creditLedger.params,
|
|
11235
|
+
held.creditLedger.data
|
|
11236
|
+
);
|
|
11237
|
+
}
|
|
10741
11238
|
if (held.company !== void 0) {
|
|
10742
11239
|
this.company.seed(SINGLETON, held.company);
|
|
10743
11240
|
}
|
|
@@ -10822,6 +11319,31 @@ var BillingStore = class {
|
|
|
10822
11319
|
};
|
|
10823
11320
|
});
|
|
10824
11321
|
}
|
|
11322
|
+
/**
|
|
11323
|
+
* Appends the next page to the credit ledger for `query`, as
|
|
11324
|
+
* `loadMoreInvoices` does for invoices.
|
|
11325
|
+
*/
|
|
11326
|
+
loadMoreCreditLedger(query = DEFAULT_CREDIT_LEDGER_QUERY) {
|
|
11327
|
+
const params = normalizeCreditLedgerQuery2(query);
|
|
11328
|
+
const resource = this.creditLedger.get(params);
|
|
11329
|
+
if (resource.snapshot.data?.nextCursor === void 0) {
|
|
11330
|
+
return Promise.resolve();
|
|
11331
|
+
}
|
|
11332
|
+
return resource.extend(async (current) => {
|
|
11333
|
+
if (current.nextCursor === void 0) {
|
|
11334
|
+
return current;
|
|
11335
|
+
}
|
|
11336
|
+
const page = await this._client.fetchCreditLedger({
|
|
11337
|
+
...params,
|
|
11338
|
+
cursor: current.nextCursor,
|
|
11339
|
+
limit: CREDIT_LEDGER_PAGE_SIZE
|
|
11340
|
+
});
|
|
11341
|
+
return creditLedgerPage(
|
|
11342
|
+
[...current.entries, ...page.entries],
|
|
11343
|
+
page.entries.length > 0 ? page.nextCursor : void 0
|
|
11344
|
+
);
|
|
11345
|
+
});
|
|
11346
|
+
}
|
|
10825
11347
|
/**
|
|
10826
11348
|
* Makes the payment method `externalId` the company's default, then
|
|
10827
11349
|
* reloads the list so it says so. Rejects with the client's error when
|
|
@@ -10941,6 +11463,24 @@ var BillingStore = class {
|
|
|
10941
11463
|
hasMore: invoices.length > 0 && invoices.length < count
|
|
10942
11464
|
};
|
|
10943
11465
|
}
|
|
11466
|
+
/**
|
|
11467
|
+
* `_reloadWindow` for the credit ledger: re-reads from the newest entry,
|
|
11468
|
+
* following cursors until it has as many rows as were loaded.
|
|
11469
|
+
*/
|
|
11470
|
+
async _reloadCreditLedgerWindow(query, window2) {
|
|
11471
|
+
const entries = [];
|
|
11472
|
+
let cursor;
|
|
11473
|
+
do {
|
|
11474
|
+
const page = await this._client.fetchCreditLedger({
|
|
11475
|
+
...query,
|
|
11476
|
+
...cursor === void 0 ? {} : { cursor },
|
|
11477
|
+
limit: Math.min(INVOICE_MAX_PAGE_SIZE, window2 - entries.length)
|
|
11478
|
+
});
|
|
11479
|
+
entries.push(...page.entries);
|
|
11480
|
+
cursor = page.entries.length > 0 ? page.nextCursor : void 0;
|
|
11481
|
+
} while (cursor !== void 0 && entries.length < window2);
|
|
11482
|
+
return creditLedgerPage(entries, cursor);
|
|
11483
|
+
}
|
|
10944
11484
|
/**
|
|
10945
11485
|
* Returns what the server said and nothing more: whether there is more to
|
|
10946
11486
|
* load depends on the whole window, which only the caller assembling it
|
|
@@ -10958,9 +11498,13 @@ var RESOURCE_NAMES = [
|
|
|
10958
11498
|
"paymentMethods",
|
|
10959
11499
|
"featureUsage",
|
|
10960
11500
|
"creditBalances",
|
|
11501
|
+
"creditLedger",
|
|
10961
11502
|
"company",
|
|
10962
11503
|
"taxIds"
|
|
10963
11504
|
];
|
|
11505
|
+
function creditLedgerPage(entries, nextCursor) {
|
|
11506
|
+
return nextCursor === void 0 ? { entries } : { entries, nextCursor };
|
|
11507
|
+
}
|
|
10964
11508
|
|
|
10965
11509
|
// src/billing/context.tsx
|
|
10966
11510
|
var import_react2 = require("react");
|
|
@@ -11056,6 +11600,7 @@ var missingBillingSource = {
|
|
|
11056
11600
|
},
|
|
11057
11601
|
creditUserUsage: () => missingHandle,
|
|
11058
11602
|
loadMoreInvoices: () => Promise.resolve(),
|
|
11603
|
+
loadMoreCreditLedger: () => Promise.resolve(),
|
|
11059
11604
|
invalidateAll: () => {
|
|
11060
11605
|
},
|
|
11061
11606
|
// The same error a read reports, so a write outside any provider names
|
|
@@ -11072,6 +11617,7 @@ function BillingDataProvider({
|
|
|
11072
11617
|
data,
|
|
11073
11618
|
featureUserUsage,
|
|
11074
11619
|
locale,
|
|
11620
|
+
onLoadMoreCreditLedger,
|
|
11075
11621
|
onLoadMoreInvoices,
|
|
11076
11622
|
onMissingString,
|
|
11077
11623
|
onRefetch,
|
|
@@ -11146,6 +11692,10 @@ function BillingDataProvider({
|
|
|
11146
11692
|
onLoadMoreInvoices?.(query);
|
|
11147
11693
|
return Promise.resolve();
|
|
11148
11694
|
},
|
|
11695
|
+
loadMoreCreditLedger: (query) => {
|
|
11696
|
+
onLoadMoreCreditLedger?.(query);
|
|
11697
|
+
return Promise.resolve();
|
|
11698
|
+
},
|
|
11149
11699
|
invalidateAll: () => {
|
|
11150
11700
|
},
|
|
11151
11701
|
catalogSource: () => catalogSourceOf(data)
|
|
@@ -11155,6 +11705,7 @@ function BillingDataProvider({
|
|
|
11155
11705
|
creditUserUsage,
|
|
11156
11706
|
data,
|
|
11157
11707
|
featureUserUsage,
|
|
11708
|
+
onLoadMoreCreditLedger,
|
|
11158
11709
|
onLoadMoreInvoices,
|
|
11159
11710
|
onRefetch,
|
|
11160
11711
|
status
|
|
@@ -11393,6 +11944,16 @@ function useCheckout(options = {}) {
|
|
|
11393
11944
|
[finalize, reset, setSelections, state]
|
|
11394
11945
|
);
|
|
11395
11946
|
}
|
|
11947
|
+
function useCreditLedger(query = DEFAULT_CREDIT_LEDGER_QUERY) {
|
|
11948
|
+
const source = useBillingDataSource();
|
|
11949
|
+
const params = useStableParams(normalizeCreditLedgerQuery2(query));
|
|
11950
|
+
const handle = useBillingResource("creditLedger", params);
|
|
11951
|
+
const loadMore = (0, import_react3.useCallback)(
|
|
11952
|
+
() => source.loadMoreCreditLedger(params),
|
|
11953
|
+
[params, source]
|
|
11954
|
+
);
|
|
11955
|
+
return (0, import_react3.useMemo)(() => ({ ...handle, loadMore }), [handle, loadMore]);
|
|
11956
|
+
}
|
|
11396
11957
|
function useInvalidateBillingData() {
|
|
11397
11958
|
return useBillingDataSource().invalidateAll;
|
|
11398
11959
|
}
|
|
@@ -11496,6 +12057,7 @@ function BillingProvider({
|
|
|
11496
12057
|
subscribeCreditUserUsage: (creditId, listener) => store.creditUserUsage.subscribe({ creditId }, listener),
|
|
11497
12058
|
creditUserUsage: (creditId) => handleOf(store.creditUserUsage.get({ creditId })),
|
|
11498
12059
|
loadMoreInvoices: (query) => store.loadMoreInvoices(query),
|
|
12060
|
+
loadMoreCreditLedger: (query) => store.loadMoreCreditLedger(query),
|
|
11499
12061
|
invalidateAll: () => store.invalidateAll(),
|
|
11500
12062
|
actions: {
|
|
11501
12063
|
setDefaultPaymentMethod: (externalId) => store.setDefaultPaymentMethod(externalId),
|
|
@@ -11570,6 +12132,7 @@ function staticSource(data) {
|
|
|
11570
12132
|
return next;
|
|
11571
12133
|
},
|
|
11572
12134
|
loadMoreInvoices: () => Promise.resolve(),
|
|
12135
|
+
loadMoreCreditLedger: () => Promise.resolve(),
|
|
11573
12136
|
invalidateAll: () => {
|
|
11574
12137
|
},
|
|
11575
12138
|
catalogSource: () => catalogSourceOf(data)
|
|
@@ -11577,7 +12140,7 @@ function staticSource(data) {
|
|
|
11577
12140
|
}
|
|
11578
12141
|
|
|
11579
12142
|
// src/version.ts
|
|
11580
|
-
var version2 = "1.
|
|
12143
|
+
var version2 = "1.19.0";
|
|
11581
12144
|
|
|
11582
12145
|
// src/context/schematic.tsx
|
|
11583
12146
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|