@schematichq/schematic-vue 1.5.0 → 1.6.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.
@@ -1,4 +1,4 @@
1
- // node_modules/@schematichq/schematic-js/dist/schematic.esm.js
1
+ // node_modules/.pnpm/@schematichq+schematic-js@1.8.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;
@@ -12,6 +12,10 @@ var __commonJS = (cb, mod) => function __require() {
12
12
  throw mod = 0, e;
13
13
  }
14
14
  };
15
+ var __export = (target, all) => {
16
+ for (var name in all)
17
+ __defProp(target, name, { get: all[name], enumerable: true });
18
+ };
15
19
  var __copyProps = (to, from, except, desc) => {
16
20
  if (from && typeof from === "object" || typeof from === "function") {
17
21
  for (let key of __getOwnPropNames(from))
@@ -29,7 +33,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
33
  mod
30
34
  ));
31
35
  var require_browser_polyfill = __commonJS({
32
- "node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
36
+ "node_modules/.pnpm/cross-fetch@4.1.0/node_modules/cross-fetch/dist/browser-polyfill.js"(exports) {
33
37
  (function(self2) {
34
38
  var irrelevant = (function(exports2) {
35
39
  var g = typeof globalThis !== "undefined" && globalThis || typeof self2 !== "undefined" && self2 || // eslint-disable-next-line no-undef
@@ -613,6 +617,18 @@ function MetricPeriodMonthResetFromJSON(json) {
613
617
  function MetricPeriodMonthResetFromJSONTyped(json, ignoreDiscriminator) {
614
618
  return json;
615
619
  }
620
+ function WarningTierFromJSON(json) {
621
+ return WarningTierFromJSONTyped(json, false);
622
+ }
623
+ function WarningTierFromJSONTyped(json, ignoreDiscriminator) {
624
+ if (json == null) {
625
+ return json;
626
+ }
627
+ return {
628
+ key: json["key"],
629
+ value: json["value"]
630
+ };
631
+ }
616
632
  function MetricPeriodFromJSON(json) {
617
633
  return MetricPeriodFromJSONTyped(json, false);
618
634
  }
@@ -644,7 +660,8 @@ function FeatureEntitlementFromJSONTyped(json, ignoreDiscriminator) {
644
660
  monthReset: json["month_reset"] == null ? void 0 : MetricPeriodMonthResetFromJSON(json["month_reset"]),
645
661
  softLimit: json["soft_limit"] == null ? void 0 : json["soft_limit"],
646
662
  usage: json["usage"] == null ? void 0 : json["usage"],
647
- valueType: EntitlementValueTypeFromJSON(json["value_type"])
663
+ valueType: EntitlementValueTypeFromJSON(json["value_type"]),
664
+ warningTiers: json["warning_tiers"] == null ? void 0 : json["warning_tiers"].map(WarningTierFromJSON)
648
665
  };
649
666
  }
650
667
  function RuleTypeFromJSON(json) {
@@ -1009,6 +1026,7 @@ function EventBodyFlagCheckToJSONTyped(value, ignoreDiscriminator = false) {
1009
1026
  error: value["error"],
1010
1027
  flag_id: value["flagId"],
1011
1028
  flag_key: value["flagKey"],
1029
+ preflight: value["preflight"],
1012
1030
  reason: value["reason"],
1013
1031
  req_company: value["reqCompany"],
1014
1032
  req_user: value["reqUser"],
@@ -1080,7 +1098,8 @@ var CheckFlagReturnFromJSON = (json) => {
1080
1098
  ruleType: ruleType == null ? void 0 : ruleType,
1081
1099
  softLimit: entitlement?.softLimit == null ? void 0 : entitlement.softLimit,
1082
1100
  userId: userId == null ? void 0 : userId,
1083
- value
1101
+ value,
1102
+ warningTiers: entitlement?.warningTiers == null ? void 0 : entitlement.warningTiers
1084
1103
  };
1085
1104
  };
1086
1105
  var CheckPlanReturnFromJSON = (json) => {
@@ -1107,7 +1126,7 @@ var CreditBalancesFromJSON = (json) => {
1107
1126
  }
1108
1127
  return balances;
1109
1128
  };
1110
- var cacheVersion = "bb56e75d";
1129
+ var cacheVersion = "7b920cf4";
1111
1130
  function contextString(context) {
1112
1131
  const sortedContext = Object.keys(context).reduce((acc, key) => {
1113
1132
  const sortedKeys = Object.keys(
@@ -1122,16 +1141,370 @@ function contextString(context) {
1122
1141
  }, {});
1123
1142
  return JSON.stringify(sortedContext);
1124
1143
  }
1125
- var version = "1.5.0";
1144
+ var version = "1.8.0";
1145
+ var models_exports = {};
1146
+ __export(models_exports, {
1147
+ ApiErrorFromJSON: () => ApiErrorFromJSON,
1148
+ ApiErrorFromJSONTyped: () => ApiErrorFromJSONTyped,
1149
+ ApiErrorToJSON: () => ApiErrorToJSON,
1150
+ ApiErrorToJSONTyped: () => ApiErrorToJSONTyped,
1151
+ CompanyDiscountResponseDataFromJSON: () => CompanyDiscountResponseDataFromJSON,
1152
+ CompanyDiscountResponseDataFromJSONTyped: () => CompanyDiscountResponseDataFromJSONTyped,
1153
+ CompanyDiscountResponseDataToJSON: () => CompanyDiscountResponseDataToJSON,
1154
+ CompanyDiscountResponseDataToJSONTyped: () => CompanyDiscountResponseDataToJSONTyped,
1155
+ CompanyInvoiceResponseDataFromJSON: () => CompanyInvoiceResponseDataFromJSON,
1156
+ CompanyInvoiceResponseDataFromJSONTyped: () => CompanyInvoiceResponseDataFromJSONTyped,
1157
+ CompanyInvoiceResponseDataToJSON: () => CompanyInvoiceResponseDataToJSON,
1158
+ CompanyInvoiceResponseDataToJSONTyped: () => CompanyInvoiceResponseDataToJSONTyped,
1159
+ CompanyInvoicesResponseDataFromJSON: () => CompanyInvoicesResponseDataFromJSON,
1160
+ CompanyInvoicesResponseDataFromJSONTyped: () => CompanyInvoicesResponseDataFromJSONTyped,
1161
+ CompanyInvoicesResponseDataToJSON: () => CompanyInvoicesResponseDataToJSON,
1162
+ CompanyInvoicesResponseDataToJSONTyped: () => CompanyInvoicesResponseDataToJSONTyped,
1163
+ CompanyUpcomingInvoiceResponseDataFromJSON: () => CompanyUpcomingInvoiceResponseDataFromJSON,
1164
+ CompanyUpcomingInvoiceResponseDataFromJSONTyped: () => CompanyUpcomingInvoiceResponseDataFromJSONTyped,
1165
+ CompanyUpcomingInvoiceResponseDataToJSON: () => CompanyUpcomingInvoiceResponseDataToJSON,
1166
+ CompanyUpcomingInvoiceResponseDataToJSONTyped: () => CompanyUpcomingInvoiceResponseDataToJSONTyped,
1167
+ GetCompanyInvoicesParamsFromJSON: () => GetCompanyInvoicesParamsFromJSON,
1168
+ GetCompanyInvoicesParamsFromJSONTyped: () => GetCompanyInvoicesParamsFromJSONTyped,
1169
+ GetCompanyInvoicesParamsToJSON: () => GetCompanyInvoicesParamsToJSON,
1170
+ GetCompanyInvoicesParamsToJSONTyped: () => GetCompanyInvoicesParamsToJSONTyped,
1171
+ GetCompanyInvoicesResponseFromJSON: () => GetCompanyInvoicesResponseFromJSON,
1172
+ GetCompanyInvoicesResponseFromJSONTyped: () => GetCompanyInvoicesResponseFromJSONTyped,
1173
+ GetCompanyInvoicesResponseToJSON: () => GetCompanyInvoicesResponseToJSON,
1174
+ GetCompanyInvoicesResponseToJSONTyped: () => GetCompanyInvoicesResponseToJSONTyped,
1175
+ GetCompanyUpcomingInvoiceResponseFromJSON: () => GetCompanyUpcomingInvoiceResponseFromJSON,
1176
+ GetCompanyUpcomingInvoiceResponseFromJSONTyped: () => GetCompanyUpcomingInvoiceResponseFromJSONTyped,
1177
+ GetCompanyUpcomingInvoiceResponseToJSON: () => GetCompanyUpcomingInvoiceResponseToJSON,
1178
+ GetCompanyUpcomingInvoiceResponseToJSONTyped: () => GetCompanyUpcomingInvoiceResponseToJSONTyped,
1179
+ InvoiceStatus: () => InvoiceStatus,
1180
+ InvoiceStatusFromJSON: () => InvoiceStatusFromJSON,
1181
+ InvoiceStatusFromJSONTyped: () => InvoiceStatusFromJSONTyped,
1182
+ InvoiceStatusToJSON: () => InvoiceStatusToJSON,
1183
+ InvoiceStatusToJSONTyped: () => InvoiceStatusToJSONTyped,
1184
+ instanceOfApiError: () => instanceOfApiError,
1185
+ instanceOfCompanyDiscountResponseData: () => instanceOfCompanyDiscountResponseData,
1186
+ instanceOfCompanyInvoiceResponseData: () => instanceOfCompanyInvoiceResponseData,
1187
+ instanceOfCompanyInvoicesResponseData: () => instanceOfCompanyInvoicesResponseData,
1188
+ instanceOfCompanyUpcomingInvoiceResponseData: () => instanceOfCompanyUpcomingInvoiceResponseData,
1189
+ instanceOfGetCompanyInvoicesParams: () => instanceOfGetCompanyInvoicesParams,
1190
+ instanceOfGetCompanyInvoicesResponse: () => instanceOfGetCompanyInvoicesResponse,
1191
+ instanceOfGetCompanyUpcomingInvoiceResponse: () => instanceOfGetCompanyUpcomingInvoiceResponse,
1192
+ instanceOfInvoiceStatus: () => instanceOfInvoiceStatus
1193
+ });
1194
+ function instanceOfApiError(value) {
1195
+ if (!("error" in value) || value["error"] === void 0) return false;
1196
+ return true;
1197
+ }
1198
+ function ApiErrorFromJSON(json) {
1199
+ return ApiErrorFromJSONTyped(json, false);
1200
+ }
1201
+ function ApiErrorFromJSONTyped(json, ignoreDiscriminator) {
1202
+ if (json == null) {
1203
+ return json;
1204
+ }
1205
+ return {
1206
+ error: json["error"]
1207
+ };
1208
+ }
1209
+ function ApiErrorToJSON(json) {
1210
+ return ApiErrorToJSONTyped(json, false);
1211
+ }
1212
+ function ApiErrorToJSONTyped(value, ignoreDiscriminator = false) {
1213
+ if (value == null) {
1214
+ return value;
1215
+ }
1216
+ return {
1217
+ error: value["error"]
1218
+ };
1219
+ }
1220
+ function instanceOfCompanyDiscountResponseData(value) {
1221
+ if (!("couponName" in value) || value["couponName"] === void 0)
1222
+ return false;
1223
+ if (!("duration" in value) || value["duration"] === void 0) return false;
1224
+ return true;
1225
+ }
1226
+ function CompanyDiscountResponseDataFromJSON(json) {
1227
+ return CompanyDiscountResponseDataFromJSONTyped(json, false);
1228
+ }
1229
+ function CompanyDiscountResponseDataFromJSONTyped(json, ignoreDiscriminator) {
1230
+ if (json == null) {
1231
+ return json;
1232
+ }
1233
+ return {
1234
+ amountOff: json["amount_off"] == null ? void 0 : json["amount_off"],
1235
+ couponName: json["coupon_name"],
1236
+ currency: json["currency"] == null ? void 0 : json["currency"],
1237
+ customerFacingCode: json["customer_facing_code"] == null ? void 0 : json["customer_facing_code"],
1238
+ duration: json["duration"],
1239
+ durationInMonths: json["duration_in_months"] == null ? void 0 : json["duration_in_months"],
1240
+ percentOff: json["percent_off"] == null ? void 0 : json["percent_off"]
1241
+ };
1242
+ }
1243
+ function CompanyDiscountResponseDataToJSON(json) {
1244
+ return CompanyDiscountResponseDataToJSONTyped(json, false);
1245
+ }
1246
+ function CompanyDiscountResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
1247
+ if (value == null) {
1248
+ return value;
1249
+ }
1250
+ return {
1251
+ amount_off: value["amountOff"],
1252
+ coupon_name: value["couponName"],
1253
+ currency: value["currency"],
1254
+ customer_facing_code: value["customerFacingCode"],
1255
+ duration: value["duration"],
1256
+ duration_in_months: value["durationInMonths"],
1257
+ percent_off: value["percentOff"]
1258
+ };
1259
+ }
1260
+ var InvoiceStatus = {
1261
+ Draft: "draft",
1262
+ Open: "open",
1263
+ Paid: "paid",
1264
+ Uncollectible: "uncollectible",
1265
+ Void: "void"
1266
+ };
1267
+ function instanceOfInvoiceStatus(value) {
1268
+ for (const key in InvoiceStatus) {
1269
+ if (Object.prototype.hasOwnProperty.call(InvoiceStatus, key)) {
1270
+ if (InvoiceStatus[key] === value) {
1271
+ return true;
1272
+ }
1273
+ }
1274
+ }
1275
+ return false;
1276
+ }
1277
+ function InvoiceStatusFromJSON(json) {
1278
+ return InvoiceStatusFromJSONTyped(json, false);
1279
+ }
1280
+ function InvoiceStatusFromJSONTyped(json, ignoreDiscriminator) {
1281
+ return json;
1282
+ }
1283
+ function InvoiceStatusToJSON(value) {
1284
+ return value;
1285
+ }
1286
+ function InvoiceStatusToJSONTyped(value, ignoreDiscriminator) {
1287
+ return value;
1288
+ }
1289
+ function instanceOfCompanyInvoiceResponseData(value) {
1290
+ if (!("amountDue" in value) || value["amountDue"] === void 0) return false;
1291
+ if (!("createdAt" in value) || value["createdAt"] === void 0) return false;
1292
+ if (!("currency" in value) || value["currency"] === void 0) return false;
1293
+ if (!("id" in value) || value["id"] === void 0) return false;
1294
+ return true;
1295
+ }
1296
+ function CompanyInvoiceResponseDataFromJSON(json) {
1297
+ return CompanyInvoiceResponseDataFromJSONTyped(json, false);
1298
+ }
1299
+ function CompanyInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
1300
+ if (json == null) {
1301
+ return json;
1302
+ }
1303
+ return {
1304
+ amountDue: json["amount_due"],
1305
+ createdAt: new Date(json["created_at"]),
1306
+ currency: json["currency"],
1307
+ dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
1308
+ id: json["id"],
1309
+ status: json["status"] == null ? void 0 : InvoiceStatusFromJSON(json["status"]),
1310
+ url: json["url"] == null ? void 0 : json["url"]
1311
+ };
1312
+ }
1313
+ function CompanyInvoiceResponseDataToJSON(json) {
1314
+ return CompanyInvoiceResponseDataToJSONTyped(json, false);
1315
+ }
1316
+ function CompanyInvoiceResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
1317
+ if (value == null) {
1318
+ return value;
1319
+ }
1320
+ return {
1321
+ amount_due: value["amountDue"],
1322
+ created_at: value["createdAt"].toISOString(),
1323
+ currency: value["currency"],
1324
+ due_date: value["dueDate"] == null ? void 0 : value["dueDate"].toISOString(),
1325
+ id: value["id"],
1326
+ status: InvoiceStatusToJSON(value["status"]),
1327
+ url: value["url"]
1328
+ };
1329
+ }
1330
+ function instanceOfCompanyInvoicesResponseData(value) {
1331
+ if (!("count" in value) || value["count"] === void 0) return false;
1332
+ if (!("invoices" in value) || value["invoices"] === void 0) return false;
1333
+ return true;
1334
+ }
1335
+ function CompanyInvoicesResponseDataFromJSON(json) {
1336
+ return CompanyInvoicesResponseDataFromJSONTyped(json, false);
1337
+ }
1338
+ function CompanyInvoicesResponseDataFromJSONTyped(json, ignoreDiscriminator) {
1339
+ if (json == null) {
1340
+ return json;
1341
+ }
1342
+ return {
1343
+ count: json["count"],
1344
+ invoices: json["invoices"].map(
1345
+ CompanyInvoiceResponseDataFromJSON
1346
+ )
1347
+ };
1348
+ }
1349
+ function CompanyInvoicesResponseDataToJSON(json) {
1350
+ return CompanyInvoicesResponseDataToJSONTyped(json, false);
1351
+ }
1352
+ function CompanyInvoicesResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
1353
+ if (value == null) {
1354
+ return value;
1355
+ }
1356
+ return {
1357
+ count: value["count"],
1358
+ invoices: value["invoices"].map(
1359
+ CompanyInvoiceResponseDataToJSON
1360
+ )
1361
+ };
1362
+ }
1363
+ function instanceOfCompanyUpcomingInvoiceResponseData(value) {
1364
+ if (!("amountDue" in value) || value["amountDue"] === void 0) return false;
1365
+ if (!("currency" in value) || value["currency"] === void 0) return false;
1366
+ if (!("customerBalanceApplied" in value) || value["customerBalanceApplied"] === void 0)
1367
+ return false;
1368
+ if (!("customerBalanceRemaining" in value) || value["customerBalanceRemaining"] === void 0)
1369
+ return false;
1370
+ if (!("discounts" in value) || value["discounts"] === void 0) return false;
1371
+ if (!("subtotal" in value) || value["subtotal"] === void 0) return false;
1372
+ return true;
1373
+ }
1374
+ function CompanyUpcomingInvoiceResponseDataFromJSON(json) {
1375
+ return CompanyUpcomingInvoiceResponseDataFromJSONTyped(json, false);
1376
+ }
1377
+ function CompanyUpcomingInvoiceResponseDataFromJSONTyped(json, ignoreDiscriminator) {
1378
+ if (json == null) {
1379
+ return json;
1380
+ }
1381
+ return {
1382
+ amountDue: json["amount_due"],
1383
+ currency: json["currency"],
1384
+ customerBalanceApplied: json["customer_balance_applied"],
1385
+ customerBalanceRemaining: json["customer_balance_remaining"],
1386
+ discounts: json["discounts"].map(
1387
+ CompanyDiscountResponseDataFromJSON
1388
+ ),
1389
+ dueDate: json["due_date"] == null ? void 0 : new Date(json["due_date"]),
1390
+ subtotal: json["subtotal"]
1391
+ };
1392
+ }
1393
+ function CompanyUpcomingInvoiceResponseDataToJSON(json) {
1394
+ return CompanyUpcomingInvoiceResponseDataToJSONTyped(json, false);
1395
+ }
1396
+ function CompanyUpcomingInvoiceResponseDataToJSONTyped(value, ignoreDiscriminator = false) {
1397
+ if (value == null) {
1398
+ return value;
1399
+ }
1400
+ return {
1401
+ amount_due: value["amountDue"],
1402
+ currency: value["currency"],
1403
+ customer_balance_applied: value["customerBalanceApplied"],
1404
+ customer_balance_remaining: value["customerBalanceRemaining"],
1405
+ discounts: value["discounts"].map(
1406
+ CompanyDiscountResponseDataToJSON
1407
+ ),
1408
+ due_date: value["dueDate"] == null ? void 0 : value["dueDate"].toISOString(),
1409
+ subtotal: value["subtotal"]
1410
+ };
1411
+ }
1412
+ function instanceOfGetCompanyInvoicesParams(value) {
1413
+ return true;
1414
+ }
1415
+ function GetCompanyInvoicesParamsFromJSON(json) {
1416
+ return GetCompanyInvoicesParamsFromJSONTyped(json, false);
1417
+ }
1418
+ function GetCompanyInvoicesParamsFromJSONTyped(json, ignoreDiscriminator) {
1419
+ if (json == null) {
1420
+ return json;
1421
+ }
1422
+ return {
1423
+ includePending: json["include_pending"] == null ? void 0 : json["include_pending"],
1424
+ limit: json["limit"] == null ? void 0 : json["limit"],
1425
+ offset: json["offset"] == null ? void 0 : json["offset"]
1426
+ };
1427
+ }
1428
+ function GetCompanyInvoicesParamsToJSON(json) {
1429
+ return GetCompanyInvoicesParamsToJSONTyped(json, false);
1430
+ }
1431
+ function GetCompanyInvoicesParamsToJSONTyped(value, ignoreDiscriminator = false) {
1432
+ if (value == null) {
1433
+ return value;
1434
+ }
1435
+ return {
1436
+ include_pending: value["includePending"],
1437
+ limit: value["limit"],
1438
+ offset: value["offset"]
1439
+ };
1440
+ }
1441
+ function instanceOfGetCompanyInvoicesResponse(value) {
1442
+ if (!("data" in value) || value["data"] === void 0) return false;
1443
+ if (!("params" in value) || value["params"] === void 0) return false;
1444
+ return true;
1445
+ }
1446
+ function GetCompanyInvoicesResponseFromJSON(json) {
1447
+ return GetCompanyInvoicesResponseFromJSONTyped(json, false);
1448
+ }
1449
+ function GetCompanyInvoicesResponseFromJSONTyped(json, ignoreDiscriminator) {
1450
+ if (json == null) {
1451
+ return json;
1452
+ }
1453
+ return {
1454
+ data: CompanyInvoicesResponseDataFromJSON(json["data"]),
1455
+ params: GetCompanyInvoicesParamsFromJSON(json["params"])
1456
+ };
1457
+ }
1458
+ function GetCompanyInvoicesResponseToJSON(json) {
1459
+ return GetCompanyInvoicesResponseToJSONTyped(json, false);
1460
+ }
1461
+ function GetCompanyInvoicesResponseToJSONTyped(value, ignoreDiscriminator = false) {
1462
+ if (value == null) {
1463
+ return value;
1464
+ }
1465
+ return {
1466
+ data: CompanyInvoicesResponseDataToJSON(value["data"]),
1467
+ params: GetCompanyInvoicesParamsToJSON(value["params"])
1468
+ };
1469
+ }
1470
+ function instanceOfGetCompanyUpcomingInvoiceResponse(value) {
1471
+ if (!("data" in value) || value["data"] === void 0) return false;
1472
+ if (!("params" in value) || value["params"] === void 0) return false;
1473
+ return true;
1474
+ }
1475
+ function GetCompanyUpcomingInvoiceResponseFromJSON(json) {
1476
+ return GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, false);
1477
+ }
1478
+ function GetCompanyUpcomingInvoiceResponseFromJSONTyped(json, ignoreDiscriminator) {
1479
+ if (json == null) {
1480
+ return json;
1481
+ }
1482
+ return {
1483
+ data: CompanyUpcomingInvoiceResponseDataFromJSON(json["data"]),
1484
+ params: json["params"]
1485
+ };
1486
+ }
1487
+ function GetCompanyUpcomingInvoiceResponseToJSON(json) {
1488
+ return GetCompanyUpcomingInvoiceResponseToJSONTyped(json, false);
1489
+ }
1490
+ function GetCompanyUpcomingInvoiceResponseToJSONTyped(value, ignoreDiscriminator = false) {
1491
+ if (value == null) {
1492
+ return value;
1493
+ }
1494
+ return {
1495
+ data: CompanyUpcomingInvoiceResponseDataToJSON(value["data"]),
1496
+ params: value["params"]
1497
+ };
1498
+ }
1126
1499
  var anonymousIdKey = "schematicId";
1127
1500
  var flagStateCachePrefix = "schematicCache";
1128
1501
  var flagStateCacheMaxContexts = 10;
1129
1502
  var flagStateCacheDefaultMaxAgeMs = 7 * 24 * 60 * 60 * 1e3;
1130
1503
  var emptyCreditBalances = Object.freeze({});
1131
1504
  var Schematic = class {
1132
- additionalHeaders = {};
1505
+ _additionalHeaders = {};
1133
1506
  apiKey;
1134
- apiUrl = "https://api.schematichq.com";
1507
+ _apiUrl = "https://api.schematichq.com";
1135
1508
  conn = null;
1136
1509
  context = {};
1137
1510
  debugEnabled = false;
@@ -1211,7 +1584,7 @@ var Schematic = class {
1211
1584
  if (this.offlineEnabled) {
1212
1585
  this.setIsPending(false);
1213
1586
  }
1214
- this.additionalHeaders = {
1587
+ this._additionalHeaders = {
1215
1588
  "X-Schematic-Client-Version": `schematic-js@${version}`,
1216
1589
  ...options?.additionalHeaders ?? {}
1217
1590
  };
@@ -1227,7 +1600,7 @@ var Schematic = class {
1227
1600
  }
1228
1601
  this.hydrateFlagStateFromCache();
1229
1602
  if (options?.apiUrl !== void 0) {
1230
- this.apiUrl = options.apiUrl;
1603
+ this._apiUrl = options.apiUrl;
1231
1604
  }
1232
1605
  if (options?.eventUrl !== void 0) {
1233
1606
  this.eventUrl = options.eventUrl;
@@ -1292,6 +1665,12 @@ var Schematic = class {
1292
1665
  this.debug("Initialized with debug mode enabled");
1293
1666
  }
1294
1667
  }
1668
+ get apiUrl() {
1669
+ return this._apiUrl;
1670
+ }
1671
+ get additionalHeaders() {
1672
+ return { ...this._additionalHeaders };
1673
+ }
1295
1674
  /**
1296
1675
  * Resolve fallback value according to priority order:
1297
1676
  * 1. Callsite fallback value (if provided)
@@ -1377,11 +1756,11 @@ var Schematic = class {
1377
1756
  return resolvedFallbackResult.value;
1378
1757
  }
1379
1758
  if (!this.useWebSocket) {
1380
- const requestUrl = `${this.apiUrl}/flags/${key}/check`;
1759
+ const requestUrl = `${this._apiUrl}/flags/${key}/check`;
1381
1760
  return fetch(requestUrl, {
1382
1761
  method: "POST",
1383
1762
  headers: {
1384
- ...this.additionalHeaders ?? {},
1763
+ ...this._additionalHeaders ?? {},
1385
1764
  "Content-Type": "application/json;charset=UTF-8",
1386
1765
  "X-Schematic-Api-Key": this.apiKey
1387
1766
  },
@@ -1584,12 +1963,12 @@ var Schematic = class {
1584
1963
  this.debug(`checkFlags offline result: returning empty object`);
1585
1964
  return {};
1586
1965
  }
1587
- const requestUrl = `${this.apiUrl}/flags/check`;
1966
+ const requestUrl = `${this._apiUrl}/flags/check`;
1588
1967
  const requestBody = JSON.stringify(context);
1589
1968
  return fetch(requestUrl, {
1590
1969
  method: "POST",
1591
1970
  headers: {
1592
- ...this.additionalHeaders ?? {},
1971
+ ...this._additionalHeaders ?? {},
1593
1972
  "Content-Type": "application/json;charset=UTF-8",
1594
1973
  "X-Schematic-Api-Key": this.apiKey
1595
1974
  },
@@ -2136,7 +2515,7 @@ var Schematic = class {
2136
2515
  const response = await fetch(captureUrl, {
2137
2516
  method: "POST",
2138
2517
  headers: {
2139
- ...this.additionalHeaders ?? {},
2518
+ ...this._additionalHeaders ?? {},
2140
2519
  "Content-Type": "application/json;charset=UTF-8"
2141
2520
  },
2142
2521
  body: payload
@@ -2632,7 +3011,7 @@ var Schematic = class {
2632
3011
  }
2633
3012
  });
2634
3013
  this.currentWebSocket = socket;
2635
- const clientVersion = this.additionalHeaders["X-Schematic-Client-Version"] ?? `schematic-js@${version}`;
3014
+ const clientVersion = this._additionalHeaders["X-Schematic-Client-Version"] ?? `schematic-js@${version}`;
2636
3015
  const messagePayload = {
2637
3016
  apiKey: this.apiKey,
2638
3017
  clientVersion,
@@ -2869,10 +3248,10 @@ var notifyCreditBalanceListener = (listener, value) => {
2869
3248
  import { inject, onScopeDispose } from "vue";
2870
3249
 
2871
3250
  // src/version.ts
2872
- var version2 = "1.5.0";
3251
+ var version2 = "1.6.0";
2873
3252
 
2874
3253
  // src/context/schematic.ts
2875
- var SchematicSymbol = Symbol("schematic");
3254
+ var SchematicSymbol = /* @__PURE__ */ Symbol("schematic");
2876
3255
  var SchematicPlugin = {
2877
3256
  install(app, options) {
2878
3257
  let client;
@@ -2909,7 +3288,14 @@ var useSchematic = () => {
2909
3288
  };
2910
3289
 
2911
3290
  // src/composables/schematic.ts
2912
- import { computed, onMounted, onScopeDispose as onScopeDispose2, ref } from "vue";
3291
+ import {
3292
+ computed,
3293
+ onMounted,
3294
+ onScopeDispose as onScopeDispose2,
3295
+ ref,
3296
+ toValue,
3297
+ watch
3298
+ } from "vue";
2913
3299
  var useSchematicClient = (opts) => {
2914
3300
  const schematic = useSchematic();
2915
3301
  const { client } = opts ?? {};
@@ -2979,10 +3365,17 @@ var useSchematicEntitlement = (key, opts) => {
2979
3365
  featureUsageExceeded: computed(() => flagCheck.value.featureUsageExceeded),
2980
3366
  featureUsageEvent: computed(() => flagCheck.value.featureUsageEvent),
2981
3367
  featureUsagePeriod: computed(() => flagCheck.value.featureUsagePeriod),
3368
+ softLimit: computed(() => flagCheck.value.softLimit),
3369
+ warningTiers: computed(() => flagCheck.value.warningTiers),
2982
3370
  flagId: computed(() => flagCheck.value.flagId),
2983
3371
  ruleId: computed(() => flagCheck.value.ruleId),
2984
3372
  companyId: computed(() => flagCheck.value.companyId),
2985
- userId: computed(() => flagCheck.value.userId)
3373
+ userId: computed(() => flagCheck.value.userId),
3374
+ // Credit fields, populated for features metered by credit burndown
3375
+ creditId: computed(() => flagCheck.value.creditId),
3376
+ creditSettled: computed(() => flagCheck.value.creditSettled),
3377
+ creditRemaining: computed(() => flagCheck.value.creditRemaining),
3378
+ creditReserved: computed(() => flagCheck.value.creditReserved)
2986
3379
  };
2987
3380
  };
2988
3381
  var useSchematicPlan = (opts) => {
@@ -3004,15 +3397,24 @@ var useSchematicPlan = (opts) => {
3004
3397
  };
3005
3398
  var useSchematicCreditBalance = (creditId, opts) => {
3006
3399
  const client = useSchematicClient(opts);
3400
+ const resolvedCreditId = computed(() => toValue(creditId));
3401
+ const readBalance = () => {
3402
+ const id = resolvedCreditId.value;
3403
+ return id === void 0 ? void 0 : client.getCreditBalance(id);
3404
+ };
3007
3405
  const creditBalance = ref(
3008
- client.getCreditBalance(creditId)
3406
+ readBalance()
3009
3407
  );
3010
3408
  const isPending = ref(client.getIsPending());
3409
+ watch(resolvedCreditId, () => {
3410
+ creditBalance.value = readBalance();
3411
+ });
3011
3412
  let unsubscribeBalance = null;
3012
3413
  let unsubscribePending = null;
3013
3414
  onMounted(() => {
3415
+ creditBalance.value = readBalance();
3014
3416
  unsubscribeBalance = client.addCreditBalanceListener(() => {
3015
- creditBalance.value = client.getCreditBalance(creditId);
3417
+ creditBalance.value = readBalance();
3016
3418
  });
3017
3419
  unsubscribePending = client.addIsPendingListener(() => {
3018
3420
  isPending.value = client.getIsPending();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schematichq/schematic-vue",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "main": "dist/schematic-vue.cjs.js",
5
5
  "module": "dist/schematic-vue.esm.js",
6
6
  "types": "dist/schematic-vue.d.ts",
@@ -16,47 +16,43 @@
16
16
  "url": "git+ssh://git@github.com/SchematicHQ/schematic-js.git"
17
17
  },
18
18
  "scripts": {
19
- "dev": "yarn tsc --watch",
20
- "build": "./version.sh && yarn tsc && yarn format && yarn lint && yarn clean && yarn build:cjs && yarn build:esm && yarn build:types",
21
- "build:cjs": "npx esbuild src/index.ts --bundle --external:vue --format=cjs --outfile=dist/schematic-vue.cjs.js",
22
- "build:esm": "npx esbuild src/index.ts --bundle --external:vue --format=esm --outfile=dist/schematic-vue.esm.js",
23
- "build:types": "npx tsc && npx api-extractor run",
19
+ "dev": "pnpm exec tsc --watch",
20
+ "build": "./version.sh && pnpm run tsc && pnpm run format && pnpm run lint && pnpm run clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
21
+ "build:cjs": "pnpm exec esbuild src/index.ts --bundle --external:vue --format=cjs --outfile=dist/schematic-vue.cjs.js",
22
+ "build:esm": "pnpm exec esbuild src/index.ts --bundle --external:vue --format=esm --outfile=dist/schematic-vue.esm.js",
23
+ "build:types": "pnpm exec tsc && pnpm exec api-extractor run",
24
24
  "clean": "rm -rf dist",
25
25
  "format": "prettier --write \"src/**/*.ts\"",
26
26
  "lint": "eslint src --ext ts --report-unused-disable-directives --fix",
27
27
  "test": "jest --config jest.config.js",
28
- "tsc": "npx tsc",
28
+ "tsc": "pnpm exec tsc",
29
29
  "prepare": "husky"
30
30
  },
31
31
  "devDependencies": {
32
- "@eslint/js": "^9.24.0",
33
- "@microsoft/api-extractor": "^7.52.2",
34
- "@schematichq/schematic-js": "^1.5.0",
35
- "@testing-library/dom": "^10.4.1",
32
+ "@eslint/js": "^10.0.1",
33
+ "@microsoft/api-extractor": "^7.59.1",
34
+ "@schematichq/schematic-js": "^1.8.0",
35
+ "@testing-library/dom": "^10.4.2",
36
36
  "@types/jest": "^30.0.0",
37
- "@vue/test-utils": "^2.4.6",
38
- "esbuild": "^0.25.2",
37
+ "@types/node": "^26.5.1",
38
+ "@vue/test-utils": "^2.5.0",
39
+ "esbuild": "^0.28.2",
39
40
  "eslint": "^9.24.0",
40
41
  "eslint-plugin-import": "^2.32.0",
41
42
  "eslint-plugin-vue": "^9.30.0",
42
- "globals": "^16.0.0",
43
+ "globals": "^17.12.0",
43
44
  "husky": "^9.1.7",
44
- "jest": "^30.0.0",
45
- "jest-environment-jsdom": "^30.0.0",
45
+ "jest": "^30.5.1",
46
+ "jest-environment-jsdom": "^30.5.1",
46
47
  "jest-esbuild": "^0.4.0",
47
- "prettier": "^3.6.2",
48
- "ts-jest": "^29.3.0",
49
- "typescript": "^5.9.2",
50
- "typescript-eslint": "^8.29.1",
51
- "vue": "^3.5.13"
48
+ "prettier": "^3.9.8",
49
+ "ts-jest": "^29.4.12",
50
+ "typescript": "^6.0.3",
51
+ "typescript-eslint": "^8.70.0",
52
+ "vue": "^3.5.42"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "vue": ">=3.3"
55
56
  },
56
- "resolutions": {
57
- "handlebars": ">=4.7.9",
58
- "lodash": ">=4.18.0",
59
- "minimatch": ">=3.1.3"
60
- },
61
- "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
57
+ "packageManager": "pnpm@11.9.0+sha512.bd682d5d03fe525ef7c9fd6780c6884d1e756ac4c9c9fe00c538782824310dcf90e3ddc4f53835f06dfaebd5085e41855e0bcbb3b60de2ac5bbab89e5036f03b"
62
58
  }