@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/{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 +22 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/dist/{sales-KbTcowYa.d.mts → sales-B1u_IHLZ.d.mts} +3 -1
- package/dist/{sales-C0FMkN4m.d.ts → sales-I2jXSS-l.d.ts} +3 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +20 -3
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +20 -3
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
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
|
|
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;
|