@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/client.mjs CHANGED
@@ -979,9 +979,18 @@ function parseBookingRules(value) {
979
979
  special_hours: parseWindowsMap(r.special_hours),
980
980
  vehicle_required: r.vehicle_required === true,
981
981
  vehicle_deferred: r.vehicle_deferred === true,
982
- drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
982
+ drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : [],
983
+ booked_counts: parseCounts(r.booked_counts)
983
984
  };
984
985
  }
986
+ function parseCounts(value) {
987
+ if (!value || typeof value !== "object" || Array.isArray(value)) return {};
988
+ const counts = {};
989
+ for (const [date, count] of Object.entries(value)) {
990
+ if (typeof count === "number" && Number.isInteger(count) && count >= 0) counts[date] = count;
991
+ }
992
+ return counts;
993
+ }
985
994
  function parseBookingOption(value) {
986
995
  if (!value || typeof value !== "object") return [];
987
996
  const o = value;
@@ -1774,7 +1783,8 @@ function camelRules(rules) {
1774
1783
  specialHours: rules.special_hours,
1775
1784
  vehicleRequired: rules.vehicle_required,
1776
1785
  vehicleDeferred: rules.vehicle_deferred,
1777
- dropOffOptions: rules.drop_off_options
1786
+ dropOffOptions: rules.drop_off_options,
1787
+ bookedCounts: rules.booked_counts ?? {}
1778
1788
  };
1779
1789
  }
1780
1790
  var WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
@@ -1807,7 +1817,8 @@ function bookableSlots(rules, { timeZone, now = /* @__PURE__ */ new Date() }) {
1807
1817
  date,
1808
1818
  weekday,
1809
1819
  morning: [...windows.morning],
1810
- afternoon: [...windows.afternoon]
1820
+ afternoon: [...windows.afternoon],
1821
+ booked: rules.bookedCounts?.[date] ?? 0
1811
1822
  });
1812
1823
  }
1813
1824
  return days;
@@ -4364,7 +4375,7 @@ function GoogleAdsTracking(props) {
4364
4375
  import { createContext as createContext2, useContext as useContext2, useEffect as useEffect5, useMemo as useMemo4 } from "react";
4365
4376
 
4366
4377
  // package.json
4367
- var version = "1.16.1";
4378
+ var version = "1.17.0";
4368
4379
 
4369
4380
  // ../tracking-core/src/phone-react.tsx
4370
4381
  import {