@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/{bookings-CkfA5XOM.d.ts → bookings-2ZKfenQ7.d.ts} +13 -0
- package/dist/{bookings-DFz3BUiP.d.mts → bookings-DOh1WMhH.d.mts} +13 -0
- package/dist/client.d.mts +2 -2
- package/dist/client.d.ts +2 -2
- package/dist/client.js +15 -4
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +15 -4
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{sales-J_ItVjgE.d.mts → sales-B1u_IHLZ.d.mts} +1 -1
- package/dist/{sales-DGSi7IqU.d.ts → sales-I2jXSS-l.d.ts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +12 -2
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +12 -2
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -717,9 +717,18 @@ function parseBookingRules(value) {
|
|
|
717
717
|
special_hours: parseWindowsMap(r.special_hours),
|
|
718
718
|
vehicle_required: r.vehicle_required === true,
|
|
719
719
|
vehicle_deferred: r.vehicle_deferred === true,
|
|
720
|
-
drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
|
|
720
|
+
drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : [],
|
|
721
|
+
booked_counts: parseCounts(r.booked_counts)
|
|
721
722
|
};
|
|
722
723
|
}
|
|
724
|
+
function parseCounts(value) {
|
|
725
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
726
|
+
const counts = {};
|
|
727
|
+
for (const [date, count] of Object.entries(value)) {
|
|
728
|
+
if (typeof count === "number" && Number.isInteger(count) && count >= 0) counts[date] = count;
|
|
729
|
+
}
|
|
730
|
+
return counts;
|
|
731
|
+
}
|
|
723
732
|
function parseBookingOption(value) {
|
|
724
733
|
if (!value || typeof value !== "object") return [];
|
|
725
734
|
const o = value;
|
|
@@ -1535,7 +1544,8 @@ function camelRules(rules) {
|
|
|
1535
1544
|
specialHours: rules.special_hours,
|
|
1536
1545
|
vehicleRequired: rules.vehicle_required,
|
|
1537
1546
|
vehicleDeferred: rules.vehicle_deferred,
|
|
1538
|
-
dropOffOptions: rules.drop_off_options
|
|
1547
|
+
dropOffOptions: rules.drop_off_options,
|
|
1548
|
+
bookedCounts: rules.booked_counts ?? {}
|
|
1539
1549
|
};
|
|
1540
1550
|
}
|
|
1541
1551
|
var WEEKDAYS = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
|
|
@@ -1568,7 +1578,8 @@ function bookableSlots(rules, { timeZone, now = /* @__PURE__ */ new Date() }) {
|
|
|
1568
1578
|
date,
|
|
1569
1579
|
weekday,
|
|
1570
1580
|
morning: [...windows.morning],
|
|
1571
|
-
afternoon: [...windows.afternoon]
|
|
1581
|
+
afternoon: [...windows.afternoon],
|
|
1582
|
+
booked: rules.bookedCounts?.[date] ?? 0
|
|
1572
1583
|
});
|
|
1573
1584
|
}
|
|
1574
1585
|
return days;
|