@schematichq/schematic-react 1.10.0 → 1.11.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 +1174 -16
- package/dist/schematic-react.d.ts +910 -3
- package/dist/schematic-react.esm.js +1174 -16
- package/package.json +7 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/.pnpm/@schematichq+schematic-js@1.
|
|
1
|
+
// node_modules/.pnpm/@schematichq+schematic-js@1.11.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;
|
|
@@ -1234,7 +1234,98 @@ function contextString(context) {
|
|
|
1234
1234
|
}, {});
|
|
1235
1235
|
return JSON.stringify(sortedContext);
|
|
1236
1236
|
}
|
|
1237
|
-
var
|
|
1237
|
+
var contextSignatureHeader = "X-Schematic-Context-Sig";
|
|
1238
|
+
var refreshSkewMs = 6e4;
|
|
1239
|
+
var maxCachedSignatures = 50;
|
|
1240
|
+
function parseSignatureExpiryMs(signature) {
|
|
1241
|
+
const parts = signature.split(".");
|
|
1242
|
+
if (parts.length !== 3) {
|
|
1243
|
+
return null;
|
|
1244
|
+
}
|
|
1245
|
+
const expSeconds = Number(parts[1]);
|
|
1246
|
+
if (!Number.isFinite(expSeconds)) {
|
|
1247
|
+
return null;
|
|
1248
|
+
}
|
|
1249
|
+
return expSeconds * 1e3;
|
|
1250
|
+
}
|
|
1251
|
+
var ContextSignatureManager = class {
|
|
1252
|
+
provider;
|
|
1253
|
+
debug;
|
|
1254
|
+
cache = /* @__PURE__ */ new Map();
|
|
1255
|
+
inFlight = /* @__PURE__ */ new Map();
|
|
1256
|
+
constructor(provider, debug) {
|
|
1257
|
+
this.provider = provider;
|
|
1258
|
+
this.debug = debug;
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Return a valid signature for the given context, fetching a fresh one via
|
|
1262
|
+
* the provider when the cache is empty or close to expiry. Concurrent calls
|
|
1263
|
+
* for the same context share a single provider invocation. Returns undefined
|
|
1264
|
+
* (and logs a warning) if the provider throws, so callers can degrade
|
|
1265
|
+
* gracefully by sending the request without a signature.
|
|
1266
|
+
*/
|
|
1267
|
+
async getSignature(context) {
|
|
1268
|
+
const key = contextString(context);
|
|
1269
|
+
const cached = this.cache.get(key);
|
|
1270
|
+
if (cached !== void 0 && Date.now() < cached.expiresAtMs - refreshSkewMs) {
|
|
1271
|
+
this.cache.delete(key);
|
|
1272
|
+
this.cache.set(key, cached);
|
|
1273
|
+
return cached.signature;
|
|
1274
|
+
}
|
|
1275
|
+
const existing = this.inFlight.get(key);
|
|
1276
|
+
if (existing !== void 0) {
|
|
1277
|
+
return existing;
|
|
1278
|
+
}
|
|
1279
|
+
const pending = this.fetchSignature(key, context).finally(() => {
|
|
1280
|
+
this.inFlight.delete(key);
|
|
1281
|
+
});
|
|
1282
|
+
this.inFlight.set(key, pending);
|
|
1283
|
+
return pending;
|
|
1284
|
+
}
|
|
1285
|
+
/** Drop all cached signatures. */
|
|
1286
|
+
clear() {
|
|
1287
|
+
this.cache.clear();
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Drop expired signatures, then the least recently used ones until the cache
|
|
1291
|
+
* is within `maxCachedSignatures`.
|
|
1292
|
+
*/
|
|
1293
|
+
evict() {
|
|
1294
|
+
const now = Date.now();
|
|
1295
|
+
for (const [key, entry] of this.cache) {
|
|
1296
|
+
if (now >= entry.expiresAtMs) {
|
|
1297
|
+
this.cache.delete(key);
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
for (const key of this.cache.keys()) {
|
|
1301
|
+
if (this.cache.size <= maxCachedSignatures) {
|
|
1302
|
+
break;
|
|
1303
|
+
}
|
|
1304
|
+
this.cache.delete(key);
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
async fetchSignature(key, context) {
|
|
1308
|
+
try {
|
|
1309
|
+
const signature = await this.provider(context);
|
|
1310
|
+
const expiresAtMs = parseSignatureExpiryMs(signature);
|
|
1311
|
+
if (expiresAtMs === null) {
|
|
1312
|
+
this.debug(
|
|
1313
|
+
"getContextSignature returned a value without a parseable expiry; not caching",
|
|
1314
|
+
{ signature }
|
|
1315
|
+
);
|
|
1316
|
+
return signature;
|
|
1317
|
+
}
|
|
1318
|
+
this.cache.delete(key);
|
|
1319
|
+
this.cache.set(key, { signature, expiresAtMs });
|
|
1320
|
+
this.evict();
|
|
1321
|
+
return signature;
|
|
1322
|
+
} catch (error) {
|
|
1323
|
+
console.warn("Failed to obtain context signature:", error);
|
|
1324
|
+
return void 0;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
var version = "1.11.0";
|
|
1238
1329
|
var SINGLETON = {};
|
|
1239
1330
|
var models_exports = {};
|
|
1240
1331
|
__export(models_exports, {
|
|
@@ -1242,15 +1333,59 @@ __export(models_exports, {
|
|
|
1242
1333
|
ApiErrorFromJSONTyped: () => ApiErrorFromJSONTyped,
|
|
1243
1334
|
ApiErrorToJSON: () => ApiErrorToJSON,
|
|
1244
1335
|
ApiErrorToJSONTyped: () => ApiErrorToJSONTyped,
|
|
1336
|
+
BillingPlanCreditGrantResetCadence: () => BillingPlanCreditGrantResetCadence,
|
|
1337
|
+
BillingPlanCreditGrantResetCadenceFromJSON: () => BillingPlanCreditGrantResetCadenceFromJSON2,
|
|
1338
|
+
BillingPlanCreditGrantResetCadenceFromJSONTyped: () => BillingPlanCreditGrantResetCadenceFromJSONTyped3,
|
|
1339
|
+
BillingPlanCreditGrantResetCadenceToJSON: () => BillingPlanCreditGrantResetCadenceToJSON2,
|
|
1340
|
+
BillingPlanCreditGrantResetCadenceToJSONTyped: () => BillingPlanCreditGrantResetCadenceToJSONTyped3,
|
|
1341
|
+
BillingPriceScheme: () => BillingPriceScheme,
|
|
1342
|
+
BillingPriceSchemeFromJSON: () => BillingPriceSchemeFromJSON2,
|
|
1343
|
+
BillingPriceSchemeFromJSONTyped: () => BillingPriceSchemeFromJSONTyped4,
|
|
1344
|
+
BillingPriceSchemeToJSON: () => BillingPriceSchemeToJSON2,
|
|
1345
|
+
BillingPriceSchemeToJSONTyped: () => BillingPriceSchemeToJSONTyped4,
|
|
1346
|
+
BillingProductPriceInterval: () => BillingProductPriceInterval,
|
|
1347
|
+
BillingProductPriceIntervalFromJSON: () => BillingProductPriceIntervalFromJSON2,
|
|
1348
|
+
BillingProductPriceIntervalFromJSONTyped: () => BillingProductPriceIntervalFromJSONTyped4,
|
|
1349
|
+
BillingProductPriceIntervalToJSON: () => BillingProductPriceIntervalToJSON2,
|
|
1350
|
+
BillingProductPriceIntervalToJSONTyped: () => BillingProductPriceIntervalToJSONTyped4,
|
|
1245
1351
|
BillingProviderType: () => BillingProviderType,
|
|
1246
1352
|
BillingProviderTypeFromJSON: () => BillingProviderTypeFromJSON2,
|
|
1247
1353
|
BillingProviderTypeFromJSONTyped: () => BillingProviderTypeFromJSONTyped11,
|
|
1248
1354
|
BillingProviderTypeToJSON: () => BillingProviderTypeToJSON2,
|
|
1249
1355
|
BillingProviderTypeToJSONTyped: () => BillingProviderTypeToJSONTyped11,
|
|
1356
|
+
BillingTiersMode: () => BillingTiersMode,
|
|
1357
|
+
BillingTiersModeFromJSON: () => BillingTiersModeFromJSON2,
|
|
1358
|
+
BillingTiersModeFromJSONTyped: () => BillingTiersModeFromJSONTyped4,
|
|
1359
|
+
BillingTiersModeToJSON: () => BillingTiersModeToJSON2,
|
|
1360
|
+
BillingTiersModeToJSONTyped: () => BillingTiersModeToJSONTyped4,
|
|
1361
|
+
CatalogCreditGrantResponseDataFromJSON: () => CatalogCreditGrantResponseDataFromJSON,
|
|
1362
|
+
CatalogCreditGrantResponseDataFromJSONTyped: () => CatalogCreditGrantResponseDataFromJSONTyped,
|
|
1363
|
+
CatalogCreditGrantResponseDataToJSON: () => CatalogCreditGrantResponseDataToJSON,
|
|
1364
|
+
CatalogCreditGrantResponseDataToJSONTyped: () => CatalogCreditGrantResponseDataToJSONTyped,
|
|
1365
|
+
CatalogPriceResponseDataFromJSON: () => CatalogPriceResponseDataFromJSON,
|
|
1366
|
+
CatalogPriceResponseDataFromJSONTyped: () => CatalogPriceResponseDataFromJSONTyped,
|
|
1367
|
+
CatalogPriceResponseDataToJSON: () => CatalogPriceResponseDataToJSON,
|
|
1368
|
+
CatalogPriceResponseDataToJSONTyped: () => CatalogPriceResponseDataToJSONTyped,
|
|
1369
|
+
CatalogPriceTierResponseDataFromJSON: () => CatalogPriceTierResponseDataFromJSON,
|
|
1370
|
+
CatalogPriceTierResponseDataFromJSONTyped: () => CatalogPriceTierResponseDataFromJSONTyped,
|
|
1371
|
+
CatalogPriceTierResponseDataToJSON: () => CatalogPriceTierResponseDataToJSON,
|
|
1372
|
+
CatalogPriceTierResponseDataToJSONTyped: () => CatalogPriceTierResponseDataToJSONTyped,
|
|
1250
1373
|
CompanyDiscountResponseDataFromJSON: () => CompanyDiscountResponseDataFromJSON,
|
|
1251
1374
|
CompanyDiscountResponseDataFromJSONTyped: () => CompanyDiscountResponseDataFromJSONTyped,
|
|
1252
1375
|
CompanyDiscountResponseDataToJSON: () => CompanyDiscountResponseDataToJSON,
|
|
1253
1376
|
CompanyDiscountResponseDataToJSONTyped: () => CompanyDiscountResponseDataToJSONTyped,
|
|
1377
|
+
CompanyFeatureUsageListResponseDataFromJSON: () => CompanyFeatureUsageListResponseDataFromJSON,
|
|
1378
|
+
CompanyFeatureUsageListResponseDataFromJSONTyped: () => CompanyFeatureUsageListResponseDataFromJSONTyped,
|
|
1379
|
+
CompanyFeatureUsageListResponseDataToJSON: () => CompanyFeatureUsageListResponseDataToJSON,
|
|
1380
|
+
CompanyFeatureUsageListResponseDataToJSONTyped: () => CompanyFeatureUsageListResponseDataToJSONTyped,
|
|
1381
|
+
CompanyFeatureUsageResponseDataFromJSON: () => CompanyFeatureUsageResponseDataFromJSON,
|
|
1382
|
+
CompanyFeatureUsageResponseDataFromJSONTyped: () => CompanyFeatureUsageResponseDataFromJSONTyped,
|
|
1383
|
+
CompanyFeatureUsageResponseDataToJSON: () => CompanyFeatureUsageResponseDataToJSON,
|
|
1384
|
+
CompanyFeatureUsageResponseDataToJSONTyped: () => CompanyFeatureUsageResponseDataToJSONTyped,
|
|
1385
|
+
CompanyFeatureUserUsageResponseDataFromJSON: () => CompanyFeatureUserUsageResponseDataFromJSON,
|
|
1386
|
+
CompanyFeatureUserUsageResponseDataFromJSONTyped: () => CompanyFeatureUserUsageResponseDataFromJSONTyped,
|
|
1387
|
+
CompanyFeatureUserUsageResponseDataToJSON: () => CompanyFeatureUserUsageResponseDataToJSON,
|
|
1388
|
+
CompanyFeatureUserUsageResponseDataToJSONTyped: () => CompanyFeatureUserUsageResponseDataToJSONTyped,
|
|
1254
1389
|
CompanyInvoiceResponseDataFromJSON: () => CompanyInvoiceResponseDataFromJSON,
|
|
1255
1390
|
CompanyInvoiceResponseDataFromJSONTyped: () => CompanyInvoiceResponseDataFromJSONTyped,
|
|
1256
1391
|
CompanyInvoiceResponseDataToJSON: () => CompanyInvoiceResponseDataToJSON,
|
|
@@ -1271,6 +1406,10 @@ __export(models_exports, {
|
|
|
1271
1406
|
CompanyUpcomingInvoiceResponseDataFromJSONTyped: () => CompanyUpcomingInvoiceResponseDataFromJSONTyped,
|
|
1272
1407
|
CompanyUpcomingInvoiceResponseDataToJSON: () => CompanyUpcomingInvoiceResponseDataToJSON,
|
|
1273
1408
|
CompanyUpcomingInvoiceResponseDataToJSONTyped: () => CompanyUpcomingInvoiceResponseDataToJSONTyped,
|
|
1409
|
+
CompanyUserUsageResponseDataFromJSON: () => CompanyUserUsageResponseDataFromJSON,
|
|
1410
|
+
CompanyUserUsageResponseDataFromJSONTyped: () => CompanyUserUsageResponseDataFromJSONTyped,
|
|
1411
|
+
CompanyUserUsageResponseDataToJSON: () => CompanyUserUsageResponseDataToJSON,
|
|
1412
|
+
CompanyUserUsageResponseDataToJSONTyped: () => CompanyUserUsageResponseDataToJSONTyped,
|
|
1274
1413
|
CreateSetupIntentResponseFromJSON: () => CreateSetupIntentResponseFromJSON,
|
|
1275
1414
|
CreateSetupIntentResponseFromJSONTyped: () => CreateSetupIntentResponseFromJSONTyped,
|
|
1276
1415
|
CreateSetupIntentResponseToJSON: () => CreateSetupIntentResponseToJSON,
|
|
@@ -1283,6 +1422,38 @@ __export(models_exports, {
|
|
|
1283
1422
|
DeleteResponseFromJSONTyped: () => DeleteResponseFromJSONTyped,
|
|
1284
1423
|
DeleteResponseToJSON: () => DeleteResponseToJSON,
|
|
1285
1424
|
DeleteResponseToJSONTyped: () => DeleteResponseToJSONTyped,
|
|
1425
|
+
EntitlementPriceBehavior: () => EntitlementPriceBehavior,
|
|
1426
|
+
EntitlementPriceBehaviorFromJSON: () => EntitlementPriceBehaviorFromJSON2,
|
|
1427
|
+
EntitlementPriceBehaviorFromJSONTyped: () => EntitlementPriceBehaviorFromJSONTyped2,
|
|
1428
|
+
EntitlementPriceBehaviorToJSON: () => EntitlementPriceBehaviorToJSON2,
|
|
1429
|
+
EntitlementPriceBehaviorToJSONTyped: () => EntitlementPriceBehaviorToJSONTyped2,
|
|
1430
|
+
EntitlementType: () => EntitlementType,
|
|
1431
|
+
EntitlementTypeFromJSON: () => EntitlementTypeFromJSON,
|
|
1432
|
+
EntitlementTypeFromJSONTyped: () => EntitlementTypeFromJSONTyped,
|
|
1433
|
+
EntitlementTypeToJSON: () => EntitlementTypeToJSON,
|
|
1434
|
+
EntitlementTypeToJSONTyped: () => EntitlementTypeToJSONTyped,
|
|
1435
|
+
EntitlementValueType: () => EntitlementValueType,
|
|
1436
|
+
EntitlementValueTypeFromJSON: () => EntitlementValueTypeFromJSON2,
|
|
1437
|
+
EntitlementValueTypeFromJSONTyped: () => EntitlementValueTypeFromJSONTyped4,
|
|
1438
|
+
EntitlementValueTypeToJSON: () => EntitlementValueTypeToJSON2,
|
|
1439
|
+
EntitlementValueTypeToJSONTyped: () => EntitlementValueTypeToJSONTyped3,
|
|
1440
|
+
FeatureType: () => FeatureType,
|
|
1441
|
+
FeatureTypeFromJSON: () => FeatureTypeFromJSON2,
|
|
1442
|
+
FeatureTypeFromJSONTyped: () => FeatureTypeFromJSONTyped3,
|
|
1443
|
+
FeatureTypeToJSON: () => FeatureTypeToJSON2,
|
|
1444
|
+
FeatureTypeToJSONTyped: () => FeatureTypeToJSONTyped3,
|
|
1445
|
+
GetCompanyFeatureUsageResponseFromJSON: () => GetCompanyFeatureUsageResponseFromJSON,
|
|
1446
|
+
GetCompanyFeatureUsageResponseFromJSONTyped: () => GetCompanyFeatureUsageResponseFromJSONTyped,
|
|
1447
|
+
GetCompanyFeatureUsageResponseToJSON: () => GetCompanyFeatureUsageResponseToJSON,
|
|
1448
|
+
GetCompanyFeatureUsageResponseToJSONTyped: () => GetCompanyFeatureUsageResponseToJSONTyped,
|
|
1449
|
+
GetCompanyFeatureUserUsageParamsFromJSON: () => GetCompanyFeatureUserUsageParamsFromJSON,
|
|
1450
|
+
GetCompanyFeatureUserUsageParamsFromJSONTyped: () => GetCompanyFeatureUserUsageParamsFromJSONTyped,
|
|
1451
|
+
GetCompanyFeatureUserUsageParamsToJSON: () => GetCompanyFeatureUserUsageParamsToJSON,
|
|
1452
|
+
GetCompanyFeatureUserUsageParamsToJSONTyped: () => GetCompanyFeatureUserUsageParamsToJSONTyped,
|
|
1453
|
+
GetCompanyFeatureUserUsageResponseFromJSON: () => GetCompanyFeatureUserUsageResponseFromJSON,
|
|
1454
|
+
GetCompanyFeatureUserUsageResponseFromJSONTyped: () => GetCompanyFeatureUserUsageResponseFromJSONTyped,
|
|
1455
|
+
GetCompanyFeatureUserUsageResponseToJSON: () => GetCompanyFeatureUserUsageResponseToJSON,
|
|
1456
|
+
GetCompanyFeatureUserUsageResponseToJSONTyped: () => GetCompanyFeatureUserUsageResponseToJSONTyped,
|
|
1286
1457
|
GetCompanyInvoicesParamsFromJSON: () => GetCompanyInvoicesParamsFromJSON,
|
|
1287
1458
|
GetCompanyInvoicesParamsFromJSONTyped: () => GetCompanyInvoicesParamsFromJSONTyped,
|
|
1288
1459
|
GetCompanyInvoicesParamsToJSON: () => GetCompanyInvoicesParamsToJSON,
|
|
@@ -1304,10 +1475,25 @@ __export(models_exports, {
|
|
|
1304
1475
|
InvoiceStatusFromJSONTyped: () => InvoiceStatusFromJSONTyped,
|
|
1305
1476
|
InvoiceStatusToJSON: () => InvoiceStatusToJSON,
|
|
1306
1477
|
InvoiceStatusToJSONTyped: () => InvoiceStatusToJSONTyped,
|
|
1478
|
+
MetricPeriod: () => MetricPeriod,
|
|
1479
|
+
MetricPeriodFromJSON: () => MetricPeriodFromJSON2,
|
|
1480
|
+
MetricPeriodFromJSONTyped: () => MetricPeriodFromJSONTyped7,
|
|
1481
|
+
MetricPeriodMonthReset: () => MetricPeriodMonthReset,
|
|
1482
|
+
MetricPeriodMonthResetFromJSON: () => MetricPeriodMonthResetFromJSON2,
|
|
1483
|
+
MetricPeriodMonthResetFromJSONTyped: () => MetricPeriodMonthResetFromJSONTyped6,
|
|
1484
|
+
MetricPeriodMonthResetToJSON: () => MetricPeriodMonthResetToJSON2,
|
|
1485
|
+
MetricPeriodMonthResetToJSONTyped: () => MetricPeriodMonthResetToJSONTyped5,
|
|
1486
|
+
MetricPeriodToJSON: () => MetricPeriodToJSON2,
|
|
1487
|
+
MetricPeriodToJSONTyped: () => MetricPeriodToJSONTyped6,
|
|
1307
1488
|
PaymentMethodResponseDataFromJSON: () => PaymentMethodResponseDataFromJSON,
|
|
1308
1489
|
PaymentMethodResponseDataFromJSONTyped: () => PaymentMethodResponseDataFromJSONTyped,
|
|
1309
1490
|
PaymentMethodResponseDataToJSON: () => PaymentMethodResponseDataToJSON,
|
|
1310
1491
|
PaymentMethodResponseDataToJSONTyped: () => PaymentMethodResponseDataToJSONTyped,
|
|
1492
|
+
PlanCreditGrantScaling: () => PlanCreditGrantScaling,
|
|
1493
|
+
PlanCreditGrantScalingFromJSON: () => PlanCreditGrantScalingFromJSON2,
|
|
1494
|
+
PlanCreditGrantScalingFromJSONTyped: () => PlanCreditGrantScalingFromJSONTyped3,
|
|
1495
|
+
PlanCreditGrantScalingToJSON: () => PlanCreditGrantScalingToJSON2,
|
|
1496
|
+
PlanCreditGrantScalingToJSONTyped: () => PlanCreditGrantScalingToJSONTyped3,
|
|
1311
1497
|
SetupIntentResponseDataFromJSON: () => SetupIntentResponseDataFromJSON,
|
|
1312
1498
|
SetupIntentResponseDataFromJSONTyped: () => SetupIntentResponseDataFromJSONTyped,
|
|
1313
1499
|
SetupIntentResponseDataToJSON: () => SetupIntentResponseDataToJSON,
|
|
@@ -1321,22 +1507,43 @@ __export(models_exports, {
|
|
|
1321
1507
|
UpdatePaymentMethodResponseToJSON: () => UpdatePaymentMethodResponseToJSON,
|
|
1322
1508
|
UpdatePaymentMethodResponseToJSONTyped: () => UpdatePaymentMethodResponseToJSONTyped,
|
|
1323
1509
|
instanceOfApiError: () => instanceOfApiError,
|
|
1510
|
+
instanceOfBillingPlanCreditGrantResetCadence: () => instanceOfBillingPlanCreditGrantResetCadence,
|
|
1511
|
+
instanceOfBillingPriceScheme: () => instanceOfBillingPriceScheme,
|
|
1512
|
+
instanceOfBillingProductPriceInterval: () => instanceOfBillingProductPriceInterval,
|
|
1324
1513
|
instanceOfBillingProviderType: () => instanceOfBillingProviderType,
|
|
1514
|
+
instanceOfBillingTiersMode: () => instanceOfBillingTiersMode,
|
|
1515
|
+
instanceOfCatalogCreditGrantResponseData: () => instanceOfCatalogCreditGrantResponseData,
|
|
1516
|
+
instanceOfCatalogPriceResponseData: () => instanceOfCatalogPriceResponseData,
|
|
1517
|
+
instanceOfCatalogPriceTierResponseData: () => instanceOfCatalogPriceTierResponseData,
|
|
1325
1518
|
instanceOfCompanyDiscountResponseData: () => instanceOfCompanyDiscountResponseData,
|
|
1519
|
+
instanceOfCompanyFeatureUsageListResponseData: () => instanceOfCompanyFeatureUsageListResponseData,
|
|
1520
|
+
instanceOfCompanyFeatureUsageResponseData: () => instanceOfCompanyFeatureUsageResponseData,
|
|
1521
|
+
instanceOfCompanyFeatureUserUsageResponseData: () => instanceOfCompanyFeatureUserUsageResponseData,
|
|
1326
1522
|
instanceOfCompanyInvoiceResponseData: () => instanceOfCompanyInvoiceResponseData,
|
|
1327
1523
|
instanceOfCompanyInvoicesResponseData: () => instanceOfCompanyInvoicesResponseData,
|
|
1328
1524
|
instanceOfCompanyPaymentMethodResponseData: () => instanceOfCompanyPaymentMethodResponseData,
|
|
1329
1525
|
instanceOfCompanyPaymentMethodsResponseData: () => instanceOfCompanyPaymentMethodsResponseData,
|
|
1330
1526
|
instanceOfCompanyUpcomingInvoiceResponseData: () => instanceOfCompanyUpcomingInvoiceResponseData,
|
|
1527
|
+
instanceOfCompanyUserUsageResponseData: () => instanceOfCompanyUserUsageResponseData,
|
|
1331
1528
|
instanceOfCreateSetupIntentResponse: () => instanceOfCreateSetupIntentResponse,
|
|
1332
1529
|
instanceOfDeletePaymentMethodResponse: () => instanceOfDeletePaymentMethodResponse,
|
|
1333
1530
|
instanceOfDeleteResponse: () => instanceOfDeleteResponse,
|
|
1531
|
+
instanceOfEntitlementPriceBehavior: () => instanceOfEntitlementPriceBehavior,
|
|
1532
|
+
instanceOfEntitlementType: () => instanceOfEntitlementType,
|
|
1533
|
+
instanceOfEntitlementValueType: () => instanceOfEntitlementValueType,
|
|
1534
|
+
instanceOfFeatureType: () => instanceOfFeatureType,
|
|
1535
|
+
instanceOfGetCompanyFeatureUsageResponse: () => instanceOfGetCompanyFeatureUsageResponse,
|
|
1536
|
+
instanceOfGetCompanyFeatureUserUsageParams: () => instanceOfGetCompanyFeatureUserUsageParams,
|
|
1537
|
+
instanceOfGetCompanyFeatureUserUsageResponse: () => instanceOfGetCompanyFeatureUserUsageResponse,
|
|
1334
1538
|
instanceOfGetCompanyInvoicesParams: () => instanceOfGetCompanyInvoicesParams,
|
|
1335
1539
|
instanceOfGetCompanyInvoicesResponse: () => instanceOfGetCompanyInvoicesResponse,
|
|
1336
1540
|
instanceOfGetCompanyPaymentMethodsResponse: () => instanceOfGetCompanyPaymentMethodsResponse,
|
|
1337
1541
|
instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
|
|
1338
1542
|
instanceOfInvoiceStatus: () => instanceOfInvoiceStatus,
|
|
1543
|
+
instanceOfMetricPeriod: () => instanceOfMetricPeriod,
|
|
1544
|
+
instanceOfMetricPeriodMonthReset: () => instanceOfMetricPeriodMonthReset,
|
|
1339
1545
|
instanceOfPaymentMethodResponseData: () => instanceOfPaymentMethodResponseData,
|
|
1546
|
+
instanceOfPlanCreditGrantScaling: () => instanceOfPlanCreditGrantScaling,
|
|
1340
1547
|
instanceOfSetupIntentResponseData: () => instanceOfSetupIntentResponseData,
|
|
1341
1548
|
instanceOfUpdatePaymentMethodRequestBody: () => instanceOfUpdatePaymentMethodRequestBody,
|
|
1342
1549
|
instanceOfUpdatePaymentMethodResponse: () => instanceOfUpdatePaymentMethodResponse
|
|
@@ -1367,6 +1574,93 @@ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
1367
1574
|
error: value["error"]
|
|
1368
1575
|
};
|
|
1369
1576
|
}
|
|
1577
|
+
var BillingPlanCreditGrantResetCadence = {
|
|
1578
|
+
Daily: "daily",
|
|
1579
|
+
Every6Months: "every_6_months",
|
|
1580
|
+
Monthly: "monthly",
|
|
1581
|
+
Quarterly: "quarterly",
|
|
1582
|
+
Weekly: "weekly",
|
|
1583
|
+
Yearly: "yearly"
|
|
1584
|
+
};
|
|
1585
|
+
function instanceOfBillingPlanCreditGrantResetCadence(value) {
|
|
1586
|
+
for (const key in BillingPlanCreditGrantResetCadence) {
|
|
1587
|
+
if (Object.prototype.hasOwnProperty.call(
|
|
1588
|
+
BillingPlanCreditGrantResetCadence,
|
|
1589
|
+
key
|
|
1590
|
+
)) {
|
|
1591
|
+
if (BillingPlanCreditGrantResetCadence[key] === value) {
|
|
1592
|
+
return true;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return false;
|
|
1597
|
+
}
|
|
1598
|
+
function BillingPlanCreditGrantResetCadenceFromJSON2(json) {
|
|
1599
|
+
return BillingPlanCreditGrantResetCadenceFromJSONTyped3(json, false);
|
|
1600
|
+
}
|
|
1601
|
+
function BillingPlanCreditGrantResetCadenceFromJSONTyped3(json, ignoreDiscriminator) {
|
|
1602
|
+
return json;
|
|
1603
|
+
}
|
|
1604
|
+
function BillingPlanCreditGrantResetCadenceToJSON2(value) {
|
|
1605
|
+
return value;
|
|
1606
|
+
}
|
|
1607
|
+
function BillingPlanCreditGrantResetCadenceToJSONTyped3(value, ignoreDiscriminator) {
|
|
1608
|
+
return value;
|
|
1609
|
+
}
|
|
1610
|
+
var BillingPriceScheme = {
|
|
1611
|
+
PerUnit: "per_unit",
|
|
1612
|
+
Tiered: "tiered"
|
|
1613
|
+
};
|
|
1614
|
+
function instanceOfBillingPriceScheme(value) {
|
|
1615
|
+
for (const key in BillingPriceScheme) {
|
|
1616
|
+
if (Object.prototype.hasOwnProperty.call(BillingPriceScheme, key)) {
|
|
1617
|
+
if (BillingPriceScheme[key] === value) {
|
|
1618
|
+
return true;
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
return false;
|
|
1623
|
+
}
|
|
1624
|
+
function BillingPriceSchemeFromJSON2(json) {
|
|
1625
|
+
return BillingPriceSchemeFromJSONTyped4(json, false);
|
|
1626
|
+
}
|
|
1627
|
+
function BillingPriceSchemeFromJSONTyped4(json, ignoreDiscriminator) {
|
|
1628
|
+
return json;
|
|
1629
|
+
}
|
|
1630
|
+
function BillingPriceSchemeToJSON2(value) {
|
|
1631
|
+
return value;
|
|
1632
|
+
}
|
|
1633
|
+
function BillingPriceSchemeToJSONTyped4(value, ignoreDiscriminator) {
|
|
1634
|
+
return value;
|
|
1635
|
+
}
|
|
1636
|
+
var BillingProductPriceInterval = {
|
|
1637
|
+
Day: "day",
|
|
1638
|
+
Month: "month",
|
|
1639
|
+
OneTime: "one-time",
|
|
1640
|
+
Year: "year"
|
|
1641
|
+
};
|
|
1642
|
+
function instanceOfBillingProductPriceInterval(value) {
|
|
1643
|
+
for (const key in BillingProductPriceInterval) {
|
|
1644
|
+
if (Object.prototype.hasOwnProperty.call(BillingProductPriceInterval, key)) {
|
|
1645
|
+
if (BillingProductPriceInterval[key] === value) {
|
|
1646
|
+
return true;
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
return false;
|
|
1651
|
+
}
|
|
1652
|
+
function BillingProductPriceIntervalFromJSON2(json) {
|
|
1653
|
+
return BillingProductPriceIntervalFromJSONTyped4(json, false);
|
|
1654
|
+
}
|
|
1655
|
+
function BillingProductPriceIntervalFromJSONTyped4(json, ignoreDiscriminator) {
|
|
1656
|
+
return json;
|
|
1657
|
+
}
|
|
1658
|
+
function BillingProductPriceIntervalToJSON2(value) {
|
|
1659
|
+
return value;
|
|
1660
|
+
}
|
|
1661
|
+
function BillingProductPriceIntervalToJSONTyped4(value, ignoreDiscriminator) {
|
|
1662
|
+
return value;
|
|
1663
|
+
}
|
|
1370
1664
|
var BillingProviderType = {
|
|
1371
1665
|
Metronome: "metronome",
|
|
1372
1666
|
Orb: "orb",
|
|
@@ -1395,6 +1689,208 @@ function BillingProviderTypeToJSON2(value) {
|
|
|
1395
1689
|
function BillingProviderTypeToJSONTyped11(value, ignoreDiscriminator) {
|
|
1396
1690
|
return value;
|
|
1397
1691
|
}
|
|
1692
|
+
var BillingTiersMode = {
|
|
1693
|
+
Graduated: "graduated",
|
|
1694
|
+
Volume: "volume"
|
|
1695
|
+
};
|
|
1696
|
+
function instanceOfBillingTiersMode(value) {
|
|
1697
|
+
for (const key in BillingTiersMode) {
|
|
1698
|
+
if (Object.prototype.hasOwnProperty.call(BillingTiersMode, key)) {
|
|
1699
|
+
if (BillingTiersMode[key] === value) {
|
|
1700
|
+
return true;
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
}
|
|
1704
|
+
return false;
|
|
1705
|
+
}
|
|
1706
|
+
function BillingTiersModeFromJSON2(json) {
|
|
1707
|
+
return BillingTiersModeFromJSONTyped4(json, false);
|
|
1708
|
+
}
|
|
1709
|
+
function BillingTiersModeFromJSONTyped4(json, ignoreDiscriminator) {
|
|
1710
|
+
return json;
|
|
1711
|
+
}
|
|
1712
|
+
function BillingTiersModeToJSON2(value) {
|
|
1713
|
+
return value;
|
|
1714
|
+
}
|
|
1715
|
+
function BillingTiersModeToJSONTyped4(value, ignoreDiscriminator) {
|
|
1716
|
+
return value;
|
|
1717
|
+
}
|
|
1718
|
+
var PlanCreditGrantScaling = {
|
|
1719
|
+
Fixed: "fixed",
|
|
1720
|
+
PerLicense: "per_license"
|
|
1721
|
+
};
|
|
1722
|
+
function instanceOfPlanCreditGrantScaling(value) {
|
|
1723
|
+
for (const key in PlanCreditGrantScaling) {
|
|
1724
|
+
if (Object.prototype.hasOwnProperty.call(PlanCreditGrantScaling, key)) {
|
|
1725
|
+
if (PlanCreditGrantScaling[key] === value) {
|
|
1726
|
+
return true;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
return false;
|
|
1731
|
+
}
|
|
1732
|
+
function PlanCreditGrantScalingFromJSON2(json) {
|
|
1733
|
+
return PlanCreditGrantScalingFromJSONTyped3(json, false);
|
|
1734
|
+
}
|
|
1735
|
+
function PlanCreditGrantScalingFromJSONTyped3(json, ignoreDiscriminator) {
|
|
1736
|
+
return json;
|
|
1737
|
+
}
|
|
1738
|
+
function PlanCreditGrantScalingToJSON2(value) {
|
|
1739
|
+
return value;
|
|
1740
|
+
}
|
|
1741
|
+
function PlanCreditGrantScalingToJSONTyped3(value, ignoreDiscriminator) {
|
|
1742
|
+
return value;
|
|
1743
|
+
}
|
|
1744
|
+
function instanceOfCatalogCreditGrantResponseData(value) {
|
|
1745
|
+
if (!("companyCreditAmount" in value) || value["companyCreditAmount"] === void 0)
|
|
1746
|
+
return false;
|
|
1747
|
+
if (!("creditAmount" in value) || value["creditAmount"] === void 0)
|
|
1748
|
+
return false;
|
|
1749
|
+
if (!("creditId" in value) || value["creditId"] === void 0) return false;
|
|
1750
|
+
if (!("creditName" in value) || value["creditName"] === void 0)
|
|
1751
|
+
return false;
|
|
1752
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
1753
|
+
if (!("scaling" in value) || value["scaling"] === void 0) return false;
|
|
1754
|
+
return true;
|
|
1755
|
+
}
|
|
1756
|
+
function CatalogCreditGrantResponseDataFromJSON(json) {
|
|
1757
|
+
return CatalogCreditGrantResponseDataFromJSONTyped(json, false);
|
|
1758
|
+
}
|
|
1759
|
+
function CatalogCreditGrantResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
1760
|
+
if (json == null) {
|
|
1761
|
+
return json;
|
|
1762
|
+
}
|
|
1763
|
+
return {
|
|
1764
|
+
companyCreditAmount: json["company_credit_amount"],
|
|
1765
|
+
creditAmount: json["credit_amount"],
|
|
1766
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
1767
|
+
creditId: json["credit_id"],
|
|
1768
|
+
creditName: json["credit_name"],
|
|
1769
|
+
creditPluralName: json["credit_plural_name"] == null ? void 0 : json["credit_plural_name"],
|
|
1770
|
+
creditSingularName: json["credit_singular_name"] == null ? void 0 : json["credit_singular_name"],
|
|
1771
|
+
id: json["id"],
|
|
1772
|
+
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
1773
|
+
resetCadence: json["reset_cadence"] == null ? void 0 : BillingPlanCreditGrantResetCadenceFromJSON2(json["reset_cadence"]),
|
|
1774
|
+
scaling: PlanCreditGrantScalingFromJSON2(json["scaling"])
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
function CatalogCreditGrantResponseDataToJSON(json) {
|
|
1778
|
+
return CatalogCreditGrantResponseDataToJSONTyped(json, false);
|
|
1779
|
+
}
|
|
1780
|
+
function CatalogCreditGrantResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1781
|
+
if (value == null) {
|
|
1782
|
+
return value;
|
|
1783
|
+
}
|
|
1784
|
+
return {
|
|
1785
|
+
company_credit_amount: value["companyCreditAmount"],
|
|
1786
|
+
credit_amount: value["creditAmount"],
|
|
1787
|
+
credit_icon: value["creditIcon"],
|
|
1788
|
+
credit_id: value["creditId"],
|
|
1789
|
+
credit_name: value["creditName"],
|
|
1790
|
+
credit_plural_name: value["creditPluralName"],
|
|
1791
|
+
credit_singular_name: value["creditSingularName"],
|
|
1792
|
+
id: value["id"],
|
|
1793
|
+
license_id: value["licenseId"],
|
|
1794
|
+
reset_cadence: BillingPlanCreditGrantResetCadenceToJSON2(
|
|
1795
|
+
value["resetCadence"]
|
|
1796
|
+
),
|
|
1797
|
+
scaling: PlanCreditGrantScalingToJSON2(value["scaling"])
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
function instanceOfCatalogPriceTierResponseData(value) {
|
|
1801
|
+
if (!("from" in value) || value["from"] === void 0) return false;
|
|
1802
|
+
return true;
|
|
1803
|
+
}
|
|
1804
|
+
function CatalogPriceTierResponseDataFromJSON(json) {
|
|
1805
|
+
return CatalogPriceTierResponseDataFromJSONTyped(json, false);
|
|
1806
|
+
}
|
|
1807
|
+
function CatalogPriceTierResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
1808
|
+
if (json == null) {
|
|
1809
|
+
return json;
|
|
1810
|
+
}
|
|
1811
|
+
return {
|
|
1812
|
+
flatPrice: json["flat_price"] == null ? void 0 : json["flat_price"],
|
|
1813
|
+
from: json["from"],
|
|
1814
|
+
perUnitPrice: json["per_unit_price"] == null ? void 0 : json["per_unit_price"],
|
|
1815
|
+
perUnitPriceDecimal: json["per_unit_price_decimal"] == null ? void 0 : json["per_unit_price_decimal"],
|
|
1816
|
+
to: json["to"] == null ? void 0 : json["to"]
|
|
1817
|
+
};
|
|
1818
|
+
}
|
|
1819
|
+
function CatalogPriceTierResponseDataToJSON(json) {
|
|
1820
|
+
return CatalogPriceTierResponseDataToJSONTyped(json, false);
|
|
1821
|
+
}
|
|
1822
|
+
function CatalogPriceTierResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1823
|
+
if (value == null) {
|
|
1824
|
+
return value;
|
|
1825
|
+
}
|
|
1826
|
+
return {
|
|
1827
|
+
flat_price: value["flatPrice"],
|
|
1828
|
+
from: value["from"],
|
|
1829
|
+
per_unit_price: value["perUnitPrice"],
|
|
1830
|
+
per_unit_price_decimal: value["perUnitPriceDecimal"],
|
|
1831
|
+
to: value["to"]
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
function instanceOfCatalogPriceResponseData(value) {
|
|
1835
|
+
if (!("currency" in value) || value["currency"] === void 0) return false;
|
|
1836
|
+
if (!("id" in value) || value["id"] === void 0) return false;
|
|
1837
|
+
if (!("interval" in value) || value["interval"] === void 0) return false;
|
|
1838
|
+
if (!("intervalCount" in value) || value["intervalCount"] === void 0)
|
|
1839
|
+
return false;
|
|
1840
|
+
if (!("packageSize" in value) || value["packageSize"] === void 0)
|
|
1841
|
+
return false;
|
|
1842
|
+
if (!("price" in value) || value["price"] === void 0) return false;
|
|
1843
|
+
if (!("priceTiers" in value) || value["priceTiers"] === void 0)
|
|
1844
|
+
return false;
|
|
1845
|
+
if (!("scheme" in value) || value["scheme"] === void 0) return false;
|
|
1846
|
+
return true;
|
|
1847
|
+
}
|
|
1848
|
+
function CatalogPriceResponseDataFromJSON(json) {
|
|
1849
|
+
return CatalogPriceResponseDataFromJSONTyped(json, false);
|
|
1850
|
+
}
|
|
1851
|
+
function CatalogPriceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
1852
|
+
if (json == null) {
|
|
1853
|
+
return json;
|
|
1854
|
+
}
|
|
1855
|
+
return {
|
|
1856
|
+
currency: json["currency"],
|
|
1857
|
+
id: json["id"],
|
|
1858
|
+
interval: BillingProductPriceIntervalFromJSON2(json["interval"]),
|
|
1859
|
+
intervalCount: json["interval_count"],
|
|
1860
|
+
overageUnitPriceDecimal: json["overage_unit_price_decimal"] == null ? void 0 : json["overage_unit_price_decimal"],
|
|
1861
|
+
packageSize: json["package_size"],
|
|
1862
|
+
price: json["price"],
|
|
1863
|
+
priceDecimal: json["price_decimal"] == null ? void 0 : json["price_decimal"],
|
|
1864
|
+
priceTiers: json["price_tiers"].map(
|
|
1865
|
+
CatalogPriceTierResponseDataFromJSON
|
|
1866
|
+
),
|
|
1867
|
+
scheme: BillingPriceSchemeFromJSON2(json["scheme"]),
|
|
1868
|
+
tiersMode: json["tiers_mode"] == null ? void 0 : BillingTiersModeFromJSON2(json["tiers_mode"])
|
|
1869
|
+
};
|
|
1870
|
+
}
|
|
1871
|
+
function CatalogPriceResponseDataToJSON(json) {
|
|
1872
|
+
return CatalogPriceResponseDataToJSONTyped(json, false);
|
|
1873
|
+
}
|
|
1874
|
+
function CatalogPriceResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
1875
|
+
if (value == null) {
|
|
1876
|
+
return value;
|
|
1877
|
+
}
|
|
1878
|
+
return {
|
|
1879
|
+
currency: value["currency"],
|
|
1880
|
+
id: value["id"],
|
|
1881
|
+
interval: BillingProductPriceIntervalToJSON2(value["interval"]),
|
|
1882
|
+
interval_count: value["intervalCount"],
|
|
1883
|
+
overage_unit_price_decimal: value["overageUnitPriceDecimal"],
|
|
1884
|
+
package_size: value["packageSize"],
|
|
1885
|
+
price: value["price"],
|
|
1886
|
+
price_decimal: value["priceDecimal"],
|
|
1887
|
+
price_tiers: value["priceTiers"].map(
|
|
1888
|
+
CatalogPriceTierResponseDataToJSON
|
|
1889
|
+
),
|
|
1890
|
+
scheme: BillingPriceSchemeToJSON2(value["scheme"]),
|
|
1891
|
+
tiers_mode: BillingTiersModeToJSON2(value["tiersMode"])
|
|
1892
|
+
};
|
|
1893
|
+
}
|
|
1398
1894
|
function instanceOfCompanyDiscountResponseData(value) {
|
|
1399
1895
|
if (!("couponName" in value) || value["couponName"] === void 0)
|
|
1400
1896
|
return false;
|
|
@@ -1435,6 +1931,394 @@ function CompanyDiscountResponseDataToJSONTyped(value, ignoreDiscriminator = fal
|
|
|
1435
1931
|
percent_off: value["percentOff"]
|
|
1436
1932
|
};
|
|
1437
1933
|
}
|
|
1934
|
+
var EntitlementValueType = {
|
|
1935
|
+
Boolean: "boolean",
|
|
1936
|
+
Credit: "credit",
|
|
1937
|
+
Numeric: "numeric",
|
|
1938
|
+
Trait: "trait",
|
|
1939
|
+
Unknown: "unknown",
|
|
1940
|
+
Unlimited: "unlimited"
|
|
1941
|
+
};
|
|
1942
|
+
function instanceOfEntitlementValueType(value) {
|
|
1943
|
+
for (const key in EntitlementValueType) {
|
|
1944
|
+
if (Object.prototype.hasOwnProperty.call(EntitlementValueType, key)) {
|
|
1945
|
+
if (EntitlementValueType[key] === value) {
|
|
1946
|
+
return true;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return false;
|
|
1951
|
+
}
|
|
1952
|
+
function EntitlementValueTypeFromJSON2(json) {
|
|
1953
|
+
return EntitlementValueTypeFromJSONTyped4(json, false);
|
|
1954
|
+
}
|
|
1955
|
+
function EntitlementValueTypeFromJSONTyped4(json, ignoreDiscriminator) {
|
|
1956
|
+
return json;
|
|
1957
|
+
}
|
|
1958
|
+
function EntitlementValueTypeToJSON2(value) {
|
|
1959
|
+
return value;
|
|
1960
|
+
}
|
|
1961
|
+
function EntitlementValueTypeToJSONTyped3(value, ignoreDiscriminator) {
|
|
1962
|
+
return value;
|
|
1963
|
+
}
|
|
1964
|
+
var FeatureType = {
|
|
1965
|
+
Boolean: "boolean",
|
|
1966
|
+
Event: "event",
|
|
1967
|
+
License: "license",
|
|
1968
|
+
Trait: "trait"
|
|
1969
|
+
};
|
|
1970
|
+
function instanceOfFeatureType(value) {
|
|
1971
|
+
for (const key in FeatureType) {
|
|
1972
|
+
if (Object.prototype.hasOwnProperty.call(FeatureType, key)) {
|
|
1973
|
+
if (FeatureType[key] === value) {
|
|
1974
|
+
return true;
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
return false;
|
|
1979
|
+
}
|
|
1980
|
+
function FeatureTypeFromJSON2(json) {
|
|
1981
|
+
return FeatureTypeFromJSONTyped3(json, false);
|
|
1982
|
+
}
|
|
1983
|
+
function FeatureTypeFromJSONTyped3(json, ignoreDiscriminator) {
|
|
1984
|
+
return json;
|
|
1985
|
+
}
|
|
1986
|
+
function FeatureTypeToJSON2(value) {
|
|
1987
|
+
return value;
|
|
1988
|
+
}
|
|
1989
|
+
function FeatureTypeToJSONTyped3(value, ignoreDiscriminator) {
|
|
1990
|
+
return value;
|
|
1991
|
+
}
|
|
1992
|
+
var MetricPeriodMonthReset = {
|
|
1993
|
+
BillingCycle: "billing_cycle",
|
|
1994
|
+
FirstOfMonth: "first_of_month"
|
|
1995
|
+
};
|
|
1996
|
+
function instanceOfMetricPeriodMonthReset(value) {
|
|
1997
|
+
for (const key in MetricPeriodMonthReset) {
|
|
1998
|
+
if (Object.prototype.hasOwnProperty.call(MetricPeriodMonthReset, key)) {
|
|
1999
|
+
if (MetricPeriodMonthReset[key] === value) {
|
|
2000
|
+
return true;
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
return false;
|
|
2005
|
+
}
|
|
2006
|
+
function MetricPeriodMonthResetFromJSON2(json) {
|
|
2007
|
+
return MetricPeriodMonthResetFromJSONTyped6(json, false);
|
|
2008
|
+
}
|
|
2009
|
+
function MetricPeriodMonthResetFromJSONTyped6(json, ignoreDiscriminator) {
|
|
2010
|
+
return json;
|
|
2011
|
+
}
|
|
2012
|
+
function MetricPeriodMonthResetToJSON2(value) {
|
|
2013
|
+
return value;
|
|
2014
|
+
}
|
|
2015
|
+
function MetricPeriodMonthResetToJSONTyped5(value, ignoreDiscriminator) {
|
|
2016
|
+
return value;
|
|
2017
|
+
}
|
|
2018
|
+
var MetricPeriod = {
|
|
2019
|
+
AllTime: "all_time",
|
|
2020
|
+
CurrentDay: "current_day",
|
|
2021
|
+
CurrentMonth: "current_month",
|
|
2022
|
+
CurrentWeek: "current_week"
|
|
2023
|
+
};
|
|
2024
|
+
function instanceOfMetricPeriod(value) {
|
|
2025
|
+
for (const key in MetricPeriod) {
|
|
2026
|
+
if (Object.prototype.hasOwnProperty.call(MetricPeriod, key)) {
|
|
2027
|
+
if (MetricPeriod[key] === value) {
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
return false;
|
|
2033
|
+
}
|
|
2034
|
+
function MetricPeriodFromJSON2(json) {
|
|
2035
|
+
return MetricPeriodFromJSONTyped7(json, false);
|
|
2036
|
+
}
|
|
2037
|
+
function MetricPeriodFromJSONTyped7(json, ignoreDiscriminator) {
|
|
2038
|
+
return json;
|
|
2039
|
+
}
|
|
2040
|
+
function MetricPeriodToJSON2(value) {
|
|
2041
|
+
return value;
|
|
2042
|
+
}
|
|
2043
|
+
function MetricPeriodToJSONTyped6(value, ignoreDiscriminator) {
|
|
2044
|
+
return value;
|
|
2045
|
+
}
|
|
2046
|
+
var EntitlementPriceBehavior = {
|
|
2047
|
+
CreditBurndown: "credit_burndown",
|
|
2048
|
+
Overage: "overage",
|
|
2049
|
+
PayAsYouGo: "pay_as_you_go",
|
|
2050
|
+
PayInAdvance: "pay_in_advance",
|
|
2051
|
+
Tier: "tier"
|
|
2052
|
+
};
|
|
2053
|
+
function instanceOfEntitlementPriceBehavior(value) {
|
|
2054
|
+
for (const key in EntitlementPriceBehavior) {
|
|
2055
|
+
if (Object.prototype.hasOwnProperty.call(EntitlementPriceBehavior, key)) {
|
|
2056
|
+
if (EntitlementPriceBehavior[key] === value) {
|
|
2057
|
+
return true;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
}
|
|
2061
|
+
return false;
|
|
2062
|
+
}
|
|
2063
|
+
function EntitlementPriceBehaviorFromJSON2(json) {
|
|
2064
|
+
return EntitlementPriceBehaviorFromJSONTyped2(json, false);
|
|
2065
|
+
}
|
|
2066
|
+
function EntitlementPriceBehaviorFromJSONTyped2(json, ignoreDiscriminator) {
|
|
2067
|
+
return json;
|
|
2068
|
+
}
|
|
2069
|
+
function EntitlementPriceBehaviorToJSON2(value) {
|
|
2070
|
+
return value;
|
|
2071
|
+
}
|
|
2072
|
+
function EntitlementPriceBehaviorToJSONTyped2(value, ignoreDiscriminator) {
|
|
2073
|
+
return value;
|
|
2074
|
+
}
|
|
2075
|
+
var EntitlementType = {
|
|
2076
|
+
CompanyOverride: "company_override",
|
|
2077
|
+
PlanEntitlement: "plan_entitlement",
|
|
2078
|
+
Unknown: "unknown"
|
|
2079
|
+
};
|
|
2080
|
+
function instanceOfEntitlementType(value) {
|
|
2081
|
+
for (const key in EntitlementType) {
|
|
2082
|
+
if (Object.prototype.hasOwnProperty.call(EntitlementType, key)) {
|
|
2083
|
+
if (EntitlementType[key] === value) {
|
|
2084
|
+
return true;
|
|
2085
|
+
}
|
|
2086
|
+
}
|
|
2087
|
+
}
|
|
2088
|
+
return false;
|
|
2089
|
+
}
|
|
2090
|
+
function EntitlementTypeFromJSON(json) {
|
|
2091
|
+
return EntitlementTypeFromJSONTyped(json, false);
|
|
2092
|
+
}
|
|
2093
|
+
function EntitlementTypeFromJSONTyped(json, ignoreDiscriminator) {
|
|
2094
|
+
return json;
|
|
2095
|
+
}
|
|
2096
|
+
function EntitlementTypeToJSON(value) {
|
|
2097
|
+
return value;
|
|
2098
|
+
}
|
|
2099
|
+
function EntitlementTypeToJSONTyped(value, ignoreDiscriminator) {
|
|
2100
|
+
return value;
|
|
2101
|
+
}
|
|
2102
|
+
function instanceOfCompanyFeatureUsageResponseData(value) {
|
|
2103
|
+
if (!("access" in value) || value["access"] === void 0) return false;
|
|
2104
|
+
if (!("entitlementType" in value) || value["entitlementType"] === void 0)
|
|
2105
|
+
return false;
|
|
2106
|
+
if (!("featureDescription" in value) || value["featureDescription"] === void 0)
|
|
2107
|
+
return false;
|
|
2108
|
+
if (!("featureIcon" in value) || value["featureIcon"] === void 0)
|
|
2109
|
+
return false;
|
|
2110
|
+
if (!("featureId" in value) || value["featureId"] === void 0) return false;
|
|
2111
|
+
if (!("featureName" in value) || value["featureName"] === void 0)
|
|
2112
|
+
return false;
|
|
2113
|
+
if (!("featureType" in value) || value["featureType"] === void 0)
|
|
2114
|
+
return false;
|
|
2115
|
+
if (!("perLicenseCreditGrants" in value) || value["perLicenseCreditGrants"] === void 0)
|
|
2116
|
+
return false;
|
|
2117
|
+
if (!("valueType" in value) || value["valueType"] === void 0) return false;
|
|
2118
|
+
return true;
|
|
2119
|
+
}
|
|
2120
|
+
function CompanyFeatureUsageResponseDataFromJSON(json) {
|
|
2121
|
+
return CompanyFeatureUsageResponseDataFromJSONTyped(json, false);
|
|
2122
|
+
}
|
|
2123
|
+
function CompanyFeatureUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2124
|
+
if (json == null) {
|
|
2125
|
+
return json;
|
|
2126
|
+
}
|
|
2127
|
+
return {
|
|
2128
|
+
access: json["access"],
|
|
2129
|
+
allocation: json["allocation"] == null ? void 0 : json["allocation"],
|
|
2130
|
+
companyOverrideId: json["company_override_id"] == null ? void 0 : json["company_override_id"],
|
|
2131
|
+
consumptionRate: json["consumption_rate"] == null ? void 0 : json["consumption_rate"],
|
|
2132
|
+
creditIcon: json["credit_icon"] == null ? void 0 : json["credit_icon"],
|
|
2133
|
+
creditId: json["credit_id"] == null ? void 0 : json["credit_id"],
|
|
2134
|
+
creditName: json["credit_name"] == null ? void 0 : json["credit_name"],
|
|
2135
|
+
creditPluralName: json["credit_plural_name"] == null ? void 0 : json["credit_plural_name"],
|
|
2136
|
+
creditSingularName: json["credit_singular_name"] == null ? void 0 : json["credit_singular_name"],
|
|
2137
|
+
currentCost: json["current_cost"] == null ? void 0 : json["current_cost"],
|
|
2138
|
+
entitlementType: EntitlementTypeFromJSON(json["entitlement_type"]),
|
|
2139
|
+
expiresAt: json["expires_at"] == null ? void 0 : new Date(json["expires_at"]),
|
|
2140
|
+
featureDescription: json["feature_description"],
|
|
2141
|
+
featureIcon: json["feature_icon"],
|
|
2142
|
+
featureId: json["feature_id"],
|
|
2143
|
+
featureName: json["feature_name"],
|
|
2144
|
+
featurePluralName: json["feature_plural_name"] == null ? void 0 : json["feature_plural_name"],
|
|
2145
|
+
featureSingularName: json["feature_singular_name"] == null ? void 0 : json["feature_singular_name"],
|
|
2146
|
+
featureType: FeatureTypeFromJSON2(json["feature_type"]),
|
|
2147
|
+
licenseId: json["license_id"] == null ? void 0 : json["license_id"],
|
|
2148
|
+
metricPeriod: json["metric_period"] == null ? void 0 : MetricPeriodFromJSON2(json["metric_period"]),
|
|
2149
|
+
metricPeriodMonthReset: json["metric_period_month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON2(json["metric_period_month_reset"]),
|
|
2150
|
+
perLicenseCreditGrants: json["per_license_credit_grants"].map(CatalogCreditGrantResponseDataFromJSON),
|
|
2151
|
+
planEntitlementId: json["plan_entitlement_id"] == null ? void 0 : json["plan_entitlement_id"],
|
|
2152
|
+
price: json["price"] == null ? void 0 : CatalogPriceResponseDataFromJSON(json["price"]),
|
|
2153
|
+
priceBehavior: json["price_behavior"] == null ? void 0 : EntitlementPriceBehaviorFromJSON2(json["price_behavior"]),
|
|
2154
|
+
resetsAt: json["resets_at"] == null ? void 0 : new Date(json["resets_at"]),
|
|
2155
|
+
softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
|
|
2156
|
+
usage: json["usage"] == null ? void 0 : json["usage"],
|
|
2157
|
+
valueBool: json["value_bool"] == null ? void 0 : json["value_bool"],
|
|
2158
|
+
valueNumeric: json["value_numeric"] == null ? void 0 : json["value_numeric"],
|
|
2159
|
+
valueType: EntitlementValueTypeFromJSON2(json["value_type"]),
|
|
2160
|
+
warningThreshold: json["warning_threshold"] == null ? void 0 : json["warning_threshold"]
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
function CompanyFeatureUsageResponseDataToJSON(json) {
|
|
2164
|
+
return CompanyFeatureUsageResponseDataToJSONTyped(json, false);
|
|
2165
|
+
}
|
|
2166
|
+
function CompanyFeatureUsageResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2167
|
+
if (value == null) {
|
|
2168
|
+
return value;
|
|
2169
|
+
}
|
|
2170
|
+
return {
|
|
2171
|
+
access: value["access"],
|
|
2172
|
+
allocation: value["allocation"],
|
|
2173
|
+
company_override_id: value["companyOverrideId"],
|
|
2174
|
+
consumption_rate: value["consumptionRate"],
|
|
2175
|
+
credit_icon: value["creditIcon"],
|
|
2176
|
+
credit_id: value["creditId"],
|
|
2177
|
+
credit_name: value["creditName"],
|
|
2178
|
+
credit_plural_name: value["creditPluralName"],
|
|
2179
|
+
credit_singular_name: value["creditSingularName"],
|
|
2180
|
+
current_cost: value["currentCost"],
|
|
2181
|
+
entitlement_type: EntitlementTypeToJSON(value["entitlementType"]),
|
|
2182
|
+
expires_at: value["expiresAt"] == null ? void 0 : value["expiresAt"].toISOString(),
|
|
2183
|
+
feature_description: value["featureDescription"],
|
|
2184
|
+
feature_icon: value["featureIcon"],
|
|
2185
|
+
feature_id: value["featureId"],
|
|
2186
|
+
feature_name: value["featureName"],
|
|
2187
|
+
feature_plural_name: value["featurePluralName"],
|
|
2188
|
+
feature_singular_name: value["featureSingularName"],
|
|
2189
|
+
feature_type: FeatureTypeToJSON2(value["featureType"]),
|
|
2190
|
+
license_id: value["licenseId"],
|
|
2191
|
+
metric_period: MetricPeriodToJSON2(value["metricPeriod"]),
|
|
2192
|
+
metric_period_month_reset: MetricPeriodMonthResetToJSON2(
|
|
2193
|
+
value["metricPeriodMonthReset"]
|
|
2194
|
+
),
|
|
2195
|
+
per_license_credit_grants: value["perLicenseCreditGrants"].map(CatalogCreditGrantResponseDataToJSON),
|
|
2196
|
+
plan_entitlement_id: value["planEntitlementId"],
|
|
2197
|
+
price: CatalogPriceResponseDataToJSON(value["price"]),
|
|
2198
|
+
price_behavior: EntitlementPriceBehaviorToJSON2(value["priceBehavior"]),
|
|
2199
|
+
resets_at: value["resetsAt"] == null ? void 0 : value["resetsAt"].toISOString(),
|
|
2200
|
+
soft_limit: value["softLimit"],
|
|
2201
|
+
usage: value["usage"],
|
|
2202
|
+
value_bool: value["valueBool"],
|
|
2203
|
+
value_numeric: value["valueNumeric"],
|
|
2204
|
+
value_type: EntitlementValueTypeToJSON2(value["valueType"]),
|
|
2205
|
+
warning_threshold: value["warningThreshold"]
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
function instanceOfCompanyFeatureUsageListResponseData(value) {
|
|
2209
|
+
if (!("count" in value) || value["count"] === void 0) return false;
|
|
2210
|
+
if (!("features" in value) || value["features"] === void 0) return false;
|
|
2211
|
+
return true;
|
|
2212
|
+
}
|
|
2213
|
+
function CompanyFeatureUsageListResponseDataFromJSON(json) {
|
|
2214
|
+
return CompanyFeatureUsageListResponseDataFromJSONTyped(json, false);
|
|
2215
|
+
}
|
|
2216
|
+
function CompanyFeatureUsageListResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2217
|
+
if (json == null) {
|
|
2218
|
+
return json;
|
|
2219
|
+
}
|
|
2220
|
+
return {
|
|
2221
|
+
count: json["count"],
|
|
2222
|
+
features: json["features"].map(
|
|
2223
|
+
CompanyFeatureUsageResponseDataFromJSON
|
|
2224
|
+
)
|
|
2225
|
+
};
|
|
2226
|
+
}
|
|
2227
|
+
function CompanyFeatureUsageListResponseDataToJSON(json) {
|
|
2228
|
+
return CompanyFeatureUsageListResponseDataToJSONTyped(json, false);
|
|
2229
|
+
}
|
|
2230
|
+
function CompanyFeatureUsageListResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2231
|
+
if (value == null) {
|
|
2232
|
+
return value;
|
|
2233
|
+
}
|
|
2234
|
+
return {
|
|
2235
|
+
count: value["count"],
|
|
2236
|
+
features: value["features"].map(
|
|
2237
|
+
CompanyFeatureUsageResponseDataToJSON
|
|
2238
|
+
)
|
|
2239
|
+
};
|
|
2240
|
+
}
|
|
2241
|
+
function instanceOfCompanyUserUsageResponseData(value) {
|
|
2242
|
+
if (!("lastSeen" in value) || value["lastSeen"] === void 0) return false;
|
|
2243
|
+
if (!("share" in value) || value["share"] === void 0) return false;
|
|
2244
|
+
if (!("usage" in value) || value["usage"] === void 0) return false;
|
|
2245
|
+
if (!("userId" in value) || value["userId"] === void 0) return false;
|
|
2246
|
+
return true;
|
|
2247
|
+
}
|
|
2248
|
+
function CompanyUserUsageResponseDataFromJSON(json) {
|
|
2249
|
+
return CompanyUserUsageResponseDataFromJSONTyped(json, false);
|
|
2250
|
+
}
|
|
2251
|
+
function CompanyUserUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2252
|
+
if (json == null) {
|
|
2253
|
+
return json;
|
|
2254
|
+
}
|
|
2255
|
+
return {
|
|
2256
|
+
lastSeen: new Date(json["last_seen"]),
|
|
2257
|
+
name: json["name"] == null ? void 0 : json["name"],
|
|
2258
|
+
share: json["share"],
|
|
2259
|
+
usage: json["usage"],
|
|
2260
|
+
userId: json["user_id"]
|
|
2261
|
+
};
|
|
2262
|
+
}
|
|
2263
|
+
function CompanyUserUsageResponseDataToJSON(json) {
|
|
2264
|
+
return CompanyUserUsageResponseDataToJSONTyped(json, false);
|
|
2265
|
+
}
|
|
2266
|
+
function CompanyUserUsageResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2267
|
+
if (value == null) {
|
|
2268
|
+
return value;
|
|
2269
|
+
}
|
|
2270
|
+
return {
|
|
2271
|
+
last_seen: value["lastSeen"].toISOString(),
|
|
2272
|
+
name: value["name"],
|
|
2273
|
+
share: value["share"],
|
|
2274
|
+
usage: value["usage"],
|
|
2275
|
+
user_id: value["userId"]
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
function instanceOfCompanyFeatureUserUsageResponseData(value) {
|
|
2279
|
+
if (!("count" in value) || value["count"] === void 0) return false;
|
|
2280
|
+
if (!("endTime" in value) || value["endTime"] === void 0) return false;
|
|
2281
|
+
if (!("startTime" in value) || value["startTime"] === void 0) return false;
|
|
2282
|
+
if (!("total" in value) || value["total"] === void 0) return false;
|
|
2283
|
+
if (!("users" in value) || value["users"] === void 0) return false;
|
|
2284
|
+
return true;
|
|
2285
|
+
}
|
|
2286
|
+
function CompanyFeatureUserUsageResponseDataFromJSON(json) {
|
|
2287
|
+
return CompanyFeatureUserUsageResponseDataFromJSONTyped(json, false);
|
|
2288
|
+
}
|
|
2289
|
+
function CompanyFeatureUserUsageResponseDataFromJSONTyped(json, ignoreDiscriminator) {
|
|
2290
|
+
if (json == null) {
|
|
2291
|
+
return json;
|
|
2292
|
+
}
|
|
2293
|
+
return {
|
|
2294
|
+
count: json["count"],
|
|
2295
|
+
endTime: new Date(json["end_time"]),
|
|
2296
|
+
startTime: new Date(json["start_time"]),
|
|
2297
|
+
total: json["total"],
|
|
2298
|
+
unattributed: json["unattributed"] == null ? void 0 : json["unattributed"],
|
|
2299
|
+
users: json["users"].map(
|
|
2300
|
+
CompanyUserUsageResponseDataFromJSON
|
|
2301
|
+
)
|
|
2302
|
+
};
|
|
2303
|
+
}
|
|
2304
|
+
function CompanyFeatureUserUsageResponseDataToJSON(json) {
|
|
2305
|
+
return CompanyFeatureUserUsageResponseDataToJSONTyped(json, false);
|
|
2306
|
+
}
|
|
2307
|
+
function CompanyFeatureUserUsageResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2308
|
+
if (value == null) {
|
|
2309
|
+
return value;
|
|
2310
|
+
}
|
|
2311
|
+
return {
|
|
2312
|
+
count: value["count"],
|
|
2313
|
+
end_time: value["endTime"].toISOString(),
|
|
2314
|
+
start_time: value["startTime"].toISOString(),
|
|
2315
|
+
total: value["total"],
|
|
2316
|
+
unattributed: value["unattributed"],
|
|
2317
|
+
users: value["users"].map(
|
|
2318
|
+
CompanyUserUsageResponseDataToJSON
|
|
2319
|
+
)
|
|
2320
|
+
};
|
|
2321
|
+
}
|
|
1438
2322
|
var InvoiceStatus = {
|
|
1439
2323
|
Draft: "draft",
|
|
1440
2324
|
Open: "open",
|
|
@@ -1794,6 +2678,91 @@ function DeletePaymentMethodResponseToJSONTyped(value, ignoreDiscriminator = fal
|
|
|
1794
2678
|
params: value["params"]
|
|
1795
2679
|
};
|
|
1796
2680
|
}
|
|
2681
|
+
function instanceOfGetCompanyFeatureUsageResponse(value) {
|
|
2682
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
2683
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
2684
|
+
return true;
|
|
2685
|
+
}
|
|
2686
|
+
function GetCompanyFeatureUsageResponseFromJSON(json) {
|
|
2687
|
+
return GetCompanyFeatureUsageResponseFromJSONTyped(json, false);
|
|
2688
|
+
}
|
|
2689
|
+
function GetCompanyFeatureUsageResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
2690
|
+
if (json == null) {
|
|
2691
|
+
return json;
|
|
2692
|
+
}
|
|
2693
|
+
return {
|
|
2694
|
+
data: CompanyFeatureUsageListResponseDataFromJSON(json["data"]),
|
|
2695
|
+
params: json["params"]
|
|
2696
|
+
};
|
|
2697
|
+
}
|
|
2698
|
+
function GetCompanyFeatureUsageResponseToJSON(json) {
|
|
2699
|
+
return GetCompanyFeatureUsageResponseToJSONTyped(json, false);
|
|
2700
|
+
}
|
|
2701
|
+
function GetCompanyFeatureUsageResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2702
|
+
if (value == null) {
|
|
2703
|
+
return value;
|
|
2704
|
+
}
|
|
2705
|
+
return {
|
|
2706
|
+
data: CompanyFeatureUsageListResponseDataToJSON(value["data"]),
|
|
2707
|
+
params: value["params"]
|
|
2708
|
+
};
|
|
2709
|
+
}
|
|
2710
|
+
function instanceOfGetCompanyFeatureUserUsageParams(value) {
|
|
2711
|
+
return true;
|
|
2712
|
+
}
|
|
2713
|
+
function GetCompanyFeatureUserUsageParamsFromJSON(json) {
|
|
2714
|
+
return GetCompanyFeatureUserUsageParamsFromJSONTyped(json, false);
|
|
2715
|
+
}
|
|
2716
|
+
function GetCompanyFeatureUserUsageParamsFromJSONTyped(json, ignoreDiscriminator) {
|
|
2717
|
+
if (json == null) {
|
|
2718
|
+
return json;
|
|
2719
|
+
}
|
|
2720
|
+
return {
|
|
2721
|
+
limit: json["limit"] == null ? void 0 : json["limit"],
|
|
2722
|
+
offset: json["offset"] == null ? void 0 : json["offset"]
|
|
2723
|
+
};
|
|
2724
|
+
}
|
|
2725
|
+
function GetCompanyFeatureUserUsageParamsToJSON(json) {
|
|
2726
|
+
return GetCompanyFeatureUserUsageParamsToJSONTyped(json, false);
|
|
2727
|
+
}
|
|
2728
|
+
function GetCompanyFeatureUserUsageParamsToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2729
|
+
if (value == null) {
|
|
2730
|
+
return value;
|
|
2731
|
+
}
|
|
2732
|
+
return {
|
|
2733
|
+
limit: value["limit"],
|
|
2734
|
+
offset: value["offset"]
|
|
2735
|
+
};
|
|
2736
|
+
}
|
|
2737
|
+
function instanceOfGetCompanyFeatureUserUsageResponse(value) {
|
|
2738
|
+
if (!("data" in value) || value["data"] === void 0) return false;
|
|
2739
|
+
if (!("params" in value) || value["params"] === void 0) return false;
|
|
2740
|
+
return true;
|
|
2741
|
+
}
|
|
2742
|
+
function GetCompanyFeatureUserUsageResponseFromJSON(json) {
|
|
2743
|
+
return GetCompanyFeatureUserUsageResponseFromJSONTyped(json, false);
|
|
2744
|
+
}
|
|
2745
|
+
function GetCompanyFeatureUserUsageResponseFromJSONTyped(json, ignoreDiscriminator) {
|
|
2746
|
+
if (json == null) {
|
|
2747
|
+
return json;
|
|
2748
|
+
}
|
|
2749
|
+
return {
|
|
2750
|
+
data: CompanyFeatureUserUsageResponseDataFromJSON(json["data"]),
|
|
2751
|
+
params: GetCompanyFeatureUserUsageParamsFromJSON(json["params"])
|
|
2752
|
+
};
|
|
2753
|
+
}
|
|
2754
|
+
function GetCompanyFeatureUserUsageResponseToJSON(json) {
|
|
2755
|
+
return GetCompanyFeatureUserUsageResponseToJSONTyped(json, false);
|
|
2756
|
+
}
|
|
2757
|
+
function GetCompanyFeatureUserUsageResponseToJSONTyped(value, ignoreDiscriminator = false) {
|
|
2758
|
+
if (value == null) {
|
|
2759
|
+
return value;
|
|
2760
|
+
}
|
|
2761
|
+
return {
|
|
2762
|
+
data: CompanyFeatureUserUsageResponseDataToJSON(value["data"]),
|
|
2763
|
+
params: GetCompanyFeatureUserUsageParamsToJSON(value["params"])
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
1797
2766
|
function instanceOfGetCompanyInvoicesParams(value) {
|
|
1798
2767
|
return true;
|
|
1799
2768
|
}
|
|
@@ -2395,6 +3364,36 @@ var SchematicBillingClient = class {
|
|
|
2395
3364
|
method: "DELETE"
|
|
2396
3365
|
}).then(() => void 0);
|
|
2397
3366
|
}
|
|
3367
|
+
fetchFeatureUsage() {
|
|
3368
|
+
const path = "/company/usage";
|
|
3369
|
+
return this.session.request(path).then((body) => {
|
|
3370
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
3371
|
+
throw new Error(`Malformed response from ${path}`);
|
|
3372
|
+
}
|
|
3373
|
+
const data = body.data;
|
|
3374
|
+
if (data == null || data.features == null) {
|
|
3375
|
+
return [];
|
|
3376
|
+
}
|
|
3377
|
+
return GetCompanyFeatureUsageResponseFromJSON(body).data.features;
|
|
3378
|
+
});
|
|
3379
|
+
}
|
|
3380
|
+
fetchFeatureUserUsage(params) {
|
|
3381
|
+
const query = new URLSearchParams();
|
|
3382
|
+
if (params.limit !== void 0) {
|
|
3383
|
+
query.set("limit", String(params.limit));
|
|
3384
|
+
}
|
|
3385
|
+
if (params.offset !== void 0) {
|
|
3386
|
+
query.set("offset", String(params.offset));
|
|
3387
|
+
}
|
|
3388
|
+
const search = query.toString();
|
|
3389
|
+
const path = `/company/usage/${encodeURIComponent(params.featureId)}/users${search === "" ? "" : `?${search}`}`;
|
|
3390
|
+
return this.session.request(path).then((body) => {
|
|
3391
|
+
if (body === null || typeof body !== "object" || !("data" in body)) {
|
|
3392
|
+
throw new Error(`Malformed response from ${path}`);
|
|
3393
|
+
}
|
|
3394
|
+
return GetCompanyFeatureUserUsageResponseFromJSON(body).data;
|
|
3395
|
+
});
|
|
3396
|
+
}
|
|
2398
3397
|
};
|
|
2399
3398
|
var anonymousIdKey = "schematicId";
|
|
2400
3399
|
var flagStateCachePrefix = "schematicCache";
|
|
@@ -2402,9 +3401,41 @@ var flagStateCacheMaxContexts = 10;
|
|
|
2402
3401
|
var flagStateCacheDefaultMaxAgeMs = 7 * 24 * 60 * 60 * 1e3;
|
|
2403
3402
|
var emptyCreditBalances = Object.freeze({});
|
|
2404
3403
|
var emptyCreditSpendPolicies = [];
|
|
3404
|
+
function extractEventContext(event) {
|
|
3405
|
+
const body = event.body;
|
|
3406
|
+
const context = {};
|
|
3407
|
+
switch (event.type) {
|
|
3408
|
+
case "identify":
|
|
3409
|
+
if (body.keys != null) {
|
|
3410
|
+
context.user = body.keys;
|
|
3411
|
+
}
|
|
3412
|
+
if (body.company?.keys != null) {
|
|
3413
|
+
context.company = body.company.keys;
|
|
3414
|
+
}
|
|
3415
|
+
break;
|
|
3416
|
+
case "track":
|
|
3417
|
+
if (body.company != null) {
|
|
3418
|
+
context.company = body.company;
|
|
3419
|
+
}
|
|
3420
|
+
if (body.user != null) {
|
|
3421
|
+
context.user = body.user;
|
|
3422
|
+
}
|
|
3423
|
+
break;
|
|
3424
|
+
case "flag_check":
|
|
3425
|
+
if (body.req_company != null) {
|
|
3426
|
+
context.company = body.req_company;
|
|
3427
|
+
}
|
|
3428
|
+
if (body.req_user != null) {
|
|
3429
|
+
context.user = body.req_user;
|
|
3430
|
+
}
|
|
3431
|
+
break;
|
|
3432
|
+
}
|
|
3433
|
+
return context;
|
|
3434
|
+
}
|
|
2405
3435
|
var Schematic = class {
|
|
2406
3436
|
_additionalHeaders = {};
|
|
2407
3437
|
apiKey;
|
|
3438
|
+
contextSignatureManager;
|
|
2408
3439
|
_apiUrl = "https://api.schematichq.com";
|
|
2409
3440
|
conn = null;
|
|
2410
3441
|
context = {};
|
|
@@ -2491,6 +3522,12 @@ var Schematic = class {
|
|
|
2491
3522
|
"X-Schematic-Client-Version": `schematic-js@${version}`,
|
|
2492
3523
|
...options?.additionalHeaders ?? {}
|
|
2493
3524
|
};
|
|
3525
|
+
if (options?.getContextSignature !== void 0) {
|
|
3526
|
+
this.contextSignatureManager = new ContextSignatureManager(
|
|
3527
|
+
options.getContextSignature,
|
|
3528
|
+
this.debug.bind(this)
|
|
3529
|
+
);
|
|
3530
|
+
}
|
|
2494
3531
|
if (options?.storage) {
|
|
2495
3532
|
this.storage = options.storage;
|
|
2496
3533
|
} else {
|
|
@@ -2660,12 +3697,14 @@ var Schematic = class {
|
|
|
2660
3697
|
}
|
|
2661
3698
|
if (!this.useWebSocket) {
|
|
2662
3699
|
const requestUrl = `${this._apiUrl}/flags/${key}/check`;
|
|
3700
|
+
const sigHeaders = await this.contextSignatureHeaders(context);
|
|
2663
3701
|
return fetch(requestUrl, {
|
|
2664
3702
|
method: "POST",
|
|
2665
3703
|
headers: {
|
|
2666
3704
|
...this._additionalHeaders ?? {},
|
|
2667
3705
|
"Content-Type": "application/json;charset=UTF-8",
|
|
2668
|
-
"X-Schematic-Api-Key": this.apiKey
|
|
3706
|
+
"X-Schematic-Api-Key": this.apiKey,
|
|
3707
|
+
...sigHeaders
|
|
2669
3708
|
},
|
|
2670
3709
|
body: JSON.stringify(context)
|
|
2671
3710
|
}).then((response) => {
|
|
@@ -2758,6 +3797,34 @@ var Schematic = class {
|
|
|
2758
3797
|
console.log(`[Schematic] ${message}`, ...args);
|
|
2759
3798
|
}
|
|
2760
3799
|
}
|
|
3800
|
+
/**
|
|
3801
|
+
* Resolve the HMAC context-signature value for a context, if a signature
|
|
3802
|
+
* provider is configured. Returns undefined when no provider is set, when
|
|
3803
|
+
* offline, or when the signature could not be obtained.
|
|
3804
|
+
*/
|
|
3805
|
+
contextSignature(context) {
|
|
3806
|
+
if (this.contextSignatureManager === void 0 || this.isOffline()) {
|
|
3807
|
+
return void 0;
|
|
3808
|
+
}
|
|
3809
|
+
return this.contextSignatureManager.getSignature(context);
|
|
3810
|
+
}
|
|
3811
|
+
/**
|
|
3812
|
+
* Build the `X-Schematic-Context-Sig` header for a context, or an empty
|
|
3813
|
+
* object when no signature is available. Spread into request headers.
|
|
3814
|
+
*
|
|
3815
|
+
* Returns synchronously (not a Promise) when no signature provider is
|
|
3816
|
+
* configured, so callers that dispatch on the same tick (e.g. fire-and-forget
|
|
3817
|
+
* event sends) keep their existing timing; only a configured provider, which
|
|
3818
|
+
* must fetch a signature, yields a Promise.
|
|
3819
|
+
*/
|
|
3820
|
+
contextSignatureHeaders(context) {
|
|
3821
|
+
if (this.contextSignatureManager === void 0 || this.isOffline()) {
|
|
3822
|
+
return {};
|
|
3823
|
+
}
|
|
3824
|
+
return this.contextSignatureManager.getSignature(context).then(
|
|
3825
|
+
(signature) => signature === void 0 ? {} : { [contextSignatureHeader]: signature }
|
|
3826
|
+
);
|
|
3827
|
+
}
|
|
2761
3828
|
/**
|
|
2762
3829
|
* Create a persistent message handler for websocket flag updates
|
|
2763
3830
|
*/
|
|
@@ -2881,12 +3948,14 @@ var Schematic = class {
|
|
|
2881
3948
|
}
|
|
2882
3949
|
const requestUrl = `${this._apiUrl}/flags/check`;
|
|
2883
3950
|
const requestBody = JSON.stringify(context);
|
|
3951
|
+
const sigHeaders = await this.contextSignatureHeaders(context);
|
|
2884
3952
|
return fetch(requestUrl, {
|
|
2885
3953
|
method: "POST",
|
|
2886
3954
|
headers: {
|
|
2887
3955
|
...this._additionalHeaders ?? {},
|
|
2888
3956
|
"Content-Type": "application/json;charset=UTF-8",
|
|
2889
|
-
"X-Schematic-Api-Key": this.apiKey
|
|
3957
|
+
"X-Schematic-Api-Key": this.apiKey,
|
|
3958
|
+
...sigHeaders
|
|
2890
3959
|
},
|
|
2891
3960
|
body: requestBody
|
|
2892
3961
|
}).then((response) => {
|
|
@@ -3441,12 +4510,17 @@ var Schematic = class {
|
|
|
3441
4510
|
this.debug(`event not sent (offline mode):`, { event });
|
|
3442
4511
|
return Promise.resolve();
|
|
3443
4512
|
}
|
|
4513
|
+
const maybeSigHeaders = this.contextSignatureHeaders(
|
|
4514
|
+
extractEventContext(event)
|
|
4515
|
+
);
|
|
4516
|
+
const sigHeaders = maybeSigHeaders instanceof Promise ? await maybeSigHeaders : maybeSigHeaders;
|
|
3444
4517
|
try {
|
|
3445
4518
|
const response = await fetch(captureUrl, {
|
|
3446
4519
|
method: "POST",
|
|
3447
4520
|
headers: {
|
|
3448
4521
|
...this._additionalHeaders ?? {},
|
|
3449
|
-
"Content-Type": "application/json;charset=UTF-8"
|
|
4522
|
+
"Content-Type": "application/json;charset=UTF-8",
|
|
4523
|
+
...sigHeaders
|
|
3450
4524
|
},
|
|
3451
4525
|
body: payload
|
|
3452
4526
|
});
|
|
@@ -3630,6 +4704,7 @@ var Schematic = class {
|
|
|
3630
4704
|
* In offline mode, this is a no-op.
|
|
3631
4705
|
*/
|
|
3632
4706
|
cleanup = async () => {
|
|
4707
|
+
this.contextSignatureManager?.clear();
|
|
3633
4708
|
if (this.isOffline()) {
|
|
3634
4709
|
this.debug("cleanup: skipped (offline mode)");
|
|
3635
4710
|
return Promise.resolve();
|
|
@@ -3915,7 +4990,7 @@ var Schematic = class {
|
|
|
3915
4990
|
context
|
|
3916
4991
|
);
|
|
3917
4992
|
this.context = context;
|
|
3918
|
-
const sendMessage = () => {
|
|
4993
|
+
const sendMessage = async () => {
|
|
3919
4994
|
let resolved = false;
|
|
3920
4995
|
const persistentMessageHandler = this.createPersistentMessageHandler(context);
|
|
3921
4996
|
const messageHandler = (event) => {
|
|
@@ -3942,20 +5017,22 @@ var Schematic = class {
|
|
|
3942
5017
|
});
|
|
3943
5018
|
this.currentWebSocket = socket;
|
|
3944
5019
|
const clientVersion = this._additionalHeaders["X-Schematic-Client-Version"] ?? `schematic-js@${version}`;
|
|
5020
|
+
const sig = await this.contextSignature(context);
|
|
3945
5021
|
const messagePayload = {
|
|
3946
5022
|
apiKey: this.apiKey,
|
|
3947
5023
|
clientVersion,
|
|
3948
|
-
data: context
|
|
5024
|
+
data: context,
|
|
5025
|
+
...sig !== void 0 ? { sig } : {}
|
|
3949
5026
|
};
|
|
3950
5027
|
this.debug(`WebSocket sending message:`, messagePayload);
|
|
3951
5028
|
socket.send(JSON.stringify(messagePayload));
|
|
3952
5029
|
};
|
|
3953
5030
|
if (socket.readyState === WebSocket.OPEN) {
|
|
3954
5031
|
this.debug(`WebSocket already open, sending message`);
|
|
3955
|
-
sendMessage();
|
|
5032
|
+
void sendMessage();
|
|
3956
5033
|
} else if (socket.readyState === WebSocket.CONNECTING) {
|
|
3957
5034
|
this.debug(`WebSocket connecting, waiting for open to send message`);
|
|
3958
|
-
socket.addEventListener("open", sendMessage);
|
|
5035
|
+
socket.addEventListener("open", () => void sendMessage());
|
|
3959
5036
|
} else {
|
|
3960
5037
|
this.debug(`WebSocket is closed, cannot send message`);
|
|
3961
5038
|
reject("WebSocket is not open or connecting");
|
|
@@ -4558,6 +5635,7 @@ var READINESS = {
|
|
|
4558
5635
|
active: "ready",
|
|
4559
5636
|
ended: "never"
|
|
4560
5637
|
};
|
|
5638
|
+
var FEATURE_USER_USAGE_LIMIT = 20;
|
|
4561
5639
|
var BillingStore = class {
|
|
4562
5640
|
constructor(_client, initialData = {}, options = {}) {
|
|
4563
5641
|
this._client = _client;
|
|
@@ -4578,6 +5656,17 @@ var BillingStore = class {
|
|
|
4578
5656
|
() => this._client.fetchPaymentMethods(),
|
|
4579
5657
|
{ readiness }
|
|
4580
5658
|
);
|
|
5659
|
+
this.featureUsage = new KeyedResource(
|
|
5660
|
+
() => this._client.fetchFeatureUsage(),
|
|
5661
|
+
{ readiness }
|
|
5662
|
+
);
|
|
5663
|
+
this.featureUserUsage = new KeyedResource(
|
|
5664
|
+
({ featureId }) => this._client.fetchFeatureUserUsage({
|
|
5665
|
+
featureId,
|
|
5666
|
+
limit: FEATURE_USER_USAGE_LIMIT
|
|
5667
|
+
}),
|
|
5668
|
+
{ readiness }
|
|
5669
|
+
);
|
|
4581
5670
|
const held = { key: initialData.sessionKey };
|
|
4582
5671
|
if (initialData.invoices !== void 0) {
|
|
4583
5672
|
held.invoices = {
|
|
@@ -4595,7 +5684,10 @@ var BillingStore = class {
|
|
|
4595
5684
|
if (initialData.paymentMethods !== void 0) {
|
|
4596
5685
|
held.paymentMethods = initialData.paymentMethods;
|
|
4597
5686
|
}
|
|
4598
|
-
if (
|
|
5687
|
+
if (initialData.featureUsage !== void 0) {
|
|
5688
|
+
held.featureUsage = initialData.featureUsage;
|
|
5689
|
+
}
|
|
5690
|
+
if (held.invoices !== void 0 || held.upcomingInvoice !== void 0 || held.paymentMethods !== void 0 || held.featureUsage !== void 0) {
|
|
4599
5691
|
this._held = held;
|
|
4600
5692
|
this._settleSeed(claimFrom(options.session) ?? claimOf(this._client));
|
|
4601
5693
|
}
|
|
@@ -4604,6 +5696,8 @@ var BillingStore = class {
|
|
|
4604
5696
|
invoices;
|
|
4605
5697
|
upcomingInvoice;
|
|
4606
5698
|
paymentMethods;
|
|
5699
|
+
featureUsage;
|
|
5700
|
+
featureUserUsage;
|
|
4607
5701
|
_pageSize;
|
|
4608
5702
|
_unsubscribe;
|
|
4609
5703
|
_connected = false;
|
|
@@ -4682,6 +5776,9 @@ var BillingStore = class {
|
|
|
4682
5776
|
if (held.paymentMethods !== void 0) {
|
|
4683
5777
|
this.paymentMethods.seed(SINGLETON, held.paymentMethods);
|
|
4684
5778
|
}
|
|
5779
|
+
if (held.featureUsage !== void 0) {
|
|
5780
|
+
this.featureUsage.seed(SINGLETON, held.featureUsage);
|
|
5781
|
+
}
|
|
4685
5782
|
this._seedKey = held.key;
|
|
4686
5783
|
this._seeded = true;
|
|
4687
5784
|
}
|
|
@@ -4694,24 +5791,28 @@ var BillingStore = class {
|
|
|
4694
5791
|
for (const name of RESOURCE_NAMES) {
|
|
4695
5792
|
this[name].resetAll();
|
|
4696
5793
|
}
|
|
5794
|
+
this.featureUserUsage.resetAll();
|
|
4697
5795
|
}
|
|
4698
5796
|
/** Forgets every resource and leaves them empty; nothing reloads. */
|
|
4699
5797
|
clearAll() {
|
|
4700
5798
|
for (const name of RESOURCE_NAMES) {
|
|
4701
5799
|
this[name].clearAll();
|
|
4702
5800
|
}
|
|
5801
|
+
this.featureUserUsage.clearAll();
|
|
4703
5802
|
}
|
|
4704
5803
|
/** Loads every resource that is subscribed and has nothing yet. */
|
|
4705
5804
|
resumeAll() {
|
|
4706
5805
|
for (const name of RESOURCE_NAMES) {
|
|
4707
5806
|
this[name].resumeAll();
|
|
4708
5807
|
}
|
|
5808
|
+
this.featureUserUsage.resumeAll();
|
|
4709
5809
|
}
|
|
4710
5810
|
/** Reloads every resource that has been loaded, keeping its current data. */
|
|
4711
5811
|
invalidateAll() {
|
|
4712
5812
|
for (const name of RESOURCE_NAMES) {
|
|
4713
5813
|
this[name].invalidateAll();
|
|
4714
5814
|
}
|
|
5815
|
+
this.featureUserUsage.invalidateAll();
|
|
4715
5816
|
}
|
|
4716
5817
|
/**
|
|
4717
5818
|
* Appends the next page to the invoices list for `query`, when there is
|
|
@@ -4823,7 +5924,8 @@ var BillingStore = class {
|
|
|
4823
5924
|
var RESOURCE_NAMES = [
|
|
4824
5925
|
"invoices",
|
|
4825
5926
|
"upcomingInvoice",
|
|
4826
|
-
"paymentMethods"
|
|
5927
|
+
"paymentMethods",
|
|
5928
|
+
"featureUsage"
|
|
4827
5929
|
];
|
|
4828
5930
|
|
|
4829
5931
|
// src/billing/context.tsx
|
|
@@ -4903,6 +6005,9 @@ var missingBillingSource = {
|
|
|
4903
6005
|
subscribe: () => () => {
|
|
4904
6006
|
},
|
|
4905
6007
|
handle: () => missingHandle,
|
|
6008
|
+
subscribeFeatureUserUsage: () => () => {
|
|
6009
|
+
},
|
|
6010
|
+
featureUserUsage: () => missingHandle,
|
|
4906
6011
|
loadMoreInvoices: () => Promise.resolve(),
|
|
4907
6012
|
invalidateAll: () => {
|
|
4908
6013
|
},
|
|
@@ -4917,6 +6022,7 @@ function BillingDataProvider({
|
|
|
4917
6022
|
actions,
|
|
4918
6023
|
children,
|
|
4919
6024
|
data,
|
|
6025
|
+
featureUserUsage,
|
|
4920
6026
|
locale,
|
|
4921
6027
|
onLoadMoreInvoices,
|
|
4922
6028
|
onMissingString,
|
|
@@ -4927,6 +6033,7 @@ function BillingDataProvider({
|
|
|
4927
6033
|
}) {
|
|
4928
6034
|
const source = useMemo2(() => {
|
|
4929
6035
|
const handles = /* @__PURE__ */ new Map();
|
|
6036
|
+
const userUsageHandles = /* @__PURE__ */ new Map();
|
|
4930
6037
|
return {
|
|
4931
6038
|
actions: rejectingActions(
|
|
4932
6039
|
(name) => new Error(BILLING_ACTION_UNAVAILABLE_MESSAGE(name)),
|
|
@@ -4950,6 +6057,24 @@ function BillingDataProvider({
|
|
|
4950
6057
|
handles.set(name, handle);
|
|
4951
6058
|
return handle;
|
|
4952
6059
|
},
|
|
6060
|
+
subscribeFeatureUserUsage: () => () => {
|
|
6061
|
+
},
|
|
6062
|
+
featureUserUsage: (featureId) => {
|
|
6063
|
+
const cached = userUsageHandles.get(featureId);
|
|
6064
|
+
if (cached !== void 0) {
|
|
6065
|
+
return cached;
|
|
6066
|
+
}
|
|
6067
|
+
const value = featureUserUsage?.[featureId];
|
|
6068
|
+
const handle = {
|
|
6069
|
+
data: value,
|
|
6070
|
+
error: void 0,
|
|
6071
|
+
isPending: value === void 0,
|
|
6072
|
+
refetch: () => {
|
|
6073
|
+
}
|
|
6074
|
+
};
|
|
6075
|
+
userUsageHandles.set(featureId, handle);
|
|
6076
|
+
return handle;
|
|
6077
|
+
},
|
|
4953
6078
|
loadMoreInvoices: (query) => {
|
|
4954
6079
|
onLoadMoreInvoices?.(query);
|
|
4955
6080
|
return Promise.resolve();
|
|
@@ -4957,7 +6082,7 @@ function BillingDataProvider({
|
|
|
4957
6082
|
invalidateAll: () => {
|
|
4958
6083
|
}
|
|
4959
6084
|
};
|
|
4960
|
-
}, [actions, data, onLoadMoreInvoices, onRefetch, status]);
|
|
6085
|
+
}, [actions, data, featureUserUsage, onLoadMoreInvoices, onRefetch, status]);
|
|
4961
6086
|
return /* @__PURE__ */ jsx2(BillingDataContext.Provider, { value: source, children: /* @__PURE__ */ jsx2(
|
|
4962
6087
|
SchematicI18nProvider,
|
|
4963
6088
|
{
|
|
@@ -5053,6 +6178,21 @@ function useSetupIntent() {
|
|
|
5053
6178
|
[source]
|
|
5054
6179
|
);
|
|
5055
6180
|
}
|
|
6181
|
+
function useFeatureUsage() {
|
|
6182
|
+
return useBillingResource("featureUsage", SINGLETON);
|
|
6183
|
+
}
|
|
6184
|
+
function useFeatureUserUsage(featureId) {
|
|
6185
|
+
const source = useBillingDataSource();
|
|
6186
|
+
const subscribe = useCallback(
|
|
6187
|
+
(listener) => source.subscribeFeatureUserUsage(featureId, listener),
|
|
6188
|
+
[featureId, source]
|
|
6189
|
+
);
|
|
6190
|
+
const getSnapshot = useCallback(
|
|
6191
|
+
() => source.featureUserUsage(featureId),
|
|
6192
|
+
[featureId, source]
|
|
6193
|
+
);
|
|
6194
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
6195
|
+
}
|
|
5056
6196
|
function useInvalidateBillingData() {
|
|
5057
6197
|
return useBillingDataSource().invalidateAll;
|
|
5058
6198
|
}
|
|
@@ -5108,8 +6248,7 @@ function BillingProvider({
|
|
|
5108
6248
|
return initialRef.current === void 0 ? void 0 : staticSource(initialRef.current);
|
|
5109
6249
|
}
|
|
5110
6250
|
const handles = /* @__PURE__ */ new WeakMap();
|
|
5111
|
-
const
|
|
5112
|
-
const resource = store.resource(name).get(params);
|
|
6251
|
+
const handleOf = (resource) => {
|
|
5113
6252
|
const snapshot = resource.getSnapshot();
|
|
5114
6253
|
const cached = handles.get(resource);
|
|
5115
6254
|
if (cached !== void 0 && cached.snapshot === snapshot) {
|
|
@@ -5119,12 +6258,18 @@ function BillingProvider({
|
|
|
5119
6258
|
...snapshot,
|
|
5120
6259
|
refetch: () => void resource.refetch()
|
|
5121
6260
|
};
|
|
5122
|
-
handles.set(resource, {
|
|
6261
|
+
handles.set(resource, {
|
|
6262
|
+
snapshot,
|
|
6263
|
+
handle: next
|
|
6264
|
+
});
|
|
5123
6265
|
return next;
|
|
5124
6266
|
};
|
|
6267
|
+
const handle = (name, params) => handleOf(store.resource(name).get(params));
|
|
5125
6268
|
return {
|
|
5126
6269
|
subscribe: (name, params, listener) => store.resource(name).subscribe(params, listener),
|
|
5127
6270
|
handle,
|
|
6271
|
+
subscribeFeatureUserUsage: (featureId, listener) => store.featureUserUsage.subscribe({ featureId }, listener),
|
|
6272
|
+
featureUserUsage: (featureId) => handleOf(store.featureUserUsage.get({ featureId })),
|
|
5128
6273
|
loadMoreInvoices: (query) => store.loadMoreInvoices(query),
|
|
5129
6274
|
invalidateAll: () => store.invalidateAll(),
|
|
5130
6275
|
actions: {
|
|
@@ -5151,7 +6296,17 @@ function BillingProvider({
|
|
|
5151
6296
|
}
|
|
5152
6297
|
function staticSource(data) {
|
|
5153
6298
|
const handles = /* @__PURE__ */ new Map();
|
|
6299
|
+
const pendingUserUsage = {
|
|
6300
|
+
data: void 0,
|
|
6301
|
+
error: void 0,
|
|
6302
|
+
isPending: true,
|
|
6303
|
+
refetch: () => {
|
|
6304
|
+
}
|
|
6305
|
+
};
|
|
5154
6306
|
return {
|
|
6307
|
+
subscribeFeatureUserUsage: () => () => {
|
|
6308
|
+
},
|
|
6309
|
+
featureUserUsage: () => pendingUserUsage,
|
|
5155
6310
|
subscribe: () => () => {
|
|
5156
6311
|
},
|
|
5157
6312
|
handle: (name) => {
|
|
@@ -5177,7 +6332,7 @@ function staticSource(data) {
|
|
|
5177
6332
|
}
|
|
5178
6333
|
|
|
5179
6334
|
// src/version.ts
|
|
5180
|
-
var version2 = "1.
|
|
6335
|
+
var version2 = "1.11.0";
|
|
5181
6336
|
|
|
5182
6337
|
// src/context/schematic.tsx
|
|
5183
6338
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
@@ -5427,6 +6582,7 @@ export {
|
|
|
5427
6582
|
BillingDataProvider,
|
|
5428
6583
|
BillingProvider,
|
|
5429
6584
|
DEFAULT_INVOICE_QUERY,
|
|
6585
|
+
FEATURE_USER_USAGE_LIMIT,
|
|
5430
6586
|
INVOICE_PAGE_SIZE,
|
|
5431
6587
|
InvoiceStatus,
|
|
5432
6588
|
RuleType,
|
|
@@ -5439,6 +6595,8 @@ export {
|
|
|
5439
6595
|
UsagePeriod,
|
|
5440
6596
|
normalizeInvoiceQuery2 as normalizeInvoiceQuery,
|
|
5441
6597
|
useBillingDataSource,
|
|
6598
|
+
useFeatureUsage,
|
|
6599
|
+
useFeatureUserUsage,
|
|
5442
6600
|
useInvalidateBillingData,
|
|
5443
6601
|
useInvoices,
|
|
5444
6602
|
usePaymentMethods,
|