@aranova/tracking-react 1.9.0 → 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/README.md CHANGED
@@ -366,11 +366,15 @@ await submit({
366
366
  form's own questions with `formSubmit.extraFields`; a name the booking already reports
367
367
  (`phone`, `email`, ...) is dropped.
368
368
  - Ask for the last name separately, and a mobile number (the shop's confirmation text goes to it).
369
- - Details after booking (when `booking.rules.vehicleDeferred`, or for extra notes):
370
- `updateBooking({ vehicle, notes })` from the same hook. It resolves `updated` / `queued` /
369
+ - Details after booking (when `booking.rules.vehicleDeferred`, for extra notes, or for the site's
370
+ own "How did you hear about us?" answer):
371
+ `updateBooking({ vehicle, notes, heardVia })` from the same hook. It resolves `updated` / `queued` /
371
372
  `notified_owner` (all saved) or `invalid`, `mismatch`, `conflict`, `not_found`, `failed`
372
373
  (only `failed` is worth a retry). To survive a reload, save `booked` (`{ bookingId, attemptKey }`)
373
- in `sessionStorage` and pass it back: `updateBooking(details, saved)`.
374
+ in `sessionStorage` and pass it back: `updateBooking(details, saved)`. `heardVia` is reporting-only
375
+ and never reaches the shop; it takes the same values as the form's `heardVia` `form_submit` field,
376
+ so asking it on the success screen instead of the form reports the same. One update per booking,
377
+ so send it with a deferred vehicle rather than in a second call.
374
378
  - Reports the `booking_integration` capability.
375
379
 
376
380
  ## On-site conversion firing
@@ -284,6 +284,12 @@ interface BookingDetailsInput {
284
284
  model: string;
285
285
  } | null;
286
286
  notes?: string | null;
287
+ /**
288
+ * The site's own "How did you hear about us?" answer, verbatim — the same values the form's
289
+ * `form_submit` `heardVia` field carries, so one answer reports the same whether it is asked
290
+ * on the form or on the success screen. Ours for reporting: never sent to the shop.
291
+ */
292
+ heardVia?: string | null;
287
293
  }
288
294
  interface BookingDetailsOptions {
289
295
  /** The `attemptKey` the booking was submitted with; only that submit may add to it. */
@@ -416,8 +422,9 @@ interface SalesBookingsClient {
416
422
  /** A booking's current status by the id `submit` returned. */
417
423
  status(id: string): Promise<BookingOutcome>;
418
424
  /**
419
- * Add the vehicle or notes after booking (e.g. `rules.vehicleDeferred`). Pass the booking's
420
- * own `attemptKey`. Never rejects: they reach the shop's request, or the owner by text.
425
+ * Add the vehicle, notes or "How did you hear about us?" after booking (e.g.
426
+ * `rules.vehicleDeferred`, or an answer asked on the success screen). Pass the booking's own
427
+ * `attemptKey`. Never rejects: they reach the shop's request, or the owner by text.
421
428
  */
422
429
  updateBooking(bookingId: string, details: BookingDetailsInput, options: BookingDetailsOptions): Promise<BookingDetailsOutcome>;
423
430
  }
@@ -284,6 +284,12 @@ interface BookingDetailsInput {
284
284
  model: string;
285
285
  } | null;
286
286
  notes?: string | null;
287
+ /**
288
+ * The site's own "How did you hear about us?" answer, verbatim — the same values the form's
289
+ * `form_submit` `heardVia` field carries, so one answer reports the same whether it is asked
290
+ * on the form or on the success screen. Ours for reporting: never sent to the shop.
291
+ */
292
+ heardVia?: string | null;
287
293
  }
288
294
  interface BookingDetailsOptions {
289
295
  /** The `attemptKey` the booking was submitted with; only that submit may add to it. */
@@ -416,8 +422,9 @@ interface SalesBookingsClient {
416
422
  /** A booking's current status by the id `submit` returned. */
417
423
  status(id: string): Promise<BookingOutcome>;
418
424
  /**
419
- * Add the vehicle or notes after booking (e.g. `rules.vehicleDeferred`). Pass the booking's
420
- * own `attemptKey`. Never rejects: they reach the shop's request, or the owner by text.
425
+ * Add the vehicle, notes or "How did you hear about us?" after booking (e.g.
426
+ * `rules.vehicleDeferred`, or an answer asked on the success screen). Pass the booking's own
427
+ * `attemptKey`. Never rejects: they reach the shop's request, or the owner by text.
421
428
  */
422
429
  updateBooking(bookingId: string, details: BookingDetailsInput, options: BookingDetailsOptions): Promise<BookingDetailsOutcome>;
423
430
  }
package/dist/client.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
3
3
  import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, j as PhoneConfig, P as ParsedPhone, k as PhoneDisplayFormat } from './phone-utils-CM8eUPz8.mjs';
4
- import { T as TrackingConfigReference, C as ConversionConfig, i as BookingOutcome, g as BookingInput, a as BookingDetailsInput, c as BookingDetailsOutcome, S as SalesBookingsClient, f as BookingFormSubmit, j as BookingSimulation } from './bookings-DtcwdM_I.mjs';
5
- import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-C2OvZ7dp.mjs';
4
+ import { T as TrackingConfigReference, C as ConversionConfig, i as BookingOutcome, g as BookingInput, a as BookingDetailsInput, c as BookingDetailsOutcome, S as SalesBookingsClient, f as BookingFormSubmit, j as BookingSimulation } from './bookings-CUes6H05.mjs';
5
+ import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-CfjE2F18.mjs';
6
6
  import { CountryCode } from 'libphonenumber-js';
7
7
  import './form-submit-BLb28aCk.mjs';
8
8
  import 'zod/mini';
@@ -418,8 +418,8 @@ interface BookingSubmitState {
418
418
  */
419
419
  booked: BookedAttempt | null;
420
420
  /**
421
- * Add the vehicle or notes to `booked`, or to `target` (a persisted one). Resolves `not_found`
422
- * when there is neither.
421
+ * Add the vehicle, notes or "How did you hear about us?" to `booked`, or to `target` (a
422
+ * persisted one). Resolves `not_found` when there is neither.
423
423
  */
424
424
  updateBooking(details: BookingDetailsInput, target?: BookedAttempt): Promise<BookingDetailsOutcome>;
425
425
  /** Back to `idle` with a fresh attempt key, e.g. "book another car". */
package/dist/client.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
3
3
  import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, j as PhoneConfig, P as ParsedPhone, k as PhoneDisplayFormat } from './phone-utils-l8ey3Zdm.js';
4
- import { T as TrackingConfigReference, C as ConversionConfig, i as BookingOutcome, g as BookingInput, a as BookingDetailsInput, c as BookingDetailsOutcome, S as SalesBookingsClient, f as BookingFormSubmit, j as BookingSimulation } from './bookings-Bx7totlS.js';
5
- import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-B-BgEZdW.js';
4
+ import { T as TrackingConfigReference, C as ConversionConfig, i as BookingOutcome, g as BookingInput, a as BookingDetailsInput, c as BookingDetailsOutcome, S as SalesBookingsClient, f as BookingFormSubmit, j as BookingSimulation } from './bookings-D5TT6D8w.js';
5
+ import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-CNeWyI0U.js';
6
6
  import { CountryCode } from 'libphonenumber-js';
7
7
  import './form-submit-BLb28aCk.js';
8
8
  import 'zod/mini';
@@ -418,8 +418,8 @@ interface BookingSubmitState {
418
418
  */
419
419
  booked: BookedAttempt | null;
420
420
  /**
421
- * Add the vehicle or notes to `booked`, or to `target` (a persisted one). Resolves `not_found`
422
- * when there is neither.
421
+ * Add the vehicle, notes or "How did you hear about us?" to `booked`, or to `target` (a
422
+ * persisted one). Resolves `not_found` when there is neither.
423
423
  */
424
424
  updateBooking(details: BookingDetailsInput, target?: BookedAttempt): Promise<BookingDetailsOutcome>;
425
425
  /** Back to `idle` with a fresh attempt key, e.g. "book another car". */
package/dist/client.js CHANGED
@@ -4009,7 +4009,7 @@ function GoogleAdsTracking(props) {
4009
4009
  var import_react6 = require("react");
4010
4010
 
4011
4011
  // package.json
4012
- var version = "1.9.0";
4012
+ var version = "1.10.0";
4013
4013
 
4014
4014
  // ../tracking-core/src/phone-react.tsx
4015
4015
  var import_react5 = require("react");