@aranova/tracking-react 1.12.0 → 1.14.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.
Files changed (36) hide show
  1. package/README.md +31 -3
  2. package/dist/{bookings-v_ucn93l.d.ts → bookings-Bw2ImtPd.d.ts} +3 -1
  3. package/dist/{bookings-Lmi0o_PA.d.mts → bookings-CDGNZUaH.d.mts} +3 -1
  4. package/dist/client.d.mts +5 -4
  5. package/dist/client.d.ts +5 -4
  6. package/dist/client.js +369 -40
  7. package/dist/client.js.map +1 -1
  8. package/dist/client.mjs +367 -39
  9. package/dist/client.mjs.map +1 -1
  10. package/dist/{form-submit-CX-CxJjQ.d.mts → form-submit-C_vJXCxh.d.mts} +11 -1
  11. package/dist/{form-submit-CX-CxJjQ.d.ts → form-submit-C_vJXCxh.d.ts} +11 -1
  12. package/dist/index.d.mts +9 -180
  13. package/dist/index.d.ts +9 -180
  14. package/dist/index.js +332 -285
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +329 -285
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/{phone-utils-D12FW8tT.d.ts → phone-utils-Cfdx474X.d.mts} +178 -3
  19. package/dist/{phone-utils-BNiSqeF7.d.mts → phone-utils-D2TGPCQW.d.ts} +178 -3
  20. package/dist/phone.d.mts +2 -2
  21. package/dist/phone.d.ts +2 -2
  22. package/dist/phone.js +2 -2
  23. package/dist/phone.js.map +1 -1
  24. package/dist/phone.mjs +2 -2
  25. package/dist/phone.mjs.map +1 -1
  26. package/dist/{sales-6vMEcopj.d.mts → sales-D4aU73mR.d.mts} +1 -1
  27. package/dist/{sales-DXLGjJQ6.d.ts → sales-DkdrGIUS.d.ts} +1 -1
  28. package/dist/sales.d.mts +3 -3
  29. package/dist/sales.d.ts +3 -3
  30. package/dist/sales.js +193 -171
  31. package/dist/sales.js.map +1 -1
  32. package/dist/sales.mjs +193 -171
  33. package/dist/sales.mjs.map +1 -1
  34. package/dist/{ingest-typed-B9I1c7jr.d.ts → submit-DuvP5AGN.d.ts} +161 -4
  35. package/dist/{ingest-typed-PKFEuJ8E.d.mts → submit-rqgXl-Wg.d.mts} +161 -4
  36. package/package.json +1 -1
package/README.md CHANGED
@@ -195,6 +195,32 @@ page unload it records the **active** (visible) time spent on the page plus the
195
195
  depth reached, delivered via a keepalive beacon so the final page still counts. This powers
196
196
  per-page dwell and drop-off in the dashboard Analytics tab; there is nothing to configure.
197
197
 
198
+ ## Typed lead forms
199
+
200
+ Generate the site's lead-form contract once and send submits through it, so a dropped required
201
+ field fails `tsc` instead of losing leads:
202
+
203
+ ```bash
204
+ npx @aranova/tracking-cli forms gen # writes src/aranova-lead-forms.ts; `forms check` in CI
205
+ ```
206
+
207
+ ```tsx
208
+ import { createLeadFormSubmit, slotFields } from "@aranova/tracking-react";
209
+ import { ARANOVA_LEAD_FORMS } from "@/aranova-lead-forms";
210
+
211
+ const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
212
+ leadForms.submit({
213
+ formId: "booking-form",
214
+ kind: "booking",
215
+ fields: { given_name: values.firstName, phone: values.phone, ...slotFields(values.slot) },
216
+ });
217
+ ```
218
+
219
+ Development logs each contract violation, `debug` throws, production sends anyway tagged
220
+ `form.contract_violations`. A malformed hand-built `form_submit` is salvaged in production
221
+ (tagged `invalid_shape`) rather than dropped. Full guide:
222
+ [docs/tracking-package/lead-forms.md](../../docs/tracking-package/lead-forms.md).
223
+
198
224
  ## Phone Fields
199
225
 
200
226
  Bundled `libphonenumber-js`: parse/format utils + a React input. Display is configurable; the
@@ -362,9 +388,11 @@ await submit({
362
388
  `[{ group, options }]` in order, so render one heading per group with its choices under it.
363
389
  - `useBookingSlots` / `bookableSlots(rules, { timeZone })` offer exactly the portal's start hours,
364
390
  judged by the shop's date. `useBookingSubmit` reuses one attempt key across a double-click or
365
- a retry, and sends the visit's `form_submit` once: don't send your own for this form. Add the
366
- form's own questions with `formSubmit.extraFields`; a name the booking already reports
367
- (`phone`, `email`, ...) is dropped.
391
+ a retry, and sends the visit's `form_submit` once: don't send your own for this form. It is a
392
+ typed `booking` submit (ADR-0024): every field carries its contract `role`, `service` is the
393
+ option keys, `preferred_date` is `YYYY-MM-DD`, `preferred_time` is
394
+ `{ start: "HH:00", end: null }`, and `drop_off` is `wait-for-it` / `drop-off`. Add the form's own questions with
395
+ `formSubmit.extraFields`; a name the booking already reports (`phone`, `email`, ...) is dropped.
368
396
  - Ask for the last name separately, and a mobile number (the shop's confirmation text goes to it).
369
397
  - Details after booking (when `booking.rules.vehicleDeferred`, for extra notes, or for the site's
370
398
  own "How did you hear about us?" answer):
@@ -1,4 +1,4 @@
1
- import { a as FormSubmitMetadata } from './form-submit-CX-CxJjQ.js';
1
+ import { b as FormSubmitMetadata } from './form-submit-C_vJXCxh.js';
2
2
 
3
3
  interface ServiceFiring {
4
4
  send_to: string;
@@ -297,6 +297,8 @@ declare class TrackingConfigRuntime {
297
297
  * link is safe to show stale. Same reference until the next adopt, for `useSyncExternalStore`.
298
298
  */
299
299
  integrations(): ConversionIntegrations | null;
300
+ /** The lead-form contracts, from the cached object like `integrations()`. */
301
+ leadForms(): LeadFormsConfig | null;
300
302
  private revalidateNow;
301
303
  private expireAuthority;
302
304
  private confirm;
@@ -1,4 +1,4 @@
1
- import { a as FormSubmitMetadata } from './form-submit-CX-CxJjQ.mjs';
1
+ import { b as FormSubmitMetadata } from './form-submit-C_vJXCxh.mjs';
2
2
 
3
3
  interface ServiceFiring {
4
4
  send_to: string;
@@ -297,6 +297,8 @@ declare class TrackingConfigRuntime {
297
297
  * link is safe to show stale. Same reference until the next adopt, for `useSyncExternalStore`.
298
298
  */
299
299
  integrations(): ConversionIntegrations | null;
300
+ /** The lead-form contracts, from the cached object like `integrations()`. */
301
+ leadForms(): LeadFormsConfig | null;
300
302
  private revalidateNow;
301
303
  private expireAuthority;
302
304
  private confirm;
package/dist/client.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
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-BNiSqeF7.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-Lmi0o_PA.mjs';
5
- import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-PKFEuJ8E.mjs';
3
+ import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, s as PhoneConfig, P as ParsedPhone, t as PhoneDisplayFormat } from './phone-utils-Cfdx474X.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-CDGNZUaH.mjs';
5
+ import { a7 as TriggerRegistryConfig, a9 as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './submit-rqgXl-Wg.mjs';
6
+ export { ai as createLeadFormSubmit } from './submit-rqgXl-Wg.mjs';
6
7
  import { CountryCode } from 'libphonenumber-js';
7
- import './form-submit-CX-CxJjQ.mjs';
8
+ import './form-submit-C_vJXCxh.mjs';
8
9
  import 'zod/mini';
9
10
  import 'zod/v4/core';
10
11
 
package/dist/client.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, CSSProperties, InputHTMLAttributes, ChangeEvent, FocusEvent, AnchorHTMLAttributes } from 'react';
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-D12FW8tT.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-v_ucn93l.js';
5
- import { X as TriggerRegistryConfig, Z as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './ingest-typed-B9I1c7jr.js';
3
+ import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, s as PhoneConfig, P as ParsedPhone, t as PhoneDisplayFormat } from './phone-utils-D2TGPCQW.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-Bw2ImtPd.js';
5
+ import { a7 as TriggerRegistryConfig, a9 as TypedTrackingClient, a as BookingHandoffPrefill, b as BookingIntegration, B as BookableDay } from './submit-DuvP5AGN.js';
6
+ export { ai as createLeadFormSubmit } from './submit-DuvP5AGN.js';
6
7
  import { CountryCode } from 'libphonenumber-js';
7
- import './form-submit-CX-CxJjQ.js';
8
+ import './form-submit-C_vJXCxh.js';
8
9
  import 'zod/mini';
9
10
  import 'zod/v4/core';
10
11