@schematichq/schematic-react 1.11.0 → 1.12.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 +582 -6
- package/dist/schematic-react.d.ts +515 -3
- package/dist/schematic-react.esm.js +582 -6
- package/package.json +4 -4
|
@@ -46,6 +46,8 @@ __export(index_exports, {
|
|
|
46
46
|
UsagePeriod: () => UsagePeriod,
|
|
47
47
|
normalizeInvoiceQuery: () => normalizeInvoiceQuery2,
|
|
48
48
|
useBillingDataSource: () => useBillingDataSource,
|
|
49
|
+
useCreditBalances: () => useCreditBalances,
|
|
50
|
+
useCreditUserUsage: () => useCreditUserUsage,
|
|
49
51
|
useFeatureUsage: () => useFeatureUsage,
|
|
50
52
|
useFeatureUserUsage: () => useFeatureUserUsage,
|
|
51
53
|
useInvalidateBillingData: () => useInvalidateBillingData,
|
|
@@ -69,7 +71,7 @@ __export(index_exports, {
|
|
|
69
71
|
});
|
|
70
72
|
module.exports = __toCommonJS(index_exports);
|
|
71
73
|
|
|
72
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
74
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.12.0/node_modules/@schematichq/schematic-js/dist/schematic.esm.js
|
|
73
75
|
var __create2 = Object.create;
|
|
74
76
|
var __defProp2 = Object.defineProperty;
|
|
75
77
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
@@ -729,6 +731,7 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
729
731
|
metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON(json["metric_period"]),
|
|
730
732
|
metricResetAt: json["metric_reset_at"] == null ? void 0 : new Date(json["metric_reset_at"]),
|
|
731
733
|
monthReset: json["month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON(json["month_reset"]),
|
|
734
|
+
quantityRates: json["quantity_rates"] == null ? void 0 : json["quantity_rates"],
|
|
732
735
|
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
733
736
|
usage: json["usage"] == null ? void 0 : json["usage"],
|
|
734
737
|
valueType: EntitlementValueTypeFromJSON(json["value_type"]),
|
|
@@ -1396,7 +1399,7 @@ var ContextSignatureManager = class {
|
|
|
1396
1399
|
}
|
|
1397
1400
|
}
|
|
1398
1401
|
};
|
|
1399
|
-
var version = "1.
|
|
1402
|
+
var version = "1.12.0";
|
|
1400
1403
|
var SINGLETON = {};
|
|
1401
1404
|
var models_exports = {};
|
|
1402
1405
|
__export2(models_exports, {
|
|
@@ -1404,6 +1407,11 @@ __export2(models_exports, {
|
|
|
1404
1407
|
ApiErrorFromJSONTyped: () => ApiErrorFromJSONTyped,
|
|
1405
1408
|
ApiErrorToJSON: () => ApiErrorToJSON,
|
|
1406
1409
|
ApiErrorToJSONTyped: () => ApiErrorToJSONTyped,
|
|
1410
|
+
BillingCreditGrantReason: () => BillingCreditGrantReason,
|
|
1411
|
+
BillingCreditGrantReasonFromJSON: () => BillingCreditGrantReasonFromJSON,
|
|
1412
|
+
BillingCreditGrantReasonFromJSONTyped: () => BillingCreditGrantReasonFromJSONTyped,
|
|
1413
|
+
BillingCreditGrantReasonToJSON: () => BillingCreditGrantReasonToJSON,
|
|
1414
|
+
BillingCreditGrantReasonToJSONTyped: () => BillingCreditGrantReasonToJSONTyped,
|
|
1407
1415
|
BillingPlanCreditGrantResetCadence: () => BillingPlanCreditGrantResetCadence,
|
|
1408
1416
|
BillingPlanCreditGrantResetCadenceFromJSON: () => BillingPlanCreditGrantResetCadenceFromJSON2,
|
|
1409
1417
|
BillingPlanCreditGrantResetCadenceFromJSONTyped: () => BillingPlanCreditGrantResetCadenceFromJSONTyped3,
|
|
@@ -1441,6 +1449,30 @@ __export2(models_exports, {
|
|
|
1441
1449
|
CatalogPriceTierResponseDataFromJSONTyped: () => CatalogPriceTierResponseDataFromJSONTyped,
|
|
1442
1450
|
CatalogPriceTierResponseDataToJSON: () => CatalogPriceTierResponseDataToJSON,
|
|
1443
1451
|
CatalogPriceTierResponseDataToJSONTyped: () => CatalogPriceTierResponseDataToJSONTyped,
|
|
1452
|
+
CompanyCreditBalanceResponseDataFromJSON: () => CompanyCreditBalanceResponseDataFromJSON,
|
|
1453
|
+
CompanyCreditBalanceResponseDataFromJSONTyped: () => CompanyCreditBalanceResponseDataFromJSONTyped,
|
|
1454
|
+
CompanyCreditBalanceResponseDataToJSON: () => CompanyCreditBalanceResponseDataToJSON,
|
|
1455
|
+
CompanyCreditBalanceResponseDataToJSONTyped: () => CompanyCreditBalanceResponseDataToJSONTyped,
|
|
1456
|
+
CompanyCreditBalancesResponseDataFromJSON: () => CompanyCreditBalancesResponseDataFromJSON,
|
|
1457
|
+
CompanyCreditBalancesResponseDataFromJSONTyped: () => CompanyCreditBalancesResponseDataFromJSONTyped,
|
|
1458
|
+
CompanyCreditBalancesResponseDataToJSON: () => CompanyCreditBalancesResponseDataToJSON,
|
|
1459
|
+
CompanyCreditBalancesResponseDataToJSONTyped: () => CompanyCreditBalancesResponseDataToJSONTyped,
|
|
1460
|
+
CompanyCreditCompositionResponseDataFromJSON: () => CompanyCreditCompositionResponseDataFromJSON,
|
|
1461
|
+
CompanyCreditCompositionResponseDataFromJSONTyped: () => CompanyCreditCompositionResponseDataFromJSONTyped,
|
|
1462
|
+
CompanyCreditCompositionResponseDataToJSON: () => CompanyCreditCompositionResponseDataToJSON,
|
|
1463
|
+
CompanyCreditCompositionResponseDataToJSONTyped: () => CompanyCreditCompositionResponseDataToJSONTyped,
|
|
1464
|
+
CompanyCreditGrantResponseDataFromJSON: () => CompanyCreditGrantResponseDataFromJSON,
|
|
1465
|
+
CompanyCreditGrantResponseDataFromJSONTyped: () => CompanyCreditGrantResponseDataFromJSONTyped,
|
|
1466
|
+
CompanyCreditGrantResponseDataToJSON: () => CompanyCreditGrantResponseDataToJSON,
|
|
1467
|
+
CompanyCreditGrantResponseDataToJSONTyped: () => CompanyCreditGrantResponseDataToJSONTyped,
|
|
1468
|
+
CompanyCreditUserUsageResponseDataFromJSON: () => CompanyCreditUserUsageResponseDataFromJSON,
|
|
1469
|
+
CompanyCreditUserUsageResponseDataFromJSONTyped: () => CompanyCreditUserUsageResponseDataFromJSONTyped,
|
|
1470
|
+
CompanyCreditUserUsageResponseDataToJSON: () => CompanyCreditUserUsageResponseDataToJSON,
|
|
1471
|
+
CompanyCreditUserUsageResponseDataToJSONTyped: () => CompanyCreditUserUsageResponseDataToJSONTyped,
|
|
1472
|
+
CompanyCreditUserUsageRowResponseDataFromJSON: () => CompanyCreditUserUsageRowResponseDataFromJSON,
|
|
1473
|
+
CompanyCreditUserUsageRowResponseDataFromJSONTyped: () => CompanyCreditUserUsageRowResponseDataFromJSONTyped,
|
|
1474
|
+
CompanyCreditUserUsageRowResponseDataToJSON: () => CompanyCreditUserUsageRowResponseDataToJSON,
|
|
1475
|
+
CompanyCreditUserUsageRowResponseDataToJSONTyped: () => CompanyCreditUserUsageRowResponseDataToJSONTyped,
|
|
1444
1476
|
CompanyDiscountResponseDataFromJSON: () => CompanyDiscountResponseDataFromJSON,
|
|
1445
1477
|
CompanyDiscountResponseDataFromJSONTyped: () => CompanyDiscountResponseDataFromJSONTyped,
|
|
1446
1478
|
CompanyDiscountResponseDataToJSON: () => CompanyDiscountResponseDataToJSON,
|
|
@@ -1513,6 +1545,18 @@ __export2(models_exports, {
|
|
|
1513
1545
|
FeatureTypeFromJSONTyped: () => FeatureTypeFromJSONTyped3,
|
|
1514
1546
|
FeatureTypeToJSON: () => FeatureTypeToJSON2,
|
|
1515
1547
|
FeatureTypeToJSONTyped: () => FeatureTypeToJSONTyped3,
|
|
1548
|
+
GetCompanyCreditBalancesResponseFromJSON: () => GetCompanyCreditBalancesResponseFromJSON,
|
|
1549
|
+
GetCompanyCreditBalancesResponseFromJSONTyped: () => GetCompanyCreditBalancesResponseFromJSONTyped,
|
|
1550
|
+
GetCompanyCreditBalancesResponseToJSON: () => GetCompanyCreditBalancesResponseToJSON,
|
|
1551
|
+
GetCompanyCreditBalancesResponseToJSONTyped: () => GetCompanyCreditBalancesResponseToJSONTyped,
|
|
1552
|
+
GetCompanyCreditUserUsageParamsFromJSON: () => GetCompanyCreditUserUsageParamsFromJSON,
|
|
1553
|
+
GetCompanyCreditUserUsageParamsFromJSONTyped: () => GetCompanyCreditUserUsageParamsFromJSONTyped,
|
|
1554
|
+
GetCompanyCreditUserUsageParamsToJSON: () => GetCompanyCreditUserUsageParamsToJSON,
|
|
1555
|
+
GetCompanyCreditUserUsageParamsToJSONTyped: () => GetCompanyCreditUserUsageParamsToJSONTyped,
|
|
1556
|
+
GetCompanyCreditUserUsageResponseFromJSON: () => GetCompanyCreditUserUsageResponseFromJSON,
|
|
1557
|
+
GetCompanyCreditUserUsageResponseFromJSONTyped: () => GetCompanyCreditUserUsageResponseFromJSONTyped,
|
|
1558
|
+
GetCompanyCreditUserUsageResponseToJSON: () => GetCompanyCreditUserUsageResponseToJSON,
|
|
1559
|
+
GetCompanyCreditUserUsageResponseToJSONTyped: () => GetCompanyCreditUserUsageResponseToJSONTyped,
|
|
1516
1560
|
GetCompanyFeatureUsageResponseFromJSON: () => GetCompanyFeatureUsageResponseFromJSON,
|
|
1517
1561
|
GetCompanyFeatureUsageResponseFromJSONTyped: () => GetCompanyFeatureUsageResponseFromJSONTyped,
|
|
1518
1562
|
GetCompanyFeatureUsageResponseToJSON: () => GetCompanyFeatureUsageResponseToJSON,
|
|
@@ -1578,6 +1622,7 @@ __export2(models_exports, {
|
|
|
1578
1622
|
UpdatePaymentMethodResponseToJSON: () => UpdatePaymentMethodResponseToJSON,
|
|
1579
1623
|
UpdatePaymentMethodResponseToJSONTyped: () => UpdatePaymentMethodResponseToJSONTyped,
|
|
1580
1624
|
instanceOfApiError: () => instanceOfApiError,
|
|
1625
|
+
instanceOfBillingCreditGrantReason: () => instanceOfBillingCreditGrantReason,
|
|
1581
1626
|
instanceOfBillingPlanCreditGrantResetCadence: () => instanceOfBillingPlanCreditGrantResetCadence,
|
|
1582
1627
|
instanceOfBillingPriceScheme: () => instanceOfBillingPriceScheme,
|
|
1583
1628
|
instanceOfBillingProductPriceInterval: () => instanceOfBillingProductPriceInterval,
|
|
@@ -1586,6 +1631,12 @@ __export2(models_exports, {
|
|
|
1586
1631
|
instanceOfCatalogCreditGrantResponseData: () => instanceOfCatalogCreditGrantResponseData,
|
|
1587
1632
|
instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
|
|
1588
1633
|
instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
|
|
1634
|
+
instanceOfCompanyCreditBalanceResponseData: () => instanceOfCompanyCreditBalanceResponseData,
|
|
1635
|
+
instanceOfCompanyCreditBalancesResponseData: () => instanceOfCompanyCreditBalancesResponseData,
|
|
1636
|
+
instanceOfCompanyCreditCompositionResponseData: () => instanceOfCompanyCreditCompositionResponseData,
|
|
1637
|
+
instanceOfCompanyCreditGrantResponseData: () => instanceOfCompanyCreditGrantResponseData,
|
|
1638
|
+
instanceOfCompanyCreditUserUsageResponseData: () => instanceOfCompanyCreditUserUsageResponseData,
|
|
1639
|
+
instanceOfCompanyCreditUserUsageRowResponseData: () => instanceOfCompanyCreditUserUsageRowResponseData,
|
|
1589
1640
|
instanceOfCompanyDiscountResponseData: () => instanceOfCompanyDiscountResponseData,
|
|
1590
1641
|
instanceOfCompanyFeatureUsageListResponseData: () => instanceOfCompanyFeatureUsageListResponseData,
|
|
1591
1642
|
instanceOfCompanyFeatureUsageResponseData: () => instanceOfCompanyFeatureUsageResponseData,
|
|
@@ -1603,6 +1654,9 @@ __export2(models_exports, {
|
|
|
1603
1654
|
instanceOfEntitlementType: () => instanceOfEntitlementType,
|
|
1604
1655
|
instanceOfEntitlementValueType: () => instanceOfEntitlementValueType,
|
|
1605
1656
|
instanceOfFeatureType: () => instanceOfFeatureType,
|
|
1657
|
+
instanceOfGetCompanyCreditBalancesResponse: () => instanceOfGetCompanyCreditBalancesResponse,
|
|
1658
|
+
instanceOfGetCompanyCreditUserUsageParams: () => instanceOfGetCompanyCreditUserUsageParams,
|
|
1659
|
+
instanceOfGetCompanyCreditUserUsageResponse: () => instanceOfGetCompanyCreditUserUsageResponse,
|
|
1606
1660
|
instanceOfGetCompanyFeatureUsageResponse: () => instanceOfGetCompanyFeatureUsageResponse,
|
|
1607
1661
|
instanceOfGetCompanyFeatureUserUsageParams: () => instanceOfGetCompanyFeatureUserUsageParams,
|
|
1608
1662
|
instanceOfGetCompanyFeatureUserUsageResponse: () => instanceOfGetCompanyFeatureUserUsageResponse,
|
|
@@ -1645,6 +1699,39 @@ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
1645
1699
|
error: value["error"]
|
|
1646
1700
|
};
|
|
1647
1701
|
}
|
|
1702
|
+
var BillingCreditGrantReason = {
|
|
1703
|
+
Adjustment: "adjustment",
|
|
1704
|
+
BillingCreditAutoTopup: "billing_credit_auto_topup",
|
|
1705
|
+
Free: "free",
|
|
1706
|
+
Plan: "plan",
|
|
1707
|
+
PostpaidForgiven: "postpaid_forgiven",
|
|
1708
|
+
PostpaidOverdraft: "postpaid_overdraft",
|
|
1709
|
+
PostpaidSettlement: "postpaid_settlement",
|
|
1710
|
+
Purchased: "purchased",
|
|
1711
|
+
Rollover: "rollover"
|
|
1712
|
+
};
|
|
1713
|
+
function instanceOfBillingCreditGrantReason(value) {
|
|
1714
|
+
for (const key in BillingCreditGrantReason) {
|
|
1715
|
+
if (Object.prototype.hasOwnProperty.call(BillingCreditGrantReason, key)) {
|
|
1716
|
+
if (BillingCreditGrantReason[key] === value) {
|
|
1717
|
+
return true;
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
return false;
|
|
1722
|
+
}
|
|
1723
|
+
function BillingCreditGrantReasonFromJSON(json) {
|
|
1724
|
+
return BillingCreditGrantReasonFromJSONTyped(json, false);
|
|
1725
|
+
}
|
|
1726
|
+
function BillingCreditGrantReasonFromJSONTyped(json, ignoreDiscriminator) {
|
|
1727
|
+
return json;
|
|
1728
|
+
}
|
|
1729
|
+
function BillingCreditGrantReasonToJSON(value) {
|
|
1730
|
+
return value;
|
|
1731
|
+
}
|
|
1732
|
+
function BillingCreditGrantReasonToJSONTyped(value, ignoreDiscriminator) {
|
|
1733
|
+
return value;
|
|
1734
|
+
}
|
|
1648
1735
|
var BillingPlanCreditGrantResetCadence = {
|
|
1649
1736
|
Daily: "daily",
|
|
1650
1737
|
Every6Months: "every_6_months",
|
|
@@ -1962,6 +2049,298 @@ function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false)
|
|
|
1962
2049
|
tiers_mode: BillingTiersModeToJSON2(value["tiersMode"])
|
|
1963
2050
|
};
|
|
1964
2051
|
}
|
|
2052
|
+
function instanceOfCompanyCreditGrantResponseData(value) {
|
|
2053
|
+
if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
|
|
2054
|
+
if (!("grantReason" in value) || value["grantReason"] === void 0)
|
|
2055
|
+
return false;
|
|
2056
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
2057
|
+
if (!("quantity" in value) || value["quantity"] === void 0) return false;
|
|
2058
|
+
if (!("quantityRemaining" in value) || value["quantityRemaining"] === void 0)
|
|
2059
|
+
return false;
|
|
2060
|
+
if (!("quantityUsed" in value) || value["quantityUsed"] === void 0)
|
|
2061
|
+
return false;
|
|
2062
|
+
return true;
|
|
2063
|
+
}
|
|
2064
|
+
function CompanyCreditGrantResponseDataFromJSON(json) {
|
|
2065
|
+
return CompanyCreditGrantResponseDataFromJSONTyped(json, false);
|
|
2066
|
+
}
|
|
2067
|
+
function CompanyCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2068
|
+
if (json == null) {
|
|
2069
|
+
return json;
|
|
2070
|
+
}
|
|
2071
|
+
return {
|
|
2072
|
+
bundleId: json["bundle_id"] == null ? void 0 : json["bundle_id"],
|
|
2073
|
+
bundleName: json["bundle_name"] == null ? void 0 : json["bundle_name"],
|
|
2074
|
+
createdAt: new Date(json["created_at"]),
|
|
2075
|
+
expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
|
|
2076
|
+
grantReason: BillingCreditGrantReasonFromJSON(json["grant_reason"]),
|
|
2077
|
+
id: json["id"],
|
|
2078
|
+
planId: json["plan_id"] == null ? void 0 : json["plan_id"],
|
|
2079
|
+
planName: json["plan_name"] == null ? void 0 : json["plan_name"],
|
|
2080
|
+
quantity: json["quantity"],
|
|
2081
|
+
quantityRemaining: json["quantity_remaining"],
|
|
2082
|
+
quantityUsed: json["quantity_used"],
|
|
2083
|
+
renewalPeriod: json["renewal_period"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["renewal_period"]),
|
|
2084
|
+
resetsAt: json["resets_at"] == null ? void 0 : new Date(json["resets_at"]),
|
|
2085
|
+
validFrom: json["valid_from"] == null ? void 0 : new Date(json["valid_from"])
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
function CompanyCreditGrantResponseDataToJSON(json) {
|
|
2089
|
+
return CompanyCreditGrantResponseDataToJSONTyped(json, false);
|
|
2090
|
+
}
|
|
2091
|
+
function CompanyCreditGrantResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2092
|
+
if (value == null) {
|
|
2093
|
+
return value;
|
|
2094
|
+
}
|
|
2095
|
+
return {
|
|
2096
|
+
bundle_id: value["bundleId"],
|
|
2097
|
+
bundle_name: value["bundleName"],
|
|
2098
|
+
created_at: value["createdAt"].toISOString(),
|
|
2099
|
+
expires_at: value["expiresAt"] == null ? void 0 : value["expiresAt"].toISOString(),
|
|
2100
|
+
grant_reason: BillingCreditGrantReasonToJSON(value["grantReason"]),
|
|
2101
|
+
id: value["id"],
|
|
2102
|
+
plan_id: value["planId"],
|
|
2103
|
+
plan_name: value["planName"],
|
|
2104
|
+
quantity: value["quantity"],
|
|
2105
|
+
quantity_remaining: value["quantityRemaining"],
|
|
2106
|
+
quantity_used: value["quantityUsed"],
|
|
2107
|
+
renewal_period: BillingPlanCreditGrantResetCadenceToJSON2(
|
|
2108
|
+
value["renewalPeriod"]
|
|
2109
|
+
),
|
|
2110
|
+
resets_at: value["resetsAt"] == null ? void 0 : value["resetsAt"].toISOString(),
|
|
2111
|
+
valid_from: value["validFrom"] == null ? void 0 : value["validFrom"].toISOString()
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
function instanceOfCompanyCreditCompositionResponseData(value) {
|
|
2115
|
+
if (!("fixedQuantity" in value) || value["fixedQuantity"] === void 0)
|
|
2116
|
+
return false;
|
|
2117
|
+
if (!("licenseName" in value) || value["licenseName"] === void 0)
|
|
2118
|
+
return false;
|
|
2119
|
+
if (!("licenseQuantity" in value) || value["licenseQuantity"] === void 0)
|
|
2120
|
+
return false;
|
|
2121
|
+
if (!("perLicenseAmount" in value) || value["perLicenseAmount"] === void 0)
|
|
2122
|
+
return false;
|
|
2123
|
+
if (!("period" in value) || value["period"] === void 0) return false;
|
|
2124
|
+
if (!("total" in value) || value["total"] === void 0) return false;
|
|
2125
|
+
return true;
|
|
2126
|
+
}
|
|
2127
|
+
function CompanyCreditCompositionResponseDataFromJSON(json) {
|
|
2128
|
+
return CompanyCreditCompositionResponseDataFromJSONTyped(json, false);
|
|
2129
|
+
}
|
|
2130
|
+
function CompanyCreditCompositionResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2131
|
+
if (json == null) {
|
|
2132
|
+
return json;
|
|
2133
|
+
}
|
|
2134
|
+
return {
|
|
2135
|
+
fixedQuantity: json["fixed_quantity"],
|
|
2136
|
+
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
2137
|
+
licenseName: json["license_name"],
|
|
2138
|
+
licensePluralName: json["license_plural_name"] == null ? void 0 : json["license_plural_name"],
|
|
2139
|
+
licenseQuantity: json["license_quantity"],
|
|
2140
|
+
licenseSingularName: json["license_singular_name"] == null ? void 0 : json["license_singular_name"],
|
|
2141
|
+
perLicenseAmount: json["per_license_amount"],
|
|
2142
|
+
period: json["period"],
|
|
2143
|
+
renewsAt: json["renews_at"] == null ? void 0 : new Date(json["renews_at"]),
|
|
2144
|
+
total: json["total"]
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
function CompanyCreditCompositionResponseDataToJSON(json) {
|
|
2148
|
+
return CompanyCreditCompositionResponseDataToJSONTyped(json, false);
|
|
2149
|
+
}
|
|
2150
|
+
function CompanyCreditCompositionResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2151
|
+
if (value == null) {
|
|
2152
|
+
return value;
|
|
2153
|
+
}
|
|
2154
|
+
return {
|
|
2155
|
+
fixed_quantity: value["fixedQuantity"],
|
|
2156
|
+
license_id: value["licenseId"],
|
|
2157
|
+
license_name: value["licenseName"],
|
|
2158
|
+
license_plural_name: value["licensePluralName"],
|
|
2159
|
+
license_quantity: value["licenseQuantity"],
|
|
2160
|
+
license_singular_name: value["licenseSingularName"],
|
|
2161
|
+
per_license_amount: value["perLicenseAmount"],
|
|
2162
|
+
period: value["period"],
|
|
2163
|
+
renews_at: value["renewsAt"] == null ? void 0 : value["renewsAt"].toISOString(),
|
|
2164
|
+
total: value["total"]
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
function instanceOfCompanyCreditBalanceResponseData(value) {
|
|
2168
|
+
if (!("creditDescription" in value) || value["creditDescription"] === void 0)
|
|
2169
|
+
return false;
|
|
2170
|
+
if (!("creditId" in value) || value["creditId"] === void 0) return false;
|
|
2171
|
+
if (!("creditName" in value) || value["creditName"] === void 0)
|
|
2172
|
+
return false;
|
|
2173
|
+
if (!("grants" in value) || value["grants"] === void 0) return false;
|
|
2174
|
+
if (!("purchasable" in value) || value["purchasable"] === void 0)
|
|
2175
|
+
return false;
|
|
2176
|
+
if (!("remaining" in value) || value["remaining"] === void 0) return false;
|
|
2177
|
+
if (!("total" in value) || value["total"] === void 0) return false;
|
|
2178
|
+
if (!("used" in value) || value["used"] === void 0) return false;
|
|
2179
|
+
return true;
|
|
2180
|
+
}
|
|
2181
|
+
function CompanyCreditBalanceResponseDataFromJSON(json) {
|
|
2182
|
+
return CompanyCreditBalanceResponseDataFromJSONTyped(json, false);
|
|
2183
|
+
}
|
|
2184
|
+
function CompanyCreditBalanceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2185
|
+
if (json == null) {
|
|
2186
|
+
return json;
|
|
2187
|
+
}
|
|
2188
|
+
return {
|
|
2189
|
+
composition: json["composition"] == null ? void 0 : CompanyCreditCompositionResponseDataFromJSON(json["composition"]),
|
|
2190
|
+
creditDescription: json["credit_description"],
|
|
2191
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
2192
|
+
creditId: json["credit_id"],
|
|
2193
|
+
creditName: json["credit_name"],
|
|
2194
|
+
creditPluralName: json["credit_plural_name"] == null ? void 0 : json["credit_plural_name"],
|
|
2195
|
+
creditSingularName: json["credit_singular_name"] == null ? void 0 : json["credit_singular_name"],
|
|
2196
|
+
expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
|
|
2197
|
+
grants: json["grants"].map(
|
|
2198
|
+
CompanyCreditGrantResponseDataFromJSON
|
|
2199
|
+
),
|
|
2200
|
+
purchasable: json["purchasable"],
|
|
2201
|
+
remaining: json["remaining"],
|
|
2202
|
+
resetsAt: json["resets_at"] == null ? void 0 : new Date(json["resets_at"]),
|
|
2203
|
+
total: json["total"],
|
|
2204
|
+
used: json["used"]
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
function CompanyCreditBalanceResponseDataToJSON(json) {
|
|
2208
|
+
return CompanyCreditBalanceResponseDataToJSONTyped(json, false);
|
|
2209
|
+
}
|
|
2210
|
+
function CompanyCreditBalanceResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2211
|
+
if (value == null) {
|
|
2212
|
+
return value;
|
|
2213
|
+
}
|
|
2214
|
+
return {
|
|
2215
|
+
composition: CompanyCreditCompositionResponseDataToJSON(
|
|
2216
|
+
value["composition"]
|
|
2217
|
+
),
|
|
2218
|
+
credit_description: value["creditDescription"],
|
|
2219
|
+
credit_icon: value["creditIcon"],
|
|
2220
|
+
credit_id: value["creditId"],
|
|
2221
|
+
credit_name: value["creditName"],
|
|
2222
|
+
credit_plural_name: value["creditPluralName"],
|
|
2223
|
+
credit_singular_name: value["creditSingularName"],
|
|
2224
|
+
expires_at: value["expiresAt"] == null ? void 0 : value["expiresAt"].toISOString(),
|
|
2225
|
+
grants: value["grants"].map(
|
|
2226
|
+
CompanyCreditGrantResponseDataToJSON
|
|
2227
|
+
),
|
|
2228
|
+
purchasable: value["purchasable"],
|
|
2229
|
+
remaining: value["remaining"],
|
|
2230
|
+
resets_at: value["resetsAt"] == null ? void 0 : value["resetsAt"].toISOString(),
|
|
2231
|
+
total: value["total"],
|
|
2232
|
+
used: value["used"]
|
|
2233
|
+
};
|
|
2234
|
+
}
|
|
2235
|
+
function instanceOfCompanyCreditBalancesResponseData(value) {
|
|
2236
|
+
if (!("balances" in value) || value["balances"] === void 0) return false;
|
|
2237
|
+
if (!("count" in value) || value["count"] === void 0) return false;
|
|
2238
|
+
return true;
|
|
2239
|
+
}
|
|
2240
|
+
function CompanyCreditBalancesResponseDataFromJSON(json) {
|
|
2241
|
+
return CompanyCreditBalancesResponseDataFromJSONTyped(json, false);
|
|
2242
|
+
}
|
|
2243
|
+
function CompanyCreditBalancesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2244
|
+
if (json == null) {
|
|
2245
|
+
return json;
|
|
2246
|
+
}
|
|
2247
|
+
return {
|
|
2248
|
+
balances: json["balances"].map(
|
|
2249
|
+
CompanyCreditBalanceResponseDataFromJSON
|
|
2250
|
+
),
|
|
2251
|
+
count: json["count"]
|
|
2252
|
+
};
|
|
2253
|
+
}
|
|
2254
|
+
function CompanyCreditBalancesResponseDataToJSON(json) {
|
|
2255
|
+
return CompanyCreditBalancesResponseDataToJSONTyped(json, false);
|
|
2256
|
+
}
|
|
2257
|
+
function CompanyCreditBalancesResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2258
|
+
if (value == null) {
|
|
2259
|
+
return value;
|
|
2260
|
+
}
|
|
2261
|
+
return {
|
|
2262
|
+
balances: value["balances"].map(
|
|
2263
|
+
CompanyCreditBalanceResponseDataToJSON
|
|
2264
|
+
),
|
|
2265
|
+
count: value["count"]
|
|
2266
|
+
};
|
|
2267
|
+
}
|
|
2268
|
+
function instanceOfCompanyCreditUserUsageRowResponseData(value) {
|
|
2269
|
+
if (!("share" in value) || value["share"] === void 0) return false;
|
|
2270
|
+
if (!("used" in value) || value["used"] === void 0) return false;
|
|
2271
|
+
if (!("userId" in value) || value["userId"] === void 0) return false;
|
|
2272
|
+
return true;
|
|
2273
|
+
}
|
|
2274
|
+
function CompanyCreditUserUsageRowResponseDataFromJSON(json) {
|
|
2275
|
+
return CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, false);
|
|
2276
|
+
}
|
|
2277
|
+
function CompanyCreditUserUsageRowResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2278
|
+
if (json == null) {
|
|
2279
|
+
return json;
|
|
2280
|
+
}
|
|
2281
|
+
return {
|
|
2282
|
+
name: json["name"] == null ? void 0 : json["name"],
|
|
2283
|
+
share: json["share"],
|
|
2284
|
+
used: json["used"],
|
|
2285
|
+
userId: json["user_id"]
|
|
2286
|
+
};
|
|
2287
|
+
}
|
|
2288
|
+
function CompanyCreditUserUsageRowResponseDataToJSON(json) {
|
|
2289
|
+
return CompanyCreditUserUsageRowResponseDataToJSONTyped(json, false);
|
|
2290
|
+
}
|
|
2291
|
+
function CompanyCreditUserUsageRowResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2292
|
+
if (value == null) {
|
|
2293
|
+
return value;
|
|
2294
|
+
}
|
|
2295
|
+
return {
|
|
2296
|
+
name: value["name"],
|
|
2297
|
+
share: value["share"],
|
|
2298
|
+
used: value["used"],
|
|
2299
|
+
user_id: value["userId"]
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
function instanceOfCompanyCreditUserUsageResponseData(value) {
|
|
2303
|
+
if (!("count" in value) || value["count"] === void 0) return false;
|
|
2304
|
+
if (!("total" in value) || value["total"] === void 0) return false;
|
|
2305
|
+
if (!("users" in value) || value["users"] === void 0) return false;
|
|
2306
|
+
return true;
|
|
2307
|
+
}
|
|
2308
|
+
function CompanyCreditUserUsageResponseDataFromJSON(json) {
|
|
2309
|
+
return CompanyCreditUserUsageResponseDataFromJSONTyped(json, false);
|
|
2310
|
+
}
|
|
2311
|
+
function CompanyCreditUserUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2312
|
+
if (json == null) {
|
|
2313
|
+
return json;
|
|
2314
|
+
}
|
|
2315
|
+
return {
|
|
2316
|
+
count: json["count"],
|
|
2317
|
+
endTime: json["end_time"] == null ? void 0 : new Date(json["end_time"]),
|
|
2318
|
+
startTime: json["start_time"] == null ? void 0 : new Date(json["start_time"]),
|
|
2319
|
+
total: json["total"],
|
|
2320
|
+
unattributed: json["unattributed"] == null ? void 0 : json["unattributed"],
|
|
2321
|
+
users: json["users"].map(
|
|
2322
|
+
CompanyCreditUserUsageRowResponseDataFromJSON
|
|
2323
|
+
)
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
function CompanyCreditUserUsageResponseDataToJSON(json) {
|
|
2327
|
+
return CompanyCreditUserUsageResponseDataToJSONTyped(json, false);
|
|
2328
|
+
}
|
|
2329
|
+
function CompanyCreditUserUsageResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2330
|
+
if (value == null) {
|
|
2331
|
+
return value;
|
|
2332
|
+
}
|
|
2333
|
+
return {
|
|
2334
|
+
count: value["count"],
|
|
2335
|
+
end_time: value["endTime"] == null ? void 0 : value["endTime"].toISOString(),
|
|
2336
|
+
start_time: value["startTime"] == null ? void 0 : value["startTime"].toISOString(),
|
|
2337
|
+
total: value["total"],
|
|
2338
|
+
unattributed: value["unattributed"],
|
|
2339
|
+
users: value["users"].map(
|
|
2340
|
+
CompanyCreditUserUsageRowResponseDataToJSON
|
|
2341
|
+
)
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
1965
2344
|
function instanceOfCompanyDiscountResponseData(value) {
|
|
1966
2345
|
if (!("couponName" in value) || value["couponName"] === void 0)
|
|
1967
2346
|
return false;
|
|
@@ -2749,6 +3128,91 @@ function DeletePaymentMethodResponseToJSONTyped(value, ignoreDiscriminator = fal
|
|
|
2749
3128
|
params: value["params"]
|
|
2750
3129
|
};
|
|
2751
3130
|
}
|
|
3131
|
+
function instanceOfGetCompanyCreditBalancesResponse(value) {
|
|
3132
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
3133
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
3134
|
+
return true;
|
|
3135
|
+
}
|
|
3136
|
+
function GetCompanyCreditBalancesResponseFromJSON(json) {
|
|
3137
|
+
return GetCompanyCreditBalancesResponseFromJSONTyped(json, false);
|
|
3138
|
+
}
|
|
3139
|
+
function GetCompanyCreditBalancesResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
3140
|
+
if (json == null) {
|
|
3141
|
+
return json;
|
|
3142
|
+
}
|
|
3143
|
+
return {
|
|
3144
|
+
data: CompanyCreditBalancesResponseDataFromJSON(json["data"]),
|
|
3145
|
+
params: json["params"]
|
|
3146
|
+
};
|
|
3147
|
+
}
|
|
3148
|
+
function GetCompanyCreditBalancesResponseToJSON(json) {
|
|
3149
|
+
return GetCompanyCreditBalancesResponseToJSONTyped(json, false);
|
|
3150
|
+
}
|
|
3151
|
+
function GetCompanyCreditBalancesResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3152
|
+
if (value == null) {
|
|
3153
|
+
return value;
|
|
3154
|
+
}
|
|
3155
|
+
return {
|
|
3156
|
+
data: CompanyCreditBalancesResponseDataToJSON(value["data"]),
|
|
3157
|
+
params: value["params"]
|
|
3158
|
+
};
|
|
3159
|
+
}
|
|
3160
|
+
function instanceOfGetCompanyCreditUserUsageParams(value) {
|
|
3161
|
+
return true;
|
|
3162
|
+
}
|
|
3163
|
+
function GetCompanyCreditUserUsageParamsFromJSON(json) {
|
|
3164
|
+
return GetCompanyCreditUserUsageParamsFromJSONTyped(json, false);
|
|
3165
|
+
}
|
|
3166
|
+
function GetCompanyCreditUserUsageParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
3167
|
+
if (json == null) {
|
|
3168
|
+
return json;
|
|
3169
|
+
}
|
|
3170
|
+
return {
|
|
3171
|
+
limit: json["limit"] == null ? void 0 : json["limit"],
|
|
3172
|
+
offset: json["offset"] == null ? void 0 : json["offset"]
|
|
3173
|
+
};
|
|
3174
|
+
}
|
|
3175
|
+
function GetCompanyCreditUserUsageParamsToJSON(json) {
|
|
3176
|
+
return GetCompanyCreditUserUsageParamsToJSONTyped(json, false);
|
|
3177
|
+
}
|
|
3178
|
+
function GetCompanyCreditUserUsageParamsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3179
|
+
if (value == null) {
|
|
3180
|
+
return value;
|
|
3181
|
+
}
|
|
3182
|
+
return {
|
|
3183
|
+
limit: value["limit"],
|
|
3184
|
+
offset: value["offset"]
|
|
3185
|
+
};
|
|
3186
|
+
}
|
|
3187
|
+
function instanceOfGetCompanyCreditUserUsageResponse(value) {
|
|
3188
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
3189
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
3190
|
+
return true;
|
|
3191
|
+
}
|
|
3192
|
+
function GetCompanyCreditUserUsageResponseFromJSON(json) {
|
|
3193
|
+
return GetCompanyCreditUserUsageResponseFromJSONTyped(json, false);
|
|
3194
|
+
}
|
|
3195
|
+
function GetCompanyCreditUserUsageResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
3196
|
+
if (json == null) {
|
|
3197
|
+
return json;
|
|
3198
|
+
}
|
|
3199
|
+
return {
|
|
3200
|
+
data: CompanyCreditUserUsageResponseDataFromJSON(json["data"]),
|
|
3201
|
+
params: GetCompanyCreditUserUsageParamsFromJSON(json["params"])
|
|
3202
|
+
};
|
|
3203
|
+
}
|
|
3204
|
+
function GetCompanyCreditUserUsageResponseToJSON(json) {
|
|
3205
|
+
return GetCompanyCreditUserUsageResponseToJSONTyped(json, false);
|
|
3206
|
+
}
|
|
3207
|
+
function GetCompanyCreditUserUsageResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
3208
|
+
if (value == null) {
|
|
3209
|
+
return value;
|
|
3210
|
+
}
|
|
3211
|
+
return {
|
|
3212
|
+
data: CompanyCreditUserUsageResponseDataToJSON(value["data"]),
|
|
3213
|
+
params: GetCompanyCreditUserUsageParamsToJSON(value["params"])
|
|
3214
|
+
};
|
|
3215
|
+
}
|
|
2752
3216
|
function instanceOfGetCompanyFeatureUsageResponse(value) {
|
|
2753
3217
|
if (!("data" in value) || value["data"] === void 0) return false;
|
|
2754
3218
|
if (!("params" in value) || value["params"] === void 0) return false;
|
|
@@ -3448,6 +3912,36 @@ var SchematicBillingClient = class {
|
|
|
3448
3912
|
return GetCompanyFeatureUsageResponseFromJSON(body).data.features;
|
|
3449
3913
|
});
|
|
3450
3914
|
}
|
|
3915
|
+
fetchCreditBalances() {
|
|
3916
|
+
const path = "/company/credits";
|
|
3917
|
+
return this.session.request(path).then((body) => {
|
|
3918
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
3919
|
+
throw new Error(`Malformed response from ${path}`);
|
|
3920
|
+
}
|
|
3921
|
+
const data = body.data;
|
|
3922
|
+
if (data == null || data.balances == null) {
|
|
3923
|
+
return [];
|
|
3924
|
+
}
|
|
3925
|
+
return GetCompanyCreditBalancesResponseFromJSON(body).data.balances;
|
|
3926
|
+
});
|
|
3927
|
+
}
|
|
3928
|
+
fetchCreditUserUsage(params) {
|
|
3929
|
+
const query = new URLSearchParams();
|
|
3930
|
+
if (params.limit !== void 0) {
|
|
3931
|
+
query.set("limit", String(params.limit));
|
|
3932
|
+
}
|
|
3933
|
+
if (params.offset !== void 0) {
|
|
3934
|
+
query.set("offset", String(params.offset));
|
|
3935
|
+
}
|
|
3936
|
+
const search = query.toString();
|
|
3937
|
+
const path = `/company/credits/${encodeURIComponent(params.creditId)}/users${search === "" ? "" : `?${search}`}`;
|
|
3938
|
+
return this.session.request(path).then((body) => {
|
|
3939
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
3940
|
+
throw new Error(`Malformed response from ${path}`);
|
|
3941
|
+
}
|
|
3942
|
+
return GetCompanyCreditUserUsageResponseFromJSON(body).data;
|
|
3943
|
+
});
|
|
3944
|
+
}
|
|
3451
3945
|
fetchFeatureUserUsage(params) {
|
|
3452
3946
|
const query = new URLSearchParams();
|
|
3453
3947
|
if (params.limit !== void 0) {
|
|
@@ -5738,6 +6232,17 @@ var BillingStore = class {
|
|
|
5738
6232
|
}),
|
|
5739
6233
|
{ readiness }
|
|
5740
6234
|
);
|
|
6235
|
+
this.creditBalances = new KeyedResource(
|
|
6236
|
+
() => this._client.fetchCreditBalances(),
|
|
6237
|
+
{ readiness }
|
|
6238
|
+
);
|
|
6239
|
+
this.creditUserUsage = new KeyedResource(
|
|
6240
|
+
({ creditId }) => this._client.fetchCreditUserUsage({
|
|
6241
|
+
creditId,
|
|
6242
|
+
limit: FEATURE_USER_USAGE_LIMIT
|
|
6243
|
+
}),
|
|
6244
|
+
{ readiness }
|
|
6245
|
+
);
|
|
5741
6246
|
const held = { key: initialData.sessionKey };
|
|
5742
6247
|
if (initialData.invoices !== void 0) {
|
|
5743
6248
|
held.invoices = {
|
|
@@ -5758,7 +6263,10 @@ var BillingStore = class {
|
|
|
5758
6263
|
if (initialData.featureUsage !== void 0) {
|
|
5759
6264
|
held.featureUsage = initialData.featureUsage;
|
|
5760
6265
|
}
|
|
5761
|
-
if (
|
|
6266
|
+
if (initialData.creditBalances !== void 0) {
|
|
6267
|
+
held.creditBalances = initialData.creditBalances;
|
|
6268
|
+
}
|
|
6269
|
+
if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0 || held.creditBalances !== void 0) {
|
|
5762
6270
|
this._held = held;
|
|
5763
6271
|
this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
|
|
5764
6272
|
}
|
|
@@ -5768,6 +6276,8 @@ var BillingStore = class {
|
|
|
5768
6276
|
upcomingInvoice;
|
|
5769
6277
|
paymentMethods;
|
|
5770
6278
|
featureUsage;
|
|
6279
|
+
creditBalances;
|
|
6280
|
+
creditUserUsage;
|
|
5771
6281
|
featureUserUsage;
|
|
5772
6282
|
_pageSize;
|
|
5773
6283
|
_unsubscribe;
|
|
@@ -5850,6 +6360,9 @@ var BillingStore = class {
|
|
|
5850
6360
|
if (held.featureUsage !== void 0) {
|
|
5851
6361
|
this.featureUsage.seed(SINGLETON, held.featureUsage);
|
|
5852
6362
|
}
|
|
6363
|
+
if (held.creditBalances !== void 0) {
|
|
6364
|
+
this.creditBalances.seed(SINGLETON, held.creditBalances);
|
|
6365
|
+
}
|
|
5853
6366
|
this._seedKey = held.key;
|
|
5854
6367
|
this._seeded = true;
|
|
5855
6368
|
}
|
|
@@ -5863,6 +6376,7 @@ var BillingStore = class {
|
|
|
5863
6376
|
this[name].resetAll();
|
|
5864
6377
|
}
|
|
5865
6378
|
this.featureUserUsage.resetAll();
|
|
6379
|
+
this.creditUserUsage.resetAll();
|
|
5866
6380
|
}
|
|
5867
6381
|
/** Forgets every resource and leaves them empty; nothing reloads. */
|
|
5868
6382
|
clearAll() {
|
|
@@ -5870,6 +6384,7 @@ var BillingStore = class {
|
|
|
5870
6384
|
this[name].clearAll();
|
|
5871
6385
|
}
|
|
5872
6386
|
this.featureUserUsage.clearAll();
|
|
6387
|
+
this.creditUserUsage.clearAll();
|
|
5873
6388
|
}
|
|
5874
6389
|
/** Loads every resource that is subscribed and has nothing yet. */
|
|
5875
6390
|
resumeAll() {
|
|
@@ -5877,6 +6392,7 @@ var BillingStore = class {
|
|
|
5877
6392
|
this[name].resumeAll();
|
|
5878
6393
|
}
|
|
5879
6394
|
this.featureUserUsage.resumeAll();
|
|
6395
|
+
this.creditUserUsage.resumeAll();
|
|
5880
6396
|
}
|
|
5881
6397
|
/** Reloads every resource that has been loaded, keeping its current data. */
|
|
5882
6398
|
invalidateAll() {
|
|
@@ -5884,6 +6400,7 @@ var BillingStore = class {
|
|
|
5884
6400
|
this[name].invalidateAll();
|
|
5885
6401
|
}
|
|
5886
6402
|
this.featureUserUsage.invalidateAll();
|
|
6403
|
+
this.creditUserUsage.invalidateAll();
|
|
5887
6404
|
}
|
|
5888
6405
|
/**
|
|
5889
6406
|
* Appends the next page to the invoices list for `query`, when there is
|
|
@@ -5996,7 +6513,8 @@ var RESOURCE_NAMES = [
|
|
|
5996
6513
|
"invoices",
|
|
5997
6514
|
"upcomingInvoice",
|
|
5998
6515
|
"paymentMethods",
|
|
5999
|
-
"featureUsage"
|
|
6516
|
+
"featureUsage",
|
|
6517
|
+
"creditBalances"
|
|
6000
6518
|
];
|
|
6001
6519
|
|
|
6002
6520
|
// src/billing/context.tsx
|
|
@@ -6079,6 +6597,9 @@ var missingBillingSource = {
|
|
|
6079
6597
|
subscribeFeatureUserUsage: () => () => {
|
|
6080
6598
|
},
|
|
6081
6599
|
featureUserUsage: () => missingHandle,
|
|
6600
|
+
subscribeCreditUserUsage: () => () => {
|
|
6601
|
+
},
|
|
6602
|
+
creditUserUsage: () => missingHandle,
|
|
6082
6603
|
loadMoreInvoices: () => Promise.resolve(),
|
|
6083
6604
|
invalidateAll: () => {
|
|
6084
6605
|
},
|
|
@@ -6092,6 +6613,7 @@ function useBillingDataSource() {
|
|
|
6092
6613
|
function BillingDataProvider({
|
|
6093
6614
|
actions,
|
|
6094
6615
|
children,
|
|
6616
|
+
creditUserUsage,
|
|
6095
6617
|
data,
|
|
6096
6618
|
featureUserUsage,
|
|
6097
6619
|
locale,
|
|
@@ -6105,6 +6627,7 @@ function BillingDataProvider({
|
|
|
6105
6627
|
const source = (0, import_react2.useMemo)(() => {
|
|
6106
6628
|
const handles = /* @__PURE__ */ new Map();
|
|
6107
6629
|
const userUsageHandles = /* @__PURE__ */ new Map();
|
|
6630
|
+
const creditUsageHandles = /* @__PURE__ */ new Map();
|
|
6108
6631
|
return {
|
|
6109
6632
|
actions: rejectingActions(
|
|
6110
6633
|
(name) => new Error(BILLING_ACTION_UNAVAILABLE_MESSAGE(name)),
|
|
@@ -6146,6 +6669,24 @@ function BillingDataProvider({
|
|
|
6146
6669
|
userUsageHandles.set(featureId, handle);
|
|
6147
6670
|
return handle;
|
|
6148
6671
|
},
|
|
6672
|
+
subscribeCreditUserUsage: () => () => {
|
|
6673
|
+
},
|
|
6674
|
+
creditUserUsage: (creditId) => {
|
|
6675
|
+
const cached = creditUsageHandles.get(creditId);
|
|
6676
|
+
if (cached !== void 0) {
|
|
6677
|
+
return cached;
|
|
6678
|
+
}
|
|
6679
|
+
const value = creditUserUsage?.[creditId];
|
|
6680
|
+
const handle = {
|
|
6681
|
+
data: value,
|
|
6682
|
+
error: void 0,
|
|
6683
|
+
isPending: value === void 0,
|
|
6684
|
+
refetch: () => {
|
|
6685
|
+
}
|
|
6686
|
+
};
|
|
6687
|
+
creditUsageHandles.set(creditId, handle);
|
|
6688
|
+
return handle;
|
|
6689
|
+
},
|
|
6149
6690
|
loadMoreInvoices: (query) => {
|
|
6150
6691
|
onLoadMoreInvoices?.(query);
|
|
6151
6692
|
return Promise.resolve();
|
|
@@ -6153,7 +6694,15 @@ function BillingDataProvider({
|
|
|
6153
6694
|
invalidateAll: () => {
|
|
6154
6695
|
}
|
|
6155
6696
|
};
|
|
6156
|
-
}, [
|
|
6697
|
+
}, [
|
|
6698
|
+
actions,
|
|
6699
|
+
creditUserUsage,
|
|
6700
|
+
data,
|
|
6701
|
+
featureUserUsage,
|
|
6702
|
+
onLoadMoreInvoices,
|
|
6703
|
+
onRefetch,
|
|
6704
|
+
status
|
|
6705
|
+
]);
|
|
6157
6706
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BillingDataContext.Provider, { value: source, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
6158
6707
|
SchematicI18nProvider,
|
|
6159
6708
|
{
|
|
@@ -6258,6 +6807,21 @@ function useFeatureUserUsage(featureId) {
|
|
|
6258
6807
|
);
|
|
6259
6808
|
return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
6260
6809
|
}
|
|
6810
|
+
function useCreditBalances() {
|
|
6811
|
+
return useBillingResource("creditBalances", SINGLETON);
|
|
6812
|
+
}
|
|
6813
|
+
function useCreditUserUsage(creditId) {
|
|
6814
|
+
const source = useBillingDataSource();
|
|
6815
|
+
const subscribe = (0, import_react3.useCallback)(
|
|
6816
|
+
(listener) => source.subscribeCreditUserUsage(creditId, listener),
|
|
6817
|
+
[creditId, source]
|
|
6818
|
+
);
|
|
6819
|
+
const getSnapshot = (0, import_react3.useCallback)(
|
|
6820
|
+
() => source.creditUserUsage(creditId),
|
|
6821
|
+
[creditId, source]
|
|
6822
|
+
);
|
|
6823
|
+
return (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
|
|
6824
|
+
}
|
|
6261
6825
|
function useInvalidateBillingData() {
|
|
6262
6826
|
return useBillingDataSource().invalidateAll;
|
|
6263
6827
|
}
|
|
@@ -6335,6 +6899,8 @@ function BillingProvider({
|
|
|
6335
6899
|
handle,
|
|
6336
6900
|
subscribeFeatureUserUsage: (featureId, listener) => store.featureUserUsage.subscribe({ featureId }, listener),
|
|
6337
6901
|
featureUserUsage: (featureId) => handleOf(store.featureUserUsage.get({ featureId })),
|
|
6902
|
+
subscribeCreditUserUsage: (creditId, listener) => store.creditUserUsage.subscribe({ creditId }, listener),
|
|
6903
|
+
creditUserUsage: (creditId) => handleOf(store.creditUserUsage.get({ creditId })),
|
|
6338
6904
|
loadMoreInvoices: (query) => store.loadMoreInvoices(query),
|
|
6339
6905
|
invalidateAll: () => store.invalidateAll(),
|
|
6340
6906
|
actions: {
|
|
@@ -6368,10 +6934,20 @@ function staticSource(data) {
|
|
|
6368
6934
|
refetch: () => {
|
|
6369
6935
|
}
|
|
6370
6936
|
};
|
|
6937
|
+
const pendingCreditUsage = {
|
|
6938
|
+
data: void 0,
|
|
6939
|
+
error: void 0,
|
|
6940
|
+
isPending: true,
|
|
6941
|
+
refetch: () => {
|
|
6942
|
+
}
|
|
6943
|
+
};
|
|
6371
6944
|
return {
|
|
6372
6945
|
subscribeFeatureUserUsage: () => () => {
|
|
6373
6946
|
},
|
|
6374
6947
|
featureUserUsage: () => pendingUserUsage,
|
|
6948
|
+
subscribeCreditUserUsage: () => () => {
|
|
6949
|
+
},
|
|
6950
|
+
creditUserUsage: () => pendingCreditUsage,
|
|
6375
6951
|
subscribe: () => () => {
|
|
6376
6952
|
},
|
|
6377
6953
|
handle: (name) => {
|
|
@@ -6397,7 +6973,7 @@ function staticSource(data) {
|
|
|
6397
6973
|
}
|
|
6398
6974
|
|
|
6399
6975
|
// src/version.ts
|
|
6400
|
-
var version2 = "1.
|
|
6976
|
+
var version2 = "1.12.0";
|
|
6401
6977
|
|
|
6402
6978
|
// src/context/schematic.tsx
|
|
6403
6979
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|