@aranova/tracking-react 1.16.0 → 1.17.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/sales.mjs CHANGED
@@ -325,7 +325,8 @@ function camelRules(rules) {
325
325
  specialHours: rules.special_hours,
326
326
  vehicleRequired: rules.vehicle_required,
327
327
  vehicleDeferred: rules.vehicle_deferred,
328
- dropOffOptions: rules.drop_off_options
328
+ dropOffOptions: rules.drop_off_options,
329
+ bookedCounts: rules.booked_counts ?? {}
329
330
  };
330
331
  }
331
332
  function buildBookingHandoffUrl(fallbackUrl, prefill = {}) {
@@ -587,9 +588,18 @@ function parseBookingRules(value) {
587
588
  special_hours: parseWindowsMap(r.special_hours),
588
589
  vehicle_required: r.vehicle_required === true,
589
590
  vehicle_deferred: r.vehicle_deferred === true,
590
- drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
591
+ drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : [],
592
+ booked_counts: parseCounts(r.booked_counts)
591
593
  };
592
594
  }
595
+ function parseCounts(value) {
596
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
597
+ const counts = {};
598
+ for (const [date, count] of Object.entries(value)) {
599
+ if (typeof count === "number" && Number.isInteger(count) && count >= 0) counts[date] = count;
600
+ }
601
+ return counts;
602
+ }
593
603
  function parseBookingOption(value) {
594
604
  if (!value || typeof value !== "object") return [];
595
605
  const o = value;
@@ -1355,9 +1365,16 @@ function optionKeys(value) {
1355
1365
  }
1356
1366
 
1357
1367
  // ../tracking-core/src/resources/http/errors.ts
1358
- var AranovaApiError = class extends Error {
1368
+ var API_ERROR_BRAND = /* @__PURE__ */ Symbol.for("aranova.api_error");
1369
+ var AranovaApiError = class _AranovaApiError extends Error {
1370
+ /** `instanceof` checks the brand, so an error from another entry's copy of this class passes. */
1371
+ static [Symbol.hasInstance](value) {
1372
+ if (this !== _AranovaApiError) return Function.prototype[Symbol.hasInstance].call(this, value);
1373
+ return typeof value === "object" && value !== null && value[API_ERROR_BRAND] === true;
1374
+ }
1359
1375
  constructor(message, options) {
1360
1376
  super(message);
1377
+ Object.defineProperty(this, API_ERROR_BRAND, { value: true });
1361
1378
  this.name = "AranovaApiError";
1362
1379
  this.status = options.status;
1363
1380
  this.code = options.code;