@aranova/tracking-react 1.16.1 → 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;