@aranova/tracking-react 1.8.1 → 1.10.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/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,26 @@ 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
+ heard_via: details.heardVia?.trim() || null
1922
+ };
1923
+ try {
1924
+ const response = await salesRequest(
1925
+ config,
1926
+ "POST",
1927
+ `/bookings/${encodeURIComponent(bookingId)}/details`,
1928
+ body
1929
+ );
1930
+ return { status: response.status, id: response.id };
1931
+ } catch (error) {
1932
+ const message = error instanceof Error ? error.message : String(error);
1933
+ return { status: detailsFailure(error), id: bookingId, message };
1934
+ }
1935
+ },
1905
1936
  async status(id) {
1906
1937
  return outcomeOf(
1907
1938
  await salesRequest(
@@ -2135,6 +2166,7 @@ var zErrorCode = z2.enum([
2135
2166
  "booking_unavailable",
2136
2167
  "booking_config_stale",
2137
2168
  "booking_rejected",
2169
+ "booking_attempt_mismatch",
2138
2170
  "calendar_not_owned",
2139
2171
  "calendar_is_sandbox",
2140
2172
  "sandbox_exists",
@@ -2215,7 +2247,6 @@ var zSmsWithheldReason = z2.enum([
2215
2247
  "confirmed_by_integration",
2216
2248
  "test_or_bot_session",
2217
2249
  "invalid_phone",
2218
- "quiet_hours",
2219
2250
  "recently_texted"
2220
2251
  ]);
2221
2252
  var zSaleSmsStatusSchema = z2.object({