@aranova/tracking-react 1.8.0 → 1.9.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/README.md +5 -0
- package/dist/{bookings-B50X7GSG.d.ts → bookings-Bx7totlS.d.ts} +43 -1
- package/dist/{bookings-n8UUzrak.d.mts → bookings-DtcwdM_I.d.mts} +43 -1
- package/dist/client.d.mts +17 -3
- package/dist/client.d.ts +17 -3
- package/dist/client.js +46 -5
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +46 -5
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +32 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-vP-DqpxO.d.ts → ingest-typed-B-BgEZdW.d.ts} +3 -1
- package/dist/{ingest-typed-ABH28Ips.d.mts → ingest-typed-C2OvZ7dp.d.mts} +3 -1
- package/dist/{sales-D4QRnpdz.d.ts → sales-DJJpMY_c.d.ts} +1 -1
- package/dist/{sales-DByfvgzT.d.mts → sales-Dil7TNV_.d.mts} +1 -1
- package/dist/sales.d.mts +2 -2
- package/dist/sales.d.ts +2 -2
- package/dist/sales.js +31 -2
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +31 -2
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -715,6 +715,7 @@ function parseBookingRules(value) {
|
|
|
715
715
|
closed_dates: isStringList(r.closed_dates) ? r.closed_dates : [],
|
|
716
716
|
special_hours: parseWindowsMap(r.special_hours),
|
|
717
717
|
vehicle_required: r.vehicle_required === true,
|
|
718
|
+
vehicle_deferred: r.vehicle_deferred === true,
|
|
718
719
|
drop_off_options: isStringList(r.drop_off_options) ? r.drop_off_options : []
|
|
719
720
|
};
|
|
720
721
|
}
|
|
@@ -1473,6 +1474,7 @@ function camelRules(rules) {
|
|
|
1473
1474
|
closedDates: rules.closed_dates,
|
|
1474
1475
|
specialHours: rules.special_hours,
|
|
1475
1476
|
vehicleRequired: rules.vehicle_required,
|
|
1477
|
+
vehicleDeferred: rules.vehicle_deferred,
|
|
1476
1478
|
dropOffOptions: rules.drop_off_options
|
|
1477
1479
|
};
|
|
1478
1480
|
}
|
|
@@ -1716,8 +1718,17 @@ var BOOKING_SIMULATE_HEADER = "X-Aranova-Simulate";
|
|
|
1716
1718
|
var BOOKING_ERROR_CODES = {
|
|
1717
1719
|
unavailable: "booking_unavailable",
|
|
1718
1720
|
stale: "booking_config_stale",
|
|
1719
|
-
rejected: "booking_rejected"
|
|
1721
|
+
rejected: "booking_rejected",
|
|
1722
|
+
attemptMismatch: "booking_attempt_mismatch",
|
|
1723
|
+
detailsConflict: "idempotency_conflict"
|
|
1720
1724
|
};
|
|
1725
|
+
function detailsFailure(error) {
|
|
1726
|
+
if (!(error instanceof AranovaApiError)) return "failed";
|
|
1727
|
+
if (error.code === BOOKING_ERROR_CODES.attemptMismatch) return "mismatch";
|
|
1728
|
+
if (error.code === BOOKING_ERROR_CODES.detailsConflict) return "conflict";
|
|
1729
|
+
if (error.status === 404) return "not_found";
|
|
1730
|
+
return error.status === 422 ? "invalid" : "failed";
|
|
1731
|
+
}
|
|
1721
1732
|
var POLL_DELAYS_MS = [1e3, 2e3, 4e3, 8e3, 15e3];
|
|
1722
1733
|
var INVALID_DETAILS = "Please check your details and try again.";
|
|
1723
1734
|
var newBookingAttemptKey = uuidV4;
|
|
@@ -1902,6 +1913,25 @@ function createSalesBookingsClient(config, firing) {
|
|
|
1902
1913
|
onPending?.(outcome);
|
|
1903
1914
|
return withHandoff(await poll(outcome.id, outcome.mode), input);
|
|
1904
1915
|
},
|
|
1916
|
+
async updateBooking(bookingId, details, { attemptKey }) {
|
|
1917
|
+
const body = {
|
|
1918
|
+
idempotency_key: attemptKey,
|
|
1919
|
+
vehicle: details.vehicle ?? null,
|
|
1920
|
+
notes: details.notes?.trim() || null
|
|
1921
|
+
};
|
|
1922
|
+
try {
|
|
1923
|
+
const response = await salesRequest(
|
|
1924
|
+
config,
|
|
1925
|
+
"POST",
|
|
1926
|
+
`/bookings/${encodeURIComponent(bookingId)}/details`,
|
|
1927
|
+
body
|
|
1928
|
+
);
|
|
1929
|
+
return { status: response.status, id: response.id };
|
|
1930
|
+
} catch (error) {
|
|
1931
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1932
|
+
return { status: detailsFailure(error), id: bookingId, message };
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1905
1935
|
async status(id) {
|
|
1906
1936
|
return outcomeOf(
|
|
1907
1937
|
await salesRequest(
|
|
@@ -2135,6 +2165,7 @@ var zErrorCode = z2.enum([
|
|
|
2135
2165
|
"booking_unavailable",
|
|
2136
2166
|
"booking_config_stale",
|
|
2137
2167
|
"booking_rejected",
|
|
2168
|
+
"booking_attempt_mismatch",
|
|
2138
2169
|
"calendar_not_owned",
|
|
2139
2170
|
"calendar_is_sandbox",
|
|
2140
2171
|
"sandbox_exists",
|
|
@@ -2215,7 +2246,6 @@ var zSmsWithheldReason = z2.enum([
|
|
|
2215
2246
|
"confirmed_by_integration",
|
|
2216
2247
|
"test_or_bot_session",
|
|
2217
2248
|
"invalid_phone",
|
|
2218
|
-
"quiet_hours",
|
|
2219
2249
|
"recently_texted"
|
|
2220
2250
|
]);
|
|
2221
2251
|
var zSaleSmsStatusSchema = z2.object({
|