@aranova/tracking-react 1.8.1 → 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/sales.mjs
CHANGED
|
@@ -206,6 +206,7 @@ function camelRules(rules) {
|
|
|
206
206
|
closedDates: rules.closed_dates,
|
|
207
207
|
specialHours: rules.special_hours,
|
|
208
208
|
vehicleRequired: rules.vehicle_required,
|
|
209
|
+
vehicleDeferred: rules.vehicle_deferred,
|
|
209
210
|
dropOffOptions: rules.drop_off_options
|
|
210
211
|
};
|
|
211
212
|
}
|
|
@@ -399,8 +400,17 @@ var BOOKING_SIMULATE_HEADER = "X-Aranova-Simulate";
|
|
|
399
400
|
var BOOKING_ERROR_CODES = {
|
|
400
401
|
unavailable: "booking_unavailable",
|
|
401
402
|
stale: "booking_config_stale",
|
|
402
|
-
rejected: "booking_rejected"
|
|
403
|
+
rejected: "booking_rejected",
|
|
404
|
+
attemptMismatch: "booking_attempt_mismatch",
|
|
405
|
+
detailsConflict: "idempotency_conflict"
|
|
403
406
|
};
|
|
407
|
+
function detailsFailure(error) {
|
|
408
|
+
if (!(error instanceof AranovaApiError)) return "failed";
|
|
409
|
+
if (error.code === BOOKING_ERROR_CODES.attemptMismatch) return "mismatch";
|
|
410
|
+
if (error.code === BOOKING_ERROR_CODES.detailsConflict) return "conflict";
|
|
411
|
+
if (error.status === 404) return "not_found";
|
|
412
|
+
return error.status === 422 ? "invalid" : "failed";
|
|
413
|
+
}
|
|
404
414
|
var POLL_DELAYS_MS = [1e3, 2e3, 4e3, 8e3, 15e3];
|
|
405
415
|
var INVALID_DETAILS = "Please check your details and try again.";
|
|
406
416
|
var newBookingAttemptKey = uuidV4;
|
|
@@ -585,6 +595,25 @@ function createSalesBookingsClient(config, firing) {
|
|
|
585
595
|
onPending?.(outcome);
|
|
586
596
|
return withHandoff(await poll(outcome.id, outcome.mode), input);
|
|
587
597
|
},
|
|
598
|
+
async updateBooking(bookingId, details, { attemptKey }) {
|
|
599
|
+
const body = {
|
|
600
|
+
idempotency_key: attemptKey,
|
|
601
|
+
vehicle: details.vehicle ?? null,
|
|
602
|
+
notes: details.notes?.trim() || null
|
|
603
|
+
};
|
|
604
|
+
try {
|
|
605
|
+
const response = await salesRequest(
|
|
606
|
+
config,
|
|
607
|
+
"POST",
|
|
608
|
+
`/bookings/${encodeURIComponent(bookingId)}/details`,
|
|
609
|
+
body
|
|
610
|
+
);
|
|
611
|
+
return { status: response.status, id: response.id };
|
|
612
|
+
} catch (error) {
|
|
613
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
614
|
+
return { status: detailsFailure(error), id: bookingId, message };
|
|
615
|
+
}
|
|
616
|
+
},
|
|
588
617
|
async status(id) {
|
|
589
618
|
return outcomeOf(
|
|
590
619
|
await salesRequest(
|
|
@@ -818,6 +847,7 @@ var zErrorCode = z.enum([
|
|
|
818
847
|
"booking_unavailable",
|
|
819
848
|
"booking_config_stale",
|
|
820
849
|
"booking_rejected",
|
|
850
|
+
"booking_attempt_mismatch",
|
|
821
851
|
"calendar_not_owned",
|
|
822
852
|
"calendar_is_sandbox",
|
|
823
853
|
"sandbox_exists",
|
|
@@ -898,7 +928,6 @@ var zSmsWithheldReason = z.enum([
|
|
|
898
928
|
"confirmed_by_integration",
|
|
899
929
|
"test_or_bot_session",
|
|
900
930
|
"invalid_phone",
|
|
901
|
-
"quiet_hours",
|
|
902
931
|
"recently_texted"
|
|
903
932
|
]);
|
|
904
933
|
var zSaleSmsStatusSchema = z.object({
|