@aranova/tracking-react 1.17.0 → 1.18.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 +16 -0
- package/dist/{bookings-2ZKfenQ7.d.ts → bookings-CCGpXhYE.d.ts} +39 -5
- package/dist/{bookings-DOh1WMhH.d.mts → bookings-CVvpj_8K.d.mts} +39 -5
- package/dist/client.d.mts +4 -4
- package/dist/client.d.ts +4 -4
- package/dist/client.js +260 -186
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +260 -186
- package/dist/client.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +46 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -33
- package/dist/index.mjs.map +1 -1
- package/dist/{ingest-typed-BO6Arbw-.d.mts → ingest-typed-C3XAjHlH.d.ts} +92 -2
- package/dist/{ingest-typed-D7I4aQ7p.d.ts → ingest-typed-CoCjTqJs.d.mts} +92 -2
- package/dist/{phone-utils-CYr6AmEP.d.mts → phone-utils-BlWj8oxq.d.mts} +1 -0
- package/dist/{phone-utils-CYr6AmEP.d.ts → phone-utils-BlWj8oxq.d.ts} +1 -0
- package/dist/phone.d.mts +1 -1
- package/dist/phone.d.ts +1 -1
- package/dist/{sales-I2jXSS-l.d.ts → sales-B1ONR-Yi.d.mts} +1 -1
- package/dist/{sales-B1u_IHLZ.d.mts → sales-Dlc_umAV.d.ts} +1 -1
- package/dist/sales.d.mts +3 -3
- package/dist/sales.d.ts +3 -3
- package/dist/sales.js +39 -33
- package/dist/sales.js.map +1 -1
- package/dist/sales.mjs +39 -33
- package/dist/sales.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -221,6 +221,22 @@ Development logs each contract violation, `debug` throws, production sends anywa
|
|
|
221
221
|
(tagged `invalid_shape`) rather than dropped. Full guide:
|
|
222
222
|
[docs/tracking-package/lead-forms.md](../../docs/tracking-package/lead-forms.md).
|
|
223
223
|
|
|
224
|
+
Optional questions after the submit (patient type, timing, how they heard) attach to that same
|
|
225
|
+
lead. Keep the handle `submit()` returns and pass it to `addDetails()` from the thank-you screen.
|
|
226
|
+
That screen is a `<section>` with buttons, never a second `<form>`: a form logs its own
|
|
227
|
+
`form_start` (a form never submitted, in the funnel) and submits on Enter.
|
|
228
|
+
|
|
229
|
+
```tsx
|
|
230
|
+
const { submission } = leadForms.submit({ formId: "booking-form", kind: "booking", fields });
|
|
231
|
+
setSubmission(submission); // then render the post-submit <section>
|
|
232
|
+
|
|
233
|
+
// "Add to my request" button's onClick: every role is optional here, nothing is owed.
|
|
234
|
+
leadForms.addDetails(submission, {
|
|
235
|
+
fields: { patient_type: answers.patientType, note: answers.note, email: answers.email },
|
|
236
|
+
extra: [{ key: "heard_from", label: "How did you hear about us?", value: answers.heardFrom }],
|
|
237
|
+
}); // { sent: false, reason: "no_fields" } when every answer is blank
|
|
238
|
+
```
|
|
239
|
+
|
|
224
240
|
## Phone Fields
|
|
225
241
|
|
|
226
242
|
Bundled `libphonenumber-js`: parse/format utils + a React input. Display is configurable; the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as LeadFormKind, r as LeadFormRole, o as LEAD_FORM_ROLE_SPECS, n as LEAD_FORM_ROLES, J as JsonValue, b as TrackingEnvironment, k as FormSubmitMetadata } from './phone-utils-
|
|
1
|
+
import { p as LeadFormKind, r as LeadFormRole, o as LEAD_FORM_ROLE_SPECS, n as LEAD_FORM_ROLES, J as JsonValue, b as TrackingEnvironment, k as FormSubmitMetadata } from './phone-utils-BlWj8oxq.js';
|
|
2
2
|
|
|
3
3
|
interface ServiceFiring {
|
|
4
4
|
send_to: string;
|
|
@@ -527,6 +527,18 @@ type LeadFormFields<C extends LeadFormContracts, K extends LeadFormKind> = {
|
|
|
527
527
|
} & {
|
|
528
528
|
[R in AddOnRole]?: boolean | Blank;
|
|
529
529
|
} & AllGroups<KindOf<C, K>, KindOf<C, K>["requiresAny"]>;
|
|
530
|
+
/** Who the lead is never changes after the submit; an email it lacked is the one exception. */
|
|
531
|
+
type DetailsRole = Exclude<RegistryRole, Exclude<{
|
|
532
|
+
[R in RegistryRole]: Specs[R] extends {
|
|
533
|
+
contactIdentity: true;
|
|
534
|
+
} ? R : never;
|
|
535
|
+
}[RegistryRole], "email">>;
|
|
536
|
+
/** Every non-identity role of one kind, all optional: details add to a sent lead, so none is owed. */
|
|
537
|
+
type LeadFormDetailsFields<C extends LeadFormContracts, K extends LeadFormKind> = {
|
|
538
|
+
[R in DetailsRole]?: LeadFormValue<KindOf<C, K>, R> | Blank;
|
|
539
|
+
} & {
|
|
540
|
+
[R in AddOnRole]?: boolean | Blank;
|
|
541
|
+
};
|
|
530
542
|
interface LeadFormExtraField {
|
|
531
543
|
key: string;
|
|
532
544
|
label: string;
|
|
@@ -541,6 +553,23 @@ interface LeadFormSubmitInput<C extends LeadFormContracts, K extends LeadFormKin
|
|
|
541
553
|
extra?: LeadFormExtraField[];
|
|
542
554
|
action?: string | null;
|
|
543
555
|
}
|
|
556
|
+
/** Names the lead one `submit()` sent, so `addDetails()` can add to it. */
|
|
557
|
+
interface LeadFormSubmission<K extends LeadFormKind = LeadFormKind> {
|
|
558
|
+
submissionId: string;
|
|
559
|
+
formId: string;
|
|
560
|
+
kind: K;
|
|
561
|
+
}
|
|
562
|
+
interface LeadFormDetailsInput<C extends LeadFormContracts, K extends LeadFormKind> {
|
|
563
|
+
fields: LeadFormDetailsFields<C, K>;
|
|
564
|
+
extra?: LeadFormExtraField[];
|
|
565
|
+
}
|
|
566
|
+
/** `no_fields`: every answer was blank, so nothing was sent. */
|
|
567
|
+
type LeadFormDetailsResult = {
|
|
568
|
+
sent: true;
|
|
569
|
+
} | {
|
|
570
|
+
sent: false;
|
|
571
|
+
reason: "no_fields";
|
|
572
|
+
};
|
|
544
573
|
/** Anything that can send a `form_submit`: `useTracking()` with `form_submit` registered. */
|
|
545
574
|
interface LeadFormTracking {
|
|
546
575
|
trackEvent(eventType: "form_submit", metadata: FormSubmitMetadata): void;
|
|
@@ -554,8 +583,12 @@ interface LeadFormSubmitOptions {
|
|
|
554
583
|
trackingConfig?: TrackingConfigReference;
|
|
555
584
|
}
|
|
556
585
|
interface LeadFormSubmitter<C extends LeadFormContracts> {
|
|
557
|
-
/** Send one typed `form_submit`; returns the metadata sent, violations included. */
|
|
558
|
-
submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata
|
|
586
|
+
/** Send one typed `form_submit`; returns the metadata sent, violations included, and its handle. */
|
|
587
|
+
submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata & {
|
|
588
|
+
submission: LeadFormSubmission<K>;
|
|
589
|
+
};
|
|
590
|
+
/** Add optional answers to a sent lead as one `form_details`; never a second lead. */
|
|
591
|
+
addDetails<K extends LeadFormKind>(submission: LeadFormSubmission<K>, input: LeadFormDetailsInput<C, K>): LeadFormDetailsResult;
|
|
559
592
|
}
|
|
560
593
|
/**
|
|
561
594
|
* Bind a tracking client to the site's generated contracts (`ARANOVA_LEAD_FORMS`).
|
|
@@ -563,7 +596,8 @@ interface LeadFormSubmitter<C extends LeadFormContracts> {
|
|
|
563
596
|
* @example
|
|
564
597
|
* ```ts
|
|
565
598
|
* const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
|
|
566
|
-
* leadForms.submit({ formId: "booking-form", kind: "booking", fields
|
|
599
|
+
* const { submission } = leadForms.submit({ formId: "booking-form", kind: "booking", fields });
|
|
600
|
+
* leadForms.addDetails(submission, { fields: { note } });
|
|
567
601
|
* ```
|
|
568
602
|
*/
|
|
569
603
|
declare function createLeadFormSubmit<C extends LeadFormContracts>(tracking: LeadFormTracking, contracts: C, options?: LeadFormSubmitOptions): LeadFormSubmitter<C>;
|
|
@@ -761,4 +795,4 @@ interface SalesBookingsClient {
|
|
|
761
795
|
/** A fresh per-submit key. Keep it for retries of the same submit; mint a new one after. */
|
|
762
796
|
declare const newBookingAttemptKey: typeof uuidV4;
|
|
763
797
|
|
|
764
|
-
export { type
|
|
798
|
+
export { slotFields as $, type LeadFormDetailsResult as A, type BookableDay as B, type ConversionConfig as C, type LeadFormExtraField as D, type LeadFormFields as E, type FormSubmitField as F, type LeadFormKindDecl as G, type LeadFormRequirementDecl as H, type LeadFormSubmission as I, type LeadFormSubmitInput as J, type LeadFormSubmitOptions as K, type LeadFormAddress as L, type LeadFormSubmitter as M, type LeadFormTimeWindow as N, type LeadFormTracking as O, type LeadFormValue as P, bookableSlots as Q, buildBookingHandoffUrl as R, type SalesBookingsClient as S, type TrackingConfigReference as T, getBookingIntegration as U, getTrackingConfigRuntime as V, groupBookingOptions as W, newBookingAttemptKey as X, resolveConversionConfig as Y, resolveTrackingConfigUrl as Z, shopToday as _, type BookingDetailsFailure as a, timeWindow as a0, createLeadFormSubmit as a1, TrackingConfigRuntime as a2, type BookingDetailsInput as b, type BookingDetailsOptions as c, type BookingDetailsOutcome as d, type BookingDetailsStatus as e, type BookingDropOff as f, type BookingFormSubmit as g, type BookingHandoffPrefill as h, type BookingInput as i, type BookingInputFor as j, type BookingIntegration as k, type BookingMode as l, type BookingOption as m, type BookingOptionGroup as n, type BookingOptionKey as o, type BookingOutcome as p, type BookingProvider as q, type BookingRules as r, type BookingServiceKey as s, type BookingSimulation as t, type BookingSubmitOptions as u, type BookingVehicle as v, type ConversionConfigStore as w, type LeadFormContracts as x, type LeadFormDetailsFields as y, type LeadFormDetailsInput as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as LeadFormKind, r as LeadFormRole, o as LEAD_FORM_ROLE_SPECS, n as LEAD_FORM_ROLES, J as JsonValue, b as TrackingEnvironment, k as FormSubmitMetadata } from './phone-utils-
|
|
1
|
+
import { p as LeadFormKind, r as LeadFormRole, o as LEAD_FORM_ROLE_SPECS, n as LEAD_FORM_ROLES, J as JsonValue, b as TrackingEnvironment, k as FormSubmitMetadata } from './phone-utils-BlWj8oxq.mjs';
|
|
2
2
|
|
|
3
3
|
interface ServiceFiring {
|
|
4
4
|
send_to: string;
|
|
@@ -527,6 +527,18 @@ type LeadFormFields<C extends LeadFormContracts, K extends LeadFormKind> = {
|
|
|
527
527
|
} & {
|
|
528
528
|
[R in AddOnRole]?: boolean | Blank;
|
|
529
529
|
} & AllGroups<KindOf<C, K>, KindOf<C, K>["requiresAny"]>;
|
|
530
|
+
/** Who the lead is never changes after the submit; an email it lacked is the one exception. */
|
|
531
|
+
type DetailsRole = Exclude<RegistryRole, Exclude<{
|
|
532
|
+
[R in RegistryRole]: Specs[R] extends {
|
|
533
|
+
contactIdentity: true;
|
|
534
|
+
} ? R : never;
|
|
535
|
+
}[RegistryRole], "email">>;
|
|
536
|
+
/** Every non-identity role of one kind, all optional: details add to a sent lead, so none is owed. */
|
|
537
|
+
type LeadFormDetailsFields<C extends LeadFormContracts, K extends LeadFormKind> = {
|
|
538
|
+
[R in DetailsRole]?: LeadFormValue<KindOf<C, K>, R> | Blank;
|
|
539
|
+
} & {
|
|
540
|
+
[R in AddOnRole]?: boolean | Blank;
|
|
541
|
+
};
|
|
530
542
|
interface LeadFormExtraField {
|
|
531
543
|
key: string;
|
|
532
544
|
label: string;
|
|
@@ -541,6 +553,23 @@ interface LeadFormSubmitInput<C extends LeadFormContracts, K extends LeadFormKin
|
|
|
541
553
|
extra?: LeadFormExtraField[];
|
|
542
554
|
action?: string | null;
|
|
543
555
|
}
|
|
556
|
+
/** Names the lead one `submit()` sent, so `addDetails()` can add to it. */
|
|
557
|
+
interface LeadFormSubmission<K extends LeadFormKind = LeadFormKind> {
|
|
558
|
+
submissionId: string;
|
|
559
|
+
formId: string;
|
|
560
|
+
kind: K;
|
|
561
|
+
}
|
|
562
|
+
interface LeadFormDetailsInput<C extends LeadFormContracts, K extends LeadFormKind> {
|
|
563
|
+
fields: LeadFormDetailsFields<C, K>;
|
|
564
|
+
extra?: LeadFormExtraField[];
|
|
565
|
+
}
|
|
566
|
+
/** `no_fields`: every answer was blank, so nothing was sent. */
|
|
567
|
+
type LeadFormDetailsResult = {
|
|
568
|
+
sent: true;
|
|
569
|
+
} | {
|
|
570
|
+
sent: false;
|
|
571
|
+
reason: "no_fields";
|
|
572
|
+
};
|
|
544
573
|
/** Anything that can send a `form_submit`: `useTracking()` with `form_submit` registered. */
|
|
545
574
|
interface LeadFormTracking {
|
|
546
575
|
trackEvent(eventType: "form_submit", metadata: FormSubmitMetadata): void;
|
|
@@ -554,8 +583,12 @@ interface LeadFormSubmitOptions {
|
|
|
554
583
|
trackingConfig?: TrackingConfigReference;
|
|
555
584
|
}
|
|
556
585
|
interface LeadFormSubmitter<C extends LeadFormContracts> {
|
|
557
|
-
/** Send one typed `form_submit`; returns the metadata sent, violations included. */
|
|
558
|
-
submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata
|
|
586
|
+
/** Send one typed `form_submit`; returns the metadata sent, violations included, and its handle. */
|
|
587
|
+
submit<K extends LeadFormKind>(input: LeadFormSubmitInput<C, K>): FormSubmitMetadata & {
|
|
588
|
+
submission: LeadFormSubmission<K>;
|
|
589
|
+
};
|
|
590
|
+
/** Add optional answers to a sent lead as one `form_details`; never a second lead. */
|
|
591
|
+
addDetails<K extends LeadFormKind>(submission: LeadFormSubmission<K>, input: LeadFormDetailsInput<C, K>): LeadFormDetailsResult;
|
|
559
592
|
}
|
|
560
593
|
/**
|
|
561
594
|
* Bind a tracking client to the site's generated contracts (`ARANOVA_LEAD_FORMS`).
|
|
@@ -563,7 +596,8 @@ interface LeadFormSubmitter<C extends LeadFormContracts> {
|
|
|
563
596
|
* @example
|
|
564
597
|
* ```ts
|
|
565
598
|
* const leadForms = createLeadFormSubmit(useTracking(), ARANOVA_LEAD_FORMS);
|
|
566
|
-
* leadForms.submit({ formId: "booking-form", kind: "booking", fields
|
|
599
|
+
* const { submission } = leadForms.submit({ formId: "booking-form", kind: "booking", fields });
|
|
600
|
+
* leadForms.addDetails(submission, { fields: { note } });
|
|
567
601
|
* ```
|
|
568
602
|
*/
|
|
569
603
|
declare function createLeadFormSubmit<C extends LeadFormContracts>(tracking: LeadFormTracking, contracts: C, options?: LeadFormSubmitOptions): LeadFormSubmitter<C>;
|
|
@@ -761,4 +795,4 @@ interface SalesBookingsClient {
|
|
|
761
795
|
/** A fresh per-submit key. Keep it for retries of the same submit; mint a new one after. */
|
|
762
796
|
declare const newBookingAttemptKey: typeof uuidV4;
|
|
763
797
|
|
|
764
|
-
export { type
|
|
798
|
+
export { slotFields as $, type LeadFormDetailsResult as A, type BookableDay as B, type ConversionConfig as C, type LeadFormExtraField as D, type LeadFormFields as E, type FormSubmitField as F, type LeadFormKindDecl as G, type LeadFormRequirementDecl as H, type LeadFormSubmission as I, type LeadFormSubmitInput as J, type LeadFormSubmitOptions as K, type LeadFormAddress as L, type LeadFormSubmitter as M, type LeadFormTimeWindow as N, type LeadFormTracking as O, type LeadFormValue as P, bookableSlots as Q, buildBookingHandoffUrl as R, type SalesBookingsClient as S, type TrackingConfigReference as T, getBookingIntegration as U, getTrackingConfigRuntime as V, groupBookingOptions as W, newBookingAttemptKey as X, resolveConversionConfig as Y, resolveTrackingConfigUrl as Z, shopToday as _, type BookingDetailsFailure as a, timeWindow as a0, createLeadFormSubmit as a1, TrackingConfigRuntime as a2, type BookingDetailsInput as b, type BookingDetailsOptions as c, type BookingDetailsOutcome as d, type BookingDetailsStatus as e, type BookingDropOff as f, type BookingFormSubmit as g, type BookingHandoffPrefill as h, type BookingInput as i, type BookingInputFor as j, type BookingIntegration as k, type BookingMode as l, type BookingOption as m, type BookingOptionGroup as n, type BookingOptionKey as o, type BookingOutcome as p, type BookingProvider as q, type BookingRules as r, type BookingServiceKey as s, type BookingSimulation as t, type BookingSubmitOptions as u, type BookingVehicle as v, type ConversionConfigStore as w, type LeadFormContracts as x, type LeadFormDetailsFields as y, type LeadFormDetailsInput as z };
|
package/dist/client.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-
|
|
4
|
-
import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-
|
|
5
|
-
export {
|
|
6
|
-
import {
|
|
3
|
+
import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-BlWj8oxq.mjs';
|
|
4
|
+
import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-CVvpj_8K.mjs';
|
|
5
|
+
export { a1 as createLeadFormSubmit } from './bookings-CVvpj_8K.mjs';
|
|
6
|
+
import { O as TriggerRegistryConfig, U as TypedTrackingClient } from './ingest-typed-CoCjTqJs.mjs';
|
|
7
7
|
import { CountryCode } from 'libphonenumber-js';
|
|
8
8
|
import 'zod/mini';
|
|
9
9
|
import 'zod/v4/core';
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-
|
|
4
|
-
import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-
|
|
5
|
-
export {
|
|
6
|
-
import {
|
|
3
|
+
import { G as GtagEnvironmentMap, M as MetaPixelEnvironmentMap, h as ConsentState, f as ConsentChoiceState, g as ConsentSource, T as TrackingParams, b as TrackingEnvironment, u as PhoneConfig, P as ParsedPhone, v as PhoneDisplayFormat } from './phone-utils-BlWj8oxq.js';
|
|
4
|
+
import { T as TrackingConfigReference, C as ConversionConfig, h as BookingHandoffPrefill, i as BookingInput, p as BookingOutcome, b as BookingDetailsInput, d as BookingDetailsOutcome, k as BookingIntegration, B as BookableDay, x as LeadFormContracts, S as SalesBookingsClient, g as BookingFormSubmit, t as BookingSimulation, j as BookingInputFor } from './bookings-CCGpXhYE.js';
|
|
5
|
+
export { a1 as createLeadFormSubmit } from './bookings-CCGpXhYE.js';
|
|
6
|
+
import { O as TriggerRegistryConfig, U as TypedTrackingClient } from './ingest-typed-C3XAjHlH.js';
|
|
7
7
|
import { CountryCode } from 'libphonenumber-js';
|
|
8
8
|
import 'zod/mini';
|
|
9
9
|
import 'zod/v4/core';
|